Osmocom Packet control Unit (PCU): Network-side GPRS (RLC/MAC); BTS- or BSC-colocated https://osmocom.org/projects/osmopcu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
osmo-pcu/src/pcu_l1_if.h

190 lines
5.1 KiB

/* pcu_l1_if.h
*
* Copyright (C) 2012 Ivan Klyuchnikov
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef PCU_L1_IF_H
#define PCU_L1_IF_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <osmocom/core/write_queue.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/pcu/pcuif_proto.h>
#ifdef __cplusplus
}
#endif
#include "pdch.h"
static inline uint8_t qta2ta(int16_t qta)
{
if (qta < 0)
return 0;
if (qta > 252)
qta = 252;
return qta >> 2;
}
static inline int8_t sign_qta2ta(int16_t qta)
{
int8_t ta_adj = 0;
if (qta < -252)
qta = -252;
if (qta > 252)
qta = 252;
/* 1-bit TA adjustment if TA error reported by L1 is outside +/- 2 qbits */
if (qta > 2)
ta_adj = 1;
if (qta < -2)
ta_adj = -1;
return (qta >> 2) + ta_adj;
}
static inline uint8_t ta_limit(int16_t ta)
{
if (ta < 0)
ta = 0;
if (ta > 63)
ta = 63;
return ta;
}
/*
* L1 Measurement values
*/
struct pcu_l1_meas_ts {
unsigned have_ms_i_level:1;
int16_t ms_i_level; /* I_LEVEL in dB */
};
static inline void pcu_l1_meas_ts_set_ms_i_level(struct pcu_l1_meas_ts* ts, int16_t v) {
ts->ms_i_level = v;
ts->have_ms_i_level = 1;
}
struct pcu_l1_meas {
unsigned have_rssi:1;
unsigned have_ber:1;
unsigned have_bto:1;
unsigned have_link_qual:1;
unsigned have_ms_rx_qual:1;
unsigned have_ms_c_value:1;
unsigned have_ms_sign_var:1;
unsigned have_ms_i_level:1;
int8_t rssi; /* RSSI in dBm */
uint8_t ber; /* Bit error rate in % */
int16_t bto; /* Burst timing offset in quarter bits */
int16_t link_qual; /* Link quality in dB */
int16_t ms_rx_qual; /* MS RXQUAL value in % */
int16_t ms_c_value; /* C value in dB */
int16_t ms_sign_var; /* SIGN_VAR in dB */
struct pcu_l1_meas_ts ts[8];
};
static inline void pcu_l1_meas_set_rssi(struct pcu_l1_meas *m, int8_t v) {
m->rssi = v;
m->have_rssi = 1;
}
static inline void pcu_l1_meas_set_ber(struct pcu_l1_meas *m, uint8_t v) {
m->ber = v;
m->have_ber = 1;
}
static inline void pcu_l1_meas_set_bto(struct pcu_l1_meas *m, int16_t v) {
m->bto = v;
m->have_bto = 1;
}
static inline void pcu_l1_meas_set_link_qual(struct pcu_l1_meas *m, int16_t v) {
m->link_qual = v;
m->have_link_qual = 1;
}
static inline void pcu_l1_meas_set_ms_rx_qual(struct pcu_l1_meas *m, int16_t v) {
m->ms_rx_qual = v;
m->have_ms_rx_qual = 1;
}
static inline void pcu_l1_meas_set_ms_c_value(struct pcu_l1_meas *m, int16_t v) {
m->ms_c_value = v;
m->have_ms_c_value = 1;
}
static inline void pcu_l1_meas_set_ms_sign_var(struct pcu_l1_meas *m, int16_t v) {
m->ms_sign_var = v;
m->have_ms_sign_var = 1;
}
static inline void pcu_l1_meas_set_ms_i_level(struct pcu_l1_meas *m, size_t idx, int16_t v) {
pcu_l1_meas_ts_set_ms_i_level(&m->ts[idx], v);
m->have_ms_i_level = 1;
}
#ifdef __cplusplus
struct gprs_rlcmac_bts;
void pcu_l1if_tx_pdtch(msgb *msg, struct gprs_rlcmac_bts *bts, uint8_t trx, uint8_t ts,
uint16_t arfcn, uint32_t fn, uint8_t block_nr);
void pcu_l1if_tx_ptcch(struct gprs_rlcmac_bts *bts,
uint8_t trx, uint8_t ts, uint16_t arfcn,
uint32_t fn, uint8_t block_nr,
uint8_t *data, size_t data_len);
void pcu_l1if_tx_agch(struct gprs_rlcmac_bts *bts, bitvec * block, int len);
void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec * block, int plen, uint16_t pgroup);
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct gprs_rlcmac_bts;
Support Neighbor Address Resolution over PCUIF IPA multiplex While NACC was initially developed, it became clear there was need for a way to interact PCU<->BSC in order resolve ARFCN+BSIC into CGI-PS for later RIM usage. Hence, this resolution was first (until today) implemented using an out of bands RPC system using the CTRL interface, which required specific config to be written and matches in osmo-pcu and osmo-bsc VTY (ip+port of the CTRL interface to use). However, this has several shortcomings: * As explained above, specific configuration is required * Since recently, we do support BSC redundancy in osmo-bts. Hence the BTS may switch to a BSC other than first one. If that happened, that'd mean the CTRL interface would still point to the initially configured one, which may not be the same currently serving the PCU. During recent development of ANR related features, a similar need for PCU<->BSC was required, but this time it was decided to extend the IPA multiplex of the Abis OML connection to pass PCUIF messages, transparently forwarded to each side by the BTS. This has the advantage that connection PCU<->BTS is handled by BTS and both sides send messages transparently. Let's switch by default to using this new interface, while still maintaing the old way for a while (announcing them as deprecated) to avoid breaking existing deployments until they are upgraded to new versions of osmo-pcu and osmo-bsc. Related: SYS#4971 Change-Id: I6ad33c7ab10202840cf804dea9ba595978d0e920
1 year ago
int pcu_tx_neigh_addr_res_req(struct gprs_rlcmac_bts *bts, const struct neigh_cache_entry_key *neigh_key);
int pcu_rx(struct gsm_pcu_if *pcu_prim, size_t pcu_prim_length);
int pcu_l1if_open(void);
void pcu_l1if_close(void);
int pcu_sock_send(struct msgb *msg);
int pcu_tx_txt_ind(enum gsm_pcu_if_text_type t, const char *fmt, ...);
int pcu_rx_rts_req_pdtch(struct gprs_rlcmac_bts *bts, uint8_t trx, uint8_t ts,
uint32_t fn, uint8_t block_nr);
int pcu_rx_rts_req_ptcch(struct gprs_rlcmac_bts *bts, uint8_t trx, uint8_t ts,
uint32_t fn, uint8_t block_nr);
int pcu_rx_rach_ind_ptcch(struct gprs_rlcmac_bts *bts, uint8_t trx_nr, uint8_t ts_nr, uint32_t fn, int16_t qta);
int pcu_rx_data_ind_pdtch(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_pdch *pdch, uint8_t *data,
uint8_t len, uint32_t fn, struct pcu_l1_meas *meas);
void pcu_rx_block_time(struct gprs_rlcmac_bts *bts, uint16_t arfcn, uint32_t fn, uint8_t ts_no);
uint16_t imsi2paging_group(const char* imsi);
#define PCUIF_HDR_SIZE ( sizeof(struct gsm_pcu_if) - sizeof(((struct gsm_pcu_if *)0)->u) )
#ifdef __cplusplus
}
#endif
#endif // PCU_L1_IF_H