Commit graph

449 commits

Author SHA1 Message Date
bunnie
b1e31924a0 add helper routines for qr finding 2024-11-05 01:45:29 +08:00
bunnie
92509c448b some debug cleanup 2024-11-04 22:53:31 +08:00
bunnie
4f85deaecb change api name for resolutions to dimensions 2024-10-27 23:26:45 +08:00
bunnie
d41113fb9a fix operator chaining 2024-10-26 18:42:16 +08:00
bunnie
4dd78b9727 add descriptor chaining helper methods
mass storage is...somewhat stable now, on both linux and windows,
but there are some corrupt packets. need to look into whether
electrical issue, or if we're stomping the transfer buffers because
we've not managed them correctly.

Also need to reflect on how to turn this API into something
safer...the hardware is doing *so much* in this API, the driver
is basically global mutable state with arbitrary slices you can
write over the ends once you hand things off to the driver.
2024-10-26 03:07:00 +08:00
bunnie
9e0bd64195 allocate large swathes of memory to camera
this is for higher resolution QR code scanning

makes it incompatible with simultaneous USB usage

however, when camera is off, the USB stack can be started, and
vice-versa. Basically, you can't both do active USB and camera
at the same time, but you can do one or the other.
2024-10-21 01:22:12 +08:00
bunnie
b5f7c4c490 add minigfx to hal lib 2024-10-21 01:18:51 +08:00
bunnie
407dec86a3 adopt platform & display -agnostic APIs for SH1107 frame buffer 2024-10-21 01:15:48 +08:00
bunnie
0081575e80 fix timer primitive for ov driver 2024-10-21 01:15:09 +08:00
bunnie
d5ba0c4cb7 add a plantform-agnostic graphics API
first step on a long road to improve the graphics API on Xous.
2024-10-21 01:13:40 +08:00
bunnie
f214e9c4d1 add frame slicing to ov2460 driver 2024-10-20 17:04:35 +08:00
bunnie
529c8b18b2 various fixes to driver
- add USB mass storage state tracking for handler-based intervention
- fix some wait loops

need to regression test this againt a xous-mode USB operation
2024-10-19 00:12:38 +08:00
bunnie
2ec562169c modify USB HAL for no-std ops
split the handler out into a function pointer

add callbacks for completion handling of EPs - in-line with
the reference code

improve the pei handling

change visibliity of structures to allow for out of crate
handlers
2024-10-18 04:14:49 +08:00
bunnie
2cb3bbf780 add SE0 pin setup 2024-10-12 00:46:15 +08:00
bunnie
701170e7e7 make device opening fallible 2024-10-12 00:45:53 +08:00
bunnie
37e82f1662 add ticktimer ref to cramium-hal
this is needed for delays in Xous mode - the camera requires
some dead-reckoned delays between i2c writes and reads
2024-10-10 02:07:15 +08:00
bunnie
7bd9e2b86b add camera pins & ifram spec 2024-10-10 02:04:49 +08:00
bunnie
552096d2a0 add prelim ov2640 driver 2024-10-10 02:04:22 +08:00
bunnie
091082dfcc add a clear routine for the sh1107 frame buffer 2024-10-10 02:03:59 +08:00
bunnie
2d8747605c promote visibility of some udma config constants 2024-10-10 02:03:37 +08:00
bunnie
c001b2759e add a method to clone an iox handle
gpios for everyone!
2024-10-10 02:03:11 +08:00
bunnie
30fdc139e5 simplify new methods for spim 2024-10-08 17:59:42 +08:00
bunnie
b99c5544c6 simplify new methods for i2c 2024-10-08 17:59:31 +08:00
bunnie
717ddefb2e add references to new libraries 2024-10-07 22:53:29 +08:00
bunnie
be56097fe4 add axp2101 driver skeleton 2024-10-07 22:52:55 +08:00
bunnie
f95941af83 add I2C features to the board description file 2024-10-06 02:44:47 +08:00
bunnie
7399c4a6da add mapping for i2c channels to global clocks; fix typo 2024-10-06 02:44:16 +08:00
bunnie
d45052b772 add i2c base driver 2024-10-06 02:43:49 +08:00
bunnie
81c6d9510b modularize the udma module 2024-10-04 22:59:02 +08:00
bunnie
d21789beff remove the chip select gpio-wait hack
We use the txrx call instead, which does not signal a completion
until the rx transaction is finished (which is after the final
bit is received of a pending SPI transaction).
2024-10-04 22:51:36 +08:00
bunnie
683aa63616 add async txrx variant to spim API
This allows us to do a "swap" transaction (transmit and receive)
asynchronously (the await returns a pointer to the receive buffer).

