comparison nuc-fw/nucleus/tmd.c @ 79:947b1f473960

beginning of nuc-fw
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 11 Aug 2013 07:17:25 +0000
parents
children
comparison
equal deleted inserted replaced
78:2c266d4339ff 79:947b1f473960
1 /*************************************************************************/
2 /* */
3 /* Copyright Mentor Graphics Corporation 2002 */
4 /* All Rights Reserved. */
5 /* */
6 /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */
7 /* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */
8 /* SUBJECT TO LICENSE TERMS. */
9 /* */
10 /*************************************************************************/
11
12 /*************************************************************************/
13 /* */
14 /* FILE NAME VERSION */
15 /* */
16 /* tmd.c Nucleus PLUS 1.14 */
17 /* */
18 /* COMPONENT */
19 /* */
20 /* TM - Timer Management */
21 /* */
22 /* DESCRIPTION */
23 /* */
24 /* This file contains global data structures for use within the */
25 /* timer management component. */
26 /* */
27 /* DATA STRUCTURES */
28 /* */
29 /* TMD_Created_Timers_List Pointer to the linked-list */
30 /* of created application */
31 /* timers */
32 /* TMD_Total_Timers Total number of created */
33 /* application timers */
34 /* TMD_Active_Timers_List Pointer to the linked-list */
35 /* of active timers. */
36 /* TMD_Active_List_Busy Flag indicating that the */
37 /* active timer list is in use*/
38 /* TMD_Created_List_Protect Created timer list protect */
39 /* structure */
40 /* TMD_System_Clock System clock */
41 /* TMD_Timer_Start Starting value of timer */
42 /* TMD_Timer Timer count-down value */
43 /* TMD_Timer_State State of timer */
44 /* TMD_Time_Slice Time slice count-down value */
45 /* TMD_Time_Slice_Task Pointer to task to time-slice*/
46 /* TMD_Time_Slice_State State of time slice */
47 /* TMD_HISR Timer HISR control block */
48 /* TMD_HISR_Stack_Ptr Pointer to HISR stack area */
49 /* TMD_HISR_Stack_Size Size of HISR stack area */
50 /* TMD_HISR_Priority Priority of timer HISR */
51 /* */
52 /* FUNCTIONS */
53 /* */
54 /* None */
55 /* */
56 /* DEPENDENCIES */
57 /* */
58 /* tm_defs.h Timer Management constants */
59 /* tc_defs.h Thread Control constants */
60 /* */
61 /* HISTORY */
62 /* */
63 /* DATE REMARKS */
64 /* */
65 /* 03-01-1993 Created initial version 1.0 */
66 /* 04-19-1993 Verified version 1.0 */
67 /* 08-09-1993 Removed timer task structures, */
68 /* making version 1.0a */
69 /* 08-09-1993 Verified version 1.0a */
70 /* 03-01-1994 Removed active list protect data */
71 /* structure since system protect */
72 /* is now used, resulting in */
73 /* version 1.1 */
74 /* */
75 /* 03-18-1994 Verified version 1.1 */
76 /* 04-17-1996 updated to version 1.2 */
77 /* 03-24-1998 Released version 1.3. */
78 /* 03-26-1999 Released 1.11m (new release */
79 /* numbering scheme) */
80 /* 04-17-2002 Released version 1.13m */
81 /* 11-07-2002 Released version 1.14 */
82 /*************************************************************************/
83 #define NU_SOURCE_FILE
84
85 #include "tm_defs.h" /* Timer constants */
86
87
88 /* TMD_Created_Timers_List is the head pointer of the linked list of
89 created application timers. If the list is NU_NULL, there are no timers
90 currently created. */
91
92 CS_NODE *TMD_Created_Timers_List;
93
94
95 /* TMD_Total_Timers contains the total number of created application timers
96 in the system. */
97
98 UNSIGNED TMD_Total_Timers;
99
100
101 /* TMD_Active_Timers_List is the head pointer of the linked list of active
102 timers. This includes both the application timers and the system timers
103 used for task sleeping and timeouts. If the list is NU_NULL, there are
104 no timers currently active. */
105
106 TM_TCB *TMD_Active_Timers_List;
107
108
109 /* TMD_Active_List_Busy is a flag that indicates that the active timer list
110 is being processed. This is used to prevent multiple updates to the
111 active timer list. */
112
113 INT TMD_Active_List_Busy;
114
115
116 /* TMD_Created_List_Protect is used to protect the created application timers
117 list from multiple accesses. */
118
119 TC_PROTECT TMD_Created_List_Protect;
120
121
122 /* TMD_System_Clock is a continually incrementing clock. One is added to
123 the clock each timer interrupt. */
124
125 UNSIGNED TMD_System_Clock;
126
127
128 /* TMD_Timer_Start represents the starting value of the last set timer
129 request. */
130
131 UNSIGNED TMD_Timer_Start;
132
133
134 /* TMD_Timer is a count-down timer that is used to represent the smallest
135 active timer value in the system. Once this counter goes to zero, a
136 timer has expired. */
137
138 UNSIGNED TMD_Timer;
139
140
141 /* TMD_Timer_State indicates the state of the timer variable. If the state
142 is active, the timer counter is decremented. If the state is expired,
143 the timer HISR and timer task are initiated to process the expiration. If
144 the state indicates that the timer is not-active, the timer counter is
145 ignored. */
146
147 INT TMD_Timer_State;
148
149
150 /* TMD_Time_Slice contains the count-down value for the currently executing
151 task's time slice. When this value goes to zero, time slice processing
152 is started. */
153
154 UNSIGNED TMD_Time_Slice;
155
156
157 /* TMD_Time_Slice_Task is a pointer to the task to time-slice. This pointer
158 is built in the portion of the timer interrupt that determines if a time-
159 slice timer has expired. */
160
161 TC_TCB *TMD_Time_Slice_Task;
162
163
164 /* TMD_Time_Slice_State indicates the state of the time slice variable. If
165 the state is active, the time slice counter is decremented. If the
166 state is expired, the timer HISR is initiated to process the expiration.
167 If the state indicates that the time slice is not-active, the time slice
168 counter is ignored. */
169
170 INT TMD_Time_Slice_State;
171
172
173 /* TMD_HISR is the timer HISR's control block. */
174
175 TC_HCB TMD_HISR;
176
177
178 /* TMD_HISR_Stack_Ptr points to the memory area reserved for the timer HISR.
179 Note that this is setup in INT_Initialize. */
180
181 VOID *TMD_HISR_Stack_Ptr;
182
183
184 /* TMD_HISR_Stack_Size represents the size of the allocated timer HISR stack.
185 Note that this is setup in INT_Initialize. */
186
187 UNSIGNED TMD_HISR_Stack_Size;
188
189
190 /* TMD_HISR_Priority indicates the priority of the timer HISR. Priorities
191 range from 0 to 2, where priority 0 is the highest. Note that this is
192 also initialized in INT_Initialize. */
193
194 INT TMD_HISR_Priority;
195
196
197
198
199
200