annotate rvinterf/etmsync/rfcap.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 091ebd46a9cc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
913
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * Setting of /gsm/com/rfcap
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 */
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <stdio.h>
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdlib.h>
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <string.h>
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <strings.h>
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "exitcodes.h"
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 static struct band_table {
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 char *keyword;
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 u_char bytes[4];
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 } band_table[] = {
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 {"dual-eu", {0x00, 0x0B, 0x41, 0x00}},
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 {"dual-us", {0x00, 0x14, 0x00, 0x14}},
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 {"tri900", {0x00, 0x0F, 0x41, 0x10}},
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 {"tri850", {0x00, 0x16, 0x01, 0x14}},
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 {"quad", {0x00, 0x1F, 0x41, 0x14}},
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 {0, {0x00, 0x00, 0x00, 0x00}}
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 };
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 static u_char rfcap_tail[12] = {0x00, 0x00, 0x00, 0x00,
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 0x50, 0x00, 0x00, 0xA5,
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 0x05, 0x00, 0xC0, 0x00};
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 set_rfcap(band_config_kw)
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 char *band_config_kw;
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 {
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 static char filename[] = "/gsm/com/rfcap";
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 u_char bytes[16];
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 struct band_table *tp;
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 for (tp = band_table; tp->keyword; tp++)
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 if (!strcmp(tp->keyword, band_config_kw))
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 break;
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 if (!tp->keyword) {
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 printf("error: band configuration \"%s\" not known\n",
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 band_config_kw);
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 return(ERROR_USAGE);
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 }
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 bcopy(tp->bytes, bytes, 4);
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 bcopy(rfcap_tail, bytes + 4, 12);
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 printf("Writing \"%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\" into %s\n",
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5],
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 bytes[6], bytes[7], bytes[8], bytes[9], bytes[10], bytes[11],
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 bytes[12], bytes[13], bytes[14], bytes[15], filename);
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 return do_short_fwrite(filename, bytes, 16);
091ebd46a9cc user-friendly set-rfcap implemented in fc-fsio
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 }