| Kinetis SDK v.2.0 API Reference Manual Rev. 0 Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- API Reference

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Files | Data Structures | Typedefs
FlexIO DMA SPI Driver
FlexIO SPI Driver

## Overview

## Files
file | fsl_flexio_spi_dma.h

## Data Structures
struct | flexio_spi_master_dma_handle_t
| FlexIO SPI DMA transfer handle, users should not touch the content of the handle. More...

## Typedefs
typedef flexio_spi_master_dma_handle_t | flexio_spi_slave_dma_handle_t
| Slave handle is the same with master handle. More...
typedef void(* | flexio_spi_master_dma_transfer_callback_t )(FLEXIO_SPI_Type *base, flexio_spi_master_dma_handle_t *handle, status_t status, void *userData)
| FlexIO SPI master callback for finished transmit.
typedef void(* | flexio_spi_slave_dma_transfer_callback_t )(FLEXIO_SPI_Type *base, flexio_spi_slave_dma_handle_t *handle, status_t status, void *userData)
| FlexIO SPI slave callback for finished transmit.

## DMA Transactional
status_t | FLEXIO_SPI_MasterTransferCreateHandleDMA (FLEXIO_SPI_Type *base, flexio_spi_master_dma_handle_t *handle, flexio_spi_master_dma_transfer_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle)
| Initializes the FLEXO SPI master DMA handle. More...
status_t | FLEXIO_SPI_MasterTransferDMA (FLEXIO_SPI_Type *base, flexio_spi_master_dma_handle_t *handle, flexio_spi_transfer_t *xfer)
| Performs a non-blocking FlexIO SPI transfer using DMA. More...
void | FLEXIO_SPI_MasterTransferAbortDMA (FLEXIO_SPI_Type *base, flexio_spi_master_dma_handle_t *handle)
| Aborts a FlexIO SPI transfer using DMA. More...
status_t | FLEXIO_SPI_MasterTransferGetCountDMA (FLEXIO_SPI_Type *base, flexio_spi_master_dma_handle_t *handle, size_t *count)
| Gets the remaining bytes for FlexIO SPI DMA transfer. More...
static void | FLEXIO_SPI_SlaveTransferCreateHandleDMA (FLEXIO_SPI_Type *base, flexio_spi_slave_dma_handle_t *handle, flexio_spi_slave_dma_transfer_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle)
| Initializes the FlexIO SPI slave DMA handle. More...
status_t | FLEXIO_SPI_SlaveTransferDMA (FLEXIO_SPI_Type *base, flexio_spi_slave_dma_handle_t *handle, flexio_spi_transfer_t *xfer)
| Performs a non-blocking FlexIO SPI transfer using DMA. More...
static void | FLEXIO_SPI_SlaveTransferAbortDMA (FLEXIO_SPI_Type *base, flexio_spi_slave_dma_handle_t *handle)
| Aborts a FlexIO SPI transfer using DMA. More...
static status_t | FLEXIO_SPI_SlaveTransferGetCountDMA (FLEXIO_SPI_Type *base, flexio_spi_slave_dma_handle_t *handle, size_t *count)
| Gets the remaining bytes to be transferred for FlexIO SPI DMA. More...

## Data Structure Documentation

struct _flexio_spi_master_dma_handle

typedef for flexio_spi_master_dma_handle_t in advance.

### Data Fields
size_t | transferSize
| Total bytes to be transferred. More...
bool | txInProgress
| Send transfer in progress.
bool | rxInProgress
| Receive transfer in progress.
dma_handle_t * | txHandle
| DMA handler for SPI send.
dma_handle_t * | rxHandle
| DMA handler for SPI receive.
flexio_spi_master_dma_transfer_callback_t | callback
| Callback for SPI DMA transfer.
void * | userData
| User Data for SPI DMA callback.

#### Field Documentation

size_t flexio_spi_master_dma_handle_t::transferSize

## Typedef Documentation

typedef flexio_spi_master_dma_handle_t flexio_spi_slave_dma_handle_t

## Function Documentation

