From b9484993457a9656adec883f44509340218413c3 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 17 Apr 2013 08:23:02 +0000 Subject: [PATCH] Update yield code in RX600/GCC port. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1866 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/portable/GCC/RX600/portmacro.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h index 5dde7013d..05deac028 100644 --- a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h @@ -115,10 +115,20 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) #define portNOP() __asm volatile( "NOP" ) -/* The location of the software interrupt register. Software interrupts use -vector 27. */ -#define portITU_SWINTR ( ( unsigned char * ) 0x000872E0 ) -#define portYIELD() *portITU_SWINTR = 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP() +/* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;" +where portITU_SWINTR is the location of the software interrupt register +(0x000872E0). Don't rely on the assembler to select a register, so instead +save and restore clobbered registers manually. */ +#define portYIELD() \ + __asm volatile \ + ( \ + "PUSH.L R10 \n" \ + "MOV.L #0x872E0, R10 \n" \ + "MOV.B #0x1, [R10] \n" \ + "MOV.L [R10], R10 \n" \ + "POP R10 \n" \ + ) + #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) portYIELD() /* -- 2.39.5