Code cleanup

master
Wolfgang Denk 18 years ago
parent 007d67da94
commit 386eda0224
  1. 4
      CHANGELOG
  2. 22
      README
  3. 8
      drivers/usbdcore_ep0.c
  4. 1124
      drivers/usbdcore_mpc8xx.c
  5. 4
      drivers/usbdcore_omap1510.c
  6. 164
      drivers/usbtty.c
  7. 4
      drivers/usbtty.h
  8. 2
      include/asm-arm/arch-pxa/pxa-regs.h
  9. 8
      include/configs/AdderUSB.h
  10. 2
      include/usb_cdc_acm.h
  11. 14
      include/usbdcore_mpc8xx.h
  12. 2
      include/usbdescriptors.h

@ -2,7 +2,9 @@
Changes since U-Boot 1.1.4: Changes since U-Boot 1.1.4:
====================================================================== ======================================================================
* Various USB related patches * Code cleanup
* Various USB related patches
- Add support for mpc8xx USB device. - Add support for mpc8xx USB device.
- Add support for Common Device Class - Abstract Control Model USB console. - Add support for Common Device Class - Abstract Control Model USB console.
- Add support for flow control in USB slave devices. - Add support for flow control in USB slave devices.

@ -870,7 +870,7 @@ The following options need to be configured:
attach your usb cable. The Unix command "dmesg" should print attach your usb cable. The Unix command "dmesg" should print
it has found a new device. The environment variable usbtty it has found a new device. The environment variable usbtty
can be set to gserial or cdc_acm to enable your device to can be set to gserial or cdc_acm to enable your device to
appear to a USB host as a Linux gserial device or a appear to a USB host as a Linux gserial device or a
Common Device Class Abstract Control Model serial device. Common Device Class Abstract Control Model serial device.
If you select usbtty = gserial you should be able to enumerate If you select usbtty = gserial you should be able to enumerate
a Linux host by a Linux host by
@ -878,14 +878,14 @@ The following options need to be configured:
else if using cdc_acm, simply setting the environment else if using cdc_acm, simply setting the environment
variable usbtty to be cdc_acm should suffice. The following variable usbtty to be cdc_acm should suffice. The following
might be defined in YourBoardName.h might be defined in YourBoardName.h
CONFIG_USB_DEVICE CONFIG_USB_DEVICE
Define this to build a UDC device Define this to build a UDC device
CONFIG_USB_TTY CONFIG_USB_TTY
Define this to have a tty type of device available to Define this to have a tty type of device available to
talk to the UDC device talk to the UDC device
CFG_CONSOLE_IS_IN_ENV CFG_CONSOLE_IS_IN_ENV
Define this if you want stdin, stdout &/or stderr to Define this if you want stdin, stdout &/or stderr to
be set to usbtty. be set to usbtty.
@ -893,15 +893,15 @@ The following options need to be configured:
mpc8xx: mpc8xx:
CFG_USB_EXTC_CLK 0xBLAH CFG_USB_EXTC_CLK 0xBLAH
Derive USB clock from external clock "blah" Derive USB clock from external clock "blah"
- CFG_USB_EXTC_CLK 0x02 - CFG_USB_EXTC_CLK 0x02
CFG_USB_BRG_CLK 0xBLAH CFG_USB_BRG_CLK 0xBLAH
Derive USB clock from brgclk Derive USB clock from brgclk
- CFG_USB_BRG_CLK 0x04 - CFG_USB_BRG_CLK 0x04
If you have a USB-IF assigned VendorID then you may wish to If you have a USB-IF assigned VendorID then you may wish to
define your own vendor specific values either in BoardName.h define your own vendor specific values either in BoardName.h
or directly in usbd_vendor_info.h. If you don't define or directly in usbd_vendor_info.h. If you don't define
CONFIG_USBD_MANUFACTURER, CONFIG_USBD_PRODUCT_NAME, CONFIG_USBD_MANUFACTURER, CONFIG_USBD_PRODUCT_NAME,
CONFIG_USBD_VENDORID and CONFIG_USBD_PRODUCTID, then U-Boot CONFIG_USBD_VENDORID and CONFIG_USBD_PRODUCTID, then U-Boot
should pretend to be a Linux device to it's target host. should pretend to be a Linux device to it's target host.
@ -909,7 +909,7 @@ The following options need to be configured:
CONFIG_USBD_MANUFACTURER CONFIG_USBD_MANUFACTURER
Define this string as the name of your company for Define this string as the name of your company for
- CONFIG_USBD_MANUFACTURER "my company" - CONFIG_USBD_MANUFACTURER "my company"
CONFIG_USBD_PRODUCT_NAME CONFIG_USBD_PRODUCT_NAME
Define this string as the name of your product Define this string as the name of your product
- CONFIG_USBD_PRODUCT_NAME "acme usb device" - CONFIG_USBD_PRODUCT_NAME "acme usb device"
@ -919,13 +919,13 @@ The following options need to be configured:
Implementors Forum. This *must* be a genuine Vendor ID Implementors Forum. This *must* be a genuine Vendor ID
to avoid polluting the USB namespace. to avoid polluting the USB namespace.
- CONFIG_USBD_VENDORID 0xFFFF - CONFIG_USBD_VENDORID 0xFFFF
CONFIG_USBD_PRODUCTID CONFIG_USBD_PRODUCTID
Define this as the unique Product ID Define this as the unique Product ID
for your device for your device
- CONFIG_USBD_PRODUCTID 0xFFFF - CONFIG_USBD_PRODUCTID 0xFFFF
- MMC Support: - MMC Support:
The MMC controller on the Intel PXA is supported. To The MMC controller on the Intel PXA is supported. To
enable this define CONFIG_MMC. The MMC can be enable this define CONFIG_MMC. The MMC can be

