Commit Graph

72 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
4f2c51e00d rust: Unswizzle framebuffer for ST7789V display
By swapping the endian in RAMCTRL as well as in the SPI driver,
the frame format can be coerced into the "normal" order of pixels in
little endian, `0xBBBBAAAA` instead of `0xAAAABBBB`. This allows
seamless casting from an array of `u16`.

Accessing as 32-bit units might still be desirable for performance, but
it is a lesser worry now.

Note that a 32-bit alignment constraint still does hold for DMA.
2020-11-06 07:26:24 +00:00
Wladimir J. van der Laan
dd801e6ecc
Merge pull request #8 from Forty-Bot/pll
k210-shared: Rewrite compute_params to use fixed-point
2020-06-17 09:07:04 +02:00
Wladimir J. van der Laan
70d200a03c rust: Resurrect interrupt test for second core
It was disabled at some point because something in riscv-rt changed
and it no longer worked. Restore the testing in a more robust way.
2020-06-03 16:10:41 +00:00
Wladimir J. van der Laan
5af12f9582 rust: Add simple debug macros
Add simple debug!() and debugln!() macros that can be used for everywhere
to print stuff to UARTHS.
2020-06-02 21:07:54 +00:00
Wladimir J. van der Laan
67078f6242 rust: Fixes for newer dependencies 2020-06-02 21:07:54 +00:00
Wladimir J. van der Laan
d7245693a7 rust: Add peripheral-side GCM tag checking (and testing) 2020-05-02 08:27:30 +00:00
Wladimir J. van der Laan
8b07675b33 rust: Implement Drop for AES iterator
Implement drop for the AES iterator to automatically finish
the hardware operation when the iterator goes out of scope.
2020-05-01 12:46:28 +00:00
Wladimir J. van der Laan
6b907fd033 rust: add AES benchmark against soft_aes 2020-05-01 12:25:24 +00:00
Wladimir J. van der Laan
e080a03821 rust: Split AES into three parts, setup, process data and finish
Might want to re-use the setup/finish code for streaming data and/or DMA.
2020-04-30 15:36:14 +00:00
Wladimir J. van der Laan
68ddf3b1bc rust: Add function that directly hashes 32-bit units
This is almost two times as fast, apparently, however it requires
the input to be aligned to 32 bit and be a multiple of 32 bits.
This should be special-cased.
2020-04-29 20:39:29 +00:00
Wladimir J. van der Laan
cf8b81c391 rust: Large SHA256 test vectors 2020-04-29 16:24:01 +00:00
Wladimir J. van der Laan
fbe528d8b6 rust: Add assertion that input length is at least 0 for AES
It doesn't look like the AES engine can handle 0-sized input. This makes
sense, in a way, as it is an edge case and in most cases a no-op. Only
in GCM mode, where there one might want to compute a tag over a 0-byte
input, would this come up.
2020-04-27 21:04:38 +00:00
Wladimir J. van der Laan
217b00227e rust: Add a few more AES-GCM test vectors 2020-04-27 20:10:14 +00:00
Wladimir J. van der Laan
7cc906d349 rust: Don't require resetting AES engine before every use
When using the AES engine in GCM mode, the hardware *requires*
verifying a tag even if we don't care about the result. Otherwise it
will hang in unfinished state, and needs a reset every time.

