- Main Page
- Modules
- Data Structures
- Files

Functions
DAT Functions
DAT

## Functions
CSL_DAT_Handle | DAT_open (CSL_DATChanNum chanNum, Uint16 chanPriority, CSL_DAT_ChannelObj *pDatChanObj, CSL_Status *status)
CSL_Status | DAT_close (CSL_DAT_Handle hDAT)
CSL_Status | DAT_copy (CSL_DAT_Handle hDAT, Uint32 srcAddr, Uint32 destAddr, Uint16 dataLength)
CSL_Status | DAT_fill (CSL_DAT_Handle hDAT, Uint32 destAddr, Uint16 dataLength, Uint32 *pdataValue)
CSL_Status | DAT_wait (CSL_DAT_Handle hDAT)

## Function Documentation

CSL_Status DAT_close | ( | CSL_DAT_Handle | hDAT | ) |

===========================================================================
DAT_close

Description
This function closes the specified handle to DAT.

Arguments

                hDAT            Handle to the DAT

Return Value CSL_Status

- CSL_SOK - Close successful
- CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
DAT_open() API must be called before this.

Post Condition
All the registers of this DMA channel will be reset.

Example

                CSL_status           status;
                CSL_DATChanNum       chanNum;
                Uint16               chanPriority;
                CSL_DAT_ChannelObj   pDatChanObj
                CSL_DAT_Handle       hDAT;
                ...
                chanNum = CSL_DAT_CHAN0;
                chanNum = CSL_DAT_CHAN_PRIORITY_HIGH;

                hDAT = DAT_open(chanNum, chanPriority, &pDatChanObj, &status);

                status = DAT_Close(hDAT);

===========================================================================

References CSL_DAT_ChannelObj::chanNum, CSL_DAT_ChannelObj::chanPrio, CSL_DAT_CHAN0, CSL_DAT_CHAN1, CSL_DAT_CHAN2, CSL_DAT_CHAN3, CSL_DAT_CHAN_INV, CSL_DAT_CHAN_PRIORITY_LOW, CSL_DAT_CHANNEL_FREE, CSL_DAT_ChannelObj::dmaRegs, and CSL_DAT_ChannelObj::isChanFree.

CSL_Status DAT_copy | ( | CSL_DAT_Handle | hDAT,
|  | Uint32 | srcAddr,
|  | Uint32 | destAddr,
|  | Uint16 | dataLength
| ) |  |

===========================================================================
DAT_copy

Description
It configures the DMA Controller registers of particular handle by some default values and trigger the transfer.

Arguments

                hDMA            Handle to the DMA.
                srcAddr         source location .
                destAddr        destination location .
                dataLength      length of data to transfer.

Return Value CSL_Status

- CSL_SOK - Hardware setup successful
- CSL_ESYS_BADHANDLE - Invalid handle
- CSL_ESYS_INVPARAMS - Parameters are invalid.

Pre Condition
DAT_open() API must be called before this.

Post Condition
DAT_wait() API must be called after this.

Example

          #define CSL_DAT_BUFFER_LENGTH 100

                CSL_DAT_ChannelObj   pDatChanObj
                CSL_DAT_Handle       hDAT;
                CSL_DAT_TxType       type;
                CSL_DATChanNum       chanNum;
                Uint16               chanPriority;
                Uint32               srcAddr;
                Uint32               destAddr;
                Uint16               dataLength;
                CSL_status           status;

    	 Uint16 srcBuffer[CSL_DAT_BUFFER_LENGTH]
    	 Uint16 destBuffer[CSL_DAT_BUFFER_LENGTH]
    	            ...
                chanNum = CSL_DAT_CHAN0;
                chanNum = CSL_DAT_CHAN_PRIORITY_HIGH;

                hDAT = DAT_open(chanNum, chanPriority, &pDatChanObj, &status);
                ...
                srcAddr      = srcBuffer;
                destAddr     = destBuffer;
                dataLength   = CSL_DAT_BUFFER_LENGTH;
                status = DAT_copy(hDAT, srcAddr, destAddr, dataLength);
                ...

===========================================================================

