FreeCalypso > hg > freecalypso-sw
comparison rvinterf/asyncshell/tchcmd.c @ 1026:f511bbac0efa
fc-shell: beginning of TCH code expansion
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 30 May 2016 22:45:48 +0000 |
parents | 9ced8e13cf91 |
children | 1178befeda76 |
comparison
equal
deleted
inserted
replaced
1025:4c80a6e6723f | 1026:f511bbac0efa |
---|---|
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <strings.h> | 9 #include <strings.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 #include "pktmux.h" | 11 #include "pktmux.h" |
12 #include "limits.h" | |
12 #include "tch_feature.h" | 13 #include "tch_feature.h" |
14 | |
15 extern u_char rvi_msg[]; | |
16 extern int rvi_msg_len; | |
17 | |
18 static int tch_rawdump_mode; | |
13 | 19 |
14 send_tch_config_req(config) | 20 send_tch_config_req(config) |
15 { | 21 { |
16 u_char sendpkt[3]; | 22 u_char sendpkt[3]; |
17 | 23 |
58 cmd_tchdl_oneshot(argc, argv) | 64 cmd_tchdl_oneshot(argc, argv) |
59 char **argv; | 65 char **argv; |
60 { | 66 { |
61 return cmd_tchdl_common(argc - 1, argv + 1); | 67 return cmd_tchdl_common(argc - 1, argv + 1); |
62 } | 68 } |
69 | |
70 static void | |
71 tch_rawdump() | |
72 { | |
73 char buf[MAX_PKT_FROM_TARGET*3+5], *dp; | |
74 u_char *cp, *endp; | |
75 | |
76 cp = rvi_msg + 2; | |
77 endp = rvi_msg + rvi_msg_len; | |
78 strcpy(buf, "TCH:"); | |
79 dp = buf + 4; | |
80 while (cp < endp) { | |
81 sprintf(dp, " %02X", *cp++); | |
82 dp += 3; | |
83 } | |
84 *dp = '\0'; | |
85 async_msg_output(buf); | |
86 } | |
87 | |
88 void | |
89 tch_packet_rx() | |
90 { | |
91 char buf[128]; | |
92 | |
93 if (tch_rawdump_mode) { | |
94 tch_rawdump(); | |
95 return; | |
96 } | |
97 if (rvi_msg_len < 3) { | |
98 inv: async_msg_output("Error: invalid TCH packet received"); | |
99 return; | |
100 } | |
101 switch (rvi_msg[2]) { | |
102 case TCH_CONFIG_CONF: | |
103 if (rvi_msg_len != 4) | |
104 goto inv; | |
105 if (rvi_msg[3] & 0xFE) | |
106 goto inv; | |
107 sprintf(buf, "TCH_CONFIG_CONF: DL forwarding is %s", | |
108 rvi_msg[3] ? "enabled" : "disabled"); | |
109 async_msg_output(buf); | |
110 return; | |
111 case TCH_ULBITS_CONF: | |
112 /* TCH UL play code will hook in here */ | |
113 return; | |
114 case TCH_DLBITS_IND: | |
115 /* TCH DL record code will hook in here */ | |
116 return; | |
117 default: | |
118 goto inv; | |
119 } | |
120 } |