annotate ft16/tx_func.c @ 5:3604828b2f54

add top Makefile
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 29 Aug 2024 13:21:38 +0000
parents 5c18cd38c8ad
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Here we are going to implement Tx on Abis toward the BTS.
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdint.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdbool.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <unistd.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <osmocom/core/msgb.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <osmocom/core/select.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <osmocom/isdn/i460_mux.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include <osmocom/trau/trau_frame.h>
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "globals.h"
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include "submux.h"
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #include "dl_frames.h"
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 static void tx_service_subslot(int nr)
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 {
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 struct abis_subslot *ab = &subslots[nr];
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 const uint8_t *srcbuf;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 struct msgb *msg;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 uint8_t *outbuf;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (!ab->got_sync)
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 return;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 switch (ab->frame_type) {
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 case TRAU_FT_FR_UP:
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 srcbuf = dl_frame_fr;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 break;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 case TRAU_FT_EFR:
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 srcbuf = dl_frame_efr;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 break;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 default:
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 return;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 }
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 msg = msgb_alloc_c(g_ctx, DL_OUTPUT_LEN, "TRAU-DL-frame");
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 if (!msg)
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 return;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 outbuf = msgb_put(msg, DL_OUTPUT_LEN);
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 memcpy(outbuf, srcbuf, DL_OUTPUT_LEN);
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 osmo_i460_mux_enqueue(ab->schan, msg);
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 void transmit_e1_ts(void)
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 {
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 uint8_t buf[160];
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 int nr;
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 for (nr = 0; nr < ABIS_SUBSLOTS; nr++)
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 tx_service_subslot(nr);
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 osmo_i460_mux_out(&i460_ts, buf, 160);
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 write(ts_fd, buf, 160);
5c18cd38c8ad ft16: import from ice1-trau-tester/abis
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 }