How to send a big file as a packet of each 16KB size through gpif2 interface?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
amjoc_3854616
Level 3
Level 3

Hi,

I need to send data through GPIF2 interface. For every 16KB of data i need to add header to it and send it through the P-Port.

Fx3 is used as a master and 32 bit GPIF2 interface is designed.

Example code used : AN87216 - Designing a GPIF2 Master Interface.

I was able to add header at the beginning but not able to add header at every 16KB of data?

What are the procedures to be followed for having the callback triggered for every 16KB of data sent? 

0 Likes
1 Solution
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

You can do the following:

1. Configure your DMA  channel buffer size to be 16KB by changing the following:

channelConfig.size           = 16KB

2. Configure the header size as following:

channelConfig.prodHeader     =  (Your header size) //let's say it is 10

I hope your DMA channel is configured as Manual (Since you need to add headers in the firmware)

If the configuration is as above,

After GPIF fills the DMA buffer with (16KB - 10bytes) of data, a Producer event will be generated which is seen in DMACallback.

Now while handling the Producer event in DMACallback, the header can be appended.

In this way for every buffer you can add header and commit it to USB.

For clear understanding of what is explained above, please go through the document and source code of AN75779

In AN75779 a MutilChannelDMA would be created (but for your requirement you can just focus on how the buffer sizes are configured and how the headers are getting added in dmaCallback.

Regards,

Hemanth

Hemanth

View solution in original post

0 Likes
2 Replies
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

You can do the following:

1. Configure your DMA  channel buffer size to be 16KB by changing the following:

channelConfig.size           = 16KB

2. Configure the header size as following:

channelConfig.prodHeader     =  (Your header size) //let's say it is 10

I hope your DMA channel is configured as Manual (Since you need to add headers in the firmware)

If the configuration is as above,

After GPIF fills the DMA buffer with (16KB - 10bytes) of data, a Producer event will be generated which is seen in DMACallback.

Now while handling the Producer event in DMACallback, the header can be appended.

In this way for every buffer you can add header and commit it to USB.

For clear understanding of what is explained above, please go through the document and source code of AN75779

In AN75779 a MutilChannelDMA would be created (but for your requirement you can just focus on how the buffer sizes are configured and how the headers are getting added in dmaCallback.

Regards,

Hemanth

Hemanth
0 Likes

Hi,

Thanks for your reply.

I'll look into the document and come back if there is any further doubts.

0 Likes