📄 adconvert.h
字号:
#ifndef _ADC_H_#define _ADC_H_/* * Macros to help debugging */#undef PDEBUG /* undef it, just in case */#ifdef ADC_DEBUG# ifdef __KERNEL__ /* This one if debugging is on, and kernel space */# define PDEBUG(fmt, args...) printk( KERN_DEBUG "ADC: " fmt, ## args )# else /* This one for user space */ define PDEBUG(fmt, args...) fptrintf(stderr, fmt, ## args)# endif#else# define PDEBUG(fmt, args...) /* not dubugging: nothing */#endif#undef PDEBUGG#define PDEBUGG(fmt, args...) /* nothing: it's a placeholder */#ifndef ADC_MAJOR#define ADC_MAJOR 0 /* dynamic major by default */#endif#ifndef ADC_NR_DEVS#define ADC_NR_DEVS 4 /* ADC through adc3 */#endif/* * The different configurable parameters */extern int adc_major; /* main.c */extern int adc_nr_devs;unsigned char ADCRxdata[225];unsigned char ADCTxdata[225];unsigned char *dbuf;/* * */static unsigned int *r_SPSTA0;static unsigned int *r_SPPRE0;static unsigned int *r_SPCON0;static unsigned int *r_SPTDAT0;static unsigned int *r_SPRDAT0;static unsigned int *r_GPECON;static unsigned int *r_GPEUP;static unsigned int *r_GPHCON;static unsigned int *r_GPHUP;static unsigned int *r_GPHDAT;/*#if 0*/void adc_convert( void );static void adc_spi_init( void );static void adc_tx_data(unsigned char data);void spi_poll_done( void );void adc_address_map( void );void adc_cancel_add_map( void );/*#endif*/static ssize_t adc_read( struct file *filp, char __user *buf, size_t count, loff_t *f_ops );static ssize_t adc_write( struct file *filp, const char __user *buf, size_t count, loff_t *f_ops );static int adc_release( struct inode *inode, struct file *filp );static int adc_open( struct inode *inode, struct file *filp );/*// I/O PORT #define rGPECON (*(volatile unsigned *)0x56000040)#define rGPEDAT (*(volatile unsigned *)0x56000044)#define rGPEUP (*(volatile unsigned *)0x56000048)#define rGPHCON (*(volatile unsigned *)0x56000070)#define rGPHDAT (*(volatile unsigned *)0x56000074)#define rGPHUP (*(volatile unsigned *)0x56000078)// ADC Control Register#define rADCCON (*(volatile unsigned *)0x58000000)#define rADCTSC (*(volatile unsigned *)0x58000004)#define rADCDLY (*(volatile unsigned *)0x58000008)#define rADCDAT0 (*(volatile unsigned *)0x5800000C)#define rADCDAT1 (*(volatile unsigned *)0x58000010)// SPI Control Register#define rSPCON0 (*(volatile unsigned *)0x59000000)#define rSPSTA0 (*(volatile unsigned *)0x59000004)#define rSPPIN0 (*(volatile unsigned *)0x59000008)#define rSPPRE0 (*(volatile unsigned *)0x5900000C)#define rSPTDAT0 (*(volatile unsigned *)0x59000010)#define rSPRDAT0 (*(volatile unsigned *)0x59000014)#define rSPCON1 (*(volatile unsigned *)0x59000020)#define rSPSTA1 (*(volatile unsigned *)0x59000024)#define rSPPIN1 (*(volatile unsigned *)0x59000028)#define rSPPRE1 (*(volatile unsigned *)0x5900002C)#define rSPTDAT1 (*(volatile unsigned *)0x59000030)#define rSPRDAT1 (*(volatile unsigned *)0x59000034)*/// I/O PORT #define rGPECON 0x56000040#define rGPEDAT 0x56000044#define rGPEUP 0x56000048#define rGPHCON 0x56000070#define rGPHDAT 0x56000074#define rGPHUP 0x56000078// ADC Control Register#define rADCCON 0x58000000#define rADCTSC 0x58000004#define rADCDLY 0x58000008#define rADCDAT0 0x5800000C#define rADCDAT1 0x58000010// SPI Control Register#define rSPCON0 0x59000000#define rSPSTA0 0x59000004#define rSPPIN0 0x59000008#define rSPPRE0 0x5900000C#define rSPTDAT0 0x59000010#define rSPRDAT0 0x59000014#define rSPCON1 0x59000020#define rSPSTA1 0x59000024#define rSPPIN1 0x59000028#define rSPPRE1 0x5900002C#define rSPTDAT1 0x59000030#define rSPRDAT1 0x59000034#endif /* _ADC_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -