dstar cleanup

This commit is contained in:
Max 2017-03-08 10:08:38 -05:00
parent 89ef1f3297
commit d403abb882
3 changed files with 19 additions and 7 deletions

View File

@ -52,6 +52,9 @@ static inline void print_result(char title[], const uint8_t r[], int len) {
}
#endif
static const uint8_t FS[24] = { 1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,0,1,1,0,1,0,0,0 };
static const uint8_t FS_DUMMY[24] = { 0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1 };
namespace gr {
namespace op25_repeater {
@ -78,7 +81,8 @@ static const int MAX_OUT = 1;
gr::io_signature::make (MIN_IN, MAX_IN, sizeof(short)),
gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof(char))),
d_verbose_flag(verbose_flag),
d_config_file(config_file)
d_config_file(config_file),
d_frame_counter(0)
{
set_output_multiple(96);
d_encoder.set_dstar_mode();
@ -119,8 +123,8 @@ dstar_tx_sb_impl::forecast(int nof_output_items, gr_vector_int &nof_input_items_
{
// each 96-bit output frame contains one voice code word=160 samples input
const size_t nof_inputs = nof_input_items_reqd.size();
const int nof_vcw = nof_output_items / 480.0;
const int nof_samples_reqd = nof_vcw * 5 * 160;
const int nof_vcw = nof_output_items / 96.0;
const int nof_samples_reqd = nof_vcw * 160;
std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
}
@ -142,6 +146,12 @@ dstar_tx_sb_impl::general_work (int noutput_items,
if (ninput_items[0] - nconsumed < 160)
break;
d_encoder.encode(in, out);
if (d_frame_counter == 0)
memcpy(out+72, FS, 24);
else
memcpy(out+72, FS_DUMMY, 24);
d_frame_counter += 1;
d_frame_counter = (d_frame_counter + 1) % 21;
in += 160;
nconsumed += 160;
nframes += 1;

View File

@ -58,6 +58,7 @@ namespace gr {
int d_verbose_flag;
const char * d_config_file;
ambe_encoder d_encoder;
int d_frame_counter;
};
} // namespace op25_repeater

View File

@ -838,6 +838,7 @@ void p25p2_vf::encode_dstar(uint8_t result[72], const int b[9]) {
pbuf[21] = (b[4] >> 2) & 1;
pbuf[22] = (b[5] >> 3) & 1;
pbuf[23] = (b[5] >> 2) & 1;
pbuf[24] = 0; /* ? */
pbuf[25] = (b[5] >> 1) & 1;
pbuf[26] = b[5] & 1;
pbuf[27] = (b[6] >> 3) & 1;
@ -875,10 +876,10 @@ void p25p2_vf::encode_dstar(uint8_t result[72], const int b[9]) {
int c3 = u3;
uint8_t ambe_fr[4][24];
store_reg(c0, ambe_fr[0], 24);
store_reg(c1, ambe_fr[1], 23);
store_reg(c2, ambe_fr[2], 11);
store_reg(c3, ambe_fr[3], 14);
dump_i(ambe_fr[0], c0, 24);
dump_i(ambe_fr[1], c1, 23);
dump_i(ambe_fr[2], c2, 11);
dump_i(ambe_fr[3], c3, 14);
result[0] = ambe_fr[0][10];
result[1] = ambe_fr[0][22];