RTEMS 6.3
Loading...
Searching...
No Matches
dac_dma.h File Reference
#include "chip.h"
#include <stdint.h>
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  DacCmd
 Dac Transfer Request prepared by the application upper layer. More...
struct  DacDma

Macros

#define DAC_OK   0
#define DAC_ERROR   1
#define DAC_ERROR_LOCK   2
#define DACC_CHANNEL_0   0
#define DACC_CHANNEL_1   1
#define DACC_SoftReset(pDACC)
#define DACC_CfgModeReg(pDACC, mode)
#define DACC_GetModeReg(pDACC)
#define DACC_CfgTrigger(pDACC, mode)
#define DACC_EnableChannel(pDACC, channel)
#define DACC_DisableChannel(pDACC, channel)
#define DACC_EnableIt(pDACC, mode)
#define DACC_DisableIt(pDACC, mode)
#define DACC_GetStatus(pDACC)
#define DACC_GetChannelStatus(pDACC)
#define DACC_GetInterruptMaskStatus(pDACC)

Typedefs

typedef void(*) DacCallback(uint8_t, void *)

Functions

uint32_t Dac_ConfigureDma (DacDma *pDacd, Dacc *pDacHw, uint8_t DacId, sXdmad *pXdmad)
 Initializes the DacDma structure and the corresponding DAC & DMA . hardware select value. The driver will uses DMA channel 0 for RX . The DMA channels are freed automatically when no DMA command processing.
uint32_t Dac_SendData (DacDma *pDacd, DacCmd *pCommand)
 Starts a DAC transfer. This is a non blocking function. It will return as soon as the transfer is started.

Detailed Description

Purpose

Interface for configuration the Analog-to-Digital Converter (DACC) peripheral.

Usage

  1. Configurate the pins for DACC
  2. Initialize the DACC with DACC_Initialize().
  3. Select the active channel using DACC_EnableChannel()
  4. Start the conversion with DACC_StartConversion()
  5. Wait the end of the conversion by polling status with DACC_GetStatus()
  6. Finally, get the converted data using DACC_GetConvertedData()

Macro Definition Documentation

◆ DACC_CfgModeReg

#define DACC_CfgModeReg ( pDACC,
mode )
Value:
{ (pDACC)->DACC_MR = (mode); }

◆ DACC_CfgTrigger

#define DACC_CfgTrigger ( pDACC,
mode )
Value:
{ (pDACC)->DACC_TRIGR = (mode); }

◆ DACC_DisableChannel

#define DACC_DisableChannel ( pDACC,
channel )
Value:
{(pDACC)->DACC_CHDR = (1 << (channel));}

◆ DACC_DisableIt

#define DACC_DisableIt ( pDACC,
mode )
Value:
{(pDACC)->DACC_IDR = (mode);}

◆ DACC_EnableChannel

#define DACC_EnableChannel ( pDACC,
channel )
Value:
{(pDACC)->DACC_CHER = (1 << (channel));}

◆ DACC_EnableIt

#define DACC_EnableIt ( pDACC,
mode )
Value:
{(pDACC)->DACC_IER = (mode);}

◆ DACC_GetChannelStatus

#define DACC_GetChannelStatus ( pDACC)
Value:
((pDACC)->DACC_CHSR)

◆ DACC_GetInterruptMaskStatus

#define DACC_GetInterruptMaskStatus ( pDACC)
Value:
((pDACC)->DACC_IMR)

◆ DACC_GetModeReg

#define DACC_GetModeReg ( pDACC)
Value:
((pDACC)->DACC_MR)

◆ DACC_GetStatus

#define DACC_GetStatus ( pDACC)
Value:
((pDACC)->DACC_ISR)

◆ DACC_SoftReset

#define DACC_SoftReset ( pDACC)
Value:
((pDACC)->DACC_CR = DACC_CR_SWRST)

Typedef Documentation

◆ DacCallback

typedef void(*) DacCallback(uint8_t, void *)

DAC transfer complete callback.

Function Documentation

◆ Dac_ConfigureDma()

uint32_t Dac_ConfigureDma ( DacDma * pDacd,
Dacc * pDacHw,
uint8_t DacId,
sXdmad * pXdmad )
extern

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

Parameters
pDacdPointer to a DacDma instance.
pDacHwAssociated Dac peripheral.
DacIdDac peripheral identifier.
pDmadPointer to a Dmad instance.

◆ Dac_SendData()

uint32_t Dac_SendData ( DacDma * pDacd,
DacCmd * pCommand )
extern

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

Parameters
pDacdPointer to a DacDma instance.
pCommandPointer to the Dac command to execute.
Returns
0 if the transfer has been started successfully; otherwise returns DAC_ERROR_LOCK is the driver is in use, or DAC_ERROR if the command is not valid.