Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file gsm_04_14.h */ |
| 2 | |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 3 | #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 */ |
| 12 | enum 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 Munaut | ebaefce | 2019-02-07 09:16:22 +0100 | [diff] [blame] | 23 | #define GSM414_MT_OPEN_LOOP_CMD 0x06 /* 8.3 */ |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 24 | #define GSM414_OPEN_LOOP_ACK_IE 0x81 |
| 25 | |
| 26 | #define GSM414_MT_CLOSE_MSLOT_LOOP_CMD 0x20 /* 8.4 */ |
| 27 | struct gsm414_close_mslot_loop_cmd { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 28 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 29 | uint8_t chc:2, |
| 30 | loop_mech:3, |
| 31 | tn:3; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 32 | #elif OSMO_IS_BIG_ENDIAN |
| 33 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ |
| 34 | uint8_t tn:3, loop_mech:3, chc:2; |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 35 | #endif |
| 36 | } __attribute__((packed)); |
| 37 | |
| 38 | #define GSM414_MT_CLOSE_MSLOT_LOOP_ACK 0x21 /* 8.5 */ |
| 39 | struct gsm414_close_mslot_loop_ack { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 40 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 41 | uint8_t err_ind:1, |
| 42 | loop_mech:3, |
| 43 | chc:2, |
| 44 | spare:2; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 45 | #elif OSMO_IS_BIG_ENDIAN |
| 46 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ |
| 47 | uint8_t spare:2, chc:2, loop_mech:3, err_ind:1; |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 48 | #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 */ |
| 64 | struct gsm414_gprs_test_mode_cmd { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 65 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 66 | uint16_t d:12, |
| 67 | spare:3, |
| 68 | l:1; |
| 69 | uint8_t m:1, |
| 70 | dl_tx_offset:3, |
| 71 | _spare:4; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 72 | #elif OSMO_IS_BIG_ENDIAN |
| 73 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ |
| 74 | uint16_t d:12, |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 75 | spare:3, |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 76 | l:1; |
| 77 | uint8_t _spare:4, dl_tx_offset:3, m:1; |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 78 | #endif |
| 79 | } __attribute__((packed)); |
| 80 | |
| 81 | |
| 82 | #define GSM414_MT_EGPRS_ST_RB_LOOP_CMD 0x25 /* 8.14 */ |
| 83 | struct gsm414_egprs_st_sb_loop_cmd { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 84 | #if OSMO_IS_LITTLE_ENDIAN |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 85 | uint8_t _spare:4, |
| 86 | dl_tx_offset:3, |
| 87 | m:1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 88 | #elif OSMO_IS_BIG_ENDIAN |
| 89 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ |
| 90 | uint8_t m:1, dl_tx_offset:3, _spare:4; |
Harald Welte | 2956737 | 2017-05-29 15:58:43 +0200 | [diff] [blame] | 91 | #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 | |
| 98 | extern const struct value_string gsm414_msgt_names[]; |