mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/sam0/spi: generalize pm_layered interaction
In DMA mode SPI transfers are carried out by HW. We need to block certain pm modes during transfer.
This commit is contained in:
parent
db9263eeca
commit
24461b43f8
@ -2,6 +2,7 @@
|
||||
* Copyright (C) 2014-2016 Freie Universität Berlin
|
||||
* 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* 2015 FreshTemp, LLC.
|
||||
* 2022 SSV Software Systems GmbH
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
@ -22,6 +23,7 @@
|
||||
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
|
||||
* @author Juergen Fitschen <me@jue.yt>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
@ -459,15 +461,15 @@ static void _blocking_transfer(spi_t bus, const void *out, void *in, size_t len)
|
||||
|
||||
static void _dma_execute(spi_t bus)
|
||||
{
|
||||
#if defined(CPU_COMMON_SAMD21)
|
||||
pm_block(SAMD21_PM_IDLE_1);
|
||||
#if IS_ACTIVE(MODULE_PM_LAYERED) && defined(SAM0_SPI_PM_BLOCK)
|
||||
pm_block(SAM0_SPI_PM_BLOCK);
|
||||
#endif
|
||||
dma_start(_dma_state[bus].rx_dma);
|
||||
dma_start(_dma_state[bus].tx_dma);
|
||||
|
||||
dma_wait(_dma_state[bus].rx_dma);
|
||||
#if defined(CPU_COMMON_SAMD21)
|
||||
pm_unblock(SAMD21_PM_IDLE_1);
|
||||
#if IS_ACTIVE(MODULE_PM_LAYERED) && defined(SAM0_SPI_PM_BLOCK)
|
||||
pm_unblock(SAM0_SPI_PM_BLOCK);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,13 @@ extern "C" {
|
||||
#define SAMD21_PM_IDLE_0 (3U) /**< Idle 0 (stops CPU) */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SPI configuration
|
||||
* @{
|
||||
*/
|
||||
#define SAM0_SPI_PM_BLOCK SAMD21_PM_IDLE_1 /**< Stay in Idle 0 mode */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name USB configuration
|
||||
* @{
|
||||
|
Loading…
Reference in New Issue
Block a user