⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mbce.c

📁 已移植到TI OMAP1610处理器的Nucleus操作系统源码
💻 C
📖 第 1 页 / 共 2 页
字号:
    /* Determine if the mailbox pointer is valid.  */
    if ((mailbox) && (mailbox -> mb_id == MB_MAILBOX_ID))
    
        /* Mailbox pointer is valid, call function to delete it.  */
        status =  MBC_Delete_Mailbox(mailbox_ptr);
        
    else
    
        /* Mailbox pointer is invalid, indicate in completion status.  */
        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      */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*        DATE                    REMARKS                                */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */
/*      03-01-1994      Modified interface to exactly                    */
/*                      match prototype, resulting in                    */
/*                      version 1.1                                      */
/*                                                                       */
/*      03-18-1994      Verified version 1.1                             */
/*                                                                       */
/*************************************************************************/
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      */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */
/*      03-01-1994      Modified interface to exactly                    */
/*                      match prototype, resulting in                    */
/*                      version 1.1                                      */
/*                                                                       */
/*      03-18-1994      Verified version 1.1                             */
/*                                                                       */
/*************************************************************************/
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -