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

📄 csl_i2caux.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 3 页
字号:
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cStart(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cStart (
    CSL_I2cHandle hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_STT, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cStop
 *
 *   @b Description
 *   @n This function writes the stop command to the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cStop(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cStop (
    CSL_I2cHandle hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_STP, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cDirTransmit
 *
 *   @b Description
 *   @n This function sets the direction of data as transmit of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDirTransmit(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cDirTransmit (
    CSL_I2cHandle        hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_TRX, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cDirReceive
 *
 *   @b Description
 *   @n This function sets the direction of data as receive of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDirReceive(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cDirReceive (
    CSL_I2cHandle hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_TRX, FALSE);
}

/** ============================================================================
 *   @n@b CSL_i2RmEnable
 *
 *   @b Description
 *   @n This function enables the repeat mode of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2RmEnable(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cRmEnable (
    CSL_I2cHandle hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_RM, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cRmDisable
 *
 *   @b Description
 *   @n This function disables the repeat mode of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cRmDisable(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cRmDisable (
    CSL_I2cHandle hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_RM, FALSE);
}

/** ============================================================================
 *   @n@b CSL_i2cDlbEnable
 *
 *   @b Description
 *   @n This function enables the data loop back of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDlbEnable(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cDlbEnable (
    CSL_I2cHandle hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_DLB, TRUE);
}

/** ============================================================================
 *   @n@b CSL_i2cDlbDisable
 *
 *   @b Description
 *   @n This function disables the data loop back of I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cDlbDisable(hI2c);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cDlbDisable (
    CSL_I2cHandle hI2c
)
{
    CSL_FINS(hI2c->regs->ICMDR, I2C_ICMDR_DLB, FALSE);
}

/**
 *  Status Functions of i2c.
 */
/** ============================================================================
 *   @n@b CSL_i2cGetClockSetup
 *
 *   @b Description
 *   @n This function gets the clock setup of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  Return clock high,clock low and prescale value.
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetClockSetup(hI2c, &response);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cGetClockSetup (
    CSL_I2cHandle hI2c,
    void          *response
)
{
    ((CSL_I2cClkSetup *)response)->prescalar
                                = CSL_FEXT(hI2c->regs->ICPSC, I2C_ICPSC_IPSC);
    ((CSL_I2cClkSetup *)response)->clklowdiv
                                = CSL_FEXT(hI2c->regs->ICCLKL, I2C_ICCLKL_ICCL);
    ((CSL_I2cClkSetup *)response)->clkhighdiv
                                = CSL_FEXT(hI2c->regs->ICCLKH, I2C_ICCLKH_ICCH);
}

/** ============================================================================
 *   @n@b CSL_i2cGetBusBusy
 *
 *   @b Description
 *   @n This function gets the bus busy status of I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  Return bus busy status.
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetBusBusy(hI2c, &response);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cGetBusBusy (
    CSL_I2cHandle hI2c,
    void          *response
)
{
    *(Uint32 *)response = CSL_FEXT(hI2c->regs->ICSTR, I2C_ICSTR_BB);
}

/** ============================================================================
 *   @n@b CSL_i2cGetRxRdy
 *
 *   @b Description
 *   @n This function gets the receive ready status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  Return receive ready status.
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetRxRdy(hI2c, &response);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cGetRxRdy (
    CSL_I2cHandle hI2c,
    void          *response
)
{
    *(Uint32 *)response = CSL_FEXT(hI2c->regs->ICSTR, I2C_ICSTR_ICRRDY);
}

/** ============================================================================
 *   @n@b CSL_i2cGetTxRdy
 *
 *   @b Description
 *   @n This function gets the transmit ready status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  Return Transmit ready status.
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim

        CSL_i2cGetTxRdy(hI2c, &response);

     @endverbatim
 *  ============================================================================
 */
static inline
void CSL_i2cGetTxRdy (
    CSL_I2cHandle hI2c,
    void          *response
)
{
    *(Uint32 *)response = CSL_FEXT(hI2c->regs->ICSTR, I2C_ICSTR_ICXRDY);
}


/** ============================================================================
 *   @n@b CSL_i2cGetAcsRdy
 *
 *   @b Description
 *   @n This function gets the ACS ready status of the I2C module.
 *
 *   @b Arguments
 *   @verbatim

            hI2c            Handle to I2C instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  Return Register-access-ready status.
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_i2cInit(),CSL_i2cOpen()has to be called successfully before calling
 *       this function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -