📄 csl_i2c.h
字号:
* <b> Usage Constraints: </b> * This function should be called before using any of the CSL APIs in the I2C * module. * * Note: As I2C doesn't have any context based information, currently, the function * just returns CSL_SOK. User is expected to pass NULL in the function call. * * @b Example: * @verbatim ... if (CSL_SOK != CSL_i2cInit(NULL)) { return; } @endverbatim * * @return returns the status of the operation * */CSL_Status CSL_i2cInit( /** I2C specific context information */ CSL_I2cContext * pContext );/** @brief Opens the instance of I2C requested. * * The open call sets up the data structures for the particular instance of * I2C 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> Usage Constraints: </b> * I2C must be successfully initialized via @a CSL_i2cInit() before calling * this function. Memory for the @a CSL_i2cObj must be allocated outside * this call. This object must be retained while usage of this peripheral. * * @b Example: * @verbatim CSL_I2cObj i2cObj; CSL_Status status; ... hI2c = CSL_i2cOpen(&i2cObj, CSL_I2C_1, NULL, &status); @endverbatim * * @return returns a handle @a CSL_I2cHandle to the requested instance of * I2C if the call is successful, otherwise, a @a NULL is returned. * */CSL_I2cHandle CSL_i2cOpen ( /** Pointer to the object that holds reference to the * instance of I2C requested after the call */ CSL_I2cObj* pI2cObj, /** Instance of I2C to which a handle is requested */ CSL_InstNum i2cNum, /** Module specific parameters; * Currently there are none; the user should pass 'NULL' */ CSL_I2cParam *pI2cParam, /** This returns the status (success/errors) of the call. * Could be 'NULL' if the user does not want status information. */ CSL_Status *pStatus );/** The Close call releases the resource and appropriate shared pins. * * <b> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully * in that order before @a CSL_i2cClose() can be called. * * @b Example: * @verbatim CSL_I2cHandle hI2c; ... CSL_i2cClose(hI2c); @endverbatim * * @return returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cClose( /** Pointer to the object that holds reference to the * instance of I2C requested after the call */ CSL_I2cHandle hI2c);/** 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 serial device is ready for data transfer. * For information passed through the HwSetup Data structure refer * @a CSL_I2cHwSetup. * * <b> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() 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_I2cHandle hI2c; CSL_I2cHwSetup hwSetup = CSL_I2C_HWSETUP_DEFAULTS; CSL_i2cHwSetup(hI2c, &hwSetup); @endverbatim * * @return Returns the status of the setup operation * */CSL_Status CSL_i2cHwSetup( /** Pointer to the object that holds reference to the * instance of I2C requested after the call */ CSL_I2cHandle hI2c, /** Pointer to setup structure which contains the * information to program I2C to a useful state */ CSL_I2cHwSetup *setup );/** This function gets the current setup of the I2C. The status is * returned through @a CSL_I2cHwSetup. The obtaining of status * is the reverse operation of @a CSL_i2cHwSetup() function. * * <b> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully * in that order before @a CSL_i2cGetHwSetup() can be called. * * @b Example: * @verbatim CSL_I2cHandle hI2c; CSL_Status status; CSL_I2cHwSetup *mysetup; ... status = CSL_i2cGetHwSetup(hI2c, &mysetup); @endverbatim * * @return returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cGetHwSetup( /** Pointer to the object that holds reference to the * instance of I2C requested after the call */ CSL_I2cHandle hI2c, /** Pointer to setup structure which contains the * information to program I2C to a useful state */ CSL_I2cHwSetup *setup);/** This function initializes the device registers with the register-values * provided through the Config Data structure. For information passed through * the Config Data structure refer to @a CSL_I2cConfig. * * <b> Usage Constraints: </b> * The user has to allocate space for & fill in the main setup structure * appropriately before calling this function. * * @b Example: * @verbatim CSL_I2cHandle hI2c; CSL_I2cConfig config; config.IE = 0x003F; ... config.CON = 0x8600; config.OA = 0x002F; config.SA = 0x0010; ... CSL_i2cHwSetupRaw(hI2c, &config); @endverbatim * * @return Returns the status of the setup operation * */ CSL_Status CSL_i2cHwSetupRaw( CSL_I2cHandle hTimer, CSL_I2cConfig * setup);/** Control operations for the I2C. For a particular control operation, the * pointer to the corresponding data type needs to be passed as argument HwControl * function Call. All the arguments (Structure elements 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> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully * in that order before @a CSL_i2cHwControl() can be called. For the * argument type that can be @a void* casted & passed with a particular command * refer to @a CSL_I2cHwControlCmd * * @b Example: * @verbatim CSL_I2cHandle hI2c; CSL_Status status; ... status = CSL_i2cHwControl(hI2c, CSL_I2C_CMD_START, &command); @endverbatim * * @return returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cHwControl( /** Pointer to the object that holds reference to the * instance of I2C requested after the call */ CSL_I2cHandle hI2c, /** The command to this API indicates the action to be taken */ CSL_I2cHwControlCmd cmd, /** An optional argument @a void* casted */ void *arg );/** Reads the received data from the data register. * * <b> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully * in that order before @a CSL_i2cRead() can be called. * * @b Example: * @verbatim * Uint16 *data_pro; CSL_I2cHandle hI2c; CSL_Status status; ... status = CSL_i2cRead(hI2c,&data_pro ); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cRead( /** Handle of already opened peripheral */ CSL_I2cHandle hI2c, /** Pointer to memory where data will be read and stored */ void* buf);/** This function writes the specified data into I2C data register.. * * <b> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully * in that order before @a CSL_i2cWrite() can be called. * * @b Example: * @verbatim CSL_I2cHandle hI2c; ... status = CSL_i2cWrite(hI2c,&data_out ); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cWrite( /** Handle of already opened peripheral */ CSL_I2cHandle hI2c, /** Pointer to data to be written */ void* buf) ;/** 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 structure to 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> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully * in that order before @a CSL_i2cGetHwStatus() can be called. For the * argument type that can be @a void* casted & passed with a particular command * refer to @a CSL_I2cHwStatusQuery * * @b Example: * @verbatim CSL_I2cHandle hI2c; CSL_Status status; Uint16 *response; ... status = CSL_i2cGetHwStatus(hI2c, CSL_I2C_QUERY_BUS_BUSY, &response); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cGetHwStatus( /** Pointer to the object that holds reference to the * instance of I2C requested after the call */ CSL_I2cHandle hI2c, /** The query to this API which indicates the status * to be returned */ CSL_I2cHwStatusQuery query, /** Placeholder to return the status. @a void* casted */ void *response );/** This function is used for the testing of the I2C module. * For details about the various test commands supported refer * @a CSL_I2cTestCmd * * <b> Usage Constraints: </b> * Both @a CSL_i2cInit() and @a CSL_i2cOpen() must be called successfully * in that order before @a CSL_i2cTest() can be called. * * @b Example: * @verbatim CSL_I2cHandle hI2c; CSL_Status status; ... status = CSL_i2cTest(hI2c,CSL_I2C_TMODE_CLK ); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cTest ( /** Handle of already opened peripheral */ CSL_I2cHandle hI2c, /** Test command */ CSL_I2cTestCmd command);/** @brief 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. * * Note: 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. Please refer the documentation for * more details. * * @b Example: * @verbatim CSL_Status status; CSL_I2cBaseAddress baseAddress; ... status = CSL_i2cGetBaseAddress(CSL_I2C_1, NULL, &baseAddress); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_i2cGetBaseAddress( /** Instance number */ CSL_InstNum i2cNum, /** Module specific parameters */ CSL_I2cParam * pI2cParam, /** Base address details */ CSL_I2cBaseAddress * pBaseAddress);#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -