📄 csl_gpiohwcontrol.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_gpioHwControl.c
*
* \brief File for functional layer of CSL API \a CSL_gpioHwControl()
*
* Description
* - The \a CSL_gpioHwControl() function definition & it's associated
* functions
*
* Path: \\(CSLPATH)\\ipmodules\\gpio\\src
*
* \date 10 June, 2004
* \author Pratheesh Gangadhar
*/
/* ============================================================================
* Revision History
* ===============
* 22-Feb-2005 Nsr Added conrol command CSL_GPIO_CMD_GET_BIT according to
* TI Issue PSG00000310.
* 04-Sep-2004 Nsr Updated the source csl_gpioHwControl.c for the new CSL
* format.
*
* ============================================================================
*/
#include <csl_gpio.h>
#include <csl_gpioAux.h>
/** ===========================================================================
* @n@b CSL_gpioHwControl
*
* @b Description
* @n Takes a command of GPIO with an optional argument & implements it.
*
* @b Arguments
* @verbatim
hGpio Handle to the GPIO instance
cmd The command to this API indicates the action to be
taken on GPIO.
arg An optional argument.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Status info return successful.
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVCMD - Invalid command
* @li CSL_ESYS_FAIL - Invalid instance number
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n The hardware registers of GPIO.
*
* @b Example
* @verbatim
CSL_GpioHandle hGpio;
CSL_GpioHwControlCmd cmd;
void arg;
status = CSL_gpioHwControl (hGpio, cmd, &arg);
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (CSL_gpioHwControl, ".text:csl_section:gpio");
CSL_Status CSL_gpioHwControl(
CSL_GpioHandle hGpio,
CSL_GpioHwControlCmd cmd,
void *arg
)
{
CSL_Status status = CSL_SOK;
Int16 pinVal;
pinVal = pinVal; /* Make compiler happy! */
if (hGpio == NULL)
return CSL_ESYS_BADHANDLE;
switch (cmd) {
case CSL_GPIO_CMD_BANK_INT_ENABLE:
status = CSL_gpioBankIntEnable (hGpio, *((CSL_GpioBankNum*) arg));
break;
case CSL_GPIO_CMD_BANK_INT_DISABLE:
status = CSL_gpioBankIntDisable (hGpio,*((CSL_GpioBankNum*) arg));
break;
case CSL_GPIO_CMD_CONFIG_BIT:
status = CSL_gpioConfigBit (hGpio,(CSL_GpioConfig*) arg);
break;
case CSL_GPIO_CMD_SET_BIT:
status = CSL_gpioSetBit (hGpio,*((CSL_GpioPinNum*) arg));
break;
case CSL_GPIO_CMD_CLEAR_BIT:
status = CSL_gpioClearBit (hGpio,*((CSL_GpioPinNum*) arg));
break;
case CSL_GPIO_CMD_GET_INTSTATUS:
status = CSL_gpioGetIntStatus (hGpio,(CSL_GpioBankData*) arg);
break;
case CSL_GPIO_CMD_GET_INPUTBIT:
status = CSL_gpioGetInputBit (hGpio,(CSL_GpioBankData*) arg);
break;
case CSL_GPIO_CMD_GET_OUTDRVSTATE:
status = CSL_gpioGetOutDrvState (hGpio,(CSL_GpioBankData*) arg);
break;
case CSL_GPIO_CMD_GET_BIT:
pinVal = CSL_gpioGetBit (hGpio,*((CSL_GpioPinNum*) arg));
break;
default:
status = CSL_ESYS_INVCMD;
break;
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -