blob: cdd3642422a53ad5f702c18a80990d63d9b3623f [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 Kluchnikov8ee60512012-03-05 19:24:57 +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;
50};
51
52struct l1fwd_hdl {
53 struct sockaddr_storage remote_sa;
54 socklen_t remote_sa_len;
55
56 struct osmo_wqueue udp_wq;
57
58 struct femtol1_hdl *fl1h;
59};
60
61extern struct l1fwd_hdl *l1fh;
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040062
Ivan Kluchnikov4277f0c2012-04-12 14:24:35 +040063int get_current_fn();
64
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040065void pcu_l1if_tx(BitVector * block);
66
Ivan Kluchnikove3a05962012-03-18 15:48:51 +040067int pcu_l1if_handle_l1prim(struct femtol1_hdl *fl1h, struct msgb *msg);
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040068
69void gsmtap_send_llc(uint8_t * data, unsigned len);
70
71#endif // PCU_L1_IF_H