📄 gtdma_dy4.h
字号:
#define SOURCE_ADDR_IN_PCI0 BIT21#define SOURCE_ADDR_IN_PCI1 BIT22#define DEST_ADDR_IN_PCI0 BIT23#define DEST_ADDR_IN_PCI1 BIT24#define REC_ADDR_IN_PCI0 BIT25#define REC_ADDR_IN_PCI1 BIT26#define REQ_FROM_TIMER_COUNTER BIT28#define REQ_FROM_MPP_PIN BIT28#define OLD_DESCRIPTOR_MODE NO_BIT#define NEW_DESCRIPTOR_MODE BIT31/* * Function prototypes: *//******************************************************************************* gtDmaRestoreDescEndian - restores the endianess of a DMA descriptor chain * that was used by gtDmaTransfer2.** DESCRIPTION:* This function is used to un-byte swap the words of a descriptor chain* after the gtDmaTransfer2 function has used them. The gtDmaTransfer2* cannot restore the descriptor chain since the DMA engine could still* be using them. The endianess of DMA descriptor chain elements only * needs to be restored if the processor intends to manipulate them after* a DMA transaction. ** NOTE:* This function cannot be called until the DMA completion interrupt has* been received. Doing so before could cause the DMA engine try and use* illegal addresses.* * INPUT:* pNextRecordPointer - pointer to the "next" record used in the call* to gtDmaTransfer2.* * OUTPUT:* None.** RETURN:* true on success, false on erroneous parameter..********************************************************************************/DMA_STATUS gtDmaRestoreDescEndian(DMA_RECORD *pNextRecordPointer);/******************************************************************************** gtDmaTransfer2 - Transfer data from sourceAddr to destAddr on one of the 4* DMA channels.* DESCRIPTION:* NOTES:* 1) When using the chain mode feature,the records must be 16* Bytes aligned. It is the user responsibility to make sure * they are a 16 Bytes aligned. This Function will not try* to align the records and returns an error when misaligned.* 2) If using the override feature ( source or destination* address over PCI ) windows 1 and 2 must be allocated for* PCI0 and PCI1 respectively before using this function.* Window 3 must be ignored !!!!* 3) DMA_DTL_8BYTES was intentionally defined as BIT1 from backwords* compatibility reasons although its defined differently in the* datasheet.if using different DTL on source and destination ,use* the DMA_DTL_8BYTES ( if needed) as is , the function will take* care of the rest for you.* INPUT:* engine - Select one of the four available DMA engines.* sourceAddr - The source address on which the transfer will begin.* destAddr - The destination address on which the transfer will move the* data.* numOfBytes - The total number of bytes to transfer.* command - The command selects different operation mode of the DMA* engine such as different DTL , source/destination address* override and so ( for more details please refer to the GT's* datasheet ).The command can be combined with the | operator.* *pNextRecordPointer - If we are using chain mode DMA transfer,* then this pointer should point to the next record,* otherwise it should be NULL.** OUTPUT:* DMA transfer.** RETURN:* DMA_NO_SUCH_CHANNEL if channel does not exist,* DMA_CHANNEL_BUSY if channel is active.* DMA_OK if the transfer ended successfully.** EXAMPLE:* Performing a chain mode DMA transfer(Copy a 1/4 mega of data using* chain mode DMA) with different DTLs for source and destination:** DMA_RECORD gtDmaRecordArray[3];* gtDmaRecordArray[0].ByteCnt = _64KB;* gtDmaRecordArray[0].DestAdd = destAddress + _64KB;* gtDmaRecordArray[0].SrcAdd = sourceAddress + _64KB;* gtDmaRecordArray[0].NextRecPtr = >DmaRecordArray[1];* gtDmaRecordArray[1].ByteCnt = _64KB;* gtDmaRecordArray[1].DestAdd = destAddress + 2*_64KB;* gtDmaRecordArray[1].SrcAdd = sourceAddress + 2*_64KB;* gtDmaRecordArray[1].NextRecPtr = >DmaRecordArray[2];* gtDmaRecordArray[2].ByteCnt = _64KB;* gtDmaRecordArray[2].DestAdd = destAddress + 3*_64KB;* gtDmaRecordArray[2].SrcAdd = sourceAddress + 3*_64KB;* gtDmaRecordArray[2].NextRecPtr = NULL;** gtDmaTransfer(DMA_ENG_0,sourceAddress,destAddress,_64KB,* DMA_BLOCK_TRANSFER_MODE | DMA_DTL_8BYTES | DMA_DEST_DTL_16BYTES,* >DmaRecordArray[0]);** See Also: "dy4182/src/demo/unsupported/chainDma.c".*******************************************************************************/DMA_STATUS gtDmaTransfer2 (DMA_ENGINE engine,unsigned int sourceAddr, unsigned int destAddr,unsigned int numOfBytes, unsigned int command,DMA_RECORD * nextRecordPointer);/******************************************************************************** gtDmaTransfer - Legacy DMA function. If backward compatability is not * required please use gtDmaTransfer2.* Transfer data from sourceAddr to destAddr on one of the 4* DMA channels.* DESCRIPTION:* NOTES:* 1) When using the chain mode feature,the records must be 16* Bytes aligned. If the records reside on the system local* memory,the function will take care of that for you but you need* to allocate one more record for that , meaning: if you are* having 3 records ,declare 4 (see the example bellow) and start* using the second one.If the records reside over PCI0/1 , it is* the user responsibility to make sure thay are a 16 Bytes* aligned.* 2) If using the override feature ( source or destination* address over PCI ) windows 1 and 2 must be allocated for* PCI0 and PCI1 respectively before using this function.* Window 3 must be ignored !!!!* 3) DMA_DTL_8BYTES was intentionally defined as BIT1 from backwords* compatibility reasons although its defined differently in the* datasheet.if using different DTL on source and destination ,use* the DMA_DTL_8BYTES ( if needed) as is , the function will take* care of the rest for you.* NOTE: 4) In Chain Mode this function requires descriptor fields to be byte* swapped to little Endian except for the NextRecPtr feild.** INPUT:* engine - Select one of the four available DMA engines.* sourceAddr - The source address on which the transfer will begin.* destAddr - The destination address on which the transfer will move the* data.* numOfBytes - The total number of bytes to transfer.* command - The command selects different operation mode of the DMA* engine such as different DTL , source/destination address* override and so ( for more details please refer to the GT's* datasheet ).The command can be combined with the | operator.* *pNextRecordPointer - If we are using chain mode DMA transfer,* then this pointer should point to the next record,* otherwise it should be NULL.*** OUTPUT:* DMA transfer.** RETURN:* DMA_NO_SUCH_CHANNEL if channel does not exist,* DMA_CHANNEL_BUSY if channel is active.* DMA_OK if the transfer ended successfully.** EXAMPLE:* Performing a chain mode DMA transfer is shown in the demo code.* See "dy4182/src/demo/unsupported/chainDma_legacy.c".********************************************************************************/DMA_STATUS gtDmaTransfer (DMA_ENGINE engine, unsigned int sourceAddr, unsigned int destAddr, unsigned int numOfBytes, unsigned int command, DMA_RECORD *pNextRecordPointer);/******************************************************************************** gtDmaIsActive - Checks if a engine is busy.** DESCRIPTION:* This function checks whether a given DMA engine ('engine' parameter)* is active or not .Usefull for polling on a DMA engine to check if its* still working.** INPUT:* engine - One of the possible engines as defind in gtDma.h** OUTPUT:* None.** RETURN:* DMA_CHANNEL_IDLE - If the engine is idle.* DMA_CHANNEL_BUSY - If the engine is busy.* DMA_NO_SUCH_CHANNEL - If there is no such engine.********************************************************************************/DMA_STATUS gtDmaIsActive(DMA_ENGINE channel);/******************************************************************************** gtDmaControl - Writes a command to a DMA engine.** DESCRIPTION:* This function writes a command to a specific DMA engine.* The command defines the mode in which the engine will work in.* There are several commands and thay are all defind in gtDma.h.* It is possible to combine several commands using the or ( | ) operation.* NOTE:* This function will not enable the DMA transfer unless the* CHANNEL_ENABLE command is combined within the command parameter.** INPUT:* engine - One of the possible engines as defind in gtDma.h* command - The command to be written to the given engine number .* All possible Values are defined in gtDma.h and can be for* example (for more details please refer to the MV data sheet* in the IDMA section):** - DMA_HOLD_SOURCE_ADDR.* - DMA_HOLD_DEST_ADDR.* - DMA_DTL_8BYTES* - DMA_DTL_16BYTES.* etc.* OUTPUT:* None.** RETURN:* true on success, false on erroneous parameter..********************************************************************************/bool gtDmaControl (DMA_ENGINE channel,unsigned int command);/******************************************************************************** gtDmaDisable - Halts the dma engine activity.** DESCRIPTION:* This function halts a DMA engine number delivered by 'engine' parameter.* The engine will abort even if not all the transfer is completed.** INPUT:* engine - One of the possible engines as defind in gtDma.h** OUTPUT:* DMA engine aborted.** RETURN:* True on success , false on erroneous parameter.********************************************************************************/bool gtDmaDisable(DMA_ENGINE engine);/******************************************************************************** gtDmaUpdateArbiter0_3 - Update the arbiter`s priority for all 4 engines.** INPUT:* pPriorityStruct - A priority Structure with 16 fields, each field* (slice) can be assigned to one of the DMA engines.** OUTPUT:* None.** RETURN:* false if one of the parameters is erroneous, true otherwise*******************************************************************************/bool gtDmaUpdateArbiter0_3(DMA_PIZZA0_3* prio0_3);#ifdef GT64260bool gtDmaUpdateArbiter4_7(DMA_PIZZA4_7* prio4_7);/* * Performs DMA transfer according to: Engine, Byte Count,source & destination * Addresses and a pointer to the first descriptor (chain mode) while source * and Destination DTL are configured by different bits */DMA_STATUS gtDmaTransferDifDTL (DMA_ENGINE engine,unsigned int sourceAddr, unsigned int destAddr,unsigned int numOfBytes, unsigned int command,DMA_RECORD * nextRecordPointer);#else/******************************************************************************** gtDmaSetMemorySpace - Set a DMA memory window for the DMA's address decoding* map.** DESCRIPTION:* the MV IDMA has its own address decoding map that is de-coupled* from the CPU interface address decoding windows. The four DMA channels* share eight address windows. Each region can be individually configured* by this function by associating it to a target interface and setting* base and size values.** INPUT:* memSpace - One of the possible memory spaces (defined in gtDma.h).* memSpaceTarget - The target interface to be associated with the* region (DRAM, PCI, devices...).* memSpaceAttr - Memory space attributes.The memory space attributes* differ in each memory space target (please see the* IDMA section in the MV spec for more details).* values for each memory space are defined in gtDma.h.* please note that you give the appropriate values to the* corresponding interface .* baseAddress - Memory space's base address.* size - Memory space's size. This function will decrement the* 'size' parameter by one and then check if the size* is valid. A valid size must be programed from LSB to* MSB as sequence of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -