Hi
NorthGuy,
I like your idea.
I can also ask:
C:
if (W >= (5120) ) //5120 = 5K = Half Buffer's Size
{
W = 0;
TriggerDma;
}
My fear is that I may write an entire half buffer, before
(W >= 5120), and in this case, I'd be in a problem.
I think of another way which I'd like to get your opinion on.
Currently, I do:
Code:
A = R - Address_Of_Half_Buffer
if (signbit != Expected_sign_bit)
{
Excpected_sign ^= 1; //According the the signbit, I know whether to transfer the lower of higher half of the Buffer
TriggerDma;
}
Now, I think of:
- When I'm in the first half of the buffer, I'd compare the
R P
ointer with address of 1/4 of the Buffer
- When I'm in the second half of the buffer, I'd compare the
R Pointer with the address of 3/4 of the Buffer
That way, only when I reach 3/4 of the Buffer, I'd transfer the first half of the Buffer, and that way I'd lower the chances that I didn't manage to complete a message in the first half of the buffer, before instructing the DMA to transfer the first half to the Large Buffer.
Additionally, the DMA transfers data much faster than I fill 1/4 of the 10KB Buffer.
What do you think of it?
I didn't figure out yet how to do it efficiently though, do you have a suggestion please?
Thank you very much!