aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/usb/usb_cdcacm.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-08-10 15:45:30 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-10-18 13:30:18 -0400
commit00c5efa7b637ee6ef1878eb870eff140f2af94a8 (patch)
tree827e4de89378c9ec1565d55a985b546a9a670e74 /libmaple/usb/usb_cdcacm.c
parentbbcbf65fd7d074268f4e25ae014965bceb995b79 (diff)
downloadlibrambutan-00c5efa7b637ee6ef1878eb870eff140f2af94a8.tar.gz
librambutan-00c5efa7b637ee6ef1878eb870eff140f2af94a8.zip
Remove usb_config.h.
Move its defines into usb_cdcacm.c and usb.[hc] as appropriate. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/usb/usb_cdcacm.c')
-rw-r--r--libmaple/usb/usb_cdcacm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libmaple/usb/usb_cdcacm.c b/libmaple/usb/usb_cdcacm.c
index 1a3b4e6..bf73c68 100644
--- a/libmaple/usb/usb_cdcacm.c
+++ b/libmaple/usb/usb_cdcacm.c
@@ -36,7 +36,6 @@
#include "nvic.h"
#include "usb.h"
-#include "usb_config.h"
#include "descriptors.h"
#include "usb_lib_globals.h"
#include "usb_reg_map.h"
@@ -136,6 +135,7 @@ const USB_Descriptor_Device usbVcomDescriptor_Device = {
.bNumConfigurations = 0x01,
};
+#define MAX_POWER (100 >> 1)
const USB_Descriptor_Config usbVcomDescriptor_Config = {
.Config_Header = {
.bLength = sizeof(USB_Descriptor_Config_Header),
@@ -146,7 +146,7 @@ const USB_Descriptor_Config usbVcomDescriptor_Config = {
.iConfiguration = 0x00,
.bmAttributes = (USB_CONFIG_ATTR_BUSPOWERED |
USB_CONFIG_ATTR_SELF_POWERED),
- .bMaxPower = USB_CONFIG_MAX_POWER,
+ .bMaxPower = MAX_POWER,
},
.CCI_Interface = {
@@ -402,13 +402,15 @@ void usbInit(void) {
usbPowerOn();
USB_BASE->ISTR = 0;
- wInterrupt_Mask = ISR_MSK;
+ wInterrupt_Mask = USB_ISR_MSK;
USB_BASE->CNTR = wInterrupt_Mask;
nvic_irq_enable(NVIC_USB_LP_CAN_RX0);
bDeviceState = UNCONNECTED;
}
+/* choose addresses to give endpoints the max 64 byte buffers */
+#define BTABLE_ADDRESS 0x00
void usbReset(void) {
pInformation->Current_Configuration = 0;
@@ -416,7 +418,7 @@ void usbReset(void) {
pInformation->Current_Feature = (USB_CONFIG_ATTR_BUSPOWERED |
USB_CONFIG_ATTR_SELF_POWERED);
- USB_BASE->BTABLE = USB_BTABLE_ADDRESS;
+ USB_BASE->BTABLE = BTABLE_ADDRESS;
/* setup control endpoint 0 */
usb_set_ep_type(USB_EP0, USB_EP_EP_TYPE_CONTROL);
@@ -595,10 +597,12 @@ void usbSetDeviceAddress(void) {
* Globals required by usb_lib/
*/
+#define NUM_ENDPTS 0x04
DEVICE Device_Table =
{NUM_ENDPTS,
1};
+#define MAX_PACKET_SIZE 0x40 /* 64B, maximum for USB FS Devices */
DEVICE_PROP Device_Property =
{usbInit,
usbReset,
@@ -611,7 +615,7 @@ DEVICE_PROP Device_Property =
usbGetConfigDescriptor,
usbGetStringDescriptor,
0,
- bMaxPacketSize};
+ MAX_PACKET_SIZE};
USER_STANDARD_REQUESTS User_Standard_Requests =
{NOP_Process,