aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* added TL Mailbox initialization for STM32WBgoueslati2023-05-0211-1334/+2063
|
* Merge #1404bors[bot]2023-05-0112-53/+1409
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1404: feat(stm32): Add DMA based, ring-buffer based rx uart, v3 r=Dirbaio a=rmja This PR replaces #1150. Comparing to that PR, this one has the following changes: * The implementation now aligns with the new stm32 dma module, thanks `@Dirbaio!` * Calls to `read()` now returns on either 1) idle line, or 2) ring buffer is at most half full. This is different from the previous pr, which would return a lot of 1 byte reads. Thank you `@chemicstry` for making me realize that it was actually not what I wanted. This is accomplished using half-transfer completed and full-transfer completed interrupts. Both seems to be supported on both dma and bdma. The implementation still have the issue mentioned here: https://github.com/embassy-rs/embassy/pull/1150#discussion_r1094627035 Regarding the todos here: https://github.com/embassy-rs/embassy/pull/1150#issuecomment-1513905925. I have removed the exposure of ndtr from `dma::RingBuffer` to the uart so that the uart now simply calls `ringbuf::reload_position()` to align the position within the ring buffer to that of the actual running dma controller. BDMA and GPDMA is not implemented. I do not have any chips with those dma controllers, so maybe someone else should to this so that it can be tested. The `saturate_serial` test utility inside `tests/utils` has an `--idles` switch which can be used to saturate the uart from a pc, but with random idles. Because embassy-stm32 now can have tests, we should probably run them in ci. I do this locally to test the DmaRingBuffer: `cargo test --no-default-features --features stm32f429ig`. cc `@chemicstry` `@Dirbaio` Co-authored-by: Rasmus Melchior Jacobsen <[email protected]> Co-authored-by: Dario Nieuwenhuis <[email protected]>
| * stm32/test: fix race condition in uart_dma.Dario Nieuwenhuis2023-05-011-9/+18
| |
| * stm32/test: cleanup ringbuffer test, exit on success (transferring 100kb)Dario Nieuwenhuis2023-05-011-39/+38
| |
| * stm32/test: add real defmt timestampDario Nieuwenhuis2023-05-012-12/+2
| |
| * stm32/dma: solve overlapping impl on DmaCtrl on stm32h7Dario Nieuwenhuis2023-05-013-15/+19
| |
| * stm32/uart: feature-gate ringbuffer out when using gpdma, not supported yet.Dario Nieuwenhuis2023-05-014-7/+20
| |
| * stm32/bdma: add ringbuffer support.Dario Nieuwenhuis2023-05-011-4/+183
| |
| * stm32/dma: remove separate process_tcif.Dario Nieuwenhuis2023-05-011-37/+9
| |
| * Actually clear idle flagRasmus Melchior Jacobsen2023-05-011-1/+8
| |
| * Remove unused importRasmus Melchior Jacobsen2023-05-011-1/+1
| |
| * Support overflow detection for more than one ring-periodRasmus Melchior Jacobsen2023-05-015-179/+214
| |
| * Do not disable dma request when idle line is detectedRasmus Melchior Jacobsen2023-05-011-5/+0
| |
| * Ring-buffered uart rx with one-period overrun detectionRasmus Melchior Jacobsen2023-05-019-18/+1171
|/
* Merge #1376bors[bot]2023-05-0120-534/+251
|\ | | | | | | | | | | | | | | 1376: rtc: cleanup and consolidate r=Dirbaio a=xoviat This removes an extra file that I left in, adds an example, and consolidates the files into one 'v2' file. Co-authored-by: xoviat <[email protected]>
| * stm32/rtc: fix datetime and add f4 testxoviat2023-04-253-11/+69
| |
| * stm32/rtc: impl. functions on traitxoviat2023-04-183-67/+69
| |
| * stm32/rtc: build more chipsxoviat2023-04-183-94/+79
| |
| * stm32/rtc: cleanup and consolidatexoviat2023-04-1815-438/+110
| |
* | Merge #1414bors[bot]2023-05-016-151/+1005
|\ \ | | | | | | | | | | | | | | | | | | | | | 1414: rp: report errors from buffered and dma uart receives r=Dirbaio a=pennae neither of these reported errors so far, which is not ideal. add error reporting to both of them that matches the blocking error reporting as closely as is feasible, even allowing partial receives from buffered uarts before errors are reported where they would have been by the blocking code. dma transfers don't do this, if an errors applies to any byte in a transfer the entire transfer is nuked (though we probably could report how many bytes have been transferred). Co-authored-by: pennae <[email protected]>
| * | rp/uart: report errors from dma receivepennae2023-05-014-25/+375
| | |
| * | rp/uart: extract fifo draining from blocking_readpennae2023-05-011-23/+27
| | | | | | | | | | | | this will also be needed for dma operations.
| * | rp/uart: make dma multicore-safepennae2023-05-011-2/+2
| | | | | | | | | | | | | | | running rx and tx on different cores could lead to hangs if the dmacr register modifys run concurrently. this is bad.
| * | rp/uart: report errors from buffered uartpennae2023-05-012-34/+301
| | | | | | | | | | | | | | | | | | | | | | | | | | | this reports errors at the same location the blocking uart would, which works out to being mostly exact (except in the case of overruns, where one extra character is dropped). this is actually easier than going nuclear in the case of errors and nuking both the buffer contents and the rx fifo, both of which are things we'd have to do in addition to what's added here, and neither are needed for correctness.
| * | rp/uart: extract common code from async and blocking buffered readspennae2023-05-011-47/+39
| | | | | | | | | | | | | | | once we add error propagation the common code will become even larger, so it makes sense to move it out.
| * | tests/rp: test error conditions for uartpennae2023-05-011-11/+148
| | |
| * | rp/uart: rename state to buffered_statepennae2023-05-012-14/+14
| | | | | | | | | | | | we'll add a dma state soon as well.
| * | rp/uart: add set-break functionspennae2023-05-012-1/+95
| | | | | | | | | | | | | | | | | | | | | sending break conditions is necessary to implement some protocols, and the hardware supports this natively. we do have to make sure that we don't assert a break condition while the uart is busy though, otherwise the break may be inserted before the last character in the tx fifo.
| * | rp/uart: add UartRx::new_blockingpennae2023-05-011-0/+10
| | |
| * | tests/rp: fix buffered uart testpennae2023-05-011-3/+3
| | | | | | | | | | | | | | | | | | the rp uart receive fifo is 32 entries deep, so the 31 byte test data fits into it without needing any buffering. extend to 48 bytes to fill the entire fifo and the 16 byte test buffer.
* | | Merge #1395bors[bot]2023-05-015-443/+284
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | 1395: rp/pio: bit of a rework r=Dirbaio a=pennae the pio module is currently in a Bit of a State. this is far from all that's needed to make it more useful, but it's a start. Co-authored-by: pennae <[email protected]>
| * | rp/pio: write instr memory only from commonpennae2023-05-014-79/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instruction memory is a shared resource. writing it only from PioCommon clarifies this, and perhaps makes it more obvious that multiple state machines can share the same instructions. this also allows *freeing* of instruction memory to reprogram the system, although this interface is not entirely safe yet. it's safe in the sense rusts understands things, but state machines may misbehave if their instruction memory is freed and rewritten while they are running. fixing this is out of scope for now since it requires some larger changes to how state machines are handled. the interface provided currently is already unsafe in that it lets people execute instruction memory that has never been written, so this isn't much of a drawback for now.
| * | rp/pio: remove a bunch of unnecessary let _ = selfpennae2023-05-011-13/+0
| | |
| * | rp/pio: move non-sm-specific methods to PioCommonpennae2023-05-013-45/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pin and irq operations affect the entire pio block. with pins this is not very problematic since pins themselves are resources, but irqs are not treated like that and can thus interfere across state machines. the ability to wait for an irq on a state machine is kept to make synchronization with user code easier, and since we can't inspect loaded programs at build time we wouldn't gain much from disallowing waits from state machines anyway.
| * | rp/pio: remove top-level PIOS arraypennae2023-05-011-162/+90
| | | | | | | | | | | | | | | | | | this mainly removes the need for explicit indexing to get the pac object. runtime effect is zero, but arguably things are a bit easier to read with less indexing.
| * | rp/pio: seal PioInstance, SmInstancepennae2023-05-011-20/+41
| | | | | | | | | | | | seems prudent to hide access to the internals.
| * | rp/pio: don't call dma::init so muchpennae2023-05-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is already done during platform init. it wasn't even sound in the original implementation because futures would meddle with the nvic in critical sections, while another (interrupt) executor could meddle with the nvic without critical sections here. it is only accidentally sound now and only if irq1 of both pios isn't used by user code. luckily the worst we can expect to happen is interrupt priorities being set wrong, but wrong is wrong is wrong.
| * | rp/pio: enable pio interrupts only oncepennae2023-05-012-36/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | since we never actually *disable* these interrupts for any length of time we can simply enable them globally. we also initialize all pio interrupt flags to not cause system interrupts since state machine irqa are not necessarily meant to cause a system interrupt when set. the fifo interrupts are sticky and can likewise only be cleared inside the handler by disabling them.
| * | rp/pio: use atomic accesses, not critical sectionspennae2023-05-011-24/+12
| | | | | | | | | | | | | | | atomic accesses are not only faster but also can't conflict with other critical sections.
| * | rp/pio: handle all pio irqs in one handlerpennae2023-05-011-90/+44
|/ / | | | | | | | | | | | | | | | | | | | | | | | | dma does this too, also with 12 bits to check. this decreases code size significantly (increasing speed when the cache is cold), frees up an interrupt handler, and avoids read-modify-write cycles (which makes each processed flag cheaper). due to more iterations per handler invocation the actual runtime of the handler body remains roughly the same (slightly faster at O2, slightly slower at Oz). notably wakers are now kept in one large array indexed by the irq register bit number instead of three different arrays, this allows for machine code-level optimizations of waker lookups.
* | Merge #1407bors[bot]2023-04-3047-9712/+12
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 1407: Remove legacy LoRa drivers r=Dirbaio a=ceekdee Remove legacy LoRa drivers and associated configuration. Co-authored-by: ceekdee <[email protected]> Co-authored-by: Chuck Davis <[email protected]>
| * \ Merge branch 'embassy-rs:master' into masterChuck Davis2023-04-304-18/+216
| |\ \ | |/ / |/| |
* | | Merge #1405bors[bot]2023-04-302-0/+180
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1405: add IPCC peripheral for stm32wb r=xoviat a=OueslatiGhaith Hello again, This pull request is related to #1397 and #1401, inspired by #24, and was tested on an stm32wb55rg. This pull request aims to add the IPCC peripheral for stm32wb microcontrollers. I am debating whether this should be included in the public API, since the IPCC peripheral would be typically managed by the TL Mailbox, not by the app directly. Co-authored-by: OueslatiGhaith <[email protected]>
| * | | removed constrain methodOueslatiGhaith2023-04-281-10/+0
| | | |
| * | | reversed changes in Cargo.tomlOueslatiGhaith2023-04-271-1381/+1348
| | | |
| * | | fixed missing importsOueslatiGhaith2023-04-272-1348/+1383
| | | |
| * | | fixed mistake with casting channel to a usizeOueslatiGhaith2023-04-271-14/+14
| | | |
| * | | add IPCC peripheral for stm32wbOueslatiGhaith2023-04-272-0/+188
| | | |
* | | | Merge #1412bors[bot]2023-04-301-18/+14
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1412: stm32/uart: abort on error r=Dirbaio a=xoviat This PR aborts the DMA transfer in the event of a UART error. Otherwise, the transfer will never complete, and an error will not be returned. Co-authored-by: xoviat <[email protected]>
| * | | | stm32/uart: abort on errorxoviat2023-04-281-18/+14
| | | | |