📄 csl_i2c.h
字号:
* @verbatim
hI2c Handle to the I2C
hwSetup Pointer to the hardware setup structure
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Retrieving the hardware setup
* parameters is successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully
* in that order before @a CSL_i2cGetHwSetup() can be called.
*
* <b> Post Condition </b>
* @n The hardware setup structure is populated with the hardware setup
* parameters
*
* @b Modifies
* @n hwSetup variable
*
* @b Example
* @verbatim
CSL_I2cHandle hI2c;
CSL_I2cHwSetup hwSetup;
...
status = CSL_i2cGetHwSetup(hI2c, &hwSetup);
...
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_i2cGetHwSetup (
CSL_I2cHandle hI2c,
CSL_I2cHwSetup *setup
);
/** ============================================================================
* @n@b CSL_i2cHwControl
*
* @b Description
* @n Control operations for the I2C. For a particular control operation,
* the pointer to the corresponding data type need to be passed as argument
* to HwControl function Call.All the arguments(Structure element included)
* passed to the HwControl function are inputs. For the list of commands
* supported and argument type that can be @a void* casted & passed with a
* particular command refer to @a CSL_I2cHwControlCmd.
* @b Arguments
* @verbatim
hI2c Handle to the I2C instance
cmd The command to this API indicates the action to be
taken on I2C.
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_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully
* in that order before @a CSL_i2cHwControl() can be called.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n The hardware registers of I2C.
*
* @b Example
* @verbatim
CSL_I2cHandle hI2c;
CSL_I2cHwControlCmd cmd = CSL_I2C_CMD_RESET;
void arg;
CSL_Status status;
...
status = CSL_i2cHwControl (hI2c, cmd, &arg);
...
@endverbatim
* =============================================================================
*/
CSL_Status CSL_i2cHwControl (
CSL_I2cHandle hI2c,
CSL_I2cHwControlCmd cmd,
void *arg
);
/** ============================================================================
* @n@b CSL_i2cRead
*
* @b Description
* @n This function reads I2C data.
*
* @b Arguments
* @verbatim
hI2c Handle to I2C instance
buf Buffer to store the data read
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Operation Successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully
* in that order before @a CSL_i2cRead() can be called.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example:
* @verbatim
Uint16 outData;
CSL_Status status;
CSL_I2cHandle hI2c;
...
// I2C object defined and HwSetup structure defined and initialized
...
// Init, Open, HwSetup successfully done in that order
...
status = CSL_i2cRead(hI2c, &outData);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_i2cRead (
CSL_I2cHandle hI2c,
void *buf
);
/** ============================================================================
* @n@b CSL_i2cWrite
*
* @b Description
* @n This function writes the specified data into I2C data register.
*
* @b Arguments
* @verbatim
hI2c Handle to I2C instance
buf data to be written
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Success (doesnot verify
written data)
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully
* in that order before @a CSL_i2cWrite() can be called.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example:
* @verbatim
Uint16 inData;
CSL_Status status;
CSL_I2cHandle hI2c;
...
// I2C object defined and HwSetup structure defined and initialized
...
// Init, Open, HwSetup successfully done in that order
...
status = CSL_i2cWrite(hi2c, &inData);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_i2cWrite (
CSL_I2cHandle hI2c,
void *buf
);
/** ============================================================================
* @n@b CSL_i2cHwSetupRaw
*
* @b Description
* @n This function initializes the device registers with the register-values
* provided through the Config Data structure.
*
* @b Arguments
* @verbatim
hI2c Handle to the I2C
config Pointer to config structure
@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
*
* @n Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully
* in that order before @a CSL_i2cHwSetupRaw() can be called.
*
* <b> Post Condition </b>
* @n The registers of the specified I2C instance will be setup
* according to value passed.
*
* @b Modifies
* @n Hardware registers of the specified I2C instance.
*
* @b Example
* @verbatim
CSL_I2cHandle hI2c;
CSL_I2cConfig config = CSL_I2C_CONFIG_DEFAULTS;
CSL_Status status;
...
status = CSL_i2cHwSetupRaw(hI2c, &config);
...
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_i2cHwSetupRaw (
CSL_I2cHandle hI2c,
CSL_I2cConfig *config
);
/** ============================================================================
* @n@b CSL_i2cGetHwStatus
*
* @b Description
* @n This function is used to read the current device configuration, status
* flags and the value present associated registers.Following table details
* the various status queries supported and the associated data structureto
* record the response. User should allocate memory for the said data type
* and pass its pointer as an unadorned void* argument to the status query
* call.For details about the various status queries supported and the
* associated data structure to record the response,
* refer to @a CSL_I2cHwStatusQuery
*
* @b Arguments
* @verbatim
hI2c Handle to the I2C instance
query The query to this API of I2C 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_INVQUERY - Invalid query command
* @li CSL_ESYS_INVPARAMS - Invalid parameter
*
* <b> Pre Condition </b>
* @n Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully
* in that order before @a CSL_i2cGetHwStatus() can be called.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_I2cHandle hI2c;
CSL_I2cHwStatusQuery query;
void reponse;
status = CSL_i2cGetHwStatus(hI2c, query, &response);
@endverbatim
* =============================================================================
*/
CSL_Status CSL_i2cGetHwStatus (
CSL_I2cHandle hI2c,
CSL_I2cHwStatusQuery query,
void *response
);
/** ============================================================================
* @n@b CSL_i2cGetBaseAddress
*
* @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_i2cOpen()
* 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
i2cNum Specifies the instance of I2C to be opened.
pI2cParam 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_I2cBaseAddress baseAddress;
...
status = CSL_i2cGetBaseAddress(CSL_I2C, NULL, &baseAddress);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_i2cGetBaseAddress (
CSL_InstNum i2cNum,
CSL_I2cParam *pI2cParam,
CSL_I2cBaseAddress *pBaseAddress
);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -