csl_uartgethwstatus.c

来自「TI达芬奇dm644x各硬件模块测试代码」· C语言 代码 · 共 115 行

C
115
字号
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005                 
 *                                                                              
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.             
 *   ===========================================================================
 */
 
/** @file csl_uartGetHwStatus.c
 *  
 *  @brief    File for functional layer of CSL API @a CSL_uartGetHwStatus()
 *
 *  Path: \\(CSLPATH)\\ipmodules\\uart\\src
 *
 *  @date 30 April, 2004
 *  @author Pratheesh Gangadhar
 
 */
 
/* =============================================================================
 *  Revision History
 *  ===============
 *  08-Sep-2004 brn Updated for the new CSL architecture
 *  11-Oct-2004 brn Updated with the code review comments.
 * =============================================================================
*/

#include <csl_uart.h>
#include <csl_uartAux.h>

/** ============================================================================
 *   @n@b CSL_uartGetHwStatus
 *
 *   @b Description
 *   @n Gets the status of the different operations of UART.
 *
 *   @b Arguments
 *   @verbatim
            hUart            Handle to the UART instance

            query           The query to this API of UART which indicates the
                            status to be returned.

            response        Placeholder to return the status.
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Status info return successful.
 *   @li                    CSL_ESYS_BADHANDLE  - Invalid handle
 *   @li                    CSL_ESYS_INVPARAMS  - Invalid parameter
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_UartHandle          hUart;
        CSL_UartHwStatusQuery   query;
        void                    reponse;

        status = CSL_uartGetHwStatus (hUart, query, &response);

     @endverbatim
 * =============================================================================
 */
#pragma CODE_SECTION (CSL_uartGetHwStatus, ".text:csl_section:uart");
CSL_Status CSL_uartGetHwStatus (
    CSL_UartHandle          hUart,
    CSL_UartHwStatusQuery   query,
    void                    *response 
)
{
    CSL_Status status = CSL_SOK;
    
    if (hUart == NULL) {
        return CSL_ESYS_BADHANDLE;
    }
    
    switch (query) {
        case CSL_UART_QUERY_LINESTATUS: 
            *((CSL_BitMask32*)response) = CSL_uartGetLineStatus (hUart);
            break;   
             
        case CSL_UART_QUERY_MODEMSTATUS: 
            *((CSL_BitMask32*)response) = CSL_uartGetModemStatus (hUart);
            break;
            
        case CSL_UART_QUERY_INTRSTATUS:  
            /* To access RBR, THR and IER registers */
            *((CSL_BitMask32*)response) = CSL_uartGetIntrStatus (hUart);
            break;  
            
        case CSL_UART_QUERY_VERSION:
            *((Uint8*)response) = CSL_uartGetVersion (hUart);
            break;
            
        case CSL_UART_QUERY_INTRSOURCE:
            *(CSL_UartIntrSource*)response = CSL_uartGetIntrSource (hUart);
            break;
            
        default:
            status = CSL_ESYS_INVQUERY ;    
            break;  
    }
    
    return status;
    
}   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?