FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/rftablerd.c @ 268:081e22784044
CHANGES: fc-fsio pirelli-magnetite-init change documented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 16 Nov 2017 04:41:39 +0000 |
parents | db7fc16bac1e |
children |
rev | line source |
---|---|
121
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Reading RF tables from formatted ASCII files for the rftw command |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <ctype.h> |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "localtypes.h" |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "l1tm.h" |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "exitcodes.h" |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #define MAX_FIELDS_PER_LINE 64 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 static char *filename; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 static FILE *rdfile; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 static unsigned lineno; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 static char linebuf[256], *line_fields[MAX_FIELDS_PER_LINE]; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 static unsigned line_nfields, line_field_ptr; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 static char *format; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 static u_char *writeptr; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 static unsigned written_size; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 static int |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 read_line() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 char *cp; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 if (!fgets(linebuf, sizeof linebuf, rdfile)) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 return(0); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 lineno++; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 cp = linebuf; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 for (line_nfields = 0; ; ) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 while (isspace(*cp)) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 cp++; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 if (*cp == '\0' || *cp == '#') |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 break; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 if (line_nfields >= MAX_FIELDS_PER_LINE) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 printf("%s line %d: too many fields on one line\n", |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 filename, lineno); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 return(-1); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 line_fields[line_nfields++] = cp; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 while (*cp && !isspace(*cp)) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 cp++; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 if (*cp) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 *cp++ = '\0'; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 return(1); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 get_field(retp) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 char **retp; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 int rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 if (line_field_ptr < line_nfields) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 *retp = line_fields[line_field_ptr++]; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 return(1); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 do { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 rc = read_line(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 if (rc <= 0) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 } while (!line_nfields); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 *retp = line_fields[0]; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 line_field_ptr = 1; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 return(1); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 process_number(size) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 char *field; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 int rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 u_long number; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 rc = get_field(&field); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 if (rc < 0) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 if (!rc) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 printf("error: %s is too short for table format %s\n", |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 filename, format); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 if (field[0] == '-') |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 number = strtol(field, 0, 0); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 else |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 number = strtoul(field, 0, 0); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 switch (size) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 case 1: |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 *writeptr++ = number; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 break; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 case 2: |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 *writeptr++ = number; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 *writeptr++ = number >> 8; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 break; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 case 4: |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 *writeptr++ = number; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 *writeptr++ = number >> 8; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 *writeptr++ = number >> 16; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 *writeptr++ = number >> 24; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 break; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 default: |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 abort(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 written_size += size; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 return(0); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 ensure_eof() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 char *field; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 int rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 rc = get_field(&field); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 if (rc < 0) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 if (rc) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 printf("error: %s is too long for table format %s\n", |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 filename, format); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 return(0); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 read_agc_table() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 for (i = 0; i < 20; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 read_afcparams() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 for (i = 0; i < 4; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 rc = process_number(4); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 for (i = 0; i < 4; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 read_agc_global_params() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 for (i = 0; i < 4; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 read_il2agc() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 for (i = 0; i < 121; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 rc = process_number(1); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 read_tx_levels() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 for (i = 0; i < 32; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 rc = process_number(1); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 rc = process_number(1); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 read_tx_calchan() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 for (i = 0; i < 64; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 read_tx_caltemp() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 for (i = 0; i < 20; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 read_rx_calchan() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 for (i = 0; i < 20; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 read_rx_caltemp() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 for (i = 0; i < 22; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 read_rx_agc_params() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 int i, rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 for (i = 0; i < 4; i++) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 rc = process_number(2); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 if (rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 return ensure_eof(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 static |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 read_raw_table() |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 int rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 char *field; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 u_long number; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 for (;;) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 rc = get_field(&field); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 if (rc < 0) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 if (!rc) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 break; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 number = strtoul(field, 0, 16); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 if (written_size >= MAX_RF_TABLE_SIZE) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 printf("error: raw table %s exceeds maximum size\n", |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 filename); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 *writeptr++ = number; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 written_size++; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 if (!written_size) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 printf("error: raw table %s is empty\n", filename); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 return(0); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 static struct table_format { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 char *kw; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 int (*handler)(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
304 } table_formats[] = { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 {"agc-table", read_agc_table}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 {"afcparams", read_afcparams}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 {"agc-global-params", read_agc_global_params}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 {"il2agc", read_il2agc}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 {"tx-levels", read_tx_levels}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 {"tx-calchan", read_tx_calchan}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 {"tx-caltemp", read_tx_caltemp}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 {"rx-calchan", read_rx_calchan}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 {"rx-caltemp", read_rx_caltemp}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 {"rx-agc-params", read_rx_agc_params}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 {"raw", read_raw_table}, |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 {0, 0} |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 }; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 read_rf_table(filename_arg, rdbuf, format_ret, size_ret) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 char *filename_arg; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 u_char *rdbuf; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 char **format_ret; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 unsigned *size_ret; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 char *field; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 int rc; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 struct table_format *tp; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 filename = filename_arg; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 rdfile = fopen(filename, "r"); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 if (!rdfile) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 perror(filename); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 return(ERROR_UNIX); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 lineno = 0; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 line_nfields = 0; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 rc = get_field(&field); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 if (rc <= 0) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 not_valid_rftable: |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 printf("error: %s is not a valid RF table file\n", filename); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 fclose(rdfile); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 if (strcmp(field, "rf_table")) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 goto not_valid_rftable; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 rc = get_field(&field); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 if (rc <= 0) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 goto not_valid_rftable; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 for (tp = table_formats; tp->kw; tp++) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 if (!strcmp(tp->kw, field)) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 break; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 if (!tp->kw) { |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 printf("error: table format \"%s\" not recognized\n", field); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 fclose(rdfile); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 return(ERROR_USAGE); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 } |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 format = tp->kw; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 if (format_ret) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 *format_ret = format; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 writeptr = rdbuf; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 written_size = 0; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 rc = tp->handler(); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 fclose(rdfile); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 if (size_ret) |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 *size_ret = written_size; |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 return(rc); |
4070847293a9
fc-tmsh: RF table reading code implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 } |
127
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
368 |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
369 static |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
370 process_txramp_number() |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
371 { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
372 char *field; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
373 int rc; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
374 u_long number; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
375 |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
376 rc = get_field(&field); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
377 if (rc < 0) |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
378 return(ERROR_USAGE); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
379 if (!rc) { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
380 printf("error: %s is too short for a Tx ramp template\n", |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
381 filename); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
382 return(ERROR_USAGE); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
383 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
384 number = strtoul(field, 0, 0); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
385 *writeptr++ = number; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
386 return(0); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
387 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
388 |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
389 static |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
390 read_txramp_16num() |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
391 { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
392 int i, rc; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
393 |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
394 for (i = 0; i < 16; i++) { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
395 rc = process_txramp_number(); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
396 if (rc) |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
397 return(rc); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
398 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
399 return(0); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
400 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
401 |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
402 read_tx_ramp_template(filename_arg, rdbuf) |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
403 char *filename_arg; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
404 u_char *rdbuf; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
405 { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
406 char *field; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
407 int rc; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
408 |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
409 filename = filename_arg; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
410 rdfile = fopen(filename, "r"); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
411 if (!rdfile) { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
412 perror(filename); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
413 return(ERROR_UNIX); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
414 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
415 lineno = 0; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
416 line_nfields = 0; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
417 rc = get_field(&field); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
418 if (rc <= 0) { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
419 not_valid_ramp_file: |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
420 printf("error: %s is not a valid Tx ramp template file\n", |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
421 filename); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
422 fclose(rdfile); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
423 return(ERROR_USAGE); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
424 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
425 if (strcmp(field, "ramp-up")) |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
426 goto not_valid_ramp_file; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
427 writeptr = rdbuf; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
428 rc = read_txramp_16num(); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
429 if (rc) { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
430 fclose(rdfile); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
431 return(rc); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
432 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
433 rc = get_field(&field); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
434 if (rc <= 0) |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
435 goto not_valid_ramp_file; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
436 if (strcmp(field, "ramp-down")) |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
437 goto not_valid_ramp_file; |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
438 rc = read_txramp_16num(); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
439 if (rc) { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
440 fclose(rdfile); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
441 return(rc); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
442 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
443 rc = get_field(&field); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
444 fclose(rdfile); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
445 if (rc < 0) |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
446 return(ERROR_USAGE); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
447 if (rc) { |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
448 printf("error: %s is too long for a Tx ramp template\n", |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
449 filename); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
450 return(ERROR_USAGE); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
451 } |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
452 return(0); |
db7fc16bac1e
fc-tmsh: implemented reading of Tx ramp template files
Mychaela Falconia <falcon@freecalypso.org>
parents:
121
diff
changeset
|
453 } |