RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
bsps
arm
lpc176x
include
bsp
adc-defs.h
Go to the documentation of this file.
1
8
9
/*
10
* Copyright (c) 2014 Taller Technologies.
11
*
12
* @author Diaz Marcos (marcos.diaz@tallertechnologies.com)
13
*
14
* The license and distribution terms for this file may be
15
* found in the file LICENSE in this distribution or at
16
* http://www.rtems.org/license/LICENSE.
17
*/
18
#ifndef LPC176X_ADC_DEFS_H
19
#define LPC176X_ADC_DEFS_H
20
21
#include <bsp.h>
22
#include <bsp/io.h>
23
#include <
bsp/lpc176x.h
>
24
#include <
bsp/adc.h
>
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
/* __cplusplus */
29
33
typedef
enum
{
34
ADC_0,
35
ADC_1,
36
ADC_2,
37
ADC_3,
38
ADC_4,
39
ADC_5,
40
ADC_6,
41
ADC_7,
42
ADC_DEVICES_COUNT
43
}
lpc176x_adc_number
;
44
45
#define MAX_ADC_CLK 13000000u
46
47
#define ADC_RANGE 0xFFFu
48
49
#define ADC_NUMBER_VALID( number ) ( ( (uint32_t) number ) < \
50
ADC_DEVICES_COUNT )
51
52
#define ADC_CR_SEL( val ) BSP_FLD32( val, 0, 7 )
53
#define ADC_CR_SEL_GET( val ) BSP_FLD32GET( val, 0, 7 )
54
#define ADC_CR_SEL_SET( reg, val ) BSP_FLD32SET( reg, val, 0, 7 )
55
#define ADC_CR_CLKDIV( val ) BSP_FLD32( val, 8, 15 )
56
#define ADC_CR_CLKDIV_GET( reg ) BSP_FLD32GET( reg, 8, 15 )
57
#define ADC_CR_CLKDIV_SET( reg, val ) BSP_FLD32SET( reg, val, 8, 15 )
58
#define ADC_CR_BURST BSP_BIT32( 16 )
59
#define ADC_CR_CLKS( val ) BSP_FLD32( val, 17, 19 )
60
#define ADC_CR_PDN BSP_BIT32( 21 )
61
#define ADC_CR_START_NOW BSP_BIT32( 24 )
62
#define ADC_CR_START( val ) BSP_FLD32( val, 24, 26 )
63
#define ADC_CR_EDGE BSP_BIT32( 27 )
64
65
#define ADC_DR_VALUE( reg ) BSP_FLD32GET( reg, 4, 15 )
66
#define ADC_DR_OVERRUN BSP_BIT32( 30 )
67
#define ADC_DR_DONE BSP_BIT32( 31 )
68
69
#define ADC_DATA_CONVERSION_DONE( val ) ( ( val & ADC_DR_DONE ) != 0u )
70
74
typedef
struct
{
75
volatile
uint32_t ADCR;
76
volatile
uint32_t ADGDR;
77
volatile
uint32_t RESERVED0;
78
volatile
uint32_t ADINTEN;
79
volatile
uint32_t ADDR[ ADC_DEVICES_COUNT ];
80
volatile
uint32_t ADSTAT;
81
volatile
uint32_t ADTRM;
82
}
lpc176x_adc_device
;
83
87
typedef
struct
{
88
uint32_t pin_number;
89
lpc176x_pin_function
pin_function;
90
}
lpc176x_adc_pin_map
;
91
92
#ifdef __cplusplus
93
}
94
#endif
/* __cplusplus */
95
96
#endif
lpc176x_adc_number
lpc176x_adc_number
The ADC inputs of the board.
Definition
adc-defs.h:33
lpc176x_pin_function
lpc176x_pin_function
Defines the functions according to the pin.
Definition
io-defs.h:68
adc.h
ADC library for the lpc176x bsp.
lpc176x.h
Specific register definitions according to lpc176x family boards.
lpc176x_adc_device
The ADC low-level device.
Definition
adc-defs.h:74
lpc176x_adc_pin_map
Represents the pin and function for each ADC input.
Definition
adc-defs.h:87
Generated by
1.18.0