📄 tms.c
字号:
/* At this point the timer is completely built. The ID can now be
set and it can be linked into the created timer list. */
timer -> tm_id = TM_TIMER_ID;
/* Link the timer into the list of created timers and increment the
total number of timers in the system. */
CSC_Place_On_List(&TMD_Created_Timers_List, &(timer -> tm_created));
TMD_Total_Timers++;
/* Release protection against access to the list of created timers. */
TCT_Unprotect();
/* Determine if the timer should be enabled. */
if (enable == NU_ENABLE_TIMER)
/* Activate the timer. */
TMS_Control_Timer(timer_ptr, NU_ENABLE_TIMER);
/* Return successful completion. */
return(NU_SUCCESS);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TMS_Delete_Timer */
/* */
/* DESCRIPTION */
/* */
/* This function deletes an application timer and removes it from */
/* the list of created timers. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* TMSE_Delete_Timer Error checking shell */
/* */
/* CALLS */
/* */
/* CSC_Remove_From_List Remove node from list */
/* [HIC_Make_History_Entry] Make entry in history log */
/* [TCT_Check_Stack] Stack checking function */
/* TCT_Protect Protect created list */
/* TCT_System_Protect Protect active list */
/* TCT_Unprotect Release protection */
/* */
/* INPUTS */
/* */
/* timer_ptr Timer control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_NOT_DISABLED Timer not disabled first */
/* NU_SUCCESS */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* W. Lamie 03-01-1994 Modified protection logic to use */
/* system protection, changed */
/* function prototype, resulting */
/* in version 1.1 */
/* R. Pfaff - */
/* D. Lamie 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS TMS_Delete_Timer(NU_TIMER *timer_ptr)
{
TM_APP_TCB *timer; /* Timer control block ptr */
STATUS status; /* Completion status */
/* Move input timer pointer into internal pointer. */
timer = (TM_APP_TCB *) timer_ptr;
#ifdef NU_ENABLE_STACK_CHECK
/* Call stack checking function to check for an overflow condition. */
TCT_Check_Stack();
#endif
#ifdef NU_ENABLE_HISTORY
/* Make an entry that corresponds to this function in the system history
log. */
HIC_Make_History_Entry(NU_DELETE_TIMER_ID, (UNSIGNED) timer,
(UNSIGNED) 0, (UNSIGNED) 0);
#endif
/* Initialize the status. */
status = NU_SUCCESS;
/* Use system protect to protect the active timer list temporarily. */
TCT_System_Protect();
/* Determine if the timer is currently disabled. */
if (timer -> tm_enabled)
/* Error, indicate to the caller that the timer is currently active. */
status = NU_NOT_DISABLED;
else
/* Clear the timer ID. */
timer -> tm_id = 0;
/* Release protection. */
TCT_Unprotect();
/* Determine if an error was detected. */
if (status == NU_SUCCESS)
{
/* Protect against access to the list of created timers. */
TCT_Protect(&TMD_Created_List_Protect);
/* Remove the timer from the list of created timers. */
CSC_Remove_From_List(&TMD_Created_Timers_List, &(timer -> tm_created));
/* Decrement the total number of created timers. */
TMD_Total_Timers--;
/* Release protection against access to the list of created timers. */
TCT_Unprotect();
}
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TMS_Reset_Timer */
/* */
/* DESCRIPTION */
/* */
/* This function resets the specified application timer. Note that */
/* the timer must be in a disabled state prior to this call. The */
/* timer is activated after it is reset if the enable parameter */
/* specifies automatic activation. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* TMSE_Reset_Timer Error checking shell */
/* */
/* CALLS */
/* */
/* [HIC_Make_History_Entry] Make entry in history log */
/* [TCT_Check_Stack] Stack checking function */
/* TCT_System_Protect Protect active list */
/* TCT_Unprotect Release protection */
/* TMS_Control_Timer Enable/disable timer */
/* */
/* INPUTS */
/* */
/* timer_ptr Timer control block pointer */
/* expiration_routine Timer expiration routine */
/* initial_time Initial expiration time */
/* reschedule_time Reschedule expiration time */
/* enable Automatic enable option */
/* */
/* OUTPUTS */
/* */
/* NU_NOT_DISABLED Timer not disabled first */
/* NU_SUCCESS Successful completion */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* W. Lamie 03-01-1994 Modified protection logic to use */
/* system protection, changed */
/* function prototype, resulting */
/* in version 1.1 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -