1 /* Synchronous part of GSM Layer 1: API to Layer2+ */
3 /* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <comm/msgb.h>
27 #include <comm/sercomm.h>
29 #include <layer1/sync.h>
30 #include <l1a_l23_interface.h>
32 /* the size we will allocate struct msgb* for HDLC */
33 #define L3_MSG_SIZE (sizeof(struct l1_ccch_info_ind) + 4)
36 void l1_queue_for_l2(struct msgb *msg)
38 /* forward via serial for now */
39 sercomm_sendmsg(SC_DLCI_L1A_L23, msg);
42 struct msgb *l1_create_l2_msg(int msg_type, uint32_t fn, uint16_t snr)
44 struct l1_info_dl *dl;
47 msg = msgb_alloc_headroom(L3_MSG_SIZE, L3_MSG_HEAD, "l1_burst");
50 puts("OOPS. Out of buffers...\n");
56 dl = (struct l1_info_dl *) msgb_put(msg, sizeof(*dl));
57 dl->msg_type = msg_type;
58 /* FIXME: we may want to compute T1/T2/T3 in L23 */
59 gsm_fn2gsmtime(&dl->time, fn);