References CSL_DAT_ChannelObj::chanNum, CSL_DAT_CHAN0, CSL_DAT_CHAN1, CSL_DAT_CHAN2, CSL_DAT_CHAN3, CSL_DAT_CHANNEL_DISABLE, CSL_DAT_CHANNEL_ENABLE, CSL_DAT_TXBURST_WORD_LENGTH, CSL_DMA_ADDR_MODE_INCREMENT, CSL_DMA_ADDR_SHIFT, CSL_DMA_DARAM_ADDR_OFFSET, CSL_DMA_DARAM_END_ADDR, CSL_DMA_DARAM_START_ADDR, CSL_DMA_MIN_TX_SIZE, CSL_DMA_SARAM_ADDR_OFFSET, CSL_DMA_SARAM_END_ADDR, CSL_DMA_SARAM_START_ADDR, CSL_DMA_UINT16_MASK, CSL_DMA_UINT16_NUMBER_BITS, and CSL_DAT_ChannelObj::dmaRegs.

CSL_Status DAT_fill | ( | CSL_DAT_Handle | hDAT,
|  | Uint32 | destAddr,
|  | Uint16 | dataLength,
|  | Uint32 * | pdataValue
| ) |  |

===========================================================================
DAT_fill

Description
It configures the DMA Controller registers of particular handle by some default values and fill the destination location with passed data value.

Arguments

                hDMA            Handle to the DMA.
                destAddr        destination location.
                pdataValue      pointer to the data.
                dataLength      length of data to transfer.

Return Value CSL_Status

- CSL_SOK - Hardware setup successful
- CSL_ESYS_BADHANDLE - Invalid handle
- CSL_ESYS_INVPARAMS - Parameters are invalid.

Pre Condition
DAT_open() API must be called before this.

Post Condition
DAT_wait() API must be called after this.

Example

          #define CSL_DAT_BUFFER_LENGTH 100

                CSL_DAT_ChannelObj   pDatChanObj
                CSL_DAT_Handle       hDAT;
                CSL_DAT_TxType       type;
                CSL_DATChanNum       chanNum;
                Uint16               chanPriority;

                Uint32           srcAddr;
                Uint32           destAddr;
                Uint16           dataLength;
                CSL_status       status;
                Uint32           pdataValue;

     Uint16 destBuffer[CSL_DAT_BUFFER_LENGTH]
                ...
                chanNum = CSL_DAT_CHAN0;
                chanNum = CSL_DAT_CHAN_PRIORITY_HIGH;

                hDAT = DAT_open(chanNum, chanPriority, &pDatChanObj, &status);
                ...
                destAddr     = destBuffer;
                dataLength   = CSL_DAT_BUFFER_LENGTH;
                pdataValue   = 0xABCD;

                status = DAT_fill(hDAT, destAddr, dataLength, &pdataValue);
                ...

===========================================================================

References CSL_DAT_ChannelObj::chanNum, CSL_DAT_CHAN0, CSL_DAT_CHAN1, CSL_DAT_CHAN2, CSL_DAT_CHAN3, CSL_DAT_CHANNEL_DISABLE, CSL_DAT_CHANNEL_ENABLE, CSL_DAT_TXBURST_WORD_LENGTH, CSL_DMA_ADDR_MODE_FIXED, CSL_DMA_ADDR_MODE_INCREMENT, CSL_DMA_ADDR_SHIFT, CSL_DMA_DARAM_ADDR_OFFSET, CSL_DMA_DARAM_END_ADDR, CSL_DMA_DARAM_START_ADDR, CSL_DMA_MIN_TX_SIZE, CSL_DMA_SARAM_ADDR_OFFSET, CSL_DMA_SARAM_END_ADDR, CSL_DMA_SARAM_START_ADDR, CSL_DMA_UINT16_MASK, CSL_DMA_UINT16_NUMBER_BITS, and CSL_DAT_ChannelObj::dmaRegs.

CSL_DAT_Handle DAT_open | ( | CSL_DATChanNum | chanNum,
|  | Uint16 | chanPriority,
|  | CSL_DAT_ChannelObj * | pDatChanObj,
|  | CSL_Status * | status
| ) |  |

