mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-21 22:11:57 -04:00
Updated the sleep function to ensure it left interrupts disabled when returning.
This commit is contained in:
parent
2cf9f1ac8c
commit
af623460a6
|
@ -132,14 +132,14 @@
|
||||||
<com_atmel_avrdbg_tool_samice>
|
<com_atmel_avrdbg_tool_samice>
|
||||||
<ToolType>com.atmel.avrdbg.tool.samice</ToolType>
|
<ToolType>com.atmel.avrdbg.tool.samice</ToolType>
|
||||||
<ToolName>J-Link-OB-SAM3U128</ToolName>
|
<ToolName>J-Link-OB-SAM3U128</ToolName>
|
||||||
<ToolNumber>000480008423</ToolNumber>
|
<ToolNumber>000480008435</ToolNumber>
|
||||||
<KeepTimersRunning>true</KeepTimersRunning>
|
<KeepTimersRunning>true</KeepTimersRunning>
|
||||||
<OverrideVtor>false</OverrideVtor>
|
<OverrideVtor>false</OverrideVtor>
|
||||||
<OverrideVtorValue>
|
<OverrideVtorValue>
|
||||||
</OverrideVtorValue>
|
</OverrideVtorValue>
|
||||||
<Channel>
|
<Channel>
|
||||||
<host>127.0.0.1</host>
|
<host>127.0.0.1</host>
|
||||||
<port>4788</port>
|
<port>1882</port>
|
||||||
<ssl>False</ssl>
|
<ssl>False</ssl>
|
||||||
</Channel>
|
</Channel>
|
||||||
<ToolOptions>
|
<ToolOptions>
|
||||||
|
|
|
@ -263,6 +263,7 @@ void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )
|
||||||
uint32_t ulAlarmValue, ulCompleteTickPeriods;
|
uint32_t ulAlarmValue, ulCompleteTickPeriods;
|
||||||
eSleepModeStatus eSleepAction;
|
eSleepModeStatus eSleepAction;
|
||||||
portTickType xModifiableIdleTime;
|
portTickType xModifiableIdleTime;
|
||||||
|
enum sleepmgr_mode xSleepMode;
|
||||||
|
|
||||||
/* THIS FUNCTION IS CALLED WITH THE SCHEDULER SUSPENDED. */
|
/* THIS FUNCTION IS CALLED WITH THE SCHEDULER SUSPENDED. */
|
||||||
|
|
||||||
|
@ -331,9 +332,15 @@ portTickType xModifiableIdleTime;
|
||||||
means the application defined code has already executed the WAIT
|
means the application defined code has already executed the WAIT
|
||||||
instruction. */
|
instruction. */
|
||||||
if( xModifiableIdleTime > 0 )
|
if( xModifiableIdleTime > 0 )
|
||||||
|
{
|
||||||
|
/* Find the deepest allowable sleep mode. */
|
||||||
|
xSleepMode = sleepmgr_get_sleep_mode();
|
||||||
|
|
||||||
|
if( xSleepMode != SLEEPMGR_ACTIVE )
|
||||||
{
|
{
|
||||||
/* Sleep until something happens. */
|
/* Sleep until something happens. */
|
||||||
sleepmgr_enter_sleep();
|
bpm_sleep( BPM, xSleepMode );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allow the application to define some post sleep processing. */
|
/* Allow the application to define some post sleep processing. */
|
||||||
|
@ -347,7 +354,6 @@ portTickType xModifiableIdleTime;
|
||||||
|
|
||||||
/* Re-enable interrupts - see comments above the cpsid instruction()
|
/* Re-enable interrupts - see comments above the cpsid instruction()
|
||||||
above. */
|
above. */
|
||||||
#warning The sleep manager will have re-enabled interrupts already, does this matter?
|
|
||||||
__asm volatile( "cpsie i" );
|
__asm volatile( "cpsie i" );
|
||||||
|
|
||||||
if( ulTickFlag != pdFALSE )
|
if( ulTickFlag != pdFALSE )
|
||||||
|
|
|
@ -294,5 +294,7 @@ void bpm_sleep(Bpm *bpm, uint32_t sleep_mode)
|
||||||
* Please note that we should probably use something like
|
* Please note that we should probably use something like
|
||||||
* cpu_leave_critical(), using set_pri_mask(0)
|
* cpu_leave_critical(), using set_pri_mask(0)
|
||||||
*/
|
*/
|
||||||
cpu_irq_enable();
|
/* In this demo interrupts are managed by the FreeRTOS kernel and must not
|
||||||
|
be altered here so the following line has been removed _RB_
|
||||||
|
cpu_irq_enable(); */
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,9 @@ static inline void bpm_sleep(Bpm *bpm, uint32_t sleep_mode)
|
||||||
* Please note that we should probably use something like
|
* Please note that we should probably use something like
|
||||||
* cpu_leave_critical(), using set_pri_mask(0)
|
* cpu_leave_critical(), using set_pri_mask(0)
|
||||||
*/
|
*/
|
||||||
cpu_irq_enable();
|
/* In this demo interrupts are managed by the FreeRTOS kernel and must not
|
||||||
|
be altered here so the following line has been removed _RB_
|
||||||
|
cpu_irq_enable(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -140,19 +140,6 @@ to exclude the API function. */
|
||||||
#define INCLUDE_vTaskDelayUntil 1
|
#define INCLUDE_vTaskDelayUntil 1
|
||||||
#define INCLUDE_vTaskDelay 1
|
#define INCLUDE_vTaskDelay 1
|
||||||
|
|
||||||
/* FreeRTOS+CLI definitions. */
|
|
||||||
|
|
||||||
/* Dimensions a buffer into which command outputs can be written. The buffer
|
|
||||||
can be declared in the CLI code itself, to allow multiple command consoles to
|
|
||||||
share the same buffer. For example, an application may allow access to the
|
|
||||||
command interpreter by UART and by Ethernet. Sharing a buffer is done purely
|
|
||||||
to save RAM. Note, however, that the command console itself is not re-entrant,
|
|
||||||
so only one command interpreter interface can be used at any one time. For
|
|
||||||
that reason, no attempt at providing mutual exclusion to the buffer is
|
|
||||||
attempted. */
|
|
||||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 400
|
|
||||||
|
|
||||||
|
|
||||||
/* Cortex-M specific definitions. */
|
/* Cortex-M specific definitions. */
|
||||||
|
|
||||||
#ifdef __NVIC_PRIO_BITS
|
#ifdef __NVIC_PRIO_BITS
|
||||||
|
@ -192,5 +179,11 @@ void vPostSleepProcessing( unsigned long xExpectedIdleTime );
|
||||||
#define configPRE_SLEEP_PROCESSING( xExpectedIdleTime ) vPreSleepProcessing( xExpectedIdleTime );
|
#define configPRE_SLEEP_PROCESSING( xExpectedIdleTime ) vPreSleepProcessing( xExpectedIdleTime );
|
||||||
#define configPOST_SLEEP_PROCESSING( xExpectedIdleTime ) vPostSleepProcessing( xExpectedIdleTime );
|
#define configPOST_SLEEP_PROCESSING( xExpectedIdleTime ) vPostSleepProcessing( xExpectedIdleTime );
|
||||||
|
|
||||||
|
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
|
||||||
|
standard names. */
|
||||||
|
#define vPortSVCHandler SVC_Handler
|
||||||
|
#define xPortPendSVHandler PendSV_Handler
|
||||||
|
#define xPortSysTickHandler SysTick_Handler
|
||||||
|
|
||||||
#endif /* FREERTOS_CONFIG_H */
|
#endif /* FREERTOS_CONFIG_H */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue