From: Uwe Hermann Date: Mon, 20 Feb 2012 23:55:23 +0000 (+0100) Subject: First somewhat working GPIF waveform and setup code. X-Git-Tag: sigrok-firmware-fx2lafw-0.1.0~81 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=dc7ac8bfeea9cae7bbfee5839889a3b37f3d62f5;p=sigrok-firmware-fx2lafw.git First somewhat working GPIF waveform and setup code. This samples data forever, and has no mechanism to detect or report lost samples. This is just for testing purposes, do not use productively! --- diff --git a/fx2lafw.c b/fx2lafw.c index 4505c138..bc97e5a7 100644 --- a/fx2lafw.c +++ b/fx2lafw.c @@ -83,7 +83,9 @@ static const BYTE wavedata[128] = { * 0x01: Stay one IFCLK cycle in this state. * 0x38: No Re-execution, BRANCHON1 = state 7, BRANCHON0 = state 0. */ - 0x01, 0x38, 0x01, 0x01, 0x01, 0x01, 0x01, + // 0x01, 0x38, 0x01, 0x01, 0x01, 0x01, 0x01, + // FIXME: For now just loop over the "sample data" state forever. + 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, /* TRM says "reserved", but GPIF designer always puts a 0x07 here. */ 0x07, @@ -272,6 +274,16 @@ static void setup_endpoints(void) RESETFIFO(0x01) RESETFIFO(0x02) + /* EP2: Enable AUTOIN mode. Set FIFO width to 8bits. */ + EP2FIFOCFG = bmAUTOIN | ~bmWORDWIDE; + SYNCDELAY(); + + /* EP2: Auto-commit 512 (0x200) byte packets (due to AUTOIN = 1). */ + EP2AUTOINLENH = 0x02; + SYNCDELAY(); + EP2AUTOINLENL = 0x00; + SYNCDELAY(); + /* Set the GPIF flag for EP2 to 'full'. */ EP2GPIFFLGSEL = (1 << 1) | (0 << 1); SYNCDELAY(); @@ -384,13 +396,8 @@ void main(void) /* Put the FX2 into GPIF master mode and setup the GPIF. */ gpif_init_la(); - /* TODO */ - /* Initiate a GPIF read. */ - (void)EP2GPIFTRIG; -#if 0 - /* TODO: This seems to hang? */ + /* Perform the initial GPIF read. */ gpif_fifo_read(GPIF_EP2); -#endif while (1) { if (got_sud) {