STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Spi Driver More...
#include "Spi_Cfg.h"
Go to the source code of this file.
Spi Driver
The SPI module provides services to initiate transmissions with a terminal buffer and call callback functions to notify events. Additionally, you have the option of having an external buffer to have more memory capacity. This module has the possibility of several JOBs, Channels and sequences.
Std_ReturnType Spi_Arch_AsyncTransmit | ( | Spi_HwUnit * | HwUnit, |
Spi_SequenceType | Sequence ) |
Spi Asynchronous Transmit
Service to transmit data on the SPI bus.
HwUnit | Pointer to the hardware unit configuration |
Sequence | Sequence ID |
E_OK | Transmission command has been accepted E_NOT_OK: Transmission command has not been accepted |
void Spi_Arch_Cancel | ( | Spi_HwUnit * | HwUnit, |
Spi_SequenceType | Sequence ) |
Spi cancel
Service cancels the specified on-going sequence transmission.
HwUnit | Pointer to the hardware unit configuration |
Sequence | Sequence ID |
Std_ReturnType Spi_Arch_DeInit | ( | Spi_HwUnit * | HwUnit | ) |
Spi De-Initialization
Service for SPI de-initialization.
HwUnit | Pointer to the hardware unit configuration |
E_OK | de-initialisation command has been accepted E_NOT_OK: de-initialisation command has not been accepted |
Spi_StatusType Spi_Arch_GetHWUnitStatus | ( | Spi_HwUnit * | HwUnit, |
Spi_HWUnitType | HWUnit ) |
Spi get Hardware microcontroller peripheral Unit Status
This service returns the status of the specified SPI Hardware microcontroller peripheral.
HwUnit | Pointer to the hardware unit configuration |
HWUnit | SPI Hardware microcontroller peripheral (unit) ID. |
Spi_StatusType | Spi_StatusType |
Spi_JobResultType Spi_Arch_GetJobResult | ( | Spi_HwUnit * | HwUnit, |
Spi_JobType | Job ) |
Spi get job result
This service returns the last transmission result of the specified Job.
HwUnit | Pointer to the hardware unit configuration |
Job | Job ID. An invalid job ID will return an undefined result |
Spi_JobResultType | Spi_JobResultType |
Spi_SeqResultType Spi_Arch_GetSequenceResult | ( | Spi_HwUnit * | HwUnit, |
Spi_SequenceType | Sequence ) |
Spi get sequence result
This service returns the last transmission result of the specified Sequence.
HwUnit | Pointer to the hardware unit configuration |
Sequence | Sequence ID. An invalid sequence ID will return an undefined result |
Spi_SeqResultType | Spi_SeqResultType |
Spi_StatusType Spi_Arch_GetStatus | ( | Spi_HwUnit * | HwUnit | ) |
Spi get status
Service returns the SPI Handler/Driver software module status.
HwUnit | Pointer to the hardware unit configuration |
Spi_StatusType | Spi_StatusType |
void Spi_Arch_GetVersionInfo | ( | Spi_HwUnit * | HwUnit, |
Std_VersionInfoType * | versioninfo ) |
Spi get version information
This service returns the version information of this module.
HwUnit | Pointer to the hardware unit configuration |
versioninfo | Pointer to where to store the version information of this module |
void Spi_Arch_Init | ( | Spi_HwUnit * | HwUnit, |
const Spi_ConfigType * | Config ) |
Spi Initialization
Service for SPI initialization.
HwUnit | Pointer to the hardware unit configuration |
Config | Pointer to configuration set |
Std_ReturnType Spi_Arch_ReadIB | ( | Spi_HwUnit * | HwUnit, |
Spi_ChannelType | Channel, | ||
const Spi_DataBufferType * | DataBufferPtr ) |
Spi Read in the Internal Buffer
Service for reading synchronously one or more data from an IB SPI Handler/Driver Channel specified by parameter.
HwUnit | Pointer to the hardware unit configuration |
Channel | Channel ID |
DataBufferPtr | Pointer to destination data buffer in RAM |
E_OK | read command has been accepted E_NOT_OK: read command has not been accepted |
Std_ReturnType Spi_Arch_SetAsyncMode | ( | Spi_HwUnit * | HwUnit, |
Spi_AsyncModeType | Mode ) |
Spi set asynchronous mode
Service to set the asynchronous mechanism mode for SPI busses handled asynchronously.
HwUnit | Pointer to the hardware unit configuration |
Mode | New mode required. |
E_OK | Setting command has been done E_NOT_OK: setting command has not been accepted |
Std_ReturnType Spi_Arch_SetupEB | ( | Spi_HwUnit * | HwUnit, |
Spi_ChannelType | Channel, | ||
const Spi_DataBufferType * | SrcDataBufferPtr, | ||
Spi_DataBufferType * | DesDataBufferPtr, | ||
Spi_NumberOfDataType | Length ) |
Spi set up external buffer
Service to setup the buffers and the length of data for the EB SPI Handler/Driver Channel specified.
HwUnit | Pointer to the hardware unit configuration |
Channel | Channel ID |
SrcDataBufferPtr | Pointer to source data buffer |
Length | Length (number of data elements) of the data to be transmitted from SrcDataBufferPtr and/or received from DesDataBufferPtr Min.: 1 Max.: Max of data specified at configuration for this channel. |
DesDataBufferPtr | Pointer to destination data buffer in RAM |
E_OK | Setup command has been accepted E_NOT_OK: Setup command has not been accepted |
Std_ReturnType Spi_Arch_SyncTransmit | ( | Spi_HwUnit * | HwUnit, |
Spi_SequenceType | Sequence ) |
Spi synchronous transmit
Service to transmit data on the SPI bus.
HwUnit | Pointer to the hardware unit configuration |
Sequence | Sequence ID |
E_OK | Transmission has been successful E_NOT_OK: Transmission failed |
Std_ReturnType Spi_Arch_WriteIB | ( | Spi_HwUnit * | HwUnit, |
Spi_ChannelType | Channel, | ||
const Spi_DataBufferType * | DataBufferPtr ) |
Spi Write in the Internal Buffer
Service for writing one or more data to an IB SPI Handler/Driver Channel specified by parameter.
HwUnit | Pointer to the hardware unit configuration |
Channel | Channel ID |
DataBufferPtr | Pointer to source data buffer. If this pointer is null, it is assumed that the data to be transmitted is not relevant and the default transmit value of this channel will be used instead. |
E_OK | write command has been accepted E_NOT_OK: write command has not been accepted |