aboutsummaryrefslogtreecommitdiff
path: root/bootloaders/diskloader/src
diff options
context:
space:
mode:
Diffstat (limited to 'bootloaders/diskloader/src')
-rw-r--r--bootloaders/diskloader/src/Platform.h5
-rw-r--r--bootloaders/diskloader/src/USBCore.cpp10
-rw-r--r--bootloaders/diskloader/src/USBDesc.cpp12
-rw-r--r--bootloaders/diskloader/src/USBDesc.h43
4 files changed, 32 insertions, 38 deletions
diff --git a/bootloaders/diskloader/src/Platform.h b/bootloaders/diskloader/src/Platform.h
index 04c5b79..fcce0a1 100644
--- a/bootloaders/diskloader/src/Platform.h
+++ b/bootloaders/diskloader/src/Platform.h
@@ -43,7 +43,10 @@ void Transfer(u8 ep, const u8* data, int len);
void Recv(u8 ep, u8* dst, u8 len);
void Program(u8 ep, u16 page, u8 count);
-#define CDC_ENABLED
+/* HID is not fully-supported in the bootloader - can be enabled
+ for testing, but note the descriptor report and other parts are
+ not complete */
+//#define HID_ENABLED
#include "USBCore.h"
#include "USBDesc.h"
diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp
index a234596..64f5852 100644
--- a/bootloaders/diskloader/src/USBCore.cpp
+++ b/bootloaders/diskloader/src/USBCore.cpp
@@ -255,13 +255,13 @@ const u8 _initEndpoints[] =
{
0,
-#ifdef CDC_ENABLED
EP_TYPE_INTERRUPT_IN, // CDC_ENDPOINT_ACM
EP_TYPE_BULK_OUT, // CDC_ENDPOINT_OUT
EP_TYPE_BULK_IN, // CDC_ENDPOINT_IN
-#endif
+#ifdef HID_ENABLED
EP_TYPE_INTERRUPT_IN, // HID_ENDPOINT_INT
+#endif
};
static void InitEndpoints()
@@ -357,13 +357,13 @@ bool SendDescriptor()
u8 t = setup.wValueH;
if (0x22 == t)
{
+#ifdef HID_ENABLED
desc_addr = _rawHID;
desc_length = sizeof(desc_length);
+#endif
} else if (USB_DEVICE_DESCRIPTOR_TYPE == t)
{
- if (setup.wLength == 8)
- _cdcComposite = 1;
- desc_addr = _cdcComposite ? (const u8*)&USB_DeviceDescriptorA : (const u8*)&USB_DeviceDescriptor;
+ desc_addr = (const u8*)&USB_DeviceDescriptor;
}
else if (USB_CONFIGURATION_DESCRIPTOR_TYPE == t)
{
diff --git a/bootloaders/diskloader/src/USBDesc.cpp b/bootloaders/diskloader/src/USBDesc.cpp
index ade072a..b143687 100644
--- a/bootloaders/diskloader/src/USBDesc.cpp
+++ b/bootloaders/diskloader/src/USBDesc.cpp
@@ -47,18 +47,12 @@ const u16 STRING_IMANUFACTURER[12] = {
};
-//#ifdef CDC_ENABLED
-DeviceDescriptor USB_DeviceDescriptorA = D_DEVICE(0X02,0X00,0X00,64,USB_VID,USB_PID,0x100,0,IPRODUCT,ISERIAL,1);
-//#else
-DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,0,IPRODUCT,ISERIAL,1);
-//#endif
-
+DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0X02,0X00,0X00,64,USB_VID,USB_PID,0x100,0,IPRODUCT,ISERIAL,1);
Config USB_ConfigDescriptor =
{
D_CONFIG(sizeof(Config),INTERFACE_COUNT),
-#ifdef CDC_ENABLED
// CDC
{
D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1),
@@ -76,12 +70,14 @@ Config USB_ConfigDescriptor =
D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,0x40,0),
D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,0x40,0)
},
-#endif
+
+#ifdef HID_ENABLED
// HID
{
D_INTERFACE(HID_INTERFACE,1,3,0,0),
D_HIDREPORT(30),
D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x40)
}
+#endif
};
diff --git a/bootloaders/diskloader/src/USBDesc.h b/bootloaders/diskloader/src/USBDesc.h
index a970fa4..3a7fc55 100644
--- a/bootloaders/diskloader/src/USBDesc.h
+++ b/bootloaders/diskloader/src/USBDesc.h
@@ -16,36 +16,31 @@
** SOFTWARE.
*/
-
-#ifdef CDC_ENABLED
-
-#define CDC_ACM_INTERFACE 0 // CDC ACM
-#define CDC_DATA_INTERFACE 1 // CDC Data
-#define CDC_ENDPOINT_ACM 1
-#define CDC_ENDPOINT_OUT 2
-#define CDC_ENDPOINT_IN 3
-
-#define HID_INTERFACE 2 // HID Interface
-#define HID_ENDPOINT_INT 4
-
-#define INTERFACE_COUNT 3 // 2 for cdc + 1 for hid
-
-#else
-
-#define HID_INTERFACE 2 // HID Interface
-#define HID_ENDPOINT_INT 4
-
-#define INTERFACE_COUNT 1 // 1 for hid
-
-#endif
+#ifndef HID_ENABLED // HID is NOT enabled
+ #define CDC_ACM_INTERFACE 0 // CDC ACM
+ #define CDC_DATA_INTERFACE 1 // CDC Data
+ #define CDC_ENDPOINT_ACM 1
+ #define CDC_ENDPOINT_OUT 2
+ #define CDC_ENDPOINT_IN 3
+ #define INTERFACE_COUNT 2 // 2 for CDC
+#else // HID is enabled
+ #define CDC_ACM_INTERFACE 0 // CDC ACM
+ #define CDC_DATA_INTERFACE 1 // CDC Data
+ #define CDC_ENDPOINT_ACM 1
+ #define CDC_ENDPOINT_OUT 2
+ #define CDC_ENDPOINT_IN 3
+ #define HID_INTERFACE 2 // HID Interface
+ #define HID_ENDPOINT_INT 4
+ #define INTERFACE_COUNT 3 // 2 for CDC + 1 for hid
+#endif
typedef struct
{
ConfigDescriptor config;
-#ifdef CDC_ENABLED
CDCDescriptor cdc;
-#endif
+#ifdef HID_ENABLED
HIDDescriptor hid;
+#endif
} Config;
extern Config USB_ConfigDescriptor PROGMEM;