Rev 21 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
21 | f9daq | 1 | #ifndef __CC32LIB_H__ |
2 | #define __CC32LIB_H__ |
||
3 | /* |
||
4 | cc32lib.h -- header for a simple access library for the |
||
5 | PCICC32 PCI to CAMAC Interface from ARW Elektronik |
||
6 | |||
7 | (c) 2000 ARW Elektronik |
||
8 | |||
9 | this source code is published under GPL (Open Source). You can use, redistrubute and |
||
10 | modify it unless this header is not modified or deleted. No warranty is given that |
||
11 | this software will work like expected. |
||
12 | This product is not authorized for use as critical component in life support systems |
||
13 | wihout the express written approval of ARW Elektronik Germany. |
||
14 | |||
15 | Please announce changes and hints to ARW Elektronik |
||
16 | |||
17 | To use this library the module "pcicc32.o" have to be installed. There must be also a |
||
18 | node which points with ist major number to the module and its minor number must equal |
||
19 | the CC32 module number (Jumper J301 to J304). |
||
20 | |||
21 | first steps derived from the LINUX pcicc32 library AR 16.03.2000 |
||
22 | added buffer, UNTIL_NOT_Q and AUTOREAD functionality AR 17.03.2001 |
||
23 | added interrupt handling (NT + 2000 only) AR 08.06.2002 |
||
24 | */ |
||
25 | |||
26 | |||
27 | /*--- INCLUDES --------------------------------------------------------------------------*/ |
||
28 | |||
29 | /*--- TYPEDEFS --------------------------------------------------------------------------*/ |
||
30 | typedef void* CC32_HANDLE; /* type of the device handle */ |
||
31 | |||
32 | /*--- DEFINES ---------------------------------------------------------------------------*/ |
||
33 | #define SW_UNTIL_NOT_Q 1 /* switches for cc32_access_switch( ..., uSwitch); */ |
||
34 | #define SW_AUTOREAD 2 |
||
35 | |||
36 | /*--- PROTOTYPES ------------------------------------------------------------------------*/ |
||
37 | |||
38 | #ifdef __cplusplus |
||
39 | extern "C" |
||
40 | { |
||
41 | #endif |
||
42 | |||
43 | /* open a path to a device. E.g. "/dev/pcicc32_1" */ |
||
44 | int __declspec(dllexport) cc32_open(char *cszPath, int nModuleNumber, CC32_HANDLE *handle); |
||
45 | |||
46 | /* close the opened path */ |
||
47 | int __declspec(dllexport) cc32_close(CC32_HANDLE handle); |
||
48 | |||
49 | /* read only a word - 16 bits - from a address made out of N,A,F */ |
||
50 | unsigned short __declspec(dllexport) cc32_read_word(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F); |
||
51 | |||
52 | /* read a long - 32 bits - from a address made out of N,A,F and get the result Q and X */ |
||
53 | unsigned long __declspec(dllexport) cc32_read_long(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, char *Q, char *X); |
||
54 | |||
55 | /* read a long - 32 bits - without any interpretation */ |
||
56 | unsigned long __declspec(dllexport) cc32_read_long_all(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F); |
||
57 | |||
58 | /* write a word - 16 bits - to a destination made out of N,A,F */ |
||
59 | void __declspec(dllexport) cc32_write_word(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, unsigned short uwData); |
||
60 | |||
61 | /* write a long - 32 bits - uninterpreted to a destination made out of N,A,F */ |
||
62 | void __declspec(dllexport) cc32_write_long(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, unsigned long ulData); |
||
63 | |||
64 | /* poll the state of the timeout line and the LAM state. The timeout line is cleared if it was set */ |
||
65 | int __declspec(dllexport) cc32_poll_error(CC32_HANDLE handle, char *nTimeout, char *nLam); |
||
66 | |||
67 | /* read 'len' words or 'UNTIL_NOT_Q' from a address made out of N,A,F into a buffer*/ |
||
68 | int __declspec(dllexport) cc32_read_word_buffer(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, |
||
69 | unsigned short *pwBuffer, unsigned long *pdwLen); |
||
70 | |||
71 | /* read 'len' longs or 'UNTIL_NOT_Q' from a address made out of N,A,F into a buffer*/ |
||
72 | int __declspec(dllexport) cc32_read_long_buffer(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, |
||
73 | unsigned long *pdwBuffer, unsigned long *pdwLen); |
||
74 | /* read 'len' longs or 'UNTIL_NOT_Q' from a address made out of N,A,F into a buffer, no interpretation */ |
||
75 | int __declspec(dllexport) cc32_read_long_all_buffer(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, |
||
76 | unsigned long *pdwBuffer, unsigned long *pdwLen); |
||
77 | |||
78 | /* switch UNTIL_NOT_Q or AUTOREAD on or off */ |
||
79 | int __declspec(dllexport) cc32_access_switch(CC32_HANDLE handle, unsigned short uwSwitch); |
||
80 | |||
81 | /* switch interrupts on */ |
||
82 | int __declspec(dllexport) cc32_enable_interrupt(CC32_HANDLE handle); |
||
83 | |||
84 | /* switch interrupts off */ |
||
85 | int __declspec(dllexport) cc32_disable_interrupt(CC32_HANDLE handle); |
||
86 | |||
87 | /* wait blocking for the next interrupt */ |
||
88 | int __declspec(dllexport) cc32_get_interrupt(CC32_HANDLE handle, unsigned long *dwStatus); |
||
89 | |||
90 | #ifdef __cplusplus |
||
91 | } |
||
92 | #endif |
||
93 | |||
94 | #endif /* __CC32LIB_H__ */ |