StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ddl_def.h
1 #ifndef _ddl_def_
2 #define _ddl_def_
3 
4 /************************************************
5 * ddl_def.h *
6 * last update: 22/01/2007 *
7 * common file for old and new ddl cards *
8 * written by: Peter Csato and Ervin Denes *
9 ************************************************/
10 
11 /* wait cycles for DDL respond */
12 #define DDL_TIMEOUT 100000
13 #define DDL_RESPONSE_TIME 1000
14 #define DDL_MAX_WAIT_CYCLE 0x7fffffffffffffffULL
15 #define DDL_MAX_REPLY 4
16 #define DDL_MAX_HW_ID 64
17 #define DDL_MAX_JTAG_LEN 100
18 
19 /* maximum size of DDL events */
20 #define DDL_MAX_WORD 0x07FFFF
21 #define DDL_MAX_BYTE 0x1FFFFC
22 #define DDL_HEADER_SIZE_BYTE 32
23 #define DDL_HEADER_SIZE_WORD 8
24 
25 /* maximum size of a simulated event sent by the DDG */
26 #define DDL_MAX_TX_WORD 0xFFFFFF
27 
28 /* destination field */
29 #define RORC 0
30 #define DIU 1
31 #define SIU 2
32 #define DSI 3
33 #define FEE 4
34 #define JTAG 8
35 
36 /* command field */
37 /* FEE commands */
38 #define RDYRX 1 /* Ready to Receive */
39 #define EOBTR 11 /* End of Block Transfer */
40 #define STBWR 13 /* Start of Block Write */
41 #define STBRD 5 /* Start of Block Read */
42 #define FECTRL 12 /* Front-end control */
43 #define FESTRD 4 /* Front-end status readout */
44 
45 /* interface commands */
46 #define LRST 10 /* Link Reset */
47 #define SUSPEND 10 /* Go to Power Off state */
48 #define LINIT 11 /* Link Initialisation */
49 #define WAKEUP 11 /* Wake up from Power Off state */
50 #define SRST 15 /* SIU Reset */
51 #define IFLOOP 9 /* DIU Transmitter or SIU Receiver Loop-back */
52 #define TSTOP 12 /* Self-test Stop */
53 #define TSTMODE 13 /* Self-test Start */
54 #define DTCC 8 /* Data Transmission Check Command */
55 #define RFWVER 4 /* Read Firmware Version of DIU or SIU */
56 #define RHWVER 6 /* Read Hardware Version of DIU or SIU */
57 #define RPMVAL 7 /* Read Power Monitor Value */
58 #define RandCIFST 0 /* Read & Clear Interface Status Word */
59 
60 /* JTAG commands */
61 #define JSTART 13 /* Start JTAG block */
62 #define JTSTW 8 /* JTAG transmission check command */
63 #define EOJTR 11 /* End of JTAG Transfer */
64 
65 /* PRBS Test Mode command parameters */
66 #define STRPRBS 1 /* Start PRBS test */
67 #define STPPRBS 0 /* Stop PRBS test */
68 #define CLRPRBS 3 /* Clear PRBS Counter */
69 #define RDPRBS 0x40000 /* Read PRBS Counter */
70 
71 /* status codes */
72 #define CTSTW 0 /* CTSTW */
73 #define CTSTW_TO 1 /* CTSTW for Front-End TimeOut */
74 #define ILCMD 2 /* CTSTW for illegal command */
75 #define FESTW 4 /* FESTW */
76 #define HWSTW 6 /* HWSTW */
77 #define PMVAL 7 /* Power Monitor Value */
78 #define DTSTW 8 /* DTSTW */
79 #define DTSTW_TO 9 /* DTSTW with Front-End TimeOut*/
80 #define IFSTW 12 /* IFSTW */
81 #define TEVAL 13 /* Test Mode Error Value */
82 #define FWSTW 14 /* FWSTW */
83 
84 /* data transmission status word */
85 #define DTSW 0x00000082
86 #define CONTINUATION_BIT 0x00000100
87 #define EOB 0x000000b4 /* End of block command */
88 #define CTSW 0x00000002 /* Command Transmission Status word */
89 #define JSTR 0x000000d2 /* Start of JTAG block */
90 #define JTSW 0x00000088 /* End of JTAG block */
91 
92 /* masks for DIU/SIU status word */
93 #define STMASK 0xFFFFF0FF /* status word without ID# */
94 #define DIUMASK 0xBFFC7000 /* DIU port states (without loop-back bit) */
95 #define REMMASK 0x00038000 /* Remote SIU/DIU states */
96 #define DIUSTMASK 0x00007000 /* DIU port states */
97 #define SIUSTMASK 0x00007000 /* SIU port states */
98 #define DIUERMASK 0xBFFC0000 /* DIU error states */
99 
100 /* DIU version */
101 
102 #define NOT_DEF -1
103 #define NO_DIU 0
104 #define OLD 1
105 #define NEW 2
106 #define EMBEDDED 3
107 
108 /* status/error bits for NEW (CMC connector) link cards */
109 
110 /* DIU status/error bits */
111 #define ERROR_BIT 0x80000000 /* error bit */
112 #define DIU_LOOP 0x40000000 /* DIU loop-back mode */
113 #define LOSS_SYNC 0x20000000 /* loss of synchronization */
114 #define D_TXOF 0x10000000 /* transmit data/status overflow */
115 #define D_RES1 0x08000000 /* reserved */
116 #define D_OSINFR 0x04000000 /* ordered set in frame */
117 #define D_INVRX 0x02000000 /* invalide receive word */
118 #define D_CERR 0x01000000 /* CRC error */
119 #define D_RES2 0x00800000 /* reserved */
120 #define D_DOUT 0x00400000 /* data word out of frame */
121 #define D_IFDL 0x00200000 /* illegal frame delimiter */
122 #define D_LONG 0x00100000 /* too long frame */
123 #define D_RXOF 0x00080000 /* received data/status overflow */
124 #define D_FRERR 0x00040000 /* error in receive frame */
125 
126 /* masks for DIU port states */
127 #define DIU_TSTM 0x00007000 /* DIU in PRBS Test Mode state */
128 #define DIU_POFF 0x00006000 /* DIU in Power Off state */
129 #define DIU_LOS 0x00005000 /* DIU in Offline and Loss of Synchro state */
130 #define DIU_NOSIG 0x00004000 /* DIU in Offline and No Signal state */
131 #define DIU_WAIT 0x00003000 /* DIU in Waiting for Power Off state */
132 #define DIU_ONL 0x00002000 /* DIU in Online state */
133 #define DIU_OFFL 0x00001000 /* DIU in Offline state */
134 #define DIU_POR 0x00000000 /* DIU in Power On Reset state */
135 
136 /* SIU status/error bits */
137 #define S_LONGE 0x40000000 /* too long event or read data block */
138 #define S_IFEDS 0x20000000 /* illegal FEE data/status */
139 #define S_TXOF 0x10000000 /* transmit FIFO overflow */
140 #define S_IWDAT 0x08000000 /* illegal write data word */
141 #define S_OSINFR 0x04000000 /* ordered set inside a frame */
142 #define S_INVRX 0x02000000 /* invalid character inside a frame */
143 #define S_CERR 0x01000000 /* CRC error */
144 #define S_DJLERR 0x00800000 /* DTCC / JTCC error */
145 #define S_DOUT 0x00400000 /* data out of receive frame */
146 #define S_IFDL 0x00200000 /* illegal frame delimiter (SOF) */
147 #define S_LONG 0x00100000 /* too long receive frame */
148 #define S_RXOF 0x00080000 /* receive FIFO overflow */
149 #define S_FRERR 0x00040000 /* error in receive frame */
150 #define S_LPERR 0x00020000 /* link protocol error */
151 #define S_LBMOD 0x00010000 /* SIU in Loop Back Mode */
152 #define S_OPTRAN 0x00008000 /* open FEE transaction */
153 
154 /* masks for SIU port states */
155 #define SIU_RESERV 0x00007000 /* reserved */
156 #define SIU_POFF 0x00006000 /* SIU in Power Off state */
157 #define SIU_LOS 0x00005000 /* SIU in Offline and Loss of Synchro state */
158 #define SIU_NOSIG 0x00004000 /* SIU in Offline and No Signal state */
159 #define SIU_WAIT 0x00003000 /* SIU in Waiting for Power Off state */
160 #define SIU_ONL 0x00002000 /* SIU in Online state */
161 #define SIU_OFFL 0x00001000 /* SIU in Offline state */
162 #define SIU_POR 0x00000000 /* SIU in Power On Reset state */
163 
164 
165 /* status/error bits for OLD link cards */
166 
167 /* DIU status/error bits */
168 #define oDIU_LOOP 0x40000000 /* DIU loop-back mode */
169 #define oLOSS_SIGN 0x20000000 /* loss of signal */
170 #define oD_RTOUT 0x10000000 /* receiver synchronisation time-out */
171 #define oD_LOSY 0x08000000 /* loss or word synchronisation */
172 #define oD_RDERR 0x04000000 /* running disparity error */
173 #define oD_INVRX 0x02000000 /* invalide receive word */
174 #define oD_CERR 0x01000000 /* CRC error */
175 #define oD_UNREC 0x00800000 /* unrecognised ordered set received */
176 #define oD_DOUT 0x00400000 /* data word out of frame */
177 #define oD_IFDL 0x00200000 /* illegal frame delimiter */
178 #define oD_LONG 0x00100000 /* too long frame */
179 #define oD_RXOV 0x00080000 /* received data/status overflow */
180 #define oD_LTOUT 0x00040000 /* link initialisation time-out */
181 
182 /* masks for received ordered sets */
183 #define oSIU_SRST 0x00038000 /* Remote DIU in Reset state, sends SRST */
184 #define oSIU_FAIL 0x00030000 /* Remote SIU/DIU in fail state, sends Not_Op */
185 #define oSIU_OFFL 0x00028000 /* Remote SIU/DIU in offl. state, sends Oper */
186 #define oSIU_LINIT 0x00020000 /* Remote DIU is sending L_Init */
187 #define oSIU_ACT 0x00018000 /* Remote SIU/DIU in active state, sends Idle */
188 #define oSIU_XOFF 0x00010000 /* Remote SIU/DIU sends Xoff */
189 #define oSIU_XON 0x00008000 /* Remote SIU/DIU sends Xon*/
190 #define oSIU_ELSE 0x00000000 /* Remote SIU/DIU is sending data or delimiter */
191 
192 /* masks for DIU port states */
193 #define oDIU_NOSYNC 0x00007000 /* receiver not synchronised state */
194 #define oDIU_RSTSIU 0x00006000 /* DIU idle (reset SIU) state */
195 #define oDIU_FAIL 0x00005000 /* DIU fail state */
196 #define oDIU_OFFL 0x00004000 /* DIU offline state */
197 #define oDIU_LRES 0x00003000 /* DIU LRES metastable state */
198 #define oDIU_START 0x00002000 /* DIU START metastable state */
199 #define oDIU_ACCED 0x00001000 /* DIU ACCED metastable state */
200 #define oLINK_ACT 0x00000000 /* link active state */
201 
202 /* SIU status/error bits */
203 #define oS_LONGE 0x40000000 /* too long event or read data block */
204 #define oS_IFEDS 0x20000000 /* illegal FEE data/status */
205 #define oS_TXOF 0x10000000 /* transmit FIFO overflow */
206 #define oS_IWDAT 0x08000000 /* illegal write data word */
207 #define oS_WBLER 0x04000000 /* write data block length error */
208 #define oS_RXOV 0x02000000 /* receive FIFO overflow */
209 #define oS_LONGD 0x01000000 /* too long data frame */
210 #define oS_LONGC 0x00800000 /* too long command frame */
211 #define oS_OSIN 0x00400000 /* ordered set inside a frame */
212 #define oS_DOUT 0x00200000 /* data out of receive frame */
213 #define oS_LPERR 0x00100000 /* link protocol error */
214 #define oS_CHERR 0x00080000 /* check summ error in receive frame */
215 #define oS_UNREC 0x00040000 /* unrecognised ordered set */
216 #define oS_INVRX 0x00020000 /* invalid receive word */
217 #define oS_WALER 0x00010000 /* word alignment error */
218 #define oS_ISPCH 0x00008000 /* illegal special character */
219 #define oS_RDERR 0x00004000 /* running disparity error */
220 #define oS_IRXCD 0x00002000 /* illegal receive code */
221 #define oS_BUFER 0x00001000 /* elastic buffer over/under run */
222 
223 #endif