Serial Driver Buffer Management
Posted: Sat Jun 21, 2014 11:24 pm
Hi,
I have a need for a project to utilise 3 serialdrivers,but I have varying needs for the RX/TX Buffer sizes that will be used for them and don't have enough memory to just set the buffer size to be large for all SerialDriver objects.
Taking a look at the source code, I see the default buffer size for RX and TX are managed by a single #define variable, so in the current model there is no real way of setting these independently for RX/TX and/or on a SerialDriver by SerialDriver basis.
So this is a quick question as to what would be the recommended approach for adding this capability ?
Thought on options that come to mind:
1. Swap out SERIAL_BUFFERS_SIZE and make it SERIAL_BUFFERS_SIZE_RX & SERIAL_BUFFERS_SIZE_TX to save some memory - simple option.
2. Set buffer size to 1 and then replace dynamically after initialisation the input/output queue respectively and update variables indicating size within the SerialDriver SD1/SD2/SD3 objects as needed. Wastes a few bytes for the Queues that are no longer used, but allows for granular per driver configuration.
Recommendations ?
I have a need for a project to utilise 3 serialdrivers,but I have varying needs for the RX/TX Buffer sizes that will be used for them and don't have enough memory to just set the buffer size to be large for all SerialDriver objects.
Taking a look at the source code, I see the default buffer size for RX and TX are managed by a single #define variable, so in the current model there is no real way of setting these independently for RX/TX and/or on a SerialDriver by SerialDriver basis.
So this is a quick question as to what would be the recommended approach for adding this capability ?
Thought on options that come to mind:
1. Swap out SERIAL_BUFFERS_SIZE and make it SERIAL_BUFFERS_SIZE_RX & SERIAL_BUFFERS_SIZE_TX to save some memory - simple option.
2. Set buffer size to 1 and then replace dynamically after initialisation the input/output queue respectively and update variables indicating size within the SerialDriver SD1/SD2/SD3 objects as needed. Wastes a few bytes for the Queues that are no longer used, but allows for granular per driver configuration.
Recommendations ?