hal.h

来自「zigbee stack ---msstatePAN」· C头文件 代码 · 共 59 行

H
59
字号
/*
  V0.1 Initial Release   10/July/2006  RBR

*/
#ifndef HAL_H
#define HAL_H

#include "compiler.h"
#include "lrwpan_config.h"         //user configurations
#include "lrwpan_common_types.h"   //types common acrosss most files
#include "evbConfig.h"             //has Crystal frequency, other evboard specifics

#define PACKET_FOOTER_SIZE  2
#define SYMBOLS_PER_MAC_TICK()        1    //this controls timer0 prescale



//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())
#define MACTIMER_MAX_VALUE 0x00FFFFFF   //24 bit counter

UINT32 halMACTimerNowDelta(UINT32 x);

#define halMACTimerDelta(x,y) (((UINT32)x-((UINT32)y))& (UINT32)MACTIMER_MAX_VALUE)

#define SAVE_AND_DISABLE_GLOBAL_INTERRUPT(x) {x=GIEH;GIEH=0;}
#define RESTORE_GLOBAL_INTERRUPT(x)          GIEH=x

#define DISABLE_GLOBAL_INTERRUPT()             GIE=0
#define ENABLE_GLOBAL_INTERRUPT()              GIE=1

#define halSetBaud(baud)  SPBRG = (((FOSC/baud)/16) -1)


void halIdle (void);

#define HAL_SUSPEND(x) 

UINT32 sym_to_ticks(UINT32 x);
UINT32 msecs_to_ticks(UINT32 x);

//software delay loop for x microseconds
#define	halWaitUs(x) { unsigned char _dcnt; \		     _dcnt = ((x* FOSC/1000000)/(12)); \		     while(--_dcnt != 0) \		       continue; }


void evbRadioIntCallback(void);
void halDisableRadio(void);

#endif


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?