⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_i2c.h

📁 基于ti tms320c672x下音频开发例子程式
💻 H
📖 第 1 页 / 共 3 页
字号:

/*
 * =============================================================================
 *   @func CSL_i2cClose
 *
 *   @b Description
 *   @n This function closes the specified instance of I2C.
 *
 *   @arg  hI2c
           Handle to the I2C instance
 *
 *   @ret CSL_Status
 *         CSL_SOK            - Close successful
 *         CSL_ESYS_BADHANDLE - Invalid handle
 *
 *   @eg
 *     CSL_i2cClose (hI2c);
 * =============================================================================
 */
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
);


/** 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
);

/** =============================================================================
 *   @func CSL_i2cHwSetupRaw
 *
 *   @desc
 *       This function configures the registers of I2C as per the values given
 *       in the Config structure.
 *
 *   @arg hI2c
 *        Handle to the I2C instance
 *
 *   @arg hwConfig
 *        Pointer to I2C config structure
 *
 *   @ret CSL_Status
 *         CSL_SOK             - Configuration successful
 *         CSL_ESYS_BADHANDLE  - Invalid handle
 *
 *   @eg
 *
 *        CSL_Status            status;
 *        CSL_I2cConfig     hwConfig;
 *
 *        status = CSL_i2cHwsetupRaw (hI2c, &hwConfig);
 *
 * ===========================================================================
 */

extern CSL_Status  CSL_i2cHwSetupRaw (
    CSL_I2cHandle           hI2c,
    CSL_I2cConfig *         config
);

/** 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 cmd
 *  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
);


/** ============================================================================
 *   @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_PER_CNT, NULL, &baseAddress);

    @endverbatim
 * ===========================================================================
 */
extern 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 + -