board_rzusb.h
Go to the documentation of this file.

    00001 /* Copyright (c) 2007 Axel Wachtler
    00002    Copyright (c) 2008 Joerg Wunsch
    00003    All rights reserved.
    00004
    00005    Redistribution and use in source and binary forms, with or without
    00006    modification, are permitted provided that the following conditions
    00007    are met:
    00008
    00009    * Redistributions of source code must retain the above copyright
    00010      notice, this list of conditions and the following disclaimer.
    00011    * Redistributions in binary form must reproduce the above copyright
    00012      notice, this list of conditions and the following disclaimer in the
    00013      documentation and/or other materials provided with the distribution.
    00014    * Neither the name of the authors nor the names of its contributors
    00015      may be used to endorse or promote products derived from this software
    00016      without specific prior written permission.
    00017
    00018    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    00019    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00020    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00021    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    00022    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    00023    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    00024    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    00025    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    00026    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    00027    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    00028    POSSIBILITY OF SUCH DAMAGE. */
    00029
    00030 /* $Id$ */
    00086 #if defined(rzusb)
    00087 # define BOARD_TYPE  BOARD_RZUSB
    00088 # define BOARD_NAME  "rzusb230"
    00089 # define RADIO_TYPE  (RADIO_AT86RF230B)
    00090 #endif
    00091
    00092 #ifndef BOARD_RDK230_H
    00093 #define BOARD_RDK230_H
    00094
    00095 /*=== Compile time parameters ========================================*/
    00096
    00097 /*=== radio interface definition =====================================*/
    00098 /* the tranceiver wiring fits the RCB/RDK settings */
    00099 #include "base_rdk230.h"
    00100
    00101 /*=== LED access macros ==============================================*/
    00102 /*
    00103  * The RZUSBSTICK has the LEDs scattered around quite a bit, so the
    00104  * standard methods in ioutil.h cannot be applied.  LED 1 is attached
    00105  * to PD7 using positive logic, and powered by Vbus.  For this reason,
    00106  * it is not counted as a standard LED, and gets number 3 assigned.
    00107  * LED 2 is attached to PD5, LED 3 to PE7, and LED 4 to PE6, all using
    00108  * negative logic.  They get assigned numbers 0, 1, and 2,
    00109  * respectively.
    00110  */
    00111
    00112 #define LED_INIT() \
    00113   do { \
    00114   DDRD |= _BV(7) | _BV(5); DDRE |= _BV(7) | _BV(6); \
    00115   PORTD &= ~_BV(7); PORTD |= _BV(5); PORTE |= _BV(7) | _BV(6); \
    00116   } while (0)
    00117
    00118 #define LED_SET(x) \
    00119   switch (x) { \
    00120   case 3: PORTD |= _BV(7); break; \
    00121   case 0: PORTD &= ~_BV(5); break; \
    00122   case 1: PORTE &= ~_BV(7); break; \
    00123   case 2: PORTE &= ~_BV(6); break; \
    00124   }
    00125
    00126 #define LED_CLR(x) \
    00127   switch (x) { \
    00128   case 3: PORTD &= ~_BV(7); break; \
    00129   case 0: PORTD |= _BV(5); break; \
    00130   case 1: PORTE |= _BV(7); break; \
    00131   case 2: PORTE |= _BV(6); break; \
    00132   }
    00133
    00134 #define LED_SET_VALUE(x) \
    00135   do { \
    00136   if (x & 1) PORTD &= ~_BV(5); else PORTD |= _BV(5); \
    00137   if (x & 2) PORTE &= ~_BV(7); else PORTE |= _BV(7); \
    00138   if (x & 4) PORTE &= ~_BV(6); else PORTE |= _BV(6); \
    00139   } while (0)
    00140
    00141 #define LED_GET_VALUE() ( \
    00142   ((PORTD & _BV(5))? 0: 1) | \
    00143   ((PORTE & _BV(7))? 0: 2) | \
    00144   ((PORTE & _BV(6))? 0: 4) \
    00145               )
    00146
    00147 #define LED_VAL(msk,val) do{}while(0)
    00149 #define LED_TOGGLE(ln) \
    00150   switch (ln) { \
    00151   case 3: PORTD ^= _BV(7); break; \
    00152   case 0: PORTD ^= _BV(5); break; \
    00153   case 1: PORTE ^= _BV(7); break; \
    00154   case 2: PORTE ^= _BV(6); break; \
    00155   }
    00156
    00157 #define LED_NUMBER (3)
    00158
    00159 #define LED_ACTIVITY (0)
    00160 #define LED_USB_CONFIGURED (3)
    00161
    00162
    00163 /*=== KEY access macros ==============================================*/
    00164 #define NO_KEYS
    00165
    00166 /*=== Host Interface ================================================*/
    00167 #define HIF_TYPE (HIF_AT90USB)
    00168
    00169 //#define USB_VID  0x3eb          /* Atmel */
    00170 #define USB_VID             URACOLI_USB_VID
    00171 #define USB_PID             URACOLI_USB_PID
    00172 #define USB_BCD_RELEASE     URACOLI_USB_BCD_RELEASE
    00173 #define USB_VENDOR_NAME     URACOLI_USB_VENDOR_NAME
    00174 #define USB_PRODUCT_NAME    URACOLI_USB_PRODUCT_NAME
    00175
    00176 /*=== TIMER Interface ===============================================*/
    00177 #define HWTMR_PRESCALE  (1)
    00178 #define HWTIMER_TICK    ((1.0*HWTMR_PRESCALE)/F_CPU)
    00179 #define HWTIMER_TICK_NB (0xFFFFUL)
    00180 #define HWTIMER_REG     (TCNT1)
    00181 #define TIMER_TICK      (HWTIMER_TICK_NB * HWTIMER_TICK)
    00182 #define TIMER_POOL_SIZE (4)
    00183 #define TIMER_INIT() \
    00184     do{ \
    00185         TCCR1B |= (_BV(CS10)); \
    00186         TIMSK1 |= _BV(TOIE1); \
    00187     }while(0)
    00188 #define TIMER_IRQ_vect   TIMER1_OVF_vect
    00189
    00190 #endif /* BOARD_RDK230_H*/