Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file gsm_04_12.h |
| 2 | * GSM TS 04.12 definitions for Short Message Service Cell Broadcast. */ |
| 3 | |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 4 | #pragma once |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 5 | |
| 6 | #include <stdint.h> |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 7 | #include <osmocom/core/endian.h> |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 8 | |
Harald Welte | 61ced83 | 2014-12-30 13:18:26 +0100 | [diff] [blame] | 9 | #define GSM412_MSG_LEN 88 /* TS 04.12 Section 3.1 */ |
| 10 | #define GSM412_BLOCK_LEN 22 /* TS 04.12 Section 3.1 */ |
| 11 | |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 12 | #define GSM412_SEQ_FST_BLOCK 0x0 |
| 13 | #define GSM412_SEQ_SND_BLOCK 0x1 |
| 14 | #define GSM412_SEQ_TRD_BLOCK 0x2 |
| 15 | #define GSM412_SEQ_FTH_BLOCK 0x3 |
| 16 | #define GSM412_SEQ_FST_SCHED_BLOCK 0x8 |
Alex Badea | 3ba0a2b | 2010-11-27 20:00:39 +0200 | [diff] [blame] | 17 | #define GSM412_SEQ_NULL_MSG 0xf |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 18 | |
| 19 | struct gsm412_block_type { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 20 | #if OSMO_IS_LITTLE_ENDIAN |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 21 | uint8_t seq_nr : 4, |
| 22 | lb : 1, |
| 23 | lpd : 2, |
| 24 | spare : 1; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 25 | #elif OSMO_IS_BIG_ENDIAN |
| 26 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ |
| 27 | uint8_t spare:1, lpd:2, lb:1, seq_nr:4; |
| 28 | #endif |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 29 | } __attribute__((packed)); |
| 30 | |
Alex Badea | 3ba0a2b | 2010-11-27 20:00:39 +0200 | [diff] [blame] | 31 | struct gsm412_sched_msg { |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 32 | #if OSMO_IS_LITTLE_ENDIAN |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 33 | uint8_t beg_slot_nr : 6, |
| 34 | type : 2; |
| 35 | uint8_t end_slot_nr : 6, |
| 36 | spare1 : 1, spare2: 1; |
| 37 | uint8_t cbsms_msg_map[6]; |
| 38 | uint8_t data[0]; |
Neels Hofmeyr | b260039 | 2018-11-16 00:20:39 +0100 | [diff] [blame] | 39 | #elif OSMO_IS_BIG_ENDIAN |
| 40 | /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ |
| 41 | uint8_t type:2, beg_slot_nr:6; |
| 42 | uint8_t spare2:1, spare1:1, end_slot_nr:6; |
| 43 | uint8_t cbsms_msg_map[6]; |
| 44 | uint8_t data[0]; |
| 45 | #endif |
Holger Hans Peter Freyther | 0d60aa2 | 2010-07-21 05:02:33 +0800 | [diff] [blame] | 46 | } __attribute__((packed)); |