FreeCalypso > hg > freecalypso-tools
comparison rvinterf/tmsh/rftablechk.c @ 123:bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 19 Feb 2017 09:07:52 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
122:cad9129d0f03 | 123:bc23c1cd30ae |
---|---|
1 /* | |
2 * This module contains the function that checks if the table format | |
3 * and rftw index match. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <stdio.h> | |
8 #include <string.h> | |
9 #include <strings.h> | |
10 #include <stdlib.h> | |
11 #include "localtypes.h" | |
12 #include "l1tm.h" | |
13 #include "exitcodes.h" | |
14 | |
15 static struct table_match { | |
16 int index; | |
17 char *format; | |
18 } matchlist[] = { | |
19 {RX_AGC_TABLE, "agc-table"}, | |
20 {AFC_PARAMS, "afcparams"}, | |
21 {RX_AGC_GLOBAL_PARAMS, "agc-global-params"}, | |
22 {RX_IL_2_AGC_MAX, "il2agc"}, | |
23 {RX_IL_2_AGC_PWR, "il2agc"}, | |
24 {RX_IL_2_AGC_AV, "il2agc"}, | |
25 {TX_LEVELS, "tx-levels"}, | |
26 {TX_CAL_CHAN, "tx-calchan"}, | |
27 {TX_CAL_TEMP, "tx-caltemp"}, | |
28 {RX_CAL_CHAN, "rx-calchan"}, | |
29 {RX_CAL_TEMP, "rx-caltemp"}, | |
30 {RX_AGC_PARAMS, "rx-agc-params"}, | |
31 {0, 0} | |
32 }; | |
33 | |
34 rftw_index_format_check(index, format) | |
35 char *format; | |
36 { | |
37 struct table_match *tp; | |
38 | |
39 if (!strcmp(format, "raw")) | |
40 return(0); | |
41 for (tp = matchlist; tp->index; tp++) { | |
42 if (tp->index == index) { | |
43 if (!strcmp(format, tp->format)) | |
44 return(0); | |
45 printf("error: read table of type %s, expected %s\n", | |
46 format, tp->format); | |
47 return(ERROR_USAGE); | |
48 } | |
49 } | |
50 return(0); | |
51 } |