osmo-gmr 0.2.104-2b98 Osmocom GMR-1

pi4cxpsk.h
Go to the documentation of this file.
1/* GMR-1 SDR - pi2-CBPSK, pi4-CBPSK and pi4-CQPSK modulation support */
2/* See GMR-1 05.004 (ETSI TS 101 376-5-4 V1.2.1) - Section 5.1 & 5.2 */
3
4/* (C) 2011-2019 by Sylvain Munaut <tnt@246tNt.com>
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __OSMO_GMR1_SDR_PI4CXPSK_H__
22#define __OSMO_GMR1_SDR_PI4CXPSK_H__
23
33#include <stdint.h>
34#include <osmocom/core/bits.h>
35#include <osmocom/dsp/cxvec.h>
36
37
38#define GMR1_MAX_SYM_EBITS 2
39#define GMR1_MAX_SYNC 4
40#define GMR1_MAX_SYNC_SYMS 32
44 struct gmr1_pi4cxpsk_symbol {
45 short idx;
46 ubit_t data[GMR1_MAX_SYM_EBITS];
47 float mod_phase;
48 float complex mod_val;
49};
50
52 struct gmr1_pi4cxpsk_modulation {
53 float rotation;
54 int nbits;
55 struct gmr1_pi4cxpsk_symbol *syms;
56 struct gmr1_pi4cxpsk_symbol *bits;
57};
58
59
60 extern struct gmr1_pi4cxpsk_modulation gmr1_pi2cbpsk;
61 extern struct gmr1_pi4cxpsk_modulation gmr1_pi4cbpsk;
62 extern struct gmr1_pi4cxpsk_modulation gmr1_pi4cqpsk;
63
64
66 struct gmr1_pi4cxpsk_sync {
67 int pos;
68 int len;
69 uint8_t syms[GMR1_MAX_SYNC_SYMS];
70 struct osmo_cxvec *_ref;
71};
72
74 struct gmr1_pi4cxpsk_data {
75 int pos;
76 int len;
77};
78
80 struct gmr1_pi4cxpsk_burst {
82 struct gmr1_pi4cxpsk_modulation *mod;
83
85 int guard_pre;
87 int guard_post;
88
90 int len;
92 int ebits;
93
95 struct gmr1_pi4cxpsk_sync *sync[GMR1_MAX_SYNC];
97 struct gmr1_pi4cxpsk_data *data;
98};
99
100
101 int
102 gmr1_pi4cxpsk_demod(struct gmr1_pi4cxpsk_burst *burst_type,
103 struct osmo_cxvec *burst_in, int sps, float freq_shift,
104 sbit_t *ebits,
105 int *sync_id_p, float *toa_p, float *freq_err_p);
106
107 int
108 gmr1_pi4cxpsk_detect(struct gmr1_pi4cxpsk_burst **burst_types, float e_toa,
109 struct osmo_cxvec *burst_in, int sps, float freq_shift,
110 int *bt_id_p, int *sync_id_p, float *toa_p);
111
112 int
113 gmr1_pi4cxpsk_mod_order(struct osmo_cxvec *burst_in, int sps, float freq_shift);
114
115 int
116 gmr1_pi4cxpsk_mod(struct gmr1_pi4cxpsk_burst *burst_type,
117 ubit_t *ebits, int sync_id, struct osmo_cxvec *burst_out);
118
119
122#endif /* __OSMO_GMR1_SDR_PI4CXPSK_H__ */
bits.h
cxvec.h
ubit_t
uint8_t ubit_t
sbit_t
int8_t sbit_t
gmr1_pi4cxpsk_detect
int gmr1_pi4cxpsk_detect(struct gmr1_pi4cxpsk_burst **burst_types, float e_toa, struct osmo_cxvec *burst_in, int sps, float freq_shift, int *bt_id_p, int *sync_id_p, float *toa_p)
Try to identify burst type by matching training sequences.
Definition: pi4cxpsk.c:618
gmr1_pi2cbpsk
struct gmr1_pi4cxpsk_modulation gmr1_pi2cbpsk
pi2-CBPSK modulation description
Definition: pi4cxpsk.c:77
gmr1_pi4cxpsk_demod
int gmr1_pi4cxpsk_demod(struct gmr1_pi4cxpsk_burst *burst_type, struct osmo_cxvec *burst_in, int sps, float freq_shift, sbit_t *ebits, int *sync_id_p, float *toa_p, float *freq_err_p)
All-in-one pi4-CxPSK demodulation method.
Definition: pi4cxpsk.c:521
GMR1_MAX_SYM_EBITS
#define GMR1_MAX_SYM_EBITS
Max e bits in a symbol.
Definition: pi4cxpsk.h:38
gmr1_pi4cxpsk_mod
int gmr1_pi4cxpsk_mod(struct gmr1_pi4cxpsk_burst *burst_type, ubit_t *ebits, int sync_id, struct osmo_cxvec *burst_out)
Modulates (currently at 1 sps)
Definition: pi4cxpsk.c:742
gmr1_pi4cqpsk
struct gmr1_pi4cxpsk_modulation gmr1_pi4cqpsk
pi4-CQPSK modulation description
Definition: pi4cxpsk.c:110
GMR1_MAX_SYNC
#define GMR1_MAX_SYNC
Max diff. sync seqs
Definition: pi4cxpsk.h:39
gmr1_pi4cxpsk_mod_order
int gmr1_pi4cxpsk_mod_order(struct osmo_cxvec *burst_in, int sps, float freq_shift)
Estimates modulation order by comparing power of x^2 vs x^4.
Definition: pi4cxpsk.c:694
GMR1_MAX_SYNC_SYMS
#define GMR1_MAX_SYNC_SYMS
Max sym in a sync seq
Definition: pi4cxpsk.h:40
gmr1_pi4cbpsk
struct gmr1_pi4cxpsk_modulation gmr1_pi4cbpsk
pi4-CBPSK modulation description
Definition: pi4cxpsk.c:85
gmr1_pi4cxpsk_burst
pi4-CxPSK Burst format description
Definition: pi4cxpsk.h:80
gmr1_pi4cxpsk_burst::guard_pre
int guard_pre
Beginning guard period.
Definition: pi4cxpsk.h:85
gmr1_pi4cxpsk_burst::guard_post
int guard_post
End guard period
Definition: pi4cxpsk.h:87
gmr1_pi4cxpsk_burst::sync
struct gmr1_pi4cxpsk_sync * sync[GMR1_MAX_SYNC]
Sync sequences.
Definition: pi4cxpsk.h:95
gmr1_pi4cxpsk_burst::data
struct gmr1_pi4cxpsk_data * data
Data chunks.
Definition: pi4cxpsk.h:97
gmr1_pi4cxpsk_burst::ebits
int ebits
Number of encoded bits.
Definition: pi4cxpsk.h:92
gmr1_pi4cxpsk_burst::mod
struct gmr1_pi4cxpsk_modulation * mod
Modulation scheme
Definition: pi4cxpsk.h:82
gmr1_pi4cxpsk_burst::len
int len
Total len with guard.
Definition: pi4cxpsk.h:90
gmr1_pi4cxpsk_data
pi4-CxPSK Data segment description
Definition: pi4cxpsk.h:74
gmr1_pi4cxpsk_data::len
int len
Data chunk length
Definition: pi4cxpsk.h:76
gmr1_pi4cxpsk_data::pos
int pos
Data chunk position
Definition: pi4cxpsk.h:75
gmr1_pi4cxpsk_modulation
pi4-CxPSK modulation description
Definition: pi4cxpsk.h:52
gmr1_pi4cxpsk_modulation::bits
struct gmr1_pi4cxpsk_symbol * bits
Symbols (bit order)
Definition: pi4cxpsk.h:56
gmr1_pi4cxpsk_modulation::rotation
float rotation
rotation per symbol
Definition: pi4cxpsk.h:53
gmr1_pi4cxpsk_modulation::nbits
int nbits
ebits/sym
Definition: pi4cxpsk.h:54
gmr1_pi4cxpsk_modulation::syms
struct gmr1_pi4cxpsk_symbol * syms
Symbols (sym order)
Definition: pi4cxpsk.h:55
gmr1_pi4cxpsk_symbol
pi4-CxPSK symbol description
Definition: pi4cxpsk.h:44
gmr1_pi4cxpsk_symbol::data
ubit_t data[GMR1_MAX_SYM_EBITS]
Encoded data bits
Definition: pi4cxpsk.h:46
gmr1_pi4cxpsk_symbol::mod_val
float complex mod_val
e^(1j*mod_phase)
Definition: pi4cxpsk.h:48
gmr1_pi4cxpsk_symbol::idx
short idx
Symbol number
Definition: pi4cxpsk.h:45
gmr1_pi4cxpsk_symbol::mod_phase
float mod_phase
Phase used during mod.
Definition: pi4cxpsk.h:47
gmr1_pi4cxpsk_sync
pi4-CxPSK Synchronization sequence segment description
Definition: pi4cxpsk.h:66
gmr1_pi4cxpsk_sync::_ref
struct osmo_cxvec * _ref
Ref signal
Definition: pi4cxpsk.h:70
gmr1_pi4cxpsk_sync::len
int len
Sync Length
Definition: pi4cxpsk.h:68
gmr1_pi4cxpsk_sync::syms
uint8_t syms[GMR1_MAX_SYNC_SYMS]
Sync Symbols
Definition: pi4cxpsk.h:69
gmr1_pi4cxpsk_sync::pos
int pos
Sync Position
Definition: pi4cxpsk.h:67
osmo_cxvec