From: Joel Holdsworth Date: Sun, 11 Mar 2012 15:36:03 +0000 (+0000) Subject: Fixed GPIF waveform branch, and annotated population code X-Git-Tag: sigrok-firmware-fx2lafw-0.1.0~45 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=baecf744abd88bde4e8badf5535872f58e3873d4;p=sigrok-firmware-fx2lafw.git Fixed GPIF waveform branch, and annotated population code --- diff --git a/gpif-acquisition.c b/gpif-acquisition.c index 5a76fae5..b57bcf68 100644 --- a/gpif-acquisition.c +++ b/gpif-acquisition.c @@ -169,17 +169,51 @@ void gpif_acquisition_start(const struct cmd_start_acquisition *cmd) /* Populate S0 */ pSTATE = &GPIF_WAVE_DATA; + + /* DELAY + * Delay cmd->sample_delay clocks. + */ pSTATE[0] = cmd->sample_delay; + + /* OPCODE + * SGL=0, GIN=0, INCAD=0, NEXT=0, DATA=1, DP=0 + * Collect data in this state. + */ pSTATE[8] = 0x02; + + /* OUTPUT + * OE[0:3]=0, CTL[0:3]=0 + */ pSTATE[16] = 0x00; + + /* LOGIC FUNCTION + * Not used + */ pSTATE[24] = 0x00; - /* Populate S1 */ + /* Populate S1 - the decision point */ pSTATE = &GPIF_WAVE_DATA + 1; - pSTATE[0] = 0x00; - pSTATE[8] = 0x01; + + /* BRANCH + * Branch to IDLE if condition is true, back to S0 otherwise + */ + pSTATE[0] = (7 << 3) | (0 << 0); + + /* OPCODE + * SGL=0, GIN=0, INCAD=0, NEXT=0, DATA=0, DP=1 + */ + pSTATE[8] = (1 << 0); + + /* OUTPUT + * OE[0:3]=0, CTL[0:3]=0 + */ pSTATE[16] = 0x00; - pSTATE[24] = 0x36; + + /* LOGIC FUNCTION + * Evaluate if the FIFO full flag is set. + * LFUNC=0 (AND), TERMA=6 (FIFO Flag), TERMB=6 (FIFO Flag) + */ + pSTATE[24] = (6 << 3) | (6 << 0); /* Execute the whole GPIF waveform once */ gpif_set_tc16(1);