annotate gsm-fw/L1/cfile/tch_feature.c @ 1034:405b5469abc4 default tip

top README: repository change notice
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 12 Jun 2016 19:06:34 +0000
parents 6e7dd5e52650
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1003
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * This module is a FreeCalypso addition; it contains code implementing
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 * our custom voice TCH rerouting feature.
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 */
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include "config.h"
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include "l1_confg.h"
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include "l1_types.h"
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include "sys_types.h"
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
10 #include <string.h>
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
11 #include "l1_const.h"
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
12 #include "l1_defty.h"
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
13 #include "l1_varex.h"
1003
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "l1_trace.h"
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 #include "tch_feature.h"
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 T_RVT_USER_ID tch_reroute_rvt_id;
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 BOOL tch_reroute_downlink;
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19
1007
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
20 void tch_send_downlink_bits(API *dsp_buffer)
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
21 {
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
22 T_RVT_BUFFER buf;
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
23 T_RVT_RET rc;
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
24 UINT8 *dp;
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
25 UWORD16 apiword;
1007
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
26 int i;
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
27
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
28 rc = rvt_mem_alloc(tch_reroute_rvt_id, 41, &buf);
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
29 if (rc != RVT_OK)
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
30 return;
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
31 dp = buf;
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
32 *dp++ = TCH_DLBITS_IND;
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
33 for (i = 0; i < 20; i++) {
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
34 apiword = dsp_buffer[i];
1031
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
35 *dp++ = apiword >> 8;
1007
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
36 *dp++ = apiword;
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
37 }
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
38 rvt_send_trace_no_cpy(buf, tch_reroute_rvt_id, 41, RVT_BINARY_FORMAT);
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
39 }
3bfeee466b0a gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1005
diff changeset
40
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
41 static void send_tch_ulbits_conf()
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
42 {
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
43 T_RVT_BUFFER buf;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
44 T_RVT_RET rc;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
45
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
46 rc = rvt_mem_alloc(tch_reroute_rvt_id, 1, &buf);
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
47 if (rc == RVT_OK) {
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
48 buf[0] = TCH_ULBITS_CONF;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
49 rvt_send_trace_no_cpy(buf, tch_reroute_rvt_id, 1,
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
50 RVT_BINARY_FORMAT);
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
51 }
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
52 }
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
53
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
54 #define UPLINK_QUEUE_SIZE 5
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
55 #define WORDS_PER_ENTRY 17
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
56
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
57 static UWORD16 uplink_data[UPLINK_QUEUE_SIZE][WORDS_PER_ENTRY];
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
58 static volatile int ul_read_ptr, ul_write_ptr;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
59
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
60 void tch_substitute_uplink(API *dsp_buffer)
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
61 {
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
62 int read_ptr;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
63 int i;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
64
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
65 read_ptr = ul_read_ptr;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
66 if (read_ptr == ul_write_ptr) {
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
67 /* no uplink substitution */
1032
6e7dd5e52650 gsm-fw feature tch-reroute: B_PLAY_UL (uplink substitution) bug fixed
Mychaela Falconia <falcon@freecalypso.org>
parents: 1031
diff changeset
68 l1s_dsp_com.dsp_ndb_ptr->d_tch_mode &= ~B_PLAY_UL;
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
69 return;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
70 }
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
71 for (i = 0; i < WORDS_PER_ENTRY; i++)
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
72 dsp_buffer[i+3] = uplink_data[read_ptr][i];
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
73 // Fill data block Header...
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
74 dsp_buffer[0] = (1 << B_BLUD); // 1st word: Set B_BLU bit.
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
75 dsp_buffer[1] = 0; // 2nd word: cleared.
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
76 dsp_buffer[2] = 0; // 3rd word: cleared.
1032
6e7dd5e52650 gsm-fw feature tch-reroute: B_PLAY_UL (uplink substitution) bug fixed
Mychaela Falconia <falcon@freecalypso.org>
parents: 1031
diff changeset
77 l1s_dsp_com.dsp_ndb_ptr->d_tch_mode |= B_PLAY_UL;
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
78 /* advance the read pointer and send TCH_ULBITS_CONF */
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
79 read_ptr++;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
80 if (read_ptr >= UPLINK_QUEUE_SIZE)
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
81 read_ptr = 0;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
82 ul_read_ptr = read_ptr;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
83 send_tch_ulbits_conf();
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
84 }
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
85
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
86 static void handle_tch_ulbits_req(T_RVT_BUFFER pkt)
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
87 {
1031
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
88 int write_ptr, write_next, i;
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
89 UINT8 *sp;
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
90
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
91 write_ptr = ul_write_ptr;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
92 write_next = write_ptr + 1;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
93 if (write_next >= UPLINK_QUEUE_SIZE)
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
94 write_next = 0;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
95 if (write_next == ul_read_ptr) /* queue full */
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
96 return;
1031
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
97 sp = pkt + 1;
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
98 for (i = 0; i < WORDS_PER_ENTRY; i++) {
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
99 uplink_data[write_ptr][i] = (sp[0] << 8) | sp[1];
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
100 sp += 2;
6312f684cef1 gsm-fw feature tch-reroute: byte order changed to big endian
Mychaela Falconia <falcon@freecalypso.org>
parents: 1016
diff changeset
101 }
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
102 ul_write_ptr = write_next;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
103 }
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
104
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
105 static void handle_tch_config_req(T_RVT_BUFFER pkt)
1005
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
106 {
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
107 UWORD8 config;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
108 T_RVT_BUFFER buf;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
109 T_RVT_RET rc;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
110
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
111 config = pkt[1] & 0x01;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
112 tch_reroute_downlink = config;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
113
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
114 /* send TCH_CONFIG_CONF response */
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
115 rc = rvt_mem_alloc(tch_reroute_rvt_id, 2, &buf);
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
116 if (rc == RVT_OK) {
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
117 buf[0] = TCH_CONFIG_CONF;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
118 buf[1] = config;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
119 rvt_send_trace_no_cpy(buf, tch_reroute_rvt_id, 2,
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
120 RVT_BINARY_FORMAT);
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
121 }
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
122 }
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
123
1003
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
124 /*
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
125 * The following function is the callback registered with RVT; it gets
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
126 * called in RVT HISR context.
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
127 */
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
128 static void tch_rvt_input_callback(T_RVT_BUFFER pkt, UINT16 pktlen)
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
129 {
1005
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
130 if (pktlen < 1)
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
131 return;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
132 switch (pkt[0]) {
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
133 case TCH_CONFIG_REQ:
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
134 if (pktlen != 2)
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
135 return;
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
136 handle_tch_config_req(pkt);
1005
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
137 break;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
138 case TCH_ULBITS_REQ:
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
139 if (pktlen < 34)
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
140 return;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
141 handle_tch_ulbits_req(pkt);
1005
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
142 break;
908566db1538 gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1003
diff changeset
143 }
1003
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
144 }
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
145
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
146 void feature_tch_reroute_init()
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
147 {
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
148 rvt_register_id("TCH", &tch_reroute_rvt_id, tch_rvt_input_callback);
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
149 tch_reroute_downlink = FALSE;
1016
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
150 ul_read_ptr = 0;
a6ca9ee289f7 gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 1007
diff changeset
151 ul_write_ptr = 0;
1003
9b147d0b2cab gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
152 }