Subversion Repositories f9daq

Rev

Blame | Last modification | View Log | RSS feed

#ifndef __CC32LIB_H__
#define __CC32LIB_H__
/*
   cc32lib.h -- header for a simple access library for the
                                     PCICC32 PCI to CAMAC Interface from ARW Elektronik

   (c) 2000 ARW Elektronik

   this source code is published under GPL (Open Source). You can use, redistrubute and
   modify it unless this header   is not modified or deleted. No warranty is given that
   this software will work like expected.
   This product is not authorized for use as critical component in life support systems
   wihout the express written approval of ARW Elektronik Germany.
 
   Please announce changes and hints to ARW Elektronik

   To use this library the module "pcicc32.o" have to be installed. There must be also a
   node which points with ist major number to the module and its minor number must equal
   the CC32 module number (Jumper J301 to J304).
   
   first steps derived from the LINUX pcicc32 library                   AR   16.03.2000
   added buffer, UNTIL_NOT_Q and AUTOREAD functionality                 AR   17.03.2001
   added interrupt handling (NT + 2000 only)                            AR   08.06.2002
*/

 

/*--- INCLUDES --------------------------------------------------------------------------*/

/*--- TYPEDEFS --------------------------------------------------------------------------*/
typedef void* CC32_HANDLE;  /* type of the device handle */

/*--- DEFINES ---------------------------------------------------------------------------*/
#define SW_UNTIL_NOT_Q   1  /* switches for cc32_access_switch( ..., uSwitch);           */
#define SW_AUTOREAD      2

/*--- PROTOTYPES ------------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C"
{
#endif

/* open a path to a device. E.g. "/dev/pcicc32_1" */
int   __declspec(dllexport) cc32_open(char *cszPath, int nModuleNumber, CC32_HANDLE *handle);

/* close the opened path */
int   __declspec(dllexport) cc32_close(CC32_HANDLE handle);

/* read only a word - 16 bits - from a address made out of N,A,F */
unsigned short __declspec(dllexport) cc32_read_word(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F);

/* read a long - 32 bits - from a address made out of N,A,F and get the result Q and X */
unsigned long __declspec(dllexport) cc32_read_long(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, char *Q, char *X);

/* read a long - 32 bits - without any interpretation */
unsigned long __declspec(dllexport) cc32_read_long_all(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F);

/* write a word - 16 bits - to a destination made out of N,A,F */
void  __declspec(dllexport) cc32_write_word(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, unsigned short uwData);

/* write a long - 32 bits - uninterpreted to a destination made out of N,A,F */
void  __declspec(dllexport) cc32_write_long(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F, unsigned long ulData);

/* poll the state of the timeout line and the LAM state. The timeout line is cleared if it was set */
int   __declspec(dllexport) cc32_poll_error(CC32_HANDLE handle, char *nTimeout, char *nLam);

/* read 'len' words or 'UNTIL_NOT_Q' from a address made out of N,A,F into a buffer*/
int __declspec(dllexport) cc32_read_word_buffer(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F,
                                                                                                                                unsigned short *pwBuffer, unsigned long *pdwLen);

/* read 'len' longs or 'UNTIL_NOT_Q' from a address made out of N,A,F into a buffer*/
int __declspec(dllexport) cc32_read_long_buffer(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F,
                                                                                                                                unsigned long *pdwBuffer, unsigned long *pdwLen);
/* read 'len' longs or 'UNTIL_NOT_Q' from a address made out of N,A,F into a buffer, no interpretation */
int __declspec(dllexport) cc32_read_long_all_buffer(CC32_HANDLE handle, unsigned int N, unsigned int A, unsigned int F,
                                                                                                                                unsigned long *pdwBuffer, unsigned long *pdwLen);

/* switch UNTIL_NOT_Q or AUTOREAD on or off */
int __declspec(dllexport) cc32_access_switch(CC32_HANDLE handle, unsigned short uwSwitch);

/* switch interrupts on */
int __declspec(dllexport) cc32_enable_interrupt(CC32_HANDLE handle);

/* switch interrupts off */
int __declspec(dllexport) cc32_disable_interrupt(CC32_HANDLE handle);

/* wait blocking for the next interrupt */
int __declspec(dllexport) cc32_get_interrupt(CC32_HANDLE handle, unsigned long *dwStatus);

#ifdef __cplusplus
}
#endif

#endif /* __CC32LIB_H__ */