Commit graph

41 commits

Author SHA1 Message Date
bunnie
1d9316f9cd regex search/replace instances of xous_ipc::String to String
core xous services cluster
2024-09-22 14:18:49 +08:00
bunnie
12327ab255 adjust ticktimer to reflect real time 2024-05-06 02:43:30 +08:00
bunnie
913beaa791 format services/xous-ticktimer 2024-01-14 22:58:20 +08:00
bunnie
d457f8b555 add assert around sleep_heap() discipline in ticktimer
Every entry into the sleep_heap() should be unique. Any insert()
call that returns a value means we're going to drop a wake-up event.

Add an assert()! that will trigger a panic if this invariant is not
met.
2023-10-10 22:22:30 +08:00
bunnie
bc18c7e629 port changes to cramium platform 2023-10-10 17:21:34 +08:00
bunnie
13e01fd823 corrections and improvements to the current PR
- set slack to 0
- change panic to advisory statement

reasons are commented in the code.
2023-10-10 16:35:53 +08:00
Sean Cross
18f3ac5507 xous-ticktimer: add back in mutex unlocking
Add back in the ability to pre-unlock a Mutex. This is used for slow
path unlocking without needing to wait for a response.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-10-09 19:27:42 +08:00
Sean Cross
c96514d365 xous-ticktimer: rewrite mutex and condvar implementations
This rewrites the Mutex and Condvar backends after gaining a better
understanding of how they're supposed to work.

Additionally, the Ticktimer backend implementation has changed:

* There is now a `recalculate_sleep_offline()` call that skips starting
  and stopping the ticktimer. This is an unsafe function because the
  user must manually manage the ticktimer state. It is used to perform
  multiple operations while the ticktimer is unscheduled.
* Ticktimers now deal in `TimerRequest` types rather than raw `i64`
  types. This is a newtype that is distinct from the previous `i64`, but
  should behave largely the same.
* Waking a Condvar now reports the number of items that were awoken,
  provided the requester sends a blocking scalar value. This allows for
  backwards compatibility.
* Attempting to wake 0 Condvars now wakes all pending Condvars.
* We no longer keep track of lock-then-unlock for Mutexes, nor
  notify-then-wait for Condvars. This makes those cases undefined
  behavior, which puts us in line with Posix. Don't unlock mutexes that
  haven't been locked, or notify Condvar recipients when nobody is
  waiting.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-10-09 17:41:46 +08:00
bunnie
96b2d74e57 add cramium targets to xous-ticktimer 2023-07-17 18:25:30 +08:00
bunnie
6ef684fd8c split reset/init routines apart
this removes the initialized flag and hazard of double-calling
the interrupt hook when you really meant to reset the block.
2023-07-16 22:06:39 +08:00
bunnie
11155df21c note naming convention deviation in xous-ticktimer
all other functions have a .init() routine that handles interrupt
binding.

ticktimer rolls that into a routine that also resets the time
of the ticktimer. A comment is added for maintaner sanity down
the road.
2023-07-16 17:37:46 +08:00
Sean Cross
539ca0cb56 xous-ticktimer: delay installing irq handler
Wait until the outside of `new()` in order to install the irq handler.
This is due to a change in the optimizer for 1.71.0 which has exposed
unsoundness.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-07-16 15:31:09 +08:00
eupn
e80a2072a6
ticktimer: add an extra counter as a base reference for delays 2023-04-21 19:21:25 +04:00
eupn
ab2ea4d313
ticktimer: move some functions into impl modules
It will allow implementations to override these functions when desired.
2023-04-21 19:18:59 +04:00
eupn
495f81ef33
xous-ticktimer: fix default log level 2023-03-30 00:28:36 +04:00
eupn
2a52359065
xous-ticktimer: add SAMA5D2 implementation 2023-03-30 00:22:33 +04:00
eupn
1bbf5621fd
xous-ticktimer: split platform impls 2023-03-30 00:21:53 +04:00
Sean Cross
5185b2ee07 xous-ticktimer: overhaul condvars
The previous condvar implementation was unsound, and didn't do the right
thing. Overhaul condvars so that they now pass the libstd tests.

