From 8c89d1681e6de2192e9485c9ff38c7f298401596 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 17 Apr 2013 08:55:16 +0000 Subject: [PATCH] Update yield code in RX200/Renesas compiler port. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1870 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../Source/portable/Renesas/RX200/portmacro.h | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h index a091660bc..08f008bc7 100644 --- a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h @@ -118,10 +118,22 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() nop() -/* The location of the software interrupt register. Software interrupts use -vector 27. */ -#define portITU_SWINTR ( ( unsigned char * ) 0x000872E0 ) -#define portYIELD() *portITU_SWINTR = 0x01; nop(); nop(); nop(); nop(); nop() +#pragma inline_asm vPortYield +static void vPortYield( void ) +{ + /* Save clobbered register - may not actually be necessary if inline asm + functions are considered to use the same rules as function calls by the + compiler. */ + PUSH.L R5 + /* Set ITU SWINTR. */ + MOV.L #553696, R5 + MOV.B #1, [R5] + /* Read back to ensure the value is taken before proceeding. */ + MOV.L [R5], R5 + /* Restore clobbered register to its previous value. */ + POP R5 +} +#define portYIELD() vPortYield() #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() /* @@ -137,12 +149,12 @@ vector 27. */ /* The critical nesting functions defined within tasks.c. */ extern void vTaskEnterCritical( void ); extern void vTaskExitCritical( void ); -#define portENTER_CRITICAL() vTaskEnterCritical(); -#define portEXIT_CRITICAL() vTaskExitCritical(); +#define portENTER_CRITICAL() vTaskEnterCritical() +#define portEXIT_CRITICAL() vTaskExitCritical() /* As this port allows interrupt nesting... */ -#define portSET_INTERRUPT_MASK_FROM_ISR() get_ipl(); set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ) -#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) set_ipl( uxSavedInterruptStatus ) +#define portSET_INTERRUPT_MASK_FROM_ISR() get_ipl(); set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY ) +#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) set_ipl( ( long ) uxSavedInterruptStatus ) /*-----------------------------------------------------------*/ @@ -150,6 +162,9 @@ extern void vTaskExitCritical( void ); #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) +/* This macro is not appropriate for this port so is defined away. */ +#define portALIGNMENT_ASSERT_pxCurrentTCB( x ) + #ifdef __cplusplus } #endif -- 2.39.5