Nut/OS  4.10.3
API Reference
at91sam7x.h
Go to the documentation of this file.
00001 #ifndef _ARCH_ARM_SAM7X_H_
00002 #define _ARCH_ARM_SAM7X_H_
00003 /*
00004  * Copyright (C) 2006-2007 by egnite Software GmbH. All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  * 3. Neither the name of the copyright holders nor the names of
00016  *    contributors may be used to endorse or promote products derived
00017  *    from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00022  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00023  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00024  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00025  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00026  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00027  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00028  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00029  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  * For additional information see http://www.ethernut.de/
00033  */
00034 
00099 #define FLASH_BASE      0x100000UL
00100 #define RAM_BASE        0x200000UL
00101 
00102 #define TC_BASE         0xFFFA0000      
00103 #define UDP_BASE        0xFFFB0000      
00104 #define TWI_BASE        0xFFFB8000      
00105 #define USART0_BASE     0xFFFC0000      
00106 #define USART1_BASE     0xFFFC4000      
00107 #define PWMC_BASE       0xFFFCC000      
00108 #define CAN_BASE        0xFFFD0000      
00109 #define SSC_BASE        0xFFFD4000      
00110 #define ADC_BASE        0xFFFD8000      
00111 #define EMAC_BASE       0xFFFDC000      
00112 #define SPI0_BASE       0xFFFE0000      
00113 #define SPI1_BASE       0xFFFE4000      
00115 #define AIC_BASE        0xFFFFF000      
00116 #define DBGU_BASE       0xFFFFF200      
00117 #define PIOA_BASE       0xFFFFF400      
00118 #define PIOB_BASE       0xFFFFF600      
00119 #define PMC_BASE        0xFFFFFC00      
00120 #define RSTC_BASE       0xFFFFFD00      
00121 #define RTT_BASE        0xFFFFFD20      
00122 #define PIT_BASE        0xFFFFFD30      
00123 #define WDT_BASE        0xFFFFFD40      
00124 #define VREG_BASE       0xFFFFFD60      
00125 #define MC_BASE         0xFFFFFF00      
00127 #define PERIPH_RPR_OFF  0x00000100      
00128 #define PERIPH_RCR_OFF  0x00000104      
00129 #define PERIPH_TPR_OFF  0x00000108      
00130 #define PERIPH_TCR_OFF  0x0000010C      
00131 #define PERIPH_RNPR_OFF 0x00000110      
00132 #define PERIPH_RNCR_OFF 0x00000114      
00133 #define PERIPH_TNPR_OFF 0x00000118      
00134 #define PERIPH_TNCR_OFF 0x0000011C      
00135 #define PERIPH_PTCR_OFF 0x00000120      
00136 #define PERIPH_PTSR_OFF 0x00000124      
00138 #define PDC_RXTEN       0x00000001      
00139 #define PDC_RXTDIS      0x00000002      
00140 #define PDC_TXTEN       0x00000100      
00141 #define PDC_TXTDIS      0x00000200      
00143 #define DBGU_HAS_PDC
00144 #define SPI_HAS_PDC
00145 #define SSC_HAS_PDC
00146 #define USART_HAS_PDC
00147 #define USART_HAS_MODE
00148 
00149 #define PIO_HAS_MULTIDRIVER
00150 #define PIO_HAS_PULLUP
00151 #define PIO_HAS_PERIPHERALSELECT
00152 #define PIO_HAS_OUTPUTWRITEENABLE
00153 
00154 #include <arch/arm/atmel/at91_tc.h>
00155 #include <arch/arm/atmel/at91_us.h>
00156 #include <arch/arm/atmel/at91_dbgu.h>
00157 #include <arch/arm/atmel/at91_emac.h>
00158 #include <arch/arm/atmel/at91_spi.h>
00159 #include <arch/arm/atmel/at91_aic.h>
00160 #include <arch/arm/atmel/at91_pio.h>
00161 #include <arch/arm/atmel/at91_pmc.h>
00162 #include <arch/arm/atmel/at91_rstc.h>
00163 #include <arch/arm/atmel/at91_wdt.h>
00164 #include <arch/arm/atmel/at91_pit.h>
00165 #include <arch/arm/atmel/at91_mc.h>
00166 #include <arch/arm/atmel/at91_ssc.h>
00167 #include <arch/arm/atmel/at91_udp.h>
00168 #include <arch/arm/atmel/at91_twi.h>
00169 #include <arch/arm/atmel/at91_adc.h>
00170 
00173 
00176 #define FIQ_ID      0       
00177 #define SYSC_ID     1       
00178 #define PIOA_ID     2       
00179 #define PIOB_ID     3       
00180 #define SPI0_ID     4       
00181 #define SPI1_ID     5       
00182 #define US0_ID      6       
00183 #define US1_ID      7       
00184 #define SSC_ID      8       
00185 #define TWI_ID      9       
00186 #define PWMC_ID     10      
00187 #define UDP_ID      11      
00188 #define TC0_ID      12      
00189 #define TC1_ID      13      
00190 #define TC2_ID      14      
00191 #define CAN_ID      15      
00192 #define EMAC_ID     16      
00193 #define ADC_ID      17      
00194 #define IRQ0_ID     30      
00195 #define IRQ1_ID     31      
00197 
00198 
00200 #define SPI0_NPCS0_PA12A        12      
00201 #define SPI0_NPCS1_PA13A        13      
00202 #define SPI0_NPCS1_PA07B        7       
00203 #define SPI0_NPCS1_PB13B        13      
00204 #define SPI0_NPCS2_PA14A        14      
00205 #define SPI0_NPCS2_PA08B        8       
00206 #define SPI0_NPCS2_PB14B        14      
00207 #define SPI0_NPCS3_PA15A        15      
00208 #define SPI0_NPCS3_PA09B        9       
00209 #define SPI0_NPCS3_PB17B        17      
00210 #define SPI0_MISO_PA16A         16      
00211 #define SPI0_MOSI_PA17A         17      
00212 #define SPI0_SPCK_PA18A         18      
00214 
00215 
00217 #define PA0_RXD0_A          0
00218 #define PA1_TXD0_A          1
00219 #define PA2_SCK0_A          2
00220 #define PA3_RTS0_A          3
00221 #define PA4_CTS0_A          4
00222 
00223 #define PA5_RXD1_A          5
00224 #define PA6_TXD1_A          6
00225 #define PA7_SCK1_A          7
00226 #define PA8_RTS1_A          8
00227 #define PA9_CTS1_A          9
00228 #define PB23_DCD1_B         23
00229 #define PB24_DSR1_B         24
00230 #define PB25_DTR1_B         25
00231 #define PB26_RI1_B          26
00232 
00236 #define PA16_SPI0_MISO_A    16
00237 #define PA17_SPI0_MOSI_A    17
00238 #define PA18_SPI0_SPCK_A    18
00239 #define PA12_SPI0_NPCS0_A   12
00240 #define PA13_SPI0_NPCS1_A   13
00241 #define PA7_SPI0_NPCS1_B    7
00242 #define PA14_SPI0_NPCS2_A   14
00243 #define PB14_SPI0_NPCS2_B   14
00244 #define PA8_SPI0_NPCS2_B    8
00245 #define PA15_SPI0_NPCS3_A   15
00246 #define PA9_SPI0_NPCS3_B    9
00247 
00248 #define SPI0_PINS           _BV(PA16_SPI0_MISO_A) | _BV(PA17_SPI0_MOSI_A) | _BV(PA18_SPI0_SPCK_A)
00249 #define SPI0_PIO_BASE       PIOA_BASE
00250 #define SPI0_PSR_OFF        PIO_ASR_OFF
00251 
00252 #define SPI0_CS0_PIN        _BV(PA12_SPI0_NPCS0_A)
00253 #define SPI0_CS0_PIO_BASE   PIOA_BASE
00254 #define SPI0_CS0_PSR_OFF    PIO_ASR_OFF
00255 
00256 #ifndef SPI0_CS1_PIN
00257 #define SPI0_CS1_PIN        _BV(PA13_SPI0_NPCS1_A)
00258 #define SPI0_CS1_PIO_BASE   PIOA_BASE
00259 #define SPI0_CS1_PSR_OFF    PIO_ASR_OFF
00260 #endif
00261 
00262 #ifndef SPI0_CS2_PIN
00263 #define SPI0_CS2_PIN        _BV(PA14_SPI0_NPCS2_A)
00264 #define SPI0_CS2_PIO_BASE   PIOA_BASE
00265 #define SPI0_CS2_PSR_OFF    PIO_ASR_OFF
00266 #endif
00267 
00268 #ifndef SPI0_CS3_PIN
00269 #define SPI0_CS3_PIN        _BV(PA15_SPI0_NPCS3_A)
00270 #define SPI0_CS3_PIO_BASE   PIOA_BASE
00271 #define SPI0_CS3_PSR_OFF    PIO_ASR_OFF
00272 #endif
00273 
00274 #define PA24_SPI1_MISO_B    24
00275 #define PA23_SPI1_MOSI_B    23
00276 #define PA22_SPI1_SPCK_B    22
00277 #define PA21_SPI1_NPCS0_B   21
00278 #define PA25_SPI1_NPCS1_B   25
00279 #define PB13_SPI0_NPCS1_B   13
00280 #define PA2_SPI1_NPCS1_B    2
00281 #define PB10_SPI1_NPCS1_B   10
00282 #define PA26_SPI1_NPCS2_B   26
00283 #define PA3_SPI1_NPCS2_B    3
00284 #define PB11_SPI1_NPCS2_B   11
00285 #define PB17_SPI0_NPCS3_B   17
00286 #define PA4_SPI1_NPCS3_B    4
00287 #define PA29_SPI1_NPCS3_B   29
00288 #define PB16_SPI1_NPCS3_B   16
00289 
00290 #define SPI1_PINS           _BV(PA24_SPI1_MISO_B) | _BV(PA23_SPI1_MOSI_B) | _BV(PA22_SPI1_SPCK_B)
00291 #define SPI1_PIO_BASE       PIOA_BASE
00292 #define SPI1_PSR_OFF        PIO_BSR_OFF
00293 
00294 #define SPI1_CS0_PIN        _BV(PA21_SPI1_NPCS0_B)
00295 #define SPI1_CS0_PIO_BASE   PIOA_BASE
00296 #define SPI1_CS0_PSR_OFF    PIO_BSR_OFF
00297 
00298 #ifndef SPI1_CS1_PIN
00299 #define SPI1_CS1_PIN        _BV(PA25_SPI1_NPCS1_B)
00300 #define SPI1_CS1_PIO_BASE   PIOA_BASE
00301 #define SPI1_CS1_PSR_OFF    PIO_BSR_OFF
00302 #endif
00303 
00304 #ifndef SPI1_CS2_PIN
00305 #define SPI1_CS2_PIN        _BV(PA26_SPI1_NPCS2_B)
00306 #define SPI1_CS2_PIO_BASE   PIOA_BASE
00307 #define SPI1_CS2_PSR_OFF    PIO_BSR_OFF
00308 #endif
00309 
00310 #ifndef SPI1_CS3_PIN
00311 #define SPI1_CS3_PIN        _BV(PA29_SPI1_NPCS3_B)
00312 #define SPI1_CS3_PIO_BASE   PIOA_BASE
00313 #define SPI1_CS3_PSR_OFF    PIO_BSR_OFF
00314 #endif
00315 
00320 #define PB0_ETXCK_EREFCK_A  0
00321 #define PB1_ETXEN_A         1
00322 #define PB2_ETX0_A          2
00323 #define PB3_ETX1_A          3
00324 #define PB4_ECRS_A          4
00325 #define PB5_ERX0_A          5
00326 #define PB6_ERX1_A          6
00327 #define PB7_ERXER_A         7
00328 #define PB8_EMDC_A          8
00329 #define PB9_EMDIO_A         9
00330 #define PB10_ETX2_A         10
00331 #define PB11_ETX3_A         11
00332 #define PB12_ETXER_A        12
00333 #define PB13_ERX2_A         13
00334 #define PB14_ERX3_A         14
00335 #define PB15_ERXDV_ECRSDV_A 15
00336 #define PB16_ECOL_A         16
00337 #define PB17_ERXCK_A        17
00338 #define PB18_EF100_A        18
00339 
00343 #define PA27_DRXD_A         27
00344 #define PA28_DTXD_A         28
00345 
00349 #define PA23_TD_A           23  
00350 #define PA24_RD_A           24  
00351 #define PA22_TK_A           22  
00352 #define PA25_RK_A           25  
00353 #define PA21_TF_A           21  
00354 #define PA26_RF_A           26  
00356 
00357 
00359 #define PA10_TWD_A          10  
00360 #define PA11_TWCK_A         11  
00362 
00363 
00365 #define PB23_TIOA0_A        23
00366 #define PB24_TIOB0_A        24
00367 #define PB12_TCLK0_B        12
00368 
00369 #define PB25_TIOA1_A        25
00370 #define PB26_TIOB1_A        26
00371 #define PB19_TCLK1_B        19
00372 
00373 #define PB27_TIOA2_A        27
00374 #define PB28_TIOB2_A        28
00375 #define PA15_TCLK2_B        15
00376 
00380 #define PB0_PCK0_B          0
00381 #define PB20_PCK0_B         20
00382 #define PA13_PCK1_B         13
00383 #define PB29_PCK1_A         29
00384 #define PB21_PCK1_B         21
00385 #define PA30_PCK2_B         30
00386 #define PB30_PCK2_A         30
00387 #define PB22_PCK2_B         22
00388 #define PA27_PCK3_B         27
00389 
00393 #define PA29_FIQ_A          29
00394 #define PA30_IRQ0_A         30
00395 #define PA14_IRQ1_B         14
00396 
00400 #define PB18_ADTRG_B        18  
00402 
00403 
00405 #define PA19_CANRX_A        19
00406 #define PA20_CANTX_A        20
00407 
00411 #define PB19_PWM0_A         19
00412 #define PB27_PWM0_B         27
00413 #define PB20_PWM1_A         20
00414 #define PB28_PWM1_B         28
00415 #define PB21_PWM2_A         21
00416 #define PB29_PWM2_B         29
00417 #define PB22_PWM3_A         22
00418 #define PB30_PWM3_B         30
00419 
00421 
00423 #endif                          /* _ARCH_ARM_AT91SAM7X_H_ */