FreeCalypso > hg > freecalypso-sw
annotate rvinterf/etmsync/pirhackinit.c @ 992:a7b0b426f9ca
target-utils: boot ROM UART autodetection revamped
The new implementation should work with both the familiar Calypso C035
boot ROM version found in our regular targets as well as the older
Calypso F741979B version found on the vintage D-Sample board.
| author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
|---|---|
| date | Wed, 30 Dec 2015 21:28:41 +0000 |
| parents | 7cb0b32f1997 |
| children |
| rev | line source |
|---|---|
|
918
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This fc-pirhackinit utility is highly specific to the TCS211-on-Pirelli |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * exercise. DO NOT run it against Pirelli's stock firmware, nor is it needed |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * when using our full-source FreeCalypso firmware. |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 */ |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <sys/types.h> |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <stdio.h> |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include <stdlib.h> |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include <string.h> |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include <strings.h> |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "etm.h" |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "ffs.h" |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "tmffs2.h" |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "localtypes.h" |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 #include "exitcodes.h" |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 extern u_char pirelli_imeisv[8]; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 write_pcm_imei() |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 static char destfile[] = "/pcm/IMEI"; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 u_char swapped[8]; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 int i, d1, d2; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 printf("Writing %s\n", destfile); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 for (i = 0; i < 8; i++) { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 d1 = pirelli_imeisv[i] >> 4; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 d2 = pirelli_imeisv[i] & 0xF; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 swapped[i] = (d2 << 4) | d1; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 return do_short_fwrite(destfile, swapped, 8); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 read_mem_region(memaddr, databuf, total_bytes) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 u32 memaddr; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 u_char *databuf; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 int chunk, remain, rc; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 for (remain = total_bytes; remain; remain -= chunk) { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 chunk = remain; |
|
920
7cb0b32f1997
fc-pirhackinit works after fixing MAX_MEMREAD_BYTES
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
918
diff
changeset
|
43 if (chunk > MAX_MEMREAD_BYTES) |
|
7cb0b32f1997
fc-pirhackinit works after fixing MAX_MEMREAD_BYTES
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
918
diff
changeset
|
44 chunk = MAX_MEMREAD_BYTES; |
|
918
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 rc = do_memory_read(memaddr, databuf, chunk); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 if (rc) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 memaddr += chunk; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 databuf += chunk; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 return(0); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 write_buf_to_file(pathname, data, datalen) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 char *pathname; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 u_char *data; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 int tfd, rc, chunk, remain; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 if (datalen <= max_short_file_write(pathname)) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 return do_short_fwrite(pathname, data, datalen); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 /* do it the long way */ |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 rc = fd_open(pathname, FFS_O_WRONLY | FFS_O_CREATE | FFS_O_TRUNC, &tfd); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 if (rc) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 for (remain = datalen; remain; remain -= chunk) { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 chunk = remain; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 if (chunk > 240) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 chunk = 240; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 rc = fd_write(tfd, data, chunk); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 if (rc) { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 fd_close(tfd); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 data += chunk; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 return fd_close(tfd); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 copy_calib_record(memaddr, pathname, size) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 u32 memaddr; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 char *pathname; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 int size; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 u_char *buf; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 int rc; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 buf = malloc(size); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 if (!buf) { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 perror("malloc"); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 exit(ERROR_UNIX); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 rc = read_mem_region(memaddr, buf, size); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 if (rc) { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 free(buf); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 rc = write_buf_to_file(pathname, buf, size); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 free(buf); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 static struct calmap { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 u32 offset; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 int size; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 char *ti_equiv; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 } pirelli_cal_map[] = { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 {0x06E5, 36, "/sys/adccal"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 {0x072B, 512, "/gsm/rf/tx/ramps.900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 {0x092C, 128, "/gsm/rf/tx/levels.900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 {0x09AD, 128, "/gsm/rf/tx/calchan.900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 {0x0A2E, 512, "/gsm/rf/tx/ramps.1800"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 {0x0C2F, 128, "/gsm/rf/tx/levels.1800"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 {0x0CB0, 128, "/gsm/rf/tx/calchan.1800"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 {0x0D31, 512, "/gsm/rf/tx/ramps.1900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 {0x0F32, 128, "/gsm/rf/tx/levels.1900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 {0x0FB3, 128, "/gsm/rf/tx/calchan.1900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 {0x10AF, 40, "/gsm/rf/rx/calchan.900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 {0x10D8, 8, "/gsm/rf/rx/agcparams.900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 {0x10E1, 40, "/gsm/rf/rx/calchan.1800"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 {0x110A, 8, "/gsm/rf/rx/agcparams.1800"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 {0x1113, 40, "/gsm/rf/rx/calchan.1900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 {0x113C, 8, "/gsm/rf/rx/agcparams.1900"}, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 {0, 0, 0} |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 }; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 copy_calib_data() |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 struct calmap *tp; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 int rc; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 printf("Copying calibration records to FFS\n"); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 for (tp = pirelli_cal_map; tp->size; tp++) { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 rc = copy_calib_record(0x027F0000 + tp->offset, tp->ti_equiv, |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 tp->size); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 if (rc) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 return(0); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 } |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 single_op_main() |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 { |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 int rc; |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 rc = get_pirelli_imei(); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 if (rc) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 printf("Creating TCS211 file system directories\n"); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 rc = create_std_dirs(); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 if (rc) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 rc = write_pcm_imei(); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 if (rc) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 rc = copy_calib_data(); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 if (rc) |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 return(rc); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 return set_rfcap("tri900"); |
|
c298d579788e
fc-pirhackinit implemented, compiles
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 } |