@ -44,7 +44,7 @@
* XXX * XXX
* *
* As alluded to above, a simple callback cdc_recv_setup has been implemented * As alluded to above, a simple callback cdc_recv_setup has been implemented
* in the usb_device data structure to facilicate passing * in the usb_device data structure to facilicate passing
* Common Device Class packets to a function driver. * Common Device Class packets to a function driver.
* *
* XXX * XXX
@ -221,7 +221,7 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
(struct usb_device_descriptor *) urb->buffer; (struct usb_device_descriptor *) urb->buffer;
} }
dbg_ep0(3, "copied device configuration, actual_length: 0x%x", urb->actual_length); dbg_ep0(3, "copied device configuration, actual_length: 0x%x", urb->actual_length);
break; break;
case USB_DESCRIPTOR_TYPE_CONFIGURATION: case USB_DESCRIPTOR_TYPE_CONFIGURATION:
@ -268,7 +268,7 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
serial_printf("Invalid string index %d\n", index); serial_printf("Invalid string index %d\n", index);
return -1; return -1;
} }
dbg_ep0(3, "string_descriptor: %p length %d", string_descriptor, string_descriptor->bLength); dbg_ep0(3, "string_descriptor: %p length %d", string_descriptor, string_descriptor->bLength);
copy_config (urb, string_descriptor, string_descriptor->bLength, max); copy_config (urb, string_descriptor, string_descriptor->bLength, max);
} }
break; break;
@ -344,7 +344,7 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
case USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER: case USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER:
{ {
/* If a USB device supports both a full speed and low speed operation /* If a USB device supports both a full speed and low speed operation
* we must send a Device_Qualifier descriptor here * we must send a Device_Qualifier descriptor here
*/ */
return -1; return -1;
} }

File diff suppressed because it is too large Load Diff

