libosmo-trx 1.8.0.50-7f5e
Osmocom TRX protocol (TRXC/TRXD) library
trxd.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <stdint.h>
6#include <stddef.h>
7
8#include <osmocom/core/bits.h>
9#include <osmocom/core/utils.h>
10
11struct msgb;
12
14#define OSMO_TRXD_PDU_VER_MAX 2
15
17#define OSMO_TRXD_BURST_LEN_GMSK 148
19#define OSMO_TRXD_BURST_LEN_8PSK 444
21#define OSMO_TRXD_BURST_LEN_MAX OSMO_TRXD_BURST_LEN_8PSK
22
26#define OSMO_TRXD_HDR_LEN_MAX 12
30#define OSMO_TRXD_MSG_BUF_SIZE (OSMO_TRXD_HDR_LEN_MAX + OSMO_TRXD_BURST_LEN_MAX)
31
37 /* room for 16QAM/32QAM */
38};
39
40/* Presence/meta flags for osmo_trxd_burst_{ind,req} */
41#define OSMO_TRXD_F_NOPE_IND (1 << 0)
43#define OSMO_TRXD_F_NOPE_REQ OSMO_TRXD_F_NOPE_IND
44#define OSMO_TRXD_F_MOD_TYPE (1 << 1)
45#define OSMO_TRXD_F_TS_INFO (1 << 2)
46#define OSMO_TRXD_F_CI_CB (1 << 3)
47#define OSMO_TRXD_F_TRX_NUM (1 << 4)
48#define OSMO_TRXD_F_BATCH_IND (1 << 5)
49#define OSMO_TRXD_F_SHADOW_IND (1 << 6)
50#define OSMO_TRXD_F_ACCESS_BURST (1 << 7)
58 uint32_t flags;
60 /* Mandatory fields (all TRXD versions) */
61 uint32_t fn;
62 uint8_t tn;
63 int16_t toa256;
64 int8_t rssi;
66 size_t burst_len;
68 /* Optional fields (presence indicated by flags) */
70 uint8_t tsc_set;
71 uint8_t tsc;
72 int16_t ci_cb;
73 uint8_t trx_num;
74};
75
79 uint32_t flags;
81 /* Mandatory fields (all TRXD versions) */
82 uint32_t fn;
83 uint8_t tn;
84 uint8_t att;
86 size_t burst_len;
88 /* Optional fields (presence indicated by flags) */
90 uint8_t tsc_set;
91 uint8_t tsc;
92 int8_t scpir;
93 uint8_t trx_num;
94};
95
99 uint8_t pdu_ver;
100 unsigned int num_pdus;
101 uint32_t fn;
102};
103
105
107 struct osmo_trxd_burst_ind *bi,
108 const uint8_t *buf, size_t buf_len);
110 struct osmo_trxd_burst_req *br,
111 const uint8_t *buf, size_t buf_len);
112
113int osmo_trxd_burst_ind_build(struct msgb *msg, uint8_t pdu_ver,
114 const struct osmo_trxd_burst_ind *bi);
115int osmo_trxd_burst_req_build(struct msgb *msg, uint8_t pdu_ver,
116 const struct osmo_trxd_burst_req *br);
117void osmo_trxd_build_fin(struct msgb *msg, uint8_t pdu_ver);
118
119const char *osmo_trxd_burst_ind_name(const struct osmo_trxd_burst_ind *bi);
120char *osmo_trxd_burst_ind_name_buf(char *buf, size_t buf_len,
121 const struct osmo_trxd_burst_ind *bi);
122const char *osmo_trxd_burst_req_name(const struct osmo_trxd_burst_req *br);
123char *osmo_trxd_burst_req_name_buf(char *buf, size_t buf_len,
124 const struct osmo_trxd_burst_req *br);
125
126extern const struct value_string osmo_trxd_mod_type_names[];
127static inline const char *osmo_trxd_mod_type_name(enum osmo_trxd_mod_type mod)
128{
129 return get_value_string(osmo_trxd_mod_type_names, mod);
130}
TRX -> L1: received burst indication (soft bits + measurements).
Definition: trxd.h:57
uint8_t trx_num
TRX (RF channel) number.
Definition: trxd.h:73
enum osmo_trxd_mod_type mod
Modulation type.
Definition: trxd.h:69
int8_t rssi
Received Signal Strength Indication (dBm)
Definition: trxd.h:64
uint32_t fn
TDMA frame number.
Definition: trxd.h:61
uint8_t tn
TDMA timeslot number.
Definition: trxd.h:62
int16_t ci_cb
Carrier-to-Interference ratio (centiBels)
Definition: trxd.h:72
uint32_t flags
see OSMO_TRXD_F_*
Definition: trxd.h:58
uint8_t tsc_set
Training Sequence Set.
Definition: trxd.h:70
uint8_t tsc
Training Sequence Code.
Definition: trxd.h:71
int16_t toa256
Timing of Arrival in units of 1/256 of symbol.
Definition: trxd.h:63
size_t burst_len
number of soft-bits (0 for NOPE.ind)
Definition: trxd.h:66
sbit_t burst[OSMO_TRXD_BURST_LEN_MAX]
soft-bits buffer
Definition: trxd.h:65
L1 -> TRX: burst transmit request (hard bits).
Definition: trxd.h:78
uint32_t fn
TDMA frame number.
Definition: trxd.h:82
int8_t scpir
SCPIR (AQPSK only, TRXDv2)
Definition: trxd.h:92
uint8_t att
Tx power attenuation (BTS side)
Definition: trxd.h:84
uint32_t flags
see OSMO_TRXD_F_*
Definition: trxd.h:79
uint8_t trx_num
TRX (RF channel) number.
Definition: trxd.h:93
enum osmo_trxd_mod_type mod
Modulation type.
Definition: trxd.h:89
uint8_t tsc_set
Training Sequence Set.
Definition: trxd.h:90
uint8_t tsc
Training Sequence Code.
Definition: trxd.h:91
size_t burst_len
number of hard-bits
Definition: trxd.h:86
uint8_t tn
TDMA timeslot number.
Definition: trxd.h:83
ubit_t burst[OSMO_TRXD_BURST_LEN_MAX]
hard-bits buffer
Definition: trxd.h:85
Parser state, keeping cross-PDU context for TRXDv2 batches.
Definition: trxd.h:98
unsigned int num_pdus
number of PDUs parsed so far
Definition: trxd.h:100
uint8_t pdu_ver
PDU version (parsed from the first PDU)
Definition: trxd.h:99
uint32_t fn
TDMA fn of the first PDU (v2 batches omit it later)
Definition: trxd.h:101
const char * osmo_trxd_burst_req_name(const struct osmo_trxd_burst_req *br)
Compose a human-readable representation of the given burst transmit request (for logging),...
Definition: trxd.c:712
char * osmo_trxd_burst_req_name_buf(char *buf, size_t buf_len, const struct osmo_trxd_burst_req *br)
Compose a human-readable representation of the given burst transmit request (for logging),...
Definition: trxd.c:724
void osmo_trxd_build_fin(struct msgb *msg, uint8_t pdu_ver)
Finalize a datagram built by osmo_trxd_burst_{ind,req}_build().
Definition: trxd.c:657
const char * osmo_trxd_burst_ind_name(const struct osmo_trxd_burst_ind *bi)
Compose a human-readable representation of the given burst indication (for logging),...
Definition: trxd.c:672
int osmo_trxd_burst_req_build(struct msgb *msg, uint8_t pdu_ver, const struct osmo_trxd_burst_req *br)
Append one encoded burst transmit request (L1 -> TRX) PDU to the given msgb.
Definition: trxd.c:606
int osmo_trxd_burst_ind_parse(struct osmo_trxd_parse_state *st, struct osmo_trxd_burst_ind *bi, const uint8_t *buf, size_t buf_len)
Parse one burst indication (TRX -> L1) PDU from the given buffer.
Definition: trxd.c:313
#define OSMO_TRXD_BURST_LEN_MAX
Maximum burst length in (soft-)bits.
Definition: trxd.h:21
int osmo_trxd_burst_req_parse(struct osmo_trxd_parse_state *st, struct osmo_trxd_burst_req *br, const uint8_t *buf, size_t buf_len)
Parse one burst transmit request (L1 -> TRX) PDU from the given buffer.
Definition: trxd.c:553
const struct value_string osmo_trxd_mod_type_names[]
Definition: trxd.c:52
osmo_trxd_mod_type
Modulation types (defined by the TRXDv2 MTS encoding, 3GPP TS 45.002)
Definition: trxd.h:33
@ OSMO_TRXD_MOD_T_AQPSK
Definition: trxd.h:36
@ OSMO_TRXD_MOD_T_GMSK
Definition: trxd.h:34
@ OSMO_TRXD_MOD_T_8PSK
Definition: trxd.h:35
static const char * osmo_trxd_mod_type_name(enum osmo_trxd_mod_type mod)
Definition: trxd.h:127
void osmo_trxd_parse_state_init(struct osmo_trxd_parse_state *st)
Initialize a parser state; call before parsing each datagram.
Definition: trxd.c:61
int osmo_trxd_burst_ind_build(struct msgb *msg, uint8_t pdu_ver, const struct osmo_trxd_burst_ind *bi)
Append one encoded burst indication (TRX -> L1) PDU to the given msgb.
Definition: trxd.c:394
char * osmo_trxd_burst_ind_name_buf(char *buf, size_t buf_len, const struct osmo_trxd_burst_ind *bi)
Compose a human-readable representation of the given burst indication (for logging),...
Definition: trxd.c:684