Commit graph

426 commits

Author SHA1 Message Date
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
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
67e0004f73
Merge branch 'main' into rkyv-0.8-migration 2024-09-23 22:32:34 +08:00
bunnie
f494da21cc absorb new xous-ipc version 2024-09-23 22:05:50 +08:00
Sean Cross
8e27dce59c flatipc: release 0.1.2
This releases flatipc 0.1.2 with more documentation and a new
`Ipc::from_memory_message()` call to reconstitute an object from a
xous::MemoryMessage.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-23 19:32:54 +08:00
bunnie
3a9a7ebf02 length of a record stored is the pos field for rkyv-to-pddb
prior use of `rkyv` reserves two bytes to record `pos` pre-pended
to the rkyv record

the new rkyv works without having to do that because it indexes
the rkyv data off the end of the stored records. Thus, all you
need to know is the total length of the byte slice that stores
the serialized data. This is available as the return argument
when you read a PDDB key, so we don't have to explicitly store it
anymore.
2024-09-23 17:01:13 +08:00
bunnie
c699e06c5a port rkyv ser/de usage in mtxchat 2024-09-23 17:00:16 +08:00
bunnie
75954de8d6 commit the version bump 2024-09-23 01:46:25 +08:00
bunnie
888cd2252e
Merge branch 'main' into rkyv-0.8-migration 2024-09-23 01:23:12 +08:00
bunnie
44b9041d0d attempt to update rkyv use in TLS library
@nworbnhoj would love it if you could have a look at
the implementation and let me know if I've ported this correctly.

I think what was going on is you were using rkyv to serialize
a structure to the PDDB. I've just updated the ser/de to use
the latest `alloc` API (which is much simpler than the API used
in xous-ipc because it is no-alloc).

I'll try and run some tests that involve the TLS crate too down
the road under the theory that it would suss out any porting
errors.
2024-09-23 01:14:41 +08:00
bunnie
4c7c9312c1 change xous-ipc api to 0.10.0 2024-09-23 00:24:48 +08:00
Sean Cross
3eb54d2cc9 flatipc: add more checks to vec and string
These are required as this goes across the IPC boundary.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-22 19:26:48 +08:00
Sean Cross
0c5b011fcf flatipc-derive: remove outdated header
Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-22 18:51:40 +08:00
Sean Cross
c8d70aae6a flatipc: run cargo +nightly fmt -p flatipc
Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-22 18:49:56 +08:00
Sean Cross
a77fdac6f0 libs: add flatipc implementation
flatipc is a new method for doing IPC. This is a zero-copy approach
where structs are given `repr(C)` implementations that are well-defined
and work across process boundaries.

If the same struct or enum is used in two processes that has the same
layout, then data can be freely passed between the two processes without
incurring a serialization or deserialization penalty, provided the
following hold:

1. The buffer must be page-aligned and be a multiple of the page size
2. The item must be `#[repr(C)]`
3. There must be no pointers or references of any kind

If these three things hold, then the object is safe to sling across the
process boundary.

This crate adds the ability to annotate structs with
`#[derive(flatipc::Ipc)]` to provide them with this functionality. When
doing so, objects gain the `.into_ipc()` call that turns them into
something that can be sent across process boundaries.

The resulting object has `.lend()`, `.lend_mut()`, `.try_lend()`, and
`.try_lend_mut()` as functions.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-22 18:32:58 +08:00
bunnie
34e6f46d63 formatting changes that resulted from the regex search
a bunch of lines are shorter or different length now which
triggers a mandatory reformat. this patch cleans that up,
so that going forward the manual rework patches are clearer and
not tied up with formatting patches.
2024-09-22 15:31:14 +08:00
bunnie
52ffd88b40 regex search/replace instances of xous_ipc::String to String
split into multiple commits for easier committing
2024-09-22 14:17:03 +08:00
bunnie
3cdf01d5e9 fix rust-1.80 warnings for cram-soc config 2024-08-19 02:57:12 +08:00
bunnie
00da783c4d add filter tests to dma suite
the filter is on by default (which blocks all DMA access with
the null settings) and can be configured to restrict access to
regions of memory that contain secret materials.
2024-08-02 17:25:38 +08:00
bunnie
28142e2b24 cleanup bios tests 2024-07-13 22:34:59 +08:00
bunnie
c3bbbbd672 fix bug in i2c library where i/o was not set low
you have to write *0* to the clear register to set the port low.
always the weird gotcha on that one...
2024-07-05 01:59:14 +08:00
bunnie
2ebe7f3c64 fix port ordering for NTO
don't think we'll be doing much with the MPW + PIO banks anyway anymore...
2024-07-05 01:58:42 +08:00
bunnie
059855201b add a simple dmareq handler test 2024-07-04 05:26:22 +08:00
bunnie
7f35fa8e72 add unit tests for aliased fifo pages 2024-07-04 03:58:33 +08:00