| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures
fsl_spi_master_driver.h File Reference

fsl_spi_master_driver.h defines structures and types for the spi master driver. More...

`#include <stdint.h>`
`#include <stdbool.h>`
`#include "PE_Types.h"`
`#include "mqxlite.h"`
`#include "lwevent.h"`
`#include "fsl_spi_hal.h"`
Include dependency graph for fsl_spi_master_driver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | SPIUserConfig
| Information about a device on the SPI bus. More...
struct | SPIHandle
struct | SPI_Master_State

## Functions
Init and shutdown
void | spi_master_init (uint32_t instance)
| Initialize a SPI instance for master mode operation. More...
Bus configuration
void | spi_master_configure_bus (uint32_t instance, const spi_user_config_t *device)
| Configure the SPI port to access a device on the bus. More...
Blocking transfers
spi_status_t | spi_master_transfer (uint32_t instance, const spi_user_config_t *device, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount, uint32_t timeout)
| Perform a blocking SPI master mode transfer. More...
Non-blocking transfers
spi_status_t | spi_master_transfer_async (uint32_t instance, const spi_user_config_t *device, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount)
| Perform an non-blocking SPI master mode transfer. More...
#define | SPI_PEX_WRITE_EVENT_SUCCESS (1)
| event macros for the lld components. More...
#define | SPI_PEX_WRITE_EVENT_ERROR (SPI_PEX_WRITE_EVENT_SUCCESS << 1)
#define | SPI_PEX_READ_EVENT_SUCCESS (SPI_PEX_WRITE_EVENT_ERROR << 1)
#define | SPI_PEX_READ_EVENT_ERROR (SPI_PEX_READ_EVENT_SUCCESS << 1)
enum | _spi_timeouts { kSpiWaitForever = 0xffffffffU }
typedef struct SPIUserConfig | spi_user_config_t
| Information about a device on the SPI bus. More...
typedef struct SPIHandle | spi_handle_t
typedef struct SPI_Master_State | spi_master_state_t

## Detailed Description

fsl_spi_master_driver.h defines structures and types for the spi master driver.

File: fsl_spi_master_driver.h

Copyright (c) 2014, Freescale Semiconductor, Inc.

Definition in file fsl_spi_master_driver.h.

## Macro Definition Documentation

#define SPI_PEX_READ_EVENT_ERROR (SPI_PEX_READ_EVENT_SUCCESS << 1)

Definition at line 56 of file fsl_spi_master_driver.h.

#define SPI_PEX_READ_EVENT_SUCCESS (SPI_PEX_WRITE_EVENT_ERROR << 1)

Definition at line 55 of file fsl_spi_master_driver.h.

Referenced by spi_master_transfer(), and SPIMasterBus1_OnBlockReceived().

#define SPI_PEX_WRITE_EVENT_ERROR (SPI_PEX_WRITE_EVENT_SUCCESS << 1)

Definition at line 54 of file fsl_spi_master_driver.h.

#define SPI_PEX_WRITE_EVENT_SUCCESS (1)

event macros for the lld components.

Definition at line 53 of file fsl_spi_master_driver.h.

Referenced by SPIMasterBus1_OnBlockSent().

## Typedef Documentation

typedef struct SPIHandle spi_handle_t

typedef struct SPI_Master_State spi_master_state_t

typedef struct SPIUserConfig spi_user_config_t

Information about a device on the SPI bus.

## Enumeration Type Documentation

enum _spi_timeouts

Enumerator
kSpiWaitForever | Wait forever for a transfer to complete.

Definition at line 28 of file fsl_spi_master_driver.h.

## Function Documentation

void spi_master_configure_bus | ( | uint32_t | instance,
|  | const spi_user_config_t * | device
| ) |  |

Configure the SPI port to access a device on the bus.

Parameters

  instance | The instance number of the SPI peripheral.
  device | Pointer to the device information struct. This struct contains the settings for how the SPI bus will be configured.

Definition at line 60 of file fsl_spi_master_driver.c.

Referenced by spi_master_adapter_configure().

Here is the caller graph for this function:

void spi_master_init | ( | uint32_t | instance | ) |

Initialize a SPI instance for master mode operation.

Parameters

  instance | The instance number of the SPI peripheral.

Definition at line 43 of file fsl_spi_master_driver.c.

References spi_master_instance_PEx::fnSPILLDInit, gSys_NumSpiBuses, and SPI_Master_State::pDeviceHandle.

Referenced by spi_master_adapter_init().

Here is the caller graph for this function:

spi_status_t spi_master_transfer | ( | uint32_t | instance,
|  | const spi_user_config_t * | device,
|  | const uint8_t * | sendBuffer,
|  | uint8_t * | receiveBuffer,
|  | uint16_t | transferByteCount,
|  | uint32_t | timeout
| ) |  |

Perform a blocking SPI master mode transfer.

This function simultaneously sends and receives data on the SPI bus, as SPI is naturally a full-duplex bus.

Parameters

  instance | The instance number of the SPI peripheral.
  device | Pointer to the device information struct. This struct contains the settings for how the SPI bus will be configured for this transfer. You may pass NULL for this parameter, in which case the current bus configuration is used unmodified.
  sendBuffer | Buffer of data to send. You may pass NULL for this parameter, in which case bytes with a value of 0 (zero) will be sent.
  receiveBuffer | Buffer where received bytes are stored. If you pass NULL for this parameter, the received bytes are ignored.
  transferByteCount | The number of bytes to send and receive.
  timeout | A timeout for the transfer in microseconds. If the transfer takes longer than this amount of time, the transfer will be aborted and a kStatus_SPI_Timeout error will be returned.

Return values

  #kStatus_Success | The transfer was succesful.
  kStatus_SPI_Busy | Cannot perform another transfer because one is already in progress.
  kStatus_SPI_Timeout | The transfer timed out and was aborted.

Definition at line 70 of file fsl_spi_master_driver.c.

References FALSE, gSys_NumSpiBuses, kStatus_SPI_Error, kStatus_SPI_Success, and SPI_PEX_READ_EVENT_SUCCESS.

spi_status_t spi_master_transfer_async | ( | uint32_t | instance,
|  | const spi_user_config_t * | device,
|  | const uint8_t * | sendBuffer,
|  | uint8_t * | receiveBuffer,
|  | uint16_t | transferByteCount
| ) |  |

Perform an non-blocking SPI master mode transfer.

Parameters

  instance | The instance number of the SPI peripheral.
  device | Pointer to the device information struct. This struct contains the settings for how the SPI bus will be configured for this transfer. You may pass NULL for this parameter, in which case the current bus configuration is used unmodified.
  sendBuffer | Buffer of data to send. You may pass NULL for this parameter, in which case bytes with a value of 0 (zero) will be sent.
  receiveBuffer | Buffer where received bytes are stored. If you pass NULL for this parameter, the received bytes are ignored.
  transferByteCount | The number of bytes to send and receive.

Return values

  #kStatus_Success | The transfer was succesful.
  kStatus_SPI_Busy | Cannot perform another transfer because one is already in progress.
  kStatus_SPI_Timeout | The transfer timed out and was aborted.

Definition at line 105 of file fsl_spi_master_driver.c.

References kStatus_SPI_Success.

- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.