From 5c8dfe7f8e209f4fb19db7c73cc24af1982b12a2 Mon Sep 17 00:00:00 2001 From: arighi Date: Fri, 11 Feb 2011 15:02:21 +0000 Subject: [PATCH] USB: allow to configure the maximum packet size of EP0 All USB devices support endpoint 0 (EP0) when powered up. This endpoint is the target of the default pipe. After the attachment of a device has been detected, the USB software uses endpoint 0 to initialise the device, perform generic (i.e., non device-specific) configuration, and obtain information about the other endpoints provided by the device. The descriptor of EP0 is hard-coded into the low-level device driver of each target platform, and cannot be re-defined by the user to implement a custom USB device. So, expose the maximum packet size of this special endpoint as a configurable parameter into the wizard. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4699 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/cfg_usb.h | 7 +++++++ bertos/cpu/cortex-m3/drv/usb_stm32.h | 2 +- boards/stm32-p103/examples/usbkeyboard/cfg/cfg_usb.h | 7 +++++++ boards/stm32-p103/examples/usbmouse/cfg/cfg_usb.h | 7 +++++++ boards/stm32-p103/examples/usbserial/cfg/cfg_usb.h | 7 +++++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/bertos/cfg/cfg_usb.h b/bertos/cfg/cfg_usb.h index d1c724c9..dbfd6fe1 100644 --- a/bertos/cfg/cfg_usb.h +++ b/bertos/cfg/cfg_usb.h @@ -75,4 +75,11 @@ */ #define CONFIG_USB_EP_MAX 0 +/** + * Maximum packet size of the control endpoint 0 [bytes]. + * $WIZ$ type = "int" + * $WIZ$ min = 8 + */ +#define CONFIG_EP0_MAX_SIZE 8 + #endif /* CFG_USB_H */ diff --git a/bertos/cpu/cortex-m3/drv/usb_stm32.h b/bertos/cpu/cortex-m3/drv/usb_stm32.h index a4cbb6b5..7801e2c8 100644 --- a/bertos/cpu/cortex-m3/drv/usb_stm32.h +++ b/bertos/cpu/cortex-m3/drv/usb_stm32.h @@ -50,7 +50,7 @@ #define USB_DP_PIN (1 << 12) #define USB_DISC_PIN (1 << 11) -#define USB_EP0_MAX_SIZE 8 +#define USB_EP0_MAX_SIZE CONFIG_EP0_MAX_SIZE #define USB_XFER_MAX_SIZE 64 #define EP_MAX_SLOTS USB_EP_MAX diff --git a/boards/stm32-p103/examples/usbkeyboard/cfg/cfg_usb.h b/boards/stm32-p103/examples/usbkeyboard/cfg/cfg_usb.h index d1c724c9..dbfd6fe1 100644 --- a/boards/stm32-p103/examples/usbkeyboard/cfg/cfg_usb.h +++ b/boards/stm32-p103/examples/usbkeyboard/cfg/cfg_usb.h @@ -75,4 +75,11 @@ */ #define CONFIG_USB_EP_MAX 0 +/** + * Maximum packet size of the control endpoint 0 [bytes]. + * $WIZ$ type = "int" + * $WIZ$ min = 8 + */ +#define CONFIG_EP0_MAX_SIZE 8 + #endif /* CFG_USB_H */ diff --git a/boards/stm32-p103/examples/usbmouse/cfg/cfg_usb.h b/boards/stm32-p103/examples/usbmouse/cfg/cfg_usb.h index d1c724c9..dbfd6fe1 100644 --- a/boards/stm32-p103/examples/usbmouse/cfg/cfg_usb.h +++ b/boards/stm32-p103/examples/usbmouse/cfg/cfg_usb.h @@ -75,4 +75,11 @@ */ #define CONFIG_USB_EP_MAX 0 +/** + * Maximum packet size of the control endpoint 0 [bytes]. + * $WIZ$ type = "int" + * $WIZ$ min = 8 + */ +#define CONFIG_EP0_MAX_SIZE 8 + #endif /* CFG_USB_H */ diff --git a/boards/stm32-p103/examples/usbserial/cfg/cfg_usb.h b/boards/stm32-p103/examples/usbserial/cfg/cfg_usb.h index d1c724c9..dbfd6fe1 100644 --- a/boards/stm32-p103/examples/usbserial/cfg/cfg_usb.h +++ b/boards/stm32-p103/examples/usbserial/cfg/cfg_usb.h @@ -75,4 +75,11 @@ */ #define CONFIG_USB_EP_MAX 0 +/** + * Maximum packet size of the control endpoint 0 [bytes]. + * $WIZ$ type = "int" + * $WIZ$ min = 8 + */ +#define CONFIG_EP0_MAX_SIZE 8 + #endif /* CFG_USB_H */ -- 2.25.1