?? tmr0.h
字號:
/***************************************************************************
* This code and information is provided "as is" without warranty of any *
* kind, either expressed or implied, including but not limited to the *
* implied warranties of merchantability and/or fitness for a particular *
* purpose. *
* *
* Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved. *
***************************************************************************/
//**************************************************************************
//
// DESCRIPTION: 71M651x POWER METER - Timer Routines.
//
// AUTHOR: RGV
//
// HISTORY: See end of file
//
//**************************************************************************
//
// File: tmr0.h
//
#ifndef TMR0_H
#define TMR0_H 1
/*** Public functions declared within this module ***/
// fixed point math that can't overflow, and is more accurate
// at higher clock rates. A reasonable compiler will do the
// math at compile time, leaving a constant.
#undef milliseconds2tmr_reg
#define milliseconds2tmr_reg(_v_) \
(UINT16_MAX - (uint16_t)((((uint32_t)_v_ * (CLK_FREQ/75)) + 80L)/160L))
#undef microseconds2tmr_reg
// assumes a 4.9MHz clock
#define microseconds2tmr_reg(_v_) \
(UINT16_MAX - (uint16_t)((((uint32_t)_v_ * 290L) + 145L)/59L))
// start timer 0; this is used in stm.c
// reload_reg is the value for the reload register. The macro above
// will calculate it from milliseconds
// restart s/b TRUE if the routine pfn should run repeatedly, FALSE for once
// pfn is a routine that the interrupt will run. It should be reentrant.
void tmr0_start (uint16_t reload_reg, uint8_t restart, void (*pfn) (void)) small reentrant;
#undef tmr_start
#define tmr_start(_r_, _b_, _pfn_) tmr0_start(_r_, _b_, _pfn_)
#define tmr0_stop() TR0 = FALSE
#undef tmr_stop
#define tmr_stop() TR0 = FALSE
#define tmr0_running() TR0
#undef tmr_running
#define tmr_running() TR0
#define tmr0_enable() ET0 = TRUE
#undef tmr_enable
#define tmr_enable() ET0 = TRUE
#define tmr0_disable() ET0 = FALSE
#undef tmr_disable
#define tmr_disable() ET0 = FALSE
// the interrupt routine for timer 0
/***************************************************************************
* History:
* $Log: tmr0.h,v $
* Revision 1.11 2006/09/09 01:10:09 gmikef
* *** empty log message ***
*
* Revision 1.10 2006/08/09 00:56:36 tvander
* *** empty log message ***
*
* Revision 1.8 2005/09/22 23:45:08 tvander
* Clean build all models and unit tests, updated copyright to be fore Teridian
*
* Revision 1.7 2005/08/28 02:16:38 gmikef
* *** empty log message ***
*
* Revision 1.6 2005/08/10 21:36:43 tvander
* Added macros to enable and disable timer interrupt.
*
* Revision 1.5 2005/05/13 00:34:41 tvander
* 6511/32k works
* Integrated and debugged self-calibration.
* The build has one unused segment, and no other errors or warnings.
* default LCD and pulse displays appear OK.
* EEPROM, software timers and hardware timers are all integrated.
*
* Revision 1.4 2005/05/03 00:39:44 tvander
* Incorporated event reporting in tmr0,tmr1 and unit tests.
* Retested stm, trm0, tmr1.
* Incorporated untested changes in io651x.h
*
* Revision 1.3 2005/04/25 19:15:31 tvander
* tested hardware timer code
*
* Revision 1.2 2005/04/21 02:01:28 gmikef
* *** empty log message ***
*
* Revision 1.4 2005/04/09 02:04:27 gmikef
* *** empty log message ***
*
* Revision 1.1 2005/03/23 19:19:32 tvander
* Added untested timer functions.
* Updated iicdio and iiceep to reflect improvements in 6510 code.
* ser0 and ser1 updated to provide features for flag.
*
* Revision 1.4 2005/03/08 19:06:53 tvander
* Self calibration in all software models
*
* Revision 1.2 2005/02/17 18:32:40 tvander
* Added automatic check-in logging to all source code.
*
* 2003 OCTOBER 30; First Version.
*
* Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved. *
* this program is fully protected by the United States copyright *
* laws and is the property of Teridian Semiconductor Corporation. *
***************************************************************************/
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -