Ben Katz / mbed-dev_spine

Dependents:   SPIne CH_Communicatuin_Test CH_Communicatuin_Test2 MCP_SPIne ... more

Fork of mbed-dev-f303 by Ben Katz

Committer:
<>
Date:
Wed Jan 04 16:58:05 2017 +0000
Revision:
154:37f96f9d4de2
This updates the lib to the mbed lib v133

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 154:37f96f9d4de2 1 /*
<> 154:37f96f9d4de2 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
<> 154:37f96f9d4de2 3 * All rights reserved.
<> 154:37f96f9d4de2 4 *
<> 154:37f96f9d4de2 5 * Redistribution and use in source and binary forms, with or without modification,
<> 154:37f96f9d4de2 6 * are permitted provided that the following conditions are met:
<> 154:37f96f9d4de2 7 *
<> 154:37f96f9d4de2 8 * o Redistributions of source code must retain the above copyright notice, this list
<> 154:37f96f9d4de2 9 * of conditions and the following disclaimer.
<> 154:37f96f9d4de2 10 *
<> 154:37f96f9d4de2 11 * o Redistributions in binary form must reproduce the above copyright notice, this
<> 154:37f96f9d4de2 12 * list of conditions and the following disclaimer in the documentation and/or
<> 154:37f96f9d4de2 13 * other materials provided with the distribution.
<> 154:37f96f9d4de2 14 *
<> 154:37f96f9d4de2 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
<> 154:37f96f9d4de2 16 * contributors may be used to endorse or promote products derived from this
<> 154:37f96f9d4de2 17 * software without specific prior written permission.
<> 154:37f96f9d4de2 18 *
<> 154:37f96f9d4de2 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<> 154:37f96f9d4de2 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
<> 154:37f96f9d4de2 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 154:37f96f9d4de2 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
<> 154:37f96f9d4de2 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
<> 154:37f96f9d4de2 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
<> 154:37f96f9d4de2 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
<> 154:37f96f9d4de2 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<> 154:37f96f9d4de2 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
<> 154:37f96f9d4de2 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 154:37f96f9d4de2 29 */
<> 154:37f96f9d4de2 30
<> 154:37f96f9d4de2 31 #include "fsl_dmamux.h"
<> 154:37f96f9d4de2 32
<> 154:37f96f9d4de2 33 /*******************************************************************************
<> 154:37f96f9d4de2 34 * Definitions
<> 154:37f96f9d4de2 35 ******************************************************************************/
<> 154:37f96f9d4de2 36
<> 154:37f96f9d4de2 37 /*******************************************************************************
<> 154:37f96f9d4de2 38 * Prototypes
<> 154:37f96f9d4de2 39 ******************************************************************************/
<> 154:37f96f9d4de2 40
<> 154:37f96f9d4de2 41 /*!
<> 154:37f96f9d4de2 42 * @brief Get instance number for DMAMUX.
<> 154:37f96f9d4de2 43 *
<> 154:37f96f9d4de2 44 * @param base DMAMUX peripheral base address.
<> 154:37f96f9d4de2 45 */
<> 154:37f96f9d4de2 46 static uint32_t DMAMUX_GetInstance(DMAMUX_Type *base);
<> 154:37f96f9d4de2 47
<> 154:37f96f9d4de2 48 /*******************************************************************************
<> 154:37f96f9d4de2 49 * Variables
<> 154:37f96f9d4de2 50 ******************************************************************************/
<> 154:37f96f9d4de2 51
<> 154:37f96f9d4de2 52 /*! @brief Array to map DMAMUX instance number to base pointer. */
<> 154:37f96f9d4de2 53 static DMAMUX_Type *const s_dmamuxBases[] = DMAMUX_BASE_PTRS;
<> 154:37f96f9d4de2 54
<> 154:37f96f9d4de2 55 /*! @brief Array to map DMAMUX instance number to clock name. */
<> 154:37f96f9d4de2 56 static const clock_ip_name_t s_dmamuxClockName[] = DMAMUX_CLOCKS;
<> 154:37f96f9d4de2 57
<> 154:37f96f9d4de2 58 /*******************************************************************************
<> 154:37f96f9d4de2 59 * Code
<> 154:37f96f9d4de2 60 ******************************************************************************/
<> 154:37f96f9d4de2 61 static uint32_t DMAMUX_GetInstance(DMAMUX_Type *base)
<> 154:37f96f9d4de2 62 {
<> 154:37f96f9d4de2 63 uint32_t instance;
<> 154:37f96f9d4de2 64
<> 154:37f96f9d4de2 65 /* Find the instance index from base address mappings. */
<> 154:37f96f9d4de2 66 for (instance = 0; instance < FSL_FEATURE_SOC_DMAMUX_COUNT; instance++)
<> 154:37f96f9d4de2 67 {
<> 154:37f96f9d4de2 68 if (s_dmamuxBases[instance] == base)
<> 154:37f96f9d4de2 69 {
<> 154:37f96f9d4de2 70 break;
<> 154:37f96f9d4de2 71 }
<> 154:37f96f9d4de2 72 }
<> 154:37f96f9d4de2 73
<> 154:37f96f9d4de2 74 assert(instance < FSL_FEATURE_SOC_DMAMUX_COUNT);
<> 154:37f96f9d4de2 75
<> 154:37f96f9d4de2 76 return instance;
<> 154:37f96f9d4de2 77 }
<> 154:37f96f9d4de2 78
<> 154:37f96f9d4de2 79 void DMAMUX_Init(DMAMUX_Type *base)
<> 154:37f96f9d4de2 80 {
<> 154:37f96f9d4de2 81 CLOCK_EnableClock(s_dmamuxClockName[DMAMUX_GetInstance(base)]);
<> 154:37f96f9d4de2 82 }
<> 154:37f96f9d4de2 83
<> 154:37f96f9d4de2 84 void DMAMUX_Deinit(DMAMUX_Type *base)
<> 154:37f96f9d4de2 85 {
<> 154:37f96f9d4de2 86 CLOCK_DisableClock(s_dmamuxClockName[DMAMUX_GetInstance(base)]);
<> 154:37f96f9d4de2 87 }