FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/L1/cfile/tch_feature.c @ 1027:1178befeda76
fc-shell: tch command framework started
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 30 May 2016 23:19:30 +0000 |
parents | a6ca9ee289f7 |
children | 6312f684cef1 |
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]; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
35 *dp++ = apiword; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
36 *dp++ = apiword >> 8; |
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 */ |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
68 l1s_dsp_com.dsp_ndb_ptr->d_tch_mode &= ~(1 << B_PLAY_UL); |
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. |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
77 l1s_dsp_com.dsp_ndb_ptr->d_tch_mode |= (1 << B_PLAY_UL); |
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 { |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
88 int write_ptr, write_next; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
89 |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
90 write_ptr = ul_write_ptr; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
91 write_next = write_ptr + 1; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
92 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
|
93 write_next = 0; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
94 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
|
95 return; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
96 memcpy(uplink_data[write_ptr], pkt + 1, 34); |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
97 ul_write_ptr = write_next; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
98 } |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
99 |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
100 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
|
101 { |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
102 UWORD8 config; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
103 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
|
104 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
|
105 |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
106 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
|
107 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
|
108 |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
109 /* 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
|
110 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
|
111 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
|
112 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
|
113 buf[1] = config; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
114 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
|
115 RVT_BINARY_FORMAT); |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
116 } |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
117 } |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
118 |
1003
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 /* |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 * 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
|
121 * called in RVT HISR context. |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 */ |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 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
|
124 { |
1005
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
125 if (pktlen < 1) |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
126 return; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
127 switch (pkt[0]) { |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
128 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
|
129 if (pktlen != 2) |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
130 return; |
1016
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
131 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
|
132 break; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
133 case TCH_ULBITS_REQ: |
1016
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
134 if (pktlen < 34) |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
135 return; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
136 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
|
137 break; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
138 } |
1003
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 } |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 void feature_tch_reroute_init() |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 { |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 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
|
144 tch_reroute_downlink = FALSE; |
1016
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
145 ul_read_ptr = 0; |
a6ca9ee289f7
gsm-fw feature tch-reroute: uplink substitution implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1007
diff
changeset
|
146 ul_write_ptr = 0; |
1003
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 } |