blob: 9f3fe98c301059bf3826a538472971447eec4227 [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
17/*! \brief PH-SAP related primitives (L1<->L2 SAP) */
18enum 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 Eversbergaa85a2d2013-02-07 12:18:37 +010026};
27
28/*! \brief for PH-RANDOM_ACCESS.req */
29struct 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 */
38struct ph_rach_ind_param {
Andreas Eversberg610517c2013-06-12 09:21:18 +020039 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010040 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 Eversberg227a9de2013-02-07 12:21:33 +010045/*! \brief for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010046struct ph_data_param {
47 uint8_t link_id; /*!< \brief Link Identifier (Like RSL) */
48 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010049 uint32_t fn; /*!< \brief GSM Frame Number */
Andreas Eversberg15b80572013-03-16 16:34:55 +010050 int8_t rssi; /*!< \brief RSSI of receivedindication */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010051};
52
53/*! \brief for TCH.{req,ind} | TCH-RTS.ind */
54struct ph_tch_param {
55 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
56 uint32_t fn; /*!< \brief GSM Frame Number */
Andreas Eversberg15b80572013-03-16 16:34:55 +010057 int8_t rssi; /*!< \brief RSSI of received indication */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010058};
59
60/*! \brief for PH-CONN.ind */
61struct ph_conn_ind_param {
62 uint32_t fn; /*!< \brief GSM Frame Number */
63};
64
Andreas Eversberg227a9de2013-02-07 12:21:33 +010065/*! \brief for TIME MPH-INFO.ind */
66struct info_time_ind_param {
67 uint32_t fn; /*!< \brief GSM Frame Number */
68};
69
70/*! \brief for MEAS MPH-INFO.ind */
71struct 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 */
81struct 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 */
87struct 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} */
93struct 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 */
100struct 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 Eversbergaa85a2d2013-02-07 12:18:37 +0100112struct osmo_phsap_prim {
113 struct osmo_prim_hdr oph; /*!< \brief generic primitive header */
114 union {
115 struct ph_data_param data;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100116 struct ph_tch_param tch;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100117 struct ph_rach_req_param rach_req;
118 struct ph_rach_ind_param rach_ind;
119 struct ph_conn_ind_param conn_ind;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100120 struct mph_info_param info;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100121 } u; /*!< \brief request-specific data */
122};