Create approximately fixed size packets
The effective DMA transfer bandwidth is higher for larger packets, however we are limited to 1 MB by buffer sizing. Given that we are currently sometimes suffering from a superfluous orbit slipping into a packet we shouldn't get close to the limit, but stick to e.g. 512 kb sized packets.
The idea is to fill a packet until current_size + 3564 BXs of frames > 512 kb
, i.e. we always want to stay below 512 kb, even if the next orbit were unsuppressed. The number of frames in the packet should then be put into the trailer so SCDAQ can perform a sanity check.
Edited by Dinyar Rabady