📄 csl_gpio.h
字号:
instance of GPIO referred to by this object*/
CSL_InstNum gpioNum; /**< This is the instance of GPIO being referred to
by this object */
Uint32 numPins; /**< This is the maximum number of pins supported by this
instance of GPIO */
Uint32 numBanks;/**< This is the maximum number of banks supported by this
instance of GPIO */
} CSL_GpioObj;
/** \brief this is a pointer to @a CSL_GpioObj and is passed as the first
* parameter to all GPIO CSL APIs */
typedef CSL_GpioObj *CSL_GpioHandle;
/**
@} */
/*****************************************************************************\
CSL3.x mandatory function prototype definitions
\*****************************************************************************/
/** ===========================================================================
* @n@b CSL_gpioInit
*
* @b Description
* @n This is the initialization function for the GPIO. This function is
* idempotent in that calling it many times is same as calling it once.
* This function initializes the CSL data structures, and doesn't affect
* the H/W.
*
* @b Arguments
* @verbatim
* pContext Context information for the instance. Should be NULL
* @endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Always returns
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
* ...
* if (CSL_sysInit() == CSL_SOK) {
* CSL_gpioInit();
* }
* @endverbatim
* ===========================================================================
*/
CSL_Status CSL_gpioInit(
CSL_GpioContext * pContext
);
/** ============================================================================
* @n@b CSL_gpioOpen
*
* @b Description
* @n This function populates the peripheral dgpio object for the GPIO instance
* and returns a handle to the instance.
* The open call sets up the dgpio structures for the particular instance
* of GPIO device. The device can be re-opened anytime after it has been
* normally closed if so required. The handle returned by this call is
* input as an essential argument for rest of the APIs described
* for this module.
*
* @b Arguments
* @verbatim
pGpioObj Pointer to the GPIO instance object
gpioNum Instance of the GPIO to be opened
pGpioParam Pointer to module specific parameters
pStatus pointer for returning status of the function call
@endverbatim
*
* <b> Return Value </b> CSL_GpioHandle
* @n Valid GPIO instance handle will be returned if
status value is equal to CSL_SOK.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n 1. GPIO object structure is populated
* @n 2. The status is returned in the status variable. If status
* returned is
* @li CSL_SOK Valid gpio handle is returned
* @li CSL_ESYS_FAIL The gpio instance is invalid
* @li CSL_ESYS_INVPARAMS Invalid parameter
*
* @b Modifies
* @n 1. The status variable
* @n 2. GPIO object structure
*
* @b Example
* @verbatim
CSL_status status;
CSL_GpioObj gpioObj;
CSL_GpioHandle hGpio;
...
hGpio = CSL_gpioOpen (&gpioObj, CSL_GPIO_PER_CNT, NULL, &status);
...
@endverbatim
* ============================================================================
*/
CSL_GpioHandle CSL_gpioOpen (
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioObj *hGpioObj,
/** Instance of GPIO to which a handle is requested
*/
CSL_InstNum gpioNum,
/** Specifies if GPIO should be opened with exclusive or
* shared access to the associate pins
*/
CSL_GpioParam *pGpioParam,
/** This returns the status (success/errors) of the call
*/
CSL_Status *status
);
/** ===========================================================================
* @n@b CSL_gpioClose
*
* @b Description
* @n This function closes the specified instance of GPIO.
*
* @b Arguments
* @verbatim
hGpio Handle to the GPIO instance
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Close successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
*
* @b Example
* @verbatim
CSL_GpioHandle hGpio;
CSL_status status;
...
status = CSL_gpioClose(hGpio);
@endverbatim
* ============================================================================
*/
CSL_Status CSL_gpioClose(
/** Pointer to the object that holds reference to the
* instance of GPIO requested after the call
*/
CSL_GpioHandle hGpio
);
/** ===========================================================================
* @n@b CSL_gpioHwSetup
*
* @b Description
* @n It configures the gpio registers as per the values passed
* in the hardware setup structure.
*
* @b Arguments
* @verbatim
hGpio Handle to the GPIO instance
hwSetup Pointer to harware 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 Modifies
* @n The hardware registers of GPIO.
*
* @b Example
* @verbatim
CSL_GpioHandle hGpio;
CSL_GpioObj gpioObj;
CSL_GpioHwSetup hwSetup;
CSL_status status;
...
hGpio = CSL_gpioOpen (&gpioObj, CSL_GPIO_PRIMARY, NULL, &status);
status = CSL_gpioHwSetup(hGpio, &hwSetup);
* @endverbatim
* ============================================================================
*/
CSL_Status CSL_gpioHwSetup (
CSL_GpioHandle hGpio,
CSL_GpioHwSetup *setup
);
/** ===========================================================================
* @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
* ===========================================================================
*/
CSL_Status CSL_gpioHwSetupRaw (
CSL_GpioHandle hGpio,
CSL_GpioCfg *config,
Uint16 index
);
/** ============================================================================
* @n@b CSL_gpioGetHwSetup
*
* @b Description
* @n Gets the current setup of GPIO.
*
* @b Arguments
* @verbatim
hGpio Handle to the GPIO instance
setup Pointer to setup structure which contains the
setup information of GPIO.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Setup info load successful.
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The registers of the specified GPIO instance will be setup.
*
* @b Modifies
* @n Hardware registers of the specified GPIO instance.
*
* @b Example
* @verbatim
CSL_GpioHandle hGpio;
CSL_GpioHwSetup setup;
CSL_Status status;
status = CSL_gpioGetHwSetup (hGpio, &setup);
@endverbatim
* ============================================================================
*/
CSL_Status CSL_gpioGetHwSetup (
CSL_GpioHandle hGpio,
CSL_GpioHwSetup *setup
);
/** ===========================================================================
* @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
* ============================================================================
*/
CSL_Status CSL_gpioHwControl (
CSL_GpioHandle hGpio,
CSL_GpioHwControlCmd cmd,
void* arg
);
/** ===========================================================================
* @n@b CSL_gpioGetHwStatus
*
* @b Description
* @n Gets the status of the different operations of GPIO.
*
* @b Arguments
* @verbatim
hGpio Handle to the GPIO instance
query The query to this API of GPIO which indicates the
status to be returned.
response Placeholder to return the status.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Status info return successful.
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_GpioHandle hGpio;
CSL_GpioHwStatusQuery query;
void reponse;
status = CSL_gpioGetHwStatus (hGpio, query, &response);
@endverbatim
* ============================================================================
*/
CSL_Status CSL_gpioGetHwStatus(
CSL_GpioHandle hGpio,
CSL_GpioHwStatusQuery query,
void* response
);
/** ===========================================================================
* @n@b CSL_gpioGetBaseAddress
*
* @b Description
* @n Function to get the base address of the peripheral instance.
* This function is used for getting the base address of the peripheral
* instance. This function will be called inside the CSL_gpioOpen()
* function call. This function is open for re-implementing if the user
* wants to modify the base address of the peripheral object to point to
* a different location and there by allow CSL initiated write/reads into
* peripheral MMR's go to an alternate location.
*
* @b Arguments
* @verbatim
gpioNum Specifies the instance of GPIO to be opened.
pGpioParam Module specific parameters.
pBaseAddress Pointer to baseaddress structure containing base
address details.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_OK Open call is successful
* @li CSL_ESYS_FAIL The instance number is invalid.
*
* <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_GpioBaseAddress baseAddress;
...
status = CSL_gpioGetBaseAddress(CSL_GPIO_PER_CNT, NULL, &baseAddress);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_gpioGetBaseAddress (
CSL_InstNum gpioNum,
CSL_GpioParam * pGpioParam,
CSL_GpioBaseAddress * pBaseAddress
);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -