FreeCalypso > hg > ice1-trau-tester
comparison abis/tx_func.c @ 30:5dd30224b70a
abis: starting new program
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 13 Aug 2024 21:38:55 +0000 |
parents | ater/tx_func.c@2742dbea95f1 |
children | 351bd801cdce |
comparison
equal
deleted
inserted
replaced
29:1dda11905e85 | 30:5dd30224b70a |
---|---|
1 /* | |
2 * Here we are going to implement Tx on Abis toward the BTS. | |
3 */ | |
4 | |
5 #include <stdint.h> | |
6 #include <stdbool.h> | |
7 #include <stdio.h> | |
8 #include <stdlib.h> | |
9 #include <string.h> | |
10 #include <unistd.h> | |
11 | |
12 #include <osmocom/core/msgb.h> | |
13 #include <osmocom/core/select.h> | |
14 #include <osmocom/isdn/i460_mux.h> | |
15 | |
16 #include "globals.h" | |
17 #include "submux.h" | |
18 #include "dl_frames.h" | |
19 | |
20 static void tx_service_subslot(int nr) | |
21 { | |
22 struct abis_subslot *ab = &subslots[nr]; | |
23 struct msgb *msg; | |
24 uint8_t *outbuf; | |
25 | |
26 if (!ab->is_active) | |
27 return; | |
28 msg = msgb_alloc_c(g_ctx, DL_OUTPUT_LEN, "TRAU-DL-frame"); | |
29 if (!msg) | |
30 return; | |
31 outbuf = msgb_put(msg, DL_OUTPUT_LEN); | |
32 memcpy(outbuf, ab->is_efr ? dl_frame_efr : dl_frame_fr, DL_OUTPUT_LEN); | |
33 osmo_i460_mux_enqueue(ab->schan, msg); | |
34 } | |
35 | |
36 void transmit_e1_ts(void) | |
37 { | |
38 uint8_t buf[160]; | |
39 int nr; | |
40 | |
41 for (nr = 0; nr < ABIS_SUBSLOTS; nr++) | |
42 tx_service_subslot(nr); | |
43 osmo_i460_mux_out(&i460_ts, buf, 160); | |
44 write(ts_fd, buf, 160); | |
45 } |