Commit graph

91 commits

Author SHA1 Message Date
bunnie
69c68db711 remove a warning in dabao build 2026-06-09 00:00:23 +08:00
hanatonikkou
ead2e9dda0 Merge branch 'dev' into dali 2026-05-11 15:26:11 +02:00
bunnie
0f1cae49f0 make i2c/peri conns lazy
this prevents race conditions on boot between the various
hardware manager dependencies.
2026-05-09 16:06:57 +08:00
bunnie
b669d65f80 fix startup race-condition on baosec platform 2026-05-08 04:22:29 +08:00
bunnie
b48df7182b make preemption switching infalliable
this allows suspend/resume to complete even if there's
a back-up in the hal processing these requests
2026-05-08 03:11:58 +08:00
bunnie
ae0eee60c5 make bio-op infalliable
this allows suspends to proceed even if the subsystem has an error
2026-05-08 03:11:30 +08:00
bunnie
ccb5912c1a fix timeout on suspend/resume
the susres process timeout timer was not cancellable, which means
that there was always a timeout pending regardless of the
success or failure of a suspend/resume process.

This fixes the implementation so that the timer is cancelled
in the case of a successful suspend/resume.
2026-05-08 03:10:33 +08:00
bunnie
7ca009d2b0 Revert "remove api call for reset_reason"
This reverts commit 1dd514f4be.

not sure why but this breaks stability. suspect a loader bug.
2026-05-06 03:28:52 +08:00
bunnie
1dd514f4be remove api call for reset_reason
the register doesn't seem to work.
2026-05-06 02:36:56 +08:00
bunnie
761b713d72 add key repeat filtering 2026-05-06 01:29:20 +08:00
bunnie
e2a229faf2 refactor service start order for the main hardware loop
- move susres service up in order
- move clock mangaer up
- move i2c into its own thread
- move keyboard server down
- add centralized hnadlers for perclk update
  - TODO: actually call perclk update on perclk changes
  (but at least now both ADC and I2C have a hook for updating)
- make main loop stall at the end by calling a dummy server
  - This reduces CPU load by removing a future-dummy-wait timer
2026-05-06 00:09:51 +08:00
bunnie
3b4d6a90ed add reset reason userspace apis 2026-05-06 00:09:21 +08:00
bunnie
c6b1b6bb79 refactor i2c implementation into an independent thread
prevents i2c from blocking progress on other critcial hardware
API activities
2026-05-06 00:00:33 +08:00
bunnie
4208ba2e0b reduce debug spew and add userspace api for reset reason 2026-05-05 23:59:39 +08:00
bunnie
602e028402 add some debug tracking on keyboard listeers 2026-05-05 23:59:18 +08:00
hanatonikkou
d69a03393b fix formatting, fix bitfield offsets 2026-04-28 20:01:34 +02:00
hanatonikkou
d26b04f043 allow changing fclk through susres server 2026-04-28 15:16:33 +02:00
bunnie
fbe6aad8bb try to improve suspend/resume stability 2026-04-22 01:22:31 +08:00
bunnie
8521d698d7 add hooks for pre-clock transition on bio
this hook allows the application logic to warn the BIO
app that a clock transition is coming so that glitches can be
suppressed.
2026-04-21 16:27:10 +08:00
bunnie
6eecc52961 rollover handling in rtc wake alarm routine 2026-04-07 18:02:47 +08:00
bunnie
b8194e7c83 add RTC wakeup alarm handling
a bit convoluted:

- RTC wakeup goes through the "always on" subsystem
- keyboard routes through "always on" because the system can wake
on keyboard press
- thus the keyboard mechanism is abused/re-used to pass wakeup
events throughout the system.

Other notes - a wakeup alarm sent within 2 seconds of the current
time will trigger an assert. It's not recommended to use the RTC
for very near-term wakeups because if you e.g. hit swap or have
something else going on that's very "busy" (like QR code scanning)
the system might not get to waking things up in time.

