Changes to the AVR demo's. IAR demo updated with new critical section method.

This commit is contained in:
Richard Barry 2006-08-28 09:35:31 +00:00
parent 41b142bae4
commit 97a570fa10
17 changed files with 866 additions and 318 deletions

View file

@ -52,6 +52,12 @@
#define portBYTES_USED_BY_RETURN_ADDRESS ( 2 )
/*-----------------------------------------------------------*/
/* Stores the critical section nesting. This must not be initialised to 0.
It will be initialised when a task starts. */
#define portNO_CRITICAL_NESTING ( ( unsigned portBASE_TYPE ) 0 )
unsigned portBASE_TYPE uxCriticalNesting = 0x50;
/*
* Perform hardware setup to enable ticks from timer 1, compare match A.
*/
@ -221,6 +227,9 @@ portSTACK_TYPE *pxTopOfHardwareStack;
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x031; /* R31 */
pxTopOfStack--;
*pxTopOfStack = portNO_CRITICAL_NESTING; /* Critical nesting is zero when the task starts. */
/*lint +e950 +e611 +e923 */
return pxTopOfStack;
@ -315,6 +324,22 @@ unsigned portCHAR ucHighByte, ucLowByte;
vTaskIncrementTick();
}
#endif
/*-----------------------------------------------------------*/
void vPortEnterCritical( void )
{
portDISABLE_INTERRUPTS();
uxCriticalNesting++;
}
/*-----------------------------------------------------------*/
void vPortExitCritical( void )
{
uxCriticalNesting--;
if( uxCriticalNesting == portNO_CRITICAL_NESTING )
{
portENABLE_INTERRUPTS();
}
}

View file

@ -70,15 +70,13 @@ Changes from V1.2.3
/*-----------------------------------------------------------*/
/* Critical section management. */
#define portENTER_CRITICAL() asm( "in r15, 3fh" ); \
asm( "cli" ); \
asm( "st -y, r15" )
extern void vPortEnterCritical( void );
extern void vPortExitCritical( void );
#define portENTER_CRITICAL() vPortEnterCritical()
#define portEXIT_CRITICAL() vPortExitCritical()
#define portEXIT_CRITICAL() asm( "ld r15, y+" ); \
asm( "out 3fh, r15" )
#define portDISABLE_INTERRUPTS() asm( "cli" );
#define portENABLE_INTERRUPTS() asm( "sti" );
#define portDISABLE_INTERRUPTS() asm( "cli" )
#define portENABLE_INTERRUPTS() asm( "sei" )
/*-----------------------------------------------------------*/
/* Architecture specifics. */