rusEFI
The most advanced open source ECU
fsl_dmamux.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #include "hal.h"
10 #include "fsl_dmamux.h"
11 
12 /*******************************************************************************
13  * Definitions
14  ******************************************************************************/
15 
16 /* Component ID definition, used by tools. */
17 #ifndef FSL_COMPONENT_ID
18 #define FSL_COMPONENT_ID "platform.drivers.dmamux"
19 #endif
20 
21 /*******************************************************************************
22  * Prototypes
23  ******************************************************************************/
24 
25 /*!
26  * @brief Get instance number for DMAMUX.
27  *
28  * @param base DMAMUX peripheral base address.
29  */
30 static uint32_t DMAMUX_GetInstance(DMAMUX_Type *base);
31 
32 /*******************************************************************************
33  * Variables
34  ******************************************************************************/
35 
36 /*! @brief Array to map DMAMUX instance number to base pointer. */
37 static DMAMUX_Type *const s_dmamuxBases[] = DMAMUX_BASE_PTRS;
38 
39 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
40 /*! @brief Array to map DMAMUX instance number to clock name. */
41 static const clock_ip_name_t s_dmamuxClockName[] = DMAMUX_CLOCKS;
42 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
43 
44 /*******************************************************************************
45  * Code
46  ******************************************************************************/
47 static uint32_t DMAMUX_GetInstance(DMAMUX_Type *base)
48 {
49  uint32_t instance;
50 
51  /* Find the instance index from base address mappings. */
52  for (instance = 0; instance < ARRAY_SIZE(s_dmamuxBases); instance++)
53  {
54  if (s_dmamuxBases[instance] == base)
55  {
56  break;
57  }
58  }
59 
60  assert(instance < ARRAY_SIZE(s_dmamuxBases));
61 
62  return instance;
63 }
64 
65 /*!
66  * brief Initializes the DMAMUX peripheral.
67  *
68  * This function ungates the DMAMUX clock.
69  *
70  * param base DMAMUX peripheral base address.
71  *
72  */
73 void DMAMUX_Init(DMAMUX_Type *base)
74 {
75 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
77 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
78 }
79 
80 /*!
81  * brief Deinitializes the DMAMUX peripheral.
82  *
83  * This function gates the DMAMUX clock.
84  *
85  * param base DMAMUX peripheral base address.
86  */
87 void DMAMUX_Deinit(DMAMUX_Type *base)
88 {
89 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
91 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
92 }
static uint32_t DMAMUX_GetInstance(DMAMUX_Type *base)
Get instance number for DMAMUX.
Definition: fsl_dmamux.c:47
static const clock_ip_name_t s_dmamuxClockName[]
Array to map DMAMUX instance number to clock name.
Definition: fsl_dmamux.c:41
static DMAMUX_Type *const s_dmamuxBases[]
Array to map DMAMUX instance number to base pointer.
Definition: fsl_dmamux.c:37
enum _clock_ip_name clock_ip_name_t
Peripheral clock name difinition used for clock gate, clock source and clock divider setting....
static void CLOCK_DisableClock(clock_ip_name_t name)
Disable the clock for specific IP.
Definition: fsl_clock.h:653
static void CLOCK_EnableClock(clock_ip_name_t name)
Enable the clock for specific IP.
Definition: fsl_clock.h:641
void DMAMUX_Init(DMAMUX_Type *base)
Initializes the DMAMUX peripheral.
Definition: fsl_dmamux.c:73
void DMAMUX_Deinit(DMAMUX_Type *base)
Deinitializes the DMAMUX peripheral.
Definition: fsl_dmamux.c:87
HIP9011 instance