|
From: | Tom Rondeau |
Subject: | Re: [Discuss-gnuradio] Liquid DSP Flexframe and GNU Radio |
Date: | Tue, 26 Jul 2016 21:19:30 -0400 |
Hello,
I have sent this to the list once before, but I did not see it show up on the index so I am assuming it did not work after waiting some time.
I am attempting to embed the liquid DSP flexframe protocol in a custom GNU Radio block. I am doing this by extending the out-of-tree module that Tom Rondeau recently worked on. I am writing a block that embeds the flexframegen and another that embeds a flexframesync. Since these blocks tend to produce a varying amount of symbols depending on the coding scheme or modulation, I wrote it as a general block. You can see the current version of the code at my own fork
I am currently having trouble with the generator and occasionally the sync block as well. However, for the generator, I am getting a return code -11 (I assume a seg fault) when I attempt to copy a generated frame to the out buffer and run this in GNURadioCompanion. This often happens after attempting to copy ~16000 gr_complex items to the outbuffer. Is there a problems with that amount? Here is my work function code:
{
unsigned int buf_len = 1000;
unsigned int payload_len = 4096;
unsigned char header[14]; // Liquid hardcodes this as the length for the header
unsigned char payload[4096];
unsigned char *in = (unsigned char *) input_items[0];
unsigned char *inbuf = in;
gr_complex *out = (gr_complex *) output_items[0];
gr_complex *outbuf = (gr_complex *) malloc(buf_len*sizeof(gr_complex));
gr_complex *front = out;
int byte_count = 0;
unsigned char frame_count;
unsigned int total_items = 0;
int frame_complete = 0;
// Make header
for(int i = 1; i < 14; i++) header[i] = i;
while(byte_count < ((int) ninput_items[0]) - payload_len) {
header[0] = frame_count;
frame_count > 255 ? frame_count = 0 : frame_count++;
memcpy(payload, inbuf, payload_len);
inbuf += payload_len;
byte_count += payload_len;
// Assemble the frame
while (!flexframegen_is_assembled(d_fg)) {
flexframegen_assemble(d_fg, header, payload, payload_len);
}
// Make the frame in blocks
frame_complete = 0;
while (!frame_complete){
frame_complete = flexframegen_write_samples(d_fg, outbuf, buf_len);
memcpy(front, outbuf, buf_len*sizeof(gr_complex));
front += buf_len;
total_items += buf_len;
}
// Get frame length
}
free(outbuf);
consume_each (total_items);
// Tell runtime system how many output items we produced.
return total_items;
}Any ideas? Thanks for any help.
_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
[Prev in Thread] | Current Thread | [Next in Thread] |