Rx: refactor memory structure and listener (#496)

* gui message doesnt show if it has a '>' symbol in error msg

* minor refactoring for readability (size_t calc fifo size)

* refactoring listening udp socket code: activated and datastream dont create udp sockets anyway, rc<=- should be discarded in any case

* wip

* refactoring memory structure access

* wip: bugfix write header + data to binary

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* portRoi no roi effecto on progress

* fail at receiver progress, wip

* segfaults for char pointer in struct

* reference to header to get header and data

* refactoring

* use const defined for size of header of fifo

* updated release notes

* refactoring from review: fwrite, static_cast
This commit is contained in:
Dhanya Thattil
2022-07-22 15:32:41 +02:00
committed by GitHub
parent 26cbfbdb30
commit 4117cda79b
18 changed files with 469 additions and 668 deletions

View File

@ -17,7 +17,7 @@
namespace sls {
Fifo::Fifo(int ind, uint32_t fifoItemSize, uint32_t depth)
Fifo::Fifo(int ind, size_t fifoItemSize, uint32_t depth)
: index(ind), memory(nullptr), fifoBound(nullptr), fifoFree(nullptr),
fifoStream(nullptr), fifoDepth(depth), status_fifoBound(0),
status_fifoFree(depth) {
@ -30,7 +30,7 @@ Fifo::~Fifo() {
DestroyFifos();
}
void Fifo::CreateFifos(uint32_t fifoItemSize) {
void Fifo::CreateFifos(size_t fifoItemSize) {
LOG(logDEBUG3) << __SHORT_AT__ << " called";
// destroy if not already
@ -41,7 +41,7 @@ void Fifo::CreateFifos(uint32_t fifoItemSize) {
fifoFree = new CircularFifo<char>(fifoDepth);
fifoStream = new CircularFifo<char>(fifoDepth);
// allocate memory
size_t mem_len = (size_t)fifoItemSize * (size_t)fifoDepth * sizeof(char);
size_t mem_len = fifoItemSize * (size_t)fifoDepth * sizeof(char);
memory = (char *)malloc(mem_len);
if (memory == nullptr) {
throw RuntimeError("Could not allocate memory for fifos");