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

📄 csl_uartgetbaseaddress.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_uartGetBaseAddress.c
 *
 *    @brief File for functional layer of CSL API @a CSL_uartGetBaseAddress()
 *
 *   Path: \\(CSLPATH)\\soc\\davinci\\arm9\\src
 *
 *  Description
 *    - The @a CSL_uartGetBaseAddress() function definition & it's associated functions
 *
 */
 
/* =============================================================================
 *  Revision History
 *  ===============
 *  08-Sep-2004 brn File Created.
 *  11-Oct_2004 brn File updated with the review comments
 * =============================================================================
 */

#include <soc.h>
#include <csl_uart.h>

/** ============================================================================
 *   @n@b CSL_uartGetBaseAddress
 *
 *   @b Description
 *   @n  This function gets the base address of the given Universal asynchronous
 *       receiver transmiter instance. 
 *
 *   @b Arguments
 *   @verbatim      
            uartNum         Specifies the instance of the Universal asynchronous
                            receiver transmiter to be opened.
 
            pUartParam      Universal asynchronous receiver transmitter module
                            specific parameters.
 
            pBaseAddress    Pointer to base address structure containing base 
                            address details.
            
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_OK            Open call is successful
 *   @li                    CSL_ESYS_FAIL     Universal asynchronous receiver 
                                              transmiter instance is not
 *                                            available.
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Base address structure is populated
 *
 *   @b Modifies
 *   @n    1. The status variable
 *
 *         2. Base address structure is modified.
 *
 *   @b Example
 *   @verbatim
        CSL_Status            status;
        CSL_UartBaseAddress    baseAddress;

        ...
        
        status = CSL_uartGetBaseAddress(CSL_UART, NULL, &baseAddress);
        
        ...
        
    @endverbatim
 * ===========================================================================
 */
#pragma CODE_SECTION (CSL_uartGetBaseAddress, ".text:csl_section:uart");
CSL_Status CSL_uartGetBaseAddress (
    CSL_InstNum             uartNum,
    CSL_UartParam           *pUartParam,
    CSL_UartBaseAddress     *pBaseAddress 
)
{
    CSL_Status status = CSL_SOK;
    *pUartParam   = *pUartParam;

	if (pBaseAddress == NULL)
        return CSL_ESYS_INVPARAMS;

    switch (uartNum) {
        case CSL_UART_1:
            pBaseAddress->regs = (CSL_UartRegsOvly)CSL_UART_1_REGS;
            break;
        
        case CSL_UART_2:
            pBaseAddress->regs = (CSL_UartRegsOvly)CSL_UART_2_REGS;
            break;
        
        case CSL_UART_3:
            pBaseAddress->regs = (CSL_UartRegsOvly)CSL_UART_3_REGS;
            break;

        default:
            pBaseAddress->regs = (CSL_UartRegsOvly)NULL;
            status = CSL_ESYS_FAIL;
            break;
    }

    return status;
}

⌨️ 快捷键说明

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