⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
字号:
/*****************************************************************************
* This is the header file to be used internal to timer module.
* All public interface are described under TMR_Interface.h file.
*
* Important: 
* COMPILER OPTIONS:
* Use gInterruptDrivenTimers_d compiler option for interrupt based Software 
* timer.
* Use gPolledTimers_d compiler option for polling based Software timer.
* The library has to be rebuild effect the change in compiler option.
*
* NUMBER OF SOFTWARE TIMERS:
* Any number of timer can be supported.It is compile time value.
* (TMR_Interface.h).
* Needs to recompile the TMR.lib for change in software timers.
*             
* (c) Copyright 2006, Freescale, Inc. All rights reserved.
*
* Freescale Semiconductor Confidential Proprietary
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale Semiconductor Danmark A/S.
*****************************************************************************/
#ifndef _TIMER_H
#define _TIMER_H

#include "TMR_Interface.h"
#include "EmbeddedTypes.h"
#include "IoConfig.h"

/*****************************************************************************
******************************************************************************
* Private macros
******************************************************************************
*****************************************************************************/
enum  {
  gValidTimer_c   = 0x1,
  gUsedTimer_c    = 0x2,
  gExpiredTimer_c = 0x4
};

#define mTimerNill_c gSoftwareTimerCount_c

/*****************************************************************************
******************************************************************************
* Public prototypes
******************************************************************************
*****************************************************************************/
void TMRCalculateAndLoadNextTimeOutCompareValue(uint8_t );
void TMRInitCompareRegister (uint16_t);
void TMR_DefaultTimeoutHandler( uint8_t );


/*****************************************************************************
******************************************************************************
* Public type definitions
******************************************************************************
*****************************************************************************/
typedef uint32_t timer_t;

typedef struct timerMgmt_tag {
  uint8_t timerType;  /*  timerType */
  uint8_t status;     /*  Set if the timer is expired */
  uint8_t next;       /*  Used for Link list  */ 
} timerMgmt_t;

typedef struct TimerRecord_tag {
  uint16_t    timeout;  /*  Timer count set by the upper layer  */
  uint16_t    restoreTimeout;
  timerMgmt_t timerMgmt;
  void ( *pCallBackFunction )( uint8_t timerID);
}TimerRecord_t;


typedef union read16bitReg_tag  { /* To Access 16 bit registers */
  uint16_t  wordAccess;
  uint8_t   byteAccess[2];
}read16bitReg_t;


/*****************************************************************************
******************************************************************************
* Public memory declarations
******************************************************************************
*****************************************************************************/
extern TimerRecord_t maSoftTimers[ gSoftwareTimerCount_c ];
extern uint8_t mTimerHead;
extern read16bitReg_t  mRead16bitReg;
extern uint8_t gaExpiredTimers[gSoftwareTimerCount_c];
extern uint8_t mExpiredTimerHead ;


/*****************************************************************************
******************************************************************************
* Public functions
******************************************************************************
*****************************************************************************/
/* None */


#endif /* _TIMER_H */

⌨️ 快捷键说明

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