📄 tcse.c
字号:
old_time_slice = time_slice; /* Return the previous time slice value. */ return(old_time_slice);}/*************************************************************************//* *//* FUNCTION *//* *//* TCSE_Control_Signals *//* *//* DESCRIPTION *//* *//* This function checks to see if the call is being made from a *//* non-task thread. If so, the request is simply ignored. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* TCS_Control_Signals Actual control signals func *//* *//* INPUTS *//* *//* enable_signal_mask Enable signal mask *//* *//* OUTPUTS *//* *//* Previous signal enable mask *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* *//*************************************************************************/UNSIGNED TCSE_Control_Signals(UNSIGNED enable_signal_mask){UNSIGNED return_mask; /* Return signal mask */TC_TCB *task; /* Task pointer */ /* Pickup the task pointer. */ task = (TC_TCB *) TCD_Current_Thread; /* Determine if the call is valid. */ if (task -> tc_id == TC_TASK_ID) /* Valid request- call actual routine to control signals. */ return_mask = TCS_Control_Signals(enable_signal_mask); else /* Return a cleared mask. */ return_mask = 0; /* Return the old enable mask. */ return(return_mask);}/*************************************************************************//* *//* FUNCTION *//* *//* TCSE_Receive_Signals *//* *//* DESCRIPTION *//* *//* This function determines whether or not the call is being made *//* from a task thread of execution. If not, the call is ignored. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* TCS_Receive_Signals Actual receive signals func *//* *//* INPUTS *//* *//* None *//* *//* OUTPUTS *//* *//* Current signals *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* *//*************************************************************************/UNSIGNED TCSE_Receive_Signals(VOID){TC_TCB *task; /* Task pointer */UNSIGNED signals; /* Current signals */ /* Pickup the task pointer. */ task = (TC_TCB *) TCD_Current_Thread; /* Determine if the call is valid. */ if (task -> tc_id == TC_TASK_ID) /* Valid request- call actual routine to receive signals. */ signals = TCS_Receive_Signals(); else /* Return cleared signals. */ signals = 0; /* Return the signals to the caller. */ return(signals);}/*************************************************************************//* *//* FUNCTION *//* *//* TCSE_Register_Signal_Handler *//* *//* DESCRIPTION *//* *//* This function determines whether or not the caller is a task. *//* If the caller is not a task and/or if the supplied signal *//* handling function pointer is NULL, an appropriate error status *//* is returned. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* TCS_Register_Signal_Handler Actual function to register *//* the signal handler *//* *//* INPUTS *//* *//* signal_handler Signal execution shell *//* *//* OUTPUTS *//* *//* NU_INVALID_TASK Not called from task thread *//* NU_INVALID_POINTER Signal handler pointer NULL *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* *//*************************************************************************/STATUS TCSE_Register_Signal_Handler(VOID (*signal_handler)(UNSIGNED)){STATUS status; /* Return status */TC_TCB *task; /* Task pointer */ /* Pickup the task pointer. */ task = (TC_TCB *) TCD_Current_Thread; /* Determine if the caller is a task. */ if (task -> tc_id != TC_TASK_ID) /* Indicate that the caller is invalid. */ status = NU_INVALID_TASK; else if (signal_handler == NU_NULL) /* Indicate that the signal handler is invalid. */ status = NU_INVALID_POINTER; else /* Everything is fine, call the actual function. */ status = TCS_Register_Signal_Handler(signal_handler); /* Return completion status. */ return(status);}/*************************************************************************//* *//* FUNCTION *//* *//* TCSE_Send_Signals *//* *//* DESCRIPTION *//* *//* This function checks for an invalid task. If an invalid task *//* is selected and error is returned. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* TCS_Send_Signals Actual send signal function *//* *//* INPUTS *//* *//* task_ptr Task pointer *//* signals Signals to send to the task *//* *//* OUTPUTS *//* *//* NU_INVALID_TASK Task pointer is invalid *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 03-01-1994 Changed function interface, *//* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* 03-17-1997 Corrected SPR220. *//* *//*************************************************************************/STATUS TCSE_Send_Signals(NU_TASK *task_ptr, UNSIGNED signals){TC_TCB *task; /* Task control block ptr */STATUS status; /* Completion status */ /* Move input task pointer into internal pointer. */ task = (TC_TCB *) task_ptr; /* Determine if the task pointer is valid. */ if ((task != NU_NULL) && (task -> tc_id == TC_TASK_ID)) /* Task pointer is valid, call the actual function. */ status = TCS_Send_Signals(task_ptr, signals); else /* Task pointer is invalid, return an error status. */ status = NU_INVALID_TASK; /* Return the completion status. */ return(status);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -