summaryrefslogtreecommitdiff
path: root/src/stm/ao_timer.c
Commit message (Collapse)AuthorAge
* altos: add ao_time_ns APIKeith Packard2019-02-25
| | | | | | | This provides nano-second resolution times by reading the systick value (which runs at 250ns ticks on stm). Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Remove 8051 address space specifiersKeith Packard2018-10-13
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Allow timer interrupt without needing tick countKeith Packard2018-08-15
| | | | | | | This saves a bit of space in the fox1ihu loader which uses the timer interrupt to poke the watchdog. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Enable HSI timer when HAS_ADC_SINGLE is setKeith Packard2018-05-28
| | | | | | The ADC unit always uses the HSI timer. 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>
* Switch from GPLv2 to GPLv2+Keith Packard2016-07-12
| | | | 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: 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: Enable system timer in flash loader and prod watchdog with itKeith Packard2014-02-08
| | | | | | | This makes it possible to reflash the board without needing to disable the watchdog. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Make sure we switch to MSI during timer initKeith Packard2013-08-28
| | | | | | | Need to ensure that the CPU is actually using the MSI during timer init or all of the other clock changes won't work Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Remove stale timer definesKeith Packard2013-08-28
| | | | | | Stuff from when we weren't using systick Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Allow core timer to be excluded from buildKeith Packard2013-05-07
| | | | | | | This removes all of the support for the base 100Hz timer from the system, saving space when not needed Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use SYSTICK on STM32LKeith Packard2013-05-07
| | | | | | | It's probably more power efficient than using one of the timers, and it's certainly easier to configure. Signed-off-by: Keith Packard <keithp@keithp.com>
* altoslib/altosui: Carry receiver status around in AltosListenerStateKeith Packard2013-04-09
| | | | | | | | | | This moves the crc_errors into the new structure and adds a receiver battery voltage value there as well. Now the receiver status can be monitored separately from the flight status. That also means that code receiving state updates should be prepared to accept missing listener or flight state values. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Provide ao_task_alarm_tick to reduce per-tick costKeith Packard2012-10-26
| | | | | | | Cache the next wakeup time and check that before jumping to the task code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add task queues.Keith Packard2012-10-25
| | | | | | | | | This replaces the array-based scheduler with a queue-based one instead. It should have the same basic scheduling semantics, but it walks shorter lists for each operation, making it much more efficient when the system has a lot of tasks. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Replace __critical usage with ao_arch_critical as neededKeith Packard2012-10-25
| | | | | | | | | | | | | sdcc offers __critical as a machine-independent way to block interrupts, but as gcc doesn't, we need to use a compiler-independent construct instead. ao_arch_critical has been around since the AVR port, but some old __critical usages remained. This fixes a bunch of random hangs when communicating with MM over USB or the radio as the various stdio loops were running without interrupts blocked between the test and the sleep. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Stop spewing clock out PA8 pinKeith Packard2012-10-21
| | | | | | | This was used to debug the clock bringup, but is not useful anymore, and probably a bad idea to boot. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Fix basic time interval to 10ms -- was 10.1msKeith Packard2012-09-09
| | | | | | Counting from 0 to 100 takes 10.1ms, so count to 99 instead. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Fix ao_delay function and move from per-chip code to ao_task.cKeith Packard2012-08-28
| | | | | | | ao_delay hasn't been chip-specific for a long time, and it had a bug in not calling ao_clear_alarm. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Trigger sample complete when all data are readyKeith Packard2012-08-26
| | | | | | | This has each sensor mark a bit in the current data record which is then sent for processing when all of the data are present. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add button driver and event queueKeith Packard2012-08-06
| | | | | | | With this, a single task can wait for any button or quadrature input device. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make ao_tick_count visibleKeith Packard2012-07-16
| | | | | | | Necessary to fetch it when interrupts are already disabled as we can't call ao_time then. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Optimize FEC encode and decodeKeith Packard2012-06-26
| | | | | | | | | | | | | Integrate interleaving, CRC and padding within the decode/encode functions. Provide for ISR priorities so that the 1120 RX interrupt takes precedence over the other interrupts or we risk losing bits. Optimize the viterbi decoder a bit (goes from 10ms per packet to 7ms per packet). Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Timers clock base depends on perhipheral bus prescalers tooKeith Packard2012-06-01
| | | | | | | | For some weird reason, a non-unity perhipheral bus clock scaler affects the base of the various timers; this left the 100Hz tick running at 200Hz. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Rework how STM clocks are initialized.Keith Packard2012-04-14
| | | | | | | | | | Clean all of the RCC configuration up after turning on the clocks. Use the MSI clock during initialization to avoid messing around with the HSI clock temporarily. Allow for an external clock on the HSE line. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make STM clock configuration per-product. Fix 32MHz CPU speedKeith Packard2012-04-09
| | | | | | | | | | This moves all of the STM clock configuration into ao_pins.h so that each product can configure it separately. While doing this, I discovered that the flash memory mode (64-bit, prefetch, latency 1) wasn't actually getting set, which is why the CPU refused to work at 32MHz. Signed-off-by: Keith Packard <keithp@keithp.com>
* Basic OS running on STM32LKeith Packard2012-03-28
| | | | | | This gets stm-demo working Signed-off-by: Keith Packard <keithp@keithp.com>
* Add stm-demo programKeith Packard2012-03-28
| | | | | | This runs AltOS and talks over the serial port. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add STM platform and stm-bringup demo programKeith Packard2012-03-28
The stm-bringup doesn't run altos, it just initializes the device and writes stuff over a serial port. Works on the STM32L Discovery board at least, should do stuff on other boards too. Signed-off-by: Keith Packard <keithp@keithp.com>