hdo  beta
/home/mrazik/Documents/web/old/hdo/at91lib/boards/at91sam7s-ek/board.h
Zobrazit dokumentaci tohoto souboru.
00001 /* ----------------------------------------------------------------------------
00002  *         ATMEL Microcontroller Software Support 
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2008, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
00028  */
00029 
00030 //------------------------------------------------------------------------------
00063 //------------------------------------------------------------------------------
00064 
00065 #ifndef BOARD_H 
00066 #define BOARD_H
00067 
00068 //------------------------------------------------------------------------------
00069 //         Headers
00070 //------------------------------------------------------------------------------
00071 
00072 #include "at91sam7s256/AT91SAM7S256.h"
00073 
00074 //------------------------------------------------------------------------------
00075 //         Global Definitions
00076 //------------------------------------------------------------------------------
00077 
00078 //------------------------------------------------------------------------------
00079 // Board
00080 //------------------------------------------------------------------------------
00082 #define BOARD_NAME      "AT91SAM7S-EK"
00083 
00084 #define at91sam7sek
00085 
00086 #define at91sam7s
00087 //------------------------------------------------------------------------------
00088 
00089 //------------------------------------------------------------------------------
00090 // Clocks
00091 //------------------------------------------------------------------------------
00093 #define BOARD_MAINOSC           18432000
00094 
00096 #define BOARD_MCK               48000000
00097 //------------------------------------------------------------------------------
00098 
00099 //------------------------------------------------------------------------------
00100 // ADC
00101 //------------------------------------------------------------------------------
00103 #define ADC_MAX_CK_10BIT         5000000
00104 
00105 #define ADC_MAX_CK_8BIT          8000000
00106 
00107 #define ADC_STARTUP_TIME_MAX       20
00108 
00109 #define ADC_TRACK_HOLD_TIME_MIN   600
00110 
00111 //------------------------------------------------------------------------------
00112 // USB
00113 //------------------------------------------------------------------------------
00115 #define BOARD_USB_UDP
00116 
00118 #define BOARD_USB_PULLUP_EXTERNAL
00119 
00121 #define BOARD_USB_NUMENDPOINTS                  4
00122 
00126 #define BOARD_USB_ENDPOINTS_MAXPACKETSIZE(i)    ((i == 0) ? 8 : 64)
00127 
00131 #define BOARD_USB_ENDPOINTS_BANKS(i)            (((i == 0) || (i == 3)) ? 1 : 2)
00132 
00134 #define BOARD_USB_BMATTRIBUTES                  USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP
00135 //#define BOARD_USB_BMATTRIBUTES                  USBConfigurationDescriptor_BUSPOWERED_NORWAKEUP
00136 //#define BOARD_USB_BMATTRIBUTES                  USBConfigurationDescriptor_SELFPOWERED_RWAKEUP
00137 //------------------------------------------------------------------------------
00138 
00139 //------------------------------------------------------------------------------
00140 // Pins
00141 //------------------------------------------------------------------------------
00143 #define PINS_DBGU  {0x00000600, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00144 
00146 #define PIN_LED_DS1   {1 << 31, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
00147 
00148 #define PIN_LED_DS2   {1 << 0, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
00149 
00150 #define PIN_LED_DS3   {1 << 1, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
00151 
00152 #define PIN_LED_DS4   {1 << 2, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
00153 
00154 #define PINS_LEDS   PIN_LED_DS1, PIN_LED_DS2, PIN_LED_DS3, PIN_LED_DS4
00155 
00157 #define PIN_PUSHBUTTON_1    {1 << 19, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEGLITCH | PIO_PULLUP}
00158 
00159 #define PIN_PUSHBUTTON_2    {1 << 20, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEGLITCH | PIO_PULLUP}
00160 
00161 #define PIN_PUSHBUTTON_3    {1 << 15, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEGLITCH | PIO_PULLUP}
00162 
00163 #define PIN_PUSHBUTTON_4    {1 << 14, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEGLITCH | PIO_PULLUP}
00164 
00165 #define PINS_PUSHBUTTONS    PIN_PUSHBUTTON_1, PIN_PUSHBUTTON_2, PIN_PUSHBUTTON_3, PIN_PUSHBUTTON_4
00166 
00167 #define PUSHBUTTON_BP1      0
00168 
00169 #define PUSHBUTTON_BP2      1
00170 
00171 #define PUSHBUTTON_BP3      2
00172 
00173 #define PUSHBUTTON_BP4      3
00174 
00175 #define JOYSTICK_LEFT       0
00176 
00177 #define JOYSTICK_RIGHT      1
00178 
00180 #define PIN_USART0_RXD  {1 << 5, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00181 
00182 #define PIN_USART0_TXD  {1 << 6, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00183 
00184 #define PIN_USART0_RTS  {1 << 7, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00185 
00186 #define PIN_USART0_CTS  {1 << 8, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00187 
00188 #define PIN_USART0_SCK  {1 << 2, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
00189 
00191 #define PIN_SPI_MISO   {1 << 12, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_PULLUP}
00192 
00193 #define PIN_SPI_MOSI   {1 << 13, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00194 
00195 #define PIN_SPI_SPCK   {1 << 14, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00196 
00197 #define PINS_SPI       PIN_SPI_MISO, PIN_SPI_MOSI, PIN_SPI_SPCK
00198 
00199 #define PIN_SPI_NPCS0  {1 << 11, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00200 
00201 #define PIN_SPI_NPCS1  {1 << 31, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00202 
00203 #define PIN_SPI_NPCS2  {1 << 10, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
00204 
00205 #define PIN_SPI_NPCS3  {1 <<  3, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
00206 
00208 #define PIN_PWMC_PWM0  {1 << 0, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00209 
00210 #define PIN_PWMC_PWM1  {1 << 1, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00211 
00212 #define PIN_PWMC_PWM2  {1 << 2, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00213 
00215 #define PIN_PWM_LED0 PIN_PWMC_PWM1
00216 
00217 #define PIN_PWM_LED1 PIN_PWMC_PWM2
00218 
00219 #define CHANNEL_PWM_LED0 1
00220 
00221 #define CHANNEL_PWM_LED1 2
00222 
00224 #define PINS_TWI  {0x00000018, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
00225 
00227 #define PIN_ADC_AD0 {1 << 17, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEFAULT}
00228 
00229 #define PIN_ADC_AD1 {1 << 18, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEFAULT}
00230 
00231 #define PIN_ADC_AD2 {1 << 19, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEFAULT}
00232 
00233 #define PIN_ADC_AD3 {1 << 20, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEFAULT}
00234 
00235 #define PINS_ADC PIN_ADC_AD0, PIN_ADC_AD1, PIN_ADC_AD2, PIN_ADC_AD3
00236 
00238 #define PIN_USB_VBUS    {1 << 13, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEFAULT}
00239 
00240 #define PIN_USB_PULLUP  {1 << 16, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
00241 //------------------------------------------------------------------------------
00242 
00248 
00251 #define BOARD_SD_SPI_BASE   AT91C_BASE_SPI
00252 
00253 #define BOARD_SD_SPI_ID     AT91C_ID_SPI
00254 
00255 #define BOARD_SD_SPI_PINS   PINS_SPI, PIN_SPI_NPCS1
00256 
00257 #define BOARD_SD_NPCS       1
00258 
00259 //------------------------------------------------------------------------------
00260 // Flash
00261 //------------------------------------------------------------------------------
00263 #define BOARD_FLASH_EFC
00264 
00265 #define BOARD_FLASH_IAP_ADDRESS         0x300E08
00266 //------------------------------------------------------------------------------
00267 
00268 //------------------------------------------------------------------------------
00277 
00279 #define PIN_SMARTCARD_CONNECT   {1 << 5, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_INPUT, PIO_DEFAULT}
00280 
00281 #define PIN_ISO7816_RSTMC       {1 << 7, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
00282 
00283 #define PINS_ISO7816            PIN_USART0_TXD, PIN_USART0_SCK, PIN_ISO7816_RSTMC
00284 //------------------------------------------------------------------------------
00285 
00286 #endif //#ifndef BOARD_H
00287