[riot-notifications] [RIOT-OS/RIOT] fe310: Use ecall instruction for thread yield (#15736)

Koen Zandberg notifications at github.com
Mon Jan 11 12:59:15 CET 2021


@bergzand commented on this pull request.



> @@ -108,14 +108,28 @@ void handle_trap(uint32_t mcause)
         }
     }
     else {
+        switch (mcause) {
+        case CAUSE_USER_ECALL:    /* ECALL from user mode */
+        case CAUSE_MACHINE_ECALL: /* ECALL from machine mode */
+        {
+            /* TODO: get the ecall arguments */
+            sched_context_switch_request = 1;
+            /* Increment the return program counter past the ecall
+             * instruction */
+            uint32_t return_pc = read_csr(mepc);
+            write_csr(mepc, return_pc + 4);
+            break;
+        }
+        default:
 #ifdef DEVELHELP

Probably, but out of scope here. I'll add that to the list of cleanups for this file

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15736#discussion_r554997639
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210111/c9959433/attachment.htm>


More information about the notifications mailing list