Some code can be written to handle this and set up a degenerate
wakeup, maybe, but for now, I am leaving it as an assert because
I want to remind myself that there is an edge case here.
2026-04-07 15:57:19 +08:00
bunnie
70543731d1 add keyboard remapping that also tracks screen flipping 2026-04-07 00:37:15 +08:00
bunnie
6b0972a551 add code to implement irq trigger edge updating
also improve comments so I can remember how this actually works.
2026-04-07 00:35:34 +08:00
bunnie
6e528f9678 fix regression on wfi vs bio setting 2026-04-05 23:22:45 +08:00
bunnie
979d00dedf attempt to debug the wfi/bio clock conundrum
the commited code works, but there's something weird going on
with the clock setting math that indicates i'm not understanding
exactly what's going on. Need to move on and solve other problems,
but this will be an outstanding issue.
2026-04-03 23:00:35 +08:00
bunnie
ee9bec19a1 fix key mappings and delay times 2026-04-02 03:47:15 +08:00
bunnie
90c3f095ec add support for more keyboard input configs on baosec 2026-02-26 18:29:47 +08:00
bunnie
663139b607 split ADC into its own service thread
this allows the ADC to depend on core HAL services. It's structured
so that other 'misc' services would go into the "other" module,
just to keep the overhead of threads/services down a bit. Up until
this point all the other services mapped to existing/other
server names, like the RTC, susres, etc.
2026-02-24 01:33:25 +08:00
bunnie
18e72a970c add draft ADC support to hal service 2026-02-23 18:53:37 +08:00
bunnie
5a8d5a8de5 fix allocation bug for ifram 2026-02-23 18:15:14 +08:00
bunnie
40a275232c udpate tomls to explicitly enumerate features used 2026-02-20 23:54:07 +08:00
bunnie
cdf489d2b1 fix std-implementation for code size/offset/padding specification 2026-02-20 21:02:19 +08:00
bunnie
b991a54b52 add debug call for bio 2026-02-20 02:09:09 +08:00
bunnie
e349703fd5 automatically adjust BIO clock dividers on sleep
this allows the BIO to continue to function even though
the CPU core is in WFI. It isn't running at full speed, but
for some applications (such as WS2812 LED driving) the lower
speed is perfectly adequate and you save a lot of power
by turning off the CPU core.
2026-02-02 23:37:48 +08:00
bunnie
7d7ddae73e pin the irq handler object for the iox banks 2026-02-02 01:29:19 +08:00
bunnie
0f19750831 remove autodrop on other hal service items 2026-02-02 01:28:32 +08:00
bunnie
2005293e11 remove autodrop on trng service 2026-02-02 01:28:15 +08:00
bunnie
3f869ca389 bump utralib version for publication 2026-01-29 19:12:00 +08:00
bunnie
2805f7a14a fix deadlock on boot issue
io need to be active early on to get clocks to function on baosec
putting that in its own thread fixes the issue.
2026-01-29 00:09:10 +08:00
bunnie
b2cf705c59 bump ticktimer version to drop susres dependency 2026-01-28 20:53:57 +08:00
bunnie
3bc1c23425 add missing feature flag 2026-01-28 15:31:22 +08:00
bunnie
c2640458f5 fix hosted mode and warnings 2026-01-28 15:21:39 +08:00
bunnie
3e4cbe441f add apis to access clock state via the susres manager
this requires a PlatformSpecific extension to the
susres API.

In addition to that, a DeepSleep op is added so we're
no longer overloading the meaning of the SuspendRequest
operation.
2026-01-28 15:07:22 +08:00
bunnie
bcf73733c3 oem-baosec-lite support in hal-service
this one is a little bit tricky. The lite version of baosec
forgoes the off-chip TRNG to save cost. Thus, there is an
"anti-feature" in the configuration, and so in this case
the dabao version of the server has to be selected despite
the baosec flag.
2026-01-24 23:52:37 +08:00
bunnie
fba011db3a commit version bump so that we may publish our packages 2026-01-08 03:04:19 +08:00
bunnie
e675ca231c cleanup warning 2026-01-05 22:02:54 +08:00
bunnie
92180af349 move the AV trng into the BIO subsystem
this also removes the board-specific hacks that track BIO usage
for the TRNG as set up by the loader
2026-01-05 21:54:30 +08:00
bunnie
bf78ba150f debug and implementation for composable I/O 2026-01-05 08:57:57 +08:00
bunnie
5f2cbd4ca4 quiet down debug 2026-01-02 12:26:27 +08:00
bunnie
5971187a62 add BIO services for resource tracking 2026-01-02 11:26:47 +08:00