Commit graph

970 commits

Author SHA1 Message Date
bunnie
8763cf3133 stash before merge 2021-03-24 22:48:23 +08:00
bunnie
e39c186c4a Revert "Revert "kernel: services: remember new thread if specified""
This reverts commit c72d67203a.
2021-03-23 23:37:54 +08:00
bunnie
c72d67203a Revert "kernel: services: remember new thread if specified"
This reverts commit 00e7f07187.
2021-03-23 23:35:07 +08:00
bunnie
9541523d76 move GPIO mapping earlier in LLIO so we can capture the boot prompt 2021-03-23 23:10:26 +08:00
Sean Cross
e894dbd7b8 Merge branch 'fix-messages' 2021-03-23 21:58:11 +08:00
Sean Cross
9a702437b0 cargo: add lockfile for kernel-test
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:43:55 +08:00
Sean Cross
d16d0c9bd8 ticktimer-server: set quantum to 10ms
This is an experiment to see if this shorter time improves things.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:43:35 +08:00
Sean Cross
e624c184cd ticktimer-server: rewrite sleep server as deadline
Use deadlines for sleep, rather than calculating the amount of remaining
time.

This keeps time consistent, because it means we don't have to
recalculate all sleeps whenever one expires.

It also allows us to take advantage of the hardware which will fire an
interrupt if we schedule a wakeup in the past.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:41:30 +08:00
Sean Cross
89cf0c1ab1 ticktimer-server: run rustfmt on Cargo.toml
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:37:52 +08:00
Sean Cross
861565054e kernel: don't activate target thread on hosted mode
This operation is unneeded on hosted, and causes an error.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:35:52 +08:00
Sean Cross
bf3a3879d2 kernel: hosted: create thread id 1
This ensures that PID1 has a thread ID created as well.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:35:20 +08:00
Sean Cross
2a6de6ed67 kernel: hosted: remove unused interrupt calls
These were removed from riscv, and have no place in hosted mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:34:37 +08:00
Sean Cross
91647592ca kernel-test: implement sleep test
This patch implements a simple sleep test.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:53:54 +08:00
Sean Cross
ff05fff4d6 kernel: syscall: run cargo fmt on syscall.rs
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:53:22 +08:00
Sean Cross
93fc8a0b99 kernel: cargo: add wrap-print feature
This is used to force kernel messages to be wrapped to 80 columns.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:52:53 +08:00
Sean Cross
0d77f704a9 kernel: services: run cargo fmt on this file
Minor text reformatting.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:51:33 +08:00
Sean Cross
00e7f07187 kernel: services: remember new thread if specified
If we switch to a thread and specify a thread ID, remember that as the
current thread ID.

This prevents thread starvation by repeatedly going back to the same
thread ID.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:50:12 +08:00
Sean Cross
9ab5b4880f kernel: server: allow taking multiple messages from queue
Previously, we would only look at the top item on the server queue. If
it was not a known message, we would return an error.

This patch changes this behavior to look through the entire queue for
something we can take, and then clean it up as we go along.

This allow for having outstanding requests in the queue an forms the
backbone of the sleep server.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:45:32 +08:00
Sean Cross
ccc7264b79 kernel: main: use iterator when printing processes
This avoids a C-style for() loop.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:42:33 +08:00
Sean Cross
6987df997d kernel: irq: don't disable interrupts when claiming irq
When claiming an IRQ, we used to disable interrupts.

This is unnecessary, as interrupts are already disabled when running in
kernel mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:40:56 +08:00
Sean Cross
6e290500db kernel: riscv: fix wfi handling for interrupts
Keep interrupts nominally disabled in supervisor mode, and only enable
them for a brief period after WFI hits.

If an interrupt occurs, then WFI becomes a NOP. The `idle()` function is
only called when no more processes are running, which happens when all
processes are waiting for an interrupt.

Therefore, enable interrupts for a brief period when WFI returns in
order to drain all pending interrupts and return to the caller to handle
any change in the process table.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:38:48 +08:00
Sean Cross
eb4ab4ca35 kernel: main: ignore interrupts in main loop
When the kernel is running its main loop, interrupts are disabled as it
is running in supervisor mode.

