A library with drivers for different peripherals on the LPC4088 QuickStart Board or related add-on boards.
Dependencies: FATFileSystem
Fork of EALib by
gpdma.h@0:0fdadbc3d852, 2013-09-26 (annotated)
- Committer:
- embeddedartists
- Date:
- Thu Sep 26 06:37:02 2013 +0000
- Revision:
- 0:0fdadbc3d852
- Child:
- 12:15597e45eea0
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:0fdadbc3d852 | 1 | |
embeddedartists | 0:0fdadbc3d852 | 2 | #ifndef GPDMA_H |
embeddedartists | 0:0fdadbc3d852 | 3 | #define GPDMA_H |
embeddedartists | 0:0fdadbc3d852 | 4 | |
embeddedartists | 0:0fdadbc3d852 | 5 | #include "platform.h" |
embeddedartists | 0:0fdadbc3d852 | 6 | |
embeddedartists | 0:0fdadbc3d852 | 7 | #define GPDMA_CONN_SDC ((1UL)) /*!< SD card */ |
embeddedartists | 0:0fdadbc3d852 | 8 | |
embeddedartists | 0:0fdadbc3d852 | 9 | typedef enum |
embeddedartists | 0:0fdadbc3d852 | 10 | { |
embeddedartists | 0:0fdadbc3d852 | 11 | GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA, /* Memory to memory - DMA control */ |
embeddedartists | 0:0fdadbc3d852 | 12 | GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA, /* Memory to peripheral - DMA control */ |
embeddedartists | 0:0fdadbc3d852 | 13 | GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA, /* Peripheral to memory - DMA control */ |
embeddedartists | 0:0fdadbc3d852 | 14 | GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA, /* Source peripheral to destination peripheral - DMA control */ |
embeddedartists | 0:0fdadbc3d852 | 15 | GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL, /* Source peripheral to destination peripheral - destination peripheral control */ |
embeddedartists | 0:0fdadbc3d852 | 16 | GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL, /* Memory to peripheral - peripheral control */ |
embeddedartists | 0:0fdadbc3d852 | 17 | GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL, /* Peripheral to memory - peripheral control */ |
embeddedartists | 0:0fdadbc3d852 | 18 | GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL, /* Source peripheral to destination peripheral - source peripheral control */ |
embeddedartists | 0:0fdadbc3d852 | 19 | } gpdma_flowControl_t; |
embeddedartists | 0:0fdadbc3d852 | 20 | |
embeddedartists | 0:0fdadbc3d852 | 21 | /** |
embeddedartists | 0:0fdadbc3d852 | 22 | * @brief Initialize the GPDMA |
embeddedartists | 0:0fdadbc3d852 | 23 | * @param pGPDMA : The base of GPDMA on the chip |
embeddedartists | 0:0fdadbc3d852 | 24 | * @return Nothing |
embeddedartists | 0:0fdadbc3d852 | 25 | */ |
embeddedartists | 0:0fdadbc3d852 | 26 | void gpdma_init(); |
embeddedartists | 0:0fdadbc3d852 | 27 | |
embeddedartists | 0:0fdadbc3d852 | 28 | /** |
embeddedartists | 0:0fdadbc3d852 | 29 | * @brief Shutdown the GPDMA |
embeddedartists | 0:0fdadbc3d852 | 30 | * @param pGPDMA : The base of GPDMA on the chip |
embeddedartists | 0:0fdadbc3d852 | 31 | * @return Nothing |
embeddedartists | 0:0fdadbc3d852 | 32 | */ |
embeddedartists | 0:0fdadbc3d852 | 33 | void gpdma_deinit(); |
embeddedartists | 0:0fdadbc3d852 | 34 | |
embeddedartists | 0:0fdadbc3d852 | 35 | /** |
embeddedartists | 0:0fdadbc3d852 | 36 | * @brief Stop a stream DMA transfer |
embeddedartists | 0:0fdadbc3d852 | 37 | * @param ChannelNum : Channel Number to be closed |
embeddedartists | 0:0fdadbc3d852 | 38 | * @return Nothing |
embeddedartists | 0:0fdadbc3d852 | 39 | */ |
embeddedartists | 0:0fdadbc3d852 | 40 | void gpdma_stop(uint8_t ChannelNum); |
embeddedartists | 0:0fdadbc3d852 | 41 | |
embeddedartists | 0:0fdadbc3d852 | 42 | /** |
embeddedartists | 0:0fdadbc3d852 | 43 | * @brief The GPDMA stream interrupt status checking |
embeddedartists | 0:0fdadbc3d852 | 44 | * @param ChannelNum : Channel Number to be checked on interruption |
embeddedartists | 0:0fdadbc3d852 | 45 | * @return Status: |
embeddedartists | 0:0fdadbc3d852 | 46 | * - true : DMA transfer success |
embeddedartists | 0:0fdadbc3d852 | 47 | * - false : DMA transfer failed |
embeddedartists | 0:0fdadbc3d852 | 48 | */ |
embeddedartists | 0:0fdadbc3d852 | 49 | bool gpdma_interrupt(uint8_t ChannelNum); |
embeddedartists | 0:0fdadbc3d852 | 50 | |
embeddedartists | 0:0fdadbc3d852 | 51 | /** |
embeddedartists | 0:0fdadbc3d852 | 52 | * @brief Get a free GPDMA channel for one DMA connection |
embeddedartists | 0:0fdadbc3d852 | 53 | * @param pCh : Assigned channel number (only valid if success) |
embeddedartists | 0:0fdadbc3d852 | 54 | * @return Status: |
embeddedartists | 0:0fdadbc3d852 | 55 | * - true : Found a free DMA channel |
embeddedartists | 0:0fdadbc3d852 | 56 | * - false : No free DMA channels, pCh value is undefined |
embeddedartists | 0:0fdadbc3d852 | 57 | */ |
embeddedartists | 0:0fdadbc3d852 | 58 | bool gpdma_getFreeChannel(uint8_t* pCh); |
embeddedartists | 0:0fdadbc3d852 | 59 | |
embeddedartists | 0:0fdadbc3d852 | 60 | /** |
embeddedartists | 0:0fdadbc3d852 | 61 | * @brief Do a DMA transfer M2M, M2P,P2M or P2P |
embeddedartists | 0:0fdadbc3d852 | 62 | * @param ChannelNum : Channel used for transfer |
embeddedartists | 0:0fdadbc3d852 | 63 | * @param src : Address of Memory or PeripheralConnection_ID which is the source |
embeddedartists | 0:0fdadbc3d852 | 64 | * @param dst : Address of Memory or PeripheralConnection_ID which is the destination |
embeddedartists | 0:0fdadbc3d852 | 65 | * @param TransferType: Select the transfer controller and the type of transfer. Should be: |
embeddedartists | 0:0fdadbc3d852 | 66 | * - GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA |
embeddedartists | 0:0fdadbc3d852 | 67 | * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA |
embeddedartists | 0:0fdadbc3d852 | 68 | * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA |
embeddedartists | 0:0fdadbc3d852 | 69 | * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA |
embeddedartists | 0:0fdadbc3d852 | 70 | * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL |
embeddedartists | 0:0fdadbc3d852 | 71 | * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL |
embeddedartists | 0:0fdadbc3d852 | 72 | * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL |
embeddedartists | 0:0fdadbc3d852 | 73 | * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL |
embeddedartists | 0:0fdadbc3d852 | 74 | * @param Size : The number of DMA transfers |
embeddedartists | 0:0fdadbc3d852 | 75 | * @return False on error, true on success |
embeddedartists | 0:0fdadbc3d852 | 76 | */ |
embeddedartists | 0:0fdadbc3d852 | 77 | //bool gpdma_transfer(uint8_t ChannelNum, |
embeddedartists | 0:0fdadbc3d852 | 78 | // uint32_t src, |
embeddedartists | 0:0fdadbc3d852 | 79 | // uint32_t dst, |
embeddedartists | 0:0fdadbc3d852 | 80 | // gpdma_flowControl_t TransferType, |
embeddedartists | 0:0fdadbc3d852 | 81 | // uint32_t Size); |
embeddedartists | 0:0fdadbc3d852 | 82 | |
embeddedartists | 0:0fdadbc3d852 | 83 | bool gpdma_transfer_to_mci(uint8_t ChannelNum, |
embeddedartists | 0:0fdadbc3d852 | 84 | uint32_t src, |
embeddedartists | 0:0fdadbc3d852 | 85 | uint32_t Size); |
embeddedartists | 0:0fdadbc3d852 | 86 | bool gpdma_transfer_from_mci(uint8_t ChannelNum, |
embeddedartists | 0:0fdadbc3d852 | 87 | uint32_t dst, |
embeddedartists | 0:0fdadbc3d852 | 88 | uint32_t Size); |
embeddedartists | 0:0fdadbc3d852 | 89 | #endif |
embeddedartists | 0:0fdadbc3d852 | 90 | |
embeddedartists | 0:0fdadbc3d852 | 91 |