📄 csl_i2c.h
字号:
CSL_I2C_QUERY_ACS_RDY = 5,
/**
* @brief Get the Stop Condition Data bit information
* @param (Uint16*)
*/
CSL_I2C_QUERY_SCD = 6,
/**
* @brief Get the Address Zero (General Call) detection status
* @param (Uint16*)
*/
CSL_I2C_QUERY_AD0 = 7,
/**
* @brief Get the Receive overflow status information
* @param (Uint16*)
*/
CSL_I2C_QUERY_RSFULL = 8,
/**
* @brief Get the Transmit underflow status information
* @param (Uint16*)
*/
CSL_I2C_QUERY_XSMT = 9,
/**
* @brief Get the Address as Slave bit information
* @param (Uint16*)
*/
CSL_I2C_QUERY_AAS = 10,
/**
* @brief Get the Arbitration Lost status information
* @param (Uint16*)
*/
CSL_I2C_QUERY_AL = 11,
/**
* @brief Get the Reset Done status bit information
* @param (Uint16*)
*/
CSL_I2C_QUERY_RDONE = 12,
/**
* @brief Get no of bits of next byte to be received or transmitted
* @param (Uint16*)
*/
CSL_I2C_QUERY_BITCOUNT = 13,
/**
* @brief Get the interrupt code for the interrupt that occured
* @param (Uint16*)
*/
CSL_I2C_QUERY_INTCODE = 14,
/**
* @brief Get the slave direction
* @param (Uint16*)
*/
CSL_I2C_QUERY_SDIR = 15,
/**
* @brief Get the acknowledgement status
* @param (Uint16*)
*/
CSL_I2C_QUERY_NACKSNT = 16
} CSL_I2cHwStatusQuery;
/** @brief Enumeration for queries passed to @a CSL_i2cHwControl()
*
* This is used to select the commands to control the operations
* existing setup of I2C. The arguments to be passed with each
* enumeration if any are specified next to the enumeration.
*/
typedef enum {
/**
* @brief Enable the I2C
* @param (None)
*/
CSL_I2C_CMD_ENABLE = 1,
/**
* @brief Reset command to the I2C
* @param (None)
*/
CSL_I2C_CMD_RESET = 2,
/**
* @brief Bring the I2C out of reset
* @param (None)
*/
CSL_I2C_CMD_OUTOFRESET = 3,
/**
* @brief Clear the status bits. The argument next to the command
* specifies the status bit to be cleared. The status bit
* can be :
* CSL_I2C_CLEAR_AL,
* CSL_I2C_CLEAR_NACK,
* CSL_I2C_CLEAR_ARDY,
* CSL_I2C_CLEAR_RRDY,
* CSL_I2C_CLEAR_XRDY,
* CSL_I2C_CLEAR_GC
* @param (None)
*/
CSL_I2C_CMD_CLEAR_STATUS = 4,
/**
* @brief Set the address of the Slave device
* @param (Uint16 *)
*/
CSL_I2C_CMD_SET_SLAVE_ADDR = 5,
/**
* @brief Set the Data Count
* @param (Uint16 *)
*/
CSL_I2C_CMD_SET_DATA_COUNT = 6,
/**
* @brief Set the start condition
* @param (None)
*/
CSL_I2C_CMD_START = 7,
/**
* @brief Set the stop condition
* @param (None)
*/
CSL_I2C_CMD_STOP = 8,
/**
* @brief Set the transmission mode
* @param (None)
*/
CSL_I2C_CMD_DIR_TRANSMIT = 9,
/**
* @brief Set the receiver mode
* @param (None)
*/
CSL_I2C_CMD_DIR_RECEIVE = 10,
/**
* @brief Set the Repeat Mode
* @param (None)
*/
CSL_I2C_CMD_RM_ENABLE = 11,
/**
* @brief Disable the Repeat Mode
* @param (None)
*/
CSL_I2C_CMD_RM_DISABLE = 12,
/**
* @brief Set the loop back mode
* @param (None)
*/
CSL_I2C_CMD_DLB_ENABLE = 13,
/**
* @brief Disable the loop back mode
* @param (None)
*/
CSL_I2C_CMD_DLB_DISABLE = 14
} CSL_I2cHwControlCmd;
/**************************************************************************\
* I2C global function declarations
\**************************************************************************/
/** ============================================================================
* @n@b CSL_i2cInit
*
* @b Description
* @n This is the initialization function for the I2C. 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
CSL_Status status;
...
status = CSL_i2cInit();
...
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_i2cInit (
CSL_I2cContext *pContext
);
/** ============================================================================
* @n@b CSL_i2cOpen
*
* @b Description
* @n This function populates the peripheral data object for the instance
* and returns a handle to the instance.
* 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 Arguments
* @verbatim
pI2cObj Pointer to the I2C instance object
i2cNum Instance of the I2C to be opened.
pI2cParam Pointer to module specific parameters
pStatus pointer for returning status of the function call
@endverbatim
*
* <b> Return Value </b>
* CSL_I2cHandle
* Valid I2C instance handle will be returned if status value is
* equal to CSL_SOK.
*
* <b> Pre Condition </b>
* @n @a CSL_i2cInit() must be called successfully.
*
* <b> Post Condition </b>
* @n i2c instance will be opened
*
* @b Modifies
* @n None
*
* @b Example:
* @verbatim
CSL_status status;
CSL_I2cObj i2cObj;
CSL_I2cHandle hI2c;
...
hI2c = CSL_I2cOpen (&i2cObj,
CSL_I2C,
NULL,
&status
);
...
@endverbatim
*
* ===========================================================================
*/
CSL_I2cHandle CSL_i2cOpen (
CSL_I2cObj *hI2cObj,
CSL_InstNum i2cNum,
CSL_I2cParam *pI2cParam,
CSL_Status *status
);
/** ============================================================================
* @n@b CSL_i2cClose
*
* @b Description
* @n This function closes the specified instance of I2C.
*
* @b Arguments
* @verbatim
hI2c Handle to the I2C
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Close Successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
*
* <b> Pre Condition </b>
* @n The device should be successfully opened.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n I2C Handle
*
* @b Example
* @verbatim
CSL_I2cHandle hI2c;
...
status = CSL_i2cClose(hI2c);
...
@endverbatim
* ============================================================================
*/
CSL_Status CSL_i2cClose (
CSL_I2cHandle hI2c
);
/** ============================================================================
* @n@b CSL_i2cHwSetup
*
* @b Description
* @n 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 device is ready
* for operation.For information passed through the HwSetup Data structure
* refer @a CSL_i2cHwSetup.
* @b Arguments
* @verbatim
hI2c Handle to the I2C
setup Pointer to setup structure which contains the
information to program I2C to a useful state
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Hardware setup 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 this function can be called. The user has to
* allocate space for & fill in the main setup structure appropriately
* before calling this function.
*
* <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_i2cHwSetup hwSetup = CSL_I2C_HWSETUP_DEFAULTS;
...
CSL_i2cHwSetup(hI2c, &hwSetup);
...
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_i2cHwSetup (
CSL_I2cHandle hI2c,
CSL_I2cHwSetup *setup
);
/** ============================================================================
* @n@b CSL_i2cGetHwSetup
*
* @b Description
* @n 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 Arguments
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -