blob: 098e4f07fb3e7c01690c60ef2c71399f07183672 [file] [log] [blame]
Sylvain Munaut12ba7782014-06-16 10:13:40 +02001#pragma once
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +01002
3#include <osmocom/core/prim.h>
4
Andreas Eversberg227a9de2013-02-07 12:21:33 +01005/*! \brief PH-SAP related primitives (L1<->L2 SAP) */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +01006enum osmo_ph_prim {
7 PRIM_PH_DATA, /*!< \brief PH-DATA */
8 PRIM_PH_RACH, /*!< \brief PH-RANDOM_ACCESS */
9 PRIM_PH_CONN, /*!< \brief PH-CONNECT */
10 PRIM_PH_EMPTY_FRAME, /*!< \brief PH-EMPTY_FRAME */
11 PRIM_PH_RTS, /*!< \brief PH-RTS */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010012 PRIM_MPH_INFO, /*!< \brief MPH-INFO */
13 PRIM_TCH, /*!< \brief TCH */
14 PRIM_TCH_RTS, /*!< \brief TCH */
15};
16
Maxadef12a2016-05-25 15:25:02 +020017extern const struct value_string osmo_ph_prim_names[];
18
Andreas Eversberg227a9de2013-02-07 12:21:33 +010019/*! \brief PH-SAP related primitives (L1<->L2 SAP) */
20enum osmo_mph_info_type {
21 PRIM_INFO_TIME, /*!< \brief Current GSM time */
22 PRIM_INFO_MEAS, /*!< \brief Measurement indication */
23 PRIM_INFO_ACTIVATE, /*!< \brief Activation of channel */
24 PRIM_INFO_DEACTIVATE, /*!< \brief Deactivation of channel */
25 PRIM_INFO_MODIFY, /*!< \brief Mode Modify of channel */
26 PRIM_INFO_ACT_CIPH, /*!< \brief Activation of ciphering */
27 PRIM_INFO_DEACT_CIPH, /*!< \brief Deactivation of ciphering */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010028};
29
Maxcc00bf82016-02-22 11:03:26 +010030/*! \brief PH-DATA presence information */
31enum osmo_ph_pres_info_type {
32 PRES_INFO_INVALID = 0, /*!< \brief Data is invalid */
33 PRES_INFO_HEADER = 1, /*!< \brief Only header is present and valid */
34 PRES_INFO_FIRST = 3, /*!< \brief First half of data + header are valid (2nd half may be present but invalid) */
35 PRES_INFO_SECOND = 5, /*!< \brief Second half of data + header are valid (1st halfmay be present but invalid) */
36 PRES_INFO_BOTH = 7, /*!< \brief Both parts + header are present and valid */
37 PRES_INFO_UNKNOWN
38};
39
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010040/*! \brief for PH-RANDOM_ACCESS.req */
41struct ph_rach_req_param {
42 uint8_t ra; /*!< \brief Random Access */
43 uint8_t ta; /*!< \brief Timing Advance */
44 uint8_t tx_power; /*!< \brief Transmit Power */
45 uint8_t is_combined_ccch;/*!< \brief Are we using a combined CCCH? */
46 uint16_t offset; /*!< \brief Timing Offset */
47};
48
bhargava1a969462016-07-14 13:15:09 +053049/*! \brief for PH_RA_IND burstType inforamtion */
50enum ph_burst_type {
51 GSM_L1_BURST_TYPE_NONE = 0,
52 GSM_L1_BURST_TYPE_ACCESS_0,
53 GSM_L1_BURST_TYPE_ACCESS_1,
54 GSM_L1_BURST_TYPE_ACCESS_2
55};
56
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010057/*! \brief for PH-RANDOM_ACCESS.ind */
58struct ph_rach_ind_param {
Andreas Eversberg610517c2013-06-12 09:21:18 +020059 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
bhargava1a969462016-07-14 13:15:09 +053060 uint16_t ra; /*!< \brief Random Access */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010061 uint8_t acc_delay; /*!< \brief Delay in bit periods */
62 uint32_t fn; /*!< \brief GSM Frame Number at time of RA */
bhargava1a969462016-07-14 13:15:09 +053063 uint8_t is_11bit; /*!< \brief no.of bits in RACH*/
64 enum ph_burst_type burst_type; /*!< \brief type of burst*/
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010065};
66
Andreas Eversberg227a9de2013-02-07 12:21:33 +010067/*! \brief for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010068struct ph_data_param {
69 uint8_t link_id; /*!< \brief Link Identifier (Like RSL) */
70 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010071 uint32_t fn; /*!< \brief GSM Frame Number */
Andreas Eversberg15b80572013-03-16 16:34:55 +010072 int8_t rssi; /*!< \brief RSSI of receivedindication */
Maxcc00bf82016-02-22 11:03:26 +010073 enum osmo_ph_pres_info_type pdch_presence_info; /*!< \brief Info regarding presence/validity of header and data parts */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010074};
75
76/*! \brief for TCH.{req,ind} | TCH-RTS.ind */
77struct ph_tch_param {
78 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
79 uint32_t fn; /*!< \brief GSM Frame Number */
Andreas Eversberg15b80572013-03-16 16:34:55 +010080 int8_t rssi; /*!< \brief RSSI of received indication */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010081};
82
83/*! \brief for PH-CONN.ind */
84struct ph_conn_ind_param {
85 uint32_t fn; /*!< \brief GSM Frame Number */
86};
87
Andreas Eversberg227a9de2013-02-07 12:21:33 +010088/*! \brief for TIME MPH-INFO.ind */
89struct info_time_ind_param {
90 uint32_t fn; /*!< \brief GSM Frame Number */
91};
92
93/*! \brief for MEAS MPH-INFO.ind */
94struct info_meas_ind_param {
95 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
96 uint16_t ber10k; /*!< \brief BER in units of 0.01% */
97 int16_t ta_offs_qbits; /*!< \brief timing advance offset (in qbits) */
98 int16_t c_i_cb; /*!< \brief C/I ratio in 0.1 dB */
99 uint8_t is_sub:1; /*!< \brief flags */
100 uint8_t inv_rssi; /*!< \brief RSSI in dBm * -1 */
101};
102
103/*! \brief for {ACTIVATE,DEACTIVATE,MODIFY} MPH-INFO.req */
104struct info_act_req_param {
105 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
106 uint8_t sacch_only; /*!< \breif Only deactivate SACCH */
107};
108
109/*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.cnf */
110struct info_act_cnf_param {
111 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
112 uint8_t cause; /*!< \brief RSL cause in case of nack */
113};
114
115/*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.{req,cnf} */
116struct info_ciph_req_param {
117 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
118 uint8_t downlink; /*!< \brief Apply to downlink */
119 uint8_t uplink; /*!< \brief Apply to uplink */
120};
121
122/*! \brief for MPH-INFO.ind */
123struct mph_info_param {
124 enum osmo_mph_info_type type; /*!< \brief Info message type */
125 union {
126 struct info_time_ind_param time_ind;
127 struct info_meas_ind_param meas_ind;
128 struct info_act_req_param act_req;
129 struct info_act_cnf_param act_cnf;
130 struct info_ciph_req_param ciph_req;
131 } u;
132};
133
134/*! \brief primitive header for PH-SAP primitives */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100135struct osmo_phsap_prim {
136 struct osmo_prim_hdr oph; /*!< \brief generic primitive header */
137 union {
138 struct ph_data_param data;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100139 struct ph_tch_param tch;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100140 struct ph_rach_req_param rach_req;
141 struct ph_rach_ind_param rach_ind;
142 struct ph_conn_ind_param conn_ind;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100143 struct mph_info_param info;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100144 } u; /*!< \brief request-specific data */
145};