HAL_Status
RtkI2SDeInit(
    IN  VOID *Data
)
{
    PHAL_I2S_ADAPTER pI2SAdapter = (PHAL_I2S_ADAPTER) Data;
    PHAL_I2S_OP     pHalI2SOP  = &HalI2SOpSAL;
    PHAL_I2S_INIT_DAT pI2SCfg;
    u32 I2Stemp;

    if (pI2SAdapter == 0) {
        DBG_I2S_ERR("RtkI2SDeInit: Null Pointer\r\n");
        return HAL_ERR_PARA;
    }

    pI2SCfg = pI2SAdapter->pInitDat;

    /*I2S Disable Module*/
    pI2SCfg->I2SEn = I2S_DISABLE;
    pHalI2SOP->HalI2SEnable(pI2SCfg);
    HalI2SClearAllOwnBit((VOID*)pI2SCfg);

    /*I2C HAL DeInitialization*/
    //pHalI2SOP->HalI2SDeInit(pI2SCfg);
    
    /*I2S Interrupt DeInitialization*/
    RtkI2SIrqDeInit(pI2SAdapter);

    /*I2S Pin Mux DeInitialization*/
    RtkI2SPinMuxDeInit(pI2SAdapter);
    
    /*I2S HAL DeInitialization*/
    pHalI2SOP->HalI2SDeInit(pI2SCfg);

    /*I2S CLK Source Close*/
    I2Stemp = HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_SYSPLL_CTRL1) & (~((1<<9) | (1<<10)));
    HAL_WRITE32(SYSTEM_CTRL_BASE, REG_SYS_SYSPLL_CTRL1, I2Stemp);     

    /*I2S Device Status Update*/
    pI2SAdapter->DevSts  = I2S_STS_UNINITIAL;
    
    return HAL_OK;
}
Beispiel #2
0
HAL_Status
RtkI2SDeInit(
    IN  VOID *Data
)
{
    PHAL_I2S_ADAPTER pI2SAdapter = (PHAL_I2S_ADAPTER) Data;
    PHAL_I2S_OP     pHalI2SOP  = &HalI2SOpSAL;
    PHAL_I2S_INIT_DAT pI2SCfg;

    if (pI2SAdapter == 0) {
        DBG_I2S_ERR("RtkI2SDeInit: Null Pointer\r\n");
        return HAL_ERR_PARA;
    }

    pI2SCfg = pI2SAdapter->pInitDat;

    /*I2S Disable Module*/
    pI2SCfg->I2SEn = I2S_DISABLE;
    pHalI2SOP->HalI2SEnable(pI2SCfg);

    /*I2C HAL DeInitialization*/
    //pHalI2SOP->HalI2SDeInit(pI2SCfg);
    
    /*I2S Interrupt DeInitialization*/
    RtkI2SIrqDeInit(pI2SAdapter);

    /*I2S Pin Mux DeInitialization*/
    RtkI2SPinMuxDeInit(pI2SAdapter);
    
    /*I2S HAL DeInitialization*/
    pHalI2SOP->HalI2SDeInit(pI2SCfg);

    /*I2S Device Status Update*/
    pI2SAdapter->DevSts  = I2S_STS_UNINITIAL;
    
    return HAL_OK;
}