Commit graph

431 commits

Author SHA1 Message Date
bunnie
5c6be58056 revise camera code - capture 256x240 frames
this improves decoding for e.g. type 5 codes, which is
a bit too tight with a 128x120 frame.
2024-10-20 17:05:45 +08:00
bunnie
f16e3721be add some QR code debugging stuffs 2024-10-20 17:03:50 +08:00
bunnie
b6fbc4ef36 clean up some gross static mut state stuff
still have to resolve the static mut issue of getting the USB
controller state into the interrupt controller.

I'm not sure there *is* a good way to do it - this might actually
be "the" use case for static mut's - but the point of this
exercise was to just diff out the driver in machine mode versus
OS mode to try and figure out if there's a hardware problem
causing instability or if it's a driver issue

the conclusion so far is that the USB stack requires extremely
tight interrupt handling timing, and so, for better stability
we may have to mirgate away from the heavily user-space dependent
implementation currently in use.
2024-10-19 00:15:12 +08:00
bunnie
37ceefef21 add usb mass storage command handlers
disk enumerates now, and initiates r/w transactions but
the reference driver does not match the implementation in that
the USB stack can't access all of RAM, so we have to add
an intermediate stage that splits the command requests into
smaller chunks
2024-10-19 00:14:12 +08:00
bunnie
dabd87aa3a add usb mass storage command handling 2024-10-19 00:13:52 +08:00
bunnie
ed9759f524 remove a debug statement 2024-10-18 17:18:06 +08:00
bunnie
90d7f45f0a adjust locations of memory for USB loader
and document the rationale
2024-10-18 17:17:29 +08:00
bunnie
452ba4adff cleanup area for statics used by the loader 2024-10-18 17:16:21 +08:00
bunnie
6c655e9358 re-enable interrupts immediately in the handler
we need to catch an interrupt that gets issued while we
are still handling the pending interrupt.
2024-10-18 17:15:24 +08:00
bunnie
a6e7459cdd re-organize the USB subsystem into modules 2024-10-18 14:45:15 +08:00
bunnie
e4f5c32ff3 update link locations to make space in loader for USB stack
this is in preparation for loader-based updates

may have to increase space even more when we pull in e.g.
firmware signing and verification primitives.
2024-10-18 04:17:36 +08:00
bunnie
d8cd9ba5c5 add hook to USB testing, and also move the kernel to make space for loader USB 2024-10-18 04:16:31 +08:00
bunnie
3a4ae8f09f add usb to cramium platform 2024-10-18 04:16:08 +08:00
bunnie
8b14494a15 fix some bugs in gpio twiddle code 2024-10-18 04:15:47 +08:00
bunnie
af6f4766ff translated reference USB stack into Rust
implements mass storage; needs debugging
2024-10-18 04:13:57 +08:00
bunnie
3b61a60a2c remove boot delay, add reset-debug feature targets 2024-10-16 03:06:41 +08:00
bunnie
4c810ec447 add various debugging assembly routines for the loader 2024-10-16 03:05:54 +08:00
bunnie
778af25414 add handler for pmic open failure; add test case for self-powerdown 2024-10-12 00:46:47 +08:00
bunnie
1f148a6136 update readme 2024-10-10 02:10:10 +08:00
bunnie
e806421141 add camera test to loader
this loops an image from the camera to the oled display in real time.
it will also dump the Y (luminance) data to to a serial port for
offline development & testing of the QR code algorithm.
2024-10-10 02:05:40 +08:00
bunnie
70de9c707d cleanup bootlogo routine 2024-10-10 02:05:18 +08:00
bunnie
4e6c2706c9 employ the axp2101 driver to setup the voltages 2024-10-07 22:53:10 +08:00
bunnie
b87c9f7672 add I2C tests & code for setting the LDO initial value 2024-10-06 02:45:18 +08:00
bunnie
d7af82261e did *not* mean to commit the font-out hack
this is just to make cycle times faster during debug only
2024-10-04 22:53:00 +08:00
bunnie
9867a3e488 cleanup loader path to use dynamically derived perclk 2024-10-04 22:52:25 +08:00
bunnie
9527dcfbaf move sh1107 to platform-independent lib 2024-10-04 13:07:59 +08:00
bunnie
6fedae8e73 implement logo drawing for oled 2024-10-04 13:07:34 +08:00
bunnie
b572db3f3f update boot logo to a 128x128 suitable black/white test image 2024-10-04 13:07:00 +08:00
bunnie
18c4413ae9 update udma_global api in bootloader swap 2024-10-04 13:06:28 +08:00
bunnie
843d928126 update manifests to point to board descriptions 2024-10-04 13:05:59 +08:00
bunnie
c44f117331 fixes to udma SPIM for tx-only mode
- fix tx_await() condition to consider both control and tx channels
- make tx_async more efficient for the common case that the buffer
fits in a single transaction by appending the CS de-assert as part
of the initial command stream
- make trait for the udma global clock setting

