git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13505 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2020-04-02 15:44:22 +00:00
parent 250fe89a2b
commit 1d976bbaec
1 changed files with 25 additions and 0 deletions

View File

@ -108,6 +108,17 @@
/* Module pre-compile time settings. */ /* Module pre-compile time settings. */
/*===========================================================================*/ /*===========================================================================*/
/**
* @brief Number of MPU regions to be saved/restored during context switch.
* @note The first region is always region zero.
* @note The use of this option has an overhead of 8 bytes for each
* region for each thread.
* @note Allowed values are 0..4, zero means none.
*/
#if !defined(PORT_SWITCHED_REGIONS_NUMBER) || defined(__DOXYGEN__)
#define PORT_SWITCHED_REGIONS_NUMBER 0
#endif
/** /**
* @brief Enables an alternative timer implementation. * @brief Enables an alternative timer implementation.
* @details Usually the port uses a timer interface defined in the file * @details Usually the port uses a timer interface defined in the file
@ -173,6 +184,10 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if (PORT_SWITCHED_REGIONS_NUMBER < 0) || (PORT_SWITCHED_REGIONS_NUMBER > 4)
#error "invalid PORT_SWITCHED_REGIONS_NUMBER value"
#endif
/** /**
* @name Port information * @name Port information
* @{ * @{
@ -414,6 +429,15 @@ struct port_context {
#define PORT_SETUP_CONTEXT_FPU(tp) #define PORT_SETUP_CONTEXT_FPU(tp)
#endif #endif
/**
* @brief Initialization of MPU part of thread context.
*/
#if (PORT_SWITCHED_REGIONS_NUMBER == 0) || defined(__DOXYGEN__)
#define PORT_SETUP_CONTEXT_MPU(tp)
#else
#define PORT_SETUP_CONTEXT_MPU(tp)
#endif
/** /**
* @brief Platform dependent part of the @p chThdCreateI() API. * @brief Platform dependent part of the @p chThdCreateI() API.
* @details This code usually setup the context switching frame represented * @details This code usually setup the context switching frame represented
@ -430,6 +454,7 @@ struct port_context {
(tp)->ctx.sp->pc = (uint32_t)__port_thread_start; \ (tp)->ctx.sp->pc = (uint32_t)__port_thread_start; \
(tp)->ctx.sp->xpsr = (uint32_t)0x01000000; \ (tp)->ctx.sp->xpsr = (uint32_t)0x01000000; \
PORT_SETUP_CONTEXT_FPU(tp); \ PORT_SETUP_CONTEXT_FPU(tp); \
PORT_SETUP_CONTEXT_MPU(tp); \
} while (false) } while (false)
/** /**