/*********************************************************************************** Filename: hal.c Description: Hardware Abstraction Layer ***********************************************************************************/ #ifndef HAL_H #define HAL_H #ifndef DMA_H #include #endif #ifndef CC2511_MAP_H #include #endif /*********************************************************************************** * INCLUDES */ /****************************************************************************** ******************* Interrupt functions/macros ******************* ******************************************************************************/ // Macros which simplify access to interrupt enables, interrupt flags and // interrupt priorities. Increases code legibility. //****************************************************************************** #define INT_ON 1 #define INT_OFF 0 #define INT_SET 1 #define INT_CLR 0 // Global interrupt enables #define INT_GLOBAL_ENABLE(on) EA=(!!on) #define DISABLE_ALL_INTERRUPTS() (IEN0 = IEN1 = IEN2 = 0x00) #define INUM_RFTXRX 0 #define INUM_ADC 1 #define INUM_URX0 2 #define INUM_URX1 3 #define INUM_ENC 4 #define INUM_ST 5 #define INUM_P2INT 6 #define INUM_UTX0 7 #define INUM_DMA 8 #define INUM_T1 9 #define INUM_T2 10 #define INUM_T3 11 #define INUM_T4 12 #define INUM_P0INT 13 #define INUM_UTX1 14 #define INUM_P1INT 15 #define INUM_RF 16 #define INUM_WDT 17 #define NBR_OF_INTERRUPTS 18 /****************************************************************************** ************************** DMA structures / macros ************************* ******************************************************************************/ // The macros and structs in this section simplify setup and usage of DMA. //****************************************************************************** #define DMA_CHANNEL_0 0x01 #define DMA_CHANNEL_1 0x02 #define DMA_CHANNEL_2 0x04 #define DMA_CHANNEL_3 0x08 #define DMA_CHANNEL_4 0x10 // Macro for enabling or disabling overflow interrupts of timer 1. #define TIMER1_ENABLE_OVERFLOW_INT(val) \ (TIMIF = (val) ? TIMIF | 0x40 : TIMIF & ~0x40) // Macros for turning timers on or off #define TIMER1_RUN(value) (T1CTL = (value) ? T1CTL|0x02 : T1CTL&~0x03) #define TIMER3_RUN(value) (T3CTL = (value) ? T3CTL|0x10 : T3CTL&~0x10) #define TIMER4_RUN(value) (T4CTL = (value) ? T4CTL|0x10 : T4CTL&~0x10) #define T1CCTL0_IM 0x40 #define T1CCTL1_IM 0x40 #define T1CCTL2_IM 0x40 #define T1CTL_CH0IF 0x20 #define T1CCTL2_CMP 0x38 #define SETPORT0PERIPHERAL(value) (P0SEL = value) #define SETPORT0ASINPUT(value) (P0DIR = value) #define SETPORT0GPIO(value) (P0SEL = value) extern DMA_CONFIG XDATA radioRxConfig; /*********************************************************************************** Copyright 2008 Texas Instruments Incorporated. All rights reserved. IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software license agreement between the user who downloaded the software, his/her employer (which must be your employer) and Texas Instruments Incorporated (the "License"). You may not use this Software unless you agree to abide by the terms of the License. The License limits your use, and you acknowledge, that the Software may not be modified, copied or distributed unless embedded on a Texas Instruments microcontroller or used solely and exclusively in conjunction with a Texas Instruments radio frequency transceiver, which is integrated into your product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any purpose. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. Should you have any questions regarding your right to use this Software, contact Texas Instruments Incorporated at www.TI.com. ***********************************************************************************/ #endif //HAL_H