Skip to content

Commit

Permalink
access.direct.demultiplexer: introduce soft_flush
Browse files Browse the repository at this point in the history
flush() ensures that all written data has been sent to the device.
soft_flush() on the other hand ensures that all written data has been
queued as USB URBs, but does not wait for them to complete.

Use soft_flush() to ensure that every last byte of queued data will
make it to the device in a timely manner, without stalling the entire
USB transfer pipeline.
  • Loading branch information
marcan committed Jul 19, 2019
1 parent da553ad commit 80ff1c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion software/glasgow/access/direct/demultiplexer.py
Expand Up @@ -297,7 +297,7 @@ async def write(self, data):
len(self._out_tasks) < _xfers_per_queue:
self._out_tasks.submit(self._out_task(self._out_slice()))

async def flush(self):
async def soft_flush(self, soft=False):
self.logger.trace("FIFO: flush")

# First, we ensure we can submit one more task. (There can be more tasks than
Expand All @@ -316,4 +316,6 @@ async def flush(self):
data += self._out_buffer.read()
self._out_tasks.submit(self._out_task(data))

async def flush(self, soft=False):
await self.soft_flush()
await self._out_tasks.wait_all()

0 comments on commit 80ff1c5

Please sign in to comment.