modm API documentation
modm::platform::BdmaChannelHal< base_addr > Class Template Reference

#include <modm/platform/dma/bdma_hal.hpp>

Inheritance diagram for modm::platform::BdmaChannelHal< base_addr >:
modm::platform::BdmaBase

Public Typedefs

using IrqHandler = void (*)(void)
 

Public Types

enum  Channel {
  Channel0 = 0, Channel1, Channel2, Channel3,
  Channel4, Channel5, Channel6, Channel7
}
 
enum  CircularMode : uint32_t { Disabled = 0, CircularMode::Enabled = BDMA_CCR_CIRC }
 
enum  DataTransferDirection : uint32_t { DataTransferDirection::PeripheralToMemory = 0, DataTransferDirection::MemoryToPeripheral = BDMA_CCR_DIR, DataTransferDirection::MemoryToMemory = BDMA_CCR_MEM2MEM }
 
enum  InterruptEnable : uint32_t { TransferComplete = BDMA_CCR_TCIE, HalfTransfer = BDMA_CCR_HTIE, TransferError = BDMA_CCR_TEIE }
 
enum  InterruptFlags : uint8_t {
  Global = 0b0001, TransferComplete = 0b0010, HalfTransferComplete = 0b0100, Error = 0b1000,
  All = 0b1111
}
 
enum  MemoryDataSize : uint32_t {
  Byte = 0, Bit8 = Byte, HalfWord = BDMA_CCR_MSIZE_0, Bit16 = HalfWord,
  Word = BDMA_CCR_MSIZE_1, Bit32 = Word
}
 
enum  MemoryIncrementMode : uint32_t { Fixed = 0, MemoryIncrementMode::Increment = BDMA_CCR_MINC }
 
enum  PeripheralDataSize : uint32_t {
  Byte = 0, Bit8 = Byte, HalfWord = BDMA_CCR_PSIZE_0, Bit16 = HalfWord,
  Word = BDMA_CCR_PSIZE_1, Bit32 = Word
}
 
enum  PeripheralIncrementMode : uint32_t { Fixed = 0, PeripheralIncrementMode::Increment = BDMA_CCR_PINC }
 
enum  Priority : uint32_t { Low = 0, Medium = BDMA_CCR_PL_0, High = BDMA_CCR_PL_1, VeryHigh = BDMA_CCR_PL_1 | BDMA_CCR_PL_0 }
 
enum  Request {
  None = 0, Request1, Request2, Request3,
  Request4, Request5, Request6, Request7,
  Request8, Request9, Request10, Request11,
  Request12, Request13, Request14, Request15,
  Request16, Request17
}
 
enum  Signal : uint8_t {
  NoSignal, A, B, Generator0,
  Generator1, Generator2, Generator3, Generator4,
  Generator5, Generator6, Generator7, Rx,
  Tx
}
 

Public Member Functions

 MODM_FLAGS32 (InterruptEnable)
 
 MODM_FLAGS32 (InterruptFlags)
 

Static Public Member Functions

static void configure (DataTransferDirection direction, MemoryDataSize memoryDataSize, PeripheralDataSize peripheralDataSize, MemoryIncrementMode memoryIncrement, PeripheralIncrementMode peripheralIncrement, Priority priority=Priority::Medium, CircularMode circularMode=CircularMode::Disabled)
 
static void start ()
 
static void stop ()
 
static DataTransferDirection getDataTransferDirection ()
 
static void setMemoryAddress (uintptr_t address)
 
static void setPeripheralAddress (uintptr_t address)
 
static void setMemoryIncrementMode (bool increment)
 
static void setPeripheralIncrementMode (bool increment)
 
static void setDataLength (std::size_t length)
 
static void enableInterrupt (InterruptEnable_t irq)
 
static void disableInterrupt (InterruptEnable_t irq)
 

Detailed Description

template<uintptr_t base_addr>
class modm::platform::BdmaChannelHal< base_addr >

BDMA channel low-level register abstraction

Template Parameters
base_addrbase address of the channel registers

Member Enumeration Documentation

enum modm::platform::BdmaBase::CircularMode : uint32_t
inheritedstrong
Enum ValuesDocumentation
Enabled 

circular mode

enum modm::platform::BdmaBase::DataTransferDirection : uint32_t
inheritedstrong
Enum ValuesDocumentation
PeripheralToMemory 

Source: DMA_CPARx; Sink: DMA_CMARx.

MemoryToPeripheral 

Source: DMA_CMARx; Sink: DMA_CPARx.

MemoryToMemory 

Source: DMA_CPARx; Sink: DMA_CMARx.

enum modm::platform::BdmaBase::MemoryIncrementMode : uint32_t
inheritedstrong
Enum ValuesDocumentation
Increment 

incremented according to MemoryDataSize

enum modm::platform::BdmaBase::PeripheralIncrementMode : uint32_t
inheritedstrong
Enum ValuesDocumentation
Increment 

incremented according to PeripheralDataSize

enum modm::platform::BdmaBase::Signal : uint8_t
inheritedstrong

Peripheral signals that can be used in DMA channels

Member Function Documentation

template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::configure ( DataTransferDirection  direction,
MemoryDataSize  memoryDataSize,
PeripheralDataSize  peripheralDataSize,
MemoryIncrementMode  memoryIncrement,
PeripheralIncrementMode  peripheralIncrement,
Priority  priority = Priority::Medium,
CircularMode  circularMode = CircularMode::Disabled 
)
inlinestatic

Configure the DMA channel (HAL)

Stops the DMA channel and writes the new values to its control register.

Parameters
[in]directionDirection of the DMA channel
[in]memoryDataSizeSize of data in memory (byte, halfword, word)
[in]peripheralDataSizeSize of data in peripheral (byte, halfword, word)
[in]memoryIncrementDefines whether the memory address is incremented after a transfer completed
[in]peripheralIncrementDefines whether the peripheral address is incremented after a transfer completed
[in]priorityPriority of the DMA channel
[in]circularModeTransfer data in circular mode?
template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::disableInterrupt ( InterruptEnable_t  irq)
inlinestatic

Disable IRQ of this DMA channel (e.g. transfer complete or error)

template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::enableInterrupt ( InterruptEnable_t  irq)
inlinestatic

Enable IRQ of this DMA channel (e.g. transfer complete or error)

template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::setDataLength ( std::size_t  length)
inlinestatic

Set length of data to transfer

template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::setMemoryAddress ( uintptr_t  address)
inlinestatic

Set the memory address of the DMA channel

Note
In Mem2Mem mode use this method to set the memory source address.
Parameters
[in]addressSource address
template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::setMemoryIncrementMode ( bool  increment)
inlinestatic

Enable/disable memory increment

When enabled, the memory address is incremented by the size of the data (e.g. 1 for byte transfers, 4 for word transfers) after the transfer completed.

Parameters
[in]incrementEnable/disable
template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::setPeripheralAddress ( uintptr_t  address)
inlinestatic

Set the peripheral address of the DMA channel

Note
In Mem2Mem mode use this method to set the memory destination address.
Parameters
[in]addressDestination address
template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::setPeripheralIncrementMode ( bool  increment)
inlinestatic

Enable/disable peripheral increment

When enabled, the peripheral address is incremented by the size of the data (e.g. 1 for byte transfers, 4 for word transfers) after the transfer completed.

Parameters
[in]incrementEnable/disable
template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::start ( )
inlinestatic

Start the transfer of the DMA channel

template<uintptr_t base_addr>
static void modm::platform::BdmaChannelHal< base_addr >::stop ( )
inlinestatic

Stop a DMA channel transfer


The documentation for this class was generated from the following file: