summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-24 13:31:13 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-24 13:31:13 -0400
commitb72469c072514317602d1345b3d19e2375a90ab5 (patch)
tree120ab9fde332c9d645500d8977471d066d9228ff /parser.c
parent6289747b35eef38cca5d5d3076b4ec6d33f9053f (diff)
added diag:eprom:reset
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c198
1 files changed, 114 insertions, 84 deletions
diff --git a/parser.c b/parser.c
index 3dba1ee..be84e8f 100644
--- a/parser.c
+++ b/parser.c
@@ -115,6 +115,7 @@ static int Go_curr_slew_98(gchar** response, int channel, char *parameter,char *
static int Go_avrq_ampl(gchar** response, int channel, char *parameter,char *units,int command_type);
static int Go_cal_100(gchar** response, int channel, char *parameter,char *units,int command_type);
static int Go_cal_interval_101(gchar** response, int channel, char *parameter,char *units,int command_type);
+static int Go_eprom_reset_102(gchar** response, int channel, char *parameter,char *units,int command_type);
static int Parser_id_word(char *id_me, int *channel, int *with_id_code)
{
@@ -346,9 +347,9 @@ static int Parser_id_word(char *id_me, int *channel, int *with_id_code)
id_code = 106;
} else if (!strcmp(id_me,"all") ) {
id_code = 107;
- }
-
- else {
+ } else if (!strcmp(id_me,"reset") || !strcmp(id_me,"res")) {
+ id_code = 108;
+ } else {
id_code = 9999;
}
@@ -378,101 +379,101 @@ static int Parser_find_commands(int commands[], int command_depth)
{6}, /* opc - sentence 5 */
{8}, /* rst - sentence 6 */
{9}, /* sre - sentence 7 */
- {10}, /* stb - sentence 8 */
- {11}, /* tst - sentence 9 */
- {12}, /* wai - sentence 10 */
- {13,14,81|optional}, /* syst:err:next - 11 */
- {13,15}, /* syst:vers - 12 */
- {16,17,18|optional}, /* stat:oper:event - 13 */
- {16,17,19}, /* stat:oper:cond - 14 */
- {16,17,20}, /* stat:oper:enable - 15 */
- {16,21,18|optional}, /* stat:ques:event - 16 */
- {16,21,19}, /* stat:ques:cond - 17 */
- {16,21,20}, /* stat:ques:enable - 18 */
- {16,22}, /* stat:preset - 19 */
- {24,25}, /* output:impedance - 20 */
- {24,26,27}, /* output:prot:tripped - 21 */
- {28|optional,29,30|optional,31|optional,32|optional}, /* sour:curr:lev:imm:ampl - 22 */
- {28|optional,29,30|optional,31|optional,33}, /* sour:curr:lev:imm:offset - 23 - not used */
- {28|optional,29,30|optional,31|optional,34}, /* sour:curr:lev:imm:high - 24 - not used */
- {28|optional,29,30|optional,31|optional,35}, /* sour:curr:lev:imm:low - 25 */
- {28|optional,36,30|optional,31|optional,32|optional}, /* sour:volt:lev:imm:ampl - 26 */
- {28|optional,36,30|optional,31|optional,33}, /* sour:volt:lev:imm:offset - 27 - not used */
- {28|optional,36,30|optional,31|optional,34}, /* sour:volt:lev:imm:high - 28 - not used */
- {28|optional,36,30|optional,31|optional,35}, /* sour:volt:lev:imm:low - 29 */
- {28|optional,29,26,27}, /* sour:curr:prot:tripped? - 30 */
- {28|optional,36,26,27}, /* sour:volt:prot:tripped? - 31 */
- {28|optional,37,49|optional}, /* sour:freq:cw - 32 */
- {28|optional,37,50|optional}, /* sour:freq:fixed - 33 */
- {28|optional,38,39|optional}, /* sour:func:shape - 34 */
- {28|optional,40,41}, /* sour:puls:per - 35 */
- {28|optional,40,42}, /* sour:puls:width - 36 */
- {28|optional,40,43}, /* sour:puls:dcyc - 37 */
- {28|optional,40,44}, /* sour:puls:hold - 38 */
- {28|optional,40,45}, /* sour:puls:delay - 39 */
- {28|optional,40,46,16|optional}, /* sour:puls:doub:state - 40 */
- {28|optional,40,46,45}, /* sour:puls:doub:delay - 41 */
- {28|optional,40,47}, /* sour:puls:pol - 42 */
- {13,48,31|optional}, /* syst:beep:imm - 43 - not used */
- {52,31|optional,53}, /* init:imm:cont - 44 - not used */
- {51}, /* abort - 45 - not used */
- {54,31|optional,28}, /* trig:imm:sour - 46 */
- {23,57,58}, /* diag:eprom:string - 47 */
- {23,57,55}, /* diag:eprom:int - 48 */
- {23,57,59,60}, /* diag:eprom:bit:set - 49 - not used */
- {23,57,59,61}, /* diag:eprom:bit:clear - 50 - not used */
- {23,57,56}, /* diag:eprom:float - 51 */
- {23,62}, /* diag:shiftreg - 52 */
- {63}, /* *rcl - 53 */
- {64}, /* *sav - 54 */
- {24,16|optional}, /* output:state - 55 */
- {28|optional,40,65,75}, /* sour:puls:gate:type - 56 */
- {66}, /* local (RS232 mode only) - 57 */
- {23,67,45}, /* diag:test:delay - 58 */
- {13,68,70,69}, /* syst:comm:gpib:addr - 59 */
+ {10}, /* stb - sentence 8 */
+ {11}, /* tst - sentence 9 */
+ {12}, /* wai - sentence 10 */
+ {13,14,81|optional}, /* syst:err:next - 11 */
+ {13,15}, /* syst:vers - 12 */
+ {16,17,18|optional}, /* stat:oper:event - 13 */
+ {16,17,19}, /* stat:oper:cond - 14 */
+ {16,17,20}, /* stat:oper:enable - 15 */
+ {16,21,18|optional}, /* stat:ques:event - 16 */
+ {16,21,19}, /* stat:ques:cond - 17 */
+ {16,21,20}, /* stat:ques:enable - 18 */
+ {16,22}, /* stat:preset - 19 */
+ {24,25}, /* output:impedance - 20 */
+ {24,26,27}, /* output:prot:tripped - 21 */
+ {28|optional,29,30|optional,31|optional,32|optional}, /* sour:curr:lev:imm:ampl - 22 */
+ {28|optional,29,30|optional,31|optional,33}, /* sour:curr:lev:imm:offset - 23 - not used */
+ {28|optional,29,30|optional,31|optional,34}, /* sour:curr:lev:imm:high - 24 - not used */
+ {28|optional,29,30|optional,31|optional,35}, /* sour:curr:lev:imm:low - 25 */
+ {28|optional,36,30|optional,31|optional,32|optional}, /* sour:volt:lev:imm:ampl - 26 */
+ {28|optional,36,30|optional,31|optional,33}, /* sour:volt:lev:imm:offset - 27 - not used */
+ {28|optional,36,30|optional,31|optional,34}, /* sour:volt:lev:imm:high - 28 - not used */
+ {28|optional,36,30|optional,31|optional,35}, /* sour:volt:lev:imm:low - 29 */
+ {28|optional,29,26,27}, /* sour:curr:prot:tripped? - 30 */
+ {28|optional,36,26,27}, /* sour:volt:prot:tripped? - 31 */
+ {28|optional,37,49|optional}, /* sour:freq:cw - 32 */
+ {28|optional,37,50|optional}, /* sour:freq:fixed - 33 */
+ {28|optional,38,39|optional}, /* sour:func:shape - 34 */
+ {28|optional,40,41}, /* sour:puls:per - 35 */
+ {28|optional,40,42}, /* sour:puls:width - 36 */
+ {28|optional,40,43}, /* sour:puls:dcyc - 37 */
+ {28|optional,40,44}, /* sour:puls:hold - 38 */
+ {28|optional,40,45}, /* sour:puls:delay - 39 */
+ {28|optional,40,46,16|optional}, /* sour:puls:doub:state - 40 */
+ {28|optional,40,46,45}, /* sour:puls:doub:delay - 41 */
+ {28|optional,40,47}, /* sour:puls:pol - 42 */
+ {13,48,31|optional}, /* syst:beep:imm - 43 - not used */
+ {52,31|optional,53}, /* init:imm:cont - 44 - not used */
+ {51}, /* abort - 45 - not used */
+ {54,31|optional,28}, /* trig:imm:sour - 46 */
+ {23,57,58}, /* diag:eprom:string - 47 */
+ {23,57,55}, /* diag:eprom:int - 48 */
+ {23,57,59,60}, /* diag:eprom:bit:set - 49 - not used */
+ {23,57,59,61}, /* diag:eprom:bit:clear - 50 - not used */
+ {23,57,56}, /* diag:eprom:float - 51 */
+ {23,62}, /* diag:shiftreg - 52 */
+ {63}, /* *rcl - 53 */
+ {64}, /* *sav - 54 */
+ {24,16|optional}, /* output:state - 55 */
+ {28|optional,40,65,75}, /* sour:puls:gate:type - 56 */
+ {66}, /* local (RS232 mode only) - 57 */
+ {23,67,45}, /* diag:test:delay - 58 */
+ {13,68,70,69}, /* syst:comm:gpib:addr - 59 */
{13,68,71,72|optional,73}, /* syst:comm:ser:rec:baud - 60 */
{13,68,71,72|optional,74,75|optional}, /* syst:comm:ser:rec:parity - 61 */
{13,68,71,72|optional,76}, /* syst:comm:ser:rec:bits - 62 */
{13,68,71,72|optional,77}, /* syst:comm:ser:rec:sbits - 63 */
- {13,68,71,80,79}, /* syst:comm:ser:control:rts - 64 */
+ {13,68,71,80,79}, /* syst:comm:ser:control:rts - 64 */
{13,68,71,72|optional,78}, /* syst:comm:ser:rec:echo - 65 */
- {13,14,82}, /* syst:err:count - 66 */
+ {13,14,82}, /* syst:err:count - 66 */
{28|optional,40,65,30}, /* sour:puls:gate:level - 67 */
- {24,85}, /* output:load - 68 */
- {86,32}, /* meas:ampl? - 69 */
- {23,57,87}, /* diag:eprom:char - 70 */
- {23,88}, /* diag:calib - 71 */
+ {24,85}, /* output:load - 68 */
+ {86,32}, /* meas:ampl? - 69 */
+ {23,57,87}, /* diag:eprom:char - 70 */
+ {23,88}, /* diag:calib - 71 */
{23,32,88,95|optional}, /* diag:ampl:calib:scale - 72 */
{23,89,88,95|optional}, /* diag:mon:calib:scale - 73 */
- {23,89,90}, /* diag:mon:step - 74 */
- {24,75}, /* output:type - 75 */
+ {23,89,90}, /* diag:mon:step - 74 */
+ {24,75}, /* output:type - 75 */
{23,33,88,95|optional}, /* diag:offset:calib:scale - 76 */
{23,40,42,88,94}, /* diag:pulse:width:calib:shift - 77 */
- {91,92}, /* route:close - 78 */
- {23,40,42,88,93}, /* diag:pulse:width:calib:point - 79 */
- {23,40,45,88,93}, /* diag:pulse:delay:calib:point - 80 */
- {23,40,41,88,93}, /* diag:pulse:period:calib:point - 81 */
- {23,40,45,88,94}, /* diag:pulse:delay:calib:shift - 82 */
- {23,32,88,93}, /* diag:ampl:calib:point - 83 */
- {23,33,88,93}, /* diag:offset:calib:point - 84 */
- {23,33,96,93}, /* diag:offset:null:point - 85 */
- {23,57,97}, /* diag:eprom:size - 86 */
- {83,84}, /* display:brightness - 87 */
- {28|optional,40,82}, /* sour:puls:count - 88 */
- {28|optional,40,98}, /* sour:puls:separation - 89 */
- {23,40,98,88,93}, /* diag:pulse:separation:calib:point - 90 */
- {13,68,99}, /* system:comm:network - 91 */
- {13,100,101}, /* system:password:new - 92 */
- {23,57,102}, /* diag:eprom:suspend - 93 */
- {28|optional,40,103,104|optional}, /* sour:puls:transition:leading - 94 */
+ {91,92}, /* route:close - 78 */
+ {23,40,42,88,93}, /* diag:pulse:width:calib:point - 79 */
+ {23,40,45,88,93}, /* diag:pulse:delay:calib:point - 80 */
+ {23,40,41,88,93}, /* diag:pulse:period:calib:point - 81 */
+ {23,40,45,88,94}, /* diag:pulse:delay:calib:shift - 82 */
+ {23,32,88,93}, /* diag:ampl:calib:point - 83 */
+ {23,33,88,93}, /* diag:offset:calib:point - 84 */
+ {23,33,96,93}, /* diag:offset:null:point - 85 */
+ {23,57,97}, /* diag:eprom:size - 86 */
+ {83,84}, /* display:brightness - 87 */
+ {28|optional,40,82}, /* sour:puls:count - 88 */
+ {28|optional,40,98}, /* sour:puls:separation - 89 */
+ {23,40,98,88,93}, /* diag:pulse:separation:calib:point - 90 */
+ {13,68,99}, /* system:comm:network - 91 */
+ {13,100,101}, /* system:password:new - 92 */
+ {23,57,102}, /* diag:eprom:suspend - 93 */
+ {28|optional,40,103,104|optional}, /* sour:puls:transition:leading - 94 */
{23,40,103,88,93}, /* diag:pulse:transition:calib:point - 95 */
{28|optional,29,105,32|optional}, /* sour:curr:limit:ampl - 96 */
{23,24,85,88,93}, /* diag:output:load:calib:point - 97 */
{28|optional,29,106}, /* sour:curr:slew - 98 */
- {23,106,88,93}, /* diag:slew:calib:point - 99 */
- {88,107|optional}, /* calibration:all - 100 */
- {88,37} /* calibration:frequency - 101 */
-
+ {23,106,88,93}, /* diag:slew:calib:point - 99 */
+ {88,107|optional}, /* calibration:all - 100 */
+ {88,37}, /* calibration:frequency - 101 */
+ {23,57,108} /* diag:eprom:reset - 102 */
};
@@ -1046,6 +1047,9 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer
case 101:
error_num=Go_cal_interval_101(&response,channel,parameter,units,command_type);
break;
+ case 102:
+ error_num=Go_eprom_reset_102(&response,channel,parameter,units,command_type);
+ break;
case 9999:
// was only whitespace, ignore
@@ -3716,6 +3720,32 @@ static int Go_eprom_sus_93(gchar** response, int channel, char *parameter,int co
}
+static int Go_eprom_reset_102(gchar** response, int channel, char *parameter,char *units,int command_type)
+{
+ int status, value;
+
+ if (channel) {
+ return InvalidChannel;
+ }
+
+ switch (command_type) {
+ case command_withparam:
+ if (status = process_int_range (parameter, &value, 0, sizeof(globals.Flash)-1)) {
+ return status;
+ }
+ initFlash(&globals.Flash, TRUE, value);
+ Main_Rst();
+ return OK;
+ break;
+
+ default:
+ return SyntaxError;
+ break;
+ }
+
+}
+
+
static int Go_rise_time_94(gchar** response, int channel, char *parameter,char *units,int command_type)
{
float new_rise_time;