@ -645,7 +645,7 @@ static void omap1510_udc_state_changed (void)
static void omap1510_udc_setup (struct usb_endpoint_instance *endpoint) static void omap1510_udc_setup (struct usb_endpoint_instance *endpoint)
{ {
UDCDBG ("-> Entering device setup"); UDCDBG ("-> Entering device setup");
do { do {
const int setup_pktsize = 8; const int setup_pktsize = 8;
unsigned char *datap = unsigned char *datap =
@ -1518,7 +1518,7 @@ void udc_startup_events (struct usb_device_instance *device)
} }
/** /**
* udc_irq - do pseudo interrupts * udc_irq - do pseudo interrupts
*/ */
void udc_irq(void) void udc_irq(void)
{ {

@ -1,7 +1,7 @@
/* /*
* (C) Copyright 2003 * (C) Copyright 2003
* Gerry Hamel, geh@ti.com, Texas Instruments * Gerry Hamel, geh@ti.com, Texas Instruments
* *
* (C) Copyright 2006 * (C) Copyright 2006
* Bryan O'Donoghue, bodonoghue@codehermit.ie * Bryan O'Donoghue, bodonoghue@codehermit.ie
* *
@ -31,7 +31,7 @@
#include "usb_cdc_acm.h" #include "usb_cdc_acm.h"
#include "usbdescriptors.h" #include "usbdescriptors.h"
#include <config.h> /* If defined, override Linux identifiers with #include <config.h> /* If defined, override Linux identifiers with
* vendor specific ones */ * vendor specific ones */
#if 0 #if 0
#define TTYDBG(fmt,args...)\ #define TTYDBG(fmt,args...)\
@ -142,10 +142,10 @@ static struct usb_device_descriptor device_descriptor = {
struct acm_config_desc { struct acm_config_desc {
struct usb_configuration_descriptor configuration_desc; struct usb_configuration_descriptor configuration_desc;
/* Master Interface */ /* Master Interface */
struct usb_interface_descriptor interface_desc; struct usb_interface_descriptor interface_desc;
struct usb_class_header_function_descriptor usb_class_header; struct usb_class_header_function_descriptor usb_class_header;
struct usb_class_call_management_descriptor usb_class_call_mgt; struct usb_class_call_management_descriptor usb_class_call_mgt;
struct usb_class_abstract_control_descriptor usb_class_acm; struct usb_class_abstract_control_descriptor usb_class_acm;
@ -154,22 +154,22 @@ struct acm_config_desc {
/* Slave Interface */ /* Slave Interface */
struct usb_interface_descriptor data_class_interface; struct usb_interface_descriptor data_class_interface;
struct usb_endpoint_descriptor struct usb_endpoint_descriptor
data_endpoints[NUM_ENDPOINTS-1] __attribute__((packed)); data_endpoints[NUM_ENDPOINTS-1] __attribute__((packed));
} __attribute__((packed)); } __attribute__((packed));
static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = { static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = {
{ {
.configuration_desc ={ .configuration_desc ={
.bLength = .bLength =
sizeof(struct usb_configuration_descriptor), sizeof(struct usb_configuration_descriptor),
.bDescriptorType = USB_DT_CONFIG, .bDescriptorType = USB_DT_CONFIG,
.wTotalLength = .wTotalLength =
cpu_to_le16(sizeof(struct acm_config_desc)), cpu_to_le16(sizeof(struct acm_config_desc)),
.bNumInterfaces = NUM_ACM_INTERFACES, .bNumInterfaces = NUM_ACM_INTERFACES,
.bConfigurationValue = 1, .bConfigurationValue = 1,
.iConfiguration = STR_CONFIG, .iConfiguration = STR_CONFIG,
.bmAttributes = .bmAttributes =
BMATTRIBUTE_SELF_POWERED|BMATTRIBUTE_RESERVED, BMATTRIBUTE_SELF_POWERED|BMATTRIBUTE_RESERVED,
.bMaxPower = USBTTY_MAXPOWER .bMaxPower = USBTTY_MAXPOWER
}, },
@ -180,62 +180,62 @@ static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = {
.bInterfaceNumber = 0, .bInterfaceNumber = 0,
.bAlternateSetting = 0, .bAlternateSetting = 0,
.bNumEndpoints = 0x01, .bNumEndpoints = 0x01,
.bInterfaceClass = .bInterfaceClass =
COMMUNICATIONS_INTERFACE_CLASS_CONTROL, COMMUNICATIONS_INTERFACE_CLASS_CONTROL,
.bInterfaceSubClass = COMMUNICATIONS_ACM_SUBCLASS, .bInterfaceSubClass = COMMUNICATIONS_ACM_SUBCLASS,
.bInterfaceProtocol = COMMUNICATIONS_V25TER_PROTOCOL, .bInterfaceProtocol = COMMUNICATIONS_V25TER_PROTOCOL,
.iInterface = STR_CTRL_INTERFACE, .iInterface = STR_CTRL_INTERFACE,
}, },
.usb_class_header = { .usb_class_header = {
.bFunctionLength = .bFunctionLength =
sizeof(struct usb_class_header_function_descriptor), sizeof(struct usb_class_header_function_descriptor),
.bDescriptorType = CS_INTERFACE, .bDescriptorType = CS_INTERFACE,
.bDescriptorSubtype = USB_ST_HEADER, .bDescriptorSubtype = USB_ST_HEADER,
.bcdCDC = cpu_to_le16(110), .bcdCDC = cpu_to_le16(110),
}, },
.usb_class_call_mgt = { .usb_class_call_mgt = {
.bFunctionLength = .bFunctionLength =
sizeof(struct usb_class_call_management_descriptor), sizeof(struct usb_class_call_management_descriptor),
.bDescriptorType = CS_INTERFACE, .bDescriptorType = CS_INTERFACE,
.bDescriptorSubtype = USB_ST_CMF, .bDescriptorSubtype = USB_ST_CMF,
.bmCapabilities = 0x00, .bmCapabilities = 0x00,
.bDataInterface = 0x01, .bDataInterface = 0x01,
}, },
.usb_class_acm = { .usb_class_acm = {
.bFunctionLength = .bFunctionLength =
sizeof(struct usb_class_abstract_control_descriptor), sizeof(struct usb_class_abstract_control_descriptor),
.bDescriptorType = CS_INTERFACE, .bDescriptorType = CS_INTERFACE,
.bDescriptorSubtype = USB_ST_ACMF, .bDescriptorSubtype = USB_ST_ACMF,
.bmCapabilities = 0x00, .bmCapabilities = 0x00,
}, },
.usb_class_union = { .usb_class_union = {
.bFunctionLength = .bFunctionLength =
sizeof(struct usb_class_union_function_descriptor), sizeof(struct usb_class_union_function_descriptor),
.bDescriptorType = CS_INTERFACE, .bDescriptorType = CS_INTERFACE,
.bDescriptorSubtype = USB_ST_UF, .bDescriptorSubtype = USB_ST_UF,
.bMasterInterface = 0x00, .bMasterInterface = 0x00,
.bSlaveInterface0 = 0x01, .bSlaveInterface0 = 0x01,
}, },
.notification_endpoint = { .notification_endpoint = {
.bLength = .bLength =
sizeof(struct usb_endpoint_descriptor), sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT, .bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x01 | USB_DIR_IN, .bEndpointAddress = 0x01 | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT, .bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize .wMaxPacketSize
= cpu_to_le16(CONFIG_USBD_SERIAL_INT_PKTSIZE), = cpu_to_le16(CONFIG_USBD_SERIAL_INT_PKTSIZE),
.bInterval = 0xFF, .bInterval = 0xFF,
}, },
/* Interface 2 */ /* Interface 2 */
.data_class_interface = { .data_class_interface = {
.bLength = .bLength =
sizeof(struct usb_interface_descriptor), sizeof(struct usb_interface_descriptor),
.bDescriptorType = USB_DT_INTERFACE, .bDescriptorType = USB_DT_INTERFACE,
.bInterfaceNumber = 0x01, .bInterfaceNumber = 0x01,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 0x02, .bNumEndpoints = 0x02,
.bInterfaceClass = .bInterfaceClass =
COMMUNICATIONS_INTERFACE_CLASS_DATA, COMMUNICATIONS_INTERFACE_CLASS_DATA,
.bInterfaceSubClass = DATA_INTERFACE_SUBCLASS_NONE, .bInterfaceSubClass = DATA_INTERFACE_SUBCLASS_NONE,
.bInterfaceProtocol = DATA_INTERFACE_PROTOCOL_NONE, .bInterfaceProtocol = DATA_INTERFACE_PROTOCOL_NONE,
@ -243,30 +243,30 @@ static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = {
}, },
.data_endpoints = { .data_endpoints = {
{ {
.bLength = .bLength =
sizeof(struct usb_endpoint_descriptor), sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT, .bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x02 | USB_DIR_OUT, .bEndpointAddress = 0x02 | USB_DIR_OUT,
.bmAttributes = .bmAttributes =
USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = .wMaxPacketSize =
cpu_to_le16(CONFIG_USBD_SERIAL_BULK_PKTSIZE), cpu_to_le16(CONFIG_USBD_SERIAL_BULK_PKTSIZE),
.bInterval = 0xFF, .bInterval = 0xFF,
}, },
{ {
.bLength = .bLength =
sizeof(struct usb_endpoint_descriptor), sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT, .bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x03 | USB_DIR_IN, .bEndpointAddress = 0x03 | USB_DIR_IN,
.bmAttributes = .bmAttributes =
USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = .wMaxPacketSize =
cpu_to_le16(CONFIG_USBD_SERIAL_BULK_PKTSIZE), cpu_to_le16(CONFIG_USBD_SERIAL_BULK_PKTSIZE),
.bInterval = 0xFF, .bInterval = 0xFF,
}, },
}, },
}, },
}; };
static struct rs232_emu rs232_desc={ static struct rs232_emu rs232_desc={
.dter = 115200, .dter = 115200,
@ -282,75 +282,75 @@ static struct rs232_emu rs232_desc={
struct gserial_config_desc { struct gserial_config_desc {
struct usb_configuration_descriptor configuration_desc; struct usb_configuration_descriptor configuration_desc;
struct usb_interface_descriptor struct usb_interface_descriptor
interface_desc[NUM_GSERIAL_INTERFACES] __attribute__((packed)); interface_desc[NUM_GSERIAL_INTERFACES] __attribute__((packed));
struct usb_endpoint_descriptor struct usb_endpoint_descriptor
data_endpoints[NUM_ENDPOINTS] __attribute__((packed)); data_endpoints[NUM_ENDPOINTS] __attribute__((packed));
} __attribute__((packed)); } __attribute__((packed));
static struct gserial_config_desc static struct gserial_config_desc
gserial_configuration_descriptors[NUM_CONFIGS] ={ gserial_configuration_descriptors[NUM_CONFIGS] ={
{ {
.configuration_desc ={ .configuration_desc ={
.bLength = sizeof(struct usb_configuration_descriptor), .bLength = sizeof(struct usb_configuration_descriptor),
.bDescriptorType = USB_DT_CONFIG, .bDescriptorType = USB_DT_CONFIG,
.wTotalLength = .wTotalLength =
cpu_to_le16(sizeof(struct gserial_config_desc)), cpu_to_le16(sizeof(struct gserial_config_desc)),
.bNumInterfaces = NUM_GSERIAL_INTERFACES, .bNumInterfaces = NUM_GSERIAL_INTERFACES,
.bConfigurationValue = 1, .bConfigurationValue = 1,
.iConfiguration = STR_CONFIG, .iConfiguration = STR_CONFIG,
.bmAttributes = .bmAttributes =
BMATTRIBUTE_SELF_POWERED|BMATTRIBUTE_RESERVED, BMATTRIBUTE_SELF_POWERED|BMATTRIBUTE_RESERVED,
.bMaxPower = USBTTY_MAXPOWER .bMaxPower = USBTTY_MAXPOWER
}, },
.interface_desc = { .interface_desc = {
{ {
.bLength = .bLength =
sizeof(struct usb_interface_descriptor), sizeof(struct usb_interface_descriptor),
.bDescriptorType = USB_DT_INTERFACE, .bDescriptorType = USB_DT_INTERFACE,
.bInterfaceNumber = 0, .bInterfaceNumber = 0,
.bAlternateSetting = 0, .bAlternateSetting = 0,
.bNumEndpoints = NUM_ENDPOINTS, .bNumEndpoints = NUM_ENDPOINTS,
.bInterfaceClass = .bInterfaceClass =
COMMUNICATIONS_INTERFACE_CLASS_VENDOR, COMMUNICATIONS_INTERFACE_CLASS_VENDOR,
.bInterfaceSubClass = .bInterfaceSubClass =
COMMUNICATIONS_NO_SUBCLASS, COMMUNICATIONS_NO_SUBCLASS,
.bInterfaceProtocol = .bInterfaceProtocol =
COMMUNICATIONS_NO_PROTOCOL, COMMUNICATIONS_NO_PROTOCOL,
.iInterface = STR_DATA_INTERFACE .iInterface = STR_DATA_INTERFACE
}, },
}, },
.data_endpoints = { .data_endpoints = {
{ {
.bLength = .bLength =
sizeof(struct usb_endpoint_descriptor), sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT, .bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x01 | USB_DIR_OUT, .bEndpointAddress = 0x01 | USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK, .bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = .wMaxPacketSize =
cpu_to_le16(CONFIG_USBD_SERIAL_OUT_PKTSIZE), cpu_to_le16(CONFIG_USBD_SERIAL_OUT_PKTSIZE),
.bInterval= 0xFF, .bInterval= 0xFF,
}, },
{ {
.bLength = .bLength =
sizeof(struct usb_endpoint_descriptor), sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT, .bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x02 | USB_DIR_IN, .bEndpointAddress = 0x02 | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK, .bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = .wMaxPacketSize =
cpu_to_le16(CONFIG_USBD_SERIAL_IN_PKTSIZE), cpu_to_le16(CONFIG_USBD_SERIAL_IN_PKTSIZE),
.bInterval = 0xFF, .bInterval = 0xFF,
}, },
{ {
.bLength = .bLength =
sizeof(struct usb_endpoint_descriptor), sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT, .bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x03 | USB_DIR_IN, .bEndpointAddress = 0x03 | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT, .bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = .wMaxPacketSize =
cpu_to_le16(CONFIG_USBD_SERIAL_INT_PKTSIZE), cpu_to_le16(CONFIG_USBD_SERIAL_INT_PKTSIZE),
.bInterval = 0xFF, .bInterval = 0xFF,
}, },
@ -368,7 +368,7 @@ static void usbtty_init_endpoints (void);
static void usbtty_init_terminal_type(short type); static void usbtty_init_terminal_type(short type);
static void usbtty_event_handler (struct usb_device_instance *device, static void usbtty_event_handler (struct usb_device_instance *device,
usb_device_event_t event, int data); usb_device_event_t event, int data);
static int usbtty_cdc_setup(struct usb_device_request *request, static int usbtty_cdc_setup(struct usb_device_request *request,
struct urb *urb); struct urb *urb);
static int usbtty_configured (void); static int usbtty_configured (void);
static int write_buffer (circbuf_t * buf); static int write_buffer (circbuf_t * buf);
@ -477,12 +477,12 @@ static void __usbtty_puts (const char *str, int len)
/* Empty buffer here, if needed, to ensure space... */ /* Empty buffer here, if needed, to ensure space... */
if (space) { if (space) {
write_buffer (&usbtty_output); write_buffer (&usbtty_output);
n = MIN (space, MIN (len, maxlen)); n = MIN (space, MIN (len, maxlen));
buf_push (&usbtty_output, str, n); buf_push (&usbtty_output, str, n);
str += n; str += n;
len -= n; len -= n;
} }
} }
} }
@ -543,7 +543,7 @@ int drv_usbtty_init (void)
tt = "generic"; tt = "generic";
} }
usbtty_init_terminal_type(strcmp(tt,"cdc_acm")); usbtty_init_terminal_type(strcmp(tt,"cdc_acm"));
/* prepare buffers... */ /* prepare buffers... */
buf_init (&usbtty_input, USBTTY_BUFFER_SIZE); buf_init (&usbtty_input, USBTTY_BUFFER_SIZE);
buf_init (&usbtty_output, USBTTY_BUFFER_SIZE); buf_init (&usbtty_output, USBTTY_BUFFER_SIZE);
@ -579,7 +579,7 @@ static void usbtty_init_strings (void)
{ {
struct usb_string_descriptor *string; struct usb_string_descriptor *string;
usbtty_string_table[STR_LANG] = usbtty_string_table[STR_LANG] =
(struct usb_string_descriptor*)wstrLang; (struct usb_string_descriptor*)wstrLang;
string = (struct usb_string_descriptor *) wstrManufacturer; string = (struct usb_string_descriptor *) wstrManufacturer;
@ -624,7 +624,7 @@ static void usbtty_init_strings (void)
/* Now, initialize the string table for ep0 handling */ /* Now, initialize the string table for ep0 handling */
usb_strings = usbtty_string_table; usb_strings = usbtty_string_table;
} }
static void usbtty_init_instances (void) static void usbtty_init_instances (void)
{ {
@ -690,7 +690,7 @@ static void usbtty_init_instances (void)
endpoint_instance[i].rcv_packetSize = endpoint_instance[i].rcv_packetSize =
le16_to_cpu(ep_descriptor_ptrs[i - 1]->wMaxPacketSize); le16_to_cpu(ep_descriptor_ptrs[i - 1]->wMaxPacketSize);
endpoint_instance[i].tx_attributes = endpoint_instance[i].tx_attributes =
ep_descriptor_ptrs[i - 1]->bmAttributes; ep_descriptor_ptrs[i - 1]->bmAttributes;
@ -721,30 +721,30 @@ static void usbtty_init_endpoints (void)
int i; int i;
bus_instance->max_endpoints = NUM_ENDPOINTS + 1; bus_instance->max_endpoints = NUM_ENDPOINTS + 1;
for (i = 1; i <= NUM_ENDPOINTS; i++) { for (i = 1; i <= NUM_ENDPOINTS; i++) {
udc_setup_ep (device_instance, i, &endpoint_instance[i]); udc_setup_ep (device_instance, i, &endpoint_instance[i]);
} }
} }
/* usbtty_init_terminal_type /* usbtty_init_terminal_type
* *
* Do some late binding for our device type. * Do some late binding for our device type.
*/ */
static void usbtty_init_terminal_type(short type) static void usbtty_init_terminal_type(short type)
{ {
switch(type){ switch(type){
/* CDC ACM */ /* CDC ACM */
case 0: case 0:
/* Assign endpoint descriptors */ /* Assign endpoint descriptors */
ep_descriptor_ptrs[0] = ep_descriptor_ptrs[0] =
&acm_configuration_descriptors[0].notification_endpoint; &acm_configuration_descriptors[0].notification_endpoint;
ep_descriptor_ptrs[1] = ep_descriptor_ptrs[1] =
&acm_configuration_descriptors[0].data_endpoints[0]; &acm_configuration_descriptors[0].data_endpoints[0];
ep_descriptor_ptrs[2] = ep_descriptor_ptrs[2] =
&acm_configuration_descriptors[0].data_endpoints[1]; &acm_configuration_descriptors[0].data_endpoints[1];
/* Enumerate Device Descriptor */ /* Enumerate Device Descriptor */
device_descriptor.bDeviceClass = device_descriptor.bDeviceClass =
COMMUNICATIONS_DEVICE_CLASS; COMMUNICATIONS_DEVICE_CLASS;
device_descriptor.idProduct = device_descriptor.idProduct =
cpu_to_le16(CONFIG_USBD_PRODUCTID_CDCACM); cpu_to_le16(CONFIG_USBD_PRODUCTID_CDCACM);
@ -752,7 +752,7 @@ static void usbtty_init_terminal_type(short type)
/* Assign endpoint indices */ /* Assign endpoint indices */
tx_endpoint = ACM_TX_ENDPOINT; tx_endpoint = ACM_TX_ENDPOINT;
rx_endpoint = ACM_RX_ENDPOINT; rx_endpoint = ACM_RX_ENDPOINT;
/* Configuration Descriptor */ /* Configuration Descriptor */
configuration_descriptor = configuration_descriptor =
(struct usb_configuration_descriptor*) (struct usb_configuration_descriptor*)
@ -766,11 +766,11 @@ static void usbtty_init_terminal_type(short type)
case 1: case 1:
default: default:
/* Assign endpoint descriptors */ /* Assign endpoint descriptors */
ep_descriptor_ptrs[0] = ep_descriptor_ptrs[0] =
&gserial_configuration_descriptors[0].data_endpoints[0]; &gserial_configuration_descriptors[0].data_endpoints[0];
ep_descriptor_ptrs[1] = ep_descriptor_ptrs[1] =
&gserial_configuration_descriptors[0].data_endpoints[1]; &gserial_configuration_descriptors[0].data_endpoints[1];
ep_descriptor_ptrs[2] = ep_descriptor_ptrs[2] =
&gserial_configuration_descriptors[0].data_endpoints[2]; &gserial_configuration_descriptors[0].data_endpoints[2];
/* Enumerate Device Descriptor */ /* Enumerate Device Descriptor */
@ -783,7 +783,7 @@ static void usbtty_init_terminal_type(short type)
rx_endpoint = GSERIAL_RX_ENDPOINT; rx_endpoint = GSERIAL_RX_ENDPOINT;
/* Configuration Descriptor */ /* Configuration Descriptor */
configuration_descriptor = configuration_descriptor =
(struct usb_configuration_descriptor*) (struct usb_configuration_descriptor*)
&gserial_configuration_descriptors; &gserial_configuration_descriptors;
@ -832,14 +832,14 @@ static int write_buffer (circbuf_t * buf)
if (!usbtty_configured ()) { if (!usbtty_configured ()) {
return 0; return 0;
} }
struct usb_endpoint_instance *endpoint = struct usb_endpoint_instance *endpoint =
&endpoint_instance[tx_endpoint]; &endpoint_instance[tx_endpoint];
struct urb *current_urb = NULL; struct urb *current_urb = NULL;
current_urb = next_urb (device_instance, endpoint); current_urb = next_urb (device_instance, endpoint);
/* TX data still exists - send it now /* TX data still exists - send it now
*/ */
if(endpoint->sent < current_urb->actual_length){ if(endpoint->sent < current_urb->actual_length){
if(udc_endpoint_write (endpoint)){ if(udc_endpoint_write (endpoint)){
/* Write pre-empted by RX */ /* Write pre-empted by RX */
@ -854,11 +854,11 @@ static int write_buffer (circbuf_t * buf)
int popnum, popped; int popnum, popped;
int total = 0; int total = 0;
/* Break buffer into urb sized pieces, /* Break buffer into urb sized pieces,
* and link each to the endpoint * and link each to the endpoint
*/ */
while (buf->size > 0) { while (buf->size > 0) {
if (!current_urb) { if (!current_urb) {
TTYERR ("current_urb is NULL, buf->size %d\n", TTYERR ("current_urb is NULL, buf->size %d\n",
buf->size); buf->size);
@ -881,8 +881,8 @@ static int write_buffer (circbuf_t * buf)
current_urb->actual_length += popped; current_urb->actual_length += popped;
total += popped; total += popped;
/* If endpoint->last == 0, then transfers have /* If endpoint->last == 0, then transfers have
* not started on this endpoint * not started on this endpoint
*/ */
if (endpoint->last == 0) { if (endpoint->last == 0) {
if(udc_endpoint_write (endpoint)){ if(udc_endpoint_write (endpoint)){
@ -904,7 +904,7 @@ static int fill_buffer (circbuf_t * buf)
&endpoint_instance[rx_endpoint]; &endpoint_instance[rx_endpoint];
if (endpoint->rcv_urb && endpoint->rcv_urb->actual_length) { if (endpoint->rcv_urb && endpoint->rcv_urb->actual_length) {
unsigned int nb = 0; unsigned int nb = 0;
char *src = (char *) endpoint->rcv_urb->buffer; char *src = (char *) endpoint->rcv_urb->buffer;
unsigned int rx_avail = buf->totalsize - buf->size; unsigned int rx_avail = buf->totalsize - buf->size;
@ -913,7 +913,7 @@ static int fill_buffer (circbuf_t * buf)
nb = endpoint->rcv_urb->actual_length; nb = endpoint->rcv_urb->actual_length;
buf_push (buf, src, nb); buf_push (buf, src, nb);
endpoint->rcv_urb->actual_length = 0; endpoint->rcv_urb->actual_length = 0;
} }
return nb; return nb;
} }
@ -958,7 +958,7 @@ int usbtty_cdc_setup(struct usb_device_request *request, struct urb *urb)
case ACM_SEND_ENCAPSULATED_COMMAND : /* Required */ case ACM_SEND_ENCAPSULATED_COMMAND : /* Required */
break; break;
case ACM_SET_LINE_ENCODING : /* DTE stop/parity bits case ACM_SET_LINE_ENCODING : /* DTE stop/parity bits
* per character */ * per character */
break; break;
case ACM_GET_ENCAPSULATED_RESPONSE : /* request response */ case ACM_GET_ENCAPSULATED_RESPONSE : /* request response */
break; break;
@ -986,8 +986,8 @@ void usbtty_poll (void)
/* New interrupts? */ /* New interrupts? */
udc_irq(); udc_irq();
/* Write any output data to host buffer /* Write any output data to host buffer
* (do this before checking interrupts to avoid missing one) * (do this before checking interrupts to avoid missing one)
*/ */
if (usbtty_configured ()) { if (usbtty_configured ()) {
write_buffer (&usbtty_output); write_buffer (&usbtty_output);
@ -995,9 +995,9 @@ void usbtty_poll (void)
/* New interrupts? */ /* New interrupts? */
udc_irq(); udc_irq();
/* Check for new data from host.. /* Check for new data from host..
* (do this after checking interrupts to get latest data) * (do this after checking interrupts to get latest data)
*/ */
if (usbtty_configured ()) { if (usbtty_configured ()) {
fill_buffer (&usbtty_input); fill_buffer (&usbtty_input);

@ -33,7 +33,7 @@
#include <version_autogenerated.h> #include <version_autogenerated.h>
/* If no VendorID/ProductID is defined in config.h, pretend to be Linux /* If no VendorID/ProductID is defined in config.h, pretend to be Linux
* DO NOT Reuse this Vendor/Product setup with protocol incompatible devices */ * DO NOT Reuse this Vendor/Product setup with protocol incompatible devices */
#define CONFIG_USBD_VENDORID 0x0525 /* Linux/NetChip */ #define CONFIG_USBD_VENDORID 0x0525 /* Linux/NetChip */
@ -45,7 +45,7 @@
#define CONFIG_USBD_CONFIGURATION_STR "TTY via USB" #define CONFIG_USBD_CONFIGURATION_STR "TTY via USB"
#define CONFIG_USBD_SERIAL_OUT_ENDPOINT UDC_OUT_ENDPOINT #define CONFIG_USBD_SERIAL_OUT_ENDPOINT UDC_OUT_ENDPOINT
#define CONFIG_USBD_SERIAL_OUT_PKTSIZE UDC_OUT_PACKET_SIZE #define CONFIG_USBD_SERIAL_OUT_PKTSIZE UDC_OUT_PACKET_SIZE
#define CONFIG_USBD_SERIAL_IN_ENDPOINT UDC_IN_ENDPOINT #define CONFIG_USBD_SERIAL_IN_ENDPOINT UDC_IN_ENDPOINT
#define CONFIG_USBD_SERIAL_IN_PKTSIZE UDC_IN_PACKET_SIZE #define CONFIG_USBD_SERIAL_IN_PKTSIZE UDC_IN_PACKET_SIZE

@ -769,8 +769,6 @@ typedef void (*ExcpHndlr) (void) ;
#define UP2OCR __REG(0x40600020) #define UP2OCR __REG(0x40600020)
#define UP3OCR __REG(0x40600024) #define UP3OCR __REG(0x40600024)
/* /*
* USB Host Controller * USB Host Controller
*/ */

@ -3,7 +3,7 @@
* Bryan O'Donoghue <bodonoghue@codehermit.ie> * Bryan O'Donoghue <bodonoghue@codehermit.ie>
* *
* Provides support for USB console on the Analogue & Micro Adder87x * Provides support for USB console on the Analogue & Micro Adder87x
* *
* See file CREDITS for list of people who contributed to this * See file CREDITS for list of people who contributed to this
* project. * project.
* *
@ -37,13 +37,13 @@
/* If you have a USB-IF assigned VendorID then you may wish to define /* If you have a USB-IF assigned VendorID then you may wish to define
* your own vendor specific values either in BoardName.h or directly in * your own vendor specific values either in BoardName.h or directly in
* usbd_vendor_info.h * usbd_vendor_info.h
*/ */
/* /*
#define CONFIG_USBD_MANUFACTURER "CodeHermit.ie" #define CONFIG_USBD_MANUFACTURER "CodeHermit.ie"
#define CONFIG_USBD_PRODUCT_NAME "Das U-Boot" #define CONFIG_USBD_PRODUCT_NAME "Das U-Boot"
#define CONFIG_USBD_VENDORID 0xFFFF #define CONFIG_USBD_VENDORID 0xFFFF
#define CONFIG_USBD_PRODUCTID_GSERIAL 0xFFFF #define CONFIG_USBD_PRODUCTID_GSERIAL 0xFFFF
#define CONFIG_USBD_PRODUCTID_CDCACM 0xFFFE #define CONFIG_USBD_PRODUCTID_CDCACM 0xFFFE
*/ */

@ -34,7 +34,7 @@
#define ACM_RESPONSE_AVAILABLE 0x01 #define ACM_RESPONSE_AVAILABLE 0x01
#define ACM_SERIAL_STATE 0x20 #define ACM_SERIAL_STATE 0x20
/* Format of response expected by a ACM_GET_LINE_ENCODING request */ /* Format of response expected by a ACM_GET_LINE_ENCODING request */
struct rs232_emu{ struct rs232_emu{
unsigned long dter; unsigned long dter;
unsigned char stop_bits; unsigned char stop_bits;

@ -99,7 +99,7 @@
#define TX_BD_TO 0x04 #define TX_BD_TO 0x04
#define TX_BD_NO_PID 0x00 #define TX_BD_NO_PID 0x00
#define TX_BD_PID_DATA0 0x80 #define TX_BD_PID_DATA0 0x80
#define TX_BD_PID_DATA1 0xC0 #define TX_BD_PID_DATA1 0xC0
#define TX_BD_CNF 0x200 #define TX_BD_CNF 0x200
#define TX_BD_TC 0x400 #define TX_BD_TC 0x400
#define TX_BD_L 0x800 #define TX_BD_L 0x800
@ -151,16 +151,16 @@ typedef struct mpc8xx_usb{
ushort usber; /* Event Register */ ushort usber; /* Event Register */
ushort res3; /* Reserved */ ushort res3; /* Reserved */
ushort usbmr; /* Mask Register */ ushort usbmr; /* Mask Register */
char res4; /* Reserved */ char res4; /* Reserved */
char usbs; /* Status Register */ char usbs; /* Status Register */
char res5[8]; /* Reserved */ char res5[8]; /* Reserved */
}usb_t; }usb_t;
typedef struct mpc8xx_parameter_ram{ typedef struct mpc8xx_parameter_ram{
ushort ep0ptr; /* Endpoint Pointer Register 0 */ ushort ep0ptr; /* Endpoint Pointer Register 0 */
ushort ep1ptr; /* Endpoint Pointer Register 1 */ ushort ep1ptr; /* Endpoint Pointer Register 1 */
ushort ep2ptr; /* Endpoint Pointer Register 2 */ ushort ep2ptr; /* Endpoint Pointer Register 2 */
ushort ep3ptr; /* Endpoint Pointer Register 3 */ ushort ep3ptr; /* Endpoint Pointer Register 3 */
uint rstate; /* Receive state */ uint rstate; /* Receive state */
uint rptr; /* Receive internal data pointer */ uint rptr; /* Receive internal data pointer */
ushort frame_n; /* Frame number */ ushort frame_n; /* Frame number */
@ -198,7 +198,7 @@ int udc_init(void);
void udc_irq(void); void udc_irq(void);
int udc_endpoint_write(struct usb_endpoint_instance *endpoint); int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
void udc_setup_ep(struct usb_device_instance *device, unsigned int ep, void udc_setup_ep(struct usb_device_instance *device, unsigned int ep,
struct usb_endpoint_instance *endpoint); struct usb_endpoint_instance *endpoint);
void udc_connect(void); void udc_connect(void);
void udc_disconnect(void); void udc_disconnect(void);
void udc_enable(struct usb_device_instance *device); void udc_enable(struct usb_device_instance *device);

@ -321,7 +321,7 @@ struct usb_class_union_function_descriptor {
u8 bDescriptorType; u8 bDescriptorType;
u8 bDescriptorSubtype; /* 0x06 */ u8 bDescriptorSubtype; /* 0x06 */
u8 bMasterInterface; u8 bMasterInterface;
//u8 bSlaveInterface0[0]; /* u8 bSlaveInterface0[0]; */
u8 bSlaveInterface0; u8 bSlaveInterface0;
} __attribute__ ((packed)); } __attribute__ ((packed));

Loading…
Cancel
Save