.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
.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
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 */
(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;
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. */
EP2AUTOINLENL = 0x00;
SYNCDELAY();
- /* Set the GPIF flag for EP2 to 'full'. */
+ /* EP2: Set the GPIF flag to 'full'. */
EP2GPIFFLGSEL = (1 << 1) | (0 << 1);
SYNCDELAY();
}
BOOL handle_vendorcommand(BYTE cmd)
{
(void)cmd;
+
+ /*
+ * TODO: Implement the protocol using control requests of type
+ * 'vendor-specific' (bmRequestType[6:5] = 2).
+ */
+
return FALSE;
}
/* (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 */