| 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
SPI µCOS/III driver
SPI: Serial Peripheral Interface Driver

## Overview

This section describes the programming interface of the SPI µCOS/III driver.

## Files
file | fsl_spi_ucosiii.h

## Data Structures
struct | spi_rtos_handle_t
| SPI FreeRTOS handle. More...

## Driver version
#define | FSL_SPI_UCOSIII_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
| SPI uCOS III driver version 2.0.0. More...

## SPI RTOS Operation
status_t | SPI_RTOS_Init (spi_rtos_handle_t *handle, SPI_Type *base, const spi_master_config_t *masterConfig, uint32_t srcClock_Hz)
| Initializes SPI. More...
status_t | SPI_RTOS_Deinit (spi_rtos_handle_t *handle)
| Deinitializes the SPI. More...
status_t | SPI_RTOS_Transfer (spi_rtos_handle_t *handle, spi_transfer_t *transfer)
| Performs SPI transfer. More...

## Data Structure Documentation

struct spi_rtos_handle_t

SPI RTOS handle.

### Data Fields
SPI_Type * | base
| SPI base address.
spi_master_handle_t | drv_handle
| Handle of the underlying driver, treated as opaque by the RTOS layer.
SemaphoreHandle_t | mutex
| Mutex to lock the handle during a trasfer.
SemaphoreHandle_t | event
| Semaphore to notify and unblock task when transfer ends.
OS_EVENT * | mutex
| Mutex to lock the handle during a trasfer.
OS_FLAG_GRP * | event
| Semaphore to notify and unblock task when transfer ends.
OS_SEM | mutex
| Mutex to lock the handle during a trasfer.
OS_FLAG_GRP | event
| Semaphore to notify and unblock task when transfer ends.

## Macro Definition Documentation

#define FSL_SPI_UCOSIII_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))

## Function Documentation

status_t SPI_RTOS_Init | ( | spi_rtos_handle_t * | handle,
|  | SPI_Type * | base,
|  | const spi_master_config_t * | masterConfig,
|  | uint32_t | srcClock_Hz
| ) |  |

This function initializes the SPI module and related RTOS context.

Parameters

  handle | The RTOS SPI handle, the pointer to an allocated space for RTOS context.
  base | The pointer base address of the SPI instance to initialize.
  masterConfig | Configuration structure to set-up SPI in master mode.
  srcClock_Hz | Frequency of input clock of the SPI module.

Returns
  status of the operation.

status_t SPI_RTOS_Deinit | ( | spi_rtos_handle_t * | handle | ) |

This function deinitializes the SPI module and related RTOS context.

Parameters

  handle | The RTOS SPI handle.

status_t SPI_RTOS_Transfer | ( | spi_rtos_handle_t * | handle,
|  | spi_transfer_t * | transfer
| ) |  |

This function performs an SPI transfer according to data given in the transfer structure.

Parameters

  handle | The RTOS SPI handle.
  transfer | Structure specifying the transfer parameters.

Returns
  status of the operation.