foxsi / foxsi-4matter

Code for FOXSI-4 formatter.
https://foxsi.umn.edu/
1 stars 3 forks source link

Should `System` include all system-specific configuration information? #36

Closed thanasipantazides closed 1 year ago

thanasipantazides commented 1 year ago

Current status

LineInterface creates a bunch of System objects with communication/commanding-related members (particularly for SpaceWire-based systems). LineInterface also creates several std::unordered_map<>s to lookup timing information, endpoint (Ethernet interface) information, etc for each System::hex value.

The buffer issue #27 necessitate more std::unordered_map<>s for looking up packet size limits (MTUs), System-specific packet buffers, etc. So I'm thinking it may be nice just to do these things:

To do

thanasipantazides commented 1 year ago

Also related to #27, how does this affect use of RingBufferInterface map by TransportLayerMachine? Is there an extension of PacketFramer that obviates RingBufferInterface, or do we need both?

thanasipantazides commented 1 year ago

Re: RingBufferInterface and PacketFramer: would just need to add two fields:

  1. PacketFramer::start_address or PacketFramer::remote_buffer_offset to track the start point of remote ring buffer memory, and
  2. PacketFramer::remote_buffer_size or something to track the length of the System's ring buffer.
thanasipantazides commented 1 year ago

In the current implementation of PacketFramer, could get the desired RingBufferInterface-like behavior by accessing PacketFramer.system.ring_params. But would need to manage iteration through remote memory in calling context, i.e. a TransportLayerMachine::handle_cmd() or something should check the write pointer and iterate through read positions.

This is assuming the PacketFramer/RingBufferInterface is used for single-frame reads. The original intention of RingBufferInterface was to facilitate reading multiple frames in a batch. That responsibility is also delegated to the calling context in the current PacketFramer implementation.