SPI Driver macros and structures.
hal_cb_driver.xml
@p spiSelect() and @p spiUnselect() do nothing.
Selection by PAL port and pad number.
Selection by port and port mask.
Selection by PAL line identifier.
Selection by LLD-defined mode.
Support for thread synchronization API.
Handling method for SPI CS line.
Return a pointer to the configuration structure.
Pointer to the @p hal_sio_driver_c object.
A pointer to the configuration structure.
config))]]>
Retrieves a configuration field.
Pointer to the @p hal_sio_driver_c object.
Configuration field to be retrieved.
The field value.
field)]]>
Type of structure representing a SPI driver.
Type of structure representing a SPI configuration.
Type of structure representing a SPI configuration
(legacy).
Type of structure representing a SPI driver (legacy).
Driver configuration structure.
Implementations may extend this structure to contain more,
architecture dependent, fields.
Enables the circular buffer mode.
Enables the slave mode.
The chip select line.
Only used in master mode.
The chip select port.
Only used in master mode.
The chip select port mask.
Only used in master mode.
The chip select port.
Only used in master mode.
The chip select pad number.
Only used in master mode.
Class of a SPI driver.
Synchronization point for transfer.
Ignores data on the SPI bus.
Number of frames
to be
ignored.
The operation status.
0U));
#if SPI_SUPPORTS_CIRCULAR
osalDbgCheck((__spi_getfield(self, circular) == false) || ((n & 1U) == 0U));
#endif
osalDbgAssert(self->state == HAL_DRV_STATE_READY, "not ready");
self->state = HAL_DRV_STATE_ACTIVE;
msg = spi_lld_ignore(self, n);
#if SPI_USE_ASSERT_ON_ERROR == TRUE
osalDbgAssert(msg == HAL_RET_SUCCESS, "function failed");
#endif
return msg;]]>
Ignores data on the SPI bus.
Number of frames
to be
ignored.
The operation status.
Exchanges data on the SPI bus.
Number of frames
to be
exchanged.
Pointer
to the
transmit buffer.
Pointer to
the
receive
buffer.
The operation status.
0U) &&
(rxbuf != NULL) && (txbuf != NULL));
#if SPI_SUPPORTS_CIRCULAR
osalDbgCheck((__spi_getfield(self, circular) == false) || ((n & 1U) == 0U));
#endif
osalDbgAssert(self->state == HAL_DRV_STATE_READY, "not ready");
self->state = HAL_DRV_STATE_ACTIVE;
msg = spi_lld_exchange(self, n, txbuf, rxbuf);
#if SPI_USE_ASSERT_ON_ERROR == TRUE
osalDbgAssert(msg == HAL_RET_SUCCESS, "function failed");
#endif
return msg;]]>
Exchanges data on the SPI bus.
Number of frames
to be
exchanged.
Pointer
to the
transmit buffer.
Pointer to
the
receive
buffer.
The operation status.
Sends data over the SPI bus.
Number of frames
to be
exchanged.
Pointer
to the
transmit buffer.
The operation status.
0U) && (txbuf != NULL));
#if SPI_SUPPORTS_CIRCULAR
osalDbgCheck((__spi_getfield(self, circular) == false) || ((n & 1U) == 0U));
#endif
osalDbgAssert(self->state == HAL_DRV_STATE_READY, "not ready");
self->state = HAL_DRV_STATE_ACTIVE;
msg = spi_lld_send(self, n, txbuf);
#if SPI_USE_ASSERT_ON_ERROR == TRUE
osalDbgAssert(msg == HAL_RET_SUCCESS, "function failed");
#endif
return msg;]]>
Sends data over the SPI bus.
Number of frames
to be
exchanged.
Pointer
to the
transmit buffer.
The operation status.
Receives data from the SPI bus.
Number of frames
to be
exchanged.
Pointer to
the
receive
buffer.
The operation status.
0U) && (rxbuf != NULL));
#if SPI_SUPPORTS_CIRCULAR
osalDbgCheck((__spi_getfield(self, circular) == false) || ((n & 1U) == 0U));
#endif
osalDbgAssert(self->state == HAL_DRV_STATE_READY, "not ready");
self->state = HAL_DRV_STATE_ACTIVE;
msg = spi_lld_receive(self, n, rxbuf);
#if SPI_USE_ASSERT_ON_ERROR == TRUE
osalDbgAssert(msg == HAL_RET_SUCCESS, "function failed");
#endif
return msg;]]>
Receives data from the SPI bus.
Number of frames
to be
exchanged.
Pointer to
the
receive
buffer.
The operation status.
Stops the ongoing SPI operation.
Pointer to the
counter
of frames not yet transferred or @p NULL.
The operation status.
state == HAL_DRV_STATE_READY) ||
(self->state == HAL_DRV_STATE_ACTIVE) ||
(self->state == HAL_DRV_STATE_COMPLETE),
"invalid state");
if ((self->state == HAL_DRV_STATE_ACTIVE) ||
(self->state == HAL_DRV_STATE_COMPLETE)) {
/* Stopping transfer at low level.*/
msg = spi_lld_stop_transfer(self, np);
self->state = HAL_DRV_STATE_READY;
#if SPI_USE_SYNCHRONIZATION == TRUE
osalThreadResumeI(&self->sync_transfer, MSG_RESET);
#endif
}
else {
msg = HAL_RET_SUCCESS;
}
return msg;]]>
Stops the ongoing SPI operation.
Pointer to the
counter
of frames not yet transferred or @p NULL.
The operation status.
Synchronization
timeout.
The synchronization result.
If operation completed without
errors.
If synchronization timed out.
If the transfer has been stopped.
state == HAL_DRV_STATE_ACTIVE) ||
(self->state == HAL_DRV_STATE_READY),
"invalid state");
if (self->state == HAL_DRV_STATE_ACTIVE) {
msg = osalThreadSuspendTimeoutS(&self->sync_transfer, timeout);
}
else {
msg = MSG_OK;
}
return msg;]]>
Synchronization
timeout.
The synchronization result.
If operation completed without
errors.
If synchronization timed out.
If the transfer has been stopped.
Ignores data on the SPI bus.
Number of
frames to be
ignored.
The operation status.
If operation completed without
errors.
If synchronization timed out.
If the transfer has been stopped.
Exchanges data on the SPI bus.
Number of
frames to be
exchanged.
Pointer
to
the
transmit buffer.
Pointer to
the
receive buffer.
The operation status.
If operation completed without
errors.
If synchronization timed out.
If the transfer has been stopped.
Sends data over the SPI bus.
Number of
frames to be
exchanged.
Pointer
to
the
transmit buffer.
The operation status.
If operation completed without
errors.
If synchronization timed out.
If the transfer has been stopped.
Receives data from the SPI bus.
Number of
frames to be
exchanged.
Pointer to
the
receive buffer.
The operation status.
If operation completed without
errors.
If synchronization timed out.
If the transfer has been stopped.
Asserts the slave select signal and prepares for
transfers.
Deasserts the slave select signal.
Wakes up the waiting thread.
This function is meant to be used in the low level
drivers
implementations only.
The wakeup
message.
sync_transfer, msg);
osalSysUnlockFromISR();]]>
Common ISR code in linear mode.
This function is meant to be used in the low level
drivers
implementations only.
Half buffer filled ISR code in circular mode.
This function is meant to be used in the low level
drivers
implementations only.
Full buffer filled ISR code in circular mode.
This function is meant to be used in the low level
drivers
implementations only.
ISR error reporting code..
This function is meant to be used in the low level
drivers
implementations only.
The error code.
SPI Driver initialization.
hal.h