mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-01 02:56:34 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -21,54 +21,52 @@
|
|||
|
||||
#include "buffer_exchange.hpp"
|
||||
|
||||
BufferExchange* BufferExchange::obj { nullptr };
|
||||
BufferExchange* BufferExchange::obj{nullptr};
|
||||
|
||||
BufferExchange::BufferExchange(
|
||||
CaptureConfig* const config
|
||||
) // : config_capture { config }
|
||||
CaptureConfig* const config) // : config_capture { config }
|
||||
{
|
||||
obj = this;
|
||||
// In capture mode, baseband wants empty buffers, app waits for full buffers
|
||||
fifo_buffers_for_baseband = config->fifo_buffers_empty;
|
||||
fifo_buffers_for_application = config->fifo_buffers_full;
|
||||
obj = this;
|
||||
// In capture mode, baseband wants empty buffers, app waits for full buffers
|
||||
fifo_buffers_for_baseband = config->fifo_buffers_empty;
|
||||
fifo_buffers_for_application = config->fifo_buffers_full;
|
||||
}
|
||||
|
||||
BufferExchange::BufferExchange(
|
||||
ReplayConfig* const config
|
||||
) // : config_replay { config }
|
||||
ReplayConfig* const config) // : config_replay { config }
|
||||
{
|
||||
obj = this;
|
||||
// In replay mode, baseband wants full buffers, app waits for empty buffers
|
||||
fifo_buffers_for_baseband = config->fifo_buffers_full;
|
||||
fifo_buffers_for_application = config->fifo_buffers_empty;
|
||||
obj = this;
|
||||
// In replay mode, baseband wants full buffers, app waits for empty buffers
|
||||
fifo_buffers_for_baseband = config->fifo_buffers_full;
|
||||
fifo_buffers_for_application = config->fifo_buffers_empty;
|
||||
}
|
||||
|
||||
BufferExchange::~BufferExchange() {
|
||||
obj = nullptr;
|
||||
fifo_buffers_for_baseband = nullptr;
|
||||
fifo_buffers_for_application = nullptr;
|
||||
obj = nullptr;
|
||||
fifo_buffers_for_baseband = nullptr;
|
||||
fifo_buffers_for_application = nullptr;
|
||||
}
|
||||
|
||||
StreamBuffer* BufferExchange::get(FIFO<StreamBuffer*>* fifo) {
|
||||
while(true) {
|
||||
StreamBuffer* p { nullptr };
|
||||
fifo->out(p);
|
||||
|
||||
if( p ) {
|
||||
return p;
|
||||
}
|
||||
while (true) {
|
||||
StreamBuffer* p{nullptr};
|
||||
fifo->out(p);
|
||||
|
||||
// Put thread to sleep, woken up by M4 IRQ
|
||||
chSysLock();
|
||||
thread = chThdSelf();
|
||||
chSchGoSleepS(THD_STATE_SUSPENDED);
|
||||
chSysUnlock();
|
||||
}
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
// Put thread to sleep, woken up by M4 IRQ
|
||||
chSysLock();
|
||||
thread = chThdSelf();
|
||||
chSchGoSleepS(THD_STATE_SUSPENDED);
|
||||
chSysUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
StreamBuffer* BufferExchange::get_prefill(FIFO<StreamBuffer*>* fifo) {
|
||||
StreamBuffer* p { nullptr };
|
||||
fifo->out(p);
|
||||
|
||||
return p;
|
||||
StreamBuffer* p{nullptr};
|
||||
fifo->out(p);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue