distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::chip::DmaChannelHandle Class Reference

#include "distortos/chip/DmaChannelHandle.hpp"

Collaboration diagram for distortos::chip::DmaChannelHandle:
[legend]

Public Types

using Flags = DmaChannelFlags
 import DmaChannelFlags More...
 

Public Member Functions

constexpr DmaChannelHandle ()
 DmaChannelHandle's constructor. More...
 
 ~DmaChannelHandle ()
 DmaChannelHandle's destructor. More...
 
size_t getTransactionsLeft () const
 
void release ()
 Releases any associated low-level DMA channel driver. More...
 
int reserve (DmaChannel &channel, const uint8_t request, DmaChannelFunctor &functor)
 Reserves low-level DMA channel driver for exclusive use via this handle. More...
 
void startTransfer (const uintptr_t memoryAddress, const uintptr_t peripheralAddress, const size_t transactions, const Flags flags) const
 Configures and starts asynchronous transfer. More...
 
void stopTransfer () const
 Stops transfer. More...
 
 DmaChannelHandle (const DmaChannelHandle &)=delete
 
 DmaChannelHandle (DmaChannelHandle &&)=delete
 
const DmaChannelHandleoperator= (const DmaChannelHandle &)=delete
 
DmaChannelHandleoperator= (DmaChannelHandle &&)=delete
 

Private Attributes

DmaChannelchannel_
 pointer to low-level DMA channel driver associated with this handle More...
 

Detailed Description

DmaChannelHandle class can be used to access DmaChannel's functionality.

Member Typedef Documentation

◆ Flags

Constructor & Destructor Documentation

◆ DmaChannelHandle()

constexpr distortos::chip::DmaChannelHandle::DmaChannelHandle ( )
inline

DmaChannelHandle's constructor.

◆ ~DmaChannelHandle()

distortos::chip::DmaChannelHandle::~DmaChannelHandle ( )
inline

DmaChannelHandle's destructor.

Precondition
No driver is reserved with this handle.

Member Function Documentation

◆ getTransactionsLeft()

size_t distortos::chip::DmaChannelHandle::getTransactionsLeft ( ) const
inline
Precondition
Driver is reserved with this handle.
Returns
number of transactions left
Here is the call graph for this function:

◆ release()

void distortos::chip::DmaChannelHandle::release ( )
inline

Releases any associated low-level DMA channel driver.

Precondition
No transfer is in progress.
Postcondition
No driver is reserved with this handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reserve()

int distortos::chip::DmaChannelHandle::reserve ( DmaChannel channel,
const uint8_t  request,
DmaChannelFunctor functor 
)
inline

Reserves low-level DMA channel driver for exclusive use via this handle.

Precondition
No driver is reserved with this handle.
request is valid.
Parameters
[in]channelis a reference to low-level DMA channel driver which will be associated with this handle
[in]requestis the request identifier with which low-level DMA channel driver will be associated
[in]functoris a reference to DmaChannelFunctor object that will be notified about transfer-related events
Returns
0 on success, error code otherwise:
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startTransfer()

void distortos::chip::DmaChannelHandle::startTransfer ( const uintptr_t  memoryAddress,
const uintptr_t  peripheralAddress,
const size_t  transactions,
const Flags  flags 
) const
inline

Configures and starts asynchronous transfer.

This function returns immediately. When the transfer is physically finished (either expected number of transactions were executed or an error was detected), one of DmaChannelFunctor functions will be executed.

Precondition
Driver is reserved with this handle.
memoryAddress and peripheralAddress and transactions and flags are valid.
Memory data size multiplied by memory burst size is less than or equal to 16.
No transfer is in progress.
Postcondition
Transfer is in progress.
Parameters
[in]memoryAddressis the memory address, must be divisible by configured memory data size multiplied by configured memory burst size
[in]peripheralAddressis the peripheral address, must be divisible by peripheral data size multiplied by configured peripheral burst size
[in]transactionsis the number of transactions, [1; 65535]
[in]flagsare configuration flags
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopTransfer()

void distortos::chip::DmaChannelHandle::stopTransfer ( ) const
inline

Stops transfer.

This function should be used after previous asynchronous transfer is finished to restore DMA channel to proper state. It may also be used to stop any ongoing asynchronous transfer.

Precondition
Driver is reserved with this handle.
Postcondition
No transfer is in progress.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ channel_

DmaChannel* distortos::chip::DmaChannelHandle::channel_
private

pointer to low-level DMA channel driver associated with this handle


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