Hi
I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same.
The Error is I get is :
qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]#
########################################################################### ADC Driver Code ###########################################################################
#define MODULE #define __KERNEL__ #include #include #include /* printk */ #include / #include /* error codes */
#include /* size_t */ #include /* proc file system */ #include #include /* cli, flags */ #include /* copy from/to user */
/*Registers to get qadc access*/ volatile unsigned short * qadcmcr = (unsigned short *)0x40190000; volatile unsigned short * qacr0 = (unsigned short *)0x4019000a; volatile unsigned short * qacr1 = (unsigned short *)0x4019000c; volatile unsigned short * qacr2 = (unsigned short *)0x4019000e; volatile unsigned short * qasr0 = (unsigned short *)0x40190010; volatile unsigned short * qasr1 = (unsigned short *)0x40190012; volatile unsigned short *ccw = (unsigned short *)0x40190200; volatile unsigned short *rjurr = (unsigned short *)0x40190280; /* Function prototypes required by qadc.c */ int qadc_open (struct inode *inode, struct file *filp);
int qadc_release (struct inode *inode, struct file *filp); ssize_t qadc_read(struct file *filp, char *buf, size_t count, loff_t
*f_pos); ssize_t qadc_write (struct file *filp, const char *buf, size_t count, loff_t *f_pos); void cleanup_module_qadc (void);/* Structure to declare our file access functions. */ struct file_operations qadc_fops = { open: qadc_open, read: qadc_read, write: qadc_write, release: qadc_release };
/* Global driver variables. */ int qadc_major = 80; /* major number */ unsigned short values[64]; /* data buffer */ int init_module_qadc(void) { int cntr; //counter for loop; int result;
*qadcmcr= 0x40; //QADC operates normally *qacr0 = 0x7f; //QCLK, disable extern mux, set the trigger assignments *qacr1 = 0x1100; //disable interrupts, select operate mode *qacr2 = 0x11; //disable queue 2 *qasr0 = 0; for(cntr=0;cntr8) > 7) // When the queue is full, read it to RAM { printk("Data in queue"); *qacr1=0; // Deactivate software triggered continous-scan mode for(adcntr=0;adcntr