Nut/OS  4.10.3
API Reference
at91sam9g45.h
Go to the documentation of this file.
00001 #ifndef _ARCH_ARM_SAM9G45_H_
00002 #define _ARCH_ARM_SAM9G45_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 
00041 #include <arch/arm/v5te.h>
00042 
00043 #if 0
00044 extern int sprintf (char *__restrict __s,
00045                     __const char *__restrict __format, ...);
00046 void PrintBlockingDebug(char *Str);
00047 #endif
00048 
00049 #define FLASH_BASE           0x100000UL
00050 #define RAM_BASE             0x200000UL
00051 #define NAND_FLASH_BASE      0x40000000
00052 
00053 // Internal peripherals
00054 #define LCDC_BASE       0x00500000      
00056 #define UDP_BASE        0xFFF78000      
00057 #define TC_BASE         0xFFF7C000      
00058 #define MCI_BASE        0xFFF80000      
00059 #define TWI_BASE        0xFFF84000      
00060 #define USART0_BASE     0xFFF8C000      
00061 #define USART1_BASE     0xFFF90000      
00062 #define USART2_BASE     0xFFF94000      
00063 #define USART3_BASE     0xFFF98000      
00064 #define SSC_BASE        0xFFF9C000      
00065 #define SPI0_BASE       0xFFFA4000      
00066 #define SPI1_BASE       0xFFFA8000      
00067 #define AC97_BASE       0xFFFAC000      
00068 #define TSADCC_BASE     0xFFFB0000      
00069 #define ISI_BASE        0xFFFB4000      
00070 #define PWMC_BASE       0xFFFB8000      
00071 #define EMAC_BASE       0xFFFBC000      
00072 #define TRNG_BASE       0xFFFCC000      
00073 #define MCI1_BASE       0xFFFD0000      
00074 #define TC345_BASE      0xFFFD4000      
00076 // System controller
00077 #define DDRSDRC1_BASE   0xFFFFE400      
00078 #define DDRSDRC0_BASE   0xFFFFE600      
00079 #define SMC_BASE        0xFFFFE800      
00080 #define MATRIX_BASE     0xFFFFEA00      
00081 #define DMAC_BASE       0xFFFFEC00      
00082 #define DBGU_BASE       0xFFFFEE00      
00083 #define AIC_BASE        0xFFFFF000      
00084 #define PIOA_BASE       0xFFFFF200      
00085 #define PIOB_BASE       0xFFFFF400      
00086 #define PIOC_BASE       0xFFFFF600      
00087 #define PIOD_BASE       0xFFFFF800      
00088 #define PIOE_BASE       0xFFFFFA00      
00089 #define PMC_BASE        0xFFFFFC00      
00090 #define RSTC_BASE       0xFFFFFD00      
00091 #define SHDWC_BASE      0xFFFFFD10      
00092 #define RTT_BASE        0xFFFFFD20      
00093 #define PIT_BASE        0xFFFFFD30      
00094 #define WDT_BASE        0xFFFFFD40      
00095 #define SCKCR_BASE      0xFFFFFD50      
00096 #define GPBR_BASE       0xFFFFFD60      
00097 #define RTC_BASE        0xFFFFFDB0      
00099 // Undocumented Base adress iin datasheet! HECC? -> Atmel Header-File (HECC ==? ECC)
00100 #define ECC_BASE        0xFFFFE200      
00102 // Peripheral DMA Controller (PDC) User Interface
00103 #define PERIPH_RPR_OFF  0x00000100      
00104 #define PERIPH_RCR_OFF  0x00000104      
00105 #define PERIPH_TPR_OFF  0x00000108      
00106 #define PERIPH_TCR_OFF  0x0000010C      
00107 #define PERIPH_RNPR_OFF 0x00000110      
00108 #define PERIPH_RNCR_OFF 0x00000114      
00109 #define PERIPH_TNPR_OFF 0x00000118      
00110 #define PERIPH_TNCR_OFF 0x0000011C      
00111 #define PERIPH_PTCR_OFF 0x00000120      
00112 #define PERIPH_PTSR_OFF 0x00000124      
00114 // Transfer Control Register - Bits
00115 #define PDC_RXTEN       0x00000001      
00116 #define PDC_RXTDIS      0x00000002      
00117 #define PDC_TXTEN       0x00000100      
00118 #define PDC_TXTDIS      0x00000200      
00120 // Check...
00121 #define DBGU_HAS_PDC
00122 #define SPI_HAS_PDC
00123 #define SSC_HAS_PDC
00124 #define USART_HAS_PDC
00125 #define USART_HAS_MODE
00126 #define MCI_HAS_PDC
00127 #define PMC_HAS_PLLB
00128 #define PMC_HAS_MDIV
00129 #define EBI_HAS_CSA
00130 
00131 // Check....
00132 #define PIO_HAS_MULTIDRIVER
00133 #define PIO_HAS_PULLUP
00134 #define PIO_HAS_PERIPHERALSELECT
00135 #define PIO_HAS_OUTPUTWRITEENABLE
00136 
00137 #include <arch/arm/atmel/at91_rtc.h>
00138 #include <arch/arm/atmel/at91_ecc.h>
00139 #include <arch/arm/atmel/at91_ebi.h>
00140 #include <arch/arm/atmel/at91_tc.h>
00141 #include <arch/arm/atmel/at91_us.h>
00142 #include <arch/arm/atmel/at91_dbgu.h>
00143 #include <arch/arm/atmel/at91_emac.h>
00144 #include <arch/arm/atmel/at91_spi.h>
00145 #include <arch/arm/atmel/at91_aic.h>
00146 #include <arch/arm/atmel/at91_pio.h>
00147 #include <arch/arm/atmel/at91_pmc.h>
00148 #include <arch/arm/atmel/at91_rstc.h>
00149 #include <arch/arm/atmel/at91_wdt.h>
00150 #include <arch/arm/atmel/at91_ssc.h>
00151 #include <arch/arm/atmel/at91_twi.h>
00152 #include <arch/arm/atmel/at91_smc.h>
00153 #include <arch/arm/atmel/at91_mci.h>
00154 #include <arch/arm/atmel/at91_matrix.h>
00155 #include <arch/arm/atmel/at91_ccfg.h>
00156 #include <arch/arm/atmel/at91_sdramc.h>
00157 #include <arch/arm/atmel/at91_adc.h>
00158 #include <arch/arm/atmel/at91_pit.h>
00159 #include <arch/arm/atmel/at91_lcdc.h>
00160 #include <arch/arm/atmel/at91_tsadcc.h>
00161 
00164 
00167 #define FIQ_ID      0           
00168 #define SYSC_ID     1           
00169 #define PIOA_ID     2           
00170 #define PIOB_ID     3           
00171 #define PIOC_ID     4           
00172 #define PIODE_ID    5           
00173 #define RNG_ID      6           
00174 #define US0_ID      7           
00175 #define US1_ID      8           
00176 #define US2_ID      9           
00177 #define US3_ID      10          
00178 #define MCI0_ID     11          
00179 #define TWI0_ID     12          
00180 #define TWI1_ID     13          
00181 #define SPI0_ID     14          
00182 #define SPI1_ID     15          
00183 #define SSC0_ID     16          
00184 #define SSC1_ID     17          
00185 #define TC0_ID      18          
00186 #define TC1_ID      18          
00187 #define TC2_ID      18          
00188 #define TC3_ID      18          
00189 #define TC4_ID      18          
00190 #define TC5_ID      18          
00191 #define PWMC_ID     19          
00192 #define TSADCC_ID   20          
00193 #define DMA_ID      21          
00194 #define UHP_ID      22          
00195 #define LCDC_ID     23          
00196 #define AC97_ID     24          
00197 #define EMAC_ID     25          
00198 #define ISI_ID      26          
00199 #define UDP_ID      27          
00200 #define MCI1_ID     29          
00201 #define IRQ0_ID     31          
00203 #define TWI_ID      TWI0_ID     
00204 #define MCI_ID      MCI0_ID     
00205 #define SSC_ID      SSC0_ID     
00208 
00209 
00211 #define PB16_SCK0_B         16  
00212 #define PB19_TXD0_A         19  
00213 #define PB18_RXD0_A         18  
00214 #define PB15_CTS0_B         15  
00215 #define PB17_RTS0_B         17  
00217 #define PD29_SCK1_B         29  
00218 #define PB4_TXD1_A          4   
00219 #define PB5_RXD1_A          5   
00220 #define PD17_CTS1_A         17  
00221 #define PD16_RTS1_A         16  
00223 #define PD30_SCK2_B         30  
00224 #define PB6_TXD2_A          6   
00225 #define PB7_RXD2_A          7   
00226 #define PC11_CTS2_B         11  
00227 #define PC9_RTS2_B          9   
00229 #define PA22_SCK3_B         22  
00230 #define PB8_TXD3_A          8   
00231 #define PB9_RXD3_A          9   
00232 #define PA24_CTS3_B         24  
00233 #define PA23_RTS3_B         23  
00235 
00236 
00238 #define PB0_SPI0_MISO_A     0   
00239 #define PB1_SPI0_MOSI_A     1   
00240 #define PB2_SPI0_SPCK_A     2   
00241 #define PB3_SPI0_NPCS0_A    3   
00242 #define PB18_SPI0_NPCS1_B   18  
00243 #define PD24_SPI0_NPCS1_A   24  
00244 #define PB19_SPI0_NPCS2_B   19  
00245 #define PD25_SPI0_NPCS2_A   25  
00246 #define PD27_SPI0_NPCS3_B   27  
00248 #define SPI0_PINS           _BV(PB0_SPI0_MISO_A) | _BV(PB1_SPI0_MOSI_A) | _BV(PB2_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(PB3_SPI0_NPCS0_A)
00253 #define SPI0_CS0_PIO_BASE   PIOB_BASE
00254 #define SPI0_CS0_PSR_OFF    PIO_ASR_OFF
00255 
00256 #define SPI0_CS1_PIN        _BV(PB18_SPI0_NPCS1_B)
00257 #define SPI0_CS1_PIO_BASE   PIOB_BASE
00258 #define SPI0_CS1_PSR_OFF    PIO_BSR_OFF
00259 
00260 #define PB14_SPI1_MISO_A     14  
00261 #define PB15_SPI1_MOSI_A     15  
00262 #define PB16_SPI1_SPCK_A     16  
00263 #define PB17_SPI1_NPCS0_A    17  
00264 #define PD28_SPI1_NPCS1_B    28  
00265 #define PD18_SPI1_NPCS2_A    18  
00266 #define PD19_SPI1_NPCS3_A    19  
00268 #define SPI1_PINS           _BV(PB14_SPI1_MISO_A) | _BV(PB15_SPI1_MOSI_A) | _BV(PB16_SPI1_SPCK_A)
00269 #define SPI1_PIO_BASE       PIOB_BASE
00270 #define SPI1_PSR_OFF        PIO_ASR_OFF
00271 
00272 #define SPI1_CS0_PIN        _BV(PB17_SPI1_NPCS0_A)
00273 #define SPI1_CS0_PIO_BASE   PIOB_BASE
00274 #define SPI1_CS0_PSR_OFF    PIO_ASR_OFF
00275 
00276 #ifndef SPI1_CS3_PIN
00277 #define SPI1_CS3_PIN        _BV(PD19_SPI1_NPCS3_A)
00278 #define SPI1_CS3_PIO_BASE   PIOD_BASE
00279 #define SPI1_CS3_PSR_OFF    PIO_ASR_OFF
00280 #endif
00281 
00286 #define PB20_ISI_D0_A       20  
00287 #define PB21_ISI_D1_A       21  
00288 #define PB22_ISI_D2_A       22  
00289 #define PB23_ISI_D3_A       23  
00290 #define PB24_ISI_D4_A       24  
00291 #define PB25_ISI_D5_A       25  
00292 #define PB26_ISI_D6_A       26  
00293 #define PB27_ISI_D7_A       27  
00294 #define PB10_ISI_D8_B       10  
00295 #define PB11_ISI_D9_B       11  
00296 #define PB12_ISI_D10_B      12  
00297 #define PB13_ISI_D11_B      13  
00298 #define PB28_ISI_PCK_A      28  
00299 #define PB29_ISI_VSYNC_A    29  
00300 #define PB30_ISI_HSYNC_A    30  
00301 #define PB31_ISI_MCK_A      31  
00303 
00304 
00306 #define PA6_ETX2_B          6   
00307 #define PA7_ETX3_B          7   
00308 #define PA10_ETX0_A         10  
00309 #define PA11_ETX1_A         11  
00310 #define PA12_ERX0_A         12  
00311 #define PA13_ERX1_A         13  
00312 #define PA14_ETXEN_A        14  
00313 #define PA15_ERXDV_A        15  
00314 #define PA16_ERXER_A        16  
00315 #define PA17_ETXCK_A        17  
00316 #define PA18_EMDC_A         18  
00317 #define PA19_EMDIO_A        19  
00318 #define PA27_ETXER_B        27  
00319 #define PA8_ERX2_B          8   
00320 #define PA9_ERX3_B          9   
00321 #define PA28_ERXCK_B        28  
00322 #define PA29_ECRS_B         29  
00323 #define PA30_ECOL_B         30  
00325 
00326 
00328 #define PHY_MODE_RMII
00329 #define EMAC_PIO_ASR                            PIO_ASR_OFF
00330 #define PHY_MII_PINS_A                  (PA10_ETX0_A | PA11_ETX1_A | PA12_ERX0_A | PA13_ERX1_A | PA14_ETXEN_A | PA15_ERXDV_A | PA16_ERXER_A | \
00331                              PA17_ETXCK_A | PA18_EMDC_A | PA19_EMDIO_A)
00332 #define EMAC_PIO_BSR                            PIO_BSR_OFF
00333 #define PHY_MII_PINS_B                  (PA6_ETX2_B | PA7_ETX3_B | PA27_ETXER_B | PA8_ERX2_B | PA9_ERX3_B | PA28_ERXCK_B | PA29_ECRS_B | PA30_ECOL_B)
00334 #define EMAC_PIO_PDR                            PIOA_PDR
00335 
00339 #define PD28_ADTRG_A        28  
00341 
00342 
00344 #define PB12_DRXD_A         12  
00345 #define PB13_DTXD_A         13  
00347 
00348 
00350 #define PD2_TD0_A           2  
00351 #define PD3_RD0_A           3  
00352 #define PD0_TK0_A           0  
00353 #define PD4_RK0_A           4  
00354 #define PD1_TF0_A           1  
00355 #define PD5_RF0_A           5  
00357 
00358 
00360 #define PA20_TWD0_A          20  
00361 #define PA21_TWCK0_A         21  
00363 #define PB10_TWD1_A          10  
00364 #define PB11_TWCK1_A         11  
00366 
00367 
00369 #define PD23_TCLK0_A         23   
00370 #define PD20_TIOA0_A         20   
00371 #define PD30_TIOB0_A         30   
00373 #define PD29_TCLK1_A         29   
00374 #define PD21_TIOA1_A         21   
00375 #define PD31_TIOB1_A         31   
00377 #define PC10_TCLK2_B         10   
00378 #define PD22_TIOA2_A         22   
00379 #define PA26_TIOB2_B         26   
00381 #define PA0_TCLK3_B          0    
00382 #define PA1_TIOA3_B          1    
00383 #define PA2_TIOB3_B          2    
00385 #define PA3_TCLK4_B          3    
00386 #define PA4_TIOA4_B          4    
00387 #define PA5_TIOB4_B          5    
00389 #define PD9_TCLK5_B          9    
00390 #define PD7_TIOA5_B          7    
00391 #define PD8_TIOB5_B          8    
00393 
00394 
00396 #define PD26_PCK0_A         26  
00397 #define PE0_PCK0_B          0   
00398 #define PD27_PCK1_A         27  
00399 #define PE31_PCK1_B         31  
00401 
00402 
00404 #define PC12_A25_CFRNW_A    12   
00405 #define PC10_NCS4_CFCS0_A   10   
00406 #define PC11_NCS5_CFCS1_A   11   
00407 #define PC8_CFCE1_A         8    
00408 #define PC9_CFCE2_A         9    
00410 
00411 
00413 #define PC16_D16_A          16  
00414 #define PC17_D17_A          17  
00415 #define PC18_D18_A          18  
00416 #define PC19_D19_A          19  
00417 #define PC20_D20_A          20  
00418 #define PC21_D21_A          21  
00419 #define PC22_D22_A          22  
00420 #define PC23_D23_A          23  
00421 #define PC24_D24_A          24  
00422 #define PC25_D25_A          25  
00423 #define PC26_D26_A          26  
00424 #define PC27_D27_A          27  
00425 #define PC28_D28_A          28  
00426 #define PC29_D29_A          29  
00427 #define PC30_D30_A          30  
00428 #define PC31_D31_A          31  
00429 #define PC6_A23_A           6   
00430 #define PC7_A24_A           7   
00431 #define PC13_NCS2_A         13  
00432 #define PC14_NCS3_NANDCS_A  14  
00433 #define PC15_NWAIT_A        15  
00435 
00436 
00438 #define PD19_FIQ_B          19  
00439 #define PC18_IRQ_B          18  
00441 
00442 
00444 #define LCDC_PIO_BASE       PIOE_BASE
00445 #define LCDC_PINS_A         0x6FEFFFDE
00446 #define LCDC_PINS_B         0x10100000
00447 #define LCDC_PINS           (LCDC_PINS_A | LCDC_PINS_B)
00448 #define LCDC_PIO_ASR        PIOE_ASR
00449 #define LCDC_PIO_BSR        PIOE_BSR
00450 #define LCDC_PIO_PDR        PIOE_PDR
00451 
00454 
00456 #endif                          /* _ARCH_ARM_SAM9G45_H_ */