blob: efe533e7fa9bd342ef4fe3054e9466834c566231 [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
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040023
Ivan Kluchnikov835f91e2012-04-30 18:00:36 +040024#include <bitvector.h>
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040025#include <gsmL1prim.h>
Ivan Kluchnikov4277f0c2012-04-12 14:24:35 +040026#include <sys/socket.h>
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040027extern "C" {
28#include <osmocom/core/write_queue.h>
29#include <osmocom/core/socket.h>
30#include <osmocom/core/timer.h>
31#include <osmocom/gsm/gsm_utils.h>
32}
33
34#define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h)
35
36struct femtol1_hdl {
37 struct gsm_time gsm_time;
38 uint32_t hLayer1; /* handle to the L1 instance in the DSP */
39 uint32_t dsp_trace_f;
40 uint16_t clk_cal;
41 struct llist_head wlc_list;
42
43 void *priv; /* user reference */
44
45 struct osmo_timer_list alive_timer;
46 unsigned int alive_prim_cnt;
47
48 struct osmo_fd read_ofd; /* osmo file descriptors */
49 struct osmo_wqueue write_q;
Ivan Kluchnikov5310d452012-04-17 22:00:31 +040050
51 struct {
52 uint16_t arfcn;
53 uint8_t tn;
54 uint8_t tsc;
55 uint16_t ta;
56 } channel_info;
57
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040058};
59
60struct l1fwd_hdl {
61 struct sockaddr_storage remote_sa;
62 socklen_t remote_sa_len;
63
64 struct osmo_wqueue udp_wq;
65
66 struct femtol1_hdl *fl1h;
67};
68
69extern struct l1fwd_hdl *l1fh;
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040070
Ivan Kluchnikov4277f0c2012-04-12 14:24:35 +040071int get_current_fn();
72
Ivan Kluchnikov835f91e2012-04-30 18:00:36 +040073void pcu_l1if_tx(bitvec * block, GsmL1_Sapi_t sapi, int len = 23);
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040074
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040075int pcu_l1if_handle_l1prim(struct femtol1_hdl *fl1h, struct msgb *msg);
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040076
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040077#endif // PCU_L1_IF_H