As part of this, function calls were added to free the mutex and condvar
objects that may have been allocated.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:01 +08:00
Sean Cross
841059e885 ticktimer: implement freemutex/freecondition
With these two API Calls, the ticktimer server will no longer grow
without bounds.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:00 +08:00
Sean Cross
17195f082f ticktimer: improve condvar handling
Improve condvar so that it is more reliable.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:00 +08:00
Sean Cross
511f77f897 ticktimer: only allow RecalculateSleep from ourselves
Rewrite the RecalculateSleep opcode handler so that it will only be
processed if sent by our own process.

As part of this rewrite, use the new `let else` pattern.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:00 +08:00
Sean Cross
3b7b49b4da ticktimer: use sleep_heap.pop_first()
This function was stabilized in Rust 1.66.0.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:00 +08:00
Sean Cross
c541c1b000 xous-ticktimer: don't panic in an interrupt
If we are unable to send a message in an interrupt, simply ignore it.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-30 22:15:00 +08:00
bunnie
0f0b51c779 bump watchdog timer to a longer interval 2023-01-06 17:46:18 +08:00
Sean Cross
e2bf710939 services: xous-ticktimer: use reply_and_receive_next()
Convert the ticktimer server to use the new
reply_and_receive_next_legacy() call. This is an example of how to use
this API for future projects.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-30 11:07:04 +08:00
Sean Cross
49ce85f9a8 ticktimer-server: prepare for using ReplyAndReceiveNext
Misc cleanup prior to switching which call we use.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-12-29 16:26:37 +08:00
bunnie
67fc21fbdd harmonize hosted mode selection, but retain an explicit hosted flag
In general, hosted mode is assumed "by default" if the target
is not Xous. This allows packages to be built cleanly on command
lines that don't know to pass a --feature flag to specify a target.

However, an explicit "hosted" flag is still retained so that we
can confirm the build system intent. This saves us from the failure
mode that we thought we were building for target A, but accidentally
ommitted the flag, and instead we've been silently building for
"hosted" mode without any warning. The main consumer of the "hosted"
flag is now just the build.rs script inside of the utralib.
2022-10-25 17:21:02 +08:00
bunnie
6ee5375934 move versioning infrastructure to a feature flag
this enables more smooth packaging of the ticktimer crate
2022-10-14 16:22:46 +08:00
bunnie
4ec076f130 ...and undo 2022-10-13 04:13:39 +08:00
bunnie
b9ed1c0106 add for publish crate 2022-10-13 04:13:06 +08:00
bunnie
3fc271e9b5 ...and undo. 2022-10-13 03:45:55 +08:00
bunnie
75443f075f add dummy commit for publish 2022-10-13 03:45:26 +08:00
bunnie
acc52f1f8e revert version commit for package push 2022-10-10 03:22:19 +08:00
bunnie
2f97738449 add version for package push 2022-10-10 03:21:19 +08:00
bunnie
97ccb67ff2 cleanup push artifacts 2022-10-06 00:03:27 +08:00
bunnie
e5704cef4e add for cargo push 2022-10-06 00:02:55 +08:00
bunnie
86cc7de6b1 version.rs should not be cached 2022-10-05 21:20:01 +08:00
bunnie
5c0154f730 cleanup version comparison code
this should be "clean" and working. yowch, this is really strict...
i may need to loosen this checking to make development sustainable.
2022-10-05 18:53:09 +08:00
bunnie
969f93b001 cross-repo update versions from xous-rs bump 2022-10-05 18:32:44 +08:00
bunnie
a12973a7ae bump ticktimer to 0.1.2 for new xous-rs dependencies 2022-10-05 17:41:45 +08:00
bunnie
4a8c4498ea fix inconsistency in Cargo.toml file 2022-10-05 17:00:18 +08:00