Skip to content

Commit

Permalink
Clean up hacked files
Browse files Browse the repository at this point in the history
  • Loading branch information
beserge committed Feb 16, 2024
1 parent 32eef17 commit 1924045
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ typedef struct
extern USBD_ClassTypeDef USBD_CDC;
#define USBD_CDC_CLASS &USBD_CDC

// these are used to hack in an optional MIDI mode
#define USBD_MODE_CDC 0
#define USBD_MODE_MIDI 1
extern uint8_t usbd_mode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,113 +163,11 @@ USBD_ClassTypeDef USBD_CDC =
#endif /* USE_USBD_COMPOSITE */
};

// #ifndef USE_USBD_COMPOSITE
// /* USB CDC device Configuration Descriptor */
// __ALIGN_BEGIN static uint8_t USBD_CDC_CfgDesc[USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END =
// {
// /* Configuration Descriptor */
// 0x09, /* bLength: Configuration Descriptor size */
// USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */
// USB_CDC_CONFIG_DESC_SIZ, /* wTotalLength */
// 0x00,
// 0x02, /* bNumInterfaces: 2 interfaces */
// 0x01, /* bConfigurationValue: Configuration value */
// 0x00, /* iConfiguration: Index of string descriptor
// describing the configuration */
// #if (USBD_SELF_POWERED == 1U)
// 0xC0, /* bmAttributes: Bus Powered according to user configuration */
// #else
// 0x80, /* bmAttributes: Bus Powered according to user configuration */
// #endif /* USBD_SELF_POWERED */
// USBD_MAX_POWER, /* MaxPower (mA) */

// /*---------------------------------------------------------------------------*/

// /* Interface Descriptor */
// 0x09, /* bLength: Interface Descriptor size */
// USB_DESC_TYPE_INTERFACE, /* bDescriptorType: Interface */
// /* Interface descriptor type */
// 0x00, /* bInterfaceNumber: Number of Interface */
// 0x00, /* bAlternateSetting: Alternate setting */
// 0x01, /* bNumEndpoints: One endpoint used */
// 0x02, /* bInterfaceClass: Communication Interface Class */
// 0x02, /* bInterfaceSubClass: Abstract Control Model */
// 0x01, /* bInterfaceProtocol: Common AT commands */
// 0x00, /* iInterface */

// /* Header Functional Descriptor */
// 0x05, /* bLength: Endpoint Descriptor size */
// 0x24, /* bDescriptorType: CS_INTERFACE */
// 0x00, /* bDescriptorSubtype: Header Func Desc */
// 0x10, /* bcdCDC: spec release number */
// 0x01,

// /* Call Management Functional Descriptor */
// 0x05, /* bFunctionLength */
// 0x24, /* bDescriptorType: CS_INTERFACE */
// 0x01, /* bDescriptorSubtype: Call Management Func Desc */
// 0x00, /* bmCapabilities: D0+D1 */
// 0x01, /* bDataInterface */

// /* ACM Functional Descriptor */
// 0x04, /* bFunctionLength */
// 0x24, /* bDescriptorType: CS_INTERFACE */
// 0x02, /* bDescriptorSubtype: Abstract Control Management desc */
// 0x02, /* bmCapabilities */

// /* Union Functional Descriptor */
// 0x05, /* bFunctionLength */
// 0x24, /* bDescriptorType: CS_INTERFACE */
// 0x06, /* bDescriptorSubtype: Union func desc */
// 0x00, /* bMasterInterface: Communication class interface */
// 0x01, /* bSlaveInterface0: Data Class Interface */

// /* Endpoint 2 Descriptor */
// 0x07, /* bLength: Endpoint Descriptor size */
// USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
// CDC_CMD_EP, /* bEndpointAddress */
// 0x03, /* bmAttributes: Interrupt */
// LOBYTE(CDC_CMD_PACKET_SIZE), /* wMaxPacketSize */
// HIBYTE(CDC_CMD_PACKET_SIZE),
// CDC_FS_BINTERVAL, /* bInterval */
// /*---------------------------------------------------------------------------*/

// /* Data class interface descriptor */
// 0x09, /* bLength: Endpoint Descriptor size */
// USB_DESC_TYPE_INTERFACE, /* bDescriptorType: */
// 0x01, /* bInterfaceNumber: Number of Interface */
// 0x00, /* bAlternateSetting: Alternate setting */
// 0x02, /* bNumEndpoints: Two endpoints used */
// 0x0A, /* bInterfaceClass: CDC */
// 0x00, /* bInterfaceSubClass */
// 0x00, /* bInterfaceProtocol */
// 0x00, /* iInterface */

