📄 hal_timer.s51
字号:
CFI EndCommon cfiCommon0
CFI Common cfiCommon1 Using cfiNames0
CFI CodeAlign 1
CFI DataAlign -1
CFI ReturnAddress ?RET CODE
CFI CFA_DOVERLAY Used
CFI CFA_IOVERLAY Used
CFI CFA_SP SP+-2
CFI CFA_PSP16 PSP16+0
CFI CFA_XSP16 XSP16+0
CFI `PSW.CY` SameValue
CFI `B.BR0` SameValue
CFI `B.BR1` SameValue
CFI `B.BR2` SameValue
CFI `B.BR3` SameValue
CFI `B.BR4` SameValue
CFI `B.BR5` SameValue
CFI `B.BR6` SameValue
CFI `B.BR7` SameValue
CFI `VB.BR8` SameValue
CFI `VB.BR9` SameValue
CFI `VB.BR10` SameValue
CFI `VB.BR11` SameValue
CFI `VB.BR12` SameValue
CFI `VB.BR13` SameValue
CFI `VB.BR14` SameValue
CFI `VB.BR15` SameValue
CFI VB SameValue
CFI B SameValue
CFI A SameValue
CFI PSW SameValue
CFI DPL0 SameValue
CFI DPH0 SameValue
CFI R0 SameValue
CFI R1 SameValue
CFI R2 SameValue
CFI R3 SameValue
CFI R4 SameValue
CFI R5 SameValue
CFI R6 SameValue
CFI R7 SameValue
CFI V0 SameValue
CFI V1 SameValue
CFI V2 SameValue
CFI V3 SameValue
CFI V4 SameValue
CFI V5 SameValue
CFI V6 SameValue
CFI V7 SameValue
CFI PSPH Undefined
CFI PSPL Undefined
CFI XSPH Undefined
CFI XSPL Undefined
CFI ?RET Concat
CFI ?BRET_EXT SameValue
CFI ?RET_HIGH Frame(CFA_SP, 2)
CFI ?RET_LOW Frame(CFA_SP, 1)
CFI EndCommon cfiCommon1
halTimer1Isr SYMBOL "halTimer1Isr"
`halTimer1Isr??INTVEC 75` SYMBOL "??INTVEC 75", halTimer1Isr
halTimer3Isr SYMBOL "halTimer3Isr"
`halTimer3Isr??INTVEC 91` SYMBOL "??INTVEC 91", halTimer3Isr
halTimer4Isr SYMBOL "halTimer4Isr"
`halTimer4Isr??INTVEC 99` SYMBOL "??INTVEC 99", halTimer4Isr
// C:\Texas Instruments\ZStack-1.4.2-1.1.0\Components\hal\target\CC2430DB\hal_timer.c
// 1 /**************************************************************************************************
// 2 Filename: hal_timer.c
// 3 Revised: $Date: 2006-11-01 15:05:21 -0700 (Wed, 01 Nov 2006) $
// 4 Revision: $Revision: 12475 $
// 5
// 6 Description:
// 7
// 8 This file contains the interface to the Timer Service.
// 9 This also contains the Task functions.
// 10
// 11 Copyright (c) 2006 by Texas Instruments, Inc.
// 12 All Rights Reserved. Permission to use, reproduce, copy, prepare
// 13 derivative works, modify, distribute, perform, display or sell this
// 14 software and/or its documentation for any purpose is prohibited
// 15 without the express written consent of Texas Instruments, Inc.
// 16 **************************************************************************************************/
// 17 /*********************************************************************
// 18 NOTE: The following mapping is done between the logical timer
// 19 names defined in HAL_TIMER.H and the physical HW timer.
// 20
// 21 HAL_TIMER_0 --> HW Timer 3 (8-bits)
// 22 HAL_TIMER_2 --> HW Timer 4 (8-bits)
// 23 HAL_TIMER_3 --> HW Timer 1 (16-bits)
// 24
// 25 NOTE: The timer code assumes only one channel, CHANNEL 0, is used
// 26 for each timer. There is currently no support for other
// 27 channels.
// 28
// 29 NOTE: Only Output Compare Mode is supported. There is no provision
// 30 to support Input Capture Mode.
// 31
// 32 NOTE: There is no support to map the output of the timers to a
// 33 physical I/O pin
// 34
// 35 *********************************************************************/
// 36 /*********************************************************************
// 37 * INCLUDES
// 38 */
// 39 #include "hal_mcu.h"
ASEGN SFR_AN:DATA:NOROOT,0cbH
// unsigned char volatile __sfr T3CTL
T3CTL:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0ccH
// unsigned char volatile __sfr T3CCTL0
T3CCTL0:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0ceH
// unsigned char volatile __sfr T3CCTL1
T3CCTL1:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0e4H
// unsigned char volatile __sfr T1CTL
T1CTL:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0e5H
// unsigned char volatile __sfr T1CCTL0
T1CCTL0:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0e6H
// unsigned char volatile __sfr T1CCTL1
T1CCTL1:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0e7H
// unsigned char volatile __sfr T1CCTL2
T1CCTL2:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0ebH
// unsigned char volatile __sfr T4CTL
T4CTL:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0ecH
// unsigned char volatile __sfr T4CCTL0
T4CCTL0:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0eeH
// unsigned char volatile __sfr T4CCTL1
T4CCTL1:
DS 1
// 40 #include "hal_defs.h"
// 41 #include "hal_types.h"
// 42 #include "hal_timer.h"
// 43
// 44 /*********************************************************************
// 45 * MACROS
// 46 */
// 47
// 48 /*********************************************************************
// 49 * CONSTANTS
// 50 */
// 51 #define HW_TIMER_1 0x00
// 52 #define HW_TIMER_3 0x01
// 53 #define HW_TIMER_4 0x02
// 54 #define HW_TIMER_INVALID 0x03
// 55 #define HW_TIMER_MAX 0x03
// 56
// 57 #define IEN1_T1IE 0x02 /* Timer1 Interrupt Enable */
// 58 #define IEN1_T3IE 0x08 /* Timer3 Interrupt Enable */
// 59 #define IEN1_T4IE 0x10 /* Timer4 Interrupt Enable */
// 60
// 61 #define T1CTL_CH2IF 0x80
// 62 #define T1CTL_CH1IF 0x40
// 63 #define T1CTL_CH0IF 0x20
// 64 #define T1CTL_OVFIF 0x10
// 65
// 66 #define TIMIF_T1OVFIM 0x40
// 67 #define TIMIF_T4CH1IF 0x20
// 68 #define TIMIF_T4CH0IF 0x10
// 69 #define TIMIF_T4OVFIF 0x08
// 70 #define TIMIF_T3CH1IF 0x04
// 71 #define TIMIF_T3CH0IF 0x02
// 72 #define TIMIF_T3OVFIF 0x01
// 73
// 74 #define T34CTL_OVFIM 0x80
// 75
// 76 #define T134CCTL_IM 0x40 /* Interrupt Mask */
// 77 #define T134CCTL_CMP_BITS 0x38 /* Bits[5:3] == CMP[2:0] */
// 78 #define T134CCTL_MODE 0x04 /* Capture(0)/Compare(1) mode */
// 79 #define T134CCTL_CAP_BITS 0x03 /* Bits[1:0] == CAP[1:0] */
// 80
// 81 #define T134CCTL_CMP_OC 0x18 /* Set output on compare, clear at 0 */
// 82 #define T134CCTL_CAP_RE 0x01 /* Set input capture on rising edge */
// 83
// 84 /* Timer clock pre-scaler definitions for 16bit timer1 */
// 85 #define HAL_TIMER1_16_TC_DIV1 0x00 /* No clock pre-scaling */
// 86 #define HAL_TIMER1_16_TC_DIV8 0x04 /* Clock pre-scaled by 8 */
// 87 #define HAL_TIMER1_16_TC_DIV32 0x08 /* Clock pre-scaled by 32 */
// 88 #define HAL_TIMER1_16_TC_DIV128 0x0c /* Clock pre-scaled by 128 */
// 89 #define HAL_TIMER1_16_TC_BITS 0x0c /* Bits 3:2 */
// 90
// 91 /* Timer clock pre-scaler definitions for 8bit timer3 and timer4 */
// 92 #define HAL_TIMER34_8_TC_DIV1 0x00 /* No clock pre-scaling */
// 93 #define HAL_TIMER34_8_TC_DIV2 0x20 /* Clock pre-scaled by 2 */
// 94 #define HAL_TIMER34_8_TC_DIV4 0x40 /* Clock pre-scaled by 4 */
// 95 #define HAL_TIMER34_8_TC_DIV8 0x60 /* Clock pre-scaled by 8 */
// 96 #define HAL_TIMER34_8_TC_DIV16 0x80 /* Clock pre-scaled by 16 */
// 97 #define HAL_TIMER34_8_TC_DIV32 0xA0 /* Clock pre-scaled by 32 */
// 98 #define HAL_TIMER34_8_TC_DIV64 0xC0 /* Clock pre-scaled by 64 */
// 99 #define HAL_TIMER34_8_TC_DIV128 0xE0 /* Clock pre-scaled by 128 */
// 100 #define HAL_TIMER34_8_TC_BITS 0xE0 /* Bits 7:5 */
// 101
// 102 /* Operation Mode definitions */
// 103 #define HAL_TIMER1_OPMODE_STOP 0x00 /* Free Running Mode, Count from 0 to Max */
// 104 #define HAL_TIMER1_OPMODE_FREERUN 0x01 /* Free Running Mode, Count from 0 to Max */
// 105 #define HAL_TIMER1_OPMODE_MODULO 0x02 /* Modulo Mode, Count from 0 to CompareValue */
// 106 #define HAL_TIMER1_OPMODE_BITS 0x03 /* Bits 1:0 */
// 107
// 108 #define HAL_TIMER34_START 0x10 /* Timer3 and Timer4 have separate Start bit */
// 109 #define HAL_TIMER34_OPMODE_FREERUN 0x00 /* Free Running Mode, Count from 0 to Max */
// 110 #define HAL_TIMER34_OPMODE_MODULO 0x02 /* Modulo Mode, Count from 0 to CompareValue */
// 111 #define HAL_TIMER34_OPMODE_BITS 0x03 /* Bits 1:0 */
// 112
// 113 #define HAL_TIMER_MODE_STOP 0x03
// 114
// 115 /* Prescale settings */
// 116 #define HAL_TIMER1_16_PRESCALE HAL_TIMER1_16_TC_DIV128
// 117 #define HAL_TIMER1_16_PRESCALE_VAL 128
// 118 #define HAL_TIMER3_8_PRESCALE HAL_TIMER34_8_TC_DIV128
// 119 #define HAL_TIMER3_8_PRESCALE_VAL 128
// 120 #define HAL_TIMER4_8_PRESCALE HAL_TIMER34_8_TC_DIV128
// 121 #define HAL_TIMER4_8_PRESCALE_VAL 128
// 122
// 123 /* Clock settings */
// 124 #define HAL_TIMER_16MHZ 16
// 125 #define HAL_TIMER_32MHZ 32
// 126
// 127 /* Default all timers to use channel 0 */
// 128 #define TCHN_T1CCTL &(X_T1CCTL0)
// 129 #define TCHN_T1CCL &(X_T1CC0L)
// 130 #define TCHN_T1CCH &(X_T1CC0H)
// 131 #define TCNH_T1OVF &(X_TIMIF)
// 132 #define TCHN_T1OVFBIT TIMIF_T1OVFIM
// 133 #define TCHN_T1INTBIT IEN1_T1IE
// 134
// 135 #define TCHN_T3CCTL &(X_T3CCTL0)
// 136 #define TCHN_T3CCL &(X_T3CC0)
// 137 #define TCHN_T3CCH &(X_T3CC0)
// 138 #define TCNH_T3OVF &(X_T3CTL)
// 139 #define TCHN_T3OVFBIT T34CTL_OVFIM
// 140 #define TCHN_T3INTBIT IEN1_T3IE
// 141
// 142 #define TCHN_T4CCTL &(X_T4CCTL0)
// 143 #define TCHN_T4CCL &(X_T4CC0)
// 144 #define TCHN_T4CCH &(X_T4CC0)
// 145 #define TCNH_T4OVF &(X_T4CTL)
// 146 #define TCHN_T4OVFBIT T34CTL_OVFIM
// 147 #define TCHN_T4INTBIT IEN1_T4IE
// 148
// 149 /*********************************************************************
// 150 * TYPEDEFS
// 151 */
// 152 typedef struct
// 153 {
// 154 bool configured;
// 155 bool intEnable;
// 156 uint8 opMode;
// 157 uint8 channel;
// 158 uint8 channelMode;
// 159 uint8 prescale;
// 160 uint8 prescaleVal;
// 161 uint8 clock;
// 162 halTimerCBack_t callBackFunc;
// 163 } halTimerSettings_t;
// 164
// 165 typedef struct
// 166 {
// 167 uint8 volatile XDATA *TxCCTL;
// 168 uint8 volatile XDATA *TxCCH;
// 169 uint8 volatile XDATA *TxCCL;
// 170 uint8 volatile XDATA *TxOVF;
// 171 uint8 ovfbit;
// 172 uint8 intbit;
// 173 } halTimerChannel_t;
// 174
// 175 /*********************************************************************
// 176 * GLOBAL VARIABLES
// 177 */
RSEG XDATA_Z:XDATA:NOROOT(0)
REQUIRE __INIT_XDATA_Z
// 178 static halTimerSettings_t halTimerRecord[HW_TIMER_MAX];
??halTimerRecord:
DS 33
RSEG XDATA_Z:XDATA:NOROOT(0)
REQUIRE __INIT_XDATA_Z
// 179 static halTimerChannel_t halTimerChannel[HW_TIMER_MAX];
??halTimerChannel:
DS 30
// 180
// 181 /*********************************************************************
// 182 * FUNCTIONS - External
// 183 */
// 184
// 185 /*********************************************************************
// 186 * FUNCTIONS - Local
// 187 */
// 188 uint8 halTimerSetCount (uint8 cc2430id, uint32 timePerTick);
// 189 uint8 halTimerSetPrescale (uint8 cc2430id, uint8 prescale);
// 190 uint8 halTimerSetOpMode (uint8 cc2430id, uint8 opMode);
// 191 uint8 halTimerSetChannelMode (uint8 cc2430id, uint8 channelMode);
// 192 void halTimerSendCallBack (uint8 timerId, uint8 channel, uint8 channelMode);
// 193 uint8 halTimerRemap (uint8 timerId);
// 194 void halProcessTimer1 (void);
// 195 void halProcessTimer3 (void);
// 196 void halProcessTimer4 (void);
// 197
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -