version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 07 18:28:36 2014 +0100
Revision:
82:6473597d706e
Release 82 of the mbed library

Main changes:

- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 82:6473597d706e 1 /*
bogdanm 82:6473597d706e 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
bogdanm 82:6473597d706e 3 * All rights reserved.
bogdanm 82:6473597d706e 4 *
bogdanm 82:6473597d706e 5 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 82:6473597d706e 6 * are permitted provided that the following conditions are met:
bogdanm 82:6473597d706e 7 *
bogdanm 82:6473597d706e 8 * o Redistributions of source code must retain the above copyright notice, this list
bogdanm 82:6473597d706e 9 * of conditions and the following disclaimer.
bogdanm 82:6473597d706e 10 *
bogdanm 82:6473597d706e 11 * o Redistributions in binary form must reproduce the above copyright notice, this
bogdanm 82:6473597d706e 12 * list of conditions and the following disclaimer in the documentation and/or
bogdanm 82:6473597d706e 13 * other materials provided with the distribution.
bogdanm 82:6473597d706e 14 *
bogdanm 82:6473597d706e 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
bogdanm 82:6473597d706e 16 * contributors may be used to endorse or promote products derived from this
bogdanm 82:6473597d706e 17 * software without specific prior written permission.
bogdanm 82:6473597d706e 18 *
bogdanm 82:6473597d706e 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
bogdanm 82:6473597d706e 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
bogdanm 82:6473597d706e 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 82:6473597d706e 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
bogdanm 82:6473597d706e 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
bogdanm 82:6473597d706e 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
bogdanm 82:6473597d706e 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
bogdanm 82:6473597d706e 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
bogdanm 82:6473597d706e 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
bogdanm 82:6473597d706e 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 82:6473597d706e 29 */
bogdanm 82:6473597d706e 30 #ifndef __FSL_DMAMUX_HAL_H__
bogdanm 82:6473597d706e 31 #define __FSL_DMAMUX_HAL_H__
bogdanm 82:6473597d706e 32
bogdanm 82:6473597d706e 33 #include <stdint.h>
bogdanm 82:6473597d706e 34 #include <stdbool.h>
bogdanm 82:6473597d706e 35 #include <assert.h>
bogdanm 82:6473597d706e 36 #include "fsl_dmamux_features.h"
bogdanm 82:6473597d706e 37 #include "fsl_device_registers.h"
bogdanm 82:6473597d706e 38
bogdanm 82:6473597d706e 39 /*!
bogdanm 82:6473597d706e 40 * @addtogroup dmamux_hal
bogdanm 82:6473597d706e 41 * @{
bogdanm 82:6473597d706e 42 */
bogdanm 82:6473597d706e 43
bogdanm 82:6473597d706e 44 /*******************************************************************************
bogdanm 82:6473597d706e 45 * Definitions
bogdanm 82:6473597d706e 46 ******************************************************************************/
bogdanm 82:6473597d706e 47 /*!
bogdanm 82:6473597d706e 48 * @brief A constant for the length of the DMA hardware source. This structure is used inside
bogdanm 82:6473597d706e 49 * the DMA driver.
bogdanm 82:6473597d706e 50 */
bogdanm 82:6473597d706e 51 typedef enum _dmamux_source {
bogdanm 82:6473597d706e 52 kDmamuxDmaRequestSource = 64U /*!< Maximum number of the DMA requests allowed for the DMA mux. */
bogdanm 82:6473597d706e 53 } dmamux_dma_request_source;
bogdanm 82:6473597d706e 54
bogdanm 82:6473597d706e 55 /*******************************************************************************
bogdanm 82:6473597d706e 56 * API
bogdanm 82:6473597d706e 57 ******************************************************************************/
bogdanm 82:6473597d706e 58
bogdanm 82:6473597d706e 59 #if defined(__cplusplus)
bogdanm 82:6473597d706e 60 extern "C" {
bogdanm 82:6473597d706e 61 #endif
bogdanm 82:6473597d706e 62
bogdanm 82:6473597d706e 63 /*!
bogdanm 82:6473597d706e 64 * @name DMAMUX HAL function
bogdanm 82:6473597d706e 65 * @{
bogdanm 82:6473597d706e 66 */
bogdanm 82:6473597d706e 67
bogdanm 82:6473597d706e 68 /*!
bogdanm 82:6473597d706e 69 * @brief Initializes the DMAMUX module to the reset state.
bogdanm 82:6473597d706e 70 *
bogdanm 82:6473597d706e 71 * Initializes the DMAMUX module to the reset state.
bogdanm 82:6473597d706e 72 *
bogdanm 82:6473597d706e 73 * @param module DMAMUX module index
bogdanm 82:6473597d706e 74 */
bogdanm 82:6473597d706e 75 void dmamux_hal_init(uint8_t module);
bogdanm 82:6473597d706e 76
bogdanm 82:6473597d706e 77 /*!
bogdanm 82:6473597d706e 78 * @brief Enables the DMAMUX channel.
bogdanm 82:6473597d706e 79 *
bogdanm 82:6473597d706e 80 * Enables the hardware request. If enabled, the hardware request is sent to
bogdanm 82:6473597d706e 81 * the corresponding DMA channel.
bogdanm 82:6473597d706e 82 *
bogdanm 82:6473597d706e 83 * @param module DMAMUX module.
bogdanm 82:6473597d706e 84 * @param channel DMAMUX channel.
bogdanm 82:6473597d706e 85 */
bogdanm 82:6473597d706e 86 static inline void dmamux_hal_enable_channel(uint8_t module, uint8_t channel)
bogdanm 82:6473597d706e 87 {
bogdanm 82:6473597d706e 88 assert(module < HW_DMAMUX_INSTANCE_COUNT);
bogdanm 82:6473597d706e 89 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
bogdanm 82:6473597d706e 90 BW_DMAMUX_CHCFGn_ENBL(module, channel, 1U);
bogdanm 82:6473597d706e 91 }
bogdanm 82:6473597d706e 92
bogdanm 82:6473597d706e 93 /*!
bogdanm 82:6473597d706e 94 * @brief Disables the DMAMUX channel.
bogdanm 82:6473597d706e 95 *
bogdanm 82:6473597d706e 96 * Disable hardware request. If disabled, the hardware request is not sent to
bogdanm 82:6473597d706e 97 * the corresponding DMA channel.
bogdanm 82:6473597d706e 98 *
bogdanm 82:6473597d706e 99 * @param module DMAMUX module.
bogdanm 82:6473597d706e 100 * @param channel DMAMUX channel.
bogdanm 82:6473597d706e 101 */
bogdanm 82:6473597d706e 102 static inline void dmamux_hal_disable_channel(uint8_t module, uint8_t channel)
bogdanm 82:6473597d706e 103 {
bogdanm 82:6473597d706e 104 assert(module < HW_DMAMUX_INSTANCE_COUNT);
bogdanm 82:6473597d706e 105 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
bogdanm 82:6473597d706e 106 BW_DMAMUX_CHCFGn_ENBL(module, channel, 0U);
bogdanm 82:6473597d706e 107 }
bogdanm 82:6473597d706e 108
bogdanm 82:6473597d706e 109 /*!
bogdanm 82:6473597d706e 110 * @brief Enables the period trigger.
bogdanm 82:6473597d706e 111 *
bogdanm 82:6473597d706e 112 * @param module DMAMUX module.
bogdanm 82:6473597d706e 113 * @param channel DMAMUX channel.
bogdanm 82:6473597d706e 114 */
bogdanm 82:6473597d706e 115 static inline void dmamux_hal_enable_period_trigger(uint8_t module, uint8_t channel)
bogdanm 82:6473597d706e 116 {
bogdanm 82:6473597d706e 117 assert(module < HW_DMAMUX_INSTANCE_COUNT);
bogdanm 82:6473597d706e 118 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
bogdanm 82:6473597d706e 119 BW_DMAMUX_CHCFGn_TRIG(module, channel, 1U);
bogdanm 82:6473597d706e 120 }
bogdanm 82:6473597d706e 121
bogdanm 82:6473597d706e 122 /*!
bogdanm 82:6473597d706e 123 * @brief Disables the period trigger.
bogdanm 82:6473597d706e 124 *
bogdanm 82:6473597d706e 125 * @param module DMAMUX module.
bogdanm 82:6473597d706e 126 * @param channel DMAMUX channel.
bogdanm 82:6473597d706e 127 */
bogdanm 82:6473597d706e 128 static inline void dmamux_hal_disable_period_trigger(uint8_t module, uint8_t channel)
bogdanm 82:6473597d706e 129 {
bogdanm 82:6473597d706e 130 assert(module < HW_DMAMUX_INSTANCE_COUNT);
bogdanm 82:6473597d706e 131 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
bogdanm 82:6473597d706e 132 BW_DMAMUX_CHCFGn_TRIG(module, channel, 0U);
bogdanm 82:6473597d706e 133 }
bogdanm 82:6473597d706e 134
bogdanm 82:6473597d706e 135 /*!
bogdanm 82:6473597d706e 136 * @brief Configures the DMA request for the DMAMUX channel.
bogdanm 82:6473597d706e 137 *
bogdanm 82:6473597d706e 138 * Sets the trigger source for the DMA channel. The trigger source is in the file
bogdanm 82:6473597d706e 139 * fsl_dma_request.h.
bogdanm 82:6473597d706e 140 *
bogdanm 82:6473597d706e 141 * @param module DMAMUX module.
bogdanm 82:6473597d706e 142 * @param channel DMAMUX channel.
bogdanm 82:6473597d706e 143 * @param source DMA request source.
bogdanm 82:6473597d706e 144 */
bogdanm 82:6473597d706e 145 static inline void dmamux_hal_set_trigger_source(uint8_t module, uint8_t channel, uint8_t source)
bogdanm 82:6473597d706e 146 {
bogdanm 82:6473597d706e 147 assert(module < HW_DMAMUX_INSTANCE_COUNT);
bogdanm 82:6473597d706e 148 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
bogdanm 82:6473597d706e 149 BW_DMAMUX_CHCFGn_SOURCE(module, channel, source);
bogdanm 82:6473597d706e 150 }
bogdanm 82:6473597d706e 151
bogdanm 82:6473597d706e 152 /* @} */
bogdanm 82:6473597d706e 153
bogdanm 82:6473597d706e 154 #if defined(__cplusplus)
bogdanm 82:6473597d706e 155 }
bogdanm 82:6473597d706e 156 #endif
bogdanm 82:6473597d706e 157
bogdanm 82:6473597d706e 158 /*! @} */
bogdanm 82:6473597d706e 159
bogdanm 82:6473597d706e 160 #endif /* __FSL_DMAMUX_HAL_H__ */
bogdanm 82:6473597d706e 161 /*******************************************************************************
bogdanm 82:6473597d706e 162 * EOF
bogdanm 82:6473597d706e 163 ******************************************************************************/
bogdanm 82:6473597d706e 164