-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds TinyUsb based CDC virtual Com port driver with an STM32 port. #748
Conversation
OPtimize thread stack size.
dcd_int_handler(0); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an "extern "C"" comment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
#include "os/OS.hxx" | ||
#include "utils/Singleton.hxx" | ||
|
||
class TinyUsbCdc : public Node, public Singleton<TinyUsbCdc> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This singleton architecture seems to preclude the possibility of multiple CDC endpoints to the same USB peripheral instance. Is that intentional? I suspect this was done so that there is only one USB thread instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not super easy to create multiple CDC endpoints. For reference, the TivaUsbCdc driver doesn't support it either. These are the steps that need to be taken before we can instantiate a second object:
- change the tinyusbconfig.h (which will have a memory footprint effect)
- change the USB descriptors
- update how the thread is started / running
- update all callbacks to be routed to the right instance
- figure out what happens on the host OS if there is no second object but the descriptor says there should be
Ultimately I think having two CDCs is a feature request that's not high priority, and at this point it's more important to prevent accidentally creating two instances, which the singleton will do fine.
#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \ | ||
_PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) ) | ||
|
||
#define USB_VID 0xCafe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why mixing upper and lower case hex characters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
// Invoked when received GET DEVICE DESCRIPTOR | ||
// Application return pointer to descriptor | ||
uint8_t const *tud_descriptor_device_cb(void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect open brace style, here and below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed all whitespace
The canusb application could not run in 16kbyte MCU's because it was running out of heap. This PR optimizes it, and handles some long standing work items in the buffering capabilities of openmrn. - switches can-usb app to use select() based implementation. - Removes five tasks: - CAN-bus read/write threads - Serial port read/write tasks - merges the main thread and the main executor thread - Fixes traffic throttling on HubDeviceSelect. It was not on par with HubDevice, as the input data was consumed at an infinite rate. Adds support for the linker option config_gridconnect_port_max_incoming_packets(). === * Add support for LimitedPool to HubDeviceSelect. This brings it on par with HubDevice in ensuring that we don't allow too much data into the memory of the embedded device, and push back on the traffic stream on the source (USB or TCP should both work). The limit will be based on the linker option config_gridconnect_port_max_incoming_packets(). * Switches the USB-CAN application to use select()-based implementation. This dramatically reduces the RAM requirements. Removes five tasks: - CAN-bus read/write threads - Serial port read/write tasks - merges the main thread and the main executor thread
* master: Ensures that 'make clean' empties lib directory of symlinks. (#753) Add an input/output GPIO type. This helps support bit banged I2C. (#752) Adds TinyUsb based CDC virtual Com port driver with an STM32 port. (#748) Limit the amount of input we read into memory in arduino sketches. (#746) Updates to send_datagram cmdline utility (#740)
* bracz-lib-clean: Ensures that 'make clean' empties lib directory of symlinks. (#753) Add an input/output GPIO type. This helps support bit banged I2C. (#752) Adds TinyUsb based CDC virtual Com port driver with an STM32 port. (#748) Limit the amount of input we read into memory in arduino sketches. (#746) Updates to send_datagram cmdline utility (#740)
…t-hub-router * 'master' of github.com:bakerstu/openmrn: (152 commits) Switches over make tests at toplevel to use the tests target instead of the cov target. Ensures that openmrn and application directory builds can run in parallel. (#754) Ensures that 'make clean' empties lib directory of symlinks. (#753) Add an input/output GPIO type. This helps support bit banged I2C. (#752) Adds TinyUsb based CDC virtual Com port driver with an STM32 port. (#748) Limit the amount of input we read into memory in arduino sketches. (#746) Updates to send_datagram cmdline utility (#740) Adds lflash command to the bracz-railcom board support makefile. Do not crash on an incoming message with 0 alias. (#751) Add common app test coverage rules. (#750) Fix symlinking of library files to the lib directory. (#747) Refactors the SPIFFS flash driver for the F7 into a generic stm32 flash driver. (#742) Unaligned read/write support in TivaEEPROM storage (#741) Adds support for producer/consumer identified message in the CallbackEventHandler. (#743) Improve error handling in BroadcastTimeDefs::string_to_date() (#745) Fix test makefiles and test target (#736) Moves the bootloader hook so that the hook implementation gets a chance to look at incoming frames. Fixes missing includes. Fixes missing symbol error. Adds stm32f072 HAL drivers to bare.armv6m compilation target. ...
The TinyUSBCdc driver is select-enabled. It does not use a Serial base class, because the read and write fifo's are provided by the TinyUsb codebase. We are exercising the application reads and writes directly from those fifos; this saves one unnecessary copy of the data in memory. (There are still two memcpy's; one in the interrupt to the fifo, one in the application code to the application buffer.)