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_cpufreq.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 ((CPU_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_SAM7X
00073 #define ADC_PIO_DISABLE PIOB_PDR
00074 #define ADC_PIO_EN_FUNC PIOB_ASR
00075
00076 #elif CPU_ARM_SAM7S_LARGE
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 void adc_hw_select_ch(uint8_t ch);
00094 uint16_t adc_hw_read(void);
00095 void adc_hw_init(void);
00096
00097 #endif