blob: 88c83991688a964dea88b0b9e1bda83b42d1a835 [file] [log] [blame]
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +04001/* pcu_l1_if.h
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +04002 *
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +04003 * Copyright (C) 2012 Ivan Klyuchnikov
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +04004 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040020#ifndef PCU_L1_IF_H
21#define PCU_L1_IF_H
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040022
Andreas Eversberg0aed6542012-06-23 10:33:16 +020023#include <stdint.h>
Andreas Eversberga23c7ee2012-12-18 10:47:28 +010024#ifdef __cplusplus
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040025extern "C" {
Andreas Eversberga23c7ee2012-12-18 10:47:28 +010026#endif
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040027#include <osmocom/core/write_queue.h>
28#include <osmocom/core/socket.h>
29#include <osmocom/core/timer.h>
Andreas Eversberg0aed6542012-06-23 10:33:16 +020030#include <osmocom/core/bitvec.h>
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040031#include <osmocom/gsm/gsm_utils.h>
Andreas Eversberga23c7ee2012-12-18 10:47:28 +010032#ifdef __cplusplus
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040033}
Jacob Erlbeck20f6fd12015-06-08 11:05:45 +020034#endif
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040035
Jacob Erlbeck20f6fd12015-06-08 11:05:45 +020036/*
37 * L1 Measurement values
38 */
39
40struct pcu_l1_meas {
41 unsigned have_rssi:1;
42 unsigned have_ber:1;
43 unsigned have_bto:1;
44 unsigned have_link_qual:1;
45
46 int8_t rssi; /* RSSI in dBm */
47 uint8_t ber; /* Bit error rate in % */
48 int16_t bto; /* Burst timing offset in quarter bits */
49 int16_t link_qual; /* Link quality in db */
50#ifdef __cplusplus
51 pcu_l1_meas& set_rssi(int8_t v) { rssi = v; have_rssi = 1; return *this;}
52 pcu_l1_meas& set_ber(uint8_t v) { ber = v; have_ber = 1; return *this;}
53 pcu_l1_meas& set_bto(int16_t v) { bto = v; have_bto = 1; return *this;}
54 pcu_l1_meas& set_link_qual(int16_t v) {
55 link_qual = v; have_link_qual = 1; return *this;
56 }
57 pcu_l1_meas() :
58 have_rssi(0),
59 have_ber(0),
60 have_bto(0),
61 have_link_qual(0)
62 {}
63#endif
64};
65
66#ifdef __cplusplus
Andreas Eversberg0aed6542012-06-23 10:33:16 +020067void pcu_l1if_tx_pdtch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn,
68 uint32_t fn, uint8_t block_nr);
69void pcu_l1if_tx_ptcch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn,
70 uint32_t fn, uint8_t block_nr);
71void pcu_l1if_tx_agch(bitvec * block, int len);
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040072
Holger Hans Peter Freyther52c911b2013-08-24 18:30:54 +020073void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi);
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040074
Andreas Eversberg0aed6542012-06-23 10:33:16 +020075int pcu_l1if_open(void);
76void pcu_l1if_close(void);
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040077
Ivan Kluchnikovef7f28c2012-07-12 14:49:15 +040078int pcu_rx(uint8_t msg_type, struct gsm_pcu_if *pcu_prim);
79int pcu_sock_send(struct msgb *msg);
Andreas Eversberga23c7ee2012-12-18 10:47:28 +010080#endif
81
82#ifdef __cplusplus
83extern "C"
84#endif
85int pcu_rx_rts_req_pdtch(uint8_t trx, uint8_t ts, uint16_t arfcn,
86 uint32_t fn, uint8_t block_nr);
87
88#ifdef __cplusplus
89extern "C"
90#endif
91int pcu_rx_data_ind_pdtch(uint8_t trx, uint8_t ts, uint8_t *data,
Jacob Erlbeck20f6fd12015-06-08 11:05:45 +020092 uint8_t len, uint32_t fn, struct pcu_l1_meas *meas);
Andreas Eversberga23c7ee2012-12-18 10:47:28 +010093
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040094#endif // PCU_L1_IF_H