📄 spptimer.lst
字号:
C51 COMPILER V7.06 SPPTIMER 04/13/2005 12:55:53 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE SPPTIMER
OBJECT MODULE PLACED IN sppTimer.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE sppTimer.c OMF2 BROWSE INCDIR(..\..\..\..\Include;..\..\..\..\lib) DEFINE(F
-REQ433) DEBUG
stmt level source
1 /*****************************************************************************
2 * *
3 * ********** *
4 * ************ *
5 * *** *** *
6 * *** +++ *** *
7 * *** + + *** *
8 * *** + CHIPCON CC1010 *
9 * *** + + *** CUL - spp *
10 * *** +++ *** *
11 * *** *** *
12 * *********** *
13 * ********* *
14 * *
15 *****************************************************************************
16 * *
17 *****************************************************************************
18 * Author: JOL *
19 *****************************************************************************
20 * Revision history: *
21 * *
22 * $Log: sppTimer.c,v $
23 * Revision 1.2 2002/11/18 13:39:23 tos
24 * Initialisation of pointers to timer callback functions before timer
25 * interrupt is started/enabled.
26 *
27 * Revision 1.1 2002/10/14 12:27:35 tos
28 * Initial version in CVS.
29 *
30 * *
31 ****************************************************************************/
32
33 #include <chipcon/sppInternal.h>
34
35 // Internal variables
36 pCBF xdata sppCBFSM;
37 word* xdata sppCNTFSM;
38 pCBF xdata sppCB0;
39 word* xdata sppCNT0;
40 pCBF xdata sppCB1;
41 word* xdata sppCNT1;
42 byte xdata sppCBCount;
43 word xdata sppTime;
44
45
46 //----------------------------------------------------------------------------
47 // void sppStartTimer (void)
48 //
49 // Description:
50 // Run timer3 with a period of 10 msecs.
51 //
52 // Arguments:
53 // word clkFreq
54 // The XOSC clock frequency in kHz.
C51 COMPILER V7.06 SPPTIMER 04/13/2005 12:55:53 PAGE 2
55 //----------------------------------------------------------------------------
56 void sppStartTimer (word clkFreq) {
57 1 sppTime = 0;
58 1 sppCBFSM = NULL;
59 1 sppCB0 = NULL;
60 1 sppCB1 = NULL;
61 1 INT_SETFLAG (INUM_TIMER3, INT_CLR);
62 1 halConfigTimer23(TIMER3 | TIMER23_INT_TIMER, 10000, clkFreq);
63 1 TIMER3_RUN(TRUE);
64 1 } // sppStartTimer
65
66
67
68
69 //----------------------------------------------------------------------------
70 // void sppSetTimerCB (void)
71 //
72 // Description:
73 // Add timer callback
74 //
75 // Arguments:
76 // byte cb
77 // Callback index - use SPP_CUSTOM_0_TIMER or SPP_CUSTOM_1_TIMER
78 // The SPP finite state machine uses SPP_FSM_TIMER
79 // void *pF
80 // Pointer to the function to call
81 // word *pTicks
82 // The timeout in 10s of msecs
83 //
84 // NOTE: *pTicks will be decremented by the Timer 3 interrupt
85 //----------------------------------------------------------------------------
86 void sppSetTimerCB (byte cb, void (*pF) (), word *pTicks) {
87 1 INT_ENABLE (INUM_TIMER3, INT_OFF);
88 1 if (cb == SPP_FSM_TIMER) {
89 2 sppCBFSM = pF;
90 2 sppCNTFSM = pTicks;
91 2 } else if (cb == SPP_CUSTOM_0_TIMER) {
92 2 sppCB0 = pF;
93 2 sppCNT0 = pTicks;
94 2 } else if (cb == SPP_CUSTOM_1_TIMER) {
95 2 sppCB1 = pF;
96 2 sppCNT1 = pTicks;
97 2 }
98 1 INT_ENABLE (INUM_TIMER3, INT_ON);
99 1 } // sppSetTimerCB
100
101
102
103
104 //----------------------------------------------------------------------------
105 // word sppGetTime (void)
106 //
107 // Description:
108 // Returns the value of the 10-msec counter, which is started by
109 // sppSetupRF(...)
110 //
111 // Return value:
112 // The current time in 10s of msecs
113 //----------------------------------------------------------------------------
114 word sppGetTime (void) {
115 1 word temp;
116 1 INT_ENABLE (INUM_TIMER3, INT_OFF);
C51 COMPILER V7.06 SPPTIMER 04/13/2005 12:55:53 PAGE 3
117 1 temp = sppTime;
118 1 INT_ENABLE (INUM_TIMER3, INT_ON);
119 1 return temp;
120 1 } // sppGetTime
121
122
123
124
125 //----------------------------------------------------------------------------
126 // Timer 3 interrupt service routine:
127 //----------------------------------------------------------------------------
128 void TIMER3_ISR () interrupt INUM_TIMER3 {
129 1 INT_SETFLAG (INUM_TIMER3, INT_CLR);
130 1
131 1 if (*sppCNTFSM && !--(*sppCNTFSM)) {
132 2 if (sppCBFSM != NULL) sppCBFSM();
133 2 }
134 1
135 1 if (*sppCNT0 && !--(*sppCNT0)) {
136 2 if (sppCB0 != NULL) sppCB0();
137 2 }
138 1
139 1 if (*sppCNT1 && !--(*sppCNT1)) {
140 2 if (sppCB1 != NULL) sppCB1();
141 2 }
142 1 sppTime++;
143 1 } // TIMER3_ISR
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 358 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 18 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 7
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -