FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/L1/cfile/tch_feature.c @ 1015:9ced8e13cf91
fc-shell tch-dl command implementation: brown paper bag
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 20 Mar 2016 23:07:46 +0000 |
parents | 3bfeee466b0a |
children | a6ca9ee289f7 |
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" |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "l1_trace.h" |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "tch_feature.h" |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 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
|
14 BOOL tch_reroute_downlink; |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 |
1007
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
16 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
|
17 { |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
18 T_RVT_BUFFER buf; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
19 T_RVT_RET rc; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
20 UINT8 *dp; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
21 API apiword; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
22 int i; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
23 |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
24 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
|
25 if (rc != RVT_OK) |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
26 return; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
27 dp = buf; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
28 *dp++ = TCH_DLBITS_IND; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
29 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
|
30 apiword = dsp_buffer[i]; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
31 *dp++ = apiword; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
32 *dp++ = apiword >> 8; |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
33 } |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
34 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
|
35 } |
3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1005
diff
changeset
|
36 |
1005
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
37 static void handle_tch_config_reg(T_RVT_BUFFER pkt) |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
38 { |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
39 UWORD8 config; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
40 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
|
41 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
|
42 |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
43 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
|
44 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
|
45 |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
46 /* 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
|
47 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
|
48 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
|
49 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
|
50 buf[1] = config; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
51 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
|
52 RVT_BINARY_FORMAT); |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
53 } |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
54 } |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
55 |
1003
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 /* |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 * 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
|
58 * called in RVT HISR context. |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 */ |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 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
|
61 { |
1005
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
62 if (pktlen < 1) |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
63 return; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
64 switch (pkt[0]) { |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
65 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
|
66 if (pktlen != 2) |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
67 return; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
68 handle_tch_config_reg(pkt); |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
69 break; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
70 case TCH_ULBITS_REQ: |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
71 /* to be filled */ |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
72 break; |
908566db1538
gsm-fw feature tch-reroute: init and config fleshed out
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
1003
diff
changeset
|
73 } |
1003
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 } |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 void feature_tch_reroute_init() |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 { |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 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
|
79 tch_reroute_downlink = FALSE; |
9b147d0b2cab
gsm-fw feature tch-reroute: started laying the foundation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 } |