📄 csl_pmxhwsetup.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_pmxHwSetup.c
*
* @brief File for functional layer of CSL API @a CSL_pmxHwSetup()
*
* Path: \\(CSLPATH)\\ipmodules\\pmx\\src
*
* Description
* - The @a CSL_pmxHwSetup() function definition & it's associated
* functions
*
*/
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/* =============================================================================
* Revision History
* ===============
*
* 18-dec-2004 BRN File Created
*
* =============================================================================
*/
#include <csl_pmx.h>
/** ============================================================================
* @n@b CSL_pmxHwSetup
*
* @b Description
* This function initializes the device registers with the appropriate values
* provided through the HwSetup Data structure. This function needs to be
* called only if the HwSetup Structure was not previously passed through the
* Open call. After the Setup is completed, the device is ready for operation.
* For information passed through the HwSetup Data structure refer
* @a CSL_pmxHwSetup.
*
* @verbatim
hPmx Handle to the PMXS instance
setup Pointer to hardware setup structure
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Hardware setup successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Hardware structure is not
* properly initialized
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The specified instance will be setup according to value passed
*
* @b Modifies
* @n Hardware registers for the specified instance
*
* <b> Usage Constraints: </b>
* Both @a CSL_pmxInit() and @a CSL_pmxOpen() must be called successfully in
* that order before this function can be called. The user has to allocate
* space for & fill in the main setup structure appropriately before calling
* this function.
*
* @b Example:
* @verbatim
CSL_pmxHandle hPmx;
CSL_pmxHwSetup hwSetup = CSL_PMX_HWSETUP_DEFAULTS;
CSL_pmxHwSetup(hPmx, &hwSetup);
@endverbatim
*
* ============================================================================
*/
/** @brief Configures the PMX using the values passed in through the
* setup structure.
*/
#pragma CODE_SECTION (CSL_pmxHwSetup, ".text:csl_section:pmx");
CSL_Status CSL_pmxHwSetup(
/** Pointer to the object that holds reference to the
* instance of PMX requested after the call
*/
CSL_PmxHandle hPmx,
/** Pointer to setup structure which contains the
* information to program PMX to a useful state
*/
CSL_PmxHwSetup *setup
)
{
CSL_Status status = CSL_SOK;
if (hPmx == NULL)
return CSL_ESYS_BADHANDLE;
if (setup == NULL)
return CSL_ESYS_INVPARAMS;
/* Setup for the PINMUX0 structure values of PMX module*/
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_EMACEN, setup->pinMux0Setup.emacEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_1394EN, setup->pinMux0Setup.En1394 );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_HPIEN, setup->pinMux0Setup.hpiEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_CFLDEN, setup->pinMux0Setup.cfldEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_CWEN, setup->pinMux0Setup.cwEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_LFLDEN, setup->pinMux0Setup.lfldEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_LOEEN, setup->pinMux0Setup.loeEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_RGB888, setup->pinMux0Setup.rgb888 );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_ATAEN, setup->pinMux0Setup.ataEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_HDIREN, setup->pinMux0Setup.hdirEn );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_VLYNQEN, setup->pinMux0Setup.vlynqEn);
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_VLSCREN, setup->pinMux0Setup.vlscrEn);
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_VLYNQWD, setup->pinMux0Setup.vlynqWd);
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_AECS5, setup->pinMux0Setup.aeCs5 );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_AECS4, setup->pinMux0Setup.aeCs4 );
CSL_FINS(hPmx->regs->PinMux0, PMX_PINMUX0_AEAW, setup->pinMux0Setup.aeAw );
/* Setup for the PINMUX1 structure values of PMX module */
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_TIMIN, setup->pinMux1Setup.timin);
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_CLK1, setup->pinMux1Setup.clk1 );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_CLK0, setup->pinMux1Setup.clk0 );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_MCBSP, setup->pinMux1Setup.mcbsp);
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_MSTK, setup->pinMux1Setup.mstk );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_SPI, setup->pinMux1Setup.spi );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_I2C, setup->pinMux1Setup.i2c );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_PWM2, setup->pinMux1Setup.pwm2 );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_PWM1, setup->pinMux1Setup.pwm1 );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_PWM0, setup->pinMux1Setup.pwm0 );
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_U2FLO, setup->pinMux1Setup.u2Flo);
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_UART2, setup->pinMux1Setup.uart2);
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_UART1, setup->pinMux1Setup.uart1);
CSL_FINS(hPmx->regs->PinMux1, PMX_PINMUX1_UART0, setup->pinMux1Setup.uart0);
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -