From: Uwe Hermann Date: Tue, 21 Feb 2012 00:44:50 +0000 (+0100) Subject: Draft how commands could be implemented. X-Git-Tag: sigrok-firmware-fx2lafw-0.1.0~77 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c7283c28a0ce6757630624e366589f8ce90949f7;p=sigrok-firmware-fx2lafw.git Draft how commands could be implemented. --- diff --git a/fx2lafw.c b/fx2lafw.c index 7972060f..6c99f046 100644 --- a/fx2lafw.c +++ b/fx2lafw.c @@ -46,6 +46,13 @@ #include #include +/* Protocol commands */ +#define CMD_SET_SAMPLERATE 0xb0 +#define CMD_START 0xb1 +#define CMD_STOP 0xb2 +#define CMD_GET_FW_VERSION 0xb3 +/* ... */ + #define SYNCDELAY() SYNCDELAY4 /* ... */ @@ -285,12 +292,27 @@ static void setup_endpoints(void) BOOL handle_vendorcommand(BYTE cmd) { - (void)cmd; - - /* - * TODO: Implement the protocol using control requests of type - * 'vendor-specific' (bmRequestType[6:5] = 2). - */ + /* Protocol implementation */ + + switch (cmd) { + case CMD_SET_SAMPLERATE: + /* TODO */ + break; + case CMD_START: + /* TODO */ + break; + case CMD_STOP: + GPIFABORT = 0xff; + /* TODO */ + return TRUE; + break; + case CMD_GET_FW_VERSION: + /* TODO */ + break; + default: + /* Unimplemented command. */ + break; + } return FALSE; }