As a result, we can ignore any interrupt enabling/disabling that may
need to occur.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:34:53 +08:00
Sean Cross
06a5997a45 kernel: debug: add wrap-print feature
This feature works around a bug in Renode where unwrapped lines cause it
to crash. This forces columns to be wrapped at 80 characters.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-22 22:27:53 +08:00
Sean Cross
f3ed417c7a emulation: xous-release: add more debug examples
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-22 22:23:53 +08:00
Sean Cross
cb5efccdf8 emulation: ticktimer: fix spurious interrupt on init
Due to a race condition, an IRQ was always fired when the timer was
turned on.

Force a recalculation of the IRQ state when the IRQ is turned on to
avoid firing an interrupt when none should fire.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-22 22:23:03 +08:00
Sean Cross
751dc8ee3a kernel-test: add test for ticktimer-server
This test is an attempt to fix `sleep_ms()`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-18 20:10:58 +08:00
Sean Cross
27c35223cd xous: run cargo-fmt
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-18 20:10:26 +08:00
Sean Cross
071f2047f8 xous: return TID and PID from current_tid() and current_pid()
These should return the raw values, rather than the Result values.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-18 20:10:01 +08:00
bunnie
184a284da5 sleep_ms() bug exhibitition 2021-03-18 17:34:48 +08:00
bunnie
6677d79834 initial RTC framework 2021-03-18 16:22:08 +08:00
bunnie
db5e56fd1a futzing with structures to try and figure out a threading issue 2021-03-18 16:21:43 +08:00
bunnie
ca07645dce remove loop polling on GAM, seems unecessary 2021-03-18 16:21:10 +08:00
bunnie
9c89409a22
Merge pull request #53 from betrusted-io/hardware
revert submodule ref for public build
2021-03-18 05:11:23 +08:00
bunnie
0cedcffd0c revert submodule ref for public build 2021-03-18 05:10:16 +08:00
bunnie
dacedc3b74
Merge pull request #52 from betrusted-io/hardware
Refactor system to use rkyv 0.4.1
2021-03-18 04:56:32 +08:00
bunnie
3c0859982b Merge branch 'rkyv-refactor' into hardware
Bring rkyv version to 0.4.1
2021-03-18 04:55:17 +08:00
bunnie
9c49940e1d add callback test back into shellchat 2021-03-18 04:22:17 +08:00
bunnie
2d5c1dd6db leverage min_const_generics and cleanup
the spoils of a hard fought battle to refactor to rkyv 0.4.1
2021-03-18 04:00:38 +08:00
bunnie
ea8b208a15 finalize rkyv 0.4.1 refactor 2021-03-18 03:54:48 +08:00
bunnie
8fbd900a4c Merge branch 'hardware-no-cb' into rkyv-refactor
Bring the two branches up to date, while also laying the groundwork
for XousServerName to be used as a native index type in xous-names
so we aren't burdening xous::String with a hasher
2021-03-17 16:06:06 +08:00
bunnie
89aa1b4c06 svd changes due to recompilation of SoC 2021-03-16 19:28:53 +08:00
bunnie
edb099d3f2 fix hosted mode with dummy i2c emulation calls 2021-03-16 19:28:01 +08:00
bunnie
1dda24e24e remarkably, things still crash despite removing the callback command. 2021-03-16 19:14:59 +08:00
bunnie
0e8767aea2 this commit crashes on boot 2021-03-16 19:07:03 +08:00
bunnie
eda33b5de7 factor out the shellchat callback, which mysterious breaks things 2021-03-16 18:03:12 +08:00
bunnie
5ba5dc0340 Merge branch 'hardware' of github.com:betrusted-io/xous-core into hardware 2021-03-16 17:03:37 +08:00
bunnie
2fb6ae5ee7 debugging i2c 2021-03-16 17:03:10 +08:00
bunnie
d74b3189e6 it builds, at least. 2021-03-16 16:37:38 +08:00
bunnie
8b8cad067c add the i2c file proper 2021-03-16 15:52:30 +08:00
bunnie
eff3e7d7bf incremental i2c changes 2021-03-16 15:52:13 +08:00