/*******************************************************************************
* Function Name: I2C_1_Stop
********************************************************************************
*
* Summary:
*  Disables the SCB component and its interrupt.
*  It also disables all TX interrupt sources so as not to cause an unexpected
*  interrupt trigger because after the component is enabled, the TX FIFO 
*  is empty.
*
* Parameters:
*  None
*
* Return:
*  None
* 
*******************************************************************************/
void I2C_1_Stop(void)
{
#if (I2C_1_SCB_IRQ_INTERNAL)
    I2C_1_DisableInt();
#endif /* (I2C_1_SCB_IRQ_INTERNAL) */

    /* Call Stop function specific to current operation mode */
    I2C_1_ScbModeStop();

    /* Disable SCB IP */
    I2C_1_CTRL_REG &= (uint32) ~I2C_1_CTRL_ENABLED;

    /* Disable all TX interrupt sources so as not to cause an unexpected
    * interrupt trigger because after the component is enabled, the TX FIFO
    * is empty.
    * For SCB IP v0, it is critical as it does not mask-out interrupt
    * sources when they are disabled. This can cause a code lock-up in the
    * interrupt handler because TX FIFO cannot be loaded after the block
    * is disabled.
    */
    I2C_1_SetTxInterruptMode(I2C_1_NO_INTR_SOURCES);

#if (I2C_1_SCB_IRQ_INTERNAL)
    I2C_1_ClearPendingInt();
#endif /* (I2C_1_SCB_IRQ_INTERNAL) */
}
Beispiel #2
0
/*******************************************************************************
* Function Name: I2C_1_Stop
********************************************************************************
*
* Summary:
*  Disables the SCB component and its interrupt.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void I2C_1_Stop(void)
{
#if(I2C_1_SCB_IRQ_INTERNAL)
    I2C_1_DisableInt();
#endif /* (I2C_1_SCB_IRQ_INTERNAL) */

    I2C_1_CTRL_REG &= (uint32) ~I2C_1_CTRL_ENABLED;  /* Disable scb IP */

#if(I2C_1_SCB_IRQ_INTERNAL)
    I2C_1_ClearPendingInt();
#endif /* (I2C_1_SCB_IRQ_INTERNAL) */

    I2C_1_ScbModeStop(); /* Calls scbMode specific Stop function */
}