Overview — eCosPro Support for CDC ACM Protocol in Host Mode
This package provides protocol driver support for host mode serial adapter connections that use the CDC ACM protocol. It needs to be used in conjunction with the USB serial driver package and the reader is referred to that document for additional details.
The eCos serial driver subsystem does not support the dynamic creation and deletion of serial devices. Instead the CDC/ACM driver allocates a number of permanently available serial channels which are allocated to USB devices as they are attached. In order to retain some continuity, it is possible to assign specific Vendor and Product ID values to individual channels so that the USB device will be allocated the same channel each time it is attached.
Writing data to a detached channel will result in that data being lost, just as if it were being written to a disconnected serial line. A detached channel will not produce any data. Changes to the line configuration (baud rate, parity, stop bits, data size) will be stored and applied to the device once it is attached.
Applications may install a serial line callback function which will
be called with the
which field set to
CYGNUM_SERIAL_STATUS_ATTACH and the
value field set to zero for a detach and
one for an attach.
To use this package, various other packages need to be included and
configuration options need to be set. The packages that need
to be included are: USB Support (
USB serial driver (
Serial device drivers (
CYGPKG_IO_SERIAL) and this package
USB host cdc acm protocol driver (
Packages can be added directly using ecosconfig add
on the command line, or the Build->Packages…
menu item within the eCos Configuration Tool. Depending on your platform
some of these may already be present in the default eCos configuration.
To activate the requisite USB host and serial support, the options
CYGPKG_IO_SERIAL_DEVICES need to be
enabled. Following this at least one CDC/ACM channel needs to be
configured using the options below.
The configuration option
CYGNUM_IO_USB_CDC_ACM_MAXPKT defines the maximum
packet size used for USB transfers. It is used define the size of
rx_buf in the
usb_serial_if structure. The actual packet
size used by any device is specified in its descriptors. Most
CDC/ACM devices will use a maximum packet size of 64 bytes, and
many will be smaller. So this value should not be reduced unless it
is known that only devices with smaller packet sizes will be used.
Each serial channel has a number of configuration options associated with it. The following descriptions show the options for serial channel 0, for other channels the zero should be replaced with the number of the channel, currently up to 4.
- This interface may be implemented by the platform HAL to instantiate this serial channel.
This is the main component that defines this serial channel,
unless this component is enabled, the remaining options will
remain undefined. Its default value is derived from
CYGINT_IO_USB_CDC_ACM_HOST_SERIAL0, but it may also be enabled with a requires statement or from the configtool.
- This option controls the name that an eCos application should use to access this device via cyg_io_lookup(), open(), or similar calls. The default is "/dev/acm0" and so on.
This option specifies the default baud rate for this channel. Its
default value is set to
This option specifies the size of both the input and output
buffer for the common serial I/O driver layer. This should be at
least equal to
CYGNUM_IO_USB_CDC_ACM_HOST_MAXPKTand preferably somewhat larger. The default value makes it twice the maximum packet size.
- This option controls whether this serial channel matches a particular USB Vendor ID. If zero it will match any ID, otherwise this channel will only match a device with the given vendor ID.
This option controls whether this serial channel matches a particular USB Product ID. If zero it will match any ID, otherwise this channel will only match a device with the given product ID.
Channels are searched for a VID and PID match in numerical order, skipping any that are already in use. Therefore lower numbered channels should have more specific VID and PID values and generic channels should be at the end of the list.
This driver only supports a subset of the CDC ACM protocol, sufficient to provide a serial-like interface between the host and the device.
CDC ACM uses two bulk endpoints to transfer raw data bytes between the host and the target board. Additionally, control messages are sent to the control endpoint to adjust the configuration of the channel. Only the following commands are currently sent:
SET LINE CODING
This sets the baud rate, stop bits, parity and character size
for the channel. This is generated in response to a
CYG_IO_SET_CONFIG_SERIAL_INFOset_config key from the application.
|2021-09-02||eCosPro Non-Commercial Public License|