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

📄 csl_gpiohwsetupraw.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_gpioHwSetupRaw.c
 *
 *  \brief    File for functional layer of CSL API \a CSL_gpioHwSetupRaw()
 *
 *  Description
 *    - The \a CSL_gpioHwSetupRaw() function definition & it's associated
 *      functions
 *
 *  Path: \\(CSLPATH)\\ipmodules\\gpio\\src
 *
 */
   
/* ============================================================================
 *  Revision History
 *  ===============
 *  07-Sep-2004 Nsr File Created.
 *
 * ============================================================================
 */

#include <csl_gpio.h>

/** ===========================================================================
 *   @n@b CSL_gpioHwSetupRaw
 *
 *   @b Description
 *   @n This function initializes the device registers with the register-values
 *      provided through the Config Data structure.
 *
 *   @b Arguments
 *   @verbatim
            hGpio        Handle to the Gpio instance

            config       Pointer to config structure
            
            index        Register bank number
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Configuration successful
 *   @li                    CSL_ESYS_BADHANDLE  - Invalid handle
 *   @li                    CSL_ESYS_INVPARAMS  - Configuration is not
 *                                                properly initialized
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  The registers of the specified GPIO instance will be setup
 *       according to value passed.
 *
 *   @b Modifies
 *   @n Hardware registers of the specified GPIO instance.
 *
 *   @b Example
 *   @verbatim
        CSL_GpioHandle       hGpio;
        CSL_GpioConfig       config = CSL_GPIO_CONFIG_DEFAULTS;
        CSL_Status          status;

        status = CSL_gpioHwSetupRaw (hGpio, &config,index);

     @endverbatim
 * ===========================================================================
 */ 
#pragma CODE_SECTION (CSL_gpioHwSetupRaw, ".text:csl_section:gpio");
CSL_Status  CSL_gpioHwSetupRaw (
    /** Pointer to the object that holds reference to the
     *  instance of GPIO requested after the call
     */
    CSL_GpioHandle     hGpio,
    CSL_GpioCfg       *config,
    Uint16             index
)
{
    if (hGpio == NULL)
        return CSL_ESYS_BADHANDLE;

    if (config == NULL )
        return CSL_ESYS_INVPARAMS;

    hGpio->regs->BINTEN                   = config->BINTEN;   
    hGpio->regs->BANK[index].DIR          &= ~(config->BANK[index].DIR);   
    hGpio->regs->BANK[index].OUT_DATA     = config->BANK[index].OUT_DATA;   
    hGpio->regs->BANK[index].SET_DATA     = config->BANK[index].SET_DATA;   
    hGpio->regs->BANK[index].CLR_DATA     = config->BANK[index].CLR_DATA;   
    hGpio->regs->BANK[index].SET_RIS_TRIG = config->BANK[index].SET_RIS_TRIG;   
    hGpio->regs->BANK[index].CLR_RIS_TRIG = config->BANK[index].CLR_RIS_TRIG;   
    hGpio->regs->BANK[index].SET_FAL_TRIG = config->BANK[index].SET_FAL_TRIG;   
    hGpio->regs->BANK[index].CLR_FAL_TRIG = config->BANK[index].CLR_FAL_TRIG;   
    hGpio->regs->BANK[index].INTSTAT      = config->BANK[index].INTSTAT; 
        
    return CSL_SOK;
}

⌨️ 快捷键说明

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