// A/D boards: CONTEC AD12-16(PCI), AD12-64(PCI) // D/A boards: CONTEC DA12-16(PCI), CONTEC DA12-8(PCI), CONTEC DA12-4(PCI) // IO base address for the boards: #define ADC_BASE_ADDR 0xdf80 #define DAC_BASE_ADDR 0xdf40 // IO base address can be obtained from /proc/pci which includes the lines like bellow: // Bus 1, device 9, function 0: // Multimedia controller: PCI device 1221:8183 (Contec Co., Ltd) (rev 0). // IRQ 14. // I/O at 0xdf40 [0xdf5f]. // Bus 1, device 10, function 0: // Multimedia controller: PCI device 1221:8153 (Contec Co., Ltd) (rev 0). // IRQ 9. // I/O at 0xdf80 [0xdf9f]. // // NOTE: In the above examples, `1221', `8183', and `8153' mean CONTEC, DA12-4(PCI), and AD12-16(PCI) respectively. //---------------------------------------------------------- // for A/D conversion //---------------------------------------------------------- // analog input method #define SINGLE_END 0x00 #define DIFFERENTIAL 0x08 // channel mode #define MULTI 0x04 #define SINGLE 0x00 // clock mode #define EXTERNAL_CLOCK 0x02 #define INTERNAL_CLOCK 0x00 // stop mode #define SOFTWARE_COMMAND 0x00 #define CLOCK 0x01 #define BUF_CLR 0x05 #define DRE 0x02 #define MULTI_CHANNEL_MODE #define CH 2 // maximum channel number for conversion. If this is set to 5, then ch0, ch1, ch2, ch3, and ch4 are converted sequentially. For single channel mode, set 0. #define SAMPLING_CLOCK 10000 /* nsec */ //---------------------------------------------------------- // for D/A conversion //---------------------------------------------------------- #define V_MAX 5. #define V_MIN -5. #define V_OFFSET ((V_MAX+V_MIN)/2.) //---------------------------------------------------------- // prototype definition of relative functions //---------------------------------------------------------- int init_adc(void); void cleanup_adc(void); int init_dac(void); void cleanup_dac(void); int ad_conv(double *); int ad_conv_raw(int *); int da_conv(double, unsigned char); int da_conv_pic(double, unsigned char);