FreeCalypso > hg > ice1-trau-tester
annotate ater8/tx_func.c @ 51:db39e8855f3d
ater: implement play-d144
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 25 Sep 2024 05:53:38 +0000 |
parents | 3cc26391d24d |
children |
rev | line source |
---|---|
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Here we are going to implement Tx on Ater toward the TRAU. |
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 |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
12 #include <osmocom/core/bits.h> |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
13 #include <osmocom/core/msgb.h> |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <osmocom/core/select.h> |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <osmocom/isdn/i460_mux.h> |
26
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
16 #include <osmocom/trau/trau_frame.h> |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "globals.h" |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "submux.h" |
26
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
20 #include "out_frame.h" |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
48
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
22 /* |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
23 * The following hard-coded frame is based on TS 48.061 section 5.2.2. |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
24 * 1-based octet numbers in the comments are as in the spec. |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
25 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
26 static const ubit_t idle_data_frame[160] = { |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
27 0, 0, 0, 0, 0, 0, 0, 0, /* octet 1 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
28 1, 0, 0, 1, 1, 1, 1, 1, /* octet 2 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
29 0, 1, 1, 1, 1, 1, 1, 1, /* octet 3 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
30 1, 1, 1, 1, 1, 1, 1, 1, /* octet 4 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
31 1, 1, 1, 1, 1, 1, 1, 1, /* octet 5 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
32 1, 1, 1, 1, 1, 1, 1, 1, /* octet 6 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
33 1, 1, 1, 1, 1, 1, 1, 1, /* octet 7 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
34 1, 1, 1, 1, 1, 1, 1, 1, /* octet 8 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
35 1, 1, 1, 1, 1, 1, 1, 1, /* octet 9 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
36 1, 1, 1, 1, 1, 1, 1, 1, /* octet 10 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
37 1, 1, 1, 1, 1, 1, 1, 1, /* octet 11 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
38 1, 1, 1, 1, 1, 1, 1, 1, /* octet 12 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
39 1, 1, 1, 1, 1, 1, 1, 1, /* octet 13 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
40 1, 1, 1, 1, 1, 1, 1, 1, /* octet 14 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
41 1, 1, 1, 1, 1, 1, 1, 1, /* octet 15 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
42 1, 1, 1, 1, 1, 1, 1, 1, /* octet 16 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
43 1, 1, 1, 1, 1, 1, 1, 1, /* octet 17 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
44 1, 1, 1, 1, 1, 1, 1, 1, /* octet 18 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
45 1, 1, 1, 1, 1, 1, 1, 1, /* octet 19 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
46 1, 1, 1, 1, 1, 1, 1, 1, /* octet 20 */ |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
47 }; |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
48 |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
49 void init_trau_ul_frame(int nr) |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
50 { |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
51 struct ater_subslot *at = &subslots[nr]; |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
52 struct osmo_trau_frame *fr = &at->ul_frame; |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
53 |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
54 fr->type = OSMO_TRAU8_SPEECH; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
55 fr->dir = OSMO_TRAU_DIR_UL; |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
56 memset(fr->c_bits + 5, 1, 3); |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
57 fr->xc_bits[0] = 0; |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
58 memset(fr->t_bits, 1, 2); |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
59 } |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
60 |
26
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
61 static void handle_play(struct ater_subslot *at) |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
62 { |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
63 if (at->play_wait_align) { |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
64 if (at->mfrm_count) |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
65 return; |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
66 at->play_wait_align = false; |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
67 } |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
68 trau_frame_from_record(at->play_buffer + at->play_buf_ptr * 22, |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
69 &at->ul_frame, &at->frame_has_taf); |
26
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
70 at->play_buf_ptr++; |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
71 if (at->play_buf_ptr < at->play_buf_total) |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
72 return; |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
73 free(at->play_buffer); |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
74 at->play_buffer = NULL; |
27
2742dbea95f1
ater: implement play command
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
75 printf("file play finished\n"); |
26
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
76 } |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
77 |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
78 /* compute the odd parity bit of the given input bit sequence */ |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
79 static ubit_t compute_odd_parity(const ubit_t *in, unsigned int num_bits) |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
80 { |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
81 int i; |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
82 unsigned int sum = 0; |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
83 |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
84 for (i = 0; i < num_bits; i++) { |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
85 if (in[i]) |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
86 sum++; |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
87 } |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
88 |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
89 if (sum & 1) |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
90 return 0; |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
91 else |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
92 return 1; |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
93 } |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
94 |
48
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
95 static void send_idle_data(int nr) |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
96 { |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
97 struct ater_subslot *at = &subslots[nr]; |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
98 struct msgb *msg; |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
99 |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
100 msg = msgb_alloc_c(g_ctx, 160, "TRAU-UL-frame"); |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
101 if (!msg) |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
102 return; |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
103 memcpy(msg->tail, idle_data_frame, 160); |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
104 msgb_put(msg, 160); |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
105 osmo_i460_mux_enqueue(at->schan, msg); |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
106 } |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
107 |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
108 static void tx_service_subslot(int nr) |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
109 { |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
110 struct ater_subslot *at = &subslots[nr]; |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
111 struct osmo_trau_frame *fr = &at->ul_frame; |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
112 ubit_t taf; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
113 struct msgb *msg; |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
114 int len; |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
115 |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
116 if (!at->is_active) |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
117 return; |
48
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
118 if (at->is_data) { |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
119 send_idle_data(nr); |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
120 return; |
3cc26391d24d
ater8: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
42
diff
changeset
|
121 } |
26
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
122 if (at->play_buffer) |
237687e2be6c
ater: implement play internals
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
123 handle_play(at); |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
124 at->mfrm_count++; |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
125 if (at->mfrm_count >= 12) { |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
126 at->mfrm_count = 0; |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
127 taf = 1; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
128 } else { |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
129 taf = 0; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
130 } |
42
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
131 if (at->frame_has_taf) |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
132 fr->xc_bits[3] = taf; |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
133 fr->xc_bits[5] = compute_odd_parity(fr->xc_bits, 5); |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
134 |
ff94d7fc5891
new program itt-ater-8
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
135 msg = msgb_alloc_c(g_ctx, 320, "TRAU-UL-frame"); |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
136 if (!msg) |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
137 return; |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
138 len = osmo_trau_frame_encode(msg->tail, msgb_tailroom(msg), fr); |
23
0d70444b5070
ater: more robust msgb handling in TRAU-UL output
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
139 if (len <= 0) { |
0d70444b5070
ater: more robust msgb handling in TRAU-UL output
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
140 msgb_free(msg); |
0d70444b5070
ater: more robust msgb handling in TRAU-UL output
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
141 return; |
0d70444b5070
ater: more robust msgb handling in TRAU-UL output
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
142 } |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
143 msgb_put(msg, len); |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
144 osmo_i460_mux_enqueue(at->schan, msg); |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
145 } |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
146 |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 void transmit_e1_ts(void) |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 { |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 uint8_t buf[160]; |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
150 int nr; |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 |
19
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
152 for (nr = 0; nr < ATER_SUBSLOTS; nr++) |
1e375472d5a5
ater: implement TRAU frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
153 tx_service_subslot(nr); |
18
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 osmo_i460_mux_out(&i460_ts, buf, 160); |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 write(ts_fd, buf, 160); |
61862af2247f
ater: E1 timeslot output (osmo_i460 mux)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 } |