FreeCalypso > hg > ice1-trau-tester
annotate 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 |
rev | line source |
---|---|
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
2 * Here we are going to implement Tx on Abis toward the BTS. |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdint.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdbool.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <unistd.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
12 #include <osmocom/core/msgb.h> |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <osmocom/core/select.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <osmocom/isdn/i460_mux.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "globals.h" |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include "submux.h" |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
18 #include "dl_frames.h" |
26
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
19 |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
20 static void tx_service_subslot(int nr) |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
21 { |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
22 struct abis_subslot *ab = &subslots[nr]; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
23 struct msgb *msg; |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
24 uint8_t *outbuf; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
25 |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
26 if (!ab->is_active) |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
27 return; |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
28 msg = msgb_alloc_c(g_ctx, DL_OUTPUT_LEN, "TRAU-DL-frame"); |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
29 if (!msg) |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
30 return; |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
31 outbuf = msgb_put(msg, DL_OUTPUT_LEN); |
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
32 memcpy(outbuf, ab->is_efr ? dl_frame_efr : dl_frame_fr, DL_OUTPUT_LEN); |
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
33 osmo_i460_mux_enqueue(ab->schan, msg); |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
34 } |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
35 |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 void transmit_e1_ts(void) |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 { |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 uint8_t buf[160]; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
39 int nr; |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 |
30
5dd30224b70a
abis: starting new program
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
41 for (nr = 0; nr < ABIS_SUBSLOTS; nr++) |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
42 tx_service_subslot(nr); |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 osmo_i460_mux_out(&i460_ts, buf, 160); |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 write(ts_fd, buf, 160); |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 } |