From 55a4b4536f5296ac8ed25e1e39f86d7c5d50c43a Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 5 Mar 2016 18:23:53 +0200 Subject: [PATCH] Add irqs.h. * Defines IRQ priorities and functions. --- src/omv/irqs.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/omv/irqs.h diff --git a/src/omv/irqs.h b/src/omv/irqs.h new file mode 100644 index 000000000..a2304f322 --- /dev/null +++ b/src/omv/irqs.h @@ -0,0 +1,47 @@ +/* + * This file is part of the OpenMV project. + * Copyright (c) 2013/2014 Ibrahim Abdelkader + * This work is licensed under the MIT license, see the file LICENSE for details. + * + * Image library. + * + */ +#ifndef __IRQS_H__ +#define __IRQS_H__ +#include + +#define IRQ_SYSTICK_PRE_PRI (0) +#define IRQ_SYSTICK_SUB_PRI (0) + +#define IRQ_FLASH_PRE_PRI (1) +#define IRQ_FLASH_SUB_PRI (0) + +#define IRQ_DCMI_PRE_PRI (2) +#define IRQ_DCMI_SUB_PRI (0) + +#define IRQ_DMA21_PRE_PRI (2) +#define IRQ_DMA21_SUB_PRI (0) + +#define IRQ_SDIO_PRE_PRI (3) +#define IRQ_SDIO_SUB_PRI (0) + +#define IRQ_DMA23_PRE_PRI (4) +#define IRQ_DMA23_SUB_PRI (0) + +#define IRQ_OTGFS_PRE_PRI (5) +#define IRQ_OTGFS_SUB_PRI (0) + +#define IRQ_TIM3_PRE_PRI (6) +#define IRQ_TIM3_SUB_PRI (0) + +#define IRQ_PENDSV_PRE_PRI (15) +#define IRQ_PENDSV_SUB_PRI (15) + + +// Disable IRQs with a priority higher than or equal to "priority" +static inline void irq_set_base_priority(uint32_t priority) { + __set_BASEPRI(priority << (8 - __NVIC_PRIO_BITS)); + __DSB(); __ISB(); // Data/Instruction barriers +} + +#endif // __IRQS_H__