]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blobdiff - fx2lafw.c
Draft how commands could be implemented.
[sigrok-firmware-fx2lafw.git] / fx2lafw.c
index 7972060f81de411c679c7d32b4bd98f75eb7086f..6c99f04692b86dd87db8de16864cc85814c9a3ce 100644 (file)
--- a/fx2lafw.c
+++ b/fx2lafw.c
 #include <eputils.h>
 #include <gpif.h>
 
+/* 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;
 }