at91sam7.h
Go to the documentation of this file.00001
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 #ifndef AT91SAM7_H
00075 #define AT91SAM7_H
00076
00077 #include <cfg/compiler.h>
00078
00079 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7S256
00080 #define FLASH_BASE 0x100000UL
00081 #define RAM_BASE 0x200000UL
00082
00083 #define TC_BASE 0xFFFA0000
00084 #define UDP_BASE 0xFFFB0000
00085 #define TWI_BASE 0xFFFB8000
00086 #define USART0_BASE 0xFFFC0000
00087 #define USART1_BASE 0xFFFC4000
00088 #define PWMC_BASE 0xFFFCC000
00089 #define SSC_BASE 0xFFFD4000
00090 #define ADC_BASE 0xFFFD8000
00091
00092 #define AIC_BASE 0xFFFFF000
00093 #define DBGU_BASE 0xFFFFF200
00094 #define PIOA_BASE 0xFFFFF400
00095 #define PMC_BASE 0xFFFFFC00
00096 #define RSTC_BASE 0xFFFFFD00
00097 #define RTT_BASE 0xFFFFFD20
00098 #define PIT_BASE 0xFFFFFD30
00099 #define WDT_BASE 0xFFFFFD40
00100 #define VREG_BASE 0xFFFFFD60
00101 #define MC_BASE 0xFFFFFF00
00102
00103 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00104 #define CAN_BASE 0xFFFD0000
00105 #define EMAC_BASE 0xFFFDC000
00106 #define SPI0_BASE 0xFFFE0000
00107 #define SPI1_BASE 0xFFFE4000
00108 #define PIOB_BASE 0xFFFFF600
00109 #endif
00110
00111 #if CPU_ARM_AT91SAM7S256
00112 #define SPI_BASE 0xFFFE0000
00113 #endif
00114
00115 #define PIO_HAS_MULTIDRIVER 1
00116 #define PIO_HAS_PULLUP 1
00117 #define PIO_HAS_PERIPHERALSELECT 1
00118 #define PIO_HAS_OUTPUTWRITEENABLE 1
00119
00120 #define DBGU_HAS_PDC 1
00121 #define SPI_HAS_PDC 1
00122 #define SSC_HAS_PDC 1
00123 #define USART_HAS_PDC 1
00124
00125 #else
00126 #error No base addrese register definition for selected ARM CPU
00127
00128 #endif
00129
00130 #include "at91_aic.h"
00131 #include "at91_pit.h"
00132 #include "at91_pmc.h"
00133 #include "at91_mc.h"
00134 #include "at91_wdt.h"
00135 #include "at91_rstc.h"
00136 #include "at91_pio.h"
00137 #include "at91_us.h"
00138 #include "at91_dbgu.h"
00139 #include "at91_tc.h"
00140 #include "at91_adc.h"
00141 #include "at91_pwm.h"
00142 #include "at91_spi.h"
00143 #include "at91_twi.h"
00144
00145
00150 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7S256 || CPU_ARM_AT91SAM7X128
00151 #define FIQ_ID 0
00152 #define SYSC_ID 1
00153 #define US0_ID 6
00154 #define US1_ID 7
00155 #define SSC_ID 8
00156 #define TWI_ID 9
00157 #define PWMC_ID 10
00158 #define UDP_ID 11
00159 #define TC0_ID 12
00160 #define TC1_ID 13
00161 #define TC2_ID 14
00162
00163 #define IRQ0_ID 30
00164 #define IRQ1_ID 31
00165
00166 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00167 #define PIOA_ID 2
00168 #define PIOB_ID 3
00169 #define SPI0_ID 4
00170 #define SPI1_ID 5
00171 #define CAN_ID 15
00172 #define EMAC_ID 16
00173 #define ADC_ID 17
00174
00175
00176 #endif
00177
00178 #if CPU_ARM_AT91SAM7S256
00179 #define PIOA_ID 2
00180
00181 #define ADC_ID 4
00182 #define SPI_ID 5
00183 #define SPI0_ID SPI_ID
00184 #endif
00185
00186 #else
00187 #error No peripheral ID and interrupts definition for selected ARM CPU
00188
00189 #endif
00190
00191
00196 #if CPU_ARM_AT91SAM7S256
00197 #define RXD0 5
00198 #define TXD0 6
00199 #define RXD1 21
00200 #define TXD1 22
00201 #define DTXD 10
00202 #define DRXD 9
00203 #elif CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00204 #define RXD0 0 // PA0
00205 #define TXD0 1 // PA1
00206 #define RXD1 5 // PA5
00207 #define TXD1 6 // PA6
00208 #define DTXD 28 // PA28
00209 #define DRXD 27 // PA27
00210 #else
00211 #error No USART & debug pin names definition for selected ARM CPU
00212 #endif
00213
00214
00219 #if CPU_ARM_AT91SAM7S256
00220 #define SPI0_NPCS0 11 // Same as NSS pin.
00221 #define SPI0_MISO 12
00222 #define SPI0_MOSI 13
00223 #define SPI0_SPCK 14
00224
00225 #elif CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00226 #define SPI0_NPCS0 12 // Same as NSS pin. PA12
00227 #define SPI0_NPCS1 13 // PA13
00228 #define SPI0_NPCS2 14 // PA14
00229 #define SPI0_NPCS3 15 // PA15
00230 #define SPI0_MISO 16 // PA16
00231 #define SPI0_MOSI 17 // PA17
00232 #define SPI0_SPCK 18 // PA18
00233
00234 #define SPI1_NPCS0 21 // Same as NSS pin. PA21
00235 #define SPI1_NPCS1 25 // PA25
00236 #define SPI1_NPCS2 26 // PA26
00237 #define SPI1_NPCS3 29 // PA29
00238 #define SPI1_MISO 24 // PA24
00239 #define SPI1_MOSI 23 // PA23
00240 #define SPI1_SPCK 22 // PA22
00241
00242 #else
00243 #error No SPI pins name definition for selected ARM CPU
00244
00245 #endif
00246
00247
00252 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00253 #define TIOA0 23 // PB23
00254 #define TIOB0 24 // PB24
00255 #define TIOA1 25 // PB25
00256 #define TIOB1 26 // PB26
00257 #define TIOA2 27 // PB27
00258 #define TIOB2 28 // PB28
00259
00260 #define TIO_PIO_PDR PIOB_PDR
00261 #define TIO_PIO_ABSR PIOB_ASR
00262
00263 #elif CPU_ARM_AT91SAM7S256
00264 #define TIOA0 0 // PA0
00265 #define TIOB0 1 // PA1
00266 #define TIOA1 15 // PA15
00267 #define TIOB1 16 // PA16
00268 #define TIOA2 26 // PA26
00269 #define TIOB2 27 // PA27
00270
00271 #define TIO_PIO_PDR PIOA_PDR
00272 #define TIO_PIO_ABSR PIOA_BSR
00273
00274 #else
00275 #error No Timer Counter names of pins definition for selected ARM CPU
00276
00277 #endif
00278
00279
00280
00285 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00286 #define PWM0 19 // PB19
00287 #define PWM1 20 // PB20
00288 #define PWM2 21 // PB21
00289 #define PWM3 22 // PB22
00290
00291 #define PWM_PIO_PDR PIOB_PDR
00292 #define PWM_PIO_PER PIOB_PER
00293 #define PWM_PIO_CODR PIOB_CODR
00294 #define PWM_PIO_OER PIOB_OER
00295 #define PWM_PIO_ABSR PIOB_ASR
00296
00297 #elif CPU_ARM_AT91SAM7S256
00298 #define PWM0 11 // PA11
00299 #define PWM1 12 // PA12
00300 #define PWM2 13 // PA13
00301 #define PWM3 14 // PA14
00302
00303 #define PWM_PIO_PDR PIOA_PDR
00304 #define PWM_PIO_PER PIOA_PER
00305 #define PWM_PIO_CODR PIOA_CODR
00306 #define PWM_PIO_OER PIOA_OER
00307 #define PWM_PIO_ABSR PIOA_BSR
00308
00309 #else
00310 #error No PWM names of pins definition for selected ARM CPU
00311
00312 #endif
00313
00314
00319 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00320 #define TWD 10
00321 #define TWCK 11
00322
00323 #elif CPU_ARM_AT91SAM7S256
00324 #define TWD 3 //PA3
00325 #define TWCK 4 //PA4
00326
00327 #else
00328 #error No TWI names of pins definition for selected ARM CPU
00329 #endif
00330
00335 #if CPU_ARM_AT91SAM7X256 || CPU_ARM_AT91SAM7X128
00336 #define ADTRG 18 // PB18
00337 #define AD0 23 // PB27
00338 #define AD1 24 // PB28
00339 #define AD2 25 // PB29
00340 #define AD3 26 // PB30
00341
00342 #elif CPU_ARM_AT91SAM7S256
00343 #define ADTRG 18 // PA8
00344 #define AD0 0 // PA17
00345 #define AD1 1 // PA18
00346 #define AD2 15 // PA19
00347 #define AD3 16 // PA20
00348
00349 #else
00350 #error No ADC names of pins definition for selected ARM CPU
00351
00352 #endif
00353
00354
00355 #endif