update to library version of M17_Implementations

main
Jean-Michel Friedt 2023-12-30 18:10:36 +01:00
parent 443cfb36ef
commit cf1b8b96fb
4 changed files with 133 additions and 385 deletions

View File

@ -14,10 +14,19 @@ include(GrPlatform) #define LIB_SUFFIX
list(APPEND m17_sources
m17_coder_impl.cc
m17_decoder_impl.cc
../M17_Implementations/SP5WWP/m17-coder/golay.c
../M17_Implementations/SP5WWP/m17-decoder/crc.c
../M17_Implementations/SP5WWP/m17-decoder/golay.c
../M17_Implementations/SP5WWP/m17-decoder/viterbi.c
../M17_Implementations/SP5WWP/lib/lib.c
../M17_Implementations/SP5WWP/lib/decode/symbols.c
../M17_Implementations/SP5WWP/lib/decode/viterbi.c
../M17_Implementations/SP5WWP/lib/encode/symbols.c
../M17_Implementations/SP5WWP/lib/encode/convol.c
../M17_Implementations/SP5WWP/lib/math/golay.c
../M17_Implementations/SP5WWP/lib/math/math.c
../M17_Implementations/SP5WWP/lib/math/rrc.c
../M17_Implementations/SP5WWP/lib/payload/call.c
../M17_Implementations/SP5WWP/lib/payload/crc.c
../M17_Implementations/SP5WWP/lib/phy/interleave.c
../M17_Implementations/SP5WWP/lib/phy/randomize.c
../M17_Implementations/SP5WWP/lib/phy/sync.c
)
set(m17_sources "${m17_sources}" PARENT_SCOPE)
@ -30,6 +39,7 @@ add_library(gnuradio-m17 SHARED ${m17_sources})
target_link_libraries(gnuradio-m17 gnuradio::gnuradio-runtime)
target_include_directories(gnuradio-m17
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../M17_Implementations/SP5WWP/lib>
PUBLIC $<INSTALL_INTERFACE:include>
)
set_target_properties(gnuradio-m17 PROPERTIES DEFINE_SYMBOL "gnuradio_m17_EXPORTS")

View File

