Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
fsl_dmamux.c
00001 /* 00002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 00003 * Copyright 2016-2017 NXP 00004 * All rights reserved. 00005 * 00006 * SPDX-License-Identifier: BSD-3-Clause 00007 */ 00008 00009 #include "fsl_dmamux.h" 00010 #include "fsl_clock.h " 00011 00012 /******************************************************************************* 00013 * Definitions 00014 ******************************************************************************/ 00015 00016 /* Component ID definition, used by tools. */ 00017 #ifndef FSL_COMPONENT_ID 00018 #define FSL_COMPONENT_ID "platform.drivers.dmamux" 00019 #endif 00020 00021 /******************************************************************************* 00022 * Prototypes 00023 ******************************************************************************/ 00024 00025 /*! 00026 * @brief Get instance number for DMAMUX. 00027 * 00028 * @param base DMAMUX peripheral base address. 00029 */ 00030 static uint32_t DMAMUX_GetInstance(DMAMUX_Type *base); 00031 00032 /******************************************************************************* 00033 * Variables 00034 ******************************************************************************/ 00035 00036 /*! @brief Array to map DMAMUX instance number to base pointer. */ 00037 static DMAMUX_Type *const s_dmamuxBases[] = DMAMUX_BASE_PTRS; 00038 00039 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) 00040 /*! @brief Array to map DMAMUX instance number to clock name. */ 00041 static const clock_ip_name_t s_dmamuxClockName[] = DMAMUX_CLOCKS; 00042 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */ 00043 00044 /******************************************************************************* 00045 * Code 00046 ******************************************************************************/ 00047 static uint32_t DMAMUX_GetInstance(DMAMUX_Type *base) 00048 { 00049 uint32_t instance; 00050 00051 /* Find the instance index from base address mappings. */ 00052 for (instance = 0; instance < ARRAY_SIZE(s_dmamuxBases); instance++) 00053 { 00054 if (s_dmamuxBases[instance] == base) 00055 { 00056 break; 00057 } 00058 } 00059 00060 assert(instance < ARRAY_SIZE(s_dmamuxBases)); 00061 00062 return instance; 00063 } 00064 00065 /*! 00066 * brief Initializes the DMAMUX peripheral. 00067 * 00068 * This function ungates the DMAMUX clock. 00069 * 00070 * param base DMAMUX peripheral base address. 00071 * 00072 */ 00073 void DMAMUX_Init(DMAMUX_Type *base) 00074 { 00075 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) 00076 CLOCK_EnableClock(s_dmamuxClockName[DMAMUX_GetInstance(base)]); 00077 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */ 00078 } 00079 00080 /*! 00081 * brief Deinitializes the DMAMUX peripheral. 00082 * 00083 * This function gates the DMAMUX clock. 00084 * 00085 * param base DMAMUX peripheral base address. 00086 */ 00087 void DMAMUX_Deinit(DMAMUX_Type *base) 00088 { 00089 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) 00090 CLOCK_DisableClock(s_dmamuxClockName[DMAMUX_GetInstance(base)]); 00091 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */ 00092 }
Generated on Tue Jul 12 2022 15:37:17 by
1.7.2