sam3n port: revert to our custom made register definition includes.
[bertos.git] / bertos / cpu / cortex-m3 / io / sam3.h
index b40381e5fec1d73d8bd5692351ee28f6daf011ca..fc724ba855b632f365a83c33d826b830ad93bee6 100644 (file)
 #ifndef SAM3_H
 #define SAM3_H
 
-// TODO: refactor common cortex-m3 regs
-
 #include <cpu/detect.h>
 #include <cfg/compiler.h>
 
+/*
+ * Peripherals IDs, same as interrupt numbers.
+ */
+#define SUPC_ID    INT_SUPC     ///< Supply Controller (SUPC)
+#define RSTC_ID    INT_RSTC     ///< Reset Controller (RSTC)
+#define RTC_ID     INT_RTC      ///< Real Time Clock (RTC)
+#define RTT_ID     INT_RTT      ///< Real Time Timer (RTT)
+#define WDT_ID     INT_WDT      ///< Watchdog Timer (WDT)
+#define PMC_ID     INT_PMC      ///< Power Management Controller (PMC)
+#define EFC_ID     INT_EFC      ///< Enhanced Flash Controller (EFC)
+#define UART0_ID   INT_UART0    ///< UART 0 (UART0)
+#define UART1_ID   INT_UART1    ///< UART 1 (UART1)
+#define UART2_ID   INT_UART2    ///< UART 0 (UART0)
+#define UART3_ID   INT_UART3    ///< UART 1 (UART1)
+#define PIOA_ID    INT_PIOA     ///< Parallel I/O Controller A (PIOA)
+#define PIOB_ID    INT_PIOB     ///< Parallel I/O Controller B (PIOB)
+#define PIOC_ID    INT_PIOC     ///< Parallel I/O Controller C (PIOC)
+#define US0_ID     INT_USART0   ///< USART 0 (USART0)
+#define US1_ID     INT_USART1   ///< USART 1 (USART1)
+#define TWI0_ID    INT_TWI0     ///< Two Wire Interface 0 (TWI0)
+#define TWI1_ID    INT_TWI1     ///< Two Wire Interface 1 (TWI1)
+#define SPI0_ID    INT_SPI      ///< Serial Peripheral Interface (SPI)
+#define TC0_ID     INT_TC0      ///< Timer/Counter 0 (TC0)
+#define TC1_ID     INT_TC1      ///< Timer/Counter 1 (TC1)
+#define TC2_ID     INT_TC2      ///< Timer/Counter 2 (TC2)
+#define TC3_ID     INT_TC3      ///< Timer/Counter 3 (TC3)
+#define TC4_ID     INT_TC4      ///< Timer/Counter 4 (TC4)
+#define TC5_ID     INT_TC5      ///< Timer/Counter 5 (TC5)
+#define ADC_ID     INT_ADC      ///< Analog To Digital Converter (ADC)
+#define DACC_ID    INT_DACC     ///< Digital To Analog Converter (DACC)
+#define PWM_ID     INT_PWM      ///< Pulse Width Modulation (PWM)
+
+/*
+ * Hardware features for drivers.
+ */
+#define USART_HAS_PDC  1
+
+
 #include "sam3_sysctl.h"
 #include "sam3_pmc.h"
 #include "sam3_memmap.h"
 #include "sam3_ints.h"
-#include "sam3_gpio.h"
+#include "sam3_pio.h"
 #include "sam3_nvic.h"
 #include "sam3_uart.h"
+#include "sam3_us.h"
+#include "sam3_spi.h"
 #include "sam3_flash.h"
+#include "sam3_wdt.h"
 
+/**
+ * UART I/O pins
+ */
+/*\{*/
+#if CPU_CM3_AT91SAM3U
+       #define RXD0   11
+       #define TXD0   12
+#else
+       #define RXD0    9
+       #define TXD0   10
+       #define RXD1    2
+       #define TXD1    3
+#endif
+/*\}*/
+
+/**
+ * PIO I/O pins
+ */
+/*\{*/
+#if CPU_CM3_AT91SAM3U
+       #define SPI0_SPCK   15
+       #define SPI0_MOSI   14
+       #define SPI0_MISO   13
+#else
+       #define SPI0_SPCK   14
+       #define SPI0_MOSI   13
+       #define SPI0_MISO   12
+#endif
+/*\}*/
 #endif /* SAM3_H */