mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-25 13:57:26 +00:00
POCSAG address filter now ignores alpha messages
Experimenting with FIFOs for replay...
This commit is contained in:
@@ -21,17 +21,32 @@
|
||||
|
||||
#include "buffer_exchange.hpp"
|
||||
|
||||
// DEBUG:
|
||||
#include "hackrf_gpio.hpp"
|
||||
using namespace hackrf::one;
|
||||
|
||||
BufferExchange* BufferExchange::obj { nullptr };
|
||||
|
||||
BufferExchange::BufferExchange(
|
||||
CaptureConfig* const config
|
||||
) : config { config }
|
||||
) // : config_capture { config }
|
||||
{
|
||||
obj = this;
|
||||
direction = CAPTURE;
|
||||
fifo_buffers_for_baseband = config->fifo_buffers_empty;
|
||||
fifo_buffers_for_application = config->fifo_buffers_full;
|
||||
}
|
||||
|
||||
BufferExchange::BufferExchange(
|
||||
ReplayConfig* const config
|
||||
) // : config_replay { config }
|
||||
{
|
||||
obj = this;
|
||||
direction = REPLAY;
|
||||
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;
|
||||
@@ -42,6 +57,9 @@ StreamBuffer* BufferExchange::get(FIFO<StreamBuffer*>* fifo) {
|
||||
while(true) {
|
||||
StreamBuffer* p { nullptr };
|
||||
fifo->out(p);
|
||||
|
||||
led_tx.on(); // DEBUG
|
||||
|
||||
if( p ) {
|
||||
return p;
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@
|
||||
class BufferExchange {
|
||||
public:
|
||||
BufferExchange(CaptureConfig* const config);
|
||||
BufferExchange(ReplayConfig* const config);
|
||||
~BufferExchange();
|
||||
|
||||
BufferExchange(const BufferExchange&) = delete;
|
||||
@@ -72,16 +73,25 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
CaptureConfig* const config;
|
||||
//CaptureConfig* const config_capture;
|
||||
//ReplayConfig* const config_replay;
|
||||
FIFO<StreamBuffer*>* fifo_buffers_for_baseband { nullptr };
|
||||
FIFO<StreamBuffer*>* fifo_buffers_for_application { nullptr };
|
||||
Thread* thread { nullptr };
|
||||
static BufferExchange* obj;
|
||||
|
||||
enum {
|
||||
CAPTURE,
|
||||
REPLAY
|
||||
} direction { };
|
||||
|
||||
void check_fifo_isr() {
|
||||
if( !empty() ) {
|
||||
//if (!empty() && (direction == CAPTURE)) {
|
||||
if (!empty())
|
||||
wakeup_isr();
|
||||
}
|
||||
//} else if (!empty() && (direction == REPLAY)) {
|
||||
// wakeup_isr();
|
||||
//}
|
||||
}
|
||||
|
||||
void wakeup_isr() {
|
||||
|
@@ -458,10 +458,21 @@ public:
|
||||
used_ += copy_size;
|
||||
return copy_size;
|
||||
}
|
||||
|
||||
size_t read(void* p, const size_t count) {
|
||||
const auto copy_size = std::min(used_, count);
|
||||
memcpy(p, &data_[used_ - copy_size], copy_size);
|
||||
used_ -= copy_size;
|
||||
return copy_size;
|
||||
}
|
||||
|
||||
bool is_full() const {
|
||||
return used_ >= capacity_;
|
||||
}
|
||||
|
||||
bool is_empty() const {
|
||||
return used_ == 0;
|
||||
}
|
||||
|
||||
void* data() const {
|
||||
return data_;
|
||||
@@ -525,7 +536,7 @@ public:
|
||||
struct ReplayConfig {
|
||||
const size_t read_size;
|
||||
const size_t buffer_count;
|
||||
uint64_t baseband_bytes_sent;
|
||||
uint64_t baseband_bytes_received;
|
||||
FIFO<StreamBuffer*>* fifo_buffers_empty;
|
||||
FIFO<StreamBuffer*>* fifo_buffers_full;
|
||||
|
||||
@@ -534,7 +545,7 @@ struct ReplayConfig {
|
||||
const size_t buffer_count
|
||||
) : read_size { read_size },
|
||||
buffer_count { buffer_count },
|
||||
baseband_bytes_sent { 0 },
|
||||
baseband_bytes_received { 0 },
|
||||
fifo_buffers_empty { nullptr },
|
||||
fifo_buffers_full { nullptr }
|
||||
{
|
||||
|
Reference in New Issue
Block a user