aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/usb/descriptors.c10
-rw-r--r--core/usb/descriptors.h17
-rw-r--r--core/usb/usb_config.h30
3 files changed, 50 insertions, 7 deletions
diff --git a/core/usb/descriptors.c b/core/usb/descriptors.c
index 522b8d6..bfcd085 100644
--- a/core/usb/descriptors.c
+++ b/core/usb/descriptors.c
@@ -14,8 +14,8 @@ USB_Descriptor_Device usbVcomDescriptor_Device = {
idVendor: VCOM_ID_VENDOR,
idProduct: VCOM_ID_PRODUCT,
bcdDevice: 0x0200,
- iManufacturer: 0x00,
- iProduct: 0x00,
+ iManufacturer: 0x01,
+ iProduct: 0x02,
iSerialNumber: 0x00,
bNumConfigurations: 0x01
};
@@ -30,7 +30,7 @@ USB_Descriptor_Configuration usbVcomDescriptor_Config = {
bConfigurationValue: 0x01,
iConfiguration: 0x00,
bmAttributes: (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATT_SELF_POWERED),
- bMaxPower: USB_CONFIG_POWER_MA(100)
+ bMaxPower: USB_CONFIG_MAX_POWER
},
CCI_Interface:
@@ -82,9 +82,9 @@ USB_Descriptor_Configuration usbVcomDescriptor_Config = {
{
bLength: sizeof(USB_Descriptor_Endpoint),
bDescriptorType: USB_DESCRIPTOR_TYPE_ENDPOINT,
- bEndpointAddress: CDC_NOTIFICATION_EPNUM,
+ bEndpointAddress: VCOM_NOTIFICATION_EPNUM,
bmAttributes: EP_TYPE_INTERRUPT,
- wMaxPacketSize: CDC_NOTIFICATION_EPSIZE,
+ wMaxPacketSize: VCOM_NOTIFICATION_EPSIZE,
bInterval: 0xFF
},
diff --git a/core/usb/descriptors.h b/core/usb/descriptors.h
index 1beabcc..d1918e3 100644
--- a/core/usb/descriptors.h
+++ b/core/usb/descriptors.h
@@ -4,11 +4,26 @@
#include "usb_lib.h"
+#include "config.h"
#if defined(__cplusplus)
extern "C" {
#endif
+#define USB_DESCRIPTOR_TYPE_DEVICE 0x01
+#define USB_DESCRIPTOR_TYPE_CONFIGURATION 0x02
+#define USB_DESCRIPTOR_TYPE_STRING 0x03
+#define USB_DESCRIPTOR_TYPE_INTERFACE 0x04
+#define USB_DESCRIPTOR_TYPE_ENDPOINT 0x05
+
+#define USB_CONFIG_ATTR_BUSPOWERED 0b10000000
+#define USB_CONFIG_ATTR_SELFPOWERED 0b11000000
+
+#define EP_TYPE_INTERRUPT 0x03
+#define EP_TYPE_BULK 0x02
+
+#define USB_DESCRIPTOR_STRING_LEN(x) (2 + (x << 1))
+
#define CDC_FUCNTIONAL_DESCRIPTOR(DataSize) \
struct \
{ \
@@ -18,8 +33,6 @@
uint8 Data[DataSize]; \
}
-#define USB_DESCRIPTOR_STRING_LEN(x) (2 + (x << 1))
-
typedef struct {
uint8 bLength;
uint8 bDescriptorType;
diff --git a/core/usb/usb_config.h b/core/usb/usb_config.h
new file mode 100644
index 0000000..bf5f4ff
--- /dev/null
+++ b/core/usb/usb_config.h
@@ -0,0 +1,30 @@
+/* insert license */
+
+#ifndef __USB_CONFIG_H
+#define __USB_CONFIG_H
+
+#define VCOM_ID_VENDOR 0x0110
+#define VCOM_ID_PRODUCT 0x1003
+
+#define USB_CONFIG_MAX_POWER (100 >> 1)
+
+/* choose addresses to give endpoints the max 64 byte buffers */
+#define USB_BTABLE_ADDRESS 0x00
+#define VCOM_CTRL_EPNUM 0x00
+#define VCOM_CTRL_RX_ADDR 0x40
+#define VCOM_CTRL_TX_ADDR 0x80
+#define VCOM_CTRL_EPSIZE 0x40
+
+#define VCOM_NOTIFICATION_EPNUM 0x01
+#define VCOM_NOTIFICATION_ADDR 0xC0
+#define VCOM_NOTIFICATION_EPSIZE 0x40
+
+#define VCOM_TX_EPNUM 0x02
+#define VCOM_TX_ADDR 0x100
+#define VCOM_TX_SIZE 0x040
+
+#define VCOM_RX_EPNUM 0x03
+#define VCOM_RX_ADDR 0x140
+#define VCOM_RX_EPSIZE 0x40
+
+#endif