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

📄 csl_uartopen.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 C
字号:
/*  ============================================================================
 *   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_uartOpen.c
 *  
 *  @brief    File for functional layer of CSL API @a CSL_uartOpen()
 *
 *  Path: \\(CSLPATH)\\ipmodules\\uart\\src
 *
 *  Description
 *    - The @a CSL_uartOpen() function definition & it's associated functions
 *
 *  @date 23rd Jan, 2004
 *  @author Ruchika Kharwar
 */
 
/* =============================================================================
 *  Revision History
 *  ===============
 *  07-Sep-2004 brn Updated for the new CSL architecture
 *  11-Oct-2004 brn Updated with the code review comments.
 * =============================================================================
*/ 

#include <csl_uart.h>

/** ============================================================================
 *   @n@b CSL_uartOpen
 *
 *   @b Description
 *   @n This function returns the handle to the Universal asynchronous receiver 
        transmitter controllerinstance. This handle is passed to all other CSL 
        APIs.
 *
 *   @b Arguments
 *   @verbatim
            uartObj          Pointer to Universal asynchronous receiver 
                             transmitter object.
 
            uartNum          Instance of Universal asynchronous receiver 
                             transmitter CSL to be opened. There is only one 
                             instance of the Universal asynchronous receiver 
                             transmitter available. So, the value for this 
                             parameter will be CSL_UART always.
 
            pUartParam       Module specific parameters.
 
            status          Status of the function call
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_UartHandle
 *   @n                         Valid Universal asynchronous receiver 
                                transmitter handle will be returned if
 *                              status value is equal to CSL_SOK.
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n   1.    The status is returned in the status variable. If status
 *              returned is
 *   @li            CSL_SOK             Valid uart handle is returned
 *   @li            CSL_ESYS_FAIL       The uart instance is invalid
 *
 *        2.    UART object structure is populated
 *
 *   @b Modifies
 *   @n    1. The status variable
 *
 *         2. Universal asynchronous receiver transmitter object structure
 *
 *   @b Example
 *   @verbatim
            CSL_status              status;
            CSL_UartObj              UartObj;
            CSL_UartHandle           hUart;

            ...
                
            hUart = CSL_uartOpen (&uartObj, CSL_UART, NULL, &status);
            
            ...
    @endverbatim
 * =============================================================================
 */
#pragma CODE_SECTION (CSL_uartOpen, ".text:csl_section:uart");
CSL_UartHandle  CSL_uartOpen (
    CSL_UartObj       *pUartObj,   
    CSL_InstNum       uartNum,     
    CSL_UartParam     *pUartParam, 
    CSL_Status        *pStatus
)
{    
    CSL_Status             status;
    CSL_UartHandle         hUart;
    CSL_UartBaseAddress    baseAddress;

    status = CSL_uartGetBaseAddress(uartNum, pUartParam, &baseAddress);

    if (status == CSL_SOK) {
        pUartObj->regs = baseAddress.regs;
        pUartObj->perNum = (CSL_InstNum)uartNum;
        hUart = (CSL_UartHandle)pUartObj;
    } 
    else {
        pUartObj->regs = (CSL_UartRegsOvly)NULL;
        pUartObj->perNum = (CSL_InstNum)-1;
        hUart = (CSL_UartHandle)NULL;
    }

    if (pStatus) {
        *pStatus = status;
    }
    
    return hUart;
}

⌨️ 快捷键说明

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