lib/circbuf: Make circbuf selectable symbol
Subsystems (2)
PATCH v2 1/2 lib/circbuf: Make circbuf selectable symbol
It is currenly only used from usbtty driver but make it properly selectable via Kconfig symbol, for future usage.
---
v2: no change
lib/Kconfig | 3 +++ lib/Makefile | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
lib/Kconfig +3 -0
@@ -290,6 +290,9 @@ config TRACE_EARLY_ADDR the size is too small then the message which says the amount of early data being coped will the the same as the +config CIRCBUF + bool + source lib/dhry/Kconfig menu "Security support"
lib/Makefile +7 -1
@@ -29,7 +29,13 @@ ifneq ($(CONFIG_CHARSET),) obj-y += charset.o endif endif -obj-$(CONFIG_USB_TTY) += circbuf.o + +ifdef CONFIG_USB_TTY +obj-y += circbuf.o +else +obj-$(CONFIG_CIRCBUF) += circbuf.o +endif + obj-y += crc8.o obj-y += crc16.o obj-$(CONFIG_ERRNO_STR) += errno_str.o
Signature · 1 line
2.7.4
PATCH v2 2/2 usb: gadget: Add CDC ACM function
Add support for CDC ACM using the new UDC and gadget API. This protocol can be used for serial over USB data transfer and is widely supported by various OS (GNU/Linux, MS-Windows, OSX...). The usual purpose of such link is to access device debug console and can be useful for products not exposing regular UART to the user.
A default stdio device named 'stdio_acm' is created, and can be used to redirect console to USB link over CDC ACM:
Quoted 1 line
setenv stdin
stdio_acm; setenv stdoutstdio_acm
---
v2: - remove possible infinite recursipe print loop
- Remove acmconsole command, start function along the stdio device
common/stdio.c | 3 + drivers/usb/gadget/Kconfig | 9 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/f_acm.c | 672 ++++++++++++++++++++++++++++++++++++++++++++ include/stdio_dev.h | 1 + 5 files changed, 686 insertions(+) create mode 100644 drivers/usb/gadget/f_acm.c
common/stdio.c +3 -0
@@ -381,6 +381,9 @@ int stdio_add_devices(void)#ifdef CONFIG_USB_TTY drv_usbtty_init ();#endif +#ifdef CONFIG_USB_FUNCTION_ACM +drv_usb_acm_stdio_init (); +#endif if (IS_ENABLED (CONFIG_NETCONSOLE ))drv_nc_init ();#ifdef CONFIG_JTAG_CONSOLE
drivers/usb/gadget/Kconfig +9 -0
@@ -182,6 +182,15 @@ config USB_FUNCTION_THOR Enable Tizen's THOR download protocol support in U-Boot. It allows downloading images into memory and flash them to target device. +config USB_FUNCTION_ACM + bool "Enable CDC ACM gadget" + select SYS_STDIO_DEREGISTER + select CIRCBUF + help + ACM serial link. This function can be used to create a stdio device to + interoperate with MS-Windows hosts or with the Linux-USB "cdc-acm" + driver. + endif # USB_GADGET_DOWNLOAD config USB_ETHER
drivers/usb/gadget/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o obj-$(CONFIG_USB_FUNCTION_SDP) += f_sdp.o obj-$(CONFIG_USB_FUNCTION_ROCKUSB) += f_rockusb.o +obj-$(CONFIG_USB_FUNCTION_ACM) += f_acm.o endif endif ifdef CONFIG_USB_ETHER
drivers/usb/gadget/f_acm.c new file +672 -0
672 lines not on this page · raw message
include/stdio_dev.h +1 -0
@@ -103,6 +103,7 @@ int drv_lcd_init(void);int drv_video_init (void );int drv_keyboard_init (void );int drv_usbtty_init (void ); +int drv_usb_acm_stdio_init (void );int drv_nc_init (void );int drv_jtag_console_init (void );int cbmemc_init (void );
Signature · 1 line
2.7.4
Re: [PATCH v2 2/2] usb: gadget: Add CDC ACM function
Hello! I have just few notes, see below.
Quoted 17 lines
drivers/usb/gadget/Makefile +1
-0@@ -30,6 +30,7 @@ obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o obj-$(CONFIG_USB_FUNCTION_SDP) += f_sdp.o obj-$(CONFIG_USB_FUNCTION_ROCKUSB) += f_rockusb.o +obj-$(CONFIG_USB_FUNCTION_ACM) += f_acm.o endif endif ifdef CONFIG_USB_ETHERdrivers/usb/gadget/f_acm.c new file +0
-0
...
drivers/usb/gadget/f_acm.c line 101
Quoted 5 lines
drivers/usb/gadget/f_acm.c new file +5
-0+static struct usb_cdc_header_desc acm_header_desc = { + .bLength =sizeof (acm_header_desc), + .bDescriptorType =USB_DT_CS_INTERFACE , + .bDescriptorSubType =USB_CDC_HEADER_TYPE , + .bcdCDC =cpu_to_le16 (0x0110 ),
This is global structure initialization. So should not it use __constant_cpu_to_le16() macro instead of cpu_to_le16()? I guess that on armel or x86 is cpu_to_le16() just identity macro, but on big endian systems it is needed to use constant initialization. Other gadget drivers are using those __constant_cpu* macros.
Quoted 1 line
+};
...
drivers/usb/gadget/f_acm.c line 660
Quoted 5 lines
drivers/usb/gadget/f_acm.c new file +5
-0+int drv_usb_acm_stdio_init (void ) +{ +struct stdio_dev stdio; + +strcpy (stdio.name,"stdio_acm" );
Just suggestion: What about "usbacm" or just "acm"?
Quoted 17 lines
drivers/usb/gadget/f_acm.c new file +12
-0+ stdio.flags =DEV_FLAGS_INPUT |DEV_FLAGS_OUTPUT ; + stdio.tstc = acm_stdio_tstc; + stdio.getc = acm_stdio_getc; + stdio.putc = acm_stdio_putc; + stdio.puts = acm_stdio_puts; + stdio.start = acm_stdio_start; + stdio.stop = acm_stdio_stop; + stdio.priv =NULL ; + stdio.ext =0 ; + +return stdio_register (&stdio); +}include/stdio_dev.h +0
-0
include/stdio_dev.h int drv_lcd_init(void); · line 106
Quoted 4 lines
include/stdio_dev.h +1
-0@@ -103,6 +103,7 @@ int drv_lcd_init(void);int drv_video_init (void );int drv_keyboard_init (void );int drv_usbtty_init (void ); +int drv_usb_acm_stdio_init (void );
Other functions do not have stdio in name too. So what about shorting it? E.g. just drv_usbacm_init()?
Quoted 6 lines
include/stdio_dev.h +0
-0int drv_nc_init (void );int drv_jtag_console_init (void );int cbmemc_init (void );Signature · 1 line
2.7.4
Re: [PATCH v2 2/2] usb: gadget: Add CDC ACM function
Hi Pali,
Quoted 27 lines · Pali Rohár
Hello! I have just few notes, see below.
Quoted 17 lines
drivers/usb/gadget/Makefile +1
-0@@ -30,6 +30,7 @@ obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o obj-$(CONFIG_USB_FUNCTION_SDP) += f_sdp.o obj-$(CONFIG_USB_FUNCTION_ROCKUSB) += f_rockusb.o +obj-$(CONFIG_USB_FUNCTION_ACM) += f_acm.o endif endif ifdef CONFIG_USB_ETHERdrivers/usb/gadget/f_acm.c new file +0
-0...
drivers/usb/gadget/f_acm.c line 101
Quoted 5 lines
drivers/usb/gadget/f_acm.c new file +5
-0+static struct usb_cdc_header_desc acm_header_desc = { + .bLength =sizeof (acm_header_desc), + .bDescriptorType =USB_DT_CS_INTERFACE , + .bDescriptorSubType =USB_CDC_HEADER_TYPE , + .bcdCDC =cpu_to_le16 (0x0110 ),
Quoted 5 lines
This is global structure initialization. So should not it use
__constant_cpu_to_le16()macro instead ofcpu_to_le16()? I guess that on armel or x86 iscpu_to_le16()just identity macro, but on big endian systems it is needed to use constant initialization. Other gadget drivers are using those __constant_cpu* macros.
Indeed, going to use it.
Quoted 10 lines
Quoted 2 lines
+};
...
drivers/usb/gadget/f_acm.c line 660
Quoted 5 lines
drivers/usb/gadget/f_acm.c new file +5
-0+int drv_usb_acm_stdio_init (void ) +{ +struct stdio_dev stdio; + +strcpy (stdio.name,"stdio_acm" );Just suggestion: What about "usbacm" or just "acm"?
usbacm sounds good.
Quoted 17 lines
Quoted 17 lines
drivers/usb/gadget/f_acm.c new file +12
-0+ stdio.flags =DEV_FLAGS_INPUT |DEV_FLAGS_OUTPUT ; + stdio.tstc = acm_stdio_tstc; + stdio.getc = acm_stdio_getc; + stdio.putc = acm_stdio_putc; + stdio.puts = acm_stdio_puts; + stdio.start = acm_stdio_start; + stdio.stop = acm_stdio_stop; + stdio.priv =NULL ; + stdio.ext =0 ; + +return stdio_register (&stdio); +}include/stdio_dev.h +0
-0
Quoted 8 lines
include/stdio_dev.h int drv_lcd_init(void); · line 106
Quoted 5 lines
include/stdio_dev.h +1
-0@@ -103,6 +103,7 @@ int drv_lcd_init(void);int drv_video_init (void );int drv_keyboard_init (void );int drv_usbtty_init (void ); +int drv_usb_acm_stdio_init (void );Other functions do not have stdio in name too. So what about shorting it? E.g. just
drv_usbacm_init()?
Yes, I've named it _stdio because it's a subpart of the driver. There is the core cdc_acm function implementation and one client of this function which is stdio. But I'm fine with shortening that.
Regards,
Loic
Dear Loic Poulain,
Quoted 16 lines · In message <[email protected]> you…
It is currenly only used from usbtty driver but make it properly selectable via
Kconfigsymbol, for future usage.Signed-off-by Loic Poulain <[email protected]>---
v2: no changelib/Kconfig | 3 +++ lib/Makefile | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-)lib/Kconfig +0
-0
lib/Kconfig config TRACE_EARLY_ADDR · line 296
Quoted 7 lines
lib/Kconfig +3
-0@@ -290,6 +290,9 @@ config TRACE_EARLY_ADDR the size is too small then the message which says the amount of early data being coped will the the same as the +config CIRCBUF + bool + source lib/dhry/Kconfig
Please add a description what this symbos is doing.
Thanks.
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] Old programmers never die, they just become managers.
Hi Wolfgang,
Quoted 23 lines · Wolfgang Denk
Dear Loic Poulain,
Quoted 19 lines · In message <[email protected]> you…
It is currenly only used from usbtty driver but make it properly selectable via
Kconfigsymbol, for future usage.Signed-off-by Loic Poulain <[email protected]>---
v2: no changelib/Kconfig | 3 +++ lib/Makefile | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-)lib/Kconfig +0
-0@@ -290,6 +290,9 @@ config TRACE_EARLY_ADDR the size is too small then the message which says the amount of early data being coped will the the same as the
Quoted 6 lines
lib/Kconfig config TRACE_EARLY_ADDR · line 296
Quoted 4 lines
lib/Kconfig +3
-0+config CIRCBUF + bool + source lib/dhry/KconfigPlease add a description what this symbos is doing.
It's not a user selectable symbol, adding description will break that, right?
Regards,
Loic