Mbed OS Reference
Loading...
Searching...
No Matches
dma_api.h
Go to the documentation of this file.
1/**
2 * @file
3 * \addtogroup hal
4 * @{
5 */
6/* mbed Microcontroller Library
7 * Copyright (c) 2014-2015 ARM Limited
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22#ifndef MBED_DMA_API_H
23#define MBED_DMA_API_H
24
25#include <stdint.h>
26
27#define DMA_ERROR_OUT_OF_CHANNELS (-1)
28
29/**
30 * @brief Enumeration of possible DMA usage hints
31 */
32typedef enum {
33 DMA_USAGE_NEVER, ///< Never use DMA
34 DMA_USAGE_OPPORTUNISTIC, ///< Use DMA if possible but deallocate DMA resources when not being used.
35 DMA_USAGE_ALWAYS, ///< Always use DMA when possible
36 DMA_USAGE_TEMPORARY_ALLOCATED, // Seems to be used as an internal state indicator for "we need to deallocate these channels."
37 DMA_USAGE_ALLOCATED // Seems to be used as an internal state indicator for "we have allocated DMA channels."
38} DMAUsage;
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44void dma_init(void);
45
46int dma_channel_allocate(uint32_t capabilities);
47
48int dma_channel_free(int channelid);
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif
55
56/** @}*/
DMAUsage
Enumeration of possible DMA usage hints.
Definition: dma_api.h:32
@ DMA_USAGE_NEVER
Never use DMA.
Definition: dma_api.h:33
@ DMA_USAGE_OPPORTUNISTIC
Use DMA if possible but deallocate DMA resources when not being used.
Definition: dma_api.h:34
@ DMA_USAGE_ALWAYS
Always use DMA when possible.
Definition: dma_api.h:35