aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* usb_descriptors.h: Remove usbVcomDescriptor[...] values.Marti Bolivar2011-10-211-7/+0
| | | | | | These are CDC ACM-specific. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb_descriptors.h: Whitespace and column cleanups.Marti Bolivar2011-10-211-80/+80
| | | | | | Untabify, make (mostly) 80-column clean. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Rename descriptors.h -> usb_descriptors.h.Marti Bolivar2011-10-212-3/+3
| | | | | | Modify its include guard, and the files that include it, appropriately. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb.h: Move to libmaple/.Marti Bolivar2011-10-211-0/+0
| | | | | | | | | | | Apart from having an unstable API, usb.h is now a fairly good citizen of libmaple, so move it to live with the rest of the libmaple headers. Its device struct is still "struct usblib_dev". Leave that there; the asymmetry with the rest of the library is a good reminder that the API isn't really on equal footing with the rest of the library. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* USB: API cleanups.Marti Bolivar2011-10-214-25/+24
| | | | | | | | | | 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: API cleanups.Marti Bolivar2011-10-213-39/+31
| | | | | | | | | | | | | | Remove usbSuspend(), usbResumeInit(), usbResume(), the USB low-priority IRQ, and usbWaitReset() from usb.h. Also remove RESUME_STATE since it was only there for usbResume(). These functions don't need to be seen by anybody except for usb.c and usb_cdcacm.c, so move them there (altering their names to fit with libmaple style guidelines) and mark them static. Clean up includes in usb.c while we're there. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb.h: Mark API unstable.Marti Bolivar2011-10-211-0/+4
| | | | | | | | The USB API is heavily reliant on the ST stack, and additionally assumes that all USB is the USB FS peripheral. As such, it's going to have to change as we go forward. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Fix micros() bug.Marti Bolivar2011-10-201-1/+1
| | | | | | Thanks to ala42 for the fix. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish: Clean up includes; other fixups.Marti Bolivar2011-10-1812-29/+46
| | | | | | | | | | | | | | | | | | Clean up various core files' includes to fit this pattern: - Header files include what they use. - CPP files include their header first - Include order is libmaple proper headers, then wirish headers (modulo CPP rule above). wirish.h: Move HIGH and LOW to io.h, and the boolean and byte typedefs into wirish_types.h. These don't belong in wirish.h. Add include guards to wirish_debug.h. Oops. wirish_digital.cpp: Use standard bool instead of "boolean". Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Oops; actually remove usb_config.h.Marti Bolivar2011-10-181-45/+0
| | | | | | | | usb_config.h was supposed to be removed in d7afdbe6b41a77938863854a1e719398e6c35094; however, it looks like some merge conflicts stopped that from happening while I was rebasing. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb_cdcacm.c: CleanupsMarti Bolivar2011-10-181-200/+202
| | | | | | | | | Move the callbacks to the bottom of the file, and mark them static. Replace empty callbacks with NOP_Process in the callback tables. Remove prototype for nonexistent prep_and_reset(). Other miscellaneous fixups. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb.h, usb.c: CleanupsMarti Bolivar2011-10-182-22/+18
| | | | | | | | | Remove wIstr. This cleans up the control flow. wIstr is still declared in usb_lib/usb_regs.h, but it's unused throughout the code base. Remove bIntPackSOF. Only written, never read. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Remove usb_int.h, usb_int.h, usb_int.c.Marti Bolivar2011-10-184-235/+0
| | | | | | No longer used. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Clean up some globals with new struct usblib_dev.Marti Bolivar2011-10-184-79/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add struct usblib_dev (and USBLIB, a pointer to the singleton) to usb.h. USBLIB contains the global state which is used by functionality imported from usb_lib/. Consolidating global state into USBLIB will make it easier to remove later. Initial fields in struct usblib_dev are endpoint interrupt callbacks, a mask for what to handle in the low-priority USB interrupt, and device state. These replace pEpInt_IN, pEpInt_OUT; wInterrupt_Mask; and bDeviceState, respectively from usb_lib/, so remove their declarations from usb_lib_globals.h accordingly. Also remove unused SaveState declaration from usblib_globals.h. Move bDeviceState into 'state' field in usblib_dev. Device state type changes from DEVICE_STATE to usb_dev_state, volatile gets dropped, and enumerators get a 'USB_' prefix, but it's otherwise the same. usb_lib/ expects pInformation to point to Device_Info, pUser_Standard_Requests -> User_Standard_Requests, and pProperty -> Device_Property. Alter usb_init_usblib() to reflect these assumptions. Reorganize usb_lib_globals.h to make these assumptions more apparent to the reader. Modify usb_init_usblib() to take endpoint callbacks as arguments; update its caller in usb_cdcacm.c. usb_lib/ defines pInformation, pProperty, and pUser_Standard_Requests itself (in usb_init.c), but we have our own definitions (in usb.c). Remove the duplicates from usb.c. Also remove EPindex and Device_Info definitions from usb.c. Unused, and anyways already defined in usb_lib/usb_init.c. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Remove usb_config.h.Marti Bolivar2011-10-183-17/+28
| | | | | | Move its defines into usb_cdcacm.c and usb.[hc] as appropriate. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Disentangle CDC ACM functionality.Marti Bolivar2011-10-1815-894/+892
| | | | | | | | | | | | | | | | | | | | | 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.c: Use usb_reg_map.h; replace most of CTR_LP().Marti Bolivar2011-10-181-90/+244
| | | | | | This cuts down on some of the uglier dependencies. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Remove usbPowerOff(), move usbPowerOn() to usb_callbacks.c.Marti Bolivar2011-10-183-31/+15
| | | | | | | | | | | Remove usbPowerOn(), usbPowerOff() prototypes from usb.h. These aren't used outside of the USB subsystem, so they don't belong here. Move usbPowerOn() from usb.c to usb_callbacks.c. This is the only place where it's used. Remove the unused usbPowerOff() (from usb.c) altogether. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Prepare for moving some files to usb_reg_map.h.Marti Bolivar2011-10-184-21/+39
| | | | | | | | | | | | | usb_config.h: Remove usb_regs.h dependency; fix includes; add license. usb_callbacks.h: Change includes to the pieces of usb_lib/ it uses, which doesn't include usb_regs.h. descriptors.h: Remove unused usb_lib.h include. usb.h: Remove unused usb_lib.h include. Some cosmetic commenting. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add usb_reg_map.h and usb_reg_map.c.Marti Bolivar2011-10-183-0/+513
| | | | | | | | | | | usb_reg_map.h contains the usual register map and register bit definitions that libmaple convention requires. It also contains a variety of structs and convenience functions for accessing and manipulating endpoint registers, BTABLE entries, and PMA buffers. We'll be moving towards usb_reg_map.h instead of usb_lib/usb_regs.h. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Update README file.Marti Bolivar2011-10-181-20/+1
| | | | | | Various parts of it are no longer true, and some TODOs are now done. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Remove usb_hardware.c and usb_hardware.h.Marti Bolivar2011-10-185-221/+6
| | | | | | | These files contain a lot of duplicated and unused code. Move the relevant pieces that need to survive into usb.c and usb_callbacks.c. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Replace duplicated code with nvic.h API.Marti Bolivar2011-10-185-58/+19
| | | | | | | | | Replace calls to usbEnbISR()/usbDsbISR() with nvic_irq_enable()/nvic_irq_disable(). Remove ST-style code. Use nvic_sys_reset() instead of systemHardReset(). Rename some conflicting #defines that including nvic.h created. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb: Cleanups and renames.Marti Bolivar2011-10-184-24/+7
| | | | | | | | | 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-1810-42/+39
| | | | | | | | | 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>
* timer.h: fix timer_oc_set_mode().Marti Bolivar2011-10-121-4/+2
| | | | | | | | | timer_oc_set_mode() incorrectly writes to CCMR1 when channel is 2; fix this. Thanks to ala42 for the fix. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* reset.py: Hackishly silence DeprecationWarning.Marti Bolivar2011-10-071-2/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usart: Add usart_rx().Marti Bolivar2011-10-072-0/+17
| | | | | usart_rx() is a nonblocking USART receive. Add it for symmetry with usart_tx().
* Cosmetics.Marti Bolivar2011-09-291-4/+4
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add support for the Olimex STM32 H103 board.David Kiliani2011-09-277-0/+230
| | | | | | | | Pin layout and header files for the STM32 H103 prototype board from Olimex featuring an STM32F103RBT6 chip. This commit contains all necessary changes to compile with BOARD=olimex_stm32_h103. Signed-off-by: David Kiliani <mail@davidkiliani.de>
* Add Windows support to DFU installation tools.Marti Bolivar2011-09-262-54/+85
| | | | | | | Tweak Makefile further for cs-make on Windows. Add Windows support to support/scripts/reset.py Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* test-fsmc.cpp: Fixup; wait for user input before running test.Marti Bolivar2011-09-261-0/+1
|
* test-fsmc.cpp: Switch to SerialUSBMarti Bolivar2011-09-261-33/+28
| | | | | | | This messes with timing a little, but makes it faster to test. The timing was never perfect anyway, due to incrementing count. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* build-targets.mk: Tweak for Windows compilation.unknown2011-09-261-2/+1
| | | | | Make on Windows doesn't seem to like @echo without a string. Give it an empty one to keep it happy.
* rcc: Add RCC_USB to rcc_clk_id/rcc_dev_table.Marti Bolivar2011-09-242-0/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* nvic: Add nvic_sys_reset().Marti Bolivar2011-09-242-1/+14
| | | | | | This uses the SCB_AIRCR register to force a system reset. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* scb.h: Fix register map and bit definitions.Marti Bolivar2011-09-241-4/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the change log: This commit breaks backwards compatibility with 0.0.12. However, it appears that the previous version was incorrect, so these changes are necessary. The SCB register map type (scb_reg_map) appears to be adapted from versions specified by ARM; these include every possible register, and do not necessarily apply to the STM32, since some registers are implementation defined, to the extent that the implementation is allowed not to feature them at all. Thus, the current definition appears to be an overreach, since libmaple is STM32-specific. We should thus revise it based on ST's PM0056, where the STM32 SCB is specified. However, the ST docs appear to be buggy. In particular, they appear to contradict requirements made by ARM v7-M ARM with respect to the debug fault status register (DFSR), which ARM says must exist, but ST fails to specify (it does leave a DFSR-sized hole in the SCB memory layout, conveniently located next to some obvious typos which suggest that the section was not well-proofread). We defer to ARM and assume ST just forgot to document the register, and leave the DFSR field in struct scb_reg_map, since (based on my reading) its absence would be a silicon bug. All of the registers appearing in memory addresses higher than that of SCB_BFAR are not specified by ST, but the v7-M ARM appears to give some latitude on this to the implementation. Leave them in the source text, but put them in an appropriately-commented #if 0 block so that users who know they're there can yell at us if they find them missing. In this block, the Auxiliary Feature Register's field was "ADR" instead of "AFR" in struct scb_reg_map; fix this. Register bit definitions have been added which are named based on PM0056 when possible, and on the November 2010 "Derrata 2010_Q3" issue of the ARM v7-M Architecture Reference Manual, in the case of the DFSR. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* test-session: Add test case for disabling USB.Marti Bolivar2011-09-241-13/+10
| | | | | | | This replaces the previously undocumented 'd' option, which tested the pin mode INPUT_PULLDOWN. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Merge remote branch 'rryan/usb_fixes'Marti Bolivar2011-09-204-156/+90
|\
| * Missed one hard-coded structure size.RJ Ryan2011-09-181-1/+1
| | | | | | | | Signed-off-by: RJ Ryan <rryan@mit.edu>
| * Fix memory alignment of USB descriptor structures.RJ Ryan2011-09-183-155/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A variety of USB descriptor structures have been manually "unpacked". Instead of using the struct, their members were unpacked into the struct they were nested in. Additionally sizeof()'s were commented in favor of manual calculation of structure sizes. After uncommenting these changes, the USB CDC peripheral stopped correctly configuring with the host. The root problem with the structures is that GCC is padding them. By applying __attribute__((__packed__)), these problems are fixed. I removed all the instances of the workaround I saw within the USB code. Signed-off-by: RJ Ryan <rryan@mit.edu>
* | Add a libc abort() implementation.RJ Ryan2011-09-161-5/+28
| | | | | | | | | | | | | | | | | | | | | | The STL in particular relies on abort() for entering an error state. Without an abort() definition, the use of many STL primitives results in a link error because the default implementation of abort() uses _kill, _exit, and _getpid -- none of which are present. My abort() implementation writes an error message to the error USART and enters the throbbing-LED error state. Signed-off-by: RJ Ryan <rryan@mit.edu>
* | Add an __assert_func assertion handler so that libc does not use itsRJ Ryan2011-09-161-0/+9
|/ | | | | | | default implementation. This allows the use of assert() from libc's assert.h. Signed-off-by: RJ Ryan <rryan@mit.edu>
* Merge remote branch 'nzmichaelh/comment-fixups-2'Marti Bolivar2011-09-1415-4/+68
|\
| * Added more doxygen file level headers. Documented a few more functions.Michael Hope2011-09-1315-4/+68
| | | | | | | | Signed-off-by: Michael Hope <michaelh@juju.net.nz>
* | Make it easier to use the libmaple build system externally.Marti Bolivar2011-09-141-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It's been tricky for users to start their own projects while still using our build system. The current recommended practice to get this done involves modifying the top-level Makefile to add their module into LIBMAPLE_MODULES, and include their own rules.mk. Editing the repository Makefile is stupid and shouldn't be a necessary step. Instead of that, allow the environment to provide the initial value for LIBMAPLE_MODULES. This allows users to specify it on the command line. Also add WIRISH_PATH to the initial set of "useful" paths.
* | Update support/scripts/copy-to-ide.Marti Bolivar2011-09-131-2/+1
| | | | | | | | Oh, copy-to-ide. I long for your death.
* | [support/ld] Unify linker scripts.Marti Bolivar2011-09-1315-248/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new common.inc, which is common_rom.inc with some DEFINED(_FLASH_BUILD) usages thrown in to allow for RAM builds. It also uses a new REGION_RODATA region alias for read-only data. Move section .USER_FLASH to REGION_RODATA. This means it lives in RAM under RAM builds. Although this might be surprising, not doing so would make RAM builds useless. Modify the individual board linker scripts to properly set REGION_RODATA and _FLASH_BUILD before calling out to common.inc. Delete common_rom.inc, common_ram.inc, common_header.inc, in favor of common.inc. This should fix RAM builds on all boards.
* | [make] Factor out target/board configuration.Marti Bolivar2011-09-132-64/+103
| | | | | | | | | | | | | | | | | | Comment the Makefile more verbosely. It's been causing confusion on the forums. Add target-config.mk, this contains build configuration depending on the BOARD and MEMORY_TARGET variables. Its contents were cluttering up the Makefile and making it harder to read.
* | Makefile: Improve helpMarti Bolivar2011-09-131-9/+13
|/