board_stk541.h

Go to the documentation of this file.
00001 /* Copyright (c) 2007 Axel Wachtler
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions
00006    are met:
00007 
00008    * Redistributions of source code must retain the above copyright
00009      notice, this list of conditions and the following disclaimer.
00010    * Redistributions in binary form must reproduce the above copyright
00011      notice, this list of conditions and the following disclaimer in the
00012      documentation and/or other materials provided with the distribution.
00013    * Neither the name of the authors nor the names of its contributors
00014      may be used to endorse or promote products derived from this software
00015      without specific prior written permission.
00016 
00017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027    POSSIBILITY OF SUCH DAMAGE. */
00028 
00029 /* $Id$ */
00087 #if defined(psk230)
00088 # define BOARD_TYPE (BOARD_PSK230)
00089 # define BOARD_NAME "psk230"
00090 # define RADIO_TYPE (RADIO_AT86RF230A)
00091 #elif defined(psk230b)
00092 # define BOARD_TYPE (BOARD_PSK230B)
00093 # define BOARD_NAME "psk230b"
00094 # define RADIO_TYPE (RADIO_AT86RF230B)
00095 #elif defined(psk231)
00096 # define BOARD_TYPE (BOARD_PSK231)
00097 # define BOARD_NAME "psk231"
00098 # define RADIO_TYPE (RADIO_AT86RF231)
00099 #elif defined(psk212)
00100 # define BOARD_TYPE (BOARD_PSK212)
00101 # define BOARD_NAME "psk212"
00102 # define RADIO_TYPE (RADIO_AT86RF212)
00103 #elif defined(psk232)
00104 # define BOARD_TYPE (BOARD_PSK232)
00105 # define BOARD_NAME "psk232"
00106 # define RADIO_TYPE (RADIO_AT86RF232)
00107 #endif
00108 
00109 #ifndef BOARD_STK541_H
00110 #define BOARD_STK541_H
00111 
00112 /*=== Compile time parameters ========================================*/
00113 #ifndef DEFAULT_SPI_RATE
00114 # define DEFAULT_SPI_RATE  (SPI_RATE_1_2)
00115 #endif
00116 
00117 /*=== radio interface definition =====================================*/
00118 #if BOARD_TYPE == BOARD_PSK230 || BOARD_TYPE == BOARD_PSK230B
00119 # include "base_rdk230.h"
00120 #else
00121 # include "base_rdk2xx.h"
00122 #endif
00123 
00124 /*=== LED access macros ==============================================*/
00125 #define LED_PORT      PORTE
00126 #define LED_DDR       DDRE
00127 #define LED_MASK      (0x1c)
00128 #define LED_SHIFT     (2)
00129 #define LEDS_INVERSE  (1)
00130 #define LED_NUMBER    (3)
00131 /*=== KEY access macros ==============================================*/
00132 #define PORT_KEY      PORTE
00133 #define PIN_KEY       PINE
00134 #define DDR_KEY       DDRE
00135 #define MASK_KEY      (0x20)
00136 #define SHIFT_KEY     (5)
00137 #define INVERSE_KEYS  (1)
00138 #define PULLUP_KEYS   (1)
00139 
00140 /*=== Host Interface ================================================*/
00141 #define HIF_TYPE      (HIF_FT245)
00142 #define HIF_IO_ENABLE XRAM_ENABLE
00143 
00144 #define USB_FIFO_AD  0xF000
00145 #define HIF_USB_READ()  (*(volatile uint8_t*)(USB_FIFO_AD))
00146 #define HIF_USB_WRITE(x) do { (*(volatile uint8_t*)(USB_FIFO_AD)) = (x); }while(0)
00147 #define XRAM_ENABLE() do {\
00148     DDRC = 0xFF;\
00149     PORTC = 0x00;\
00150     XMCRA |= (1 << SRE);\
00151     XMCRB = (1 << XMBK);\
00152     } while(0)
00153 
00154 #define HIF_NO_DATA   (0x0100)
00155 #define FT245_DDR    DDRE
00156 #define FT245_PORT   PORTE
00157 #define FT245_PIN    PINE
00158 #define FT245_TXE    _BV(6)
00159 #define FT245_RXF    _BV(7)
00160 #define FT245_INIT() do { \
00161            XMCRA |= (1 << SRE); \
00162            XMCRB = (1 << XMBK);\
00163            FT245_DDR &= ~(FT245_TXE|FT245_RXF);\
00164            FT245_PORT |= (FT245_TXE|FT245_RXF);\
00165         } while(0)
00166 #define TX_IS_READY        (0)
00167 #define TX_IS_BLOCKED      (FT245_TXE)
00168 #define RX_HAS_DATA        (0)
00169 #define RX_HAS_NO_DATA     (FT245_RXF)
00170 #define FT245_RX_DATA()  ((FT245_PIN & FT245_RXF))
00171 #define FT245_TX_DATA()  ((FT245_PIN & FT245_TXE))
00172 
00173 /*=== TIMER Interface ===============================================*/
00174 #define HWTMR_PRESCALE  (1)
00175 #define HWTIMER_TICK    ((1.0*HWTMR_PRESCALE)/F_CPU)
00176 #define HWTIMER_TICK_NB (0xFFFFUL+1)
00177 #define HWTIMER_REG     (TCNT1)
00178 #define TIMER_TICK      (HWTIMER_TICK_NB * HWTIMER_TICK)
00179 #define TIMER_POOL_SIZE (4)
00180 
00182 #define TIMER_IRQ_vect   TIMER1_OVF_vect
00183 
00193 # define TIMER_INIT() \
00194     do{ \
00195         TCCR1B |= (_BV(CS10));\
00196         TIMSK1 |= _BV(TOIE1); \
00197     }while(0)
00198 
00199 
00200 /*=== DBG interface =================================================*/
00201 # define DBG_PORT PORTD
00202 # define DBG_DDR DDRD
00203 # define DBG_PIN (1<<PD0)
00204 
00205 #endif /* BOARD_STK541_H */

This documentation for µracoli was generated on Wed Mar 14 2012 by  doxygen 1.7.1