diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-07-01 20:41:55 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2019-07-19 11:44:13 +0000 |
commit | 15fa64bce4a17b8f90ca11523784547ffde79265 (patch) | |
tree | a837e5f4063262811301a3599f4948aec3ed45a9 /Transceiver52M/proto_trxd.h | |
parent | c9202ab0be5e3e89f5fa4236ef45d550cee91af6 (diff) |
Transceiver: Move out TRXD socket send code to prepare for TRXDv1
Only old v0 is supported so far. TRXD protocol related data/logic is
moved to its own file out of Transceiver class. Code is refactored so it
can be re-used later by TRXDv1.
Related: OS#4006
Change-Id: I5786dd44b076202c6f1a6e82405670e8605797ed
Diffstat (limited to 'Transceiver52M/proto_trxd.h')
-rw-r--r-- | Transceiver52M/proto_trxd.h | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/Transceiver52M/proto_trxd.h b/Transceiver52M/proto_trxd.h index 9da18db..2e5ad52 100644 --- a/Transceiver52M/proto_trxd.h +++ b/Transceiver52M/proto_trxd.h @@ -1,28 +1,52 @@ #pragma once #include <stdint.h> +#include <stdbool.h> +#include <unistd.h> +#include <math.h> + #include <osmocom/core/endian.h> +#include "debug.h" + +#define MAX_RX_BURST_BUF_SIZE 444 /* 444 = EDGE_BURST_NBITS */ + +struct trx_ul_burst_ind { + float rx_burst[MAX_RX_BURST_BUF_SIZE]; /* soft bits normalized 0..1 */ + unsigned nbits; // number of symbols per slot in rxBurst, not counting guard periods + uint32_t fn; // TDMA frame number + uint8_t tn; // TDMA time-slot number + double rssi; // in dBFS + double toa; // in symbols + double noise; // noise level in dBFS + bool idle; // true if no valid burst is included +}; + +bool trxd_send_burst_ind_v0(size_t chan, int fd, const struct trx_ul_burst_ind *bi); + +/* The latest supported TRXD header format version */ +#define TRX_DATA_FORMAT_VER 0 + struct trxd_hdr_common { #if OSMO_IS_LITTLE_ENDIAN - uint8_t tn:3, - reserved:1, - version:4; + uint8_t tn:3, + reserved:1, + version:4; #elif OSMO_IS_BIG_ENDIAN - uint8_t version:4, - reserved:1, - tn:3; + uint8_t version:4, + reserved:1, + tn:3; #endif - uint32_t fn; /* big endian */ + uint32_t fn; /* big endian */ } __attribute__ ((packed)); struct trxd_hdr_v0_specific { - uint8_t rssi; - uint16_t toa; /* big endian */ + uint8_t rssi; + uint16_t toa; /* big endian */ } __attribute__ ((packed)); struct trxd_hdr_v0 { - struct trxd_hdr_common common; - struct trxd_hdr_v0_specific v0; - uint8_t soft_bits[0]; + struct trxd_hdr_common common; + struct trxd_hdr_v0_specific v0; + uint8_t soft_bits[0]; } __attribute__ ((packed)); |