38 volatile unsigned int config;
39 volatile unsigned int status;
41 volatile unsigned int adc_din;
42 volatile unsigned int dac_dout;
44 volatile unsigned int adrin;
45 volatile unsigned int adrout;
46 volatile unsigned int adrdir;
48 volatile unsigned int data_in;
49 volatile unsigned int data_out;
50 volatile unsigned int data_dir;
53#define GRADCDAC_CFG_DACWS 0x00f80000
54#define GRADCDAC_CFG_WRPOL 0x00040000
55#define GRADCDAC_CFG_DACDW 0x00030000
56#define GRADCDAC_CFG_ADCWS 0x0000f800
57#define GRADCDAC_CFG_RCPOL 0x00000400
58#define GRADCDAC_CFG_CSMODE 0x00000300
59#define GRADCDAC_CFG_CSPOL 0x00000080
60#define GRADCDAC_CFG_RDYMODE 0x00000040
61#define GRADCDAC_CFG_RDYPOL 0x00000020
62#define GRADCDAC_CFG_TRIGPOL 0x00000010
63#define GRADCDAC_CFG_TRIGMODE 0x0000000c
64#define GRADCDAC_CFG_ADCDW 0x00000003
66#define GRADCDAC_CFG_DACWS_BIT 19
67#define GRADCDAC_CFG_WRPOL_BIT 18
68#define GRADCDAC_CFG_DACDW_BIT 16
69#define GRADCDAC_CFG_ADCWS_BIT 11
70#define GRADCDAC_CFG_RCPOL_BIT 10
71#define GRADCDAC_CFG_CSMODE_BIT 8
72#define GRADCDAC_CFG_CSPOL_BIT 7
73#define GRADCDAC_CFG_RDYMODE_BIT 6
74#define GRADCDAC_CFG_RDYPOL_BIT 5
75#define GRADCDAC_CFG_TRIGPOL_BIT 4
76#define GRADCDAC_CFG_TRIGMODE_BIT 2
77#define GRADCDAC_CFG_ADCDW_BIT 0
79#define GRADCDAC_STATUS_DACNO 0x40
80#define GRADCDAC_STATUS_DACRDY 0x20
81#define GRADCDAC_STATUS_DACON 0x10
82#define GRADCDAC_STATUS_ADCTO 0x08
83#define GRADCDAC_STATUS_ADCNO 0x04
84#define GRADCDAC_STATUS_ADCRDY 0x02
85#define GRADCDAC_STATUS_ADCON 0x01
87#define GRADCDAC_STATUS_DACNO_BIT 6
88#define GRADCDAC_STATUS_DACRDY_BIT 5
89#define GRADCDAC_STATUS_DACON_BIT 4
90#define GRADCDAC_STATUS_ADCTO_BIT 3
91#define GRADCDAC_STATUS_ADCNO_BIT 2
92#define GRADCDAC_STATUS_ADCRDY_BIT 1
93#define GRADCDAC_STATUS_ADCON_BIT 0
95#define GRADCDAC_IRQ_DAC 1
96#define GRADCDAC_IRQ_ADC 0
101 unsigned char dac_dw;
102 unsigned char adc_ws;
104 unsigned char cs_mode;
109 unsigned char trigg_mode;
110 unsigned char adc_dw;
113extern void *gradcdac_open(
char *devname);
115extern void gradcdac_set_config(
void *cookie,
struct gradcdac_config *cfg);
117extern void gradcdac_get_config(
void *cookie,
struct gradcdac_config *cfg);
119extern void gradcdac_set_cfg(
void *cookie,
unsigned int config);
121extern unsigned int gradcdac_get_cfg(
void *cookie);
123extern unsigned int gradcdac_get_status(
void *cookie);
125static int __inline__ gradcdac_DAC_ReqRej(
unsigned int status)
127 return (status & GRADCDAC_STATUS_DACNO);
130static int __inline__ gradcdac_DAC_isCompleted(
unsigned int status)
132 return (status & GRADCDAC_STATUS_DACRDY);
135static int __inline__ gradcdac_DAC_isOngoing(
unsigned int status)
137 return (status & GRADCDAC_STATUS_DACON);
140static int __inline__ gradcdac_ADC_isTimeouted(
unsigned int status)
142 return (status & GRADCDAC_STATUS_ADCTO);
145static int __inline__ gradcdac_ADC_ReqRej(
unsigned int status)
147 return (status & GRADCDAC_STATUS_ADCNO);
150static int __inline__ gradcdac_ADC_isCompleted(
unsigned int status)
152 return (status & GRADCDAC_STATUS_ADCRDY);
155static int __inline__ gradcdac_ADC_isOngoing(
unsigned int status)
157 return (status & GRADCDAC_STATUS_ADCON);
160#define GRADCDAC_ISR_BOTH 3
161#define GRADCDAC_ISR_DAC 2
162#define GRADCDAC_ISR_ADC 1
173extern int gradcdac_install_irq_handler
174 (
void *cookie,
int adc,
void (*isr)(
void *cookie,
void *arg),
void *arg);
176extern void gradcdac_uninstall_irq_handler(
void *cookie,
int adc);
182extern void gradcdac_adc_convert_start(
void *cookie);
193extern int gradcdac_adc_convert_try(
void *cookie,
unsigned short *digital_value);
202extern int gradcdac_adc_convert(
void *cookie,
unsigned short *digital_value);
209extern int gradcdac_dac_convert_try(
void *cookie,
unsigned short digital_value);
216extern void gradcdac_dac_convert(
void *cookie,
unsigned short digital_value);
218extern unsigned int gradcdac_get_adrinput(
void *cookie);
219extern void gradcdac_set_adrinput(
void *cookie,
unsigned int input);
221extern unsigned int gradcdac_get_adroutput(
void *cookie);
222extern void gradcdac_set_adroutput(
void *cookie,
unsigned int output);
224extern unsigned int gradcdac_get_adrdir(
void *cookie);
225extern void gradcdac_set_adrdir(
void *cookie,
unsigned int dir);
227extern unsigned int gradcdac_get_datainput(
void *cookie);
228extern void gradcdac_set_datainput(
void *cookie,
unsigned int input);
230extern unsigned int gradcdac_get_dataoutput(
void *cookie);
231extern void gradcdac_set_dataoutput(
void *cookie,
unsigned int output);
233extern unsigned int gradcdac_get_datadir(
void *cookie);
234extern void gradcdac_set_datadir(
void *cookie,
unsigned int dir);
237extern void grAdcDacShow(
void *cookie);
240extern void gradcdac_register_drv (
void);
Definition: deflate.c:114
Definition: gradcdac.h:98
Definition: gradcdac.h:37