📄 hal.h
字号:
/*
V0.1 Initial Release 10/July/2006 RBR
Port over Tmote 21/December/2006 RS
*/
#ifndef HAL_H
#define HAL_H
#include "compiler.h"
#include "lrwpan_config.h" //user configurations of the stack parameters
#include "lrwpan_common_types.h" //types common acrosss most files
#include "evbConfig.h" //crystal frequency, other evboard specifics
#define PACKET_FOOTER_SIZE 2
#define SYMBOLS_PER_MAC_TICK() 1 //TMote Sky: tick is meant to be HW increment of TimerA
//timer support
#define SYMBOLS_TO_MACTICKS(x) ((UINT32)(x)/(UINT32)SYMBOLS_PER_MAC_TICK())
#define MSECS_TO_MACTICKS(x) ((UINT32)(x)*((UINT32)LRWPAN_SYMBOLS_PER_SECOND/(UINT32)1000)*(UINT32)SYMBOLS_PER_MAC_TICK())
//not needed if 32 bit
#define MACTIMER_MAX_VALUE 0xFFFFFFFF //16 bit counter TAR + UINT16 halMacTimerOflow
UINT32 halMACTimerNowDelta(UINT32 x);
//#define halMACTimerDelta(x,y) (((UINT32)x-((UINT32)y))& (UINT32)MACTIMER_MAX_VALUE)
#define halMACTimerDelta(x,y) ((UINT32)x-((UINT32)y))
//global macros
#define SAVE_AND_DISABLE_GLOBAL_INTERRUPT(x) {x = READ_SR & GIE; _DINT();}
#define RESTORE_GLOBAL_INTERRUPT(x) {if(x) _EINT();}
#define ENABLE_GLOBAL_INTERRUPT() _EINT()
#define DISABLE_GLOBAL_INTERRUPT() _DINT()
//Tmote Sky UART system
//57600 default for SMCLK 1MHz
//Old setting
/*
#define SMCLK_BAUD_57_6k_UMCTL 0x84
#define SMCLK_BAUD_57_6k_UBR1 0x00
#define SMCLK_BAUD_57_6k_UBR0 0x12
*/
//Tmote Sky UART system
//57600 default for SMCLK 0.5MHz
#define SMCLK_BAUD_57_6k_UMCTL 0x5B
#define SMCLK_BAUD_57_6k_UBR1 0x00
#define SMCLK_BAUD_57_6k_UBR0 0x08
/*
#define halSetBaud(unsigned char baud) do {\
} while (0)
*/
void halIdle (void);
#define HAL_SUSPEND(x)
UINT32 sym_to_ticks(UINT32 x);
UINT32 msecs_to_ticks(UINT32 x);
void evbRadioIntCallback(void);
void halDisableRadio(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -