The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_EFM32HG_STK3400/TARGET_Silicon_Labs/TARGET_EFM32/dma_api_HAL.h@113:f141b2784e32, 2016-02-02 (annotated)
- Committer:
- Kojto
- Date:
- Tue Feb 02 14:43:35 2016 +0000
- Revision:
- 113:f141b2784e32
- Parent:
- 108:34e6b704fe68
- Child:
- 122:f9eeca106725
Release 113 of the mbed library
Changes:
- new targets - Silabs Perl Gecko, TY51822
- Silabs - emlib update to 4.1.0, various bugfixes as result
- STM B96B_F446VE - add async serial support
- Freescale KLXX - rtc lock fix
- LPC11U68 and LPC1549 - pwm bugfixes - duty cycle
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 108:34e6b704fe68 | 1 | /***************************************************************************//** |
Kojto | 108:34e6b704fe68 | 2 | * @file dma_api_HAL.h |
Kojto | 108:34e6b704fe68 | 3 | ******************************************************************************* |
Kojto | 108:34e6b704fe68 | 4 | * @section License |
Kojto | 108:34e6b704fe68 | 5 | * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> |
Kojto | 108:34e6b704fe68 | 6 | ******************************************************************************* |
Kojto | 98:8ab26030e058 | 7 | * |
Kojto | 108:34e6b704fe68 | 8 | * Permission is granted to anyone to use this software for any purpose, |
Kojto | 108:34e6b704fe68 | 9 | * including commercial applications, and to alter it and redistribute it |
Kojto | 108:34e6b704fe68 | 10 | * freely, subject to the following restrictions: |
Kojto | 98:8ab26030e058 | 11 | * |
Kojto | 108:34e6b704fe68 | 12 | * 1. The origin of this software must not be misrepresented; you must not |
Kojto | 108:34e6b704fe68 | 13 | * claim that you wrote the original software. |
Kojto | 108:34e6b704fe68 | 14 | * 2. Altered source versions must be plainly marked as such, and must not be |
Kojto | 108:34e6b704fe68 | 15 | * misrepresented as being the original software. |
Kojto | 108:34e6b704fe68 | 16 | * 3. This notice may not be removed or altered from any source distribution. |
Kojto | 98:8ab26030e058 | 17 | * |
Kojto | 108:34e6b704fe68 | 18 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
Kojto | 108:34e6b704fe68 | 19 | * obligation to support this Software. Silicon Labs is providing the |
Kojto | 108:34e6b704fe68 | 20 | * Software "AS IS", with no express or implied warranties of any kind, |
Kojto | 108:34e6b704fe68 | 21 | * including, but not limited to, any implied warranties of merchantability |
Kojto | 108:34e6b704fe68 | 22 | * or fitness for any particular purpose or warranties against infringement |
Kojto | 108:34e6b704fe68 | 23 | * of any proprietary rights of a third party. |
Kojto | 108:34e6b704fe68 | 24 | * |
Kojto | 108:34e6b704fe68 | 25 | * Silicon Labs will not be liable for any consequential, incidental, or |
Kojto | 108:34e6b704fe68 | 26 | * special damages, or any other relief, or for any claim by any third party, |
Kojto | 108:34e6b704fe68 | 27 | * arising from your use of this Software. |
Kojto | 108:34e6b704fe68 | 28 | * |
Kojto | 108:34e6b704fe68 | 29 | ******************************************************************************/ |
Kojto | 108:34e6b704fe68 | 30 | |
Kojto | 98:8ab26030e058 | 31 | #ifndef MBED_DMA_API_HAL_H |
Kojto | 98:8ab26030e058 | 32 | #define MBED_DMA_API_HAL_H |
Kojto | 98:8ab26030e058 | 33 | |
Kojto | 98:8ab26030e058 | 34 | #include <stdint.h> |
Kojto | 98:8ab26030e058 | 35 | #include "dma_api.h" |
Kojto | 113:f141b2784e32 | 36 | #include "em_device.h" |
Kojto | 113:f141b2784e32 | 37 | |
Kojto | 113:f141b2784e32 | 38 | #ifdef DMA_PRESENT |
Kojto | 98:8ab26030e058 | 39 | #include "em_dma.h" |
Kojto | 113:f141b2784e32 | 40 | #endif |
Kojto | 113:f141b2784e32 | 41 | |
Kojto | 113:f141b2784e32 | 42 | #ifdef LDMA_PRESENT |
Kojto | 113:f141b2784e32 | 43 | #include "em_ldma.h" |
Kojto | 113:f141b2784e32 | 44 | #endif |
Kojto | 98:8ab26030e058 | 45 | |
Kojto | 98:8ab26030e058 | 46 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 47 | extern "C" { |
Kojto | 98:8ab26030e058 | 48 | #endif |
Kojto | 98:8ab26030e058 | 49 | |
Kojto | 98:8ab26030e058 | 50 | /* Purpose of this file: extend dma_api.h to include EFM-specific DMA attributes */ |
Kojto | 98:8ab26030e058 | 51 | |
Kojto | 98:8ab26030e058 | 52 | #define DMA_CAP_2DCOPY (1 << 0) |
Kojto | 98:8ab26030e058 | 53 | #define DMA_CAP_NONE (0 << 0) |
Kojto | 98:8ab26030e058 | 54 | |
Kojto | 98:8ab26030e058 | 55 | #if ( DMA_CHAN_COUNT <= 4 ) |
Kojto | 98:8ab26030e058 | 56 | #define DMACTRL_CH_CNT 4 |
Kojto | 98:8ab26030e058 | 57 | #define DMACTRL_ALIGNMENT 256 |
Kojto | 98:8ab26030e058 | 58 | |
Kojto | 98:8ab26030e058 | 59 | #elif ( ( DMA_CHAN_COUNT > 4 ) && ( DMA_CHAN_COUNT <= 8 ) ) |
Kojto | 98:8ab26030e058 | 60 | #define DMACTRL_CH_CNT 8 |
Kojto | 98:8ab26030e058 | 61 | #define DMACTRL_ALIGNMENT 256 |
Kojto | 98:8ab26030e058 | 62 | |
Kojto | 98:8ab26030e058 | 63 | #elif ( ( DMA_CHAN_COUNT > 8 ) && ( DMA_CHAN_COUNT <= 16 ) ) |
Kojto | 98:8ab26030e058 | 64 | #define DMACTRL_CH_CNT 16 |
Kojto | 98:8ab26030e058 | 65 | #define DMACTRL_ALIGNMENT 512 |
Kojto | 98:8ab26030e058 | 66 | |
Kojto | 98:8ab26030e058 | 67 | #else |
Kojto | 98:8ab26030e058 | 68 | #error "Unsupported DMA channel count (dma_api.c)." |
Kojto | 98:8ab26030e058 | 69 | #endif |
Kojto | 98:8ab26030e058 | 70 | |
Kojto | 113:f141b2784e32 | 71 | #ifdef LDMA_PRESENT |
Kojto | 113:f141b2784e32 | 72 | typedef void (*LDMAx_CBFunc_t)(unsigned int channel, bool primary, void *user); |
Kojto | 113:f141b2784e32 | 73 | |
Kojto | 113:f141b2784e32 | 74 | typedef struct |
Kojto | 113:f141b2784e32 | 75 | { |
Kojto | 113:f141b2784e32 | 76 | LDMAx_CBFunc_t cbFunc; |
Kojto | 113:f141b2784e32 | 77 | void *userPtr; |
Kojto | 113:f141b2784e32 | 78 | } LDMAx_Callback_t; |
Kojto | 113:f141b2784e32 | 79 | |
Kojto | 113:f141b2784e32 | 80 | void LDMAx_StartTransfer( int ch, |
Kojto | 113:f141b2784e32 | 81 | LDMA_TransferCfg_t *transfer, |
Kojto | 113:f141b2784e32 | 82 | LDMA_Descriptor_t *descriptor, |
Kojto | 113:f141b2784e32 | 83 | LDMAx_CBFunc_t cbFunc, |
Kojto | 113:f141b2784e32 | 84 | void *userData ); |
Kojto | 113:f141b2784e32 | 85 | bool LDMAx_ChannelEnabled( int ch ); |
Kojto | 113:f141b2784e32 | 86 | #endif |
Kojto | 113:f141b2784e32 | 87 | |
Kojto | 98:8ab26030e058 | 88 | typedef struct { |
Kojto | 100:cbbeb26dbd92 | 89 | DMAUsage dmaUsageState; |
Kojto | 100:cbbeb26dbd92 | 90 | int dmaChannel; |
Kojto | 113:f141b2784e32 | 91 | #ifndef LDMA_PRESENT |
Kojto | 100:cbbeb26dbd92 | 92 | DMA_CB_TypeDef dmaCallback; |
Kojto | 113:f141b2784e32 | 93 | #else |
Kojto | 113:f141b2784e32 | 94 | LDMAx_Callback_t dmaCallback; |
Kojto | 113:f141b2784e32 | 95 | #endif |
Kojto | 98:8ab26030e058 | 96 | } DMA_OPTIONS_t; |
Kojto | 98:8ab26030e058 | 97 | |
Kojto | 98:8ab26030e058 | 98 | typedef void (*DMACallback)(void); |
Kojto | 98:8ab26030e058 | 99 | |
Kojto | 98:8ab26030e058 | 100 | extern DMA_DESCRIPTOR_TypeDef dmaControlBlock[]; |
Kojto | 98:8ab26030e058 | 101 | |
Kojto | 98:8ab26030e058 | 102 | #ifdef __cplusplus |
Kojto | 98:8ab26030e058 | 103 | } |
Kojto | 98:8ab26030e058 | 104 | #endif |
Kojto | 98:8ab26030e058 | 105 | |
Kojto | 98:8ab26030e058 | 106 | #endif |