blob: 22cfcf1b19fd0d8c3cc11c646d05897b423da386 [file] [log] [blame]
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +01001#ifndef _OSMOCOM_L1SAP_H
2#define _OSMOCOM_L1SAP_H
3
4#include <osmocom/core/prim.h>
5
Andreas Eversberg227a9de2013-02-07 12:21:33 +01006/*! \brief PH-SAP related primitives (L1<->L2 SAP) */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +01007enum osmo_ph_prim {
8 PRIM_PH_DATA, /*!< \brief PH-DATA */
9 PRIM_PH_RACH, /*!< \brief PH-RANDOM_ACCESS */
10 PRIM_PH_CONN, /*!< \brief PH-CONNECT */
11 PRIM_PH_EMPTY_FRAME, /*!< \brief PH-EMPTY_FRAME */
12 PRIM_PH_RTS, /*!< \brief PH-RTS */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010013 PRIM_MPH_INFO, /*!< \brief MPH-INFO */
14 PRIM_TCH, /*!< \brief TCH */
15 PRIM_TCH_RTS, /*!< \brief TCH */
16};
17
18/*! \brief PH-SAP related primitives (L1<->L2 SAP) */
19enum osmo_mph_info_type {
20 PRIM_INFO_TIME, /*!< \brief Current GSM time */
21 PRIM_INFO_MEAS, /*!< \brief Measurement indication */
22 PRIM_INFO_ACTIVATE, /*!< \brief Activation of channel */
23 PRIM_INFO_DEACTIVATE, /*!< \brief Deactivation of channel */
24 PRIM_INFO_MODIFY, /*!< \brief Mode Modify of channel */
25 PRIM_INFO_ACT_CIPH, /*!< \brief Activation of ciphering */
26 PRIM_INFO_DEACT_CIPH, /*!< \brief Deactivation of ciphering */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010027};
28
29/*! \brief for PH-RANDOM_ACCESS.req */
30struct ph_rach_req_param {
31 uint8_t ra; /*!< \brief Random Access */
32 uint8_t ta; /*!< \brief Timing Advance */
33 uint8_t tx_power; /*!< \brief Transmit Power */
34 uint8_t is_combined_ccch;/*!< \brief Are we using a combined CCCH? */
35 uint16_t offset; /*!< \brief Timing Offset */
36};
37
38/*! \brief for PH-RANDOM_ACCESS.ind */
39struct ph_rach_ind_param {
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 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};
123
124#endif /* _OSMOCOM_L1SAP_H */