| 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
LPUART DMA Driver
LPUART Driver

## Overview

## Files
file | fsl_lpuart_dma.h

## Data Structures
struct | lpuart_dma_handle_t
| LPUART DMA handle. More...

## Typedefs
typedef void(* | lpuart_dma_transfer_callback_t )(LPUART_Type *base, lpuart_dma_handle_t *handle, status_t status, void *userData)
| LPUART transfer callback function. More...

## EDMA transactional
void | LPUART_TransferCreateHandleDMA (LPUART_Type *base, lpuart_dma_handle_t *handle, lpuart_dma_transfer_callback_t callback, void *userData, dma_handle_t *txDmaHandle, dma_handle_t *rxDmaHandle)
| Initializes the LPUART handle which is used in transactional functions. More...
status_t | LPUART_TransferSendDMA (LPUART_Type *base, lpuart_dma_handle_t *handle, lpuart_transfer_t *xfer)
| Sends data using DMA. More...
status_t | LPUART_TransferReceiveDMA (LPUART_Type *base, lpuart_dma_handle_t *handle, lpuart_transfer_t *xfer)
| Receives data using DMA. More...
void | LPUART_TransferAbortSendDMA (LPUART_Type *base, lpuart_dma_handle_t *handle)
| Aborts the sent data using DMA. More...
void | LPUART_TransferAbortReceiveDMA (LPUART_Type *base, lpuart_dma_handle_t *handle)
| Aborts the received data using DMA. More...
status_t | LPUART_TransferGetSendCountDMA (LPUART_Type *base, lpuart_dma_handle_t *handle, uint32_t *count)
| Get the number of bytes that have been written to LPUART TX register. More...
status_t | LPUART_TransferGetReceiveCountDMA (LPUART_Type *base, lpuart_dma_handle_t *handle, uint32_t *count)
| Get the number of bytes that have been received. More...

## Data Structure Documentation

struct _lpuart_dma_handle

### Data Fields
lpuart_dma_transfer_callback_t | callback
| Callback function. More...
void * | userData
| LPUART callback function parameter. More...
size_t | rxDataSizeAll
| Size of the data to receive. More...
size_t | txDataSizeAll
| Size of the data to send out. More...
dma_handle_t * | txDmaHandle
| The DMA TX channel used. More...
dma_handle_t * | rxDmaHandle
| The DMA RX channel used. More...
volatile uint8_t | txState
| TX transfer state. More...
volatile uint8_t | rxState
| RX transfer state.

#### Field Documentation

lpuart_dma_transfer_callback_t lpuart_dma_handle_t::callback

void* lpuart_dma_handle_t::userData

size_t lpuart_dma_handle_t::rxDataSizeAll

size_t lpuart_dma_handle_t::txDataSizeAll

dma_handle_t* lpuart_dma_handle_t::txDmaHandle

dma_handle_t* lpuart_dma_handle_t::rxDmaHandle

volatile uint8_t lpuart_dma_handle_t::txState

## Typedef Documentation

typedef void(* lpuart_dma_transfer_callback_t)(LPUART_Type *base, lpuart_dma_handle_t *handle, status_t status, void *userData)

## Function Documentation

void LPUART_TransferCreateHandleDMA | ( | LPUART_Type * | base,
|  | lpuart_dma_handle_t * | handle,
|  | lpuart_dma_transfer_callback_t | callback,
|  | void * | userData,
|  | dma_handle_t * | txDmaHandle,
|  | dma_handle_t * | rxDmaHandle
| ) |  |

Parameters

  base | LPUART peripheral base address.
  handle | Pointer to lpuart_dma_handle_t structure.
  callback | Callback function.
  userData | User data.
  txDmaHandle | User-requested DMA handle for TX DMA transfer.
  rxDmaHandle | User-requested DMA handle for RX DMA transfer.

status_t LPUART_TransferSendDMA | ( | LPUART_Type * | base,
|  | lpuart_dma_handle_t * | handle,
|  | lpuart_transfer_t * | xfer
| ) |  |

This function sends data using DMA. This is a non-blocking function, which returns right away. When all data is sent, the send callback function is called.

Parameters

  base | LPUART peripheral base address.
  handle | LPUART handle pointer.
  xfer | LPUART DMA transfer structure. See lpuart_transfer_t.

Return values

  kStatus_Success | if succeed, others failed.
  kStatus_LPUART_TxBusy | Previous transfer on going.
  kStatus_InvalidArgument | Invalid argument.

status_t LPUART_TransferReceiveDMA | ( | LPUART_Type * | base,
|  | lpuart_dma_handle_t * | handle,
|  | lpuart_transfer_t * | xfer
| ) |  |

This function receives data using DMA. This is a non-blocking function, which returns right away. When all data is received, the receive callback function is called.

Parameters

  base | LPUART peripheral base address.
  handle | Pointer to lpuart_dma_handle_t structure.
  xfer | LPUART DMA transfer structure. See lpuart_transfer_t.

Return values

  kStatus_Success | if succeed, others failed.
  kStatus_LPUART_RxBusy | Previous transfer on going.
  kStatus_InvalidArgument | Invalid argument.

void LPUART_TransferAbortSendDMA | ( | LPUART_Type * | base,
|  | lpuart_dma_handle_t * | handle
| ) |  |

This function aborts send data using DMA.

Parameters

  base | LPUART peripheral base address
  handle | Pointer to lpuart_dma_handle_t structure

void LPUART_TransferAbortReceiveDMA | ( | LPUART_Type * | base,
|  | lpuart_dma_handle_t * | handle
| ) |  |

This function aborts the received data using DMA.

Parameters

  base | LPUART peripheral base address
  handle | Pointer to lpuart_dma_handle_t structure

status_t LPUART_TransferGetSendCountDMA | ( | LPUART_Type * | base,
|  | lpuart_dma_handle_t * | handle,
|  | uint32_t * | count
| ) |  |

This function gets the number of bytes that have been written to LPUART TX register by DMA.

Parameters

  base | LPUART peripheral base address.
  handle | LPUART handle pointer.
  count | Send bytes count.

Return values

  kStatus_NoTransferInProgress | No send in progress.
  kStatus_InvalidArgument | Parameter is invalid.
  kStatus_Success | Get successfully through the parameter `count`;

status_t LPUART_TransferGetReceiveCountDMA | ( | LPUART_Type * | base,
|  | lpuart_dma_handle_t * | handle,
|  | uint32_t * | count
| ) |  |

This function gets the number of bytes that have been received.

Parameters

  base | LPUART peripheral base address.
  handle | LPUART handle pointer.
  count | Receive bytes count.

Return values

  kStatus_NoTransferInProgress | No receive in progress.
  kStatus_InvalidArgument | Parameter is invalid.
  kStatus_Success | Get successfully through the parameter `count`;