Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 1 | /* pcu_l1_if.h |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 2 | * |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 4 | * |
| 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 Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 20 | #ifndef PCU_L1_IF_H |
| 21 | #define PCU_L1_IF_H |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 22 | |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 23 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 24 | #include <BitVector.h> |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 25 | #include <gsmL1prim.h> |
Ivan Kluchnikov | 4277f0c | 2012-04-12 14:24:35 +0400 | [diff] [blame] | 26 | #include <sys/socket.h> |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 27 | extern "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 | |
| 36 | struct 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 Kluchnikov | 5310d45 | 2012-04-17 22:00:31 +0400 | [diff] [blame] | 50 | |
| 51 | struct { |
| 52 | uint16_t arfcn; |
| 53 | uint8_t tn; |
| 54 | uint8_t tsc; |
| 55 | uint16_t ta; |
| 56 | } channel_info; |
| 57 | |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | struct 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 | |
| 69 | extern struct l1fwd_hdl *l1fh; |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 70 | |
Ivan Kluchnikov | 4277f0c | 2012-04-12 14:24:35 +0400 | [diff] [blame] | 71 | int get_current_fn(); |
| 72 | |
Ivan Kluchnikov | 5310d45 | 2012-04-17 22:00:31 +0400 | [diff] [blame] | 73 | void pcu_l1if_tx(BitVector * block, GsmL1_Sapi_t sapi, int len = 23); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 74 | |
Ivan Kluchnikov | e3a0596 | 2012-03-18 15:48:51 +0400 | [diff] [blame] | 75 | int pcu_l1if_handle_l1prim(struct femtol1_hdl *fl1h, struct msgb *msg); |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 76 | |
| 77 | void gsmtap_send_llc(uint8_t * data, unsigned len); |
| 78 | |
| 79 | #endif // PCU_L1_IF_H |