mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-24 11:43:09 +00:00
76e3fd3060
* Firmware, Bootloader: add f3 target. Refactor code to be portable across targets. * Firmware: remove bkpt * Makefile: debug agent. Debug: f3 platform throw openocd. * freertos-openocd helper * separate hal resources * return of input_dump app * using hew target resources abstration layer for backlight and blink * dirty hack for input driver, f3 has no charging pin * worked input interrupts * working display * F3: switch to 32mHz resonator * F3: configure SD_CS pin * NFC: port to F3. * fat uart app * sd card hal api * separate CC1101 spi config * faster spi gpio for sd card * Assets: disable LFS * Cube: disable css on LSE * Input: format code * Make: add bootloader source code to formatting rule * F3: enable rf by default, adjust clock settings, map all pins where they should be. * libs for coreglitch_demo_0 * nvic priority * bus clocks all to 64 * lf-rfid timer and pin * irda * ir rx setup * tim2 irq handler * Makefile: environment aware mkdir * Makefile, Irukagotchi: commit seq number. * split falling and rising ir rx events * Makefile: proper git branch detect on old git. Firmware: api fix. * fix irda * Makefile,Irukagotchi: date timestamp. * NFC: adjust SPI speed * Irukagotchi: format code * Make: add blackmagic debug in host mode * Makefile: detach blackmagic from terminal signals * Makefile,Irukagotchi: stamp target * add F3 bootloader/firmware to CI Co-authored-by: Aleksandr Kutuzov <aku@plooks.com> Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com> Co-authored-by: aanper <mail@s3f.ru>
59 lines
No EOL
1.6 KiB
C
59 lines
No EOL
1.6 KiB
C
#include "cmsis_os.h"
|
|
#include "api-hal-task.h"
|
|
|
|
//-----------------------------cmsis_os2.c-------------------------------
|
|
// helpers to get isr context
|
|
// get arch
|
|
#ifndef __ARM_ARCH_6M__
|
|
#define __ARM_ARCH_6M__ 0
|
|
#endif
|
|
#ifndef __ARM_ARCH_7M__
|
|
#define __ARM_ARCH_7M__ 0
|
|
#endif
|
|
#ifndef __ARM_ARCH_7EM__
|
|
#define __ARM_ARCH_7EM__ 0
|
|
#endif
|
|
#ifndef __ARM_ARCH_8M_MAIN__
|
|
#define __ARM_ARCH_8M_MAIN__ 0
|
|
#endif
|
|
#ifndef __ARM_ARCH_7A__
|
|
#define __ARM_ARCH_7A__ 0
|
|
#endif
|
|
|
|
// get masks
|
|
#if((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M_MAIN__ == 1U))
|
|
#define IS_IRQ_MASKED() ((__get_PRIMASK() != 0U) || (__get_BASEPRI() != 0U))
|
|
#elif(__ARM_ARCH_6M__ == 1U)
|
|
#define IS_IRQ_MASKED() (__get_PRIMASK() != 0U)
|
|
#elif(__ARM_ARCH_7A__ == 1U)
|
|
/* CPSR mask bits */
|
|
#define CPSR_MASKBIT_I 0x80U
|
|
|
|
#define IS_IRQ_MASKED() ((__get_CPSR() & CPSR_MASKBIT_I) != 0U)
|
|
#else
|
|
#define IS_IRQ_MASKED() (__get_PRIMASK() != 0U)
|
|
#endif
|
|
|
|
// get is irq mode
|
|
#if(__ARM_ARCH_7A__ == 1U)
|
|
/* CPSR mode bitmasks */
|
|
#define CPSR_MODE_USER 0x10U
|
|
#define CPSR_MODE_SYSTEM 0x1FU
|
|
|
|
#define IS_IRQ_MODE() ((__get_mode() != CPSR_MODE_USER) && (__get_mode() != CPSR_MODE_SYSTEM))
|
|
#else
|
|
#define IS_IRQ_MODE() (__get_IPSR() != 0U)
|
|
#endif
|
|
|
|
// added osKernelGetState(), because KernelState is a static var
|
|
#define IS_IRQ() (IS_IRQ_MODE() || (IS_IRQ_MASKED() && (osKernelGetState() == osKernelRunning)))
|
|
//-------------------------end of cmsis_os2.c----------------------------
|
|
|
|
bool task_is_isr_context(void) {
|
|
return IS_IRQ();
|
|
}
|
|
|
|
bool task_equal(TaskHandle_t a, TaskHandle_t b) {
|
|
if(a == NULL || b == NULL) return false;
|
|
return a == b;
|
|
} |