[tuxdroid-svn] r1035 - firmware/fuxusb/branches/HID/modules/usb_enum
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-04-30 13:29:35
|
Author: Paul_R Date: 2008-04-30 10:33:50 +0200 (Wed, 30 Apr 2008) New Revision: 1035 Modified: firmware/fuxusb/branches/HID/modules/usb_enum/USB_ENUM.H firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c Log: * Indentation & typo Modified: firmware/fuxusb/branches/HID/modules/usb_enum/USB_ENUM.H =================================================================== --- firmware/fuxusb/branches/HID/modules/usb_enum/USB_ENUM.H 2008-04-30 08:19:03 UTC (rev 1034) +++ firmware/fuxusb/branches/HID/modules/usb_enum/USB_ENUM.H 2008-04-30 08:33:50 UTC (rev 1035) @@ -182,13 +182,13 @@ struct usb_hid_descriptor { - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uint16 bcdHID; /* HID spec. */ - Uchar bCountryCode; /* Country code value*/ - Uchar bNumDescriptors; /* Number of reports descriptor */ - Uchar bDescriptorTypeRep; /* Type of the class-specific descriptor */ - Uint16 wDescriptorLength; /* Size of the report descriptor */ + Uchar bLength; /* size of this descriptor in bytes */ + Uchar bDescriptorType; /* INTERFACE descriptor type */ + Uint16 bcdHID; /* HID spec. */ + Uchar bCountryCode; /* Country code value*/ + Uchar bNumDescriptors; /* Number of reports descriptor */ + Uchar bDescriptorTypeRep; /* Type of the class-specific descriptor */ + Uint16 wDescriptorLength; /* Size of the report descriptor */ }; /*_____ U S B I N T E R F A C E D E S C R I P T O R _____________________*/ @@ -340,10 +340,10 @@ Uchar bLength; /* size of this descriptor in bytes */ Uchar bDescriptorType; /* INTERFACE descriptor type */ Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uint16 bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ - Uint16 wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ + Uint16 bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ + Uint16 wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ Uchar bInCollection; /* Number of EP except EP 0 */ - Uchar baInterfaceNr[2]; /* Class code assigned by the USB */ + Uchar baInterfaceNr[2]; /* Class code assigned by the USB */ }; struct usb_Audio_cs_ACinterface_descriptor_NbCol1 @@ -351,10 +351,10 @@ Uchar bLength; /* size of this descriptor in bytes */ Uchar bDescriptorType; /* INTERFACE descriptor type */ Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uint16 bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ - Uint16 wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ - Uchar bInCollection; /* Number of EP except EP 0 */ - Uchar baInterfaceNr[1]; /* Class code assigned by the USB */ + Uint16 bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ + Uint16 wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ + Uchar bInCollection; /* Number of EP except EP 0 */ + Uchar baInterfaceNr[1]; /* Class code assigned by the USB */ }; /*_____ U S B I N P U T T E R M I N A L D E S C R I P T O R ___________________________*/ @@ -364,13 +364,13 @@ Uchar bLength; /* size of this descriptor in bytes */ Uchar bDescriptorType; /* INTERFACE descriptor type */ Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uchar bTerminalID; /* CConstant characterizing the type of Termina*/ - Uint16 wTerminalType; /* Constant characterizing the type of Terminal.*/ - Uchar bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ - Uchar bNrChannels; /* Number of logical output channels in the Terminals output audio channel cluster. */ - Uint16 wChannelConfig; /* Describes the spatial location of the logical channels.*/ - Uchar iChannelNames; /*Index of a string descriptor, describing the name of the first logical channel */ - Uchar iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ + Uchar bTerminalID; /* CConstant characterizing the type of Termina*/ + Uint16 wTerminalType; /* Constant characterizing the type of Terminal.*/ + Uchar bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ + Uchar bNrChannels; /* Number of logical output channels in the Terminals output audio channel cluster. */ + Uint16 wChannelConfig; /* Describes the spatial location of the logical channels.*/ + Uchar iChannelNames; /*Index of a string descriptor, describing the name of the first logical channel */ + Uchar iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ }; /*_____ U S B O U T P U T T E R M I N A L D E S C R I P T O R ___________________________*/ @@ -380,11 +380,11 @@ Uchar bLength; /* size of this descriptor in bytes */ Uchar bDescriptorType; /* INTERFACE descriptor type */ Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uchar bTerminalID; /* CConstant characterizing the type of Termina*/ - Uint16 wTerminalType; /* Constant characterizing the type of Terminal.*/ - Uchar bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ - Uchar bSourceID; /*ID of the Unit or Terminal to which this Terminal is connected */ - Uchar iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ + Uchar bTerminalID; /* CConstant characterizing the type of Termina*/ + Uint16 wTerminalType; /* Constant characterizing the type of Terminal.*/ + Uchar bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ + Uchar bSourceID; /*ID of the Unit or Terminal to which this Terminal is connected */ + Uchar iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ }; /*_____ U S B F E A T U R E U N I T D E S C R I P T O R ___________________________*/ @@ -394,11 +394,11 @@ Uchar bLength; /* size of this descriptor in bytes */ Uchar bDescriptorType; /* INTERFACE descriptor type */ Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uchar bUnitID; /* Constant uniquely identifying the Unit within the audio function.*/ - Uchar bSourceID; /* Constant characterizing the type of Terminal.*/ - Uchar bControlSize; /* Size in bytes of an element of the bmaControls() array: n*/ - Uchar bmaControls[2]; /*ID of the Unit or Terminal to which this Terminal is connected */ - Uchar iFeature; /*Index of a string descriptor, describing this Feature Unit.. */ + Uchar bUnitID; /* Constant uniquely identifying the Unit within the audio function.*/ + Uchar bSourceID; /* Constant characterizing the type of Terminal.*/ + Uchar bControlSize; /* Size in bytes of an element of the bmaControls() array: n*/ + Uchar bmaControls[2]; /*ID of the Unit or Terminal to which this Terminal is connected */ + Uchar iFeature; /*Index of a string descriptor, describing this Feature Unit.. */ }; /*_____ U S B S T D AUDIO STREAM I N T E R F A C E D E S C R I P T O R _____________________*/ @@ -423,9 +423,9 @@ Uchar bLength; /* size of this descriptor in bytes */ Uchar bDescriptorType; /* INTERFACE descriptor type */ Uchar bDescriptorSubtype; /* AS_GENERAL descriptor subtype.*/ - Uchar bTerminalLink; /* The Terminal ID of the Terminal to which the endpoint of this interface is connected.*/ - Uchar bDelay; /* Delay (d) introduced by the data path */ - Uint16 wFormatTag; /* Class code assigned by the USB */ + Uchar bTerminalLink; /* The Terminal ID of the Terminal to which the endpoint of this interface is connected.*/ + Uchar bDelay; /* Delay (d) introduced by the data path */ + Uint16 wFormatTag; /* Class code assigned by the USB */ }; /*_____ U S B AUDIO ST E N D P O I N T D E S C R I P T O R _______________________*/ @@ -437,9 +437,9 @@ Uchar bEndpointAddress; /* Address of the endpoint */ Uchar bmAttributes; /* Endpoint's attributes */ Uint16 wMaxPacketSize; /* Maximum packet size for this EP */ - Uchar bInterval; /* Interval for polling EP in ms */ - Uchar bRefresh; /* Reset to 0.*/ - Uchar bSynchAddress; /* The address of the endpoint used to communicate synchronization information if required by this endpoint..*/ + Uchar bInterval; /* Interval for polling EP in ms */ + Uchar bRefresh; /* Reset to 0.*/ + Uchar bSynchAddress; /* The address of the endpoint used to communicate synchronization information if required by this endpoint..*/ }; /*_____ U S B AUDIO S T E N D P O I N T D E S C R I P T O R _______________________*/ @@ -451,7 +451,7 @@ Uchar bDescriptorSubtype; /* EP_GENERAL descriptor subtype. */ Uchar bmAttributes; /* Endpoint's attributes */ Uchar bLockDelayUnits; /*Indicates the units used for the wLockDelay field:*/ - Uint16 wLockDelay; /* Reset to 0.*/ + Uint16 wLockDelay; /* Reset to 0.*/ }; /*_____ U S B AUDIO S T E N D P O I N T D E S C R I P T O R _______________________*/ @@ -461,12 +461,12 @@ Uchar bLength; /* Size of this descriptor in bytes */ Uchar bDescriptorType; /* ENDPOINT descriptor type */ Uchar bDescriptorSubtype; /* EP_GENERAL descriptor subtype. */ - Uchar bFormatType; /* FORMAT_TYPE_I. Constant identifying the Format Type the AudioStreaming interface is using.*/ - Uchar bNrChannels; /*Indicates the number of physical channels in the audio data stream.:*/ - Uchar bSubframeSize; /* The number of bytes occupied by one audio subframe. Can be 1, 2, 3 or 4.*/ - Uchar bBitResolution; /* The number of effectively used bits from the available bits in an audio subframe.*/ - Uchar bSamFreqType; /*Indicates how the sampling frequency can be programmed */ - Uchar bSamFreqTbl[3]; /*See sampling frequency tables*/ + Uchar bFormatType; /* FORMAT_TYPE_I. Constant identifying the Format Type the AudioStreaming interface is using.*/ + Uchar bNrChannels; /*Indicates the number of physical channels in the audio data stream.:*/ + Uchar bSubframeSize; /* The number of bytes occupied by one audio subframe. Can be 1, 2, 3 or 4.*/ + Uchar bBitResolution; /* The number of effectively used bits from the available bits in an audio subframe.*/ + Uchar bSamFreqType; /*Indicates how the sampling frequency can be programmed */ + Uchar bSamFreqTbl[3]; /*See sampling frequency tables*/ }; /*_____ D E C L A R A T I O N ______________________________________________*/ Modified: firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c =================================================================== --- firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c 2008-04-30 08:19:03 UTC (rev 1034) +++ firmware/fuxusb/branches/HID/modules/usb_enum/usb_enum.c 2008-04-30 08:33:50 UTC (rev 1035) @@ -109,8 +109,8 @@ // Interface 3 :: Command / Status Interface //-------------------------------------------------------------------------- struct usb_st_interface_descriptor HIDInterfaceDescriptor; - struct usb_hid_descriptor hid; - struct usb_st_endpoint_descriptor HID_InEndpointDescriptor; + struct usb_hid_descriptor HIDStandardDescriptor; + struct usb_st_endpoint_descriptor HID_InEndpointDescriptor; struct usb_st_endpoint_descriptor HID_OutEndpointDescriptor; #ifdef TTS_INTERFACE_ENABLED @@ -592,36 +592,36 @@ // HID Report descriptor //---------------------------------------------------------------------------- // This descriptor defines the HID device. - // Size : 47 bytes - // The size of this descriptor is not considered for the global descr. size. + // Size : 47 bytes + // The size of this descriptor is not considered for the global descr. size. //-------------------------------------------------------------------------- - { // Report descriptor - 0x06, 0x00, 0xFF, // Usage page (vendor-defined) - 0x09, 0x01, // Usage (Vendor-defined) - 0xA1, 0x01, // Collection (Application) + { // Report descriptor + 0x06, 0x00, 0xFF, // Usage page (vendor-defined) + 0x09, 0x01, // Usage (Vendor-defined) + 0xA1, 0x01, // Collection (Application) - 0x09, 0x03, // Usage (vendor defined) - 0x15, 0x00, // Logical Minimum (0) - 0x26, 0xFF, 0x00, // Logical maximum (255) - 0x95, 0x40, // Report count (64) - 0x75, 0x08, // Report size (8 bits) - 0x81, 0x02, // input (data, variable, absolute) + 0x09, 0x03, // Usage (vendor defined) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical maximum (255) + 0x95, 0x40, // Report count (64) + 0x75, 0x08, // Report size (8 bits) + 0x81, 0x02, // input (data, variable, absolute) - 0x09, 0x04, // Usage (vendor defined) - 0x15, 0x00, // Logical Minimum (0) - 0x26, 0xFF, 0x00, // Logical maximum (255) - 0x95, 0x05, // Report count (5) - 0x75, 0x08, // Report size (8 bits) - 0x91, 0x02, // output (data, variable, absolute) - -// 0x09, 0x05, // Usage (vendor defined) -// 0x15, 0x00, // Logical Minimum (0) -// 0x26, 0xFF, 0x00, // Logical maximum (255) -// 0x75, 0x08, // Report size (8 bits) -// 0x95, 0x02, // Report count (2) -// 0xB1, 0x02, // feature (data, variable, absolute) - - 0xC0 // End collection + 0x09, 0x04, // Usage (vendor defined) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical maximum (255) + 0x95, 0x05, // Report count (5) + 0x75, 0x08, // Report size (8 bits) + 0x91, 0x02, // output (data, variable, absolute) +/* + 0x09, 0x05, // Usage (vendor defined) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical maximum (255) + 0x75, 0x08, // Report size (8 bits) + 0x95, 0x02, // Report count (2) + 0xB1, 0x02, // feature (data, variable, absolute) +*/ + 0xC0 // End collection } }; @@ -802,32 +802,32 @@ if (bmRequestType == 0) { usb_set_configuration(); } else { usb_hid_set_report(); } break; - /* - case CLEAR_FEATURE: // or GET_ENCPASULATED_COMMAND // - if(bmRequestType == 0xA1) { cdc_get_encapsulated_command(); } - else {usb_clear_feature();} break; - */ - /* - case SET_FEATURE: - usb_set_feature(); break; - */ - /* - case GET_STATUS: // or SEND_ENCAPSULATED_COMMAND // - if(bmRequestType == 0x21) { cdc_send_encapsulated_command(); } - else {usb_get_status();} break; - */ - case GET_INTERFACE: /* HID_SET_IDLE */ - if (bmRequestType == 0x81) { usb_get_interface(); } - else { usb_hid_set_idle(); } - break; + /* + case CLEAR_FEATURE: // or GET_ENCPASULATED_COMMAND // + if(bmRequestType == 0xA1) { cdc_get_encapsulated_command(); } + else {usb_clear_feature();} break; + */ + /* + case SET_FEATURE: + usb_set_feature(); break; + */ + /* + case GET_STATUS: // or SEND_ENCAPSULATED_COMMAND // + if(bmRequestType == 0x21) { cdc_send_encapsulated_command(); } + else {usb_get_status();} break; + */ + case GET_INTERFACE: /* HID_SET_IDLE */ + if (bmRequestType == 0x81) { usb_get_interface(); } + else { usb_hid_set_idle(); } + break; case SET_INTERFACE: usb_set_interface(); break; - /* HID Specific request */ - case HID_GET_IDLE: - usb_hid_get_idle(); break; + /* HID Specific request */ + case HID_GET_IDLE: + usb_hid_get_idle(); break; case SET_DESCRIPTOR: case SYNCH_FRAME: @@ -1153,8 +1153,8 @@ case HID: { - data_to_transfer = sizeof(usb_configuration.hid); - pbuffer = &(usb_configuration.hid.bLength); + data_to_transfer = sizeof(usb_configuration.HIDStandardDescriptor); + pbuffer = &(usb_configuration.HIDStandardDescriptor.bLength); break; } case STRING: @@ -1872,13 +1872,13 @@ *****************************************************************************/ void usb_hid_set_report (void) { - Usb_clear_rx_setup(); - - while(!Usb_rx_complete() ); - Usb_clear_rx(); - Usb_set_tx_ready(); /* send a ZLP for STATUS phase */ - while(!(Usb_tx_complete())); - Usb_clear_tx_complete(); + Usb_clear_rx_setup(); + + while(!Usb_rx_complete() ); + Usb_clear_rx(); + Usb_set_tx_ready(); /* send a ZLP for STATUS phase */ + while(!(Usb_tx_complete())); + Usb_clear_tx_complete(); } @@ -1901,13 +1901,13 @@ *****************************************************************************/ void usb_hid_set_idle (void) { - ACC = Usb_read_byte(); - hid_idle_duration = Usb_read_byte(); /* wValue contains the duration */ - Usb_clear_rx_setup(); + ACC = Usb_read_byte(); + hid_idle_duration = Usb_read_byte(); /* wValue contains the duration */ + Usb_clear_rx_setup(); - Usb_set_tx_ready(); /* send a ZLP for STATUS phase */ - while(!(Usb_tx_complete())); - Usb_clear_tx_complete(); + Usb_set_tx_ready(); /* send a ZLP for STATUS phase */ + while(!(Usb_tx_complete())); + Usb_clear_tx_complete(); } /*F************************************************************************** @@ -1928,16 +1928,16 @@ *****************************************************************************/ void usb_hid_get_idle (void) { - Usb_clear_rx_setup(); - Usb_set_DIR(); - Usb_write_byte(hid_idle_duration); - Usb_set_tx_ready(); /* send a ZLP for STATUS phase */ - while(!(Usb_tx_complete())); - Usb_clear_tx_complete(); - - while (!(Usb_rx_complete())); - Usb_clear_rx(); - Usb_clear_DIR(); + Usb_clear_rx_setup(); + Usb_set_DIR(); + Usb_write_byte(hid_idle_duration); + Usb_set_tx_ready(); /* send a ZLP for STATUS phase */ + while(!(Usb_tx_complete())); + Usb_clear_tx_complete(); + + while (!(Usb_rx_complete())); + Usb_clear_rx(); + Usb_clear_DIR(); } |