board_zgbl.h

Go to the documentation of this file.
00001 /* Copyright (c) 2009 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: board__zgbl_8h_source.html,v 1.1.1.4 2013/04/09 21:12:16 awachtler Exp $ */
00030 
00083 /*
00084  @image html atmel_stk50x.jpg "STK500 + STK501 + Radio board"
00085  @image latex atmel_stk50x.jpg "STK500 + STK501 + Radio board"
00086  */
00087 #if defined(zgbl230)
00088 # define BOARD_TYPE BOARD_ZGBL230
00089 # define BOARD_NAME "zgbl230"
00090 # define RADIO_TYPE (RADIO_AT86RF230B)
00091 #elif defined(zgbl231)
00092 # define BOARD_TYPE  BOARD_ZGBL231
00093 # define BOARD_NAME "zgbl231"
00094 # define RADIO_TYPE (RADIO_AT86RF231)
00095 #elif defined(zgbl212)
00096 # define BOARD_TYPE  BOARD_ZGBL212
00097 # define BOARD_NAME "zgbl212"
00098 # define RADIO_TYPE (RADIO_AT86RF212)
00099 #elif defined(zgbh230)
00100 # define BOARD_TYPE BOARD_ZGBH230
00101 # define BOARD_NAME "zgbh230"
00102 # define RADIO_TYPE (RADIO_AT86RF230B)
00103 # define ZGBL_EVM_HOST (1)
00104 #elif defined(zgbh231)
00105 # define BOARD_TYPE  BOARD_ZGBH231
00106 # define BOARD_NAME "zgbh231"
00107 # define RADIO_TYPE (RADIO_AT86RF231)
00108 # define ZGBL_EVM_HOST (1)
00109 #elif defined(zgbh212)
00110 # define BOARD_TYPE  BOARD_ZGBH212
00111 # define BOARD_NAME "zgbh212"
00112 # define RADIO_TYPE (RADIO_AT86RF212)
00113 # define ZGBL_EVM_HOST (1)
00114 #endif
00115 
00116 #ifndef BOARD_ZGBL_H
00117 #define BOARD_ZGBL_H
00118 
00119 
00120 /*=== Compile time parameters ========================================*/
00121 
00122 /*=== radio interface definition =====================================*/
00123 #include "base_rdk2xx.h"
00124 
00125 static inline void xmem_init(void)
00126 {
00127     XMCRA |= _BV(SRE);
00128     XMCRB |= _BV(XMBK);
00129 }
00130 
00131 
00132 /*=== LED access macros ==============================================*/
00133 #ifndef ZGBL_EVM_HOST
00134 # define NO_KEYS       (1)
00135 #else
00136 /* EVM HOST memory mapped keys */
00137 # define KEY_IO_AD     (0x4000)
00138 # define PIN_KEY       (*(volatile uint8_t*)(KEY_IO_AD))
00139 # define xDDR_KEY       DDRE
00140 # define MASK_KEY      (0x1)
00141 # define SHIFT_KEY     (0)
00142 # define INVERSE_KEYS  (0)
00143 # define PULLUP_KEYS   (0)
00144 # define KEY_INIT      xmem_init
00145 #endif
00146 /*=== KEY access macros ==============================================*/
00147 #ifndef ZGBL_EVM_HOST
00148 # define NO_LEDS       (1)        
00149 #else
00150 
00151 /*
00152  * The EVM_HOST has the LEDs scattered around quite a bit, so the
00153  * standard methods in ioutil.h cannot be applied.
00154  * LED 0 (B5) is attached to IO_PB6
00155  * LED 1 (D7) is attached to PD7
00156  */
00157 
00158 #define MASK_LED0 (_BV(6))
00159 #define PORT_LED0 PORTB
00160 #define DDR_LED0  DDRB
00161 #define MASK_LED1 (_BV(7))
00162 #define PORT_LED1 PORTD
00163 #define DDR_LED1  DDRD
00164 
00165 #define LED_INIT() \
00166   do { \
00167   DDR_LED0 |= MASK_LED0; \
00168   DDR_LED1 |= MASK_LED1; \
00169   PORT_LED0 &= ~MASK_LED0; \
00170   PORT_LED1 |= MASK_LED1;\
00171   } while (0)
00172 
00173 #define LED_SET(x) \
00174   switch (x) { \
00175   case 0: PORT_LED0 &= ~MASK_LED0; break; \
00176   case 1: PORT_LED1 &= ~MASK_LED1; break; \
00177   }
00178 
00179 #define LED_CLR(x) \
00180   switch (x) { \
00181   case 0: PORT_LED0 |= MASK_LED0; break; \
00182   case 1: PORT_LED1 |= MASK_LED1; break; \
00183   }
00184 
00185 #define LED_SET_VALUE(x) \
00186   do { \
00187   if (x & 1) PORT_LED0 &= ~MASK_LED0; else PORT_LED0 |= MASK_LED0; \
00188   if (x & 2) PORT_LED1 &= ~MASK_LED1; else PORT_LED1 |= MASK_LED1; \
00189   } while (0)
00190 
00191 #define LED_GET_VALUE() ( \
00192   ((PORT_LED0 & MASK_LED0)? 0: 1) | \
00193   ((PORT_LED1 & MASK_LED1)? 0: 2) \
00194               )
00195 
00196 #define LED_VAL(msk,val) do{}while(0) 
00198 #define LED_TOGGLE(ln) \
00199   switch (ln) { \
00200   case 0: PORT_LED0 ^= MASK_LED0; break; \
00201   case 1: PORT_LED1 ^= MASK_LED1; break; \
00202   }
00203 
00204 #define LED_NUMBER (2)
00205 
00206 #endif
00207 /*
00208 #define SLEEP_ON_KEY_INIT() do{}while(0)
00209 #define SLEEP_ON_KEY() \
00210         do{\
00211             EIMSK |= _BV(INT5);\
00212             set_sleep_mode(SLEEP_MODE_PWR_DOWN);\
00213             sleep_mode();\
00214             EIMSK &= ~_BV(INT5);\
00215         } while(0)
00216 
00217 #define SLEEP_ON_KEY_vect INT5_vect
00218 */
00219 
00220 #define SLEEP_ON_KEY_INIT() do{}while(0)
00221 #define SLEEP_ON_KEY() do{}while(0)
00222 
00223 /*=== Host Interface ================================================*/
00224 #define HIF_TYPE (HIF_UART_1)
00225 
00226 /*=== TIMER Interface ===============================================*/
00227 #define HWTMR_PRESCALE  (1)
00228 #define HWTIMER_TICK    ((1.0*HWTMR_PRESCALE)/F_CPU)
00229 #define HWTIMER_TICK_NB (0xFFFFUL)
00230 #define HWTIMER_REG     (TCNT1)
00231 #define TIMER_TICK      (HWTIMER_TICK_NB * HWTIMER_TICK)
00232 #define TIMER_POOL_SIZE (4)
00233 #define TIMER_INIT() \
00234     do{ \
00235         TCCR1B |= (_BV(CS10)); \
00236         TIMSK1 |= _BV(TOIE1); \
00237     }while(0)
00238 #define TIMER_IRQ_vect   TIMER1_OVF_vect
00239 
00240 #endif /* BOARD_ZGBL_H */

This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1