===========================================================================
DAT_open

Description
This function returns the handle to the DAT instance. This handle is passed to all other CSL APIs.

Arguments

                chanNum        channel number to use.
                chanPriority   channel priority.
                pDatChanObj    pointer to dat channel object.
                status         Status of the function call

Return Value CSL_DAT_Handle
Valid DAT handle will be returned if status value is equal to CSL_SOK.

Pre Condition
Before Calling this API User must configure the system control register to enabling the clock for DMA Controller.

Post Condition
1. The status is returned in the status variable. If status returned is

- CSL_SOK - Valid DAT handle is returned
- CSL_ESYS_INVPARAMS - Invalid parameter

Modifies
1. The status variable

Example

                CSL_status           status;
                CSL_DATChanNum       chanNum;
                Uint16               chanPriority;
                CSL_DAT_ChannelObj   pDatChanObj
                CSL_DAT_Handle       hDAT;
                ...
                chanNum = CSL_DAT_CHAN0;
                chanNum = CSL_DAT_CHAN_PRIORITY_HIGH;

                hDAT = DAT_open(chanNum, chanPriority, &pDatChanObj, &status);
                ...

===========================================================================

References CSL_DAT_ChannelObj::chanNum, CSL_DAT_ChannelObj::chanPrio, CSL_DAT_CHAN0, CSL_DAT_CHAN1, CSL_DAT_CHAN10, CSL_DAT_CHAN11, CSL_DAT_CHAN12, CSL_DAT_CHAN13, CSL_DAT_CHAN14, CSL_DAT_CHAN15, CSL_DAT_CHAN2, CSL_DAT_CHAN3, CSL_DAT_CHAN4, CSL_DAT_CHAN5, CSL_DAT_CHAN6, CSL_DAT_CHAN7, CSL_DAT_CHAN8, CSL_DAT_CHAN9, CSL_DAT_CHAN_INV, CSL_DAT_CHANNEL_BUSY, CSL_DAT_ENGINE0, CSL_DAT_ENGINE1, CSL_DAT_ENGINE2, CSL_DAT_ENGINE3, CSL_DAT_ChannelObj::datInstNum, CSL_DAT_ChannelObj::dmaRegs, and CSL_DAT_ChannelObj::isChanFree.

CSL_Status DAT_wait | ( | CSL_DAT_Handle | hDAT | ) |

===========================================================================
DAT_wait

Description
This function wait till the completion of Data Transfer.

Arguments

                hDAT            Handle to the DAT

Return Value CSL_Status

- CSL_SOK - Close successful
- CSL_ESYS_BADHANDLE - Invalid handle

Pre Condition
DAT_open() API must be called before this.

Post Condition
None

Example

          #define CSL_DAT_BUFFER_LENGTH 100

                CSL_DAT_ChannelObj   pDatChanObj
                CSL_DAT_Handle       hDAT;
                CSL_DAT_TxType       type;
                CSL_DATChanNum       chanNum;
                Uint16               chanPriority;

                Uint32           srcAddr;
                Uint32           destAddr;
                Uint16           dataLength;
                CSL_status       status;
                Uint32           pdataValue;

    	 Uint16 destBuffer[CSL_DAT_BUFFER_LENGTH]
                ...
                chanNum = CSL_DAT_CHAN0;
                chanNum = CSL_DAT_CHAN_PRIORITY_HIGH;

                hDAT = DAT_open(chanNum, chanPriority, &pDatChanObj, &status);
                ...
                destAddr     = destBuffer;
                dataLength   = CSL_DAT_BUFFER_LENGTH;
                pdataValue   = 0xABCD;

                status   = DAT_fill(hDAT, destAddr, dataLength, &pdataValue);

                status = DAT_wait(hDAT);

===========================================================================

References CSL_DAT_ChannelObj::chanNum, CSL_DAT_CHAN0, CSL_DAT_CHAN1, CSL_DAT_CHAN2, CSL_DAT_CHAN3, CSL_DAT_TIME_OUT, and CSL_DAT_ChannelObj::dmaRegs.