I have a project that uses HeapBuff as data in/out....my device receives a lot of data from another device. My device has to take the data and send them to another device. I use Memory_alloc/Memory_free (heapBuff) to process Input/output.
I have defined HeapBuff(16blocks) so if the flow of data input is faster than data output, then I will add blocks of data, otherwise I take the head free the memory and re-alloc when i receive the new data.
Everything works fine when the input_speed is <= output_speed, which is the normal condition. Now I have to manage the situation when input_speed>output_speed. My list is a FIFO so I have to take the head of the list and the next block will become the new head.
I am trying to figure out if there is a why to shift the blocks down one (buffer_size) after I took the head so I don't have to shift all the blocks one by one.
Ok let me generalize the question a bit more...if I Malloc_free a block inside the HeapBuff(lets say the head for instance), is there a "easy" way to shift all the blocks which are after the block I took so I can keep the HeapBuff blocks contiguous ?