blob: c21abe5ee60fcee7e93b907720ffcd4da58e645d [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 {
Andreas Eversberg610517c2013-06-12 09:21:18 +020040 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010041 uint8_t ra; /*!< \brief Random Access */
42 uint8_t acc_delay; /*!< \brief Delay in bit periods */
43 uint32_t fn; /*!< \brief GSM Frame Number at time of RA */
44};
45
Andreas Eversberg227a9de2013-02-07 12:21:33 +010046/*! \brief for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010047struct ph_data_param {
48 uint8_t link_id; /*!< \brief Link Identifier (Like RSL) */
49 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010050 uint32_t fn; /*!< \brief GSM Frame Number */
Andreas Eversberg15b80572013-03-16 16:34:55 +010051 int8_t rssi; /*!< \brief RSSI of receivedindication */
Andreas Eversberg227a9de2013-02-07 12:21:33 +010052};
53
54/*! \brief for TCH.{req,ind} | TCH-RTS.ind */
55struct ph_tch_param {
56 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
57 uint32_t fn; /*!< \brief GSM Frame Number */
Andreas Eversberg15b80572013-03-16 16:34:55 +010058 int8_t rssi; /*!< \brief RSSI of received indication */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010059};
60
61/*! \brief for PH-CONN.ind */
62struct ph_conn_ind_param {
63 uint32_t fn; /*!< \brief GSM Frame Number */
64};
65
Andreas Eversberg227a9de2013-02-07 12:21:33 +010066/*! \brief for TIME MPH-INFO.ind */
67struct info_time_ind_param {
68 uint32_t fn; /*!< \brief GSM Frame Number */
69};
70
71/*! \brief for MEAS MPH-INFO.ind */
72struct info_meas_ind_param {
73 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
74 uint16_t ber10k; /*!< \brief BER in units of 0.01% */
75 int16_t ta_offs_qbits; /*!< \brief timing advance offset (in qbits) */
76 int16_t c_i_cb; /*!< \brief C/I ratio in 0.1 dB */
77 uint8_t is_sub:1; /*!< \brief flags */
78 uint8_t inv_rssi; /*!< \brief RSSI in dBm * -1 */
79};
80
81/*! \brief for {ACTIVATE,DEACTIVATE,MODIFY} MPH-INFO.req */
82struct info_act_req_param {
83 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
84 uint8_t sacch_only; /*!< \breif Only deactivate SACCH */
85};
86
87/*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.cnf */
88struct info_act_cnf_param {
89 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
90 uint8_t cause; /*!< \brief RSL cause in case of nack */
91};
92
93/*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.{req,cnf} */
94struct info_ciph_req_param {
95 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
96 uint8_t downlink; /*!< \brief Apply to downlink */
97 uint8_t uplink; /*!< \brief Apply to uplink */
98};
99
100/*! \brief for MPH-INFO.ind */
101struct mph_info_param {
102 enum osmo_mph_info_type type; /*!< \brief Info message type */
103 union {
104 struct info_time_ind_param time_ind;
105 struct info_meas_ind_param meas_ind;
106 struct info_act_req_param act_req;
107 struct info_act_cnf_param act_cnf;
108 struct info_ciph_req_param ciph_req;
109 } u;
110};
111
112/*! \brief primitive header for PH-SAP primitives */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100113struct osmo_phsap_prim {
114 struct osmo_prim_hdr oph; /*!< \brief generic primitive header */
115 union {
116 struct ph_data_param data;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100117 struct ph_tch_param tch;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100118 struct ph_rach_req_param rach_req;
119 struct ph_rach_ind_param rach_ind;
120 struct ph_conn_ind_param conn_ind;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100121 struct mph_info_param info;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100122 } u; /*!< \brief request-specific data */
123};
124
125#endif /* _OSMOCOM_L1SAP_H */