A library with drivers for different peripherals on the LPC4088 QuickStart Board or related add-on boards.

Dependencies:   FATFileSystem

Dependents:   bare

Fork of EALib by EmbeddedArtists AB

Committer:
koiamk
Date:
Thu Mar 27 22:43:39 2014 +0000
Revision:
13:64f3dd338612
Parent:
12:15597e45eea0
o;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 12:15597e45eea0 1 /*
embeddedartists 12:15597e45eea0 2 * Copyright 2013 Embedded Artists AB
embeddedartists 12:15597e45eea0 3 *
embeddedartists 12:15597e45eea0 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 12:15597e45eea0 5 * you may not use this file except in compliance with the License.
embeddedartists 12:15597e45eea0 6 * You may obtain a copy of the License at
embeddedartists 12:15597e45eea0 7 *
embeddedartists 12:15597e45eea0 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 12:15597e45eea0 9 *
embeddedartists 12:15597e45eea0 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 12:15597e45eea0 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 12:15597e45eea0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 12:15597e45eea0 13 * See the License for the specific language governing permissions and
embeddedartists 12:15597e45eea0 14 * limitations under the License.
embeddedartists 12:15597e45eea0 15 */
embeddedartists 0:0fdadbc3d852 16
embeddedartists 0:0fdadbc3d852 17 #ifndef GPDMA_H
embeddedartists 0:0fdadbc3d852 18 #define GPDMA_H
embeddedartists 0:0fdadbc3d852 19
embeddedartists 0:0fdadbc3d852 20 #include "platform.h"
embeddedartists 0:0fdadbc3d852 21
embeddedartists 0:0fdadbc3d852 22 #define GPDMA_CONN_SDC ((1UL)) /*!< SD card */
embeddedartists 0:0fdadbc3d852 23
embeddedartists 0:0fdadbc3d852 24 typedef enum
embeddedartists 0:0fdadbc3d852 25 {
embeddedartists 0:0fdadbc3d852 26 GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA, /* Memory to memory - DMA control */
embeddedartists 0:0fdadbc3d852 27 GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA, /* Memory to peripheral - DMA control */
embeddedartists 0:0fdadbc3d852 28 GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA, /* Peripheral to memory - DMA control */
embeddedartists 0:0fdadbc3d852 29 GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA, /* Source peripheral to destination peripheral - DMA control */
embeddedartists 0:0fdadbc3d852 30 GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL, /* Source peripheral to destination peripheral - destination peripheral control */
embeddedartists 0:0fdadbc3d852 31 GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL, /* Memory to peripheral - peripheral control */
embeddedartists 0:0fdadbc3d852 32 GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL, /* Peripheral to memory - peripheral control */
embeddedartists 0:0fdadbc3d852 33 GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL, /* Source peripheral to destination peripheral - source peripheral control */
embeddedartists 0:0fdadbc3d852 34 } gpdma_flowControl_t;
embeddedartists 0:0fdadbc3d852 35
embeddedartists 0:0fdadbc3d852 36 /**
embeddedartists 0:0fdadbc3d852 37 * @brief Initialize the GPDMA
embeddedartists 0:0fdadbc3d852 38 * @param pGPDMA : The base of GPDMA on the chip
embeddedartists 0:0fdadbc3d852 39 * @return Nothing
embeddedartists 0:0fdadbc3d852 40 */
embeddedartists 0:0fdadbc3d852 41 void gpdma_init();
embeddedartists 0:0fdadbc3d852 42
embeddedartists 0:0fdadbc3d852 43 /**
embeddedartists 0:0fdadbc3d852 44 * @brief Shutdown the GPDMA
embeddedartists 0:0fdadbc3d852 45 * @param pGPDMA : The base of GPDMA on the chip
embeddedartists 0:0fdadbc3d852 46 * @return Nothing
embeddedartists 0:0fdadbc3d852 47 */
embeddedartists 0:0fdadbc3d852 48 void gpdma_deinit();
embeddedartists 0:0fdadbc3d852 49
embeddedartists 0:0fdadbc3d852 50 /**
embeddedartists 0:0fdadbc3d852 51 * @brief Stop a stream DMA transfer
embeddedartists 0:0fdadbc3d852 52 * @param ChannelNum : Channel Number to be closed
embeddedartists 0:0fdadbc3d852 53 * @return Nothing
embeddedartists 0:0fdadbc3d852 54 */
embeddedartists 0:0fdadbc3d852 55 void gpdma_stop(uint8_t ChannelNum);
embeddedartists 0:0fdadbc3d852 56
embeddedartists 0:0fdadbc3d852 57 /**
embeddedartists 0:0fdadbc3d852 58 * @brief The GPDMA stream interrupt status checking
embeddedartists 0:0fdadbc3d852 59 * @param ChannelNum : Channel Number to be checked on interruption
embeddedartists 0:0fdadbc3d852 60 * @return Status:
embeddedartists 0:0fdadbc3d852 61 * - true : DMA transfer success
embeddedartists 0:0fdadbc3d852 62 * - false : DMA transfer failed
embeddedartists 0:0fdadbc3d852 63 */
embeddedartists 0:0fdadbc3d852 64 bool gpdma_interrupt(uint8_t ChannelNum);
embeddedartists 0:0fdadbc3d852 65
embeddedartists 0:0fdadbc3d852 66 /**
embeddedartists 0:0fdadbc3d852 67 * @brief Get a free GPDMA channel for one DMA connection
embeddedartists 0:0fdadbc3d852 68 * @param pCh : Assigned channel number (only valid if success)
embeddedartists 0:0fdadbc3d852 69 * @return Status:
embeddedartists 0:0fdadbc3d852 70 * - true : Found a free DMA channel
embeddedartists 0:0fdadbc3d852 71 * - false : No free DMA channels, pCh value is undefined
embeddedartists 0:0fdadbc3d852 72 */
embeddedartists 0:0fdadbc3d852 73 bool gpdma_getFreeChannel(uint8_t* pCh);
embeddedartists 0:0fdadbc3d852 74
embeddedartists 0:0fdadbc3d852 75 /**
embeddedartists 0:0fdadbc3d852 76 * @brief Do a DMA transfer M2M, M2P,P2M or P2P
embeddedartists 0:0fdadbc3d852 77 * @param ChannelNum : Channel used for transfer
embeddedartists 0:0fdadbc3d852 78 * @param src : Address of Memory or PeripheralConnection_ID which is the source
embeddedartists 0:0fdadbc3d852 79 * @param dst : Address of Memory or PeripheralConnection_ID which is the destination
embeddedartists 0:0fdadbc3d852 80 * @param TransferType: Select the transfer controller and the type of transfer. Should be:
embeddedartists 0:0fdadbc3d852 81 * - GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA
embeddedartists 0:0fdadbc3d852 82 * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA
embeddedartists 0:0fdadbc3d852 83 * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA
embeddedartists 0:0fdadbc3d852 84 * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA
embeddedartists 0:0fdadbc3d852 85 * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL
embeddedartists 0:0fdadbc3d852 86 * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL
embeddedartists 0:0fdadbc3d852 87 * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL
embeddedartists 0:0fdadbc3d852 88 * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL
embeddedartists 0:0fdadbc3d852 89 * @param Size : The number of DMA transfers
embeddedartists 0:0fdadbc3d852 90 * @return False on error, true on success
embeddedartists 0:0fdadbc3d852 91 */
embeddedartists 0:0fdadbc3d852 92 //bool gpdma_transfer(uint8_t ChannelNum,
embeddedartists 0:0fdadbc3d852 93 // uint32_t src,
embeddedartists 0:0fdadbc3d852 94 // uint32_t dst,
embeddedartists 0:0fdadbc3d852 95 // gpdma_flowControl_t TransferType,
embeddedartists 0:0fdadbc3d852 96 // uint32_t Size);
embeddedartists 0:0fdadbc3d852 97
embeddedartists 0:0fdadbc3d852 98 bool gpdma_transfer_to_mci(uint8_t ChannelNum,
embeddedartists 0:0fdadbc3d852 99 uint32_t src,
embeddedartists 0:0fdadbc3d852 100 uint32_t Size);
embeddedartists 0:0fdadbc3d852 101 bool gpdma_transfer_from_mci(uint8_t ChannelNum,
embeddedartists 0:0fdadbc3d852 102 uint32_t dst,
embeddedartists 0:0fdadbc3d852 103 uint32_t Size);
embeddedartists 0:0fdadbc3d852 104 #endif
embeddedartists 0:0fdadbc3d852 105
embeddedartists 0:0fdadbc3d852 106