static __attribute__((noreturn)) msg_t baseband_fn(void *arg) { (void)arg; chRegSetThreadName("baseband"); BasebandStatsCollector stats; while(true) { // TODO: Place correct sampling rate into buffer returned here: const auto buffer_tmp = baseband::dma::wait_for_rx_buffer(); const buffer_c8_t buffer { buffer_tmp.p, buffer_tmp.count, baseband_configuration.sampling_rate }; if( baseband_processor ) { baseband_processor->execute(buffer); } stats.process(buffer, [](const BasebandStatistics statistics) { BasebandStatisticsMessage message; message.statistics = statistics; shared_memory.application_queue.push(message); } ); } }
void BasebandThread::run() { baseband_sgpio.init(); baseband::dma::init(); const auto baseband_buffer = std::make_unique<std::array<baseband::sample_t, 8192>>(); baseband::dma::configure( baseband_buffer->data(), direction() ); //baseband::dma::allocate(4, 2048); BasebandStatsCollector stats { chSysGetIdleThread(), thread_main, thread_rssi, chThdSelf() }; while(true) { // TODO: Place correct sampling rate into buffer returned here: const auto buffer_tmp = baseband::dma::wait_for_rx_buffer(); if( buffer_tmp ) { buffer_c8_t buffer { buffer_tmp.p, buffer_tmp.count, baseband_configuration.sampling_rate }; if( baseband_processor ) { baseband_processor->execute(buffer); } stats.process(buffer, [](const BasebandStatistics& statistics) { const BasebandStatisticsMessage message { statistics }; shared_memory.application_queue.push(message); } ); } } }