Note that a pure-rx-only variant is still todo, but should follow
pretty naturally from the pattern outlined here.
2024-10-04 22:49:56 +08:00
bunnie
669ab294f2 update lib refs and manifest 2024-10-04 13:05:40 +08:00
bunnie
be8f939311 update hardware descriptor to point to the oled 2024-10-04 13:05:01 +08:00
bunnie
437dcb2de5 add IoGpio trait
this allows us to stash a reference to the Iox in both std
and no-std reperesentations of the hardware.
2024-10-04 13:04:22 +08:00
bunnie
b6532ffd39 add the 'SharedCsr' type object
this is a CSR object that presents writes as an immutable on the
parent object. This simplifies traits, etc.

On the one hand, the CSR itself is truly immutable - the address
represented by the CSR does not change.

On the other hand, the underlying data inside the CSR is changing,
so, the CSR actually represesnts an immutable pointer to a mutable
piece of data.

For the case of the UDMA, we have a bank of globally shared state,
it is much more convenient to think of the CSR as immutable, and
we manage the underlying global shared state through other checks,
e.g. through dynamic allocators that track when various blocks
or resources have been parceled out.
2024-10-04 13:01:03 +08:00
bunnie
c2ff7c759d prelim driver for sh1107-style OLED displays 2024-10-04 13:00:36 +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
412a76288a fix formatting 2024-10-02 01:47:41 +08:00
bunnie
d6790489f1 migrate more board parameters to board files 2024-10-02 01:44:33 +08:00
bunnie
20dd9b2c14 consolidate spi pin setup routines 2024-10-02 00:23:17 +08:00
bunnie
6eca732043 cleanup a warning 2024-10-01 23:15:22 +08:00
bunnie
c0ddf5f82a add board feature placeholders 2024-10-01 23:14:20 +08:00
bunnie
81637f119b add helper to translate return values from io setup to udma clock channels
this allows us to tease out the clock setting code from the pin
setting code. probably will need to add more helpers for other
peripherals as we continue through with this exercise.
2024-10-01 23:13:08 +08:00
bunnie
45d9487c70 add board module to the project 2024-10-01 23:12:53 +08:00
bunnie
1dbfb21020 add some stand-in code for board definitions on the cramium platform 2024-10-01 23:12:30 +08:00
bunnie
c7bdc1aec5 refactor iox to have a setup_pin() trait
this lays the foundation to make code portable between std and
no-std environments for setting up pin configurations.
2024-10-01 23:11:24 +08:00
bunnie
ab41cbc299 make aclk test allow both registered and unregistered mem configs
both are valid, which is picked in the end will depend on
timing closure
2024-09-26 18:19:27 +08:00
bunnie
0b419400c7 improve reset condition for filter & make pass criteria tighter
- filter setup can be impacted by previous engine running, make
sure engines are stopped and FIFOs flushed prior to test start
- when reading a filtered bank we can get garbage, so make the
test check for the specific value we should see.
2024-09-26 18:18:12 +08:00
bunnie
81f0523ee3 add functional multiply-accumulate test
note that multiplies must go from register to register,
they can't directly pull out of FIFO regs
2024-09-26 18:17:31 +08:00
bunnie
7b8f4d91ec add mul unit test 2024-09-26 18:17:14 +08:00