adc_at91.h

Go to the documentation of this file.
00001 
00041 #ifndef DRV_ADC_AT91_H
00042 #define DRV_ADC_AT91_H
00043 
00044 #include "hw/hw_cpu.h"
00045 
00046 #include "cfg/cfg_adc.h"
00047 
00048 #include <cfg/compiler.h>
00049 
00053 #define ADC_MUX_MAXCH          8 //Max number of channel for ADC.
00054 #define ADC_BITS              10 //Bit resolution for ADC converter.
00055 
00060 #define ADC_COMPUTED_PRESCALER    ((CLOCK_FREQ/(2 * CONFIG_ADC_CLOCK)) - 1)
00061 #define ADC_COMPUTED_STARTUPTIME  (((CONFIG_ADC_STARTUP_TIME * CONFIG_ADC_CLOCK)/ 8000000UL) - 1)
00062 #define ADC_COMPUTED_SHTIME       (((CONFIG_ADC_SHTIME * CONFIG_ADC_CLOCK)/1000000000UL) - 1)
00063 
00072 #if CPU_ARM_AT91SAM7X256
00073     #define ADC_PIO_DISABLE           PIOB_PDR
00074     #define ADC_PIO_EN_FUNC           PIOB_ASR
00075 
00076 #elif CPU_ARM_AT91SAM7S256
00077     #define ADC_PIO_DISABLE           PIOA_PDR
00078     #define ADC_PIO_EN_FUNC           PIOA_BSR
00079 
00080 #else
00081     #error No ADC pins name definitions for selected ARM CPU
00082 #endif
00083 /*\}*/
00084 
00089 #define ADC_INIT_PINS() \
00090     do { \
00091     } while (0)
00092 
00093 
00094 #endif /* DRV_ADC_AT91_H */