summaryrefslogtreecommitdiff
path: root/src/stm
Commit message (Collapse)AuthorAge
...
* altos/stm: Add nvic priority register fields. Add more TIM234 defines.Keith Packard2017-02-20
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Make i2c code handle PCLK1 of 24MHzKeith Packard2017-02-20
| | | | | | Just adds the necessary defines to the code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Allow DMA channels to be hijacked by other codeKeith Packard2017-02-20
| | | | | | | This lets code which needs finer control over DMA to use the channel without interference, and leaves the DMA engine running so that it can. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Allow use basepri instead of primask for masking interruptsKeith Packard2017-02-20
| | | | | | | | | | | | This allows for high priority interrupts (priority 0) to run, even when other interrupts are blocked. Code executing in such interrupt handlers must not attempt to control task execution as that will race with the scheduler. Select this by defining AO_NONMASK_INTERRUPT in ao_pins.h. non-maskable interrupt priority is AO_STM_NVIC_NONMASK_PRIORITY Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Interrupt priority is in the upper bits of the priority maskKeith Packard2017-02-20
| | | | | | | | | | Because the STM32L only offers 16 priority levels, the bottom four bits of each priority mask are not used. All of the interrupt priority settings in the system were using values < 16, making them all effectively the same. Fix that by moving them into the upper 4 bits and using symbolic constants everywhere. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/arm: Align data so that gcc 5.4 doesn't do byte-accesses. Add -Wcast-alignKeith Packard2016-12-17
| | | | | | | | | | | | | | | | | | | | | | Gcc 5.4.1 tracks alignment of data through assignments, so that a uint32_t pointer which comes from byte-aligned uint8_t data: extern uint8_t foo[]; uint32_t *q = (void *) foo; Fetches and stores through this pointer are done bytewise. This is slow (meh), but if q references a device register, things to bad very quickly. This patch works around this bug in the compiler by adding __attribute__((aligned(4))) tags to some variables, or changing them from uint8_t to uint32_t. Places doing this will now be caught as I've added -Wcast-align to the compiler flags. That required adding (void *) casts, after the relevant code was checked to make sure the compiler could tell that the addresses were aligned. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Make ao_usb_set_address static. Saves a bunch of text spaceKeith Packard2016-12-12
| | | | | | | I'm sure this makes the function end up in-lined, which saves enough text space to fit the flash loader in ROM again. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Set SPI slave DMA priority to HIGH/VERY_HIGHKeith Packard2016-09-03
| | | | | | | | | Set spi slave DMA priority MOSI to HIGH and MISO to VERY_HIGH. Slave SPI doesn't have the luxury of slowing down when the system is busy, so provide it maximum memory bandwidth to try and keep up with the master. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Set i2c recv DMA to HIGHKeith Packard2016-09-03
| | | | | | | Make sure receive DMA is higher than any TX dma so that it always runs in preference. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Set MISO DMA priority to HIGH to avoid OVRKeith Packard2016-09-03
| | | | | | | | | When the MISO DMA priority is too low, and the processor gets busy, it's possible for SPI input to overrun the processor, which causes the MISO DMA to get out of sync and never finish. Set the MISO DMA priority to HIGH to avoid this. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Create funcs to set SPI DMA parametersKeith Packard2016-09-03
| | | | | | | | Instead of having nearly duplicate versions of the SPI DMA configuration calls, create helper funcs that do most of the work so that the SPI API funcs are shorter and clearer. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Make ao_spi_duplex out pointer constKeith Packard2016-09-03
| | | | | | Provides a bit better typechecking opportunities for this function. Signed-off-by: Keith Packard <keithp@keithp.com>
* Switch from GPLv2 to GPLv2+Keith Packard2016-07-12
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: clean up ao_exti_enableKeith Packard2016-06-29
| | | | | | Was computing (1 << pin) twice for no good reason. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Add better byte-level SPI apiKeith Packard2016-06-29
| | | | | | | | This provides inline functions for sending and receiving individual bytes, and setup/finish functions to wrap them in. This make the byte sending respect the SPI hardware interface requirements. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Clean up spi_enable/disable_index functionsKeith Packard2016-06-29
| | | | | | These had an extra level of switch nesting for no good reason. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: move spi execution to common ao_spi_runKeith Packard2016-06-29
| | | | | | | | This regularizes SPI hardware use and ensures that the device is turned off after it has been used and that the status register is back to 'normal' the next time through. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add STM SPI debuggingKeith Packard2016-06-29
| | | | | | | This dumps out the SPI hardware state and history of SPI operations when compiled with -DDEBUG=1. Without that, this patch does nothing. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add STM DMA debuggingKeith Packard2016-06-29
| | | | | | | This provides a command that shows current DMA operations when compiled with -DDEBUG=1. Without that, this patch has no effect. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Change ao_spi_send_sync definition to take const sourceKeith Packard2016-06-29
| | | | | | Provides for a bit better error checking. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Add more SPI status register bitsKeith Packard2016-06-29
| | | | | | These weren't the original version of the docs that we had. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: use 0xff for dma mutex value for allocated mutexesKeith Packard2016-06-29
| | | | | | | DMA channels which are 'allocated' can't be shared. Instead of using the value '1' in the related 'mutex', use 0xff which won't match any task. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: remove ao_dma_abortKeith Packard2016-06-29
| | | | | | This function isn't used anywhere. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Block interrupts while waking tasks sleeping on timers.Keith Packard2016-06-29
| | | | | | | | Interrupts may not be blocked in the timer ISR, but they need to be while walking the pending timer list and moving tasks back to the run queue. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Handle USB reset in STM32L usb driverKeith Packard2016-06-10
| | | | | | | Just like lpc and stmf0, deal with the host resetting the bus while rebooting by restoring all usb-related data to the initial values. Signed-off-by: Keith Packard <keithp@keithp.com>
* Revert "altos/stm: Run scheduler code on interrupt stack"Keith Packard2016-04-30
| | | | | | This reverts commit 6a9546413d6a236c010e806b50506d870961d074. This causes the device to stop reliably handling interrupts.
* altos/stm32l: Add support for software-driven HW flow controlKeith Packard2016-04-25
| | | | | | | | This allows applications to request that the flow control bits be driven from software rather than hardware, permitting more flexible pin configuration. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use TXE instead of TC for serial on STM32lKeith Packard2016-04-25
| | | | | | | Using TXE allows for full-speed communication, rather than waiting for each byte to be transmitted before inserting the next into the queue. Signed-off-by: Keith Packard <keithp@keithp.com>
* Debug bits for telebtKeith Packard2016-04-25
|
* altos: Add ao_gpi_set/clr_bits functionsKeith Packard2016-04-13
| | | | | | These set or clear a group of bits in a single GPIO register all together. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add one-byte SPI output routine for LPC and STM coresKeith Packard2016-03-26
| | | | | | This allows for SPI output at interrupt time, one byte at a time. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Allow apps to define different stack sizeKeith Packard2016-03-26
| | | | | | | While 512 bytes is a reasonable size, sometimes apps don't have that much stack space. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Validate current task SP in interrupt by looking at PSPKeith Packard2016-03-26
| | | | | | | | | We use a separate stack pointer for task code, which means we can verify that it is in range in any interrupt handler. This adds checks for the task stack (under #ifdef DEBUG) that run in ao_wakeup as well as at every timer interrupt. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Run scheduler code on interrupt stackKeith Packard2016-03-26
| | | | | | This provides a bit more room for tasks on their stack Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Expose fast timer API from kernel/Keith Packard2016-03-18
| | | | | | This allows multiple SoCs to provide the same driver interface Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Get stm32l pwm driver workingKeith Packard2015-12-25
| | | | | | | | | | | | | Fix the CCMR1_OC1PE and CCMR2_OC3PE values. Disable clock when no PWM outputs are running. Fix the apb1enr value for the timer. Set ARR value to PWM_MAX - 1 -- ARR is off by one. Sets the GPIO pins to 40MHz bandwidth for sharper edges. Tested on EasyMega, but that code is not included as it breaks the companion protocol. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add TeleMega v2.0, including PWM driverKeith Packard2015-12-25
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Replace ao_alarm/ao_clear_alarm with ao_sleep_forKeith Packard2015-02-13
| | | | | | | | | | | | | | | | Having arbitrary alarms firing in the middle of complicated device logic makes no sense at all. Therefore only correct use of ao_alarm and ao_clear_alarm was around a specific ao_sleep call, with correct recovery in case the alarm fires. This patch replaces all uses of ao_alarm/ao_sleep/ao_clear_alarm with ao_sleep_for, a new function which takes the alarm timeout directly. A few cases which weren't simply calling ao_sleep have been reworked to pass the timeout value down to the place where sleep *is* being called, and having that code deal with the return correctly. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Add ability to delay STDIO usage for serial portsKeith Packard2015-02-01
| | | | | | | | Bluetooth needs to delay adding the serial port to stdio until the link is up and running. The cc1111 serial driver had DELAY_SERIAL_*_STDIN bits which have been added to the STM serial driver. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Fix typo in stm32l.hKeith Packard2015-01-26
| | | | | | This crept in while working on the stmf0 bits. oops. Signed-off-by: Keith Packard <keithp@keithp.com>
* ao-tools: Add --wait option to ao-usbloadKeith Packard2015-01-25
| | | | | | | This waits forever for USB writes to complete, instead of timing out after five seconds. Useful when debugging the device. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add support for TeleBT v3.0Keith Packard2015-01-24
| | | | | | | Add support to the BTM driver for non-CC1111 interrupts Add HW flow control to STM serial driver Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Mark STM ao_spi_send as taking const pointerKeith Packard2014-10-24
| | | | | | We don't write to this, so let it be const for type checking Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Rework packet receive for cc1120Keith Packard2014-07-05
| | | | | | | | | | Instead of blocking on PQT, just set up the receiver to start going and when the first bit interrupt comes in, grab the SPI bus if possible and configure it for reception. This improves sensitivity in the radio by a significant amount while making the code conceptually a bit nicer. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Fake flight code changes in kernel and stmKeith Packard2014-05-27
| | | | | | | Redirects data input from local sensors to USB sourced data, leaving USB enabled when the computer goes into pad mode. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: stm and lpc ao_boot.h were identical. move to kernel.Keith Packard2014-05-15
| | | | | | | These two files were absolutely identical, so share them by moving under kernel instead.x Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use explicit boot loader signal in ao_boot_rebootKeith Packard2014-05-15
| | | | | | | | Instead of just "knowing" that ao_boot_loader will be passed zero when the application wants to get back to the boot loader, explicitly define the values so that both sides always agree. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Use #define'd constants for GPIO register addressesKeith Packard2014-05-12
| | | | | | | This lets the compiler short-circuit the tests in ao_enable_gpio and ao_disable_gpio to save a bit of code space and time. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Figure out available flash space based on chip id registersKeith Packard2014-05-12
| | | | | | | Look at the flash size and the device id registers to figure out how much flash is available. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: White space fix in ao_boot_pin.cKeith Packard2014-05-12
|