NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Plx.h
1 #ifndef __PLX_H
2 #define __PLX_H
3 
4 /*******************************************************************************
5  * Copyright (c) PLX Technology, Inc.
6  *
7  * PLX Technology Inc. licenses this source file under the GNU Lesser General Public
8  * License (LGPL) version 2. This source file may be modified or redistributed
9  * under the terms of the LGPL and without express permission from PLX Technology.
10  *
11  * PLX Technology, Inc. provides this software AS IS, WITHOUT ANY WARRANTY,
12  * EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF
13  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. PLX makes no guarantee
14  * or representations regarding the use of, or the results of the use of,
15  * the software and documentation in terms of correctness, accuracy,
16  * reliability, currentness, or otherwise; and you rely on the software,
17  * documentation and results solely at your own risk.
18  *
19  * IN NO EVENT SHALL PLX BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
20  * LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
21  * OF ANY KIND.
22  *
23  ******************************************************************************/
24 
25 /******************************************************************************
26  *
27  * File Name:
28  *
29  * Plx.h
30  *
31  * Description:
32  *
33  * This file contains definitions that are common to all PCI SDK code
34  *
35  * Revision:
36  *
37  * 04-01-13 : PLX SDK v7.10
38  *
39  ******************************************************************************/
40 
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 
48 
49 /**********************************************
50 * Definitions
51 **********************************************/
52 // SDK Version information
53 #define PLX_SDK_VERSION_MAJOR 7
54 #define PLX_SDK_VERSION_MINOR 10
55 #define PLX_SDK_VERSION_STRING "7.10"
56 #define PLX_SDK_COPYRIGHT_STRING "\251 PLX Technology, Inc. 2013"
57 
58 #define MAX_PCI_BUS 255 // Max PCI Buses
59 #define MAX_PCI_DEV 32 // Max PCI Slots
60 #define MAX_PCI_FUNC 8 // Max PCI Functions
61 #define PCI_NUM_BARS_TYPE_00 6 // Total PCI BARs for Type 0 Header
62 #define PCI_NUM_BARS_TYPE_01 2 // Total PCI BARs for Type 1 Header
63 
64 #define PLX_VENDOR_ID 0x10B5 // PLX Vendor ID
65 
66 // Device object validity codes
67 #define PLX_TAG_VALID 0x5F504C58 // "_PLX" in Hex
68 #define PLX_TAG_INVALID 0x564F4944 // "VOID" in Hex
69 #define ObjectValidate(pObj) ((pObj)->IsValidTag = PLX_TAG_VALID)
70 #define ObjectInvalidate(pObj) ((pObj)->IsValidTag = PLX_TAG_INVALID)
71 #define IsObjectValid(pObj) ((pObj)->IsValidTag == PLX_TAG_VALID)
72 
73 // Used for locating PCI devices
74 #define PCI_FIELD_IGNORE (-1)
75 
76 // Used for VPD accesses
77 #define VPD_COMMAND_MAX_RETRIES 5 // Max number VPD command re-issues
78 #define VPD_STATUS_MAX_POLL 10 // Max number of times to read VPD status
79 #define VPD_STATUS_POLL_DELAY 5 // Delay between polling VPD status (Milliseconds)
80 
81 // Define a large value for a signal to the driver
82 #define FIND_AMOUNT_MATCHED 80001
83 
84 // Used for performance counter calculations
85 #define PERF_TLP_OH_DW 2 // Overhead DW per TLP
86 #define PERF_TLP_DW (3 + PERF_TLP_OH_DW) // DW per TLP
87 #define PERF_TLP_SIZE (PERF_TLP_DW * sizeof(U32)) // Bytes per TLP w/o payload
88 #define PERF_DLLP_SIZE (2 * sizeof(U32)) // Bytes per DLLP
89 #define PERF_MAX_BPS_GEN_1_0 ((U64)250000000) // 250 MBps (2.5 Gbps * 80%)
90 #define PERF_MAX_BPS_GEN_2_0 ((U64)500000000) // 500 MBps (5 Gbps * 80%)
91 #define PERF_MAX_BPS_GEN_3_0 ((U64)1000000000) // 1 GBps (8 Gbps)
92 
93 // Endian swap macros
94 #define EndianSwap32(value) ( ((((value) >> 0) & 0xff) << 24) | \
95  ((((value) >> 8) & 0xff) << 16) | \
96  ((((value) >> 16) & 0xff) << 8) | \
97  ((((value) >> 24) & 0xff) << 0) )
98 
99 #define EndianSwap16(value) ( ((((value) >> 0) & 0xffff) << 16) | \
100  ((((value) >> 16) & 0xffff) << 0) )
101 
102 // PCIe ReqID support macros
103 #define Plx_PciToReqId(bus,slot,fn) (((U16)bus << 8) | (slot << 3) | (fn << 0))
104 #define Plx_ReqId_Bus(ReqId) ((U8)(ReqId >> 8) & 0xFF)
105 #define Plx_ReqId_Slot(ReqId) ((U8)(ReqId >> 3) & 0x1F)
106 #define Plx_ReqId_Fn(ReqId) ((U8)(ReqId >> 0) & 0x7)
107 
108 
109 // Device IDs of PLX reference boards
110 #define PLX_9080RDK_960_DEVICE_ID 0x0960
111 #define PLX_9080RDK_401B_DEVICE_ID 0x0401
112 #define PLX_9080RDK_860_DEVICE_ID 0x0860
113 #define PLX_9054RDK_860_DEVICE_ID 0x1860
114 #define PLX_9054RDK_LITE_DEVICE_ID 0x5406
115 #define PLX_CPCI9054RDK_860_DEVICE_ID 0xC860
116 #define PLX_9056RDK_LITE_DEVICE_ID 0x5601
117 #define PLX_9056RDK_860_DEVICE_ID 0x56c2
118 #define PLX_9656RDK_LITE_DEVICE_ID 0x9601
119 #define PLX_9656RDK_860_DEVICE_ID 0x96c2
120 #define PLX_9030RDK_LITE_DEVICE_ID 0x3001
121 #define PLX_CPCI9030RDK_LITE_DEVICE_ID 0x30c1
122 #define PLX_9050RDK_LITE_DEVICE_ID 0x9050
123 #define PLX_9052RDK_LITE_DEVICE_ID 0x5201
124 
125 
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif