Commit graph

91 commits

Author SHA1 Message Date
bunnie
c7f835a93f fix xous implementation 2025-12-31 23:36:00 +08:00
bunnie
58df51ae43 bio implementation in bao1x-hal-service 2025-12-26 21:03:40 +08:00
bunnie
1c0d8eea17 update the xous API to handle bitmask-based setting of the BIO pins 2025-12-26 20:18:49 +08:00
bunnie
476f747c78 add skeletal bio service 2025-12-26 20:16:13 +08:00
bunnie
6f0a9c4275 fix keyboard scan configuration
turns out that when the keyboard is activated, *all* the keyboard
lines take over the GPIOs - and this will fight with the the doubled-up
PF7_PA2/PF8_PA1/PF9_PA0 I/Os.

Using the keyboard controller means that *all* of the PF2-PF9 pins
are now driven by the keyboard controller, regardless of the GPIO
setting.

This is because when the core is powered off, the GPIO output mappings
are lost (they are in the core domain, not always on), and the KPC
was implemented without the ability to selectively demux unused
rows/cols.

In particular on baosec this can lead to high power consumption on
the 24MHz clock when driving the camera, because the KPC fights
with the clock.

The mitigation for the current baosec hardware is to configure
the KPC such that the internal pull-up is responsible for the
"high" level, and it's only driven when "low". This reduces the
amount of fighting with the oscillator.

A future rev of hardware will move the osc to the PA3 pin, where
there is a PWM output but no muxing with the KPC, eliminating
the conflict entirely.
2025-12-23 23:36:17 +08:00
bunnie
192a9148dc catch the deep sleep request 2025-12-22 02:11:54 +08:00
bunnie
3427c4965e note RTC todo's 2025-12-22 02:11:29 +08:00
bunnie
cd075729c4 quite down a debug statement 2025-12-18 02:21:20 +08:00
bunnie
d874c3e5c2 commit for version bump 2025-12-16 02:02:37 +08:00
bunnie
21d508f64b add susres dependency 2025-12-16 01:16:10 +08:00
bunnie
b0b72bc28b remove wfi api - using susres manager instead 2025-12-16 01:15:30 +08:00
bunnie
257bafcc5f structural rework of the main loop to allow for deferred blocking scalars
also invoke the susres thread manager
2025-12-16 01:14:45 +08:00
bunnie
8536b4fda4 rework power management scheme to use susres API 2025-12-16 01:10:30 +08:00
bunnie
b0ec2929d7 cleanup warning in rtc 2025-12-16 01:09:12 +08:00
bunnie
5ebc40453c add suspend/resume manager to the HAL
this gives us a clean API for power savings mode entry/exit
2025-12-16 01:08:41 +08:00
bunnie
a94595ca9f RTC: rework to give milliseconds time
The original RTC was set to a 1Hz tick, which isn't sufficient
for the time API

This has been reworked to give a 1/1024 second increment.
Rollover logic is implemented in the RTC. Requires the system
to be powered on at least once every 48 days to capture the
rollover, otherwise it could miss a rollover event. This is
fine because the backup battery doesn't last that long, and
scans of QR codes for password login always reset the RTC anyways.

The RTC offset randomization code is now gone because we're
not tracking long-term power-on information in the RTC.
2025-12-15 15:16:10 +08:00
bunnie
5f1b769822 cleanup warnings 2025-12-11 02:27:56 +08:00
bunnie
def8da571b add a wfi api 2025-12-11 02:22:01 +08:00
bunnie
261ea7a880 update apis in hal-service 2025-12-11 02:18:44 +08:00
bunnie
b6f761a9a9 move power manager to a server
this is because the power manager itself relies on the HAL
server to manipulate GPIOs and it'll block the main loop if
the calls are handled there.
2025-12-11 02:07:17 +08:00
bunnie
a3a566b240 add API calls for debugging kernel under baochip targets
also updated some really bit-rotted docs

we will deprecate the docs/ directory soon, they are wrong
and misleading at this point.
2025-12-09 16:19:04 +08:00
bunnie
7d7fa75e7d add debug telemetry for keyboard connect error
sometimes on boot, a process tries to send keyboard an incorrectly
formatted message. I think this might be the IOX interrupt handler
firing due to random noise. Corrective action towards debugging
includes instrumenting the keyboard call with debug info, and also
ensuring that the iox interrupt handler banks are initialized to 0.
2025-11-29 15:49:40 +08:00
bunnie
4ec0eda2b5 migrate service name to some place public 2025-11-29 01:01:04 +08:00
bunnie
6918e275d0 map the center key to "fire"
This allows the center key to be used as a UI trigger action
without creating a carriage return on the console. this prevents
console actions from errantly triggering during complex ui navs.

probably later on we should filter out more of the UI nav items
going to the console because the console is always listening
2025-11-28 18:43:59 +08:00
bunnie
647ec0dfb4 fix dabao target - keyboard server
dabao needs to have a vestigial keyboard server which handles
forwarding USB/serial key events to listeners. otherwise, there
is no input interface.
2025-11-28 11:35:17 +08:00
bunnie
fbb04d96ab make center keypress a unique key so we handle it separately 2025-11-27 16:51:15 +08:00
bunnie
a24aaaa944 increase keyup delay slightly
this prevents some keyboard stutter in case of ui lag
2025-11-27 12:34:13 +08:00
bunnie
434e0c7ae5 refactor organization of code to fix dabao target
kpc isn't possible on dabao due to the pins not being broken out,
so gate out the service entirely for that target.
2025-11-26 21:37:31 +08:00
bunnie
601d2763e8 add keyboard userland abstractions 2025-11-26 20:45:50 +08:00
bunnie
40c94b5abc add kpc_aoint abstraction layers 2025-11-26 20:45:12 +08:00
bunnie
c677f6f78a add apis & services for the rtc 2025-11-24 18:56:03 +08:00
bunnie
d30d889774 add rtc hardware drivers and service 2025-11-24 18:28:00 +08:00
bunnie
fdb613cfb3 fix corner case on non-word aligned buffers 2025-11-18 22:40:09 +08:00
bunnie
4f39532471 clean up filling API
previous implementation was full of too many special cases

also add a version that allows us to fill using a seeded CSPRNG
for better performance on bulk fills
2025-11-18 19:34:57 +08:00
bunnie
c2c135bfdc fix trng service in baosec environment
fix missing initializers
2025-11-11 07:53:52 +08:00
bunnie
ed94245a5c enable trng server in dabao mode
this allows the rand core crates to work
2025-11-02 10:37:47 +08:00
bunnie
5f137aac96
add TRNG service for baosec target
dabao has no external TRNG, and so it can "cheat" and use the
server ID api call from the kernel to get random numbers (the
server ID is just TRNG output from the kernel's TRNG).

baosec has an external TRNG, and it needs a userspace
server to blend both kernel TRNG output and this external TRNG.
the TRNG requires the BIO block to aggregate the random data.
This commit adds that implementation.
2025-10-28 17:55:06 +08:00
bunnie
21c9089de2 make pre-emption controllable 2025-10-26 13:35:35 +08:00
bunnie
5fb7743d3b add preemption timer to the kernel
we can use the TIMER0 mechanism now that this is available in NTO!
2025-10-24 21:10:19 +08:00
bunnie
dbb0a75118 bump versions
have to absorb a version change due to xous-semver change

might as well also update the utra/svd generator dependencies
since that's been held off for a long time now.
2025-10-06 13:23:18 +08:00
bunnie
1255bf12d9 FLAG DAY: fix all names to harmonize around 'bao1x'
The code base had evolved through several code names, interim
names, company names and chip names that alternatively did or did
not exist.

Baochip is the definitive name of the company, and the Baochip1x
(full part number BAO1X2S4F-WA) is the definitivey part number of
the SoC. For convenience, the part number is shortened to 'bao1x'
in most feature flags and variable references.

This commit fixes all of the odd names and removes some unmaintained
early targets.
2025-09-18 21:25:51 +08:00