status_t FLEXIO_SPI_MasterTransferCreateHandleDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_master_dma_handle_t * | handle,
|  | flexio_spi_master_dma_transfer_callback_t | callback,
|  | void * | userData,
|  | dma_handle_t * | txHandle,
|  | dma_handle_t * | rxHandle
| ) |  |

This function initializes the FLEXO SPI master DMA handle which can be used for other FLEXO SPI master transactional APIs. Usually, for a specified FLEXO SPI instance, user need only call this API once to get the initialized handle.

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | pointer to flexio_spi_master_dma_handle_t structure to store the transfer state.
  callback | SPI callback, NULL means no callback.
  userData | callback function parameter.
  txHandle | User requested DMA handle for FlexIO SPI RX DMA transfer.
  rxHandle | User requested DMA handle for FlexIO SPI TX DMA transfer.

Return values

  kStatus_Success | Successfully create the handle.
  kStatus_OutOfRange | The FlexIO SPI DMA type/handle table out of range.

status_t FLEXIO_SPI_MasterTransferDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_master_dma_handle_t * | handle,
|  | flexio_spi_transfer_t * | xfer
| ) |  |

Note
  This interface returned immediately after transfer initiates, users could call FLEXIO_SPI_MasterGetTransferCountDMA to poll the transfer status to check whether FlexIO SPI transfer finished.

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | pointer to flexio_spi_master_dma_handle_t structure to store the transfer state.
  xfer | Pointer to FlexIO SPI transfer structure.

Return values

  kStatus_Success | Successfully start a transfer.
  kStatus_InvalidArgument | Input argument is invalid.
  kStatus_FLEXIO_SPI_Busy | FlexIO SPI is not idle, is running another transfer.

void FLEXIO_SPI_MasterTransferAbortDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_master_dma_handle_t * | handle
| ) |  |

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | FlexIO SPI DMA handle pointer.

status_t FLEXIO_SPI_MasterTransferGetCountDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_master_dma_handle_t * | handle,
|  | size_t * | count
| ) |  |

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | FlexIO SPI DMA handle pointer.
  count | Number of bytes transferred so far by the non-blocking transaction.

static void FLEXIO_SPI_SlaveTransferCreateHandleDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_slave_dma_handle_t * | handle,
|  | flexio_spi_slave_dma_transfer_callback_t | callback,
|  | void * | userData,
|  | dma_handle_t * | txHandle,
|  | dma_handle_t * | rxHandle
| ) |  |
| inline static

This function initializes the FlexIO SPI slave DMA handle.

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | pointer to flexio_spi_slave_dma_handle_t structure to store the transfer state.
  callback | SPI callback, NULL means no callback.
  userData | callback function parameter.
  txHandle | User requested DMA handle for FlexIO SPI TX DMA transfer.
  rxHandle | User requested DMA handle for FlexIO SPI RX DMA transfer.

status_t FLEXIO_SPI_SlaveTransferDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_slave_dma_handle_t * | handle,
|  | flexio_spi_transfer_t * | xfer
| ) |  |

Note
  This interface returned immediately after transfer initiates, users could call FLEXIO_SPI_SlaveGetTransferCountDMA to poll the transfer status to check whether FlexIO SPI transfer finished.

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | pointer to flexio_spi_slave_dma_handle_t structure to store the transfer state.
  xfer | Pointer to FlexIO SPI transfer structure.

Return values

  kStatus_Success | Successfully start a transfer.
  kStatus_InvalidArgument | Input argument is invalid.
  kStatus_FLEXIO_SPI_Busy | FlexIO SPI is not idle, is running another transfer.

static void FLEXIO_SPI_SlaveTransferAbortDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_slave_dma_handle_t * | handle
| ) |  |
| inline static

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | pointer to flexio_spi_slave_dma_handle_t structure to store the transfer state.

static status_t FLEXIO_SPI_SlaveTransferGetCountDMA | ( | FLEXIO_SPI_Type * | base,
|  | flexio_spi_slave_dma_handle_t * | handle,
|  | size_t * | count
| ) |  |
| inline static

Parameters

  base | pointer to FLEXIO_SPI_Type structure.
  handle | FlexIO SPI DMA handle pointer.
  count | Number of bytes transferred so far by the non-blocking transaction.