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

📄 timerhal.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
字号:
/*****************************************************************************
* This file contains the macro used by TimerHAL.c file
* All public interface are described under TMR_Interface.h file.
*
*             
* (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 _TIMERHAL_H
#define _TIMERHAL_H

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

/*****************************************************************************
******************************************************************************
* Private macros
******************************************************************************
*****************************************************************************/
#define gTpm1scPreeScale1_c     0x00	 /* For PreeScale Value of 1   */
#define gTpm1scPreeScale2_c     0x01   /* For PreeScale Value of 2   */
#define gTpm1scPreeScale4_c     0x02	 /* For PreeScale Value of 4   */
#define gTpm1scPreeScale8_c     0x03	 /* For PreeScale Value of 8   */
#define gTpm1scPreeScale16_c    0x04   /* For PreeScale Value of 16  */
#define gTpm1scPreeScale32_c    0x05	 /* For PreeScale Value of 32  */
#define gTpm1scPreeScale64_c    0x06	 /* For PreeScale Value of 64  */
#define gTpm1scPreeScale128_c   0x07	 /* For PreeScale Value of 128 */

#define gTpm1scPreeScaleCount_c gTpm1scPreeScale128_c /*Selects the system's 
  								                                     PreeScale Value for 128 */

#define gTpm1scClksb_c          0x10
#define gTpm1scStop_c           0x00
#define gTpm1scFixedClock_c     gTpm1scClksb_c  /*Selects the system clock*/ 
#define gTpm1c0scChofClear_c    0x7F
#define gTpm1c0scMs0a_c         0x10
#define gTpm1socCh0ie_c         0x40
#define gChofSet_c              0x80


/* Converts the time given in milli sec to timer tick. This is specific for
   HCS08 implementation. Here milllisecond is converted to ticks by divide by
   four.  */
#define TMR_ConversionOfMilliSecToTicks(ticksInMiliSec )  (ticksInMiliSec>>2) 


/* Macro to read compare register of channel 0 of timer 1 */
#define TPM1C0VReadValue( variable )  \
  mRead16bitReg.byteAccess[0]  = TPM1C0VH;  \
  mRead16bitReg.byteAccess[1]  = TPM1C0VL;  \
  ( variable ) = mRead16bitReg.wordAccess ;
  
 
/* Macro to read Free running counter  */
#define ReadTpmCntRegister( variable )  \
  mRead16bitReg.byteAccess[0]  = TPM1CNTH;  \
  mRead16bitReg.byteAccess[1]  = TPM1CNTL;  \
  ( variable ) = mRead16bitReg.wordAccess ;

  

/* EnterSwTimerMode: enables the software timer registers.*/
#define EnterSwTimerMode()  \
  (TPM1SC |= (gTpm1scFixedClock_c | gTpm1scPreeScaleCount_c ))

/*ExitSwTimerMode: resets the softwar timer.*/
#define ExitSwTimerMode() (TPM1SC = (gTpm1scStop_c))

  
/* Loads TPM1C0V registers  */  
#define TPM1C0VLvalue(minimumResolutionTick)(minimumResolutionTick & 0xFF) 
#define TPM1C0VHvalue(minimumResolutionTick) (minimumResolutionTick >> 8) 

#endif

⌨️ 快捷键说明

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