9names
9641c0b4a4
Change pio::Tx::write to write u32 instead of <T>* ( #352 )
...
* Change pio::Tx::write to write u32 instead of <T>*
* Use i2c-pio branch that supports new SIO FIFO API so the PIO FIFO changes don't break CI
2022-06-13 18:24:05 +10:00
Kasil
9bce594db2
Add accessor for installed pio program offset ( #355 )
2022-06-05 21:56:46 +10:00
Jan Niehusmann
ed7148a1e7
Take possible PIO program length of 32 into account ( #350 )
...
Avoid overflow of left-shift operation by special-casing the value 32.
Fixes #349
2022-06-02 07:03:04 +10:00
9names
d66b47920e
Merge pull request #311 from Liamolucko/multicore-no-alloc
...
Remove the `alloc` requirement for `Core::spawn`
2022-06-01 20:52:11 +10:00
Liam Murphy
e9534ace04
Add a fence after writing the arguments to the stack
...
Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-06-01 17:33:37 +10:00
9names
e9f367f26c
Restrict PIO FIFO writes to unsigned integers ( #318 )
...
* Change pio::Tx::write to write u32 instead of <T>*
* Add replicated u8/u16 writes to pio::Tx::write
* Switching back to generic version of pio::fifo.write()
* Fix links to make cargo doc happy
Co-authored-by: Jan Niehusmann <jan@gondor.com>
Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-06-01 06:13:33 +10:00
Liam Murphy
9848f849bd
Write core 1 arguments directly to RAM without casting to usize
2022-05-29 19:56:20 +10:00
Christian Maniewski
99b8845d74
Add missing GPIO I2C trait implmentations ( #344 )
2022-05-25 09:03:29 +10:00
Wilfried Chauveau
38692dfcb9
Add defmt feature (as optional dep) and allow i2c::Error to be formatted ( #328 )
2022-05-09 19:22:41 +10:00
Liam Murphy
0e5fdcfd9c
Fix example
2022-05-08 20:14:40 +10:00
Liam Murphy
c0fafc7694
Make Multicore
take SioFifo
rather than the whole Sio
& make the spawn
closure the last argument
2022-05-08 18:24:49 +10:00
Liam Murphy
b932663cc9
Merge branch 'main' into multicore-no-alloc
2022-05-03 17:40:22 +10:00
mqy
623457a498
fixed typos
2022-04-30 12:51:45 +10:00
Wilfried Chauveau
bb07402fc9
Abstract alarms
2022-04-30 11:54:54 +10:00
Wilfried Chauveau
977bc2732a
Remove unmaintained implementation async i2c.
2022-04-30 11:46:30 +10:00
9names
3d8f66df78
Provide an unsafe function for resetting all spinlocks
2022-04-30 11:33:22 +10:00
Liam Murphy
67ceb65703
Update documentation and drop entrypoint on error
2022-04-21 14:38:36 +10:00
Liam Murphy
8a261b050c
Remove the multicore trampoline and make the core 1 startup function generic
...
I managed to avoid the multicore trampoline by messing with the signature of the core 1 startup function.
While the first couple arguments to a function with the arm C abi are passed in registers, once they're filled up, the rest of the arguments go on the stack; so, I put some dummy arguments before the real arguments to force them to go onto the stack. That allows it to be used directly, without needing the trampoline to move the arguments from the stack to registers.
I also changed the startup function to be generic over the function type passed, which avoids the mess of dealing with `Core1Main` and fat pointers and all that.
2022-04-20 19:30:32 +10:00
Derek Hageman
f9d2610fff
Use direct assembler calls for the divider
...
Convert the hardware divider to optimized assembler.
2022-04-12 10:17:44 -06:00
Derek Hageman
a15c109e8d
Change hardware divider results structure order
...
Putting the quotient first makes the compiler emit slightly better
code by putting the quotient in r0 which is generally what the
intrinsics want.
2022-04-12 08:50:56 -06:00
Derek Hageman
b8ef969d92
Generate intrinsic aliases directly
...
Using the full module structure generated by the intrinsics macro
interacts oddly with inlining on some optimization levels, causing
a duplicate identical function body to be generated. This doesn't
affect performance, but it wastes space, so just declare the alias
directly which seems to cause the symbol to be aliased as it should
be.
2022-04-12 08:50:56 -06:00
Jan Niehusmann
f67b650bb3
Remove some unused fields from UartPeripheral and Reader ( #315 )
...
* Remove unused field `effective_baudrate` from uart code
* Remove unused field `config` from uart code
2022-03-18 20:57:45 +11:00
Marius Meißner
990085948a
Using thread send safe UART* marker, as suggested by @danielzfranklin in #Issue-284 ( #314 )
2022-03-18 20:56:27 +11:00
Jan Niehusmann
6026ea4ae3
Allow to start multiple state machines in sync ( #301 )
...
* add example of synchronized PIOs
* Synchronize state machines using WAIT IRQ instruction
* Use "irq wait 0" instead of "wait 1 irq 0"
This way, the initial value of the interrupt flag doesn't matter
* Start state machines synchronized without IRQ WAIT instruction
* Improve API
Co-authored-by: Andrew Straw <strawman@astraw.com>
2022-03-18 20:55:31 +11:00
Jan Niehusmann
f8de8755cc
Add an rp2040 specific #[entry] macro. ( #300 )
...
* Add an rp2040 specific #[entry] macro.
This macro extends the one from cortex-m-rt by code to unlock
all spinlocks on boot.
* Idiomatic pointer arithmetic
Apply suggestion by @9names, improving address calculations.
(This doesn't change the generated code at opt levels 2 or "z".)
Co-authored-by: 9names <60134748+9names@users.noreply.github.com>
2022-03-13 12:35:59 +11:00
9names
b81955c2a8
Prep for 0.4.0 release ( #312 )
...
* Update changelog for 0.4.0 release
* Enable rt feature for irq example in Cargo.toml
* Bump pio/pio-proc deps to 0.2.0, update pio examples
* Update BSPs to latest ws2812-pio, remove unused pio dep
* Fix usage of pio_proc in doc comment
* Clean up pio doc-example
* Update rp-pico to latest i2c-pio
Co-authored-by: Jan Niehusmann <jan@gondor.com>
2022-03-11 22:37:34 +11:00
Liam Murphy
56aa96769d
Don't assume usize
is 32 bits
2022-03-05 21:57:35 +11:00
Liam Murphy
f0b46c0f58
Remove the alloc requirement for Core::spawn
2022-03-05 14:55:32 +11:00
9names
111654fc28
Merge pull request #291 from jannic/avoid-64bit-division
...
Avoid 64bit division
2022-02-27 10:42:56 +11:00
Jan Niehusmann
021e942e47
Fix clippy warnings
2022-02-27 09:29:54 +11:00
Jan Niehusmann
b46ddd7351
Add test cases for fractional_div()
2022-02-26 13:33:58 +00:00
Jan Niehusmann
fecde70cf9
Derive several traits for ClockError
2022-02-26 13:33:58 +00:00
Jan Niehusmann
402b7f1eb8
Use u32 instead of u64 division in clock calculations
...
This saves about 1kB of flash by removing
compiler_builtins::int::specialized_div_rem::u64_div_rem if
no other code uses u64 divisions.
2022-02-26 13:33:58 +00:00
Jan Niehusmann
7750781650
Implement embedded-hal 1.0.0-alpha.7 traits ( #298 )
...
* embedded-hal v1.0.0-alpha.7 removed several traits
* bump dependency to embedded-hal 1.0.0-alpha.7
* Mention embedded-hal alpha changes in changelog
2022-02-26 21:06:55 +11:00
Emil Fresk
b7e56d0869
Added so stopped PIO state machines can change their clock divider
2022-02-26 20:57:12 +11:00
9names
4075f81b2d
Merge pull request #272 from 9names/watchdog_fix
...
Set hw reset bits for watchdog
2022-02-20 16:46:12 +11:00
9names
fff980611a
Merge pull request #289 from astraw/fix-typo
...
fix typo
2022-02-13 13:37:12 +11:00
Derek Hageman
80c84b13ba
Add ROM floating point math library
...
Hook up the ROM functions to floating point intrinsics.
2022-02-12 11:56:24 -07:00
Derek Hageman
ce681b4f10
Move divider intrinsics to the new intrinsics macro
2022-02-12 11:56:24 -07:00
Derek Hageman
a70eb89799
Add basic ROM intrinsics
...
Add a standardized macro for intrinsics export and connect the simple
ROM functions to intrinsics.
2022-02-12 11:56:24 -07:00
Derek Hageman
81ab38fd71
Add ROM version check
...
Add a check for a V2 bootrom when using floating point functions that
require it. Panic when it's not present.
2022-02-06 17:14:27 -07:00
Andrew Straw
799449dd1a
fix typo
2022-02-06 09:03:30 +01:00
Derek Hageman
a6f2453440
Fix ROM function signatures
...
Fix a few function signatures that don't match the ROM according to the
datasheet.
_memset4 also has a wrong code in the datasheet, so match it to the
actual ROM.
2022-02-04 07:18:11 -07:00
Jonathan 'theJPster' Pallant
8bdecd2058
Merge pull request #283 from Sizurka/rom-functions
...
Improve ROM function access
2022-02-04 09:53:59 +00:00
Derek Hageman
98fd6c1724
Add ROM function caching
...
Add a feature to enable automatic caching of the result of ROM table
function lookups.
2022-02-03 13:45:18 -07:00
Derek Hageman
a6daaf9fa3
Standardize ROM function access
...
Make all ROM functions (normal and floating point) provide both a direct
call that does the operation and a module with a ptr() function to get
the function pointer.
2022-02-03 13:32:18 -07:00
Jonathan 'theJPster' Pallant
16c9064c52
Merge pull request #280 from 9names/alarm-ergonomics
...
Use atomic operations for altering Timer alarm interrupts
2022-02-03 19:47:40 +00:00
Jonathan 'theJPster' Pallant
385c92392b
Merge pull request #278 from Sizurka/divider-intrinsics
...
Implement intrinsics for the hardware divider
2022-02-03 19:46:00 +00:00
Jonathan 'theJPster' Pallant
4a540d041a
Hide spinlock 31.
2022-01-30 16:43:59 +00:00
Jonathan 'theJPster' Pallant
efda22c9ea
Update spinlock docs.
2022-01-30 16:43:53 +00:00
Jonathan 'theJPster' Pallant
f44f5f0e09
Make clippy happy.
2022-01-30 16:12:43 +00:00
Jonathan 'theJPster' Pallant
35a10f2bc6
Clean up critical-section impl.
...
Adds new `Sio::core()` function.
2022-01-30 16:07:40 +00:00
Jonathan 'theJPster' Pallant
7e2f8d274c
Use const generics for spinlocks.
...
The fewer code-generating macros we have, the better!
2022-01-30 15:56:23 +00:00
Jonathan 'theJPster' Pallant
c8c366c23d
Use new spinlock API provide by PAC 0.3.0
2022-01-30 12:56:51 +00:00
9names
b19f2cc8e5
Use atomic operations for altering Timer interrupts
2022-01-30 22:54:27 +11:00
Wilfried Chauveau
d08bfac989
Fix i2c peripheral mode state machine
...
The start_det flag is set as soon as a start condition occurs
whereas rd_req flag is only set once the address byte is received.
2022-01-29 00:01:32 +11:00
Derek Hageman
f279945315
Add intrinsics for the hardware divider
...
Implement intrinsic functions so basic operators use the hardware divider.
2022-01-26 19:37:06 -07:00
Derek Hageman
35704d9799
Change divider delay to explicit NOPs
...
Use explicit NOPs since cortex_m::asm::delay actually delays for
longer than we need to.
2022-01-26 19:37:06 -07:00
Derek Hageman
c2d3b21d91
Make hardware divisor interrupt safe
...
Copy the pico-sdk logic for save and restore of the hardware divider
for making it interrupt safe.
2022-01-26 19:37:06 -07:00
9names
57e9943836
Set hw reset bits for watchdog
2022-01-20 21:55:16 +11:00
Victor Koenders
d6e3c7b615
Set the uart config default baud rate to 115200
2022-01-18 17:28:13 +01:00
Victor Koenders
b3b4d9ff6f
Fixed doc test
2022-01-18 11:32:48 +01:00
Victor Koenders
9e75cec551
Added impl Default
for UartConfig
2022-01-18 11:17:01 +01:00
Wilfried Chauveau
7840d0f833
embassy-traits: Fix unexpected restart on repeated read.
2022-01-13 19:28:23 +11:00
Jonathan 'theJPster' Pallant
d3c9c3b4e2
Merge pull request #263 from WeirdConstructor/fix_alarm_schedule_race_cond
...
Fix alarm schedule race condition
2022-01-12 20:07:59 +00:00
Weird Constructor
7a23247ca1
Fix alarm schedule() race condition.
2022-01-12 06:41:03 +01:00
Weird Constructor
a7b71bd5aa
Fix compilation bug in the documentation
2022-01-09 15:16:01 +01:00
Weird Constructor
9e84c961a8
(Hopefully) Improved documentation of bsp_pins!()
2022-01-09 13:50:57 +01:00
Jonathan 'theJPster' Pallant
f23ababb1a
Merge pull request #197 from chinoto/pio_sound_send
...
pio: Fix unsound Send clippy warning
2022-01-06 12:57:26 +00:00
Jonathan Pallant
67d9da85e6
Fix docs for SerialInfallible.
2021-12-26 20:57:04 +00:00
Jonathan Pallant
55acbdb1b0
Fix build errors in eh_1.0 mode.
2021-12-26 20:56:48 +00:00
Jonathan Pallant (Ferrous Systems)
d3bd232885
Added two UART IRQ examples.
...
They are in the pico BSP as they need the 'rt' feature. Also includes
changes to the UART driver for enabling/disabling interrupts.
2021-12-26 19:33:23 +00:00
Victor Koenders
8f63be0f22
Fixed failing doctest
2021-12-25 09:49:32 +01:00
Victor Koenders
86444448a4
Migrated examples to the new uart system
2021-12-25 09:46:40 +01:00
Victor Koenders
c41c273131
Added reader/writer split to UartPeripheral
2021-12-25 09:46:38 +01:00
Victor Koenders
84b8fb05b0
Fixed compile errors on eh1_0_alpha feature
2021-12-25 09:46:34 +01:00
Victor Koenders
a8a27672b8
Constraint the uart::pin:: traits to UartDevice
2021-12-25 09:45:57 +01:00
Victor Koenders
a4a0bcf987
Added pins to the uart constructor functions
2021-12-25 09:45:54 +01:00
Victor Koenders
bdfb4d82c9
Split uart in separate files, introduced a typesystem constraint for valid UART pin configurations
2021-12-25 09:45:45 +01:00
Jonathan Pallant
4959afe151
Include manufacturer in BSP crate name.
...
Avoids ambiguity.
2021-12-20 21:28:00 +00:00
Pedro Ferreira
24a417f01a
Make fields in UartConfig public ( #233 )
...
Otherwise it's impossible to have a configuration which differs from the provided default options.
2021-12-14 10:47:35 +11:00
9names
427344667e
Add basic multicore FIFO example ( #226 )
...
* Add basic multicore fifo example
* Add documentation for multicore
* Send system_clock frequency to core1 over FIFO in example
* Add Stack::new() to HAL. Use Stack::new() in example
2021-12-08 19:34:39 +11:00
Jonathan 'theJPster' Pallant
b94a5ab885
Merge pull request #232 from jannic/refactor-uart-init
...
Refactor uart init
2021-12-05 18:02:44 +00:00
Jan Niehusmann
b380b3ddf6
Reset UART in new()
2021-12-05 07:05:12 +00:00
9names
dc8ceffd09
Move uses of sio::Sio to Sio
2021-12-04 16:20:27 +11:00
9names
11aa0b87af
Cargo fmt
2021-12-04 15:38:25 +11:00
Jan Niehusmann
26fa532fa3
Refactor Uart initialization
2021-12-03 21:24:50 +00:00
9names
33ff337631
Merge branch 'rp-rs:main' into reexport_mod_structs
2021-12-04 00:43:14 +11:00
9names
6ab9cd7ed3
Generate sev in sio.fifo.write()
2021-12-04 00:42:46 +11:00
9names
55a8b4acf9
Re-export mod structs
2021-12-04 00:04:45 +11:00
9names
a7d5dc2bee
Add safety docs from atsamd-rs to GPIO traits
2021-12-03 23:42:45 +11:00
Gus Caplan
5dafe3985f
use user-provided stack for core 1
...
Fixes: https://github.com/rp-rs/rp-hal/issues/218
2021-12-03 20:24:53 +11:00
9names
d84e641390
Add simple interrupt_disable+spinlock critical-section impl ( #151 )
...
* Add basic interrupt_disable+spinlock critical-section
* Update impl based on feedback from jannic
* Get rid of count variable, switch to AtomicU8 for lock state
* Remove interrupt::disable that isn't necessary for safety
* Rename variables, re-write most of the comments
* Add fences to ensure ordering
2021-12-02 00:03:41 +11:00
devsnek
e1f99443d9
multicore ( #89 )
...
mvp multicore implementation
Co-authored-by: Jan Niehusmann <jan@gondor.com>
2021-12-01 23:52:53 +11:00
Trangar
f68f148d12
Added RtcClock DateTime and alarms ( #213 )
...
* Added RealTimeClock, DateTime and RTC alarms
* Improved documentation on weird behaviors in the RealTimeClock
* Fixed incorrect leap_year_check in RealTimeClock
* Fixed rtc-datetime PR feedback
2021-11-29 21:15:20 +11:00
Jonathan 'theJPster' Pallant
fad1dfa259
Merge pull request #191 from jannic/rename-set_instruction
...
Rename set_instruction to exec_instruction
2021-11-25 19:08:13 +00:00
Jonathan 'theJPster' Pallant
3a3280575f
Merge pull request #204 from rp-rs/add_sio_fifo
...
Add SIO FIFO
2021-11-25 19:05:40 +00:00
Jan Niehusmann
bb8531445e
Fix fmt
...
Thats what happens when editing files directly on github...
2021-11-25 16:44:57 +00:00
Jan Niehusmann
15c162757f
Update docs in rp2040-hal/src/pio.rs
...
Co-authored-by: Wilfried Chauveau <wilfried.chauveau@ithinuel.me>
2021-11-25 17:38:18 +01:00
Jonathan Pallant (Ferrous Systems)
69255f7b8c
Fix wfe/sev semantics.
...
We must sev on write, so the other core can wfe on read.
2021-11-25 15:14:03 +00:00