Commits

Sven Schnelle  committed df8f9b6

Add handle_get_descriptor() function

Some fx2 code might want to return special descriptors, so add
a callback function for this.

Signed-off-by: Sven Schnelle <svens@stackframe.org>

  • Participants
  • Parent commits 0f35f9e

Comments (0)

Files changed (4)

File examples/bulkloop/bulkloop.c

  return cfg==1 ? TRUE : FALSE; // we only handle cfg 1
 }
 
+BOOL handle_get_descriptor()
+{
+}
 
 // copied usb jt routines from usbjt.h
 void sudav_isr() interrupt SUDAV_ISR {

File examples/eeprom/firmware/eeprom.c

 
 }
 
-
+BOOL handle_get_descriptor()
+{
+	return FALSE;
+}
 #define VC_EEPROM 0xb1
         
 BOOL handle_vendorcommand(BYTE cmd) {

File include/setupdat.h

 #define DSCR_STRING_TYPE 3
 #define DSCR_DEVQUAL_TYPE 6
 #define DSCR_OTHERSPD_TYPE 7
+#define DSCR_DEBUG_TYPE 10
 
 /* usb spec 2 */
 #define DSCR_BCD 2

File lib/setupdat.c

 extern BOOL handle_vendorcommand(BYTE cmd);
 extern BOOL handle_set_configuration(BYTE cfg);
 extern BOOL handle_get_interface(BYTE ifc, BYTE* alt_ifc);
+extern BOOL handle_get_descriptor(BYTE desc);
 extern BOOL handle_set_interface(BYTE ifc,BYTE alt_ifc);
 extern BYTE handle_get_configuration();
 extern BOOL handle_set_configuration(BYTE cfg);
   // 0x04 is reserved
 //  SET_ADDRESS=0x05, // this is handled by EZ-USB core unless RENUM=0
 //  GET_DESCRIPTOR,
-void handle_get_descriptor();
+void handle_get_descriptor_default();
 //  SET_DESCRIPTOR,
 //  GET_CONFIGURATION, // handled by callback
 //  SET_CONFIGURATION, // handled by callback
             }
             break;
         case GET_DESCRIPTOR:
-            handle_get_descriptor();
+            handle_get_descriptor_default();
             break;
         case GET_CONFIGURATION:            
             EP0BUF[0] = handle_get_configuration();
  *  String
  *  Other-Speed
  **/
-void handle_get_descriptor() {
+void handle_get_descriptor_default() {
     //printf ( "Get Descriptor\n" );
-    
+
     switch ( SETUPDAT[3] ) {
         case DSCR_DEVICE_TYPE:
             printf ( "Get Device Config\n" );
             SUDPTRL = LSB(pOtherConfig);
             break;
         default:
-            printf ( "Unhandled Get Descriptor: %02x\n", SETUPDAT[3]);
-            STALLEP0();
+            if (!handle_get_descriptor(SETUPDAT[3])) {
+                printf ( "Unhandled Get Descriptor: %02x\n", SETUPDAT[3]);
+                STALLEP0();
+            }
+            break;
     }
     
 }