- Main Page
- Related Pages
- Modules
- Data Structures
- Files

# 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: board_rzusb.h,v 1.11 2009/07/25 06:53:55 awachtler Exp $ */
    00086 #if defined(rzusb)
    00087 # define BOARD_NAME_RZUSB "rzusb230"
    00088 # define RADIO_TYPE (RADIO_AT86RF230B)
    00089 # define CPU_TYPE   (CPU_M1287)
    00090 #endif
    00091
    00092 #ifndef BOARD_RDK230_H
    00093 #define BOARD_RDK230_H
    00094
    00095 #define BOARD_TYPE  RZ_USB230
    00096 #define BOARD_NAME  BOARD_NAME_RZUSB
    00097
    00098 /*=== Compile time parameters ========================================*/
    00099 #ifndef MAX_FRAME_SIZE
    00100 # define MAX_FRAME_SIZE (127)
    00101 #endif
    00102
    00103 /*=== radio interface definition =====================================*/
    00104 /* the tranceiver wiring fits the RCB/RDK settings */
    00105 #include "base_rdk230.h"
    00106
    00107 /*=== LED access macros ==============================================*/
    00108 /*
    00109  * The RZUSBSTICK has the LEDs scattered around quite a bit, so the
    00110  * standard methods in ioutil.h cannot be applied.  LED 1 is attached
    00111  * to PD7 using positive logic, and powered by Vbus.  For this reason,
    00112  * it is not counted as a standard LED, and gets number 3 assigned.
    00113  * LED 2 is attached to PD5, LED 3 to PE7, and LED 4 to PE6, all using
    00114  * negative logic.  They get assigned numbers 0, 1, and 2,
    00115  * respectively.
    00116  */
    00117
    00118 #define LED_INIT() \
    00119   do { \
    00120   DDRD |= _BV(7) | _BV(5); DDRE |= _BV(7) | _BV(6); \
    00121   PORTD &= ~_BV(7); PORTD |= _BV(5); PORTE |= _BV(7) | _BV(6); \
    00122   } while (0)
    00123
    00124 #define LED_SET(x) \
    00125   switch (x) { \
    00126   case 3: PORTD |= _BV(7); break; \
    00127   case 0: PORTD &= ~_BV(5); break; \
    00128   case 1: PORTE &= ~_BV(7); break; \
    00129   case 2: PORTE &= ~_BV(6); break; \
    00130   }
    00131
    00132 #define LED_CLR(x) \
    00133   switch (x) { \
    00134   case 3: PORTD &= ~_BV(7); break; \
    00135   case 0: PORTD |= _BV(5); break; \
    00136   case 1: PORTE |= _BV(7); break; \
    00137   case 2: PORTE |= _BV(6); break; \
    00138   }
    00139
    00140 #define LED_SET_VALUE(x) \
    00141   do { \
    00142   if (x & 1) PORTD &= ~_BV(5); else PORTD |= _BV(5); \
    00143   if (x & 2) PORTE &= ~_BV(7); else PORTE |= _BV(7); \
    00144   if (x & 4) PORTE &= ~_BV(6); else PORTE |= _BV(6); \
    00145   } while (0)
    00146
    00147 #define LED_GET_VALUE() ( \
    00148   ((PORTD & _BV(5))? 0: 1) | \
    00149   ((PORTE & _BV(7))? 0: 2) | \
    00150   ((PORTE & _BV(6))? 0: 4) \
    00151               )
    00152
    00153 #define LED_VAL(msk,val) do{}while(0)
    00155 #define LED_TOGGLE(ln) \
    00156   switch (ln) { \
    00157   case 3: PORTD ^= _BV(7); break; \
    00158   case 0: PORTD ^= _BV(5); break; \
    00159   case 1: PORTE ^= _BV(7); break; \
    00160   case 2: PORTE ^= _BV(6); break; \
    00161   }
    00162
    00163 #define LED_NUMBER (3)
    00164
    00165 #define LED_ACTIVITY (0)
    00166 #define LED_USB_CONFIGURED (3)
    00167
    00168
    00169 /*=== KEY access macros ==============================================*/
    00170 #define NO_KEYS
    00171
    00172 /*=== Host Interface ================================================*/
    00173 #define HIF_TYPE (HIF_AT90USB)
    00174
    00175 //#define USB_VID  0x3eb          /* Atmel */
    00176 #define USB_VID             URACOLI_USB_VID
    00177 #define USB_PID             URACOLI_USB_PID
    00178 #define USB_BCD_RELEASE     URACOLI_USB_BCD_RELEASE
    00179 #define USB_VENDOR_NAME     URACOLI_USB_VENDOR_NAME
    00180 #define USB_PRODUCT_NAME    URACOLI_USB_PRODUCT_NAME
    00181
    00182 /*=== TIMER Interface ===============================================*/
    00183 #define HWTMR_PRESCALE  (1)
    00184 #define HWTIMER_TICK    ((1.0*HWTMR_PRESCALE)/F_CPU)
    00185 #define HWTIMER_TICK_NB (0xFFFFUL)
    00186 #define HWTIMER_REG     (TCNT1)
    00187 #define TIMER_TICK      (HWTIMER_TICK_NB * HWTIMER_TICK)
    00188 #define TIMER_POOL_SIZE (4)
    00189 #define TIMER_INIT() \
    00190     do{ \
    00191         TCCR1B |= (_BV(CS10)); \
    00192         TIMSK1 |= _BV(TOIE1); \
    00193     }while(0)
    00194 #define TIMER_IRQ_vect   TIMER1_OVF_vect
    00195
    00196 /*=== OSCCAL tuning =================================================*/
    00197
    00198 #ifndef TUNED_OSCCAL
    00199 # define TUNED_OSCCAL (0xbf)  /* default is 0xb1, but @2.9V 0xbf is better */
    00200 #endif
    00201 #endif /* BOARD_RDK230_H*/