Skip to content
Snippets Groups Projects
nvicconf.h 3.02 KiB
/**
 *    ||          ____  _ __
 * +------+      / __ )(_) /_______________ _____  ___
 * | 0xBC |     / __  / / __/ ___/ ___/ __ `/_  / / _ \
 * +------+    / /_/ / / /_/ /__/ /  / /_/ / / /_/  __/
 *  ||  ||    /_____/_/\__/\___/_/   \__,_/ /___/\___/
 *
 * Crazyflie control firmware
 *
 * Copyright (C) 2011-2012 Bitcraze AB
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, in version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * nvicconf.c - Interrupt priority configuration
 *
 * The STM32 has 16 priorities to choose from where 0 is the
 * highest priority. They are now configured using no groups.
 *
 * Interrupt functions that call FreeRTOS FromISR functions
 * must have a interrupt number 10 and above which is currently
 * set by configMAX_SYSCALL_INTERRUPT_PRIORITY.
 */
#ifndef NVIC_CONF_H_
#define NVIC_CONF_H_

/*
 Interrupt priority organisation in Crazyflie:

 In Cortex-M low priority number is higher priority. Hence priority 0 is the
 highest priority interrupt and priority 15 the lowest (STM32 implements
 4 priority bits)

 Interrupts bellow MAX_SYSCALL_INTERRUPT_PRIORITY cannot call any RTOS
 functions! They should be handled like some kind of softdevice, running above
 the OS.

 3 Interrupt level are defined
  - NVIC_LOW_PRI
  - NVIC_MID_PRI
  - NVIC_HIGH_PRI
 The aim is to simplify interrupt handling and to document why any special case
 is required.

 15 -
 14 -
 13 - NVIC_LOW_PRI
 12 - NVIC_ADC_PRI
 11 - NVIC_RADIO_PRI
 10 - NVIC_MID_PRI
  9 -
  8 -
  7 - NVIC_HIGH_PRI
  6 -
  5 -                                     <-- MAX_SYSCALL_INTERRUPT_PRIORITY
  4 ! NVIC_I2C_PRI_LOW NVIC_TRACE_TIM_PRI --- Does not call any RTOS function
  3 ! NVIC_I2C_PRI_HIGH
  2 !
  1 !
  0 !
*/