The high bit in this exploration is that there seems to be no
way to actually confirm when a UDMA transaction has fully completed
on the hardware interface. All the completion signals tell you
when the software-side UDMA resources are freed up. However, in this
case, the hardware-side resources may still be transmitting/receiving
data.

This is a problem for the case of a '4-wire SPI' display where you
need to set an extra line to control command/data mode addressing.

In this case, the current work-around is to read back the state of
the chip select pin as a GPIO to determine when the hardware has
finished.

I suspect that if we can figure out how to use UDMA in a full duplex
mode that we could do something more essentially linked to the
hardware, but this would also require having a dummy Rx buffer allocated
that is the same depth as the hardware Tx buffer if all you cared about
is the hardware conclusion of a Tx.
2024-10-04 12:53:55 +08:00
bunnie
b2f81666d0 fix formatting 2024-10-02 01:47:51 +08:00
bunnie
1eb1a1a671 migrate loader board parameters to board files 2024-10-02 01:44:57 +08:00
bunnie
2e086f4152 consolidate spi pin setup 2024-10-02 00:23:48 +08:00
bunnie
0733b65ead firmware updater strategy and thoughts jotted into a file 2024-10-01 23:19:14 +08:00
bunnie
cddd971aa9 remap to the setup_pin() trait
this is an intermediate step on the way to moving these all into
a common area for board definitions
2024-10-01 23:18:31 +08:00
bunnie
482b815f44 convert to using the new setup_pin trait 2024-10-01 23:17:36 +08:00
bunnie
a66cd1c077 add modules from previous commit 2024-10-01 23:16:57 +08:00
bunnie
59b15541f3 add stubs for lifecycle management and update checking in loader
this is just a reminder to me on how i was planning to implement
this after going through a big side-quest to change other things.
2024-10-01 23:15:54 +08:00
bunnie
19741d3615 add new flash IDs to swap routine as well 2024-10-01 14:40:36 +08:00
bunnie
cb466c24a3 recognize more flash chip types
1. System works with 1.8V VDD I/O now, needs a new chip ID for
flash

2. Add direct c-translated version of init_clock_asic() for reference
testing.
2024-10-01 14:39:40 +08:00
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
75954de8d6 commit the version bump 2024-09-23 01:46:25 +08:00
bunnie
423bfe93ea clean up a warning in loader crate
minor cleanup because the warning is distracting from chasing
down all the other warnings
2024-09-22 11:34:59 +08:00
bunnie
89f92c28a2
Merge branch 'main' into nto-work 2024-08-19 02:30:35 +08:00
bunnie
6eab1c48bb patches to clean up warnings in rust-1.80 2024-08-19 02:24:24 +08:00
bunnie
4884ee51d9 reserve the top-most word of RAM as a "gutter" for filtered DMA
it's much easier to gutter a blocked AXI transaction, than to
squash it. So we reserve a region of memory as a gutter for blocked
transactions.
2024-08-02 17:26:24 +08:00
bunnie
8015b16cb8 clock tests 2024-07-19 17:16:02 +08:00
bunnie
9c227d2a93 beginning of clock tests 2024-07-13 22:45:58 +08:00
bunnie
30eb2f145f fix a bug where the last seeded value was not being used.
Realized that the last round of mixed values wasn't actually being
used because we nuke the `seed` value at the top of the loop.

We effectively had a round of ChaCha8 that we were doing but then
throwing away.

This construction should capture all the benefit of the computation
without wasting computation.
2024-06-22 21:18:59 +08:00