@ -30,21 +30,21 @@
#include <stdint.h>
#include <unistd.h>
#include "../M17_Implementations/SP5WWP/inc/m17.h"
#include "../M17_Implementations/SP5WWP/m17-coder/golay.h"
#include "../M17_Implementations/SP5WWP/m17-coder/crc.h"
#include "../M17_Implementations/SP5WWP/lib/lib.h"
#include "../M17_Implementations/SP5WWP/lib/math/golay.h"
#include "../M17_Implementations/SP5WWP/lib/payload/crc.h"
#include "../M17_Implementations/SP5WWP/lib/encode/symbols.h"
#include "../M17_Implementations/SP5WWP/lib/phy/sync.h"
#include "../M17_Implementations/SP5WWP/lib/encode/convol.h"
#include "../M17_Implementations/SP5WWP/lib/payload/call.h"
#include "../M17_Implementations/SP5WWP/lib/payload/lsf.h"
#include "../M17_Implementations/SP5WWP/lib/phy/interleave.h"
#include "../M17_Implementations/SP5WWP/lib/phy/randomize.h"
namespace gr {
namespace m17 {
struct LSF
{
uint8_t dst[6];
uint8_t src[6];
uint8_t type[2];
uint8_t meta[112/8];
uint8_t crc[2];
} lsf;
struct LSF lsf;
void send_Preamble(const uint8_t type,float *out, int *counterout)
{
@ -80,6 +80,7 @@ void send_Preamble(const uint8_t type,float *out, int *counterout)
}
}
// now ../M17_Implementations/SP5WWP/lib/lib.c:void send_syncword(const uint16_t syncword)
void send_Syncword(const uint16_t sword, float *out, int *counterout)
{
float symb;
@ -93,198 +94,6 @@ void send_Syncword(const uint16_t sword, float *out, int *counterout)
}
}
//out - unpacked bits
//in - packed raw bits
//fn - frame number
void conv_Encode_Frame(uint8_t* out, uint8_t* in, uint16_t fn)
{
uint8_t pp_len = sizeof(P_2);
uint8_t p=0; //puncturing pattern index
uint16_t pb=0; //pushed punctured bits
uint8_t ud[144+4+4]; //unpacked data
memset(ud, 0, 144+4+4);
//unpack frame number
for(uint8_t i=0; i<16; i++)
{
ud[4+i]=(fn>>(15-i))&1;
}
//unpack data
for(uint8_t i=0; i<16; i++)
{
for(uint8_t j=0; j<8; j++)
{
ud[4+16+i*8+j]=(in[i]>>(7-j))&1;
}
}
//encode
for(uint8_t i=0; i<144+4; i++)
{
uint8_t G1=(ud[i+4] +ud[i+1]+ud[i+0])%2;
uint8_t G2=(ud[i+4]+ud[i+3]+ud[i+2] +ud[i+0])%2;
//printf("%d%d", G1, G2);
if(P_2[p])
{
out[pb]=G1;
pb++;
}
p++;
p%=pp_len;
if(P_2[p])
{
out[pb]=G2;
pb++;
}
p++;
p%=pp_len;
}
//printf("pb=%d\n", pb);
}
//out - unpacked bits
//in - packed raw bits (LSF struct)
void conv_Encode_LSF(uint8_t* out, struct LSF *in)
{
uint8_t pp_len = sizeof(P_1);
uint8_t p=0; //puncturing pattern index
uint16_t pb=0; //pushed punctured bits
uint8_t ud[240+4+4]; //unpacked data
memset(ud, 0, 240+4+4);
//unpack DST
for(uint8_t i=0; i<8; i++)
{
ud[4+i] =((in->dst[0])>>(7-i))&1;
ud[4+i+8] =((in->dst[1])>>(7-i))&1;
ud[4+i+16]=((in->dst[2])>>(7-i))&1;
ud[4+i+24]=((in->dst[3])>>(7-i))&1;
ud[4+i+32]=((in->dst[4])>>(7-i))&1;
ud[4+i+40]=((in->dst[5])>>(7-i))&1;
}
//unpack SRC
for(uint8_t i=0; i<8; i++)
{
ud[4+i+48]=((in->src[0])>>(7-i))&1;
ud[4+i+56]=((in->src[1])>>(7-i))&1;
ud[4+i+64]=((in->src[2])>>(7-i))&1;
ud[4+i+72]=((in->src[3])>>(7-i))&1;
ud[4+i+80]=((in->src[4])>>(7-i))&1;
ud[4+i+88]=((in->src[5])>>(7-i))&1;
}
//unpack TYPE
for(uint8_t i=0; i<8; i++)
{
ud[4+i+96] =((in->type[0])>>(7-i))&1;
ud[4+i+104]=((in->type[1])>>(7-i))&1;
}
//unpack META
for(uint8_t i=0; i<8; i++)
{
ud[4+i+112]=((in->meta[0])>>(7-i))&1;
ud[4+i+120]=((in->meta[1])>>(7-i))&1;
ud[4+i+128]=((in->meta[2])>>(7-i))&1;
ud[4+i+136]=((in->meta[3])>>(7-i))&1;
ud[4+i+144]=((in->meta[4])>>(7-i))&1;
ud[4+i+152]=((in->meta[5])>>(7-i))&1;
ud[4+i+160]=((in->meta[6])>>(7-i))&1;
ud[4+i+168]=((in->meta[7])>>(7-i))&1;
ud[4+i+176]=((in->meta[8])>>(7-i))&1;
ud[4+i+184]=((in->meta[9])>>(7-i))&1;
ud[4+i+192]=((in->meta[10])>>(7-i))&1;
ud[4+i+200]=((in->meta[11])>>(7-i))&1;
ud[4+i+208]=((in->meta[12])>>(7-i))&1;
ud[4+i+216]=((in->meta[13])>>(7-i))&1;
}
//unpack CRC
for(uint8_t i=0; i<8; i++)
{
ud[4+i+224]=((in->crc[0])>>(7-i))&1;
ud[4+i+232]=((in->crc[1])>>(7-i))&1;
}
//encode
for(uint8_t i=0; i<240+4; i++)
{
uint8_t G1=(ud[i+4] +ud[i+1]+ud[i+0])%2;
uint8_t G2=(ud[i+4]+ud[i+3]+ud[i+2] +ud[i+0])%2;
//printf("%d%d", G1, G2);
if(P_1[p])
{
out[pb]=G1;
pb++;
}
p++;
p%=pp_len;
if(P_1[p])
{
out[pb]=G2;
pb++;
}
p++;
p%=pp_len;
}
//printf("pb=%d\n", pb);
}
uint16_t LSF_CRC(struct LSF *in)
{
uint8_t d[28];
memcpy(&d[0], in->dst, 6);
memcpy(&d[6], in->src, 6);
memcpy(&d[12], in->type, 2);
memcpy(&d[14], in->meta, 14);
return CRC_M17(d, 28);
}
//encode 9-char callsign to a 6-byte long array
// EMITTR -> 0x000070FE024D
// RECEIV -> 0x000087AB859A
void encode_callsign(uint8_t *outp, const uint8_t *inp,int length)
{int i;
uint64_t encoded=0;
char val;
if (strcmp((char*)inp,"ALL")==0)
{for (i=0;i<6;i++) {outp[i]=0xff;}
printf("Broadcast\n");
return;
}
else
for (i=0;i<length;i++)
{val=inp[length-i-1];
if (val=='.') encoded=encoded*40+39; // last char
else if (val==' ') encoded=encoded*40+0;
else if (val=='/') encoded=encoded*40+38;
else if (val=='-') encoded=encoded*40+37;
else if (val>='A') encoded=encoded*40+(val-'A'+1);
else if (val>='0') encoded=encoded*40+(val-'0'+27);
else encoded=encoded*40; // invalid characters are forced to 0
}
printf("Encoded callsign %s -> %lx\n",inp,encoded);
for (i=0;i<6;i++) outp[5-i]=(encoded>>(8*i))&0xff;
}
m17_coder::sptr
m17_coder::make(std::string src_id,std::string dst_id,short type,std::string meta, bool debug)
{
@ -323,7 +132,7 @@ void m17_coder_impl::set_src_id(std::string src_id)
for (int i=0;i<10;i++) {_src_id[i]=0;}
if (src_id.length()>9) length=9; else length=src_id.length();
for (int i=0;i<length;i++) {_src_id[i]=toupper(src_id.c_str()[i]);}
encode_callsign(lsf.src,_src_id,length); // 6 byte ID <- 9 char callsign
encode_callsign((uint64_t*)lsf.src,_src_id); // 6 byte ID <- 9 char callsign
uint16_t ccrc=LSF_CRC(&lsf);
lsf.crc[0]=ccrc>>8;
lsf.crc[1]=ccrc&0xFF;
@ -334,7 +143,7 @@ void m17_coder_impl::set_dst_id(std::string dst_id)
for (int i=0;i<10;i++) {_dst_id[i]=0;}
if (dst_id.length()>9) length=9; else length=dst_id.length();
for (int i=0;i<length;i++) {_dst_id[i]=toupper(dst_id.c_str()[i]);}
encode_callsign(lsf.dst,_dst_id,length); // 6 byte ID <- 9 char callsign
encode_callsign((uint64_t*)lsf.dst,_dst_id); // 6 byte ID <- 9 char callsign
uint16_t ccrc=LSF_CRC(&lsf);
lsf.crc[0]=ccrc>>8;
lsf.crc[1]=ccrc&0xFF;
@ -399,10 +208,6 @@ void m17_coder_impl::set_type(short type)
{if(_got_lsf) //stream frames
{
//we could discard the data we already have
// for (int i=0;i<6;i++) {lsf.dst[i]=in[countin];countin++;}
// for (int i=0;i<6;i++) {lsf.src[i]=in[countin];countin++;}
// for (int i=0;i<2;i++) {lsf.type[i]=in[countin];countin++;}
// for (int i=0;i<14;i++) {lsf.meta[i]=in[countin];countin++;}
for (int i=0;i<16;i++) {data[i]=in[countin];countin++;}
//send stream frame syncword
@ -497,7 +302,7 @@ void m17_coder_impl::set_type(short type)
}
//encode the rest of the frame
conv_Encode_Frame(&enc_bits[96], data, _fn);
conv_encode_stream_frame(&enc_bits[96], data, _fn);
//reorder bits
for(uint16_t i=0; i<SYM_PER_PLD*2; i++)
@ -554,7 +359,7 @@ void m17_coder_impl::set_type(short type)
// printf("got_lsf=1\n");
//encode LSF data
conv_Encode_LSF(enc_bits, &lsf);
conv_encode_LSF(enc_bits, &lsf);
//send out the preamble and LSF
send_Preamble(0,out,&countout); //0 - LSF preamble, as opposed to 1 - BERT preamble

View File

@ -31,82 +31,30 @@
#include <stdint.h>
#include <string.h>
#include "../M17_Implementations/SP5WWP/inc/m17.h"
#include "../M17_Implementations/SP5WWP/m17-decoder/golay.h"
#include "../M17_Implementations/SP5WWP/m17-decoder/viterbi.h"
#include "../M17_Implementations/SP5WWP/m17-decoder/crc.h"
#include "../M17_Implementations/SP5WWP/lib/lib.h"
#include "../M17_Implementations/SP5WWP/lib/math/golay.h"
#include "../M17_Implementations/SP5WWP/lib/payload/crc.h"
#include "../M17_Implementations/SP5WWP/lib/payload/call.h"
#include "../M17_Implementations/SP5WWP/lib/phy/sync.h"
#include "../M17_Implementations/SP5WWP/lib/decode/viterbi.h"
#include "../M17_Implementations/SP5WWP/lib/payload/lsf.h"
#include "../M17_Implementations/SP5WWP/lib/phy/interleave.h"
#include "../M17_Implementations/SP5WWP/lib/phy/randomize.h"
#include "../M17_Implementations/SP5WWP/lib/decode/symbols.h"
#include "../M17_Implementations/SP5WWP/lib/encode/symbols.h"
#include "../M17_Implementations/SP5WWP/lib/encode/convol.h"
#include "../M17_Implementations/SP5WWP/lib/math/math.h"
#define DECODE_CALLSIGNS
//#define SHOW_VITERBI_ERRS
//
#define CODE_MEAN -0.75 // mean(str_sync)
#define CODE_STD 8.21583836f //std(str_sync)*sqrt(length(str_sync)-1)
// see ../M17_Implementations/SP5WWP/inc/m17.h for const int8_t str_sync[8]={-3, -3, -3, -3, +3, +3, -3, +3};
#define CODE_MEAN -0.75 // mean(str_sync_symbols)
#define CODE_STD 8.21583836f //std(str_sync_symbols)*sqrt(length(str_sync_symbols)-1)
namespace gr {
namespace m17 {
//soft decodes LICH into a 6-byte array
//input - soft bits
//output - an array of packed bits
void decode_LICH(uint8_t* outp, const uint16_t* inp)
{
uint16_t tmp;
memset(outp, 0, 5);
tmp=golay24_sdecode(&inp[0]);
outp[0]=(tmp>>4)&0xFF;
outp[1]|=(tmp&0xF)<<4;
tmp=golay24_sdecode(&inp[1*24]);
outp[1]|=(tmp>>8)&0xF;
outp[2]=tmp&0xFF;
tmp=golay24_sdecode(&inp[2*24]);
outp[3]=(tmp>>4)&0xFF;
outp[4]|=(tmp&0xF)<<4;
tmp=golay24_sdecode(&inp[3*24]);
outp[4]|=(tmp>>8)&0xF;
outp[5]=tmp&0xFF;
}
//decodes a 6-byte long array to a callsign
void decode_callsign(uint8_t *outp, const uint8_t *inp)
{
uint64_t encoded=0;
//repack the data to a uint64_t
for(uint8_t i=0; i<6; i++)
encoded|=(uint64_t)inp[5-i]<<(8*i);
//check if the value is reserved (not a callsign)
if(encoded>=262144000000000ULL)
{
if(encoded==0xFFFFFFFFFFFF) //broadcast
{
sprintf((char*)outp, "#BCAST");
}
else
{
outp[0]=0;
}
return;
}
//decode the callsign
uint8_t i=0;
while(encoded>0)
{
outp[i]=" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-/."[encoded%40];
encoded/=40;
i++;
}
outp[i] = 0;
}
m17_decoder::sptr
m17_decoder::make(bool debug_data,bool debug_ctrl,float threshold)
{
@ -135,39 +83,27 @@ void decode_callsign(uint8_t *outp, const uint8_t *inp)
{
}
void m17_decoder_impl::set_threshold(float threshold)
{_threshold=threshold;
printf("Threshold: %f\n",_threshold);
}
void m17_decoder_impl::set_debug_data(bool debug)
{_debug_data=debug;
if (_debug_data==true) printf("Data debug: true\n"); else printf("Data debug: false\n");
}
void m17_decoder_impl::set_debug_ctrl(bool debug)
{_debug_ctrl=debug;
if (_debug_ctrl==true) printf("Debug control: true\n"); else printf("Debug control: false\n");
}
void m17_decoder_impl::set_threshold(float threshold)
{_threshold=threshold;
printf("Threshold: %f\n",_threshold);
}
void m17_decoder_impl::set_debug_data(bool debug)
{_debug_data=debug;
if (_debug_data==true) printf("Data debug: true\n"); else printf("Data debug: false\n");
}
void m17_decoder_impl::set_debug_ctrl(bool debug)
{_debug_ctrl=debug;
if (_debug_ctrl==true) printf("Debug control: true\n"); else printf("Debug control: false\n");
}
void
m17_decoder_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required)
{
ninput_items_required[0] = 0; // noutput_items;
}
float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
{
float tmp = 0.0f;
for(uint8_t i=0; i<len; i++)
{
tmp += powf(in1[i]-(float)in2[i], 2.0f);
}
return sqrt(tmp);
}
int
m17_decoder_impl::general_work (int noutput_items,
gr_vector_int &ninput_items,
@ -180,10 +116,6 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
float sample; //last raw sample from the stdin
float dist; //Euclidean distance for finding syncwords in the symbol stream
// float xcorr; //cross correlation for finding syncwords
// float meanx; //mean value
// float normx; //cross correlation normalization
for (int counterin=0;counterin<ninput_items[0];counterin++)
{
@ -201,11 +133,11 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
last[7]=sample;
//calculate euclidean norm
dist = eucl_norm(last, str_sync, 8);
dist = eucl_norm(last, str_sync_symbols, 8);
if(dist<_threshold) //frame syncword detected
{
//fprintf(stderr, "str_sync dist: %3.5f\n", dist);
//fprintf(stderr, "str_sync_symbols dist: %3.5f\n", dist);
syncd=1;
pushed=0;
fl=0;
@ -213,7 +145,7 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
else
{
//calculate euclidean norm again, this time against LSF syncword
dist = eucl_norm(last, lsf_sync, 8);
dist = eucl_norm(last, lsf_sync_symbols, 8);
if(dist<_threshold) //LSF syncword
{
@ -235,21 +167,21 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
for(uint8_t i=0; i<SYM_PER_PLD; i++)
{
//bit 0
if(pld[i]>=symbs[3])
if(pld[i]>=symbol_map[3])
{
soft_bit[i*2+1]=0xFFFF;
}
else if(pld[i]>=symbs[2])
else if(pld[i]>=symbol_map[2])
{
soft_bit[i*2+1]=-(float)0xFFFF/(symbs[3]-symbs[2])*symbs[2]+pld[i]*(float)0xFFFF/(symbs[3]-symbs[2]);
soft_bit[i*2+1]=-(float)0xFFFF/(symbol_map[3]-symbol_map[2])*symbol_map[2]+pld[i]*(float)0xFFFF/(symbol_map[3]-symbol_map[2]);
}
else if(pld[i]>=symbs[1])
else if(pld[i]>=symbol_map[1])
{
soft_bit[i*2+1]=0x0000;
}
else if(pld[i]>=symbs[0])
else if(pld[i]>=symbol_map[0])
{
soft_bit[i*2+1]=(float)0xFFFF/(symbs[1]-symbs[0])*symbs[1]-pld[i]*(float)0xFFFF/(symbs[1]-symbs[0]);
soft_bit[i*2+1]=(float)0xFFFF/(symbol_map[1]-symbol_map[0])*symbol_map[1]-pld[i]*(float)0xFFFF/(symbol_map[1]-symbol_map[0]);
}
else
{
@ -257,13 +189,13 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
}
//bit 1
if(pld[i]>=symbs[2])
if(pld[i]>=symbol_map[2])
{
soft_bit[i*2]=0x0000;
}
else if(pld[i]>=symbs[1])
else if(pld[i]>=symbol_map[1])
{
soft_bit[i*2]=0x7FFF-pld[i]*(float)0xFFFF/(symbs[2]-symbs[1]);
soft_bit[i*2]=0x7FFF-pld[i]*(float)0xFFFF/(symbol_map[2]-symbol_map[1]);
}
else
{
@ -305,8 +237,8 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
#ifdef DECODE_CALLSIGNS
uint8_t d_dst[12], d_src[12]; //decoded strings
decode_callsign(d_dst, &lsf[0]);
decode_callsign(d_src, &lsf[6]);
decode_callsign_bytes(d_dst, &lsf[0]);
decode_callsign_bytes(d_src, &lsf[6]);
if (_debug_ctrl==true) {
//DST
@ -360,7 +292,7 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
}
//decode
decodePunctured(frame_data, enc_data, P_2, 272, 12);
viterbi_decode_punctured(frame_data, enc_data, puncture_pattern_2, 272, 12);
if (_debug_data==true) {
//dump data - first byte is empty
@ -385,69 +317,69 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
}
else //lsf
{
if (_debug_ctrl==true) {
printf("LSF\n");
}
if (_debug_ctrl==true) {
printf("LSF\n");
}
//decode
decodePunctured(lsf, d_soft_bit, P_1, 2*SYM_PER_PLD, 61);
viterbi_decode_punctured(lsf, d_soft_bit, puncture_pattern_1, 2*SYM_PER_PLD, 61);
//shift the buffer 1 position left - get rid of the encoded flushing bits
for(uint8_t i=0; i<30; i++)
lsf[i]=lsf[i+1];
//dump data
#ifdef DECODE_CALLSIGNS
#ifdef DECODE_CALLSIGNS
uint8_t d_dst[12], d_src[12]; //decoded strings
decode_callsign(d_dst, &lsf[0]);
decode_callsign(d_src, &lsf[6]);
decode_callsign_bytes(d_dst, &lsf[0]);
decode_callsign_bytes(d_src, &lsf[6]);
if (_debug_ctrl==true) {
//DST
printf("DST: %-9s ", d_dst);
//SRC
printf("SRC: %-9s ", d_src);
#else
//DST
printf("DST: ");
for(uint8_t i=0; i<6; i++)
printf("%02X", lsf[i]);
printf(" ");
//SRC
printf("SRC: ");
for(uint8_t i=0; i<6; i++)
printf("%02X", lsf[6+i]);
printf(" ");
#endif
//TYPE
printf("TYPE: ");
for(uint8_t i=0; i<2; i++)
printf("%02X", lsf[12+i]);
printf(" ");
//META
printf("META: ");
for(uint8_t i=0; i<14; i++)
printf("%02X", lsf[14+i]);
printf(" ");
//CRC
//printf("CRC: ");
//for(uint8_t i=0; i<2; i++)
//printf("%02X", lsf[28+i]);
if(CRC_M17(lsf, 30))
printf("LSF_CRC_ERR");
else
printf("LSF_CRC_OK ");
//Viterbi decoder errors
#ifdef SHOW_VITERBI_ERRS
printf(" e=%1.1f\n", (float)e/0xFFFF);
#else
printf("\n");
#endif
if (_debug_ctrl==true) {
//DST
printf("DST: %-9s ", d_dst);
//SRC
printf("SRC: %-9s ", d_src);
#else
//DST
printf("DST: ");
for(uint8_t i=0; i<6; i++)
printf("%02X", lsf[i]);
printf(" ");
//SRC
printf("SRC: ");
for(uint8_t i=0; i<6; i++)
printf("%02X", lsf[6+i]);
printf(" ");
#endif
//TYPE
printf("TYPE: ");
for(uint8_t i=0; i<2; i++)
printf("%02X", lsf[12+i]);
printf(" ");
//META
printf("META: ");
for(uint8_t i=0; i<14; i++)
printf("%02X", lsf[14+i]);
printf(" ");
//CRC
//printf("CRC: ");
//for(uint8_t i=0; i<2; i++)
//printf("%02X", lsf[28+i]);
if(CRC_M17(lsf, 30))
printf("LSF_CRC_ERR");
else
printf("LSF_CRC_OK ");
//Viterbi decoder errors
#ifdef SHOW_VITERBI_ERRS
printf(" e=%1.1f\n", (float)e/0xFFFF);
#else
printf("\n");
#endif
}
}

View File

@ -9,11 +9,12 @@
#define INCLUDED_M17_M17_DECODER_IMPL_H
#include <gnuradio/m17/m17_decoder.h>
#include "../M17_Implementations/SP5WWP/lib/lib.h"
#include "../M17_Implementations/SP5WWP/inc/m17.h"
#include "../M17_Implementations/SP5WWP/m17-decoder/golay.h"
#include "../M17_Implementations/SP5WWP/m17-decoder/viterbi.h"
#include "../M17_Implementations/SP5WWP/m17-decoder/crc.h"
//#include "../M17_Implementations/SP5WWP/inc/m17.h"
//#include "../M17_Implementations/SP5WWP/m17-decoder/golay.h"
//#include "../M17_Implementations/SP5WWP/m17-decoder/viterbi.h"
//#include "../M17_Implementations/SP5WWP/m17-decoder/crc.h"
namespace gr {
namespace m17 {