By going through these motions (like the SDK does) this costly reset can
be avoided.
2020-04-27 19:47:32 +00:00
Wladimir J. van der Laan
e8dc6282e8 rust: Add more test vectors for AES128/256 2020-04-27 19:00:35 +00:00
Wladimir J. van der Laan
4aef921276 rust: add AES and SHA256 peripheral drivers to k210-shared
And expand crypto engines test with more test vectors.
2020-04-26 10:37:41 +00:00
Sean Anderson
f1680533e4 k210-shared: Rewrite compute_params to use fixed-point
This code is adapted from a patch I wrote for U-Boot "clk: Add K210 pll
support" Forty-Bot/u-boot@7d95737a93.
Significant reference was made to the datasheet for the PLL, which may be
found by searching for "tcitsmcn40ggpmplla1". For testing, I use a "brute
force" version of the algorithm which is significantly simpler code-wise.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2020-04-19 20:17:33 -04:00
Wladimir J. van der Laan
d1981173f7 rust: Use command names from ST7789V datasheet in LCD driver
Use the command names from the ST7789V datasheet instead of the
arbitrary ones borrowed from the SDK.
2020-02-22 23:34:36 +00:00
Wladimir J. van der Laan
78fb83fe50 rust: Add comment for sysctl set_spi0_dvp_data 2020-02-18 06:23:50 +00:00
Wladimir J. van der Laan
4d987f0d7d rust: Important correction to board definition comment
WIFI_RX and WIFI_TX are named from the perspective of the ESP8285,
so they need to be connected RX<->TX and TX<->RX to be used.
2020-02-17 12:32:32 +00:00
Wladimir J. van der Laan
b7fdbc0ad7 rust: Add module for timing/FPS measurement 2020-02-07 19:50:37 +00:00
Wladimir J. van der Laan
412e414198 rust: Add comment 2020-02-07 19:50:37 +00:00
Wladimir J. van der Laan
8806f01455 rust: Add LCD shutdown function 2020-02-07 18:48:45 +00:00
Wladimir J. van der Laan
9e6c9f5a8f rust: i2c: Reset I2C controller at initialization
Prevent random hangs when restarting the application because
the I2C controller is still in a busy state.
2020-02-07 18:48:45 +00:00
Wladimir J. van der Laan
a1c65405ea rust: Clean up cargo patches
No more need for any `k210-hal` and `k210-pac` patches with 0.2.0
2019-12-28 20:17:37 +00:00
Wladimir J. van der Laan
68faef6cf4 rust: SPI clock speed constant for LCD 2019-08-21 14:56:04 +00:00
Wladimir J. van der Laan
37cf4ad5a2 rust: Test PLL computation against output of C implementation 2019-08-21 14:55:31 +00:00
Wladimir J. van der Laan
eab9d94a1b rust: Return usable PLL register values directly from the computation
The internal representation and parameter names are just an implementation detail.
2019-08-21 09:01:55 +00:00
Wladimir J. van der Laan
9bdf7ea2df rust: Factor PLL computation out from sysctl
If you need to have mystery meat algorithms, at least abstract
them.
2019-08-21 08:49:41 +00:00
Wladimir J. van der Laan
d7eb8dd0e8 rust: sysctl PLL setting
Port over the terrible PLL frequency setting code, and use it to set up
the clocks for every demo.
2019-08-20 21:18:23 +00:00
Wladimir J. van der Laan
1990bff89f rust: k210-pac dependency bump 2019-08-15 12:48:41 +00:00
Wladimir J. van der Laan
0dcbeda646 rust: sdcard read/write sectors using DMA 2019-08-12 17:43:16 +00:00
Wladimir J. van der Laan
ed91b43e2a rust: sdlcd improvements
- Init error reporting
- Put 16-bit halves of display output correctly
- Better comments
2019-08-12 07:37:32 +00:00
Wladimir J. van der Laan
862407a1bc rust: Comment update 2019-08-11 18:16:53 +00:00
Wladimir J. van der Laan
e32ba5b66a rust: Bump LCD SPI clock rate
Now that LCD is using DMA, the SPI clock rate can be increased.
2019-08-11 18:16:53 +00:00
Wladimir J. van der Laan
a5d1f5c9ae rust: Make SPI send/recv loops nicer
Use iterators to make the loops simpler.
2019-08-11 18:16:53 +00:00
Wladimir J. van der Laan
161bd9982e rust: Prefer X::from to as X 2019-08-11 18:16:44 +00:00
Wladimir J. van der Laan
c2c6287f9c rust: Basic sdcard test
Print SD card information and dump a sector.
2019-08-11 09:56:54 +00:00
Wladimir J. van der Laan
4e5ea50f08 rust: lcd: Clarify magic values 2019-08-07 11:27:49 +00:00
Wladimir J. van der Laan
e86d5c5f75 Use DMAC for display everywhere
This mimics the way the Kendryte SDK does things—it is better because
the MMIO based SPI tends to sometimes lose synchonization when the CPU
doesn't keep up providing data fast enough.
2019-08-07 10:22:05 +00:00
Wladimir J. van der Laan
2906c8c895 DMAC!
Add basic DMAC support (SPI/LCD first).

The current implementation (adding _dma to LCD traits) is really, really
awkward and just for testing. Probably it would be better for the LCD to
own its own dedicated DMA channel to avoid having to pass them in
for every… single… thing…
2019-08-07 09:19:44 +00:00
Wladimir J. van der Laan
d4b2b6bbbd rust: Dependency bump k210-hal
Peripherals moved to pac, UARTS take the pins to use and internally
configure sysctl.
2019-07-03 18:24:24 +00:00
Wladimir J. van der Laan
c1fc53d249 Dependencies bump 2019-07-02 17:20:39 +00:00
Wladimir J. van der Laan
3ff4933a88 Comment updates 2019-07-02 15:13:22 +00:00
Wladimir J. van der Laan
ec7ce47dff rust: Add rust version of glyph mapping demo 2019-06-02 12:51:51 +00:00
Wladimir J. van der Laan
d20791330d rust: Remove wrong comment from dvp 2019-06-01 22:51:53 +00:00
Wladimir J. van der Laan
9bdd98f29b rust: Clean up SPI interface
Selectively borrow types from pac, this breaks the need for a direct
dependency on pac for clients of SPI and makes the interface easier to
use.
2019-06-01 22:07:52 +00:00
Wladimir J. van der Laan
00ac503e3e rust: clean up FPIOA interface
Remove need for .into() everywhere by accepting everything
that goes into usize in the appropriate methods.
2019-06-01 21:56:35 +00:00
Wladimir J. van der Laan
1630dc2a31 rust: Add dvp-ov 2019-06-01 21:56:35 +00:00
Wladimir J. van der Laan
cd7f72f03f rust: Improve DVP interface
Clean up interface a bit.
2019-06-01 21:56:35 +00:00