blob: 485acbfcf4ce9d9a1325f3c6a0e9cda4b25a3b32 [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 */
50};
51
52/*! \brief for TCH.{req,ind} | TCH-RTS.ind */
53struct ph_tch_param {
54 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
55 uint32_t fn; /*!< \brief GSM Frame Number */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +010056};
57
58/*! \brief for PH-CONN.ind */
59struct ph_conn_ind_param {
60 uint32_t fn; /*!< \brief GSM Frame Number */
61};
62
Andreas Eversberg227a9de2013-02-07 12:21:33 +010063/*! \brief for TIME MPH-INFO.ind */
64struct info_time_ind_param {
65 uint32_t fn; /*!< \brief GSM Frame Number */
66};
67
68/*! \brief for MEAS MPH-INFO.ind */
69struct info_meas_ind_param {
70 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
71 uint16_t ber10k; /*!< \brief BER in units of 0.01% */
72 int16_t ta_offs_qbits; /*!< \brief timing advance offset (in qbits) */
73 int16_t c_i_cb; /*!< \brief C/I ratio in 0.1 dB */
74 uint8_t is_sub:1; /*!< \brief flags */
75 uint8_t inv_rssi; /*!< \brief RSSI in dBm * -1 */
76};
77
78/*! \brief for {ACTIVATE,DEACTIVATE,MODIFY} MPH-INFO.req */
79struct info_act_req_param {
80 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
81 uint8_t sacch_only; /*!< \breif Only deactivate SACCH */
82};
83
84/*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.cnf */
85struct info_act_cnf_param {
86 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
87 uint8_t cause; /*!< \brief RSL cause in case of nack */
88};
89
90/*! \brief for {ACTIVATE,DEACTIVATE} MPH-INFO.{req,cnf} */
91struct info_ciph_req_param {
92 uint8_t chan_nr; /*!< \brief Channel Number (Like RSL) */
93 uint8_t downlink; /*!< \brief Apply to downlink */
94 uint8_t uplink; /*!< \brief Apply to uplink */
95};
96
97/*! \brief for MPH-INFO.ind */
98struct mph_info_param {
99 enum osmo_mph_info_type type; /*!< \brief Info message type */
100 union {
101 struct info_time_ind_param time_ind;
102 struct info_meas_ind_param meas_ind;
103 struct info_act_req_param act_req;
104 struct info_act_cnf_param act_cnf;
105 struct info_ciph_req_param ciph_req;
106 } u;
107};
108
109/*! \brief primitive header for PH-SAP primitives */
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100110struct osmo_phsap_prim {
111 struct osmo_prim_hdr oph; /*!< \brief generic primitive header */
112 union {
113 struct ph_data_param data;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100114 struct ph_tch_param tch;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100115 struct ph_rach_req_param rach_req;
116 struct ph_rach_ind_param rach_ind;
117 struct ph_conn_ind_param conn_ind;
Andreas Eversberg227a9de2013-02-07 12:21:33 +0100118 struct mph_info_param info;
Andreas Eversbergaa85a2d2013-02-07 12:18:37 +0100119 } u; /*!< \brief request-specific data */
120};
121
122#endif /* _OSMOCOM_L1SAP_H */