GNU Radio's M17 Package
m17.h
Go to the documentation of this file.
1 #ifndef M17_CONSTS
2 #define M17_CONSTS
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 #define FLT_LEN 81 //baseband filter length (number of taps)
8 #define SW_LEN 80 //syncword detector length
9 #define XC_LEN 90 //cross-correlator lookback length in samples
10 #define SYM_PER_SWD 8 //symbols per syncword
11 #define SYM_PER_PLD 184 //symbols per payload in a frame
12 #define SYM_PER_FRA 192 //symbols per whole 40 ms frame
13 #define RRC_DEV 7168.0f //.rrc file deviation for +1.0 symbol
14 
15 #define XCORR_THRESH 0.90 //arbitrary threshold between 0 and 1
16 #define SW_MEAN -0.75 //mean(str_sync)=mean(pkt_sync)
17 #define SW_STD 8.21583836f //std(str_sync)*sqrt(length(str_sync)-1)
18 #define DIST_THRESH 2.0f //threshold for distance (syncword detection)
19 
20 //syncword patterns (RX) TODO:Compute those at runtime from the consts below
21 const int8_t lsf_sync[8]={+3, +3, +3, +3, -3, -3, +3, -3};
22 const int8_t str_sync[8]={-3, -3, -3, -3, +3, +3, -3, +3};
23 const int8_t pkt_sync[8]={+3, -3, +3, +3, -3, -3, -3, -3};
24 
25 //symbol levels (RX)
26 const float symbs[4]={-3.0, -1.0, +1.0, +3.0};
27 
28 //dibits-symbols map (TX)
29 const int8_t symbol_map[4]={+1, +3, -1, -3};
30 
31 //syncwords
32 const uint16_t SYNC_LSF = 0x55F7;
33 const uint16_t SYNC_STR = 0xFF5D;
34 const uint16_t SYNC_PKT = 0x75FF;
35 const uint16_t SYNC_BER = 0xDF55;
36 const uint16_t EOT_MRKR = 0x555D;
37 
38 //puncturing pattern P_1
39 const uint8_t P_1[61]={1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,
40  1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,
41  1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,
42  1,0,1,1,1,0,1,1,1,0,1,1};
43 
44 //puncturing pattern P_2
45 const uint8_t P_2[12]={1,1,1,1,1,1,1,1,1,1,1,0};
46 
47 //puncturing pattern P_3
48 const uint8_t P_3[8]={1,1,1,1,1,1,1,0};
49 
50 //RRC filter - 10 samples per symbol, 8 symbols span
51 const float taps[FLT_LEN]=
52 {
53  -0.003195702904062073f, -0.002930279157647190f, -0.001940667871554463f,
54  -0.000356087678023658f, 0.001547011339077758f, 0.003389554791179751f,
55  0.004761898604225673f, 0.005310860846138910f, 0.004824746306020221f,
56  0.003297923526848786f, 0.000958710871218619f, -0.001749908029791816f,
57  -0.004238694106631223f, -0.005881783042101693f, -0.006150256456781309f,
58  -0.004745376707651645f, -0.001704189656473565f, 0.002547854551539951f,
59  0.007215575568844704f, 0.011231038205363532f, 0.013421952197060707f,
60  0.012730475385624438f, 0.008449554307303753f, 0.000436744366018287f,
61  -0.010735380379191660f, -0.023726883538258272f, -0.036498030780605324f,
62  -0.046500883189991064f, -0.050979050575999614f, -0.047340680079891187f,
63  -0.033554880492651755f, -0.008513823955725943f, 0.027696543159614194f,
64  0.073664520037517042f, 0.126689053778116234f, 0.182990955139333916f,
65  0.238080025892859704f, 0.287235637987091563f, 0.326040247765297220f,
66  0.350895727088112619f, 0.359452932027607974f, 0.350895727088112619f,
67  0.326040247765297220f, 0.287235637987091563f, 0.238080025892859704f,
68  0.182990955139333916f, 0.126689053778116234f, 0.073664520037517042f,
69  0.027696543159614194f, -0.008513823955725943f, -0.033554880492651755f,
70  -0.047340680079891187f, -0.050979050575999614f, -0.046500883189991064f,
71  -0.036498030780605324f, -0.023726883538258272f, -0.010735380379191660f,
72  0.000436744366018287f, 0.008449554307303753f, 0.012730475385624438f,
73  0.013421952197060707f, 0.011231038205363532f, 0.007215575568844704f,
74  0.002547854551539951f, -0.001704189656473565f, -0.004745376707651645f,
75  -0.006150256456781309f, -0.005881783042101693f, -0.004238694106631223f,
76  -0.001749908029791816f, 0.000958710871218619f, 0.003297923526848786f,
77  0.004824746306020221f, 0.005310860846138910f, 0.004761898604225673f,
78  0.003389554791179751f, 0.001547011339077758f, -0.000356087678023658f,
79  -0.001940667871554463f, -0.002930279157647190f, -0.003195702904062073f
80 };
81 
82 //randomizing pattern
83 const uint8_t rand_seq[46]=
84 {
85  0xD6, 0xB5, 0xE2, 0x30, 0x82, 0xFF, 0x84, 0x62, 0xBA, 0x4E, 0x96, 0x90, 0xD8, 0x98, 0xDD, 0x5D, 0x0C, 0xC8, 0x52, 0x43, 0x91, 0x1D, 0xF8,
86  0x6E, 0x68, 0x2F, 0x35, 0xDA, 0x14, 0xEA, 0xCD, 0x76, 0x19, 0x8D, 0xD5, 0x80, 0xD1, 0x33, 0x87, 0x13, 0x57, 0x18, 0x2D, 0x29, 0x78, 0xC3
87 };
88 
89 //interleaver pattern
90 const uint16_t intrl_seq[368]=
91 {
92  0, 137, 90, 227, 180, 317, 270, 39, 360, 129, 82, 219, 172, 309, 262, 31,
93  352, 121, 74, 211, 164, 301, 254, 23, 344, 113, 66, 203, 156, 293, 246, 15,
94  336, 105, 58, 195, 148, 285, 238, 7, 328, 97, 50, 187, 140, 277, 230, 367,
95  320, 89, 42, 179, 132, 269, 222, 359, 312, 81, 34, 171, 124, 261, 214, 351,
96  304, 73, 26, 163, 116, 253, 206, 343, 296, 65, 18, 155, 108, 245, 198, 335,
97  288, 57, 10, 147, 100, 237, 190, 327, 280, 49, 2, 139, 92, 229, 182, 319,
98  272, 41, 362, 131, 84, 221, 174, 311, 264, 33, 354, 123, 76, 213, 166, 303,
99  256, 25, 346, 115, 68, 205, 158, 295, 248, 17, 338, 107, 60, 197, 150, 287,
100  240, 9, 330, 99, 52, 189, 142, 279, 232, 1, 322, 91, 44, 181, 134, 271,
101  224, 361, 314, 83, 36, 173, 126, 263, 216, 353, 306, 75, 28, 165, 118, 255,
102  208, 345, 298, 67, 20, 157, 110, 247, 200, 337, 290, 59, 12, 149, 102, 239,
103  192, 329, 282, 51, 4, 141, 94, 231, 184, 321, 274, 43, 364, 133, 86, 223,
104  176, 313, 266, 35, 356, 125, 78, 215, 168, 305, 258, 27, 348, 117, 70, 207,
105  160, 297, 250, 19, 340, 109, 62, 199, 152, 289, 242, 11, 332, 101, 54, 191,
106  144, 281, 234, 3, 324, 93, 46, 183, 136, 273, 226, 363, 316, 85, 38, 175,
107  128, 265, 218, 355, 308, 77, 30, 167, 120, 257, 210, 347, 300, 69, 22, 159,
108  112, 249, 202, 339, 292, 61, 14, 151, 104, 241, 194, 331, 284, 53, 6, 143,
109  96, 233, 186, 323, 276, 45, 366, 135, 88, 225, 178, 315, 268, 37, 358, 127,
110  80, 217, 170, 307, 260, 29, 350, 119, 72, 209, 162, 299, 252, 21, 342, 111,
111  64, 201, 154, 291, 244, 13, 334, 103, 56, 193, 146, 283, 236, 5, 326, 95,
112  48, 185, 138, 275, 228, 365, 318, 87, 40, 177, 130, 267, 220, 357, 310, 79,
113  32, 169, 122, 259, 212, 349, 302, 71, 24, 161, 114, 251, 204, 341, 294, 63,
114  16, 153, 106, 243, 196, 333, 286, 55, 8, 145, 98, 235, 188, 325, 278, 47
115 };
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif
const uint8_t P_3[8]
Definition: m17.h:48
const uint8_t rand_seq[46]
Definition: m17.h:83
const uint16_t SYNC_LSF
Definition: m17.h:32
const float taps[FLT_LEN]
Definition: m17.h:51
const uint16_t intrl_seq[368]
Definition: m17.h:90
#define FLT_LEN
Definition: m17.h:7
const float symbs[4]
Definition: m17.h:26
const int8_t pkt_sync[8]
Definition: m17.h:23
const int8_t lsf_sync[8]
Definition: m17.h:21
const uint16_t EOT_MRKR
Definition: m17.h:36
const uint16_t SYNC_BER
Definition: m17.h:35
const uint16_t SYNC_PKT
Definition: m17.h:34
const uint8_t P_1[61]
Definition: m17.h:39
const int8_t str_sync[8]
Definition: m17.h:22
const int8_t symbol_map[4]
Definition: m17.h:29
const uint16_t SYNC_STR
Definition: m17.h:33
const uint8_t P_2[12]
Definition: m17.h:45