📄 csl_gpioaux.h
字号:
}
else {
status = CSL_EGPIO_INVPARAM;
}
return status;
}
/** ===========================================================================
* @n@b CSL_gpioGetIntStatus
*
* @b Description
* @n This function used to get the interrupt status of the bank.
*
* @b Arguments
* @verbatim
hGpio Handle to GPIO instance
bankData Pointer to the CSL_GpioBankData structure.
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_gpioGetIntStatus (hGpio,&bankData);
@endverbatim
* ============================================================================
*/
static inline
CSL_Status CSL_gpioGetIntStatus (
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioHandle hGpio,
CSL_GpioBankData *bankData
)
{
CSL_Status status = CSL_SOK;
Uint32 index;
CSL_GpioRegsOvly gpioRegs = hGpio->regs;
index = bankData->index;
if (index <= (hGpio->numBanks >> 1)) {
bankData->data = gpioRegs->BANK[index].INTSTAT;
}
else {
status = CSL_EGPIO_INVPARAM;
}
return status;
}
/** ===========================================================================
* @n@b CSL_gpioGetInputBit
*
* @b Description
* @n This function gets the IN_DATA register value of the GPIO bank.
*
* @b Arguments
* @verbatim
hGpio Handle to GPIO instance
bankData Pointer to the CSL_GpioBankData structure.
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_gpioGetInputBit (hGpio,&bankData);
@endverbatim
* ============================================================================
*/
static inline
CSL_Status CSL_gpioGetInputBit (
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioHandle hGpio,
CSL_GpioBankData *bankData
)
{
CSL_Status status = CSL_SOK;
Uint32 index;
CSL_GpioRegsOvly gpioRegs = hGpio->regs;
index = bankData->index;
if (index <= (hGpio->numBanks >> 1)) {
bankData->data = gpioRegs->BANK[index].IN_DATA;
}
else {
status = CSL_EGPIO_INVPARAM;
}
return status;
}
/** ===========================================================================
* @n@b CSL_gpioGetBit
*
* @b Description
* @n This function gets the Pin number status of GPIO module.
* @b Arguments
* @verbatim
hGpio Handle to GPIO instance
pinNum pin number to get the status.
@endverbatim
*
* <b> Return Value </b>
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_gpioGetBit(hGpio,pinNum);
@endverbatim
* ===========================================================================
*/
static inline
Int16 CSL_gpioGetBit (
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioHandle hGpio,
/** pin number to get the status. */
CSL_GpioPinNum pinNum
)
{
Uint32 index;
Int16 pinVal;
CSL_GpioRegsOvly gpioRegs = hGpio->regs;
if (pinNum < hGpio->numPins) {
index = (pinNum >> 5);
pinNum = (CSL_GpioPinNum)(pinNum & 0x1f);
pinVal = CSL_FEXTR(gpioRegs->BANK[index].IN_DATA, pinNum, pinNum);
}
else {
pinVal = CSL_ESYS_FAIL;
}
return pinVal;
}
/** ===========================================================================
* @n@b CSL_gpioGetOutDrvState
*
* @b Description
* @n This function gets the OUT_DATA value of the GPIO bank.
*
* @b Arguments
* @verbatim
hGpio Handle to GPIO instance
bankData Pointer to the CSL_GpioBankData structure.
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_gpioGetOutDrvState (hGpio,&bankData);
@endverbatim
* ===========================================================================
*/
static inline
CSL_Status CSL_gpioGetOutDrvState (
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioHandle hGpio,
CSL_GpioBankData *bankData
)
{
CSL_Status status = CSL_SOK;
Uint32 index;
CSL_GpioRegsOvly gpioRegs = hGpio->regs;
index = bankData->index;
if (index <= (hGpio->numBanks >> 1)) {
bankData->data = gpioRegs->BANK[index].OUT_DATA;
}
else {
status = CSL_EGPIO_INVPARAM;
}
return status;
}
/** ===========================================================================
* @n@b CSL_gpioGetPid
*
* @b Description
* @n This function gets the Peripheral ID.
*
* @b Arguments
* @verbatim
hGpio Handle to GPIO instance
response Placeholder to return status.
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_gpioGetPid (hGpio, &response);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_gpioGetPid (
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioHandle hGpio,
/** Placeholder to return the status. @a void* casted */
void *response
)
{
*(Uint32*)response = hGpio->regs->PID;
}
/** ===========================================================================
* @n@b CSL_gpioGetBintenStat
*
* @b Description
* @n This function gets the interrupt capabilities of all banks in GPIO
* module.
* @b Arguments
* @verbatim
hGpio Handle to GPIO instance
response Placeholder to return status.
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_gpioGetBintenStat (hGpio,&response);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_gpioGetBintenStat (
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioHandle hGpio,
/** Placeholder to return the status. @a void* casted */
void *response
)
{
*(CSL_BitMask32*)response = hGpio->regs->BINTEN;
}
#ifdef __cplusplus
extern "C" {
#endif
#endif /* CSL_GPIOAUX_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -