blob: dddec5195704cad1083ec07215e5762454610216 [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gsm_04_14.h */
2
Harald Welte29567372017-05-29 15:58:43 +02003#pragma once
4
5#include <stdint.h>
6#include <osmocom/core/endian.h>
7#include <osmocom/core/utils.h>
8
9/* According to 3GPP TS 44.014 / GSM TS 04.14 */
10
11#define GSM414_MT_CLOSE_TCH_LOOP_CMD 0x00 /* 8.1 */
12enum gsm414_tch_loop_mode {
13 GSM414_LOOP_A = 0x00,
14 GSM414_LOOP_B = 0x01,
15 GSM414_LOOP_C = 0x02,
16 GSM414_LOOP_D = 0x04,
17 GSM414_LOOP_E = 0x08,
18 GSM414_LOOP_F = 0x0c,
19 GSM414_LOOP_I = 0x1c,
20};
21
22#define GSM414_MT_CLOSE_TCH_LOOP_ACK 0x01 /* 8.2 */
Sylvain Munautebaefce2019-02-07 09:16:22 +010023#define GSM414_MT_OPEN_LOOP_CMD 0x06 /* 8.3 */
Harald Welte29567372017-05-29 15:58:43 +020024#define GSM414_OPEN_LOOP_ACK_IE 0x81
25
26#define GSM414_MT_CLOSE_MSLOT_LOOP_CMD 0x20 /* 8.4 */
27struct gsm414_close_mslot_loop_cmd {
Neels Hofmeyrb2600392018-11-16 00:20:39 +010028#if OSMO_IS_LITTLE_ENDIAN
Harald Welte29567372017-05-29 15:58:43 +020029 uint8_t chc:2,
30 loop_mech:3,
31 tn:3;
Neels Hofmeyrb2600392018-11-16 00:20:39 +010032#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +010033/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +010034 uint8_t tn:3, loop_mech:3, chc:2;
Harald Welte29567372017-05-29 15:58:43 +020035#endif
36} __attribute__((packed));
37
38#define GSM414_MT_CLOSE_MSLOT_LOOP_ACK 0x21 /* 8.5 */
39struct gsm414_close_mslot_loop_ack {
Neels Hofmeyrb2600392018-11-16 00:20:39 +010040#if OSMO_IS_LITTLE_ENDIAN
Harald Welte29567372017-05-29 15:58:43 +020041 uint8_t err_ind:1,
42 loop_mech:3,
43 chc:2,
44 spare:2;
Neels Hofmeyrb2600392018-11-16 00:20:39 +010045#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +010046/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +010047 uint8_t spare:2, chc:2, loop_mech:3, err_ind:1;
Harald Welte29567372017-05-29 15:58:43 +020048#endif
49} __attribute__((packed));
50
51#define GSM414_MT_OPEN_MSLOT_LOOP_CMD 0x22 /* 8.6 */
52#define GSM414_MT_OPEN_MSLOT_LOOP_ACK 0x23 /* 8.7 */
53#define GSM414_MT_ACT_EMMI_CMD 0x0c /* 8.8 */
54#define GSM414_MT_ACT_EMMI_ACK 0x0d /* 8.9 */
55#define GSM414_MT_DEACT_EMMI_CMD 0x80 /* 8.10 */
56#define GSM414_MT_TEST_INTERFACE 0x84 /* 8.11 */
57
58/* 8.12 Timers (milli-seconds) */
59#define GSM414_TT01_MS 2500
60#define GSM414_TT02_MS 2500
61#define GSM414_TT03_MS 50
62
63#define GSM414_MT_GPRS_TEST_MODE_CMD 0x24 /* 8.13 */
64struct gsm414_gprs_test_mode_cmd {
Neels Hofmeyrb2600392018-11-16 00:20:39 +010065#if OSMO_IS_LITTLE_ENDIAN
Harald Welte29567372017-05-29 15:58:43 +020066 uint16_t d:12,
67 spare:3,
68 l:1;
69 uint8_t m:1,
70 dl_tx_offset:3,
71 _spare:4;
Neels Hofmeyrb2600392018-11-16 00:20:39 +010072#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +010073/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +010074 uint16_t d:12,
Harald Welte29567372017-05-29 15:58:43 +020075 spare:3,
Neels Hofmeyrb2600392018-11-16 00:20:39 +010076 l:1;
77 uint8_t _spare:4, dl_tx_offset:3, m:1;
Harald Welte29567372017-05-29 15:58:43 +020078#endif
79} __attribute__((packed));
80
81
82#define GSM414_MT_EGPRS_ST_RB_LOOP_CMD 0x25 /* 8.14 */
83struct gsm414_egprs_st_sb_loop_cmd {
Neels Hofmeyrb2600392018-11-16 00:20:39 +010084#if OSMO_IS_LITTLE_ENDIAN
Harald Welte29567372017-05-29 15:58:43 +020085 uint8_t _spare:4,
86 dl_tx_offset:3,
87 m:1;
Neels Hofmeyrb2600392018-11-16 00:20:39 +010088#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +010089/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +010090 uint8_t m:1, dl_tx_offset:3, _spare:4;
Harald Welte29567372017-05-29 15:58:43 +020091#endif
92} __attribute__((packed));
93
94#define GSM414_MT_RESET_MS_POS_STORED 0x26 /* 8.15 */
95#define GSM414_MS_POS_TECH_AGPS 0x00
96#define GSM414_MS_POS_TECH_AGNSS 0x01
97
98extern const struct value_string gsm414_msgt_names[];