Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 1 | #pragma once |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 2 | |
| 3 | #include <osmocom/core/prim.h> |
| 4 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 5 | /*! \brief PH-SAP related primitives (L1<->L2 SAP) */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 6 | enum 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 Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 12 | PRIM_MPH_INFO, /*!< \brief MPH-INFO */ |
| 13 | PRIM_TCH, /*!< \brief TCH */ |
| 14 | PRIM_TCH_RTS, /*!< \brief TCH */ |
| 15 | }; |
| 16 | |
Max | adef12a | 2016-05-25 15:25:02 +0200 | [diff] [blame] | 17 | extern const struct value_string osmo_ph_prim_names[]; |
| 18 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 19 | /*! \brief PH-SAP related primitives (L1<->L2 SAP) */ |
| 20 | enum 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 Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 28 | }; |
| 29 | |
Max | cc00bf8 | 2016-02-22 11:03:26 +0100 | [diff] [blame] | 30 | /*! \brief PH-DATA presence information */ |
| 31 | enum 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 Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 40 | /*! \brief for PH-RANDOM_ACCESS.req */ |
| 41 | struct 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 | |
bhargava | 1a96946 | 2016-07-14 13:15:09 +0530 | [diff] [blame] | 49 | /*! \brief for PH_RA_IND burstType inforamtion */ |
| 50 | enum 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 Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 57 | /*! \brief for PH-RANDOM_ACCESS.ind */ |
| 58 | struct ph_rach_ind_param { |
Andreas Eversberg | 610517c | 2013-06-12 09:21:18 +0200 | [diff] [blame] | 59 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
bhargava | 1a96946 | 2016-07-14 13:15:09 +0530 | [diff] [blame] | 60 | uint16_t ra; /*!< \brief Random Access */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 61 | uint8_t acc_delay; /*!< \brief Delay in bit periods */ |
| 62 | uint32_t fn; /*!< \brief GSM Frame Number at time of RA */ |
bhargava | 1a96946 | 2016-07-14 13:15:09 +0530 | [diff] [blame] | 63 | uint8_t is_11bit; /*!< \brief no.of bits in RACH*/ |
| 64 | enum ph_burst_type burst_type; /*!< \brief type of burst*/ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 65 | }; |
| 66 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 67 | /*! \brief for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 68 | struct ph_data_param { |
| 69 | uint8_t link_id; /*!< \brief Link Identifier (Like RSL) */ |
| 70 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 71 | uint32_t fn; /*!< \brief GSM Frame Number */ |
Andreas Eversberg | 15b8057 | 2013-03-16 16:34:55 +0100 | [diff] [blame] | 72 | int8_t rssi; /*!< \brief RSSI of receivedindication */ |
Max | 9a9739c | 2016-07-21 14:24:37 +0200 | [diff] [blame] | 73 | uint16_t ber10k; /*!< \brief BER in units of 0.01% */ |
| 74 | int16_t ta_offs_qbits; /* !< \brief Burst TA Offset in quarter bits */ |
| 75 | int16_t lqual_cb; /* !< \brief Link quality in centiBel */ |
Max | cc00bf8 | 2016-02-22 11:03:26 +0100 | [diff] [blame] | 76 | enum osmo_ph_pres_info_type pdch_presence_info; /*!< \brief Info regarding presence/validity of header and data parts */ |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | /*! \brief for TCH.{req,ind} | TCH-RTS.ind */ |
| 80 | struct ph_tch_param { |
| 81 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 82 | uint32_t fn; /*!< \brief GSM Frame Number */ |
Andreas Eversberg | 15b8057 | 2013-03-16 16:34:55 +0100 | [diff] [blame] | 83 | int8_t rssi; /*!< \brief RSSI of received indication */ |
Max | c69de3e | 2016-08-12 16:18:56 +0200 | [diff] [blame] | 84 | uint8_t marker; /*!< \brief RTP Marker bit (speech onset indicator) */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | /*! \brief for PH-CONN.ind */ |
| 88 | struct ph_conn_ind_param { |
| 89 | uint32_t fn; /*!< \brief GSM Frame Number */ |
| 90 | }; |
| 91 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 92 | /*! \brief for TIME MPH-INFO.ind */ |
| 93 | struct info_time_ind_param { |
| 94 | uint32_t fn; /*!< \brief GSM Frame Number */ |
| 95 | }; |
| 96 | |
| 97 | /*! \brief for MEAS MPH-INFO.ind */ |
| 98 | struct info_meas_ind_param { |
| 99 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
Philipp Maier | 18d49d6 | 2017-03-02 10:27:13 +0100 | [diff] [blame] | 100 | uint32_t fn; /*!< \brief GSM Frame Number */ |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 101 | uint16_t ber10k; /*!< \brief BER in units of 0.01% */ |
| 102 | int16_t ta_offs_qbits; /*!< \brief timing advance offset (in qbits) */ |
| 103 | int16_t c_i_cb; /*!< \brief C/I ratio in 0.1 dB */ |
| 104 | uint8_t is_sub:1; /*!< \brief flags */ |
| 105 | uint8_t inv_rssi; /*!< \brief RSSI in dBm * -1 */ |
| 106 | }; |
| 107 | |
| 108 | /*! \brief for {ACTIVATE,DEACTIVATE,MODIFY} MPH-INFO.req */ |
| 109 | struct info_act_req_param { |
| 110 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 111 | uint8_t sacch_only; /*!< \breif Only deactivate SACCH */ |
| 112 | }; |
| 113 | |
| 114 | /*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.cnf */ |
| 115 | struct info_act_cnf_param { |
| 116 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 117 | uint8_t cause; /*!< \brief RSL cause in case of nack */ |
| 118 | }; |
| 119 | |
| 120 | /*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.{req,cnf} */ |
| 121 | struct info_ciph_req_param { |
| 122 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 123 | uint8_t downlink; /*!< \brief Apply to downlink */ |
| 124 | uint8_t uplink; /*!< \brief Apply to uplink */ |
| 125 | }; |
| 126 | |
| 127 | /*! \brief for MPH-INFO.ind */ |
| 128 | struct mph_info_param { |
| 129 | enum osmo_mph_info_type type; /*!< \brief Info message type */ |
| 130 | union { |
| 131 | struct info_time_ind_param time_ind; |
| 132 | struct info_meas_ind_param meas_ind; |
| 133 | struct info_act_req_param act_req; |
| 134 | struct info_act_cnf_param act_cnf; |
| 135 | struct info_ciph_req_param ciph_req; |
| 136 | } u; |
| 137 | }; |
| 138 | |
| 139 | /*! \brief primitive header for PH-SAP primitives */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 140 | struct osmo_phsap_prim { |
| 141 | struct osmo_prim_hdr oph; /*!< \brief generic primitive header */ |
| 142 | union { |
| 143 | struct ph_data_param data; |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 144 | struct ph_tch_param tch; |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 145 | struct ph_rach_req_param rach_req; |
| 146 | struct ph_rach_ind_param rach_ind; |
| 147 | struct ph_conn_ind_param conn_ind; |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 148 | struct mph_info_param info; |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 149 | } u; /*!< \brief request-specific data */ |
| 150 | }; |