aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/usb_serial.cpp
Commit message (Collapse)AuthorAgeFilesLines
* usb_serial.cpp: Hackishly silence spurious warnings on VLDiscovery.Marti Bolivar2012-08-271-0/+6
| | | | | | Guard hooks with BOARD_HAVE_SERIALUSB to keep GCC quiet. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb_serial.cpp: Neaten up reset signal RX hook.Marti Bolivar2012-08-221-34/+33
| | | | | | | | | | Move magic bytes from stack to Flash. De-magic-number sizeof magic byte buffer. Use uintptr_t instead of unsigned int when casting address of wait_reset(). Based on a patch by Michael Hope. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move bootloader reset signal detection to Wirish.Marti Bolivar2012-07-311-0/+116
| | | | | | | | Use usb_cdcacm hooks to move the DTR edge and "1EAF" magic packet detection to usb_serial.cpp. We'll later be able to extend this system to support Leonardo-style reset signalling. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb_serial.cpp: Minor tweak.Marti Bolivar2012-07-251-2/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Slightly improve and generify the USB infrastructure.Marti Bolivar2012-06-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The good news is that <libmaple/usb.h> and <libmaple/usb_cdcacm.h> did turn out generic enough in what they specify to go on unchanged. However, we can't just go on assuming that there's USB just because we're on an F1. Now that there's value line in the tree, we need to be more careful (value line F1s don't have USB peripherals). To that end, make all the F1 board-includes/*.mk files specify what line their MCU is with an MCU_F1_LINE variable. Use that to hack libmaple/usb/rules.mk so we only try to build the USB module under appropriate circumstances. While we're at it, add a vector_symbols.inc for value line MCUs under support/ld/. We need this to get the target-config.mk modifications implied by the addition of MCU_F1_LINE. We'll fix up some other performance-line-isms under libmaple/stm32f1 in a separate commit. Also in libmaple/usb/: - Move everything into a new stm32f1 directory. Due to aforementioned rules.mk hacks, there is no immediate need for an stm32f2 directory (USB support doesn't exist there). - Update the README for style and content. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Make USB its own submodule.Marti Bolivar2012-04-111-1/+1
| | | | | | | | | | | | | | | Add libmaple/usb/rules.mk, which compiles the USB FS device firmware submodule. Move the logic for compiling the USB stack from libmaple/rules.mk into libmaple/usb/rules.mk. Move libmaple/usb/usb_cdacm.h to libmaple/include/libmaple/. Its API is sufficiently general that we'll be able to port it over to USB OTG (either FS or HS) eventually, and that lets us include it from Wirish using the new style for libmaple headers. Fix the includes for public libmaple headers within libmaple/usb. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move public headers to include directories; related cleanups.Marti Bolivar2012-04-111-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move libmaple/*.h to (new) libmaple/include/libmaple/. The new accepted way to include a libmaple header foo.h is with: #include <libmaple/foo.h> This is more polite in terms of the include namespace. It also allows us to e.g. implement the Arduino SPI library at all (which has header SPI.h; providing it was previously impossible on case-insensitive filesystems due to libmaple's spi.h). Similarly for Wirish. The old include style (#include "header.h") is now deprecated. libmaple/*.h: - Change include guard #defines from _FOO_H_ to _LIBMAPLE_FOO_H_. - Add license headers where they're missing - Add conditional extern "C" { ... } blocks where they're missing (they aren't always necessary, but we might was well do it against the future, while we're at it.). - Change includes from #include "foo.h" to #include <libmaple/foo.h>. - Move includes after extern "C". - Remove extra trailing newlines Note that this doesn't include the headers under libmaple/usb/ or libmaple/usb/usb_lib. These will get fixed later. libmaple/*.c: - Change includes from #include "foo.h" to #include <libmaple/foo.h>. Makefile: - Add I$(LIBMAPLE_PATH)/include/libmaple to GLOBAL_FLAGS. This allows for users (including Wirish) to migrate their code, but should go away ASAP, since it slows down compilation. Wirish: - Move wirish/**/*.h to (new) wirish/include/wirish/. This ignores the USB headers, which, as usual, are getting handled after everything else. - Similarly generify wirish/boards/ structure. For each supported board "foo", move wirish/boards/foo.h and wirish/boards/foo.cpp to wirish/boards/foo/include/board/board.h and wirish/boards/foo/board.cpp, respectively. Also remove the #ifdef hacks around the .cpp files. - wirish/rules.mk: put wirish/boards/foo/include in the include path (and add wirish/boards/foo/board.cpp to the list of sources to be compiled). This allows saying: #include <board/board.h> instead of the hack currently in place. We can allow the user to override this setting later to make adding custom board definitions easier. - Disable -Werror in libmaple/rules.mk, as the current USB warnings don't let the olimex_stm32_h103 board compile. We can re-enable -Werror once we've moved the board-specific bits out of libmaple proper. libraries, examples: - Update includes accordingly. - Miscellaneous cosmetic fixups. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* USB: API cleanups.Marti Bolivar2011-10-211-2/+2
| | | | | | | | | | Modify usb.h functions (changing their names in some cases) to also take a usblib_dev* argument, to fit in better with the rest of libmaple. Store an rcc_clk_id in struct usblib_dev for the same reason. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Disentangle CDC ACM functionality.Marti Bolivar2011-10-181-9/+10
| | | | | | | | | | | | | | | | | | | | | Add new usb_cdcacm.h, which provides the virtual serial port API. This file (and new usb_cdcacm.c) consolidate the VCOM support, which was previously distributed through descriptors.[hc], usb.[hc], usb_callbacks.[hc], and usb_config.h. Add usb_init_usblib() to usb.h, as a way of initializing the USB peripheral in terms of the data structures required by usb_lib. This is used by the new usb_cdcacm_enable(). Create new usb_lib_globals.h, with declarations for the usb_lib global state which is most used throughout the rest of the libmaple USB stack. Remove descriptors.c and usb_callbacks.[hc]; they are no longer necessary. Update the USB README accordingly. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Cleanups and renames.Marti Bolivar2011-10-181-2/+2
| | | | | | | | | Rename setupUSB() and disableUSB() to usb_cdcacm_enable() and usb_cdcacm_disable(), respectively. Remove usbSendHello(). This shouldn't exist. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Move some board-specific configuration to Wirish.Marti Bolivar2011-10-181-2/+2
| | | | | | | | | Create new BOARD_USB_DISC_DEV and BOARD_USB_DISC_BIT board-specific values. Use these as arguments to setupUSB() and disableUSB(). This helps make the USB stack more generic, and goes towards the resolution of an important FIXME. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* SerialUSB fixups.Marti Bolivar2011-05-041-74/+43
|
* Fixing USBSerial::read(void*, uint32).Marti Bolivar2011-05-041-3/+3
|
* fixed broken build from usb_serial.cppAJM2010-12-131-2/+2
| | | | oops
* made SerialUSB.read blockingAJM2010-12-131-2/+12
| | | | it should have been blocking before but wasnt. see bug #49
* more sphinx docsMarti Bolivar2010-10-111-0/+2
|
* wirish reformatted and code-styledMarti Bolivar2010-09-261-17/+24
|
* last usbserial change... please?bnewbold2010-07-221-3/+12
|
* added isConnected() to serialusbbnewbold2010-07-221-0/+12
|
* went with 50ms SerialUSB timeoutbnewbold2010-07-201-1/+1
|
* working serialUSB with timeoutbnewbold2010-07-191-5/+38
| | | | | | | | | | | as a temporary workaround for the fact that SerialUSB is often blocking, this crude implementation makes the low-level C usbSendBytes function non-blocking (with a return code of bytes sent) and implements a 2ms timeout in the wirish write() function. also adds begin(), end(), getDTR(), getRTS(), pending(). device is still initialized the old fashioned way during init() so that, eg, autoreset will work. includes a simple multi-test program.
* added getDTR and getRTS to usb.h, subtly modded how sendBytes checks for ↵AJM2010-06-111-1/+2
| | | | | | connection flip flopped back and forth on how much work should be done here. For now its like 5 lines of changes
* USB Serial read() fix:Perry Hung2010-06-051-1/+2
| | | | stupid, stupid mistake.
* Preliminary wirish USBSerial implementation.Perry Hung2010-06-041-0/+72
-updated examples -removed HardwareUSB -cleaned up a handful of includes