]>
git.zerfleddert.de Git - proxmark3-svn/blob - include/at91sam7s128.h
1a5fe1c455a07f44670d8f08bf276b5addbd867d
1 //-----------------------------------------------------------------------------
2 // Incomplete register definitions for the AT91SAM7S128 chip.
3 // Jonathan Westhues, Jul 2005
4 //-----------------------------------------------------------------------------
6 #ifndef __AT91SAM7S128_H
7 #define __AT91SAM7S128_H
9 #define REG(x) (*(volatile unsigned long *)(x))
14 #define PERIPH_AIC_FIQ 0
15 #define PERIPH_SYSIRQ 1
23 #define PERIPH_PWMC 10
28 #define PERIPH_AIC_IRQ0 30
29 #define PERIPH_AIC_IRQ1 31
34 #define RSTC_BASE (0xfffffd00)
36 #define RSTC_CONTROL REG(RSTC_BASE+0x00)
38 #define RST_CONTROL_KEY (0xa5<<24)
39 #define RST_CONTROL_PROCESSOR_RESET (1<<0)
44 #define PWM_BASE (0xfffcc000)
46 #define PWM_MODE REG(PWM_BASE+0x00)
47 #define PWM_ENABLE REG(PWM_BASE+0x04)
48 #define PWM_DISABLE REG(PWM_BASE+0x08)
49 #define PWM_STATUS REG(PWM_BASE+0x0c)
50 #define PWM_INTERRUPT_ENABLE REG(PWM_BASE+0x10)
51 #define PWM_INTERRUPT_DISABLE REG(PWM_BASE+0x14)
52 #define PWM_INTERRUPT_MASK REG(PWM_BASE+0x18)
53 #define PWM_INTERRUPT_STATUS REG(PWM_BASE+0x1c)
54 #define PWM_CH_MODE(x) REG(PWM_BASE+0x200+((x)*0x20))
55 #define PWM_CH_DUTY_CYCLE(x) REG(PWM_BASE+0x204+((x)*0x20))
56 #define PWM_CH_PERIOD(x) REG(PWM_BASE+0x208+((x)*0x20))
57 #define PWM_CH_COUNTER(x) REG(PWM_BASE+0x20c+((x)*0x20))
58 #define PWM_CH_UPDATE(x) REG(PWM_BASE+0x210+((x)*0x20))
60 #define PWM_MODE_DIVA(x) ((x)<<0)
61 #define PWM_MODE_PREA(x) ((x)<<8)
62 #define PWM_MODE_DIVB(x) ((x)<<16)
63 #define PWM_MODE_PREB(x) ((x)<<24)
65 #define PWM_CHANNEL(x) (1<<(x))
67 #define PWM_CH_MODE_PRESCALER(x) ((x)<<0)
68 #define PWM_CH_MODE_PERIOD_CENTER_ALIGNED (1<<8)
69 #define PWM_CH_MODE_POLARITY_STARTS_HIGH (1<<9)
70 #define PWM_CH_MODE_UPDATE_UPDATES_PERIOD (1<<10)
75 #define DBG_BASE (0xfffff200)
77 #define DBGU_CR REG(DBG_BASE+0x0000)
78 #define DBGU_MR REG(DBG_BASE+0x0004)
79 #define DBGU_IER REG(DBG_BASE+0x0008)
80 #define DBGU_IDR REG(DBG_BASE+0x000C)
81 #define DBGU_IMR REG(DBG_BASE+0x0010)
82 #define DBGU_SR REG(DBG_BASE+0x0014)
83 #define DBGU_RHR REG(DBG_BASE+0x0018)
84 #define DBGU_THR REG(DBG_BASE+0x001C)
85 #define DBGU_BRGR REG(DBG_BASE+0x0020)
86 #define DBGU_CIDR REG(DBG_BASE+0x0040)
87 #define DBGU_EXID REG(DBG_BASE+0x0044)
88 #define DBGU_FNR REG(DBG_BASE+0x0048)
91 // Embedded Flash Controller
93 #define MC_BASE (0xffffff00)
95 #define MC_FLASH_MODE0 REG(MC_BASE+0x60)
96 #define MC_FLASH_COMMAND REG(MC_BASE+0x64)
97 #define MC_FLASH_STATUS REG(MC_BASE+0x68)
98 #define MC_FLASH_MODE1 REG(MC_BASE+0x70)
100 #define MC_FLASH_MODE_READY_INTERRUPT_ENABLE (1<<0)
101 #define MC_FLASH_MODE_LOCK_INTERRUPT_ENABLE (1<<2)
102 #define MC_FLASH_MODE_PROG_ERROR_INTERRUPT_ENABLE (1<<3)
103 #define MC_FLASH_MODE_NO_ERASE_BEFORE_PROGRAMMING (1<<7)
104 #define MC_FLASH_MODE_FLASH_WAIT_STATES(x) ((x)<<8)
105 #define MC_FLASH_MODE_MASTER_CLK_IN_MHZ(x) ((x)<<16)
107 #define MC_FLASH_COMMAND_FCMD(x) ((x)<<0)
108 #define MC_FLASH_COMMAND_PAGEN(x) ((x)<<8)
109 #define MC_FLASH_COMMAND_KEY ((0x5a)<<24)
112 #define FCMD_WRITE_PAGE 0x1
113 #define FCMD_SET_LOCK_BIT 0x2
114 #define FCMD_WRITE_PAGE_LOCK 0x3
115 #define FCMD_CLEAR_LOCK_BIT 0x4
116 #define FCMD_ERASE_ALL 0x8
117 #define FCMD_SET_GP_NVM_BIT 0xb
118 #define FCMD_SET_SECURITY_BIT 0xf
120 #define MC_FLASH_STATUS_READY (1<<0)
121 #define MC_FLASH_STATUS_LOCK_ERROR (1<<2)
122 #define MC_FLASH_STATUS_PROGRAMMING_ERROR (1<<3)
123 #define MC_FLASH_STATUS_SECURITY_BIT_ACTIVE (1<<4)
124 #define MC_FLASH_STATUS_GP_NVM_ACTIVE_0 (1<<8)
125 #define MC_FLASH_STATUS_GP_NVM_ACTIVE_1 (1<<9)
126 #define MC_FLASH_STATUS_LOCK_ACTIVE(x) (1<<((x)+16))
128 #define FLASH_PAGE_SIZE_BYTES 256
129 #define FLASH_PAGE_COUNT 512
132 // Watchdog Timer - 12 bit down counter, uses slow clock divided by 128 as source
134 #define WDT_BASE (0xfffffd40)
136 #define WDT_CONTROL REG(WDT_BASE+0x00)
137 #define WDT_MODE REG(WDT_BASE+0x04)
138 #define WDT_STATUS REG(WDT_BASE+0x08)
140 #define WDT_HIT() WDT_CONTROL = 0xa5000001
142 #define WDT_MODE_COUNT(x) ((x)<<0)
143 #define WDT_MODE_INTERRUPT_ON_EVENT (1<<12)
144 #define WDT_MODE_RESET_ON_EVENT_ENABLE (1<<13)
145 #define WDT_MODE_RESET_ON_EVENT (1<<14)
146 #define WDT_MODE_WATCHDOG_DELTA(x) ((x)<<16)
147 #define WDT_MODE_HALT_IN_DEBUG_MODE (1<<28)
148 #define WDT_MODE_HALT_IN_IDLE_MODE (1<<29)
149 #define WDT_MODE_DISABLE (1<<15)
152 // Parallel Input/Output Controller
154 #define PIO_BASE (0xfffff400)
156 #define PIO_ENABLE REG(PIO_BASE+0x000)
157 #define PIO_DISABLE REG(PIO_BASE+0x004)
158 #define PIO_STATUS REG(PIO_BASE+0x008)
159 #define PIO_OUTPUT_ENABLE REG(PIO_BASE+0x010)
160 #define PIO_OUTPUT_DISABLE REG(PIO_BASE+0x014)
161 #define PIO_OUTPUT_STATUS REG(PIO_BASE+0x018)
162 #define PIO_GLITCH_ENABLE REG(PIO_BASE+0x020)
163 #define PIO_GLITCH_DISABLE REG(PIO_BASE+0x024)
164 #define PIO_GLITCH_STATUS REG(PIO_BASE+0x028)
165 #define PIO_OUTPUT_DATA_SET REG(PIO_BASE+0x030)
166 #define PIO_OUTPUT_DATA_CLEAR REG(PIO_BASE+0x034)
167 #define PIO_OUTPUT_DATA_STATUS REG(PIO_BASE+0x038)
168 #define PIO_PIN_DATA_STATUS REG(PIO_BASE+0x03c)
169 #define PIO_OPEN_DRAIN_ENABLE REG(PIO_BASE+0x050)
170 #define PIO_OPEN_DRAIN_DISABLE REG(PIO_BASE+0x054)
171 #define PIO_OPEN_DRAIN_STATUS REG(PIO_BASE+0x058)
172 #define PIO_NO_PULL_UP_ENABLE REG(PIO_BASE+0x060)
173 #define PIO_NO_PULL_UP_DISABLE REG(PIO_BASE+0x064)
174 #define PIO_NO_PULL_UP_STATUS REG(PIO_BASE+0x068)
175 #define PIO_PERIPHERAL_A_SEL REG(PIO_BASE+0x070)
176 #define PIO_PERIPHERAL_B_SEL REG(PIO_BASE+0x074)
177 #define PIO_PERIPHERAL_WHICH REG(PIO_BASE+0x078)
178 #define PIO_OUT_WRITE_ENABLE REG(PIO_BASE+0x0a0)
179 #define PIO_OUT_WRITE_DISABLE REG(PIO_BASE+0x0a4)
180 #define PIO_OUT_WRITE_STATUS REG(PIO_BASE+0x0a8)
185 #define UDP_BASE (0xfffb0000)
187 #define UDP_FRAME_NUMBER REG(UDP_BASE+0x0000)
188 #define UDP_GLOBAL_STATE REG(UDP_BASE+0x0004)
189 #define UDP_FUNCTION_ADDR REG(UDP_BASE+0x0008)
190 #define UDP_INTERRUPT_ENABLE REG(UDP_BASE+0x0010)
191 #define UDP_INTERRUPT_DISABLE REG(UDP_BASE+0x0014)
192 #define UDP_INTERRUPT_MASK REG(UDP_BASE+0x0018)
193 #define UDP_INTERRUPT_STATUS REG(UDP_BASE+0x001c)
194 #define UDP_INTERRUPT_CLEAR REG(UDP_BASE+0x0020)
195 #define UDP_RESET_ENDPOINT REG(UDP_BASE+0x0028)
196 #define UDP_ENDPOINT_CSR(x) REG(UDP_BASE+0x0030+((x)*4))
197 #define UDP_ENDPOINT_FIFO(x) REG(UDP_BASE+0x0050+((x)*4))
198 #define UDP_TRANSCEIVER_CTRL REG(UDP_BASE+0x0074)
200 #define UDP_GLOBAL_STATE_ADDRESSED (1<<0)
201 #define UDP_GLOBAL_STATE_CONFIGURED (1<<1)
202 #define UDP_GLOBAL_STATE_SEND_RESUME_ENABLED (1<<2)
203 #define UDP_GLOBAL_STATE_RESUME_RECEIVED (1<<3)
204 #define UDP_GLOBAL_STATE_REMOTE_WAKE_UP_ENABLED (1<<4)
206 #define UDP_FUNCTION_ADDR_ENABLED (1<<8)
208 #define UDP_INTERRUPT_ENDPOINT(x) (1<<(x))
209 #define UDP_INTERRUPT_SUSPEND (1<<8)
210 #define UDP_INTERRUPT_RESUME (1<<9)
211 #define UDP_INTERRUPT_EXTERNAL_RESUME (1<<10)
212 #define UDP_INTERRUPT_SOF (1<<11)
213 #define UDP_INTERRUPT_END_OF_BUS_RESET (1<<12)
214 #define UDP_INTERRUPT_WAKEUP (1<<13)
216 #define UDP_RESET_ENDPOINT_NUMBER(x) (1<<(x))
218 #define UDP_CSR_TX_PACKET_ACKED (1<<0)
219 #define UDP_CSR_RX_PACKET_RECEIVED_BANK_0 (1<<1)
220 #define UDP_CSR_RX_HAVE_READ_SETUP_DATA (1<<2)
221 #define UDP_CSR_STALL_SENT (1<<3)
222 #define UDP_CSR_TX_PACKET (1<<4)
223 #define UDP_CSR_FORCE_STALL (1<<5)
224 #define UDP_CSR_RX_PACKET_RECEIVED_BANK_1 (1<<6)
225 #define UDP_CSR_CONTROL_DATA_DIR (1<<7)
226 #define UDP_CSR_EPTYPE_CONTROL (0<<8)
227 #define UDP_CSR_EPTYPE_ISOCHRON_OUT (1<<8)
228 #define UDP_CSR_EPTYPE_ISOCHRON_IN (5<<8)
229 #define UDP_CSR_EPTYPE_BULK_OUT (2<<8)
230 #define UDP_CSR_EPTYPE_BULK_IN (6<<8)
231 #define UDP_CSR_EPTYPE_INTERRUPT_OUT (3<<8)
232 #define UDP_CSR_EPTYPE_INTERRUPT_IN (7<<8)
233 #define UDP_CSR_IS_DATA1 (1<<11)
234 #define UDP_CSR_ENABLE_EP (1<<15)
235 #define UDP_CSR_BYTES_RECEIVED(x) (((x) >> 16) & 0x7ff)
237 #define UDP_TRANSCEIVER_CTRL_DISABLE (1<<8)
240 // Power Management Controller
242 #define PMC_BASE (0xfffffc00)
244 #define PMC_SYS_CLK_ENABLE REG(PMC_BASE+0x0000)
245 #define PMC_SYS_CLK_DISABLE REG(PMC_BASE+0x0004)
246 #define PMC_SYS_CLK_STATUS REG(PMC_BASE+0x0008)
247 #define PMC_PERIPHERAL_CLK_ENABLE REG(PMC_BASE+0x0010)
248 #define PMC_PERIPHERAL_CLK_DISABLE REG(PMC_BASE+0x0014)
249 #define PMC_PERIPHERAL_CLK_STATUS REG(PMC_BASE+0x0018)
250 #define PMC_MAIN_OSCILLATOR REG(PMC_BASE+0x0020)
251 #define PMC_MAIN_CLK_FREQUENCY REG(PMC_BASE+0x0024)
252 #define PMC_PLL REG(PMC_BASE+0x002c)
253 #define PMC_MASTER_CLK REG(PMC_BASE+0x0030)
254 #define PMC_PROGRAMMABLE_CLK_0 REG(PMC_BASE+0x0040)
255 #define PMC_PROGRAMMABLE_CLK_1 REG(PMC_BASE+0x0044)
256 #define PMC_INTERRUPT_ENABLE REG(PMC_BASE+0x0060)
257 #define PMC_INTERRUPT_DISABLE REG(PMC_BASE+0x0064)
258 #define PMC_INTERRUPT_STATUS REG(PMC_BASE+0x0068)
259 #define PMC_INTERRUPT_MASK REG(PMC_BASE+0x006c)
261 #define PMC_SYS_CLK_PROCESSOR_CLK (1<<0)
262 #define PMC_SYS_CLK_UDP_CLK (1<<7)
263 #define PMC_SYS_CLK_PROGRAMMABLE_CLK_0 (1<<8)
264 #define PMC_SYS_CLK_PROGRAMMABLE_CLK_1 (1<<9)
265 #define PMC_SYS_CLK_PROGRAMMABLE_CLK_2 (1<<10)
267 #define PMC_MAIN_OSCILLATOR_STABILIZED (1<<0)
268 #define PMC_MAIN_OSCILLATOR_PLL_LOCK (1<<2)
269 #define PMC_MAIN_OSCILLATOR_MCK_READY (1<<3)
270 #define PMC_MAIN_OSCILLATOR_ENABLE (1<<0)
271 #define PMC_MAIN_OSCILLATOR_BYPASS (1<<1)
272 #define PMC_MAIN_OSCILLATOR_STARTUP_DELAY(x) ((x)<<8)
274 #define PMC_PLL_DIVISOR(x) (x)
275 #define PMC_PLL_COUNT_BEFORE_LOCK(x) ((x)<<8)
276 #define PMC_PLL_FREQUENCY_RANGE(x) ((x)<<14)
277 #define PMC_PLL_MULTIPLIER(x) (((x)-1)<<16)
278 #define PMC_PLL_USB_DIVISOR(x) ((x)<<28)
280 #define PMC_CLK_SELECTION_PLL_CLOCK (3<<0)
281 #define PMC_CLK_SELECTION_MAIN_CLOCK (1<<0)
282 #define PMC_CLK_SELECTION_SLOW_CLOCK (0<<0)
283 #define PMC_CLK_PRESCALE_DIV_1 (0<<2)
284 #define PMC_CLK_PRESCALE_DIV_2 (1<<2)
285 #define PMC_CLK_PRESCALE_DIV_4 (2<<2)
286 #define PMC_CLK_PRESCALE_DIV_8 (3<<2)
287 #define PMC_CLK_PRESCALE_DIV_16 (4<<2)
288 #define PMC_CLK_PRESCALE_DIV_32 (5<<2)
289 #define PMC_CLK_PRESCALE_DIV_64 (6<<2)
292 // Serial Peripheral Interface (SPI)
294 #define SPI_BASE (0xfffe0000)
296 #define SPI_CONTROL REG(SPI_BASE+0x00)
297 #define SPI_MODE REG(SPI_BASE+0x04)
298 #define SPI_RX_DATA REG(SPI_BASE+0x08)
299 #define SPI_TX_DATA REG(SPI_BASE+0x0c)
300 #define SPI_STATUS REG(SPI_BASE+0x10)
301 #define SPI_INTERRUPT_ENABLE REG(SPI_BASE+0x14)
302 #define SPI_INTERRUPT_DISABLE REG(SPI_BASE+0x18)
303 #define SPI_INTERRUPT_MASK REG(SPI_BASE+0x1c)
304 #define SPI_FOR_CHIPSEL_0 REG(SPI_BASE+0x30)
305 #define SPI_FOR_CHIPSEL_1 REG(SPI_BASE+0x34)
306 #define SPI_FOR_CHIPSEL_2 REG(SPI_BASE+0x38)
307 #define SPI_FOR_CHIPSEL_3 REG(SPI_BASE+0x3c)
309 #define SPI_CONTROL_ENABLE (1<<0)
310 #define SPI_CONTROL_DISABLE (1<<1)
311 #define SPI_CONTROL_RESET (1<<7)
312 #define SPI_CONTROL_LAST_TRANSFER (1<<24)
314 #define SPI_MODE_MASTER (1<<0)
315 #define SPI_MODE_VARIABLE_CHIPSEL (1<<1)
316 #define SPI_MODE_CHIPSELS_DECODED (1<<2)
317 #define SPI_MODE_USE_DIVIDED_CLOCK (1<<3)
318 #define SPI_MODE_MODE_FAULT_DETECTION_OFF (1<<4)
319 #define SPI_MODE_LOOPBACK (1<<7)
320 #define SPI_MODE_CHIPSEL(x) ((x)<<16)
321 #define SPI_MODE_DELAY_BETWEEN_CHIPSELS(x) ((x)<<24)
323 #define SPI_RX_DATA_CHIPSEL(x) (((x)>>16)&0xf)
325 #define SPI_TX_DATA_CHIPSEL(x) ((x)<<16)
326 #define SPI_TX_DATA_LAST_TRANSFER (1<<24)
328 #define SPI_STATUS_RECEIVE_FULL (1<<0)
329 #define SPI_STATUS_TRANSMIT_EMPTY (1<<1)
330 #define SPI_STATUS_MODE_FAULT (1<<2)
331 #define SPI_STATUS_OVERRUN (1<<3)
332 #define SPI_STATUS_END_OF_RX_BUFFER (1<<4)
333 #define SPI_STATUS_END_OF_TX_BUFFER (1<<5)
334 #define SPI_STATUS_RX_BUFFER_FULL (1<<6)
335 #define SPI_STATUS_TX_BUFFER_EMPTY (1<<7)
336 #define SPI_STATUS_NSS_RISING_DETECTED (1<<8)
337 #define SPI_STATUS_TX_EMPTY (1<<9)
338 #define SPI_STATUS_SPI_ENABLED (1<<16)
340 #define SPI_FOR_CHIPSEL_INACTIVE_CLK_1 (1<<0)
341 #define SPI_FOR_CHIPSEL_PHASE (1<<1)
342 #define SPI_FOR_CHIPSEL_LEAVE_CHIPSEL_LOW (1<<3)
343 #define SPI_FOR_CHIPSEL_BITS_IN_WORD(x) ((x)<<4)
344 #define SPI_FOR_CHIPSEL_DIVISOR(x) ((x)<<8)
345 #define SPI_FOR_CHIPSEL_DELAY_BEFORE_CLK(x) ((x)<<16)
346 #define SPI_FOR_CHIPSEL_INTERWORD_DELAY(x) ((x)<<24)
349 // Analog to Digital Converter
351 #define ADC_BASE (0xfffd8000)
353 #define ADC_CONTROL REG(ADC_BASE+0x00)
354 #define ADC_MODE REG(ADC_BASE+0x04)
355 #define ADC_CHANNEL_ENABLE REG(ADC_BASE+0x10)
356 #define ADC_CHANNEL_DISABLE REG(ADC_BASE+0x14)
357 #define ADC_CHANNEL_STATUS REG(ADC_BASE+0x18)
358 #define ADC_STATUS REG(ADC_BASE+0x1c)
359 #define ADC_LAST_CONVERTED_DATA REG(ADC_BASE+0x20)
360 #define ADC_INTERRUPT_ENABLE REG(ADC_BASE+0x24)
361 #define ADC_INTERRUPT_DISABLE REG(ADC_BASE+0x28)
362 #define ADC_INTERRUPT_MASK REG(ADC_BASE+0x2c)
363 #define ADC_CHANNEL_DATA(x) REG(ADC_BASE+0x30+(4*(x)))
365 #define ADC_CONTROL_RESET (1<<0)
366 #define ADC_CONTROL_START (1<<1)
368 #define ADC_MODE_HW_TRIGGERS_ENABLED (1<<0)
369 #define ADC_MODE_8_BIT_RESOLUTION (1<<4)
370 #define ADC_MODE_SLEEP (1<<5)
371 #define ADC_MODE_PRESCALE(x) ((x)<<8)
372 #define ADC_MODE_STARTUP_TIME(x) ((x)<<16)
373 #define ADC_MODE_SAMPLE_HOLD_TIME(x) ((x)<<24)
375 #define ADC_CHANNEL(x) (1<<(x))
377 #define ADC_END_OF_CONVERSION(x) (1<<(x))
378 #define ADC_OVERRUN_ERROR(x) (1<<(8+(x)))
379 #define ADC_DATA_READY (1<<16)
380 #define ADC_GENERAL_OVERRUN (1<<17)
381 #define ADC_END_OF_RX_BUFFER (1<<18)
382 #define ADC_RX_BUFFER_FULL (1<<19)
385 // Synchronous Serial Controller
387 #define SSC_BASE (0xfffd4000)
389 #define SSC_CONTROL REG(SSC_BASE+0x00)
390 #define SSC_CLOCK_DIVISOR REG(SSC_BASE+0x04)
391 #define SSC_RECEIVE_CLOCK_MODE REG(SSC_BASE+0x10)
392 #define SSC_RECEIVE_FRAME_MODE REG(SSC_BASE+0x14)
393 #define SSC_TRANSMIT_CLOCK_MODE REG(SSC_BASE+0x18)
394 #define SSC_TRANSMIT_FRAME_MODE REG(SSC_BASE+0x1c)
395 #define SSC_RECEIVE_HOLDING REG(SSC_BASE+0x20)
396 #define SSC_TRANSMIT_HOLDING REG(SSC_BASE+0x24)
397 #define SSC_RECEIVE_SYNC_HOLDING REG(SSC_BASE+0x30)
398 #define SSC_TRANSMIT_SYNC_HOLDING REG(SSC_BASE+0x34)
399 #define SSC_STATUS REG(SSC_BASE+0x40)
400 #define SSC_INTERRUPT_ENABLE REG(SSC_BASE+0x44)
401 #define SSC_INTERRUPT_DISABLE REG(SSC_BASE+0x48)
402 #define SSC_INTERRUPT_MASK REG(SSC_BASE+0x4c)
404 #define SSC_CONTROL_RX_ENABLE (1<<0)
405 #define SSC_CONTROL_RX_DISABLE (1<<1)
406 #define SSC_CONTROL_TX_ENABLE (1<<8)
407 #define SSC_CONTROL_TX_DISABLE (1<<9)
408 #define SSC_CONTROL_RESET (1<<15)
410 #define SSC_CLOCK_MODE_SELECT(x) ((x)<<0)
411 #define SSC_CLOCK_MODE_OUTPUT(x) ((x)<<2)
412 #define SSC_CLOCK_MODE_INVERT (1<<5)
413 #define SSC_CLOCK_MODE_START(x) ((x)<<8)
414 #define SSC_CLOCK_MODE_START_DELAY(x) ((x)<<16)
415 #define SSC_CLOCK_MODE_FRAME_PERIOD(x) ((x)<<24)
417 #define SSC_FRAME_MODE_BITS_IN_WORD(x) (((x)-1)<<0)
418 #define SSC_FRAME_MODE_LOOPBACK (1<<5) // for RX
419 #define SSC_FRAME_MODE_DEFAULT_IS_1 (1<<5) // for TX
420 #define SSC_FRAME_MODE_MSB_FIRST (1<<7)
421 #define SSC_FRAME_MODE_WORDS_PER_TRANSFER(x) ((x)<<8)
422 #define SSC_FRAME_MODE_FRAME_SYNC_LEN(x) ((x)<<16)
423 #define SSC_FRAME_MODE_FRAME_SYNC_TYPE(x) ((x)<<20)
424 #define SSC_FRAME_MODE_SYNC_DATA_ENABLE (1<<23) // for TX only
425 #define SSC_FRAME_MODE_NEGATIVE_EDGE (1<<24)
427 #define SSC_STATUS_TX_READY (1<<0)
428 #define SSC_STATUS_TX_EMPTY (1<<1)
429 #define SSC_STATUS_TX_ENDED (1<<2)
430 #define SSC_STATUS_TX_BUF_EMPTY (1<<3)
431 #define SSC_STATUS_RX_READY (1<<4)
432 #define SSC_STATUS_RX_OVERRUN (1<<5)
433 #define SSC_STATUS_RX_ENDED (1<<6)
434 #define SSC_STATUS_RX_BUF_FULL (1<<7)
435 #define SSC_STATUS_TX_SYNC_OCCURRED (1<<10)
436 #define SSC_STATUS_RX_SYNC_OCCURRED (1<<11)
437 #define SSC_STATUS_TX_ENABLED (1<<16)
438 #define SSC_STATUS_RX_ENABLED (1<<17)
441 // Peripheral DMA Controller
443 // There is one set of registers for every peripheral that supports DMA.
445 #define PDC_RX_POINTER(x) REG((x)+0x100)
446 #define PDC_RX_COUNTER(x) REG((x)+0x104)
447 #define PDC_TX_POINTER(x) REG((x)+0x108)
448 #define PDC_TX_COUNTER(x) REG((x)+0x10c)
449 #define PDC_RX_NEXT_POINTER(x) REG((x)+0x110)
450 #define PDC_RX_NEXT_COUNTER(x) REG((x)+0x114)
451 #define PDC_TX_NEXT_POINTER(x) REG((x)+0x118)
452 #define PDC_TX_NEXT_COUNTER(x) REG((x)+0x11c)
453 #define PDC_CONTROL(x) REG((x)+0x120)
454 #define PDC_STATUS(x) REG((x)+0x124)
456 #define PDC_RX_ENABLE (1<<0)
457 #define PDC_RX_DISABLE (1<<1)
458 #define PDC_TX_ENABLE (1<<8)
459 #define PDC_TX_DISABLE (1<<9)