mbce.c
来自「nucleus 2006 source code」· C语言 代码 · 共 325 行 · 第 1/2 页
C
325 行
status = NU_INVALID_MAILBOX;
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* MBCE_Send_To_Mailbox */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the send-to-mailbox function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* MBC_Sent_To_Mailbox Actual mailbox send function */
/* TCCE_Suspend_Error Check suspend validity */
/* */
/* INPUTS */
/* */
/* mailbox_ptr Mailbox control block pointer*/
/* message Pointer to message to send */
/* suspend Suspension option if full */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_MAILBOX Mailbox pointer is invalid */
/* NU_INVALID_POINTER Message pointer is invalid */
/* NU_INVALID_SUSPEND Invalid suspend request */
/* */
/*************************************************************************/
STATUS MBCE_Send_To_Mailbox(NU_MAILBOX *mailbox_ptr, VOID *message,
UNSIGNED suspend)
{
MB_MCB *mailbox; /* Mailbox control block ptr */
STATUS status; /* Completion status */
/* Move input mailbox pointer into internal pointer. */
mailbox = (MB_MCB *) mailbox_ptr;
/* Determine if mailbox pointer is invalid. */
if (mailbox == NU_NULL)
/* Mailbox pointer is invalid, indicate in completion status. */
status = NU_INVALID_MAILBOX;
else if (mailbox -> mb_id != MB_MAILBOX_ID)
/* Mailbox pointer is invalid, indicate in completion status. */
status = NU_INVALID_MAILBOX;
else if (message == NU_NULL)
/* Message pointer is invalid, indicate in completion status. */
status = NU_INVALID_POINTER;
else if ((suspend) && (TCCE_Suspend_Error()))
/* Indicate that suspension is only valid from a task thread. */
status = NU_INVALID_SUSPEND;
else
/* Parameters are valid, call actual function. */
status = MBC_Send_To_Mailbox(mailbox_ptr, message, suspend);
/* Return the completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* MBCE_Receive_From_Mailbox */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the receive message from mailbox function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* MBC_Receive_From_Mailbox Actual receive function */
/* TCCE_Suspend_Error Check suspend validity */
/* */
/* INPUTS */
/* */
/* mailbox_ptr Mailbox control block pointer*/
/* message Pointer to message to send */
/* suspend Suspension option if empty */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_MAILBOX Mailbox pointer is invalid */
/* NU_INVALID_POINTER Message pointer is invalid */
/* NU_INVALID_SUSPEND Invalid suspend request */
/* */
/*************************************************************************/
STATUS MBCE_Receive_From_Mailbox(NU_MAILBOX *mailbox_ptr, VOID *message,
UNSIGNED suspend)
{
MB_MCB *mailbox; /* Mailbox control block ptr */
STATUS status; /* Completion status */
/* Move input mailbox pointer into internal pointer. */
mailbox = (MB_MCB *) mailbox_ptr;
/* Determine if mailbox pointer is invalid. */
if (mailbox == NU_NULL)
/* Mailbox pointer is invalid, indicate in completion status. */
status = NU_INVALID_MAILBOX;
else if (mailbox -> mb_id != MB_MAILBOX_ID)
/* Mailbox pointer is invalid, indicate in completion status. */
status = NU_INVALID_MAILBOX;
else if (message == NU_NULL)
/* Message pointer is invalid, indicate in completion status. */
status = NU_INVALID_POINTER;
else if ((suspend) && (TCCE_Suspend_Error()))
/* Indicate that suspension is only valid from a task thread. */
status = NU_INVALID_SUSPEND;
else
/* Parameters are valid, call actual function. */
status = MBC_Receive_From_Mailbox(mailbox_ptr, message, suspend);
/* Return the completion status. */
return(status);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?