Contiki-NG
soc-adc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /**
32  * \addtogroup cc2538
33  * @{
34  *
35  * \defgroup cc2538-soc-adc cc2538 ADC and RNG
36  *
37  * Register declarations for the cc2538 ADC and H/W RNG
38  * @{
39  *
40  * \file
41  * Header file with register declarations for the cc2538 ADC and H/W RNG
42  */
43 #ifndef SOC_ADC_H_
44 #define SOC_ADC_H_
45 /*---------------------------------------------------------------------------*/
46 /** \name ADC and RNG Register offset declarations
47  * @{
48  */
49 #define SOC_ADC_ADCCON1 0x400D7000 /**< ADC Control 1 */
50 #define SOC_ADC_ADCCON2 0x400D7004 /**< ADC Control 2 */
51 #define SOC_ADC_ADCCON3 0x400D7008 /**< ADC Control 3 */
52 #define SOC_ADC_ADCL 0x400D700C /**< ADC Result, least significant part */
53 #define SOC_ADC_ADCH 0x400D7010 /**< ADC Result, most significant part */
54 #define SOC_ADC_RNDL 0x400D7014 /**< RNG low byte */
55 #define SOC_ADC_RNDH 0x400D7018 /**< RNG high byte */
56 #define SOC_ADC_CMPCTL 0x400D7024 /**< Analog comparator control and status */
57 /** @} */
58 /*---------------------------------------------------------------------------*/
59 /** \name SOC_ADC_ADCCON1 register bit masks
60  * @{
61  */
62 #define SOC_ADC_ADCCON1_EOC 0x00000080 /**< End of conversion */
63 #define SOC_ADC_ADCCON1_ST 0x00000040 /**< Start conversion */
64 #define SOC_ADC_ADCCON1_STSEL 0x00000030 /**< Start select */
65 #define SOC_ADC_ADCCON1_RCTRL 0x0000000C /**< Controls the 16-bit RNG */
66 #define SOC_ADC_ADCCON1_RCTRL1 0x00000008 /**< RCTRL high bit */
67 #define SOC_ADC_ADCCON1_RCTRL0 0x00000004 /**< RCTRL low bit */
68 /** @} */
69 /*---------------------------------------------------------------------------*/
70 /** \name SOC_ADC_ADCCON2 register bit masks
71  * @{
72  */
73 #define SOC_ADC_ADCCON2_SREF 0x000000C0 /**< Reference voltage for sequence */
74 #define SOC_ADC_ADCCON2_SDIV 0x00000030 /**< Decimation rate for sequence */
75 #define SOC_ADC_ADCCON2_SCH 0x0000000F /**< Sequence channel select */
76 /** @} */
77 /*---------------------------------------------------------------------------*/
78 /** \name SOC_ADC_ADCCON3 register bit masks
79  * @{
80  */
81 #define SOC_ADC_ADCCON3_EREF 0x000000C0 /**< Reference voltage for extra */
82 #define SOC_ADC_ADCCON3_EDIV 0x00000030 /**< Decimation rate for extra */
83 #define SOC_ADC_ADCCON3_ECH 0x0000000F /**< Single channel select */
84 /** @} */
85 /*---------------------------------------------------------------------------*/
86 /** \name SOC_ADC_ADCCONx registers field values
87  * @{
88  */
89 #define SOC_ADC_ADCCON_REF_INT (0 << 6) /**< Internal reference */
90 #define SOC_ADC_ADCCON_REF_EXT_SINGLE (1 << 6) /**< External reference on AIN7 pin */
91 #define SOC_ADC_ADCCON_REF_AVDD5 (2 << 6) /**< AVDD5 pin */
92 #define SOC_ADC_ADCCON_REF_EXT_DIFF (3 << 6) /**< External reference on AIN6-AIN7 differential input */
93 #define SOC_ADC_ADCCON_DIV_64 (0 << 4) /**< 64 decimation rate (7 bits ENOB) */
94 #define SOC_ADC_ADCCON_DIV_128 (1 << 4) /**< 128 decimation rate (9 bits ENOB) */
95 #define SOC_ADC_ADCCON_DIV_256 (2 << 4) /**< 256 decimation rate (10 bits ENOB) */
96 #define SOC_ADC_ADCCON_DIV_512 (3 << 4) /**< 512 decimation rate (12 bits ENOB) */
97 #define SOC_ADC_ADCCON_CH_AIN0 0x0 /**< AIN0 */
98 #define SOC_ADC_ADCCON_CH_AIN1 0x1 /**< AIN1 */
99 #define SOC_ADC_ADCCON_CH_AIN2 0x2 /**< AIN2 */
100 #define SOC_ADC_ADCCON_CH_AIN3 0x3 /**< AIN3 */
101 #define SOC_ADC_ADCCON_CH_AIN4 0x4 /**< AIN4 */
102 #define SOC_ADC_ADCCON_CH_AIN5 0x5 /**< AIN5 */
103 #define SOC_ADC_ADCCON_CH_AIN6 0x6 /**< AIN6 */
104 #define SOC_ADC_ADCCON_CH_AIN7 0x7 /**< AIN7 */
105 #define SOC_ADC_ADCCON_CH_AIN0_AIN1 0x8 /**< AIN0-AIN1 */
106 #define SOC_ADC_ADCCON_CH_AIN2_AIN3 0x9 /**< AIN2-AIN3 */
107 #define SOC_ADC_ADCCON_CH_AIN4_AIN5 0xA /**< AIN4-AIN5 */
108 #define SOC_ADC_ADCCON_CH_AIN6_AIN7 0xB /**< AIN6-AIN7 */
109 #define SOC_ADC_ADCCON_CH_GND 0xC /**< GND */
110 #define SOC_ADC_ADCCON_CH_TEMP 0xE /**< Temperature sensor */
111 #define SOC_ADC_ADCCON_CH_VDD_3 0xF /**< VDD/3 */
112 /** @} */
113 /*---------------------------------------------------------------------------*/
114 /** \name SOC_ADC_ADC[L:H] register bit masks
115  * @{
116  */
117 #define SOC_ADC_ADCL_ADC 0x000000FC /**< ADC Result, least significant part */
118 #define SOC_ADC_ADCH_ADC 0x000000FF /**< ADC Result, most significant part */
119 /** @} */
120 /*---------------------------------------------------------------------------*/
121 /** \name SOC_ADC_RND[L:H] register bit masks
122  * @{
123  */
124 #define SOC_ADC_RNDL_RNDL 0x000000FF /**< Random value/seed or CRC result low byte */
125 #define SOC_ADC_RNDH_RNDH 0x000000FF /**< Random value or CRC result/input data, high byte */
126 /** @} */
127 /*---------------------------------------------------------------------------*/
128 /** \name SOC_ADC_CMPCTL register bit masks
129  * @{
130  */
131 #define SOC_ADC_CMPCTL_EN 0x00000002 /**< Comparator enable */
132 #define SOC_ADC_CMPCTL_OUTPUT 0x00000001 /**< Comparator output */
133 /** @} */
134 
135 #endif /* SOC_ADC_H_ */
136 
137 /**
138  * @}
139  * @}
140  */