source: drsdaq/VME/atlas/include/vme_rcc/vme_rcc_common.h@ 152

Last change on this file since 152 was 22, checked in by ogrimm, 16 years ago
First commit of drsdaq program
  • Property svn:executable set to *
File size: 6.4 KB
Line 
1// $Id: vme_rcc_common.h,v 1.13 2007/11/08 07:56:44 joos Exp $
2/************************************************************************/
3/* */
4/* File: vme_rcc_common.h */
5/* */
6/* This is the common public header file for RCC VMEbus library */
7/* and driver */
8/* */
9/* 2. Nov. 01 MAJO created */
10/* 2. Nov. 01 JOP interrupts */
11/* 26 Nov. 01 JOP bus errors */
12/* 19 Apr. 02 JOP ROAK / RORA */
13/* 27 May. 02 JOP modify interrupt API */
14/* */
15/************ C 2005 - The software with that certain something *********/
16
17#ifndef _VME_RCC_COMMON_H
18#define _VME_RCC_COMMON_H
19
20#ifdef __KERNEL__
21 #include <linux/types.h>
22 #define P_ID_VMERCC 2 // Needs to be re-defined here since we do not want to include rcc_error.h at this level
23#else
24 #include <sys/types.h>
25#endif
26
27/***************/
28/*CCT SBC types*/
29/***************/
30#define VP_UNKNOWN 0
31#define VP_PSE 1
32#define VP_PMC 2
33#define VP_100 3
34#define VP_CP1 4
35#define VP_110 5
36#define VP_315 6
37#define VP_317 7
38#define VP_325 8
39
40/*******************/
41/* Other constants */
42/*******************/
43#define TEXT_SIZE1 3000
44#define TEXT_SIZE2 20000
45#define VME_MAXINTERRUPT 256 // Max # vectors per handle
46#define VME_MAX_BERR_PROCS 10 // Max # processes with BERR handling
47#define VME_MAX_MASTERMAP 200 // Max # of concurrent master mappings in all processes
48#define VME_MAXCHAINEL 32 //Max number of elements in DMA chain
49#define VME_MAXCHAIN 16 //Max number of internal DMA chains
50#define DMA_DESC_SIZE (VME_MAXCHAINEL * VME_MAXCHAIN * sizeof(VME_DmaChain_t))
51
52enum
53{
54 VME_LEVELISDISABLED = 0,
55 VME_INT_ROAK,
56 VME_INT_RORA
57};
58
59/*************/
60/*error codes*/
61/*************/
62
63//error codes
64enum
65{
66 VME_SUCCESS = 0,
67 VME_NOTKNOWN = (P_ID_VMERCC << 8) + 1,
68 VME_UNKNOWN,
69 VME_NOTOPEN,
70 VME_RANGE,
71 VME_BUSERROR,
72 VME_ALIGN,
73 VME_NOCHAINMEM,
74 VME_NOBUSERROR,
75 VME_TOOLONG,
76 VME_DMABUSY, // 10
77 VME_TIMEOUT,
78 VME_FILE,
79 VME_NOMAP,
80 VME_NOSTATMAP,
81 VME_IRGBUSY,
82 VME_EIO,
83 VME_EFAULT,
84 VME_VIRT,
85 VME_REMAP,
86 VME_ENOSYS, // 20
87 VME_NOSIZE,
88 VME_CMEM_FAIL,
89 VME_ERESTARTSYS,
90 VME_DMAERR,
91 VME_PCI_ERR,
92 VME_VME_ERR,
93 VME_PROTOCOL_ERR,
94 VME_NOT_EXECUTED,
95 VME_MUNMAP,
96 VME_ILLREV, // 30
97 VME_IOREMAP,
98 VME_REQIRQ,
99 VME_TOOMANYINT,
100 VME_TOOMANYHDL,
101 VME_INTUSED,
102 VME_ILLINTLEVEL,
103 VME_ILLINTTYPE,
104 VME_INTCONF,
105 VME_LVLDISABLED,
106 VME_LVLISNOTRORA, // 40
107 VME_ILLINTHANDLE,
108 VME_INTBYSIGNAL,
109 VME_NOINTERRUPT,
110 VME_ENOMEM,
111 VME_KMALLOC,
112 VME_BERRTBLFULL,
113 VME_BERRNOTFOUND,
114 VME_ERROR_FAIL,
115 VME_ILL_TO,
116 VME_NODOMEMEM, // 50
117 VME_NO_CODE,
118 VME_UNKNOWN_BOARD,
119 VME_IO_FAIL,
120 VME_SYSFAILTBLFULL,
121 VME_SYSFAILTBLNOTLINKED,
122 VME_SYSFAILNOTLINKED,
123 VME_NOSTATMAP2,
124 VME_IOUNMAP,
125 VME_INTDISABLED,
126 VME_NOCRCSRMAP
127};
128
129
130/*************/
131/*ioctl codes*/
132/*************/
133enum
134{
135 VMEMASTERMAP = 1,
136 VMEMASTERUNMAP,
137 VMEMASTERMAPDUMP,
138 VMEBERRREGISTERSIGNAL,
139 VMEBERRINFO,
140 VMESLAVEMAP,
141 VMESLAVEMAPDUMP,
142 VMESCSAFE,
143 VMEDMASTART,
144 VMEDMAPOLL, //10
145 VMEDMADUMP,
146 VMELINK,
147 VMEINTENABLE,
148 VMEINTDISABLE,
149 VMEWAIT,
150 VMEREGISTERSIGNAL,
151 VMEINTERRUPTINFOGET,
152 VMEUNLINK,
153 VMETSTART,
154 VMETSTOP, //20
155 VMEUPDATE,
156 VMESYSFAILUNLINK,
157 VMESYSFAILWAIT,
158 VMESYSFAILREGISTERSIGNAL,
159 VMESYSFAILLINK,
160 VMESYSFAILREENABLE,
161 VMESYSFAILPOLL,
162 VMESYSFAILSET,
163 VMESYSFAILRESET,
164 VMESYSRST, //30
165 VMETEST
166};
167
168
169/******************/
170/*type definitions*/
171/******************/
172typedef struct
173{
174 u_int vmebus_address;
175 u_int window_size;
176 u_int address_modifier;
177 u_int options;
178} VME_MasterMap_t;
179
180typedef struct
181{
182 VME_MasterMap_t in;
183 u_int pci_address;
184 u_int virt_address; //for the user
185 u_int kvirt_address; //for the kernel
186 u_int used;
187}VME_MasterMapInt_t;
188
189typedef struct
190{
191 u_int system_iobus_address;
192 u_int window_size;
193 u_int address_width;
194 u_int options;
195} VME_SlaveMap_t;
196
197typedef struct
198{
199 VME_SlaveMap_t in;
200 u_int vme_address;
201 u_int used;
202}VME_SlaveMapInt_t;
203
204typedef struct
205{
206 u_int kvirt_address;
207 u_int offset;
208 u_int data;
209 u_int nbytes;
210 u_int rw;
211}VME_SingleCycle_t;
212
213typedef struct
214{
215 u_int dctl; //Universe chain descriptor
216 u_int dtbc; //Universe chain descriptor
217 u_int dla; //Universe chain descriptor
218 u_int reserved1; //Universe chain descriptor
219 u_int dva; //Universe chain descriptor
220 u_int reserved2; //Universe chain descriptor
221 u_int dcpp; //Universe chain descriptor
222 u_int reserved3; //Universe chain descriptor
223 u_int ref; //used by the library
224 u_int reserved4[7]; //the size of the whole structure has to be a multiple of 32 bytes
225} VME_DmaChain_t;
226
227typedef struct
228{
229 u_int handle;
230 u_int pid;
231 u_int ctrl;
232 u_int counter;
233 u_int timeout;
234 u_int index;
235 int timeoutval;
236} VME_DMAhandle_t;
237
238typedef struct
239{
240 u_int nvectors;
241 u_int vector[VME_MAXINTERRUPT]; // use int internally
242 u_int level; // SAME for all vectors
243 u_int type; // SAME for all vectors
244} VME_IntHandle_t;
245
246typedef struct
247{
248 u_int level;
249 u_int type;
250} VME_IntEnable_t;
251
252typedef struct
253{
254 VME_IntHandle_t int_handle;
255 int timeout;
256 u_int level;
257 u_int type;
258 u_int vector; // use int internally
259 u_int multiple;
260} VME_WaitInt_t;
261
262typedef struct
263{
264 VME_IntHandle_t int_handle;
265 int signum;
266} VME_RegSig_t;
267
268typedef struct
269{
270 u_int paddr;
271 u_int handle;
272} VME_DMAstart_t;
273
274typedef struct
275{
276 u_int irq_mode[9];
277} VME_Update_t;
278
279typedef u_int VME_ErrorCode_t;
280
281typedef struct
282{
283 u_int vmebus_address;
284 u_int system_iobus_address;
285 u_int size_requested;
286 u_int control_word;
287 u_int size_remaining;
288 u_int status_word;
289} VME_BlockTransferItem_t;
290
291typedef struct
292{
293 u_char vector;
294 u_int level;
295 u_int type;
296} VME_InterruptItem_t;
297
298typedef struct
299{
300 u_char vector;
301 u_int level;
302 u_int type;
303 u_int multiple;
304} VME_InterruptInfo_t;
305
306typedef struct
307{
308 u_int vmebus_address;
309 u_int address_modifier;
310 u_int lword;
311 u_int iack;
312 u_int ds0;
313 u_int ds1;
314 u_int wr;
315 int multiple;
316} VME_BusErrorInfo_t;
317
318/********/
319/*Macros*/
320/********/
321#ifdef __powerpc__
322 #define BSWAP(x) bswap(x)
323 #define SYNC __asm__("eieio")
324#endif
325
326#ifdef __i386__
327 #define BSWAP(x) (x)
328 #define SYNC
329#endif
330
331#endif
Note: See TracBrowser for help on using the repository browser.