Fix 8b10b word count issue
This commit is contained in:
parent
f33f46edb9
commit
392b93306f
|
@ -66,22 +66,26 @@ namespace gr {
|
|||
const int *erasures_ref;
|
||||
size_t erasures_len;
|
||||
|
||||
pmt::pmt_t pmt_data = pmt::dict_ref(m, pmt::mp("pdu"), pmt::PMT_NIL);
|
||||
pmt::pmt_t pmt_erasures = pmt::dict_ref(m, pmt::mp("erasures"),
|
||||
pmt::pmt_t pmt_data = pmt::dict_ref(m, pmt::intern("data"), pmt::PMT_NIL);
|
||||
pmt::pmt_t pmt_erasures = pmt::dict_ref(m, pmt::intern("erasures"),
|
||||
pmt::PMT_NIL);
|
||||
if (pmt::equal (pmt::PMT_NIL, pmt_data)
|
||||
|| pmt::equal (pmt::PMT_NIL, pmt_erasures)) {
|
||||
if (pmt::equal (pmt::PMT_NIL, pmt_data)) {
|
||||
LOG_ERROR("Invalid message format.");
|
||||
}
|
||||
|
||||
data_ref = pmt::u8vector_elements(pmt_data, data_len);
|
||||
memcpy(data, data_ref, data_len);
|
||||
|
||||
if( pmt::equal (pmt::PMT_NIL, pmt_erasures)) {
|
||||
decode_rs_ccsds(data, NULL, 0, (int)(255 - data_len));
|
||||
}
|
||||
else {
|
||||
erasures_len = pmt::blob_length(pmt_erasures);
|
||||
erasures_ref = pmt::s32vector_elements(pmt_erasures, erasures_len);
|
||||
memcpy(erasures, erasures_ref, erasures_len * sizeof(int));
|
||||
|
||||
decode_rs_ccsds(data, erasures, (int)erasures_len, (int)(255 - data_len));
|
||||
decode_rs_ccsds(data, erasures, (int)erasures_len,
|
||||
(int)(255 - data_len));
|
||||
}
|
||||
message_port_pub(pmt::mp("pdu"), pmt::make_blob(data, 223));
|
||||
}
|
||||
|
||||
|
|
|
@ -191,15 +191,19 @@ namespace gr
|
|||
d_word_cnt++;
|
||||
|
||||
|
||||
if(d_word_cnt == d_max_frame_len) {
|
||||
if(d_word_cnt == d_max_frame_len / 10) {
|
||||
d_state = IN_SYNC;
|
||||
pmt::pmt_t data = pmt::init_u8vector (d_max_frame_len / 10,
|
||||
d_8b_words);
|
||||
|
||||
pmt::pmt_t out = pmt::make_dict();
|
||||
if (d_erasure_cnt > 0) {
|
||||
pmt::pmt_t erasures = pmt::init_s32vector (d_erasure_cnt,
|
||||
d_erasures_indexes);
|
||||
pmt::pmt_t out = pmt::make_dict();
|
||||
pmt::dict_add(out, pmt::mp("pdu"), data);
|
||||
pmt::dict_add(out, pmt::mp("erasures"), erasures);
|
||||
out = pmt::dict_add (out, pmt::intern ("erasures"), erasures);
|
||||
}
|
||||
out = pmt::dict_add(out, pmt::intern("data"), data);
|
||||
|
||||
|
||||
message_port_pub (pmt::mp ("pdu"), out);
|
||||
return (i+1) * 10;
|
||||
|
|
Loading…
Reference in New Issue