comparison librftab/rftablerd.c @ 283:64bb50fc470f

librftab reader: implemented reading of Tx ramps tables
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 18 Nov 2017 00:01:31 +0000
parents feb2ee302d25
children a0f79bba0ad8
comparison
equal deleted inserted replaced
282:90c475877d34 283:64bb50fc470f
110 written_size += size; 110 written_size += size;
111 return(0); 111 return(0);
112 } 112 }
113 113
114 static 114 static
115 expect_keyword(kw)
116 char *kw;
117 {
118 char *field;
119 int rc;
120
121 rc = get_field(&field);
122 if (rc < 0)
123 return(ERROR_USAGE);
124 if (!rc) {
125 printf("error: %s is too short for table format %s\n",
126 filename, format);
127 return(ERROR_USAGE);
128 }
129 if (strcmp(field, kw)) {
130 printf("%s line %d: expected %s keyword\n", filename, lineno,
131 kw);
132 return(ERROR_USAGE);
133 }
134 return(0);
135 }
136
137 static
115 ensure_eof() 138 ensure_eof()
116 { 139 {
117 char *field; 140 char *field;
118 int rc; 141 int rc;
119 142
179 202
180 for (i = 0; i < 121; i++) { 203 for (i = 0; i < 121; i++) {
181 rc = process_number(1); 204 rc = process_number(1);
182 if (rc) 205 if (rc)
183 return(rc); 206 return(rc);
207 }
208 return ensure_eof();
209 }
210
211 static
212 read_tx_ramps()
213 {
214 int i, j, rc;
215
216 if (maxsize < 512) {
217 printf("error: tx-ramps table not allowed in this context\n");
218 return(ERROR_USAGE);
219 }
220 for (i = 0; i < 16; i++) {
221 rc = expect_keyword("ramp-up");
222 if (rc)
223 return(rc);
224 for (j = 0; j < 16; j++) {
225 rc = process_number(1);
226 if (rc)
227 return(rc);
228 }
229 rc = expect_keyword("ramp-down");
230 if (rc)
231 return(rc);
232 for (j = 0; j < 16; j++) {
233 rc = process_number(1);
234 if (rc)
235 return(rc);
236 }
184 } 237 }
185 return ensure_eof(); 238 return ensure_eof();
186 } 239 }
187 240
188 static 241 static
304 } table_formats[] = { 357 } table_formats[] = {
305 {"agc-table", read_agc_table}, 358 {"agc-table", read_agc_table},
306 {"afcparams", read_afcparams}, 359 {"afcparams", read_afcparams},
307 {"agc-global-params", read_agc_global_params}, 360 {"agc-global-params", read_agc_global_params},
308 {"il2agc", read_il2agc}, 361 {"il2agc", read_il2agc},
362 {"tx-ramps", read_tx_ramps},
309 {"tx-levels", read_tx_levels}, 363 {"tx-levels", read_tx_levels},
310 {"tx-calchan", read_tx_calchan}, 364 {"tx-calchan", read_tx_calchan},
311 {"tx-caltemp", read_tx_caltemp}, 365 {"tx-caltemp", read_tx_caltemp},
312 {"rx-calchan", read_rx_calchan}, 366 {"rx-calchan", read_rx_calchan},
313 {"rx-caltemp", read_rx_caltemp}, 367 {"rx-caltemp", read_rx_caltemp},