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 | |
| 17 | /*! \brief PH-SAP related primitives (L1<->L2 SAP) */ |
| 18 | enum osmo_mph_info_type { |
| 19 | PRIM_INFO_TIME, /*!< \brief Current GSM time */ |
| 20 | PRIM_INFO_MEAS, /*!< \brief Measurement indication */ |
| 21 | PRIM_INFO_ACTIVATE, /*!< \brief Activation of channel */ |
| 22 | PRIM_INFO_DEACTIVATE, /*!< \brief Deactivation of channel */ |
| 23 | PRIM_INFO_MODIFY, /*!< \brief Mode Modify of channel */ |
| 24 | PRIM_INFO_ACT_CIPH, /*!< \brief Activation of ciphering */ |
| 25 | PRIM_INFO_DEACT_CIPH, /*!< \brief Deactivation of ciphering */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 26 | }; |
| 27 | |
Max | cc00bf8 | 2016-02-22 11:03:26 +0100 | [diff] [blame] | 28 | /*! \brief PH-DATA presence information */ |
| 29 | enum osmo_ph_pres_info_type { |
| 30 | PRES_INFO_INVALID = 0, /*!< \brief Data is invalid */ |
| 31 | PRES_INFO_HEADER = 1, /*!< \brief Only header is present and valid */ |
| 32 | PRES_INFO_FIRST = 3, /*!< \brief First half of data + header are valid (2nd half may be present but invalid) */ |
| 33 | PRES_INFO_SECOND = 5, /*!< \brief Second half of data + header are valid (1st halfmay be present but invalid) */ |
| 34 | PRES_INFO_BOTH = 7, /*!< \brief Both parts + header are present and valid */ |
| 35 | PRES_INFO_UNKNOWN |
| 36 | }; |
| 37 | |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 38 | /*! \brief for PH-RANDOM_ACCESS.req */ |
| 39 | struct ph_rach_req_param { |
| 40 | uint8_t ra; /*!< \brief Random Access */ |
| 41 | uint8_t ta; /*!< \brief Timing Advance */ |
| 42 | uint8_t tx_power; /*!< \brief Transmit Power */ |
| 43 | uint8_t is_combined_ccch;/*!< \brief Are we using a combined CCCH? */ |
| 44 | uint16_t offset; /*!< \brief Timing Offset */ |
| 45 | }; |
| 46 | |
| 47 | /*! \brief for PH-RANDOM_ACCESS.ind */ |
| 48 | struct ph_rach_ind_param { |
Andreas Eversberg | 610517c | 2013-06-12 09:21:18 +0200 | [diff] [blame] | 49 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 50 | uint8_t ra; /*!< \brief Random Access */ |
| 51 | uint8_t acc_delay; /*!< \brief Delay in bit periods */ |
| 52 | uint32_t fn; /*!< \brief GSM Frame Number at time of RA */ |
| 53 | }; |
| 54 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 55 | /*! \brief for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 56 | struct ph_data_param { |
| 57 | uint8_t link_id; /*!< \brief Link Identifier (Like RSL) */ |
| 58 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 59 | uint32_t fn; /*!< \brief GSM Frame Number */ |
Andreas Eversberg | 15b8057 | 2013-03-16 16:34:55 +0100 | [diff] [blame] | 60 | int8_t rssi; /*!< \brief RSSI of receivedindication */ |
Max | cc00bf8 | 2016-02-22 11:03:26 +0100 | [diff] [blame] | 61 | 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] | 62 | }; |
| 63 | |
| 64 | /*! \brief for TCH.{req,ind} | TCH-RTS.ind */ |
| 65 | struct ph_tch_param { |
| 66 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 67 | uint32_t fn; /*!< \brief GSM Frame Number */ |
Andreas Eversberg | 15b8057 | 2013-03-16 16:34:55 +0100 | [diff] [blame] | 68 | int8_t rssi; /*!< \brief RSSI of received indication */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | /*! \brief for PH-CONN.ind */ |
| 72 | struct ph_conn_ind_param { |
| 73 | uint32_t fn; /*!< \brief GSM Frame Number */ |
| 74 | }; |
| 75 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 76 | /*! \brief for TIME MPH-INFO.ind */ |
| 77 | struct info_time_ind_param { |
| 78 | uint32_t fn; /*!< \brief GSM Frame Number */ |
| 79 | }; |
| 80 | |
| 81 | /*! \brief for MEAS MPH-INFO.ind */ |
| 82 | struct info_meas_ind_param { |
| 83 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 84 | uint16_t ber10k; /*!< \brief BER in units of 0.01% */ |
| 85 | int16_t ta_offs_qbits; /*!< \brief timing advance offset (in qbits) */ |
| 86 | int16_t c_i_cb; /*!< \brief C/I ratio in 0.1 dB */ |
| 87 | uint8_t is_sub:1; /*!< \brief flags */ |
| 88 | uint8_t inv_rssi; /*!< \brief RSSI in dBm * -1 */ |
| 89 | }; |
| 90 | |
| 91 | /*! \brief for {ACTIVATE,DEACTIVATE,MODIFY} MPH-INFO.req */ |
| 92 | struct info_act_req_param { |
| 93 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 94 | uint8_t sacch_only; /*!< \breif Only deactivate SACCH */ |
| 95 | }; |
| 96 | |
| 97 | /*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.cnf */ |
| 98 | struct info_act_cnf_param { |
| 99 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 100 | uint8_t cause; /*!< \brief RSL cause in case of nack */ |
| 101 | }; |
| 102 | |
| 103 | /*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.{req,cnf} */ |
| 104 | struct info_ciph_req_param { |
| 105 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 106 | uint8_t downlink; /*!< \brief Apply to downlink */ |
| 107 | uint8_t uplink; /*!< \brief Apply to uplink */ |
| 108 | }; |
| 109 | |
| 110 | /*! \brief for MPH-INFO.ind */ |
| 111 | struct mph_info_param { |
| 112 | enum osmo_mph_info_type type; /*!< \brief Info message type */ |
| 113 | union { |
| 114 | struct info_time_ind_param time_ind; |
| 115 | struct info_meas_ind_param meas_ind; |
| 116 | struct info_act_req_param act_req; |
| 117 | struct info_act_cnf_param act_cnf; |
| 118 | struct info_ciph_req_param ciph_req; |
| 119 | } u; |
| 120 | }; |
| 121 | |
| 122 | /*! \brief primitive header for PH-SAP primitives */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 123 | struct osmo_phsap_prim { |
| 124 | struct osmo_prim_hdr oph; /*!< \brief generic primitive header */ |
| 125 | union { |
| 126 | struct ph_data_param data; |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 127 | struct ph_tch_param tch; |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 128 | struct ph_rach_req_param rach_req; |
| 129 | struct ph_rach_ind_param rach_ind; |
| 130 | struct ph_conn_ind_param conn_ind; |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 131 | struct mph_info_param info; |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 132 | } u; /*!< \brief request-specific data */ |
| 133 | }; |