Robobo
component_adc.h
1 /* ----------------------------------------------------------------------------
2  * SAM Software Package License
3  * ----------------------------------------------------------------------------
4  * Copyright (c) 2012, Atmel Corporation
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following condition is met:
10  *
11  * - Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the disclaimer below.
13  *
14  * Atmel's name may not be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * ----------------------------------------------------------------------------
28  */
29 
30 #ifndef _SAM3U_ADC_COMPONENT_
31 #define _SAM3U_ADC_COMPONENT_
32 
33 /* ============================================================================= */
35 /* ============================================================================= */
38 
39 #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
40 
41 typedef struct {
42  WoReg ADC_CR;
43  RwReg ADC_MR;
44  RoReg Reserved1[2];
45  WoReg ADC_CHER;
46  WoReg ADC_CHDR;
47  RoReg ADC_CHSR;
49  RoReg ADC_LCDR;
50  WoReg ADC_IER;
51  WoReg ADC_IDR;
52  RoReg ADC_IMR;
53  RoReg ADC_CDR[8];
54  RoReg Reserved2[44];
55  RwReg ADC_RPR;
56  RwReg ADC_RCR;
57  RoReg Reserved3[2];
58  RwReg ADC_RNPR;
59  RwReg ADC_RNCR;
60  RoReg Reserved4[2];
61  WoReg ADC_PTCR;
62  RoReg ADC_PTSR;
63 } Adc;
64 #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
65 /* -------- ADC_CR : (ADC Offset: 0x00) Control Register -------- */
66 #define ADC_CR_SWRST (0x1u << 0)
67 #define ADC_CR_START (0x1u << 1)
68 /* -------- ADC_MR : (ADC Offset: 0x04) Mode Register -------- */
69 #define ADC_MR_TRGEN (0x1u << 0)
70 #define ADC_MR_TRGEN_DIS (0x0u << 0)
71 #define ADC_MR_TRGEN_EN (0x1u << 0)
72 #define ADC_MR_TRGSEL_Pos 1
73 #define ADC_MR_TRGSEL_Msk (0x7u << ADC_MR_TRGSEL_Pos)
74 #define ADC_MR_TRGSEL(value) ((ADC_MR_TRGSEL_Msk & ((value) << ADC_MR_TRGSEL_Pos)))
75 #define ADC_MR_TRGSEL_ADC_TRIG0 (0x6u << 1)
76 #define ADC_MR_TRGSEL_ADC_TRIG1 (0x0u << 1)
77 #define ADC_MR_TRGSEL_ADC_TRIG2 (0x1u << 1)
78 #define ADC_MR_TRGSEL_ADC_TRIG3 (0x2u << 1)
79 #define ADC_MR_TRGSEL_ADC_TRIG4 (0x3u << 1)
80 #define ADC_MR_TRGSEL_ADC_TRIG5 (0x4u << 1)
81 #define ADC_MR_LOWRES (0x1u << 4)
82 #define ADC_MR_LOWRES_BITS_10 (0x0u << 4)
83 #define ADC_MR_LOWRES_BITS_8 (0x1u << 4)
84 #define ADC_MR_SLEEP (0x1u << 5)
85 #define ADC_MR_SLEEP_NORMAL (0x0u << 5)
86 #define ADC_MR_SLEEP_SLEEP (0x1u << 5)
87 #define ADC_MR_PRESCAL_Pos 8
88 #define ADC_MR_PRESCAL_Msk (0xffu << ADC_MR_PRESCAL_Pos)
89 #define ADC_MR_PRESCAL(value) ((ADC_MR_PRESCAL_Msk & ((value) << ADC_MR_PRESCAL_Pos)))
90 #define ADC_MR_STARTUP_Pos 16
91 #define ADC_MR_STARTUP_Msk (0x7fu << ADC_MR_STARTUP_Pos)
92 #define ADC_MR_STARTUP(value) ((ADC_MR_STARTUP_Msk & ((value) << ADC_MR_STARTUP_Pos)))
93 #define ADC_MR_SHTIM_Pos 24
94 #define ADC_MR_SHTIM_Msk (0xfu << ADC_MR_SHTIM_Pos)
95 #define ADC_MR_SHTIM(value) ((ADC_MR_SHTIM_Msk & ((value) << ADC_MR_SHTIM_Pos)))
96 /* -------- ADC_CHER : (ADC Offset: 0x10) Channel Enable Register -------- */
97 #define ADC_CHER_CH0 (0x1u << 0)
98 #define ADC_CHER_CH1 (0x1u << 1)
99 #define ADC_CHER_CH2 (0x1u << 2)
100 #define ADC_CHER_CH3 (0x1u << 3)
101 #define ADC_CHER_CH4 (0x1u << 4)
102 #define ADC_CHER_CH5 (0x1u << 5)
103 #define ADC_CHER_CH6 (0x1u << 6)
104 #define ADC_CHER_CH7 (0x1u << 7)
105 /* -------- ADC_CHDR : (ADC Offset: 0x14) Channel Disable Register -------- */
106 #define ADC_CHDR_CH0 (0x1u << 0)
107 #define ADC_CHDR_CH1 (0x1u << 1)
108 #define ADC_CHDR_CH2 (0x1u << 2)
109 #define ADC_CHDR_CH3 (0x1u << 3)
110 #define ADC_CHDR_CH4 (0x1u << 4)
111 #define ADC_CHDR_CH5 (0x1u << 5)
112 #define ADC_CHDR_CH6 (0x1u << 6)
113 #define ADC_CHDR_CH7 (0x1u << 7)
114 /* -------- ADC_CHSR : (ADC Offset: 0x18) Channel Status Register -------- */
115 #define ADC_CHSR_CH0 (0x1u << 0)
116 #define ADC_CHSR_CH1 (0x1u << 1)
117 #define ADC_CHSR_CH2 (0x1u << 2)
118 #define ADC_CHSR_CH3 (0x1u << 3)
119 #define ADC_CHSR_CH4 (0x1u << 4)
120 #define ADC_CHSR_CH5 (0x1u << 5)
121 #define ADC_CHSR_CH6 (0x1u << 6)
122 #define ADC_CHSR_CH7 (0x1u << 7)
123 /* -------- ADC_SR : (ADC Offset: 0x1C) Status Register -------- */
124 #define ADC_SR_EOC0 (0x1u << 0)
125 #define ADC_SR_EOC1 (0x1u << 1)
126 #define ADC_SR_EOC2 (0x1u << 2)
127 #define ADC_SR_EOC3 (0x1u << 3)
128 #define ADC_SR_EOC4 (0x1u << 4)
129 #define ADC_SR_EOC5 (0x1u << 5)
130 #define ADC_SR_EOC6 (0x1u << 6)
131 #define ADC_SR_EOC7 (0x1u << 7)
132 #define ADC_SR_OVRE0 (0x1u << 8)
133 #define ADC_SR_OVRE1 (0x1u << 9)
134 #define ADC_SR_OVRE2 (0x1u << 10)
135 #define ADC_SR_OVRE3 (0x1u << 11)
136 #define ADC_SR_OVRE4 (0x1u << 12)
137 #define ADC_SR_OVRE5 (0x1u << 13)
138 #define ADC_SR_OVRE6 (0x1u << 14)
139 #define ADC_SR_OVRE7 (0x1u << 15)
140 #define ADC_SR_DRDY (0x1u << 16)
141 #define ADC_SR_GOVRE (0x1u << 17)
142 #define ADC_SR_ENDRX (0x1u << 18)
143 #define ADC_SR_RXBUFF (0x1u << 19)
144 /* -------- ADC_LCDR : (ADC Offset: 0x20) Last Converted Data Register -------- */
145 #define ADC_LCDR_LDATA_Pos 0
146 #define ADC_LCDR_LDATA_Msk (0x3ffu << ADC_LCDR_LDATA_Pos)
147 /* -------- ADC_IER : (ADC Offset: 0x24) Interrupt Enable Register -------- */
148 #define ADC_IER_EOC0 (0x1u << 0)
149 #define ADC_IER_EOC1 (0x1u << 1)
150 #define ADC_IER_EOC2 (0x1u << 2)
151 #define ADC_IER_EOC3 (0x1u << 3)
152 #define ADC_IER_EOC4 (0x1u << 4)
153 #define ADC_IER_EOC5 (0x1u << 5)
154 #define ADC_IER_EOC6 (0x1u << 6)
155 #define ADC_IER_EOC7 (0x1u << 7)
156 #define ADC_IER_OVRE0 (0x1u << 8)
157 #define ADC_IER_OVRE1 (0x1u << 9)
158 #define ADC_IER_OVRE2 (0x1u << 10)
159 #define ADC_IER_OVRE3 (0x1u << 11)
160 #define ADC_IER_OVRE4 (0x1u << 12)
161 #define ADC_IER_OVRE5 (0x1u << 13)
162 #define ADC_IER_OVRE6 (0x1u << 14)
163 #define ADC_IER_OVRE7 (0x1u << 15)
164 #define ADC_IER_DRDY (0x1u << 16)
165 #define ADC_IER_GOVRE (0x1u << 17)
166 #define ADC_IER_ENDRX (0x1u << 18)
167 #define ADC_IER_RXBUFF (0x1u << 19)
168 /* -------- ADC_IDR : (ADC Offset: 0x28) Interrupt Disable Register -------- */
169 #define ADC_IDR_EOC0 (0x1u << 0)
170 #define ADC_IDR_EOC1 (0x1u << 1)
171 #define ADC_IDR_EOC2 (0x1u << 2)
172 #define ADC_IDR_EOC3 (0x1u << 3)
173 #define ADC_IDR_EOC4 (0x1u << 4)
174 #define ADC_IDR_EOC5 (0x1u << 5)
175 #define ADC_IDR_EOC6 (0x1u << 6)
176 #define ADC_IDR_EOC7 (0x1u << 7)
177 #define ADC_IDR_OVRE0 (0x1u << 8)
178 #define ADC_IDR_OVRE1 (0x1u << 9)
179 #define ADC_IDR_OVRE2 (0x1u << 10)
180 #define ADC_IDR_OVRE3 (0x1u << 11)
181 #define ADC_IDR_OVRE4 (0x1u << 12)
182 #define ADC_IDR_OVRE5 (0x1u << 13)
183 #define ADC_IDR_OVRE6 (0x1u << 14)
184 #define ADC_IDR_OVRE7 (0x1u << 15)
185 #define ADC_IDR_DRDY (0x1u << 16)
186 #define ADC_IDR_GOVRE (0x1u << 17)
187 #define ADC_IDR_ENDRX (0x1u << 18)
188 #define ADC_IDR_RXBUFF (0x1u << 19)
189 /* -------- ADC_IMR : (ADC Offset: 0x2C) Interrupt Mask Register -------- */
190 #define ADC_IMR_EOC0 (0x1u << 0)
191 #define ADC_IMR_EOC1 (0x1u << 1)
192 #define ADC_IMR_EOC2 (0x1u << 2)
193 #define ADC_IMR_EOC3 (0x1u << 3)
194 #define ADC_IMR_EOC4 (0x1u << 4)
195 #define ADC_IMR_EOC5 (0x1u << 5)
196 #define ADC_IMR_EOC6 (0x1u << 6)
197 #define ADC_IMR_EOC7 (0x1u << 7)
198 #define ADC_IMR_OVRE0 (0x1u << 8)
199 #define ADC_IMR_OVRE1 (0x1u << 9)
200 #define ADC_IMR_OVRE2 (0x1u << 10)
201 #define ADC_IMR_OVRE3 (0x1u << 11)
202 #define ADC_IMR_OVRE4 (0x1u << 12)
203 #define ADC_IMR_OVRE5 (0x1u << 13)
204 #define ADC_IMR_OVRE6 (0x1u << 14)
205 #define ADC_IMR_OVRE7 (0x1u << 15)
206 #define ADC_IMR_DRDY (0x1u << 16)
207 #define ADC_IMR_GOVRE (0x1u << 17)
208 #define ADC_IMR_ENDRX (0x1u << 18)
209 #define ADC_IMR_RXBUFF (0x1u << 19)
210 /* -------- ADC_CDR[8] : (ADC Offset: 0x30) Channel Data Register -------- */
211 #define ADC_CDR_DATA_Pos 0
212 #define ADC_CDR_DATA_Msk (0x3ffu << ADC_CDR_DATA_Pos)
213 /* -------- ADC_RPR : (ADC Offset: 0x100) Receive Pointer Register -------- */
214 #define ADC_RPR_RXPTR_Pos 0
215 #define ADC_RPR_RXPTR_Msk (0xffffffffu << ADC_RPR_RXPTR_Pos)
216 #define ADC_RPR_RXPTR(value) ((ADC_RPR_RXPTR_Msk & ((value) << ADC_RPR_RXPTR_Pos)))
217 /* -------- ADC_RCR : (ADC Offset: 0x104) Receive Counter Register -------- */
218 #define ADC_RCR_RXCTR_Pos 0
219 #define ADC_RCR_RXCTR_Msk (0xffffu << ADC_RCR_RXCTR_Pos)
220 #define ADC_RCR_RXCTR(value) ((ADC_RCR_RXCTR_Msk & ((value) << ADC_RCR_RXCTR_Pos)))
221 /* -------- ADC_RNPR : (ADC Offset: 0x110) Receive Next Pointer Register -------- */
222 #define ADC_RNPR_RXNPTR_Pos 0
223 #define ADC_RNPR_RXNPTR_Msk (0xffffffffu << ADC_RNPR_RXNPTR_Pos)
224 #define ADC_RNPR_RXNPTR(value) ((ADC_RNPR_RXNPTR_Msk & ((value) << ADC_RNPR_RXNPTR_Pos)))
225 /* -------- ADC_RNCR : (ADC Offset: 0x114) Receive Next Counter Register -------- */
226 #define ADC_RNCR_RXNCTR_Pos 0
227 #define ADC_RNCR_RXNCTR_Msk (0xffffu << ADC_RNCR_RXNCTR_Pos)
228 #define ADC_RNCR_RXNCTR(value) ((ADC_RNCR_RXNCTR_Msk & ((value) << ADC_RNCR_RXNCTR_Pos)))
229 /* -------- ADC_PTCR : (ADC Offset: 0x120) Transfer Control Register -------- */
230 #define ADC_PTCR_RXTEN (0x1u << 0)
231 #define ADC_PTCR_RXTDIS (0x1u << 1)
232 #define ADC_PTCR_TXTEN (0x1u << 8)
233 #define ADC_PTCR_TXTDIS (0x1u << 9)
234 /* -------- ADC_PTSR : (ADC Offset: 0x124) Transfer Status Register -------- */
235 #define ADC_PTSR_RXTEN (0x1u << 0)
236 #define ADC_PTSR_TXTEN (0x1u << 8)
239 
240 
241 #endif /* _SAM3U_ADC_COMPONENT_ */
volatile uint32_t RwReg
Definition: sam3n00a.h:54
volatile uint32_t WoReg
Definition: sam3n00a.h:53
RoReg ADC_SR
(Adc Offset: 0x1C) Status Register
Definition: component_adc.h:48
volatile const uint32_t RoReg
Definition: sam3n00a.h:49
Adc hardware registers.
Definition: component_adc.h:41