RTEMS: bsps/arm/atsam/include/libchip/include/afe_dma.h File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
afe_dma.h File Reference
`#include "chip.h"`

Go to the source code of this file.

## Data Structures
struct | AfeCmd
| Spi Transfer Request prepared by the application upper layer. More...
struct | AfeDma

## Macros
#define | AFE_OK 0
#define | AFE_ERROR 1
#define | AFE_ERROR_LOCK 2

## Typedefs
typedef void(* | AfeCallback) (uint8_t, void *)

## Functions
uint32_t | Afe_ConfigureDma (AfeDma *pAfed, Afec *pAfeHw, uint8_t AfeId, sXdmad *pXdmad)
| Initializes the AfeDma structure and the corresponding AFE & 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 | Afe_SendData (AfeDma *pAfed, AfeCmd *pCommand)
| Starts a AFE 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 (AFEC) peripheral.

# Usage

1. Configurate the pins for AFEC.
2. Initialize the AFEC with AFEC_Initialize().
3. Set AFEC clock and timing with AFEC_SetClock() and AFEC_SetTiming().
4. Select the active channel using AFEC_EnableChannel().
5. Start the conversion with AFEC_StartConversion().
6. Wait the end of the conversion by polling status with AFEC_GetStatus().
7. Finally, get the converted data using AFEC_GetConvertedData() or AFEC_GetLastConvertedData().

## Typedef Documentation

## ◆ AfeCallback

typedef void(* AfeCallback) (uint8_t, void *)

AFE transfer complete callback.

## Function Documentation

## ◆ Afe_ConfigureDma()

uint32_t Afe_ConfigureDma | ( | AfeDma * | pAfed,
|  | Afec * | pAfeHw,
|  | uint8_t | AfeId,
|  | sXdmad * | pXdmad
| ) |  |

Initializes the AfeDma structure and the corresponding AFE & 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

  pAfed | Pointer to a AfeDma instance.
  pAfeHw | Associated Afe peripheral.
  AfeId | Afe peripheral identifier.
  pDmad | Pointer to a Dmad instance.

## ◆ Afe_SendData()

uint32_t Afe_SendData | ( | AfeDma * | pAfed,
|  | AfeCmd * | pCommand
| ) |  |

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

Parameters

  pAfed | Pointer to a AfeDma instance.
  pCommand | Pointer to the Afe command to execute.

Returns
  0 if the transfer has been started successfully; otherwise returns AFE_ERROR_LOCK is the driver is in use, or AFE_ERROR if the command is not valid.