Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DM_HttpServer DM_USBHost
Dependents: lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more
Fork of DMSupport by
FileSystems/gpdma.h@0:6b68dac0d986, 2014-11-21 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Nov 21 11:42:51 2014 +0000
- Revision:
- 0:6b68dac0d986
- Child:
- 9:a33326afd686
First version
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| embeddedartists | 0:6b68dac0d986 | 1 | /* |
| embeddedartists | 0:6b68dac0d986 | 2 | * Copyright 2013 Embedded Artists AB |
| embeddedartists | 0:6b68dac0d986 | 3 | * |
| embeddedartists | 0:6b68dac0d986 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| embeddedartists | 0:6b68dac0d986 | 5 | * you may not use this file except in compliance with the License. |
| embeddedartists | 0:6b68dac0d986 | 6 | * You may obtain a copy of the License at |
| embeddedartists | 0:6b68dac0d986 | 7 | * |
| embeddedartists | 0:6b68dac0d986 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| embeddedartists | 0:6b68dac0d986 | 9 | * |
| embeddedartists | 0:6b68dac0d986 | 10 | * Unless required by applicable law or agreed to in writing, software |
| embeddedartists | 0:6b68dac0d986 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| embeddedartists | 0:6b68dac0d986 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| embeddedartists | 0:6b68dac0d986 | 13 | * See the License for the specific language governing permissions and |
| embeddedartists | 0:6b68dac0d986 | 14 | * limitations under the License. |
| embeddedartists | 0:6b68dac0d986 | 15 | */ |
| embeddedartists | 0:6b68dac0d986 | 16 | |
| embeddedartists | 0:6b68dac0d986 | 17 | #ifndef GPDMA_H |
| embeddedartists | 0:6b68dac0d986 | 18 | #define GPDMA_H |
| embeddedartists | 0:6b68dac0d986 | 19 | |
| embeddedartists | 0:6b68dac0d986 | 20 | #include "platform.h" |
| embeddedartists | 0:6b68dac0d986 | 21 | |
| embeddedartists | 0:6b68dac0d986 | 22 | #define GPDMA_CONN_SDC ((1UL)) /*!< SD card */ |
| embeddedartists | 0:6b68dac0d986 | 23 | |
| embeddedartists | 0:6b68dac0d986 | 24 | typedef enum |
| embeddedartists | 0:6b68dac0d986 | 25 | { |
| embeddedartists | 0:6b68dac0d986 | 26 | GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA, /* Memory to memory - DMA control */ |
| embeddedartists | 0:6b68dac0d986 | 27 | GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA, /* Memory to peripheral - DMA control */ |
| embeddedartists | 0:6b68dac0d986 | 28 | GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA, /* Peripheral to memory - DMA control */ |
| embeddedartists | 0:6b68dac0d986 | 29 | GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA, /* Source peripheral to destination peripheral - DMA control */ |
| embeddedartists | 0:6b68dac0d986 | 30 | GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL, /* Source peripheral to destination peripheral - destination peripheral control */ |
| embeddedartists | 0:6b68dac0d986 | 31 | GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL, /* Memory to peripheral - peripheral control */ |
| embeddedartists | 0:6b68dac0d986 | 32 | GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL, /* Peripheral to memory - peripheral control */ |
| embeddedartists | 0:6b68dac0d986 | 33 | GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL, /* Source peripheral to destination peripheral - source peripheral control */ |
| embeddedartists | 0:6b68dac0d986 | 34 | } gpdma_flowControl_t; |
| embeddedartists | 0:6b68dac0d986 | 35 | |
| embeddedartists | 0:6b68dac0d986 | 36 | /** |
| embeddedartists | 0:6b68dac0d986 | 37 | * @brief Initialize the GPDMA |
| embeddedartists | 0:6b68dac0d986 | 38 | * @param pGPDMA : The base of GPDMA on the chip |
| embeddedartists | 0:6b68dac0d986 | 39 | * @return Nothing |
| embeddedartists | 0:6b68dac0d986 | 40 | */ |
| embeddedartists | 0:6b68dac0d986 | 41 | void gpdma_init(); |
| embeddedartists | 0:6b68dac0d986 | 42 | |
| embeddedartists | 0:6b68dac0d986 | 43 | /** |
| embeddedartists | 0:6b68dac0d986 | 44 | * @brief Shutdown the GPDMA |
| embeddedartists | 0:6b68dac0d986 | 45 | * @param pGPDMA : The base of GPDMA on the chip |
| embeddedartists | 0:6b68dac0d986 | 46 | * @return Nothing |
| embeddedartists | 0:6b68dac0d986 | 47 | */ |
| embeddedartists | 0:6b68dac0d986 | 48 | void gpdma_deinit(); |
| embeddedartists | 0:6b68dac0d986 | 49 | |
| embeddedartists | 0:6b68dac0d986 | 50 | /** |
| embeddedartists | 0:6b68dac0d986 | 51 | * @brief Stop a stream DMA transfer |
| embeddedartists | 0:6b68dac0d986 | 52 | * @param ChannelNum : Channel Number to be closed |
| embeddedartists | 0:6b68dac0d986 | 53 | * @return Nothing |
| embeddedartists | 0:6b68dac0d986 | 54 | */ |
| embeddedartists | 0:6b68dac0d986 | 55 | void gpdma_stop(uint8_t ChannelNum); |
| embeddedartists | 0:6b68dac0d986 | 56 | |
| embeddedartists | 0:6b68dac0d986 | 57 | /** |
| embeddedartists | 0:6b68dac0d986 | 58 | * @brief The GPDMA stream interrupt status checking |
| embeddedartists | 0:6b68dac0d986 | 59 | * @param ChannelNum : Channel Number to be checked on interruption |
| embeddedartists | 0:6b68dac0d986 | 60 | * @return Status: |
| embeddedartists | 0:6b68dac0d986 | 61 | * - true : DMA transfer success |
| embeddedartists | 0:6b68dac0d986 | 62 | * - false : DMA transfer failed |
| embeddedartists | 0:6b68dac0d986 | 63 | */ |
| embeddedartists | 0:6b68dac0d986 | 64 | bool gpdma_interrupt(uint8_t ChannelNum); |
| embeddedartists | 0:6b68dac0d986 | 65 | |
| embeddedartists | 0:6b68dac0d986 | 66 | /** |
| embeddedartists | 0:6b68dac0d986 | 67 | * @brief Get a free GPDMA channel for one DMA connection |
| embeddedartists | 0:6b68dac0d986 | 68 | * @param pCh : Assigned channel number (only valid if success) |
| embeddedartists | 0:6b68dac0d986 | 69 | * @return Status: |
| embeddedartists | 0:6b68dac0d986 | 70 | * - true : Found a free DMA channel |
| embeddedartists | 0:6b68dac0d986 | 71 | * - false : No free DMA channels, pCh value is undefined |
| embeddedartists | 0:6b68dac0d986 | 72 | */ |
| embeddedartists | 0:6b68dac0d986 | 73 | bool gpdma_getFreeChannel(uint8_t* pCh); |
| embeddedartists | 0:6b68dac0d986 | 74 | |
| embeddedartists | 0:6b68dac0d986 | 75 | /** |
| embeddedartists | 0:6b68dac0d986 | 76 | * @brief Do a DMA transfer M2M, M2P,P2M or P2P |
| embeddedartists | 0:6b68dac0d986 | 77 | * @param ChannelNum : Channel used for transfer |
| embeddedartists | 0:6b68dac0d986 | 78 | * @param src : Address of Memory or PeripheralConnection_ID which is the source |
| embeddedartists | 0:6b68dac0d986 | 79 | * @param dst : Address of Memory or PeripheralConnection_ID which is the destination |
| embeddedartists | 0:6b68dac0d986 | 80 | * @param TransferType: Select the transfer controller and the type of transfer. Should be: |
| embeddedartists | 0:6b68dac0d986 | 81 | * - GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA |
| embeddedartists | 0:6b68dac0d986 | 82 | * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA |
| embeddedartists | 0:6b68dac0d986 | 83 | * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA |
| embeddedartists | 0:6b68dac0d986 | 84 | * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA |
| embeddedartists | 0:6b68dac0d986 | 85 | * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL |
| embeddedartists | 0:6b68dac0d986 | 86 | * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL |
| embeddedartists | 0:6b68dac0d986 | 87 | * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL |
| embeddedartists | 0:6b68dac0d986 | 88 | * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL |
| embeddedartists | 0:6b68dac0d986 | 89 | * @param Size : The number of DMA transfers |
| embeddedartists | 0:6b68dac0d986 | 90 | * @return False on error, true on success |
| embeddedartists | 0:6b68dac0d986 | 91 | */ |
| embeddedartists | 0:6b68dac0d986 | 92 | //bool gpdma_transfer(uint8_t ChannelNum, |
| embeddedartists | 0:6b68dac0d986 | 93 | // uint32_t src, |
| embeddedartists | 0:6b68dac0d986 | 94 | // uint32_t dst, |
| embeddedartists | 0:6b68dac0d986 | 95 | // gpdma_flowControl_t TransferType, |
| embeddedartists | 0:6b68dac0d986 | 96 | // uint32_t Size); |
| embeddedartists | 0:6b68dac0d986 | 97 | |
| embeddedartists | 0:6b68dac0d986 | 98 | bool gpdma_transfer_to_mci(uint8_t ChannelNum, |
| embeddedartists | 0:6b68dac0d986 | 99 | uint32_t src, |
| embeddedartists | 0:6b68dac0d986 | 100 | uint32_t Size); |
| embeddedartists | 0:6b68dac0d986 | 101 | bool gpdma_transfer_from_mci(uint8_t ChannelNum, |
| embeddedartists | 0:6b68dac0d986 | 102 | uint32_t dst, |
| embeddedartists | 0:6b68dac0d986 | 103 | uint32_t Size); |
| embeddedartists | 0:6b68dac0d986 | 104 | #endif |
| embeddedartists | 0:6b68dac0d986 | 105 | |
| embeddedartists | 0:6b68dac0d986 | 106 |
