AnsweredAssumed Answered

PE DMA modify address adjustment at runtime

Question asked by Andrew Parlane on Nov 8, 2014
Latest reply on Nov 10, 2014 by Andrew Parlane

Hi,

 

I'm setting up my project using PE. I have a UART, DMA controller, 2 DMA channels, etc... I can transmit data using DMA and receive it. However I haven't found a decent way of transmitting a variable amount of bytes. Say my DMA TX buffer is 512 bytes, and I want to send a 20 byte packet, I need to change the request count size, which is easy to do using: UART_TX_DMA_SetRequestCount(). However I also want to change the "after transfer complete source address adjustment" to go back to the beginning of my buffer.

 

I could do this manually, IE. disable this option in PE, and when I receive my dma complete event, change the source address using UART_TX_DMA_SetSourceAddress(). Or I can change the address adjust manually using register writes: DMA_TCD4_SLAST = DMA_SLAST_SLAST(0-size); (note this may be the wrong code to use, I can't test it until Monday). However this makes the assumption that I'm using DMA Channel 4 for this. Which is fine until I change that and forget to change this line of code.

 

I would like to be able to do one of:

1) UART_TX_DMA_SetAfterTransferSourceAddressAdjust(..., 0-size);

2) DMA_SLAST_REG(DMA_BASE_PTR, UART_TX_DMA_CHANNEL_NUM) = DMA_SLAST_SLAST(0-size); // Note the CHANNEL_NUM define doesn't exist like this. I could try and get access to the DMAController_TChnInit struct and get the logical channel number, and from the physical channel number, but that's quite messy, and that data is largely defined in .c files Including the DMAController_TDevConst struct, which would make it a bit nasty to get the info.

 

Am I missing something? Or is PE missing this feature?

 

Using KDS 1.1.0, PE 1.1.0.RT6_b1428-0121, windows 7.

 

Thanks,

Andy

Outcomes