<div dir="ltr">Hi<div><br></div><div>I wrote a handy application helper named the Regulator (movie sounds there). It was designed to address a customer's challenge where they had a bursty input where immediately sending those bursts led to overflowing the destination. But there was plenty of time between bursts to deliver and process if the data flow rate was regulated. From the README</div><div><br></div><div>"The regulator library supports accepting an input stream of
messages from a source and metering those to a destination sink. The
regulator assumes that the input stream contains sporadic bursts of data
which can exceed the output rate of the sink. However, if the messages
are metered to the destination in a regulated fashion, an overflow of
the receiver can be avoided. The input buffering required to manage
the maximum burst as well as the metering rate for the output shall be
configurable. The regulator provides a configuration capability to allow
for adaptation to different message streams. The regulator also supports
multiple instances which could be used on independent message streams."</div><div><br></div><div>The API is generally named and source code written per RTEMS conventions although I'd need to add rtems_ prefix in places. It is written using Classic API objects. There is 100% source and branch level test coverage. The APIs are:</div><div><br></div><div>+ regulator_create<br></div><div>+ regulator_delete<br></div><div>+ regulator_obtain_buffer<br></div><div>+ regulator_release_buffer<br></div><div>+ regulator_send<br></div><div><br></div><div>The user provides configuration information and a "delivery function". The regulation of the data flow is independent of the source and sink.</div><div><br></div><div>All resources are pre-allocated at regulator instance create time. A regulator instance can be used in a way which avoids adding an extra data copy when using this.</div><div><br></div><div>I've attached the header file which should explain the APIs and usage.</div><div><br></div><div>I'd like feedback on this being added as cpukit/regulator. I think it's a nice solution to a recurring issue faced in embedded systems.</div><div><br></div><div>Thanks.<br><br>--joel</div></div>