RTEMS 6.3
Loading...
Searching...
No Matches
usart_dma.c File Reference
#include "chip.h"
#include "string.h"
#include "stdlib.h"

Functions

uint32_t USARTD_Configure (UsartDma *pUsartd, uint8_t usartId, uint32_t UsartMode, uint32_t BaudRate, uint32_t UsartClk)
 Initializes the USARTDma structure and the corresponding USART & DMA . hardware select value. The driver will uses DMA channel 0 for RX and DMA channel 1 for TX. The DMA channels are freed automatically when no USART command processing.
uint32_t USARTD_EnableRxChannels (UsartDma *pUsartd, UsartChannel *pRxCh)
 This function initialize the appropriate DMA channel for Rx channel of USART.
uint32_t USARTD_EnableTxChannels (UsartDma *pUsartd, UsartChannel *pTxCh)
 This function initialize the appropriate DMA channel for Tx channel of USART.
uint32_t USARTD_DisableRxChannels (UsartDma *pUsartd, UsartChannel *pRxCh)
 This function disables the appropriate DMA channel for Rx channel of USART.
uint32_t USARTD_DisableTxChannels (UsartDma *pUsartd, UsartChannel *pTxCh)
 This function disables the appropriate DMA channel for Tx channel of USART.
uint32_t USARTD_SendData (UsartDma *pUsartd)
 Starts a USART master transfer. This is a non blocking function. It will return as soon as the transfer is started.
uint32_t USARTD_RcvData (UsartDma *pUsartd)
 Starts a USART master transfer. This is a non blocking function. It will return as soon as the transfer is started.

Detailed Description

Implementation for the USART with xDMA driver.

Function Documentation

◆ USARTD_Configure()

uint32_t USARTD_Configure ( UsartDma * pUsartd,
uint8_t usartId,
uint32_t UsartMode,
uint32_t BaudRate,
uint32_t UsartClk )

Initializes the USARTDma structure and the corresponding USART & DMA . hardware select value. The driver will uses DMA channel 0 for RX and DMA channel 1 for TX. The DMA channels are freed automatically when no USART command processing.

Parameters
pUSARTDPointer to a UsartDma instance.
pUsartHwAssociated USART peripheral.
usartIdUSART peripheral identifier.
UsartClkUSART clock.
pXdmadPointer to a Dmad instance.

◆ USARTD_DisableRxChannels()

uint32_t USARTD_DisableRxChannels ( UsartDma * pUsartd,
UsartChannel * pRxCh )

This function disables the appropriate DMA channel for Rx channel of USART.

Parameters
pUsartdPointer to a UsartDma instance.
pRxChPointer to TxChannel configuration
Returns
0 if the transfer has been started successfully; otherwise returns USARTD_ERROR_LOCK is the driver is in use, or USARTD_ERROR if the command is not valid.

◆ USARTD_DisableTxChannels()

uint32_t USARTD_DisableTxChannels ( UsartDma * pUsartd,
UsartChannel * pTxCh )

This function disables the appropriate DMA channel for Tx channel of USART.

Parameters
pUsartdPointer to a USARTDma instance.
pTxChPointer to TxChannel configuration
Returns
0 if the transfer has been started successfully; otherwise returns USARTD_ERROR_LOCK is the driver is in use, or USARTD_ERROR if the command is not valid.

◆ USARTD_EnableRxChannels()

uint32_t USARTD_EnableRxChannels ( UsartDma * pUsartd,
UsartChannel * pRxCh )

This function initialize the appropriate DMA channel for Rx channel of USART.

Parameters
pUsartdPointer to a UsartDma instance.
pRxChPointer to TxChannel configuration
Returns
0 if the transfer has been started successfully; otherwise returns USARTD_ERROR_LOCK is the driver is in use, or USARTD_ERROR if the command is not valid.

◆ USARTD_EnableTxChannels()

uint32_t USARTD_EnableTxChannels ( UsartDma * pUsartd,
UsartChannel * pTxCh )

This function initialize the appropriate DMA channel for Tx channel of USART.

Parameters
pUsartdPointer to a USARTDma instance.
pTxChPointer to TxChannel configuration
Returns
0 if the transfer has been started successfully; otherwise returns USARTD_ERROR_LOCK is the driver is in use, or USARTD_ERROR if the command is not valid.

◆ USARTD_RcvData()

uint32_t USARTD_RcvData ( UsartDma * pUsartd)

Starts a USART master transfer. This is a non blocking function. It will return as soon as the transfer is started.

Parameters
pUSARTDPointer to a USARTDma instance.
Returns
0 if the transfer has been started successfully; otherwise returns USARTD_ERROR_LOCK is the driver is in use, or USARTD_ERROR if the command is not valid.

◆ USARTD_SendData()

uint32_t USARTD_SendData ( UsartDma * pUsartd)

Starts a USART master transfer. This is a non blocking function. It will return as soon as the transfer is started.

Parameters
pUSARTDPointer to a USARTDma instance.
Returns
0 if the transfer has been started successfully; otherwise returns USARTD_ERROR_LOCK is the driver is in use, or USARTD_ERROR if the command is not valid.