Пример #1
0
/*FUNCTION**********************************************************************
 *
 * Function Name : DMA_DRV_Deinit
 * Description   : Deinitilize DMA
 *
 *END**************************************************************************/
dma_status_t DMA_DRV_Deinit(void)
{
    uint8_t i;

    /* Disable DMA clock and free channel. */
    for (i = 0; i < FSL_FEATURE_DMA_DMAMUX_CHANNELS; i++)
    {
        /* Free all requested channels. */
        if (g_dma->dmaChan[i])
        {
            DMA_DRV_FreeChannel(g_dma->dmaChan[i]);
        }
    }

    /* Disable DMA clcok. */
    for (i = 0; i < DMA_INSTANCE_COUNT; i++)
    {
        CLOCK_SYS_DisableDmaClock(i);
    }

    /* Disable DMAMUX clock. */
    for (i = 0; i < DMAMUX_INSTANCE_COUNT; i++)
    {
        CLOCK_SYS_DisableDmaClock(i);
    }
#if USE_RTOS
    OSA_MutexDestroy(&g_dma->lock);
#endif

    return kStatus_DMA_Success;
}
uint32_t OS_Mutex_destroy(os_mutex_handle handle)
{
    if (kStatus_OSA_Success == OSA_MutexDestroy((mutex_t*) handle))
    {
        OSA_MemFree(handle);
        return (uint32_t) OS_MUTEX_OK;
    }
    else
    {
        return (uint32_t) OS_MUTEX_ERROR;
    }
}