spidrv.c File Reference

SPIDRV API implementation.

License

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

SPDX-License-Identifier: Zlib

The licensor of this software is Silicon Laboratories Inc.

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

Definition in file spidrv.c .

#include <string.h>
#include "em_device.h"
#include " em_gpio.h "
#include " em_core.h "
#include " em_usart.h "
#include " dmadrv.h "
#include " spidrv.h "

Functions

Ecode_t SPIDRV_AbortTransfer ( SPIDRV_Handle_t handle)
Abort an ongoing SPI transfer.
Ecode_t SPIDRV_DeInit ( SPIDRV_Handle_t handle)
Deinitialize an SPI driver instance.
Ecode_t SPIDRV_GetBitrate ( SPIDRV_Handle_t handle, uint32_t *bitRate)
Get current SPI bus bitrate.
Ecode_t SPIDRV_GetFramelength ( SPIDRV_Handle_t handle, uint32_t *frameLength)
Get current SPI framelength.
Ecode_t SPIDRV_GetTransferStatus ( SPIDRV_Handle_t handle, int *itemsTransferred, int *itemsRemaining)
Get the status of an SPI transfer.
Ecode_t SPIDRV_Init ( SPIDRV_Handle_t handle, SPIDRV_Init_t *initData)
Initialize an SPI driver instance.
Ecode_t SPIDRV_MReceive ( SPIDRV_Handle_t handle, void *buffer, int count, SPIDRV_Callback_t callback)
Start an SPI master receive transfer.
Ecode_t SPIDRV_MReceiveB ( SPIDRV_Handle_t handle, void *buffer, int count)
Start an SPI master blocking receive transfer.
Ecode_t SPIDRV_MTransfer ( SPIDRV_Handle_t handle, const void *txBuffer, void * rxBuffer , int count, SPIDRV_Callback_t callback)
Start an SPI master transfer.
Ecode_t SPIDRV_MTransferB ( SPIDRV_Handle_t handle, const void *txBuffer, void * rxBuffer , int count)
Start an SPI master blocking transfer.
Ecode_t SPIDRV_MTransferSingleItemB ( SPIDRV_Handle_t handle, uint32_t txValue, void *rxValue)
Start an SPI master blocking single item (frame) transfer.
Ecode_t SPIDRV_MTransmit ( SPIDRV_Handle_t handle, const void *buffer, int count, SPIDRV_Callback_t callback)
Start an SPI master transmit transfer.
Ecode_t SPIDRV_MTransmitB ( SPIDRV_Handle_t handle, const void *buffer, int count)
Start an SPI master blocking transmit transfer.
Ecode_t SPIDRV_SetBitrate ( SPIDRV_Handle_t handle, uint32_t bitRate)
Set SPI bus bitrate.
Ecode_t SPIDRV_SetFramelength ( SPIDRV_Handle_t handle, uint32_t frameLength)
Set SPI framelength.
Ecode_t SPIDRV_SReceive ( SPIDRV_Handle_t handle, void *buffer, int count, SPIDRV_Callback_t callback, int timeoutMs)
Start an SPI slave receive transfer.
Ecode_t SPIDRV_SReceiveB ( SPIDRV_Handle_t handle, void *buffer, int count, int timeoutMs)
Start an SPI slave blocking receive transfer.
Ecode_t SPIDRV_STransfer ( SPIDRV_Handle_t handle, const void *txBuffer, void * rxBuffer , int count, SPIDRV_Callback_t callback, int timeoutMs)
Start an SPI slave transfer.
Ecode_t SPIDRV_STransferB ( SPIDRV_Handle_t handle, const void *txBuffer, void * rxBuffer , int count, int timeoutMs)
Start an SPI slave blocking transfer.
Ecode_t SPIDRV_STransmit ( SPIDRV_Handle_t handle, const void *buffer, int count, SPIDRV_Callback_t callback, int timeoutMs)
Start an SPI slave transmit transfer.
Ecode_t SPIDRV_STransmitB ( SPIDRV_Handle_t handle, const void *buffer, int count, int timeoutMs)
Start an SPI slave blocking transmit transfer.