F´ Flight Software - C/C++ Documentation
NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
|
BufferManager
is a passive ISF component. It allocates and deallocates variable-sized buffers from a fixed-size store.
Requirement | Description | Rationale | Verification Method |
---|---|---|---|
ISF-BM-001 | BufferManager shall maintain a fixed-size store and shall provide a callee port on which another component may request and receive variable-size buffers allocated from the store. | This requirement provides variable-sized buffers that may be passed between components by reference. Such buffers are useful for transferring large data items of varying length, such as file packets and images. For such data items, a fixed-size buffer such as Fw::ComBuffer is not practical. | Test |
ISF-BM-002 | BufferManager shall provide an input port on which a component that has been given a buffer may return the buffer for deallocation. | Deallocation prevents the fixed-size store from becoming exhausted. Note that the component returning the buffer is generally the receiver, while the component requesting the buffer is generally the sender. See the sequence diagram below. | Test |
The design of BufferManager
assumes the following:
BufferManager
has some maximum number of outstanding allocations, set at component initialization, that is never exceeded.BufferManager
has a fixed size, set at component initialization. This fixed size is never exceeded by the outstanding allocations.Name | Type | Role |
---|---|---|
timeCaller | Fw::Time | TimeGet |
tlmOut | Fw::Tlm | Telemetry |
eventOut | Fw::LogEvent | LogEvent |
Name | Type | Kind | Purpose |
---|---|---|---|
bufferSendIn | Fw::BufferSend | guarded input | Receives buffers for deallocation |
bufferGetCallee | Fw::BufferGet | guarded input (callee) | Receives requests for allocated buffers and returns the buffers |
BufferManager
maintains the following constants, initialized when the component is instantiated:
BufferManager
maintains the following state:
The identifiers I are 32-bit unsigned integers.
When BufferManager
receives a request for a buffer of size s on bufferGetCallee, it carries out the following steps:
Otherwise
a. Assert that the size s' of allocationQueue is less than or equal to allocationQueueDepth.
b. If *s' = allocationQueueDepth*, then issue an *AllocationQueueFull*
event and return an invalid buffer.
c. Otherwise 1. Create a fresh identifier *I*. 2. Compute the pointer *P* that points to byte [*freeIndex*](#freeIndex) of [*store*](#store). 3. Create an allocation queue entry *E = (I, s)*. 4. Push *E* onto the front of [*allocationQueue*](#allocationQueue). 5. Increase [*freeIndex*](#freeIndex) by *s*. 6. Create and return a valid
Fw::Buffer
with managerID
equal to the instance number of this component, bufferID
equal to I, data
equal to P, and size
equal to s.
When BufferManager
receives notification of a free buffer on bufferSendIn, it carries out the following steps:
Otherwise
a. Pull an entry *(I, s)* off the back of the queue.
b. If I matches the identifier provided in the free notification, then decrease freeIndex by s.
c. Otherwise issue an *IDMismatch* event.
The following sequence diagram shows the procedure for sending a buffer from one component to another:
bufferGetCallee
port of BufferManager
.bufferSendIn
port of BufferManager
for deallocation.Dictionaries: HTML MD
Document | Link |
---|---|
Design | Link |
Code | Link |
Unit Test | Link |
TODO