Update version of EALib.
Dependencies: FATFileSystem
Fork of EALib by
Diff: gpdma.h
- Revision:
- 0:0fdadbc3d852
- Child:
- 12:15597e45eea0
diff -r 000000000000 -r 0fdadbc3d852 gpdma.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpdma.h Thu Sep 26 06:37:02 2013 +0000 @@ -0,0 +1,91 @@ + +#ifndef GPDMA_H +#define GPDMA_H + +#include "platform.h" + +#define GPDMA_CONN_SDC ((1UL)) /*!< SD card */ + +typedef enum +{ + GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA, /* Memory to memory - DMA control */ + GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA, /* Memory to peripheral - DMA control */ + GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA, /* Peripheral to memory - DMA control */ + GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA, /* Source peripheral to destination peripheral - DMA control */ + GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL, /* Source peripheral to destination peripheral - destination peripheral control */ + GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL, /* Memory to peripheral - peripheral control */ + GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL, /* Peripheral to memory - peripheral control */ + GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL, /* Source peripheral to destination peripheral - source peripheral control */ +} gpdma_flowControl_t; + +/** + * @brief Initialize the GPDMA + * @param pGPDMA : The base of GPDMA on the chip + * @return Nothing + */ +void gpdma_init(); + +/** + * @brief Shutdown the GPDMA + * @param pGPDMA : The base of GPDMA on the chip + * @return Nothing + */ +void gpdma_deinit(); + +/** + * @brief Stop a stream DMA transfer + * @param ChannelNum : Channel Number to be closed + * @return Nothing + */ +void gpdma_stop(uint8_t ChannelNum); + +/** + * @brief The GPDMA stream interrupt status checking + * @param ChannelNum : Channel Number to be checked on interruption + * @return Status: + * - true : DMA transfer success + * - false : DMA transfer failed + */ +bool gpdma_interrupt(uint8_t ChannelNum); + +/** + * @brief Get a free GPDMA channel for one DMA connection + * @param pCh : Assigned channel number (only valid if success) + * @return Status: + * - true : Found a free DMA channel + * - false : No free DMA channels, pCh value is undefined + */ +bool gpdma_getFreeChannel(uint8_t* pCh); + +/** + * @brief Do a DMA transfer M2M, M2P,P2M or P2P + * @param ChannelNum : Channel used for transfer + * @param src : Address of Memory or PeripheralConnection_ID which is the source + * @param dst : Address of Memory or PeripheralConnection_ID which is the destination + * @param TransferType: Select the transfer controller and the type of transfer. Should be: + * - GPDMA_TRANSFERTYPE_M2M_CONTROLLER_DMA + * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA + * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA + * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DMA + * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_DestPERIPHERAL + * - GPDMA_TRANSFERTYPE_M2P_CONTROLLER_PERIPHERAL + * - GPDMA_TRANSFERTYPE_P2M_CONTROLLER_PERIPHERAL + * - GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL + * @param Size : The number of DMA transfers + * @return False on error, true on success + */ +//bool gpdma_transfer(uint8_t ChannelNum, +// uint32_t src, +// uint32_t dst, +// gpdma_flowControl_t TransferType, +// uint32_t Size); + +bool gpdma_transfer_to_mci(uint8_t ChannelNum, + uint32_t src, + uint32_t Size); +bool gpdma_transfer_from_mci(uint8_t ChannelNum, + uint32_t dst, + uint32_t Size); +#endif + +