// /* Endpoint OUT Descriptor */
// 0x07, /* bLength: Endpoint Descriptor size */
// USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
// CDC_OUT_EP, /* bEndpointAddress */
// 0x02, /* bmAttributes: Bulk */
// LOBYTE(CDC_DATA_FS_MAX_PACKET_SIZE), /* wMaxPacketSize */
// HIBYTE(CDC_DATA_FS_MAX_PACKET_SIZE),
// 0x00, /* bInterval */

// /* Endpoint IN Descriptor */
// 0x07, /* bLength: Endpoint Descriptor size */
// USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */
// CDC_IN_EP, /* bEndpointAddress */
// 0x02, /* bmAttributes: Bulk */
// LOBYTE(CDC_DATA_FS_MAX_PACKET_SIZE), /* wMaxPacketSize */
// HIBYTE(CDC_DATA_FS_MAX_PACKET_SIZE),
// 0x00 /* bInterval */
// };
// #endif /* USE_USBD_COMPOSITE */

static uint8_t CDCInEpAdd = CDC_IN_EP;
static uint8_t CDCOutEpAdd = CDC_OUT_EP;
static uint8_t CDCCmdEpAdd = CDC_CMD_EP;


// Hacked descriptors to allow either CDC or MIDI
__ALIGN_BEGIN uint8_t USBD_MIDI_CfgDesc[USB_MIDI_CONFIG_DESC_SIZ] __ALIGN_END =
{
// configuration descriptor
Expand Down Expand Up @@ -940,27 +838,6 @@ static uint8_t USBD_CDC_EP0_RxReady(USBD_HandleTypeDef *pdev)
*/
static uint8_t *USBD_CDC_GetFSCfgDesc(uint16_t *length)
{
// USBD_EpDescTypeDef *pEpCmdDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_CMD_EP);
// USBD_EpDescTypeDef *pEpOutDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_OUT_EP);
// USBD_EpDescTypeDef *pEpInDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_IN_EP);

// if (pEpCmdDesc != NULL)
// {
// pEpCmdDesc->bInterval = CDC_FS_BINTERVAL;
// }

// if (pEpOutDesc != NULL)
// {
// pEpOutDesc->wMaxPacketSize = CDC_DATA_FS_MAX_PACKET_SIZE;
// }

// if (pEpInDesc != NULL)
// {
// pEpInDesc->wMaxPacketSize = CDC_DATA_FS_MAX_PACKET_SIZE;
// }

// *length = (uint16_t)sizeof(USBD_CDC_CfgDesc);
// return USBD_CDC_CfgDesc;
switch (usbd_mode)
{
default:
Expand All @@ -987,27 +864,6 @@ static uint8_t *USBD_CDC_GetFSCfgDesc(uint16_t *length)
*/
static uint8_t *USBD_CDC_GetHSCfgDesc(uint16_t *length)
{
// USBD_EpDescTypeDef *pEpCmdDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_CMD_EP);
// USBD_EpDescTypeDef *pEpOutDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_OUT_EP);
// USBD_EpDescTypeDef *pEpInDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_IN_EP);

// if (pEpCmdDesc != NULL)
// {
// pEpCmdDesc->bInterval = CDC_HS_BINTERVAL;
// }

// if (pEpOutDesc != NULL)
// {
// pEpOutDesc->wMaxPacketSize = CDC_DATA_HS_MAX_PACKET_SIZE;
// }

// if (pEpInDesc != NULL)
// {
// pEpInDesc->wMaxPacketSize = CDC_DATA_HS_MAX_PACKET_SIZE;
// }

// *length = (uint16_t)sizeof(USBD_CDC_CfgDesc);
// return USBD_CDC_CfgDesc;
switch (usbd_mode)
{
default:
Expand All @@ -1034,27 +890,6 @@ static uint8_t *USBD_CDC_GetHSCfgDesc(uint16_t *length)
*/
static uint8_t *USBD_CDC_GetOtherSpeedCfgDesc(uint16_t *length)
{
// USBD_EpDescTypeDef *pEpCmdDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_CMD_EP);
// USBD_EpDescTypeDef *pEpOutDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_OUT_EP);
// USBD_EpDescTypeDef *pEpInDesc = USBD_GetEpDesc(USBD_CDC_CfgDesc, CDC_IN_EP);

// if (pEpCmdDesc != NULL)
// {
// pEpCmdDesc->bInterval = CDC_FS_BINTERVAL;
// }

// if (pEpOutDesc != NULL)
// {
// pEpOutDesc->wMaxPacketSize = CDC_DATA_FS_MAX_PACKET_SIZE;
// }

// if (pEpInDesc != NULL)
// {
// pEpInDesc->wMaxPacketSize = CDC_DATA_FS_MAX_PACKET_SIZE;
// }

// *length = (uint16_t)sizeof(USBD_CDC_CfgDesc);
// return USBD_CDC_CfgDesc;
switch (usbd_mode)
{
default:
Expand Down

0 comments on commit 1924045

Please sign in to comment.