|
libosmo-trx 1.8.0.50-7f5e
Osmocom TRX protocol (TRXC/TRXD) library
|
TRXD (burst data) protocol: I/O-free PDU codec. More...
#include <errno.h>#include <string.h>#include <stdint.h>#include <osmocom/core/bits.h>#include <osmocom/core/msgb.h>#include <osmocom/core/utils.h>#include <osmocom/gsm/gsm0502.h>#include <osmocom/trx/trxd.h>Macros | |
| #define | TRXD_IND_V0HDR_LEN (1 + 4 + 1 + 2) |
| #define | TRXD_IND_V1HDR_LEN (TRXD_IND_V0HDR_LEN + 1 + 2) |
| #define | TRXD_IND_V2HDR_LEN (1 + 1 + 1 + 1 + 2 + 2) |
| #define | TRXD_REQ_V01HDR_LEN (1 + 4 + 1) |
| #define | TRXD_REQ_V2HDR_LEN (1 + 1 + 1 + 1 + 1 + 3) |
Functions | |
| void | osmo_trxd_parse_state_init (struct osmo_trxd_parse_state *st) |
| Initialize a parser state; call before parsing each datagram. More... | |
| static int | burst_len_by_mod (enum osmo_trxd_mod_type mod) |
| static int | mts_parse (uint32_t *flags, enum osmo_trxd_mod_type *mod, uint8_t *tsc_set, uint8_t *tsc, uint8_t mts) |
| int | trxd_mts_parse_ind (struct osmo_trxd_burst_ind *bi, uint8_t mts) |
| int | trxd_mts_parse_req (struct osmo_trxd_burst_req *br, uint8_t mts) |
| static int | mts_build (uint8_t *mts, uint32_t flags, enum osmo_trxd_mod_type mod, uint8_t tsc_set, uint8_t tsc) |
| int | trxd_mts_build_ind (uint8_t *mts, const struct osmo_trxd_burst_ind *bi) |
| int | trxd_mts_build_req (uint8_t *mts, const struct osmo_trxd_burst_req *br) |
| static void | soft_bits_parse (sbit_t *out, const uint8_t *in, size_t len) |
| static void | soft_bits_build (uint8_t *out, const sbit_t *in, size_t len) |
| static void | trxd_burst_ind_parse_hdr_v0 (struct osmo_trxd_burst_ind *bi, const uint8_t *buf) |
| static int | trxd_burst_ind_parse_v0 (struct osmo_trxd_burst_ind *bi, const uint8_t *buf, size_t buf_len) |
| static int | trxd_burst_ind_parse_v1 (struct osmo_trxd_burst_ind *bi, const uint8_t *buf, size_t buf_len) |
| static int | trxd_burst_ind_parse_v2 (struct osmo_trxd_parse_state *st, struct osmo_trxd_burst_ind *bi, const uint8_t *buf, size_t buf_len) |
| 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. More... | |
| 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. More... | |
| static int | trxd_burst_req_parse_v01 (struct osmo_trxd_burst_req *br, const uint8_t *buf, size_t buf_len) |
| static int | trxd_burst_req_parse_v2 (struct osmo_trxd_parse_state *st, struct osmo_trxd_burst_req *br, const uint8_t *buf, size_t buf_len) |
| 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. More... | |
| 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. More... | |
| void | osmo_trxd_build_fin (struct msgb *msg, uint8_t pdu_ver) |
| Finalize a datagram built by osmo_trxd_burst_{ind,req}_build(). More... | |
| 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), store into a thread-local static buffer. More... | |
| 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), store into the given buffer. More... | |
| 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), store into a thread-local static buffer. More... | |
| 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), store into the given buffer. More... | |
Variables | |
| const struct value_string | osmo_trxd_mod_type_names [] |
TRXD (burst data) protocol: I/O-free PDU codec.
Based on the TRXD implementation in osmo-bts-trx and osmo-trx.
| #define TRXD_IND_V0HDR_LEN (1 + 4 + 1 + 2) |
| #define TRXD_IND_V1HDR_LEN (TRXD_IND_V0HDR_LEN + 1 + 2) |
| #define TRXD_IND_V2HDR_LEN (1 + 1 + 1 + 1 + 2 + 2) |
| #define TRXD_REQ_V01HDR_LEN (1 + 4 + 1) |
| #define TRXD_REQ_V2HDR_LEN (1 + 1 + 1 + 1 + 1 + 3) |
|
static |
References OSMO_TRXD_BURST_LEN_8PSK, OSMO_TRXD_BURST_LEN_GMSK, OSMO_TRXD_MOD_T_8PSK, OSMO_TRXD_MOD_T_AQPSK, and OSMO_TRXD_MOD_T_GMSK.
Referenced by osmo_trxd_burst_ind_parse(), and trxd_burst_req_parse_v2().
|
static |
References OSMO_TRXD_F_ACCESS_BURST, OSMO_TRXD_F_NOPE_IND, OSMO_TRXD_MOD_T_8PSK, OSMO_TRXD_MOD_T_AQPSK, and OSMO_TRXD_MOD_T_GMSK.
Referenced by trxd_mts_build_ind(), and trxd_mts_build_req().
|
static |
References OSMO_TRXD_F_ACCESS_BURST, OSMO_TRXD_F_MOD_TYPE, OSMO_TRXD_F_NOPE_IND, OSMO_TRXD_F_TS_INFO, OSMO_TRXD_MOD_T_8PSK, OSMO_TRXD_MOD_T_AQPSK, and OSMO_TRXD_MOD_T_GMSK.
Referenced by trxd_mts_parse_ind(), and trxd_mts_parse_req().
| void osmo_trxd_build_fin | ( | struct msgb * | msg, |
| uint8_t | pdu_ver | ||
| ) |
Finalize a datagram built by osmo_trxd_burst_{ind,req}_build().
| [in,out] | msg | message buffer holding the encoded PDU(s) |
| [in] | pdu_ver | TRXD PDU version in use |
Referenced by trx_ep_data_tx_flush().
| 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.
For TRXDv2, PDU batching works by calling this function repeatedly on the same msgb; call osmo_trxd_build_fin() once the datagram is complete (it clears the BATCH.ind bit of the last PDU).
| [in,out] | msg | destination message buffer |
| [in] | pdu_ver | TRXD PDU version to encode |
| [in] | bi | burst indication to be encoded |
References osmo_trxd_burst_ind::burst, osmo_trxd_burst_ind::burst_len, osmo_trxd_burst_ind::ci_cb, osmo_trxd_burst_ind::flags, osmo_trxd_burst_ind::fn, OSMO_TRXD_F_NOPE_IND, OSMO_TRXD_F_SHADOW_IND, osmo_trxd_burst_ind::rssi, soft_bits_build(), osmo_trxd_burst_ind::tn, osmo_trxd_burst_ind::toa256, osmo_trxd_burst_ind::trx_num, TRXD_IND_V0HDR_LEN, TRXD_IND_V1HDR_LEN, TRXD_IND_V2HDR_LEN, and trxd_mts_build_ind().
Referenced by osmo_trx_ep_send_burst_ind().
| 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), store into a thread-local static buffer.
| [in] | bi | BURST.ind to get a human-readable representation of |
References osmo_trxd_burst_ind_name_buf().
| 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), store into the given buffer.
| [out] | buf | output buffer to store the result |
| [in] | buf_len | size of the output buffer |
| [in] | bi | BURST.ind to get a human-readable representation of |
References osmo_trxd_burst_ind::burst_len, osmo_trxd_burst_ind::ci_cb, osmo_trxd_burst_ind::flags, osmo_trxd_burst_ind::fn, osmo_trxd_burst_ind::mod, OSMO_TRXD_F_CI_CB, OSMO_TRXD_F_MOD_TYPE, OSMO_TRXD_F_NOPE_IND, OSMO_TRXD_F_TRX_NUM, OSMO_TRXD_F_TS_INFO, osmo_trxd_mod_type_name(), osmo_trxd_burst_ind::rssi, osmo_trxd_burst_ind::tn, osmo_trxd_burst_ind::toa256, osmo_trxd_burst_ind::trx_num, osmo_trxd_burst_ind::tsc, and osmo_trxd_burst_ind::tsc_set.
Referenced by osmo_trxd_burst_ind_name().
| 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.
The PDU version is parsed from the first PDU of a datagram and kept in st. Starting from TRXDv2, a datagram may batch multiple PDUs: call this function repeatedly on the remaining buffer as long as the parsed PDU has OSMO_TRXD_F_BATCH_IND set in bi->flags.
| [in,out] | st | parser state (see osmo_trxd_parse_state_init()) |
| [out] | bi | parsed burst indication |
| [in] | buf | buffer positioned at the beginning of a PDU |
| [in] | buf_len | remaining length of the buffer |
References osmo_trxd_burst_ind::burst, osmo_trxd_burst_ind::burst_len, burst_len_by_mod(), osmo_trxd_burst_ind::flags, osmo_trxd_burst_ind::fn, osmo_trxd_burst_ind::mod, osmo_trxd_parse_state::num_pdus, OSMO_TRXD_F_NOPE_IND, OSMO_TRXD_PDU_VER_MAX, osmo_trxd_parse_state::pdu_ver, soft_bits_parse(), trxd_burst_ind_parse_v0(), trxd_burst_ind_parse_v1(), trxd_burst_ind_parse_v2(), TRXD_IND_V0HDR_LEN, TRXD_IND_V1HDR_LEN, and TRXD_IND_V2HDR_LEN.
Referenced by trx_ep_data_read_cb().
| 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.
For TRXDv2, PDU batching works by calling this function repeatedly on the same msgb; call osmo_trxd_build_fin() once the datagram is complete (it clears the BATCH.ind bit of the last PDU).
| [in,out] | msg | destination message buffer |
| [in] | pdu_ver | TRXD PDU version to encode |
| [in] | br | burst transmit request to be encoded |
References osmo_trxd_burst_req::att, osmo_trxd_burst_req::burst, osmo_trxd_burst_req::burst_len, osmo_trxd_burst_req::flags, osmo_trxd_burst_req::fn, OSMO_TRXD_F_NOPE_REQ, osmo_trxd_burst_req::scpir, osmo_trxd_burst_req::tn, osmo_trxd_burst_req::trx_num, trxd_mts_build_req(), TRXD_REQ_V01HDR_LEN, and TRXD_REQ_V2HDR_LEN.
Referenced by osmo_trx_ep_send_burst_req().
| 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), store into a thread-local static buffer.
| [in] | br | BURST.req to get a human-readable representation of |
References osmo_trxd_burst_req_name_buf().
| 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), store into the given buffer.
| [out] | buf | output buffer to store the result |
| [in] | buf_len | size of the output buffer |
| [in] | br | BURST.req to get a human-readable representation of |
References osmo_trxd_burst_req::att, osmo_trxd_burst_req::burst_len, osmo_trxd_burst_req::flags, osmo_trxd_burst_req::fn, osmo_trxd_burst_req::mod, OSMO_TRXD_F_MOD_TYPE, OSMO_TRXD_F_NOPE_REQ, OSMO_TRXD_F_TRX_NUM, OSMO_TRXD_F_TS_INFO, osmo_trxd_mod_type_name(), osmo_trxd_burst_req::tn, osmo_trxd_burst_req::trx_num, osmo_trxd_burst_req::tsc, and osmo_trxd_burst_req::tsc_set.
Referenced by osmo_trxd_burst_req_name().
| 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.
The PDU version is parsed from the first PDU of a datagram and kept in st. Starting from TRXDv2, a datagram may batch multiple PDUs: call this function repeatedly on the remaining buffer as long as the parsed PDU has OSMO_TRXD_F_BATCH_IND set in br->flags.
| [in,out] | st | parser state (see osmo_trxd_parse_state_init()) |
| [out] | br | parsed burst transmit request |
| [in] | buf | buffer positioned at the beginning of a PDU |
| [in] | buf_len | remaining length of the buffer |
References osmo_trxd_burst_req::fn, osmo_trxd_parse_state::num_pdus, OSMO_TRXD_PDU_VER_MAX, osmo_trxd_parse_state::pdu_ver, trxd_burst_req_parse_v01(), trxd_burst_req_parse_v2(), TRXD_REQ_V01HDR_LEN, and TRXD_REQ_V2HDR_LEN.
Referenced by trx_ep_data_read_cb().
| void osmo_trxd_parse_state_init | ( | struct osmo_trxd_parse_state * | st | ) |
Initialize a parser state; call before parsing each datagram.
| [out] | st | parser state to be initialized |
Referenced by trx_ep_data_read_cb().
|
static |
Referenced by osmo_trxd_burst_ind_build().
|
static |
Referenced by osmo_trxd_burst_ind_parse(), and trxd_burst_ind_parse_v0().
|
static |
References osmo_trxd_burst_ind::fn, osmo_trxd_burst_ind::rssi, osmo_trxd_burst_ind::tn, and osmo_trxd_burst_ind::toa256.
Referenced by trxd_burst_ind_parse_v0(), and trxd_burst_ind_parse_v1().
|
static |
References osmo_trxd_burst_ind::burst, osmo_trxd_burst_ind::burst_len, osmo_trxd_burst_ind::flags, osmo_trxd_burst_ind::mod, OSMO_TRXD_BURST_LEN_8PSK, OSMO_TRXD_BURST_LEN_GMSK, OSMO_TRXD_F_MOD_TYPE, OSMO_TRXD_F_NOPE_IND, OSMO_TRXD_MOD_T_8PSK, OSMO_TRXD_MOD_T_GMSK, soft_bits_parse(), trxd_burst_ind_parse_hdr_v0(), and TRXD_IND_V0HDR_LEN.
Referenced by osmo_trxd_burst_ind_parse().
|
static |
|
static |
References osmo_trxd_burst_ind::ci_cb, osmo_trxd_burst_ind::flags, osmo_trxd_burst_ind::fn, osmo_trxd_parse_state::fn, osmo_trxd_parse_state::num_pdus, OSMO_TRXD_F_BATCH_IND, OSMO_TRXD_F_CI_CB, OSMO_TRXD_F_SHADOW_IND, OSMO_TRXD_F_TRX_NUM, osmo_trxd_burst_ind::rssi, osmo_trxd_burst_ind::tn, osmo_trxd_burst_ind::toa256, osmo_trxd_burst_ind::trx_num, TRXD_IND_V2HDR_LEN, and trxd_mts_parse_ind().
Referenced by osmo_trxd_burst_ind_parse().
|
static |
References osmo_trxd_burst_req::att, osmo_trxd_burst_req::burst, osmo_trxd_burst_req::burst_len, osmo_trxd_burst_req::flags, osmo_trxd_burst_req::fn, osmo_trxd_burst_req::mod, OSMO_TRXD_BURST_LEN_8PSK, OSMO_TRXD_BURST_LEN_GMSK, OSMO_TRXD_F_MOD_TYPE, OSMO_TRXD_F_NOPE_REQ, OSMO_TRXD_MOD_T_8PSK, OSMO_TRXD_MOD_T_GMSK, osmo_trxd_burst_req::tn, and TRXD_REQ_V01HDR_LEN.
Referenced by osmo_trxd_burst_req_parse().
|
static |
References osmo_trxd_burst_req::att, osmo_trxd_burst_req::burst, osmo_trxd_burst_req::burst_len, burst_len_by_mod(), osmo_trxd_burst_req::flags, osmo_trxd_burst_req::fn, osmo_trxd_parse_state::fn, osmo_trxd_burst_req::mod, osmo_trxd_parse_state::num_pdus, OSMO_TRXD_F_BATCH_IND, OSMO_TRXD_F_NOPE_REQ, OSMO_TRXD_F_TRX_NUM, osmo_trxd_burst_req::scpir, osmo_trxd_burst_req::tn, osmo_trxd_burst_req::trx_num, trxd_mts_parse_req(), and TRXD_REQ_V2HDR_LEN.
Referenced by osmo_trxd_burst_req_parse().
| int trxd_mts_build_ind | ( | uint8_t * | mts, |
| const struct osmo_trxd_burst_ind * | bi | ||
| ) |
References osmo_trxd_burst_ind::flags, osmo_trxd_burst_ind::mod, mts_build(), osmo_trxd_burst_ind::tsc, and osmo_trxd_burst_ind::tsc_set.
Referenced by osmo_trxd_burst_ind_build().
| int trxd_mts_build_req | ( | uint8_t * | mts, |
| const struct osmo_trxd_burst_req * | br | ||
| ) |
References osmo_trxd_burst_req::flags, osmo_trxd_burst_req::mod, mts_build(), osmo_trxd_burst_req::tsc, and osmo_trxd_burst_req::tsc_set.
Referenced by osmo_trxd_burst_req_build().
| int trxd_mts_parse_ind | ( | struct osmo_trxd_burst_ind * | bi, |
| uint8_t | mts | ||
| ) |
References osmo_trxd_burst_ind::flags, osmo_trxd_burst_ind::mod, mts_parse(), osmo_trxd_burst_ind::tsc, and osmo_trxd_burst_ind::tsc_set.
Referenced by trxd_burst_ind_parse_v1(), and trxd_burst_ind_parse_v2().
| int trxd_mts_parse_req | ( | struct osmo_trxd_burst_req * | br, |
| uint8_t | mts | ||
| ) |
References osmo_trxd_burst_req::flags, osmo_trxd_burst_req::mod, mts_parse(), osmo_trxd_burst_req::tsc, and osmo_trxd_burst_req::tsc_set.
Referenced by trxd_burst_req_parse_v2().
| const struct value_string osmo_trxd_mod_type_names[] |
Referenced by osmo_trxd_mod_type_name().