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 | |
| 28 | /*! \brief for PH-RANDOM_ACCESS.req */ |
| 29 | struct ph_rach_req_param { |
| 30 | uint8_t ra; /*!< \brief Random Access */ |
| 31 | uint8_t ta; /*!< \brief Timing Advance */ |
| 32 | uint8_t tx_power; /*!< \brief Transmit Power */ |
| 33 | uint8_t is_combined_ccch;/*!< \brief Are we using a combined CCCH? */ |
| 34 | uint16_t offset; /*!< \brief Timing Offset */ |
| 35 | }; |
| 36 | |
| 37 | /*! \brief for PH-RANDOM_ACCESS.ind */ |
| 38 | struct ph_rach_ind_param { |
Andreas Eversberg | 610517c | 2013-06-12 09:21:18 +0200 | [diff] [blame] | 39 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 40 | uint8_t ra; /*!< \brief Random Access */ |
| 41 | uint8_t acc_delay; /*!< \brief Delay in bit periods */ |
| 42 | uint32_t fn; /*!< \brief GSM Frame Number at time of RA */ |
| 43 | }; |
| 44 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 45 | /*! \brief for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 46 | struct ph_data_param { |
| 47 | uint8_t link_id; /*!< \brief Link Identifier (Like RSL) */ |
| 48 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 49 | uint32_t fn; /*!< \brief GSM Frame Number */ |
Andreas Eversberg | 15b8057 | 2013-03-16 16:34:55 +0100 | [diff] [blame] | 50 | int8_t rssi; /*!< \brief RSSI of receivedindication */ |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | /*! \brief for TCH.{req,ind} | TCH-RTS.ind */ |
| 54 | struct ph_tch_param { |
| 55 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 56 | uint32_t fn; /*!< \brief GSM Frame Number */ |
Andreas Eversberg | 15b8057 | 2013-03-16 16:34:55 +0100 | [diff] [blame] | 57 | int8_t rssi; /*!< \brief RSSI of received indication */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | /*! \brief for PH-CONN.ind */ |
| 61 | struct ph_conn_ind_param { |
| 62 | uint32_t fn; /*!< \brief GSM Frame Number */ |
| 63 | }; |
| 64 | |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 65 | /*! \brief for TIME MPH-INFO.ind */ |
| 66 | struct info_time_ind_param { |
| 67 | uint32_t fn; /*!< \brief GSM Frame Number */ |
| 68 | }; |
| 69 | |
| 70 | /*! \brief for MEAS MPH-INFO.ind */ |
| 71 | struct info_meas_ind_param { |
| 72 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 73 | uint16_t ber10k; /*!< \brief BER in units of 0.01% */ |
| 74 | int16_t ta_offs_qbits; /*!< \brief timing advance offset (in qbits) */ |
| 75 | int16_t c_i_cb; /*!< \brief C/I ratio in 0.1 dB */ |
| 76 | uint8_t is_sub:1; /*!< \brief flags */ |
| 77 | uint8_t inv_rssi; /*!< \brief RSSI in dBm * -1 */ |
| 78 | }; |
| 79 | |
| 80 | /*! \brief for {ACTIVATE,DEACTIVATE,MODIFY} MPH-INFO.req */ |
| 81 | struct info_act_req_param { |
| 82 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 83 | uint8_t sacch_only; /*!< \breif Only deactivate SACCH */ |
| 84 | }; |
| 85 | |
| 86 | /*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.cnf */ |
| 87 | struct info_act_cnf_param { |
| 88 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 89 | uint8_t cause; /*!< \brief RSL cause in case of nack */ |
| 90 | }; |
| 91 | |
| 92 | /*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.{req,cnf} */ |
| 93 | struct info_ciph_req_param { |
| 94 | uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */ |
| 95 | uint8_t downlink; /*!< \brief Apply to downlink */ |
| 96 | uint8_t uplink; /*!< \brief Apply to uplink */ |
| 97 | }; |
| 98 | |
| 99 | /*! \brief for MPH-INFO.ind */ |
| 100 | struct mph_info_param { |
| 101 | enum osmo_mph_info_type type; /*!< \brief Info message type */ |
| 102 | union { |
| 103 | struct info_time_ind_param time_ind; |
| 104 | struct info_meas_ind_param meas_ind; |
| 105 | struct info_act_req_param act_req; |
| 106 | struct info_act_cnf_param act_cnf; |
| 107 | struct info_ciph_req_param ciph_req; |
| 108 | } u; |
| 109 | }; |
| 110 | |
| 111 | /*! \brief primitive header for PH-SAP primitives */ |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 112 | struct osmo_phsap_prim { |
| 113 | struct osmo_prim_hdr oph; /*!< \brief generic primitive header */ |
| 114 | union { |
| 115 | struct ph_data_param data; |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 116 | struct ph_tch_param tch; |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 117 | struct ph_rach_req_param rach_req; |
| 118 | struct ph_rach_ind_param rach_ind; |
| 119 | struct ph_conn_ind_param conn_ind; |
Andreas Eversberg | 227a9de | 2013-02-07 12:21:33 +0100 | [diff] [blame] | 120 | struct mph_info_param info; |
Andreas Eversberg | aa85a2d | 2013-02-07 12:18:37 +0100 | [diff] [blame] | 121 | } u; /*!< \brief request-specific data */ |
| 122 | }; |