From: Uwe Hermann Date: Tue, 21 Feb 2012 00:30:33 +0000 (+0100) Subject: Eliminate EP1, commands should use EP0. X-Git-Tag: sigrok-firmware-fx2lafw-0.1.0~78 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=4ad20a4c57699f7ea5ce88fc132feaf7471743c1;hp=bee5946d03f60500debb8923ac137981bd65e9cf;p=sigrok-firmware-fx2lafw.git Eliminate EP1, commands should use EP0. The protocol should be implemented using control requests of type 'vendor-specific' (bmRequestType[6:5] = 2). --- diff --git a/dscr.a51 b/dscr.a51 index 1337a395..735e55d3 100644 --- a/dscr.a51 +++ b/dscr.a51 @@ -97,21 +97,12 @@ highspd_dscr_end: .db DSCR_INTERFACE_TYPE .db 0 ; Interface index .db 0 ; Alternate setting index - .db 2 ; Number of endpoints + .db 1 ; Number of endpoints .db 0xff ; Class (vendor specific) .db 0xff ; Subclass (vendor specific) .db 0xff ; Protocol (vendor specific) .db 0 ; String index (none) - ; Endpoint 1 (OUT) - .db DSCR_ENDPOINT_LEN - .db DSCR_ENDPOINT_TYPE - .db 0x01 ; EP number (1), direction (OUT) - .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) - .db 0x00 ; Max. packet size, LSB (512 bytes) - .db 0x02 ; Max. packet size, MSB (512 bytes) - .db 0x00 ; Polling interval - ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE @@ -146,21 +137,12 @@ fullspd_dscr_end: .db DSCR_INTERFACE_TYPE .db 0 ; Interface index .db 0 ; Alternate setting index - .db 2 ; Number of endpoints + .db 1 ; Number of endpoints .db 0xff ; Class (vendor specific) .db 0xff ; Subclass (vendor specific) .db 0xff ; Protocol (vendor specific) .db 0 ; String index (none) - ; Endpoint 1 (OUT) - .db DSCR_ENDPOINT_LEN - .db DSCR_ENDPOINT_TYPE - .db 0x01 ; EP number (1), direction (OUT) - .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) - .db 0x40 ; Max. packet size, LSB (64 bytes) - .db 0x00 ; Max. packet size, MSB (64 bytes) - .db 0x00 ; Polling interval - ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE diff --git a/fx2lafw.c b/fx2lafw.c index 1b0b90e3..7972060f 100644 --- a/fx2lafw.c +++ b/fx2lafw.c @@ -243,15 +243,6 @@ static void gpif_init_la(void) static void setup_endpoints(void) { - /* Setup EP1 (OUT). */ - EP1OUTCFG = (1 << 7) | /* EP is valid/activated */ - (0 << 6) | /* Reserved */ - (1 << 5) | (0 << 4) | /* EP Type: bulk */ - (0 << 3) | /* Reserved */ - (0 << 2) | /* Reserved */ - (0 << 1) | (0 << 0); /* Reserved */ - SYNCDELAY(); - /* Setup EP2 (IN). */ EP2CFG = (1 << 7) | /* EP is valid/activated */ (1 << 6) | /* EP direction: IN */ @@ -261,7 +252,11 @@ static void setup_endpoints(void) (0 << 1) | (0 << 0); /* EP buffering: quad buffering */ SYNCDELAY(); - /* Disable all other EPs (EP4, EP6, and EP8). */ + /* Disable all other EPs (EP1, EP4, EP6, and EP8). */ + EP1INCFG &= ~bmVALID; + SYNCDELAY(); + EP1OUTCFG &= ~bmVALID; + SYNCDELAY(); EP4CFG &= ~bmVALID; SYNCDELAY(); EP6CFG &= ~bmVALID; @@ -269,9 +264,8 @@ static void setup_endpoints(void) EP8CFG &= ~bmVALID; SYNCDELAY(); - /* Reset the FIFOs of EP1 and EP2. */ + /* EP2: Reset the FIFOs. */ /* Note: RESETFIFO() gets the EP number WITHOUT bit 7 set/cleared. */ - RESETFIFO(0x01) RESETFIFO(0x02) /* EP2: Enable AUTOIN mode. Set FIFO width to 8bits. */ @@ -284,7 +278,7 @@ static void setup_endpoints(void) EP2AUTOINLENL = 0x00; SYNCDELAY(); - /* Set the GPIF flag for EP2 to 'full'. */ + /* EP2: Set the GPIF flag to 'full'. */ EP2GPIFFLGSEL = (1 << 1) | (0 << 1); SYNCDELAY(); } @@ -292,6 +286,12 @@ 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). + */ + return FALSE; } @@ -317,13 +317,10 @@ BOOL handle_set_interface(BYTE ifc, BYTE alt_ifc) /* (2) Reset data toggles of the EPs in the interface. */ /* Note: RESETTOGGLE() gets the EP number WITH bit 7 set/cleared. */ - RESETTOGGLE(0x01); RESETTOGGLE(0x82); /* (3) Restore EPs to their default conditions. */ /* Note: RESETFIFO() gets the EP number WITHOUT bit 7 set/cleared. */ - RESETFIFO(0x01); - /* TODO */ RESETFIFO(0x02); /* TODO */