]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/GCC/RISC-V/portASM.S
RISC-V port updates: The machine timer compare register can now be for any HART...
[freertos] / FreeRTOS / Source / portable / GCC / RISC-V / portASM.S
index df6495f44e15433e669ea3ae210af5c2eccae56c..436895158faef67124e929e33546850966fd4307 100644 (file)
@@ -92,11 +92,13 @@ at the top of this file. */
 .extern pxCurrentTCB\r
 .extern ulPortTrapHandler\r
 .extern vTaskSwitchContext\r
+.extern xTaskIncrementTick\r
 .extern Timer_IRQHandler\r
 .extern pullMachineTimerCompareRegister\r
 .extern pullNextTime\r
 .extern uxTimerIncrementsForOneTick /* size_t type so 32-bit on 32-bit core and 64-bits on 64-bit core. */\r
 .extern xISRStackTop\r
+.extern portasmHANDLE_INTERRUPT\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -167,10 +169,12 @@ handle_asynchronous:
                #if( __riscv_xlen == 32 )\r
 \r
                        /* Update the 64-bit mtimer compare match value in two 32-bit writes. */\r
+                       li t4, -1\r
                        lw t2, 0(t1)                            /* Load the low word of ullNextTime into t2. */\r
                        lw t3, 4(t1)                            /* Load the high word of ullNextTime into t3. */\r
+                       sw t4, 0(t0)                            /* Low word no smaller than old value. */\r
+                       sw t3, 4(t0)                            /* Store high word of ullNextTime into compare register.  No smaller than new value. */\r
                        sw t2, 0(t0)                            /* Store low word of ullNextTime into compare register. */\r
-                       sw t3, 4(t0)                            /* Store high word of ullNextTime into compare register. */\r
                        lw t0, uxTimerIncrementsForOneTick      /* Load the value of ullTimerIncrementForOneTick into t0 (could this be optimized by storing in an array next to pullNextTime?). */\r
                        add t4, t0, t2                          /* Add the low word of ullNextTime to the timer increments for one tick (assumes timer increment for one tick fits in 32-bits). */\r
                        sltu t5, t4, t2                         /* See if the sum of low words overflowed (what about the zero case?). */\r