ChibiOS/HAL 9.0.0
|
Generic WSPI Driver. More...
Generic WSPI Driver.
This module defines an abstract interface for an wide SPI communication interface (Quad SPI, Octal SPI and similar).
HAL_USE_WSPI
option must be enabled in halconf.h
.WSPI configuration options | |
#define | WSPI_USE_WAIT TRUE |
Enables synchronous APIs. | |
#define | WSPI_USE_MUTUAL_EXCLUSION TRUE |
Enables the wspiAcquireBus() and wspiReleaseBus() APIs. |
Transfer options | |
| |
#define | WSPI_CFG_CMD_MODE_MASK (7LU << 0LU) |
#define | WSPI_CFG_CMD_MODE_NONE (0LU << 0LU) |
#define | WSPI_CFG_CMD_MODE_ONE_LINE (1LU << 0LU) |
#define | WSPI_CFG_CMD_MODE_TWO_LINES (2LU << 0LU) |
#define | WSPI_CFG_CMD_MODE_FOUR_LINES (3LU << 0LU) |
#define | WSPI_CFG_CMD_MODE_EIGHT_LINES (4LU << 0LU) |
#define | WSPI_CFG_CMD_DTR (1LU << 3LU) |
#define | WSPI_CFG_CMD_SIZE_MASK (3LU << 4LU) |
#define | WSPI_CFG_CMD_SIZE_8 (0LU << 4LU) |
#define | WSPI_CFG_CMD_SIZE_16 (1LU << 4LU) |
#define | WSPI_CFG_CMD_SIZE_24 (2LU << 4LU) |
#define | WSPI_CFG_CMD_SIZE_32 (3LU << 4LU) |
#define | WSPI_CFG_ADDR_MODE_MASK (7LU << 8LU) |
#define | WSPI_CFG_ADDR_MODE_NONE (0LU << 8LU) |
#define | WSPI_CFG_ADDR_MODE_ONE_LINE (1LU << 8LU) |
#define | WSPI_CFG_ADDR_MODE_TWO_LINES (2LU << 8LU) |
#define | WSPI_CFG_ADDR_MODE_FOUR_LINES (3LU << 8LU) |
#define | WSPI_CFG_ADDR_MODE_EIGHT_LINES (4LU << 8LU) |
#define | WSPI_CFG_ADDR_DTR (1LU << 11LU) |
#define | WSPI_CFG_ADDR_SIZE_MASK (3LU << 12LU) |
#define | WSPI_CFG_ADDR_SIZE_8 (0LU << 12LU) |
#define | WSPI_CFG_ADDR_SIZE_16 (1LU << 12LU) |
#define | WSPI_CFG_ADDR_SIZE_24 (2LU << 12LU) |
#define | WSPI_CFG_ADDR_SIZE_32 (3LU << 12LU) |
#define | WSPI_CFG_ALT_MODE_MASK (7LU << 16LU) |
#define | WSPI_CFG_ALT_MODE_NONE (0LU << 16LU) |
#define | WSPI_CFG_ALT_MODE_ONE_LINE (1LU << 16LU) |
#define | WSPI_CFG_ALT_MODE_TWO_LINES (2LU << 16LU) |
#define | WSPI_CFG_ALT_MODE_FOUR_LINES (3LU << 16LU) |
#define | WSPI_CFG_ALT_MODE_EIGHT_LINES (4LU << 16LU) |
#define | WSPI_CFG_ALT_DTR (1LU << 19LU) |
#define | WSPI_CFG_ALT_SIZE_MASK (3LU << 20LU) |
#define | WSPI_CFG_ALT_SIZE_8 (0LU << 20LU) |
#define | WSPI_CFG_ALT_SIZE_16 (1LU << 20LU) |
#define | WSPI_CFG_ALT_SIZE_24 (2LU << 20LU) |
#define | WSPI_CFG_ALT_SIZE_32 (3LU << 20LU) |
#define | WSPI_CFG_DATA_MODE_MASK (7LU << 24LU) |
#define | WSPI_CFG_DATA_MODE_NONE (0LU << 24LU) |
#define | WSPI_CFG_DATA_MODE_ONE_LINE (1LU << 24LU) |
#define | WSPI_CFG_DATA_MODE_TWO_LINES (2LU << 24LU) |
#define | WSPI_CFG_DATA_MODE_FOUR_LINES (3LU << 24LU) |
#define | WSPI_CFG_DATA_MODE_EIGHT_LINES (4LU << 24LU) |
#define | WSPI_CFG_DATA_DTR (1LU << 27LU) |
#define | WSPI_CFG_DQS_ENABLE (1LU << 29LU) |
#define | WSPI_CFG_SIOO (1LU << 31LU) |
#define | WSPI_CFG_ALL_DTR |
Macro Functions | |
#define | wspiStartCommandI(wspip, cmdp) |
Sends a command without data phase. | |
#define | wspiStartSendI(wspip, cmdp, n, txbuf) |
Sends data over the WSPI bus. | |
#define | wspiStartReceiveI(wspip, cmdp, n, rxbuf) |
Receives data from the WSPI bus. | |
#define | wspiMapFlashI(wspip, cmdp, addrp) |
Maps in memory space a WSPI flash device. | |
#define | wspiUnmapFlashI(wspip) |
Maps in memory space a WSPI flash device. |
Low level driver helper macros | |
#define | _wspi_wakeup_isr(wspip, msg) |
Wakes up the waiting thread. | |
#define | _wspi_isr_code(wspip) |
Common ISR code. | |
#define | _wspi_error_code(wspip) |
Common error ISR code. |
WSPI implementation capabilities | |
#define | WSPI_SUPPORTS_MEMMAP TRUE |
#define | WSPI_DEFAULT_CFG_MASKS TRUE |
Configuration options | |
#define | PLATFORM_WSPI_USE_WSPI1 FALSE |
WSPID1 driver enable switch. |
Data Structures | |
struct | wspi_command_t |
Type of a WSPI command descriptor. More... | |
struct | hal_wspi_config |
Driver configuration structure. More... | |
struct | hal_wspi_driver |
Structure representing an WSPI driver. More... |
Macros | |
#define | wspi_lld_driver_fields |
Low level fields of the WSPI driver structure. | |
#define | wspi_lld_config_fields |
Low level fields of the WSPI configuration structure. |
Typedefs | |
typedef struct hal_wspi_driver | WSPIDriver |
Type of a structure representing an WSPI driver. | |
typedef struct hal_wspi_config | WSPIConfig |
Type of a structure representing an WSPI driver configuration. | |
typedef void(* | wspicallback_t) (WSPIDriver *wspip) |
Type of a WSPI notification callback. |
Enumerations | |
enum | wspistate_t { WSPI_UNINIT = 0 , WSPI_STOP = 1 , WSPI_READY = 2 , WSPI_SEND = 3 , WSPI_RECEIVE = 4 , WSPI_COMPLETE = 5 , WSPI_MEMMAP = 6 } |
Driver state machine possible states. More... |
Functions | |
void | wspiInit (void) |
WSPI Driver initialization. | |
void | wspiObjectInit (WSPIDriver *wspip) |
Initializes the standard part of a WSPIDriver structure. | |
msg_t | wspiStart (WSPIDriver *wspip, const WSPIConfig *config) |
Configures and activates the WSPI peripheral. | |
void | wspiStop (WSPIDriver *wspip) |
Deactivates the WSPI peripheral. | |
void | wspiStartCommand (WSPIDriver *wspip, const wspi_command_t *cmdp) |
Sends a command without data phase. | |
void | wspiStartSend (WSPIDriver *wspip, const wspi_command_t *cmdp, size_t n, const uint8_t *txbuf) |
Sends a command with data over the WSPI bus. | |
void | wspiStartReceive (WSPIDriver *wspip, const wspi_command_t *cmdp, size_t n, uint8_t *rxbuf) |
Sends a command then receives data over the WSPI bus. | |
bool | wspiCommand (WSPIDriver *wspip, const wspi_command_t *cmdp) |
Sends a command without data phase. | |
bool | wspiSend (WSPIDriver *wspip, const wspi_command_t *cmdp, size_t n, const uint8_t *txbuf) |
Sends a command with data over the WSPI bus. | |
bool | wspiReceive (WSPIDriver *wspip, const wspi_command_t *cmdp, size_t n, uint8_t *rxbuf) |
Sends a command then receives data over the WSPI bus. | |
void | wspiMapFlash (WSPIDriver *wspip, const wspi_command_t *cmdp, uint8_t **addrp) |
Maps in memory space a WSPI flash device. | |
void | wspiUnmapFlash (WSPIDriver *wspip) |
Unmaps from memory space a WSPI flash device. | |
void | wspiAcquireBus (WSPIDriver *wspip) |
Gains exclusive access to the WSPI bus. | |
void | wspiReleaseBus (WSPIDriver *wspip) |
Releases exclusive access to the WSPI bus. | |
void | wspi_lld_init (void) |
Low level WSPI driver initialization. | |
void | wspi_lld_start (WSPIDriver *wspip) |
Configures and activates the WSPI peripheral. | |
void | wspi_lld_stop (WSPIDriver *wspip) |
Deactivates the WSPI peripheral. | |
void | wspi_lld_command (WSPIDriver *wspip, const wspi_command_t *cmdp) |
Sends a command without data phase. | |
void | wspi_lld_send (WSPIDriver *wspip, const wspi_command_t *cmdp, size_t n, const uint8_t *txbuf) |
Sends a command with data over the WSPI bus. | |
void | wspi_lld_receive (WSPIDriver *wspip, const wspi_command_t *cmdp, size_t n, uint8_t *rxbuf) |
Sends a command then receives data over the WSPI bus. | |
void | wspi_lld_map_flash (WSPIDriver *wspip, const wspi_command_t *cmdp, uint8_t **addrp) |
Maps in memory space a WSPI flash device. | |
void | wspi_lld_unmap_flash (WSPIDriver *wspip) |
Unmaps from memory space a WSPI flash device. |
Variables | |
WSPIDriver | WSPID1 |
WSPID1 driver identifier. |
#define WSPI_USE_WAIT TRUE |
Enables synchronous APIs.
Definition at line 47 of file hal_wspi.h.
#define WSPI_USE_MUTUAL_EXCLUSION TRUE |
Enables the wspiAcquireBus()
and wspiReleaseBus()
APIs.
Definition at line 55 of file hal_wspi.h.
#define WSPI_CFG_CMD_MODE_MASK (7LU << 0LU) |
Definition at line 196 of file hal_wspi.h.
#define WSPI_CFG_CMD_MODE_NONE (0LU << 0LU) |
Definition at line 197 of file hal_wspi.h.
Referenced by n25q_reset_xip().
#define WSPI_CFG_CMD_MODE_ONE_LINE (1LU << 0LU) |
Definition at line 198 of file hal_wspi.h.
Referenced by __n25q_init_impl(), __n25q_mmap_on_impl(), and n25q_read_id().
#define WSPI_CFG_CMD_MODE_TWO_LINES (2LU << 0LU) |
Definition at line 199 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl().
#define WSPI_CFG_CMD_MODE_FOUR_LINES (3LU << 0LU) |
Definition at line 200 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl().
#define WSPI_CFG_CMD_MODE_EIGHT_LINES (4LU << 0LU) |
Definition at line 201 of file hal_wspi.h.
#define WSPI_CFG_CMD_DTR (1LU << 3LU) |
Definition at line 203 of file hal_wspi.h.
#define WSPI_CFG_CMD_SIZE_MASK (3LU << 4LU) |
Definition at line 205 of file hal_wspi.h.
#define WSPI_CFG_CMD_SIZE_8 (0LU << 4LU) |
Definition at line 206 of file hal_wspi.h.
#define WSPI_CFG_CMD_SIZE_16 (1LU << 4LU) |
Definition at line 207 of file hal_wspi.h.
#define WSPI_CFG_CMD_SIZE_24 (2LU << 4LU) |
Definition at line 208 of file hal_wspi.h.
#define WSPI_CFG_CMD_SIZE_32 (3LU << 4LU) |
Definition at line 209 of file hal_wspi.h.
#define WSPI_CFG_ADDR_MODE_MASK (7LU << 8LU) |
Definition at line 211 of file hal_wspi.h.
#define WSPI_CFG_ADDR_MODE_NONE (0LU << 8LU) |
Definition at line 212 of file hal_wspi.h.
#define WSPI_CFG_ADDR_MODE_ONE_LINE (1LU << 8LU) |
Definition at line 213 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_ADDR_MODE_TWO_LINES (2LU << 8LU) |
Definition at line 214 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_ADDR_MODE_FOUR_LINES (3LU << 8LU) |
Definition at line 215 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_ADDR_MODE_EIGHT_LINES (4LU << 8LU) |
Definition at line 216 of file hal_wspi.h.
#define WSPI_CFG_ADDR_DTR (1LU << 11LU) |
Definition at line 218 of file hal_wspi.h.
#define WSPI_CFG_ADDR_SIZE_MASK (3LU << 12LU) |
Definition at line 220 of file hal_wspi.h.
#define WSPI_CFG_ADDR_SIZE_8 (0LU << 12LU) |
Definition at line 221 of file hal_wspi.h.
#define WSPI_CFG_ADDR_SIZE_16 (1LU << 12LU) |
Definition at line 222 of file hal_wspi.h.
#define WSPI_CFG_ADDR_SIZE_24 (2LU << 12LU) |
Definition at line 223 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_ADDR_SIZE_32 (3LU << 12LU) |
Definition at line 224 of file hal_wspi.h.
#define WSPI_CFG_ALT_MODE_MASK (7LU << 16LU) |
Definition at line 226 of file hal_wspi.h.
#define WSPI_CFG_ALT_MODE_NONE (0LU << 16LU) |
Definition at line 227 of file hal_wspi.h.
#define WSPI_CFG_ALT_MODE_ONE_LINE (1LU << 16LU) |
Definition at line 228 of file hal_wspi.h.
#define WSPI_CFG_ALT_MODE_TWO_LINES (2LU << 16LU) |
Definition at line 229 of file hal_wspi.h.
#define WSPI_CFG_ALT_MODE_FOUR_LINES (3LU << 16LU) |
Definition at line 230 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_ALT_MODE_EIGHT_LINES (4LU << 16LU) |
Definition at line 231 of file hal_wspi.h.
#define WSPI_CFG_ALT_DTR (1LU << 19LU) |
Definition at line 233 of file hal_wspi.h.
#define WSPI_CFG_ALT_SIZE_MASK (3LU << 20LU) |
Definition at line 235 of file hal_wspi.h.
#define WSPI_CFG_ALT_SIZE_8 (0LU << 20LU) |
Definition at line 236 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_ALT_SIZE_16 (1LU << 20LU) |
Definition at line 237 of file hal_wspi.h.
#define WSPI_CFG_ALT_SIZE_24 (2LU << 20LU) |
Definition at line 238 of file hal_wspi.h.
#define WSPI_CFG_ALT_SIZE_32 (3LU << 20LU) |
Definition at line 239 of file hal_wspi.h.
#define WSPI_CFG_DATA_MODE_MASK (7LU << 24LU) |
Definition at line 241 of file hal_wspi.h.
Referenced by wspiCommand(), wspiMapFlash(), wspiReceive(), and wspiSend().
#define WSPI_CFG_DATA_MODE_NONE (0LU << 24LU) |
Definition at line 242 of file hal_wspi.h.
Referenced by wspiCommand(), wspiMapFlash(), wspiReceive(), and wspiSend().
#define WSPI_CFG_DATA_MODE_ONE_LINE (1LU << 24LU) |
Definition at line 243 of file hal_wspi.h.
Referenced by __n25q_init_impl(), __n25q_mmap_on_impl(), n25q_read_id(), and n25q_reset_xip().
#define WSPI_CFG_DATA_MODE_TWO_LINES (2LU << 24LU) |
Definition at line 244 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_DATA_MODE_FOUR_LINES (3LU << 24LU) |
Definition at line 245 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl(), and n25q_reset_xip().
#define WSPI_CFG_DATA_MODE_EIGHT_LINES (4LU << 24LU) |
Definition at line 246 of file hal_wspi.h.
#define WSPI_CFG_DATA_DTR (1LU << 27LU) |
Definition at line 248 of file hal_wspi.h.
#define WSPI_CFG_DQS_ENABLE (1LU << 29LU) |
Definition at line 250 of file hal_wspi.h.
#define WSPI_CFG_SIOO (1LU << 31LU) |
Definition at line 252 of file hal_wspi.h.
Referenced by __n25q_mmap_on_impl().
#define WSPI_CFG_ALL_DTR |
Definition at line 254 of file hal_wspi.h.
#define wspiStartCommandI | ( | wspip, | |
cmdp ) |
Sends a command without data phase.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
Definition at line 274 of file hal_wspi.h.
Referenced by wspiCommand(), and wspiStartCommand().
#define wspiStartSendI | ( | wspip, | |
cmdp, | |||
n, | |||
txbuf ) |
Sends data over the WSPI bus.
This asynchronous function starts a transmit operation.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to send or zero if no data phase |
[in] | txbuf | the pointer to the transmit buffer |
Definition at line 294 of file hal_wspi.h.
Referenced by wspiSend(), and wspiStartSend().
#define wspiStartReceiveI | ( | wspip, | |
cmdp, | |||
n, | |||
rxbuf ) |
Receives data from the WSPI bus.
This asynchronous function starts a receive operation.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to receive or zero if no data phase |
[out] | rxbuf | the pointer to the receive buffer |
Definition at line 314 of file hal_wspi.h.
Referenced by wspiReceive(), and wspiStartReceive().
#define wspiMapFlashI | ( | wspip, | |
cmdp, | |||
addrp ) |
Maps in memory space a WSPI flash device.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[out] | addrp | pointer to the memory start address of the mapped flash or NULL |
Definition at line 335 of file hal_wspi.h.
Referenced by wspiMapFlash().
#define wspiUnmapFlashI | ( | wspip | ) |
Maps in memory space a WSPI flash device.
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 347 of file hal_wspi.h.
Referenced by wspiUnmapFlash().
#define _wspi_wakeup_isr | ( | wspip, | |
msg ) |
Wakes up the waiting thread.
[in] | wspip | pointer to the WSPIDriver object |
[in] | msg | the wakeup message |
Definition at line 365 of file hal_wspi.h.
#define _wspi_isr_code | ( | wspip | ) |
Common ISR code.
This code handles the portable part of the ISR code:
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 388 of file hal_wspi.h.
#define _wspi_error_code | ( | wspip | ) |
Common error ISR code.
This code handles the portable part of the ISR code:
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 414 of file hal_wspi.h.
#define WSPI_SUPPORTS_MEMMAP TRUE |
Definition at line 38 of file hal_wspi_lld.h.
#define WSPI_DEFAULT_CFG_MASKS TRUE |
Definition at line 39 of file hal_wspi_lld.h.
#define PLATFORM_WSPI_USE_WSPI1 FALSE |
WSPID1 driver enable switch.
If set to TRUE
the support for WSPID1 is included.
FALSE
. Definition at line 56 of file hal_wspi_lld.h.
#define wspi_lld_driver_fields |
Low level fields of the WSPI driver structure.
Definition at line 75 of file hal_wspi_lld.h.
#define wspi_lld_config_fields |
Low level fields of the WSPI configuration structure.
Definition at line 82 of file hal_wspi_lld.h.
typedef struct hal_wspi_driver WSPIDriver |
Type of a structure representing an WSPI driver.
Definition at line 83 of file hal_wspi.h.
typedef struct hal_wspi_config WSPIConfig |
Type of a structure representing an WSPI driver configuration.
Definition at line 88 of file hal_wspi.h.
typedef void(* wspicallback_t) (WSPIDriver *wspip) |
Type of a WSPI notification callback.
[in] | wspip | pointer to the WSPIDriver object triggering the callback |
Definition at line 96 of file hal_wspi.h.
enum wspistate_t |
Driver state machine possible states.
Definition at line 70 of file hal_wspi.h.
void wspiInit | ( | void | ) |
WSPI Driver initialization.
halInit()
, there is no need to explicitly initialize the driver.Definition at line 56 of file hal_wspi.c.
References wspi_lld_init().
Referenced by halInit().
void wspiObjectInit | ( | WSPIDriver * | wspip | ) |
Initializes the standard part of a WSPIDriver
structure.
[out] | wspip | pointer to the WSPIDriver object |
Definition at line 68 of file hal_wspi.c.
References hal_wspi_driver::config, hal_wspi_driver::mutex, osalMutexObjectInit(), hal_wspi_driver::state, hal_wspi_driver::thread, and WSPI_STOP.
Referenced by wspi_lld_init().
msg_t wspiStart | ( | WSPIDriver * | wspip, |
const WSPIConfig * | config ) |
Configures and activates the WSPI peripheral.
[in] | wspip | pointer to the WSPIDriver object |
[in] | config | pointer to the WSPIConfig object |
Definition at line 92 of file hal_wspi.c.
References hal_wspi_driver::config, HAL_RET_SUCCESS, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), hal_wspi_driver::state, wspi_lld_start(), WSPI_READY, and WSPI_STOP.
Referenced by __xsnor_bus_acquire(), bus_acquire(), snorStart(), and xsnorStart().
void wspiStop | ( | WSPIDriver * | wspip | ) |
Deactivates the WSPI peripheral.
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 131 of file hal_wspi.c.
References hal_wspi_driver::config, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), hal_wspi_driver::state, wspi_lld_stop(), WSPI_READY, and WSPI_STOP.
Referenced by bus_stop(), and xsnorStop().
void wspiStartCommand | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp ) |
Sends a command without data phase.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
Definition at line 156 of file hal_wspi.c.
References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), hal_wspi_driver::state, WSPI_READY, and wspiStartCommandI.
void wspiStartSend | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
size_t | n, | ||
const uint8_t * | txbuf ) |
Sends a command with data over the WSPI bus.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to send |
[in] | txbuf | the pointer to the transmit buffer |
Definition at line 180 of file hal_wspi.c.
References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), hal_wspi_driver::state, WSPI_READY, and wspiStartSendI.
void wspiStartReceive | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
size_t | n, | ||
uint8_t * | rxbuf ) |
Sends a command then receives data over the WSPI bus.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to send |
[out] | rxbuf | the pointer to the receive buffer |
Definition at line 206 of file hal_wspi.c.
References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), hal_wspi_driver::state, WSPI_READY, and wspiStartReceiveI.
bool wspiCommand | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp ) |
Sends a command without data phase.
WSPI_USE_WAIT
must be enabled. end_cb
= NULL
).[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
false | if the operation succeeded. |
true | if the operation failed because HW issues. |
Definition at line 237 of file hal_wspi.c.
References wspi_command_t::cfg, hal_wspi_driver::config, hal_wspi_config::end_cb, MSG_OK, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadSuspendS(), hal_wspi_driver::state, hal_wspi_driver::thread, WSPI_CFG_DATA_MODE_MASK, WSPI_CFG_DATA_MODE_NONE, WSPI_READY, and wspiStartCommandI.
Referenced by __n25q_init_impl(), __xsnor_bus_cmd(), __xsnor_bus_cmd_addr(), bus_cmd(), bus_cmd_addr(), mx25_reset_memory(), mx25_write_cr2(), and n25q_reset_memory().
bool wspiSend | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
size_t | n, | ||
const uint8_t * | txbuf ) |
Sends a command with data over the WSPI bus.
WSPI_USE_WAIT
must be enabled. end_cb
= NULL
).[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to send |
[in] | txbuf | the pointer to the transmit buffer |
false | if the operation succeeded. |
true | if the operation failed because HW issues. |
Definition at line 273 of file hal_wspi.c.
References wspi_command_t::cfg, hal_wspi_driver::config, hal_wspi_config::end_cb, MSG_OK, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadSuspendS(), hal_wspi_driver::state, hal_wspi_driver::thread, WSPI_CFG_DATA_MODE_MASK, WSPI_CFG_DATA_MODE_NONE, WSPI_READY, and wspiStartSendI.
Referenced by __n25q_init_impl(), __xsnor_bus_cmd_addr_send(), __xsnor_bus_cmd_send(), bus_cmd_addr_send(), bus_cmd_send(), and mx25_write_cr2().
bool wspiReceive | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
size_t | n, | ||
uint8_t * | rxbuf ) |
Sends a command then receives data over the WSPI bus.
WSPI_USE_WAIT
must be enabled. end_cb
= NULL
).[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to send |
[out] | rxbuf | the pointer to the receive buffer |
false | if the operation succeeded. |
true | if the operation failed because HW issues. |
Definition at line 311 of file hal_wspi.c.
References wspi_command_t::cfg, hal_wspi_driver::config, hal_wspi_config::end_cb, MSG_OK, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadSuspendS(), hal_wspi_driver::state, hal_wspi_driver::thread, WSPI_CFG_DATA_MODE_MASK, WSPI_CFG_DATA_MODE_NONE, WSPI_READY, and wspiStartReceiveI.
Referenced by __xsnor_bus_cmd_addr_dummy_receive(), __xsnor_bus_cmd_addr_receive(), __xsnor_bus_cmd_dummy_receive(), __xsnor_bus_cmd_receive(), bus_cmd_addr_dummy_receive(), bus_cmd_addr_receive(), bus_cmd_dummy_receive(), bus_cmd_receive(), mx25_read_id(), n25q_read_id(), and n25q_reset_xip().
void wspiMapFlash | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
uint8_t ** | addrp ) |
Maps in memory space a WSPI flash device.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[out] | addrp | pointer to the memory start address of the mapped flash or NULL |
Definition at line 346 of file hal_wspi.c.
References wspi_command_t::cfg, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), hal_wspi_driver::state, WSPI_CFG_DATA_MODE_MASK, WSPI_CFG_DATA_MODE_NONE, WSPI_MEMMAP, WSPI_READY, and wspiMapFlashI.
Referenced by __mx25_mmap_on_impl(), __n25q_mmap_on_impl(), and snorMemoryMap().
void wspiUnmapFlash | ( | WSPIDriver * | wspip | ) |
Unmaps from memory space a WSPI flash device.
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 372 of file hal_wspi.c.
References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), hal_wspi_driver::state, WSPI_MEMMAP, WSPI_READY, and wspiUnmapFlashI.
Referenced by __mx25_mmap_off_impl(), __n25q_mmap_off_impl(), and snorMemoryUnmap().
void wspiAcquireBus | ( | WSPIDriver * | wspip | ) |
Gains exclusive access to the WSPI bus.
This function tries to gain ownership to the WSPI bus, if the bus is already being used then the invoking thread is queued.
WSPI_USE_MUTUAL_EXCLUSION
must be enabled.[in] | wspip | pointer to the WSPIDriver object |
Definition at line 399 of file hal_wspi.c.
References hal_wspi_driver::mutex, osalDbgCheck, and osalMutexLock().
Referenced by __xsnor_bus_acquire(), and bus_acquire().
void wspiReleaseBus | ( | WSPIDriver * | wspip | ) |
Releases exclusive access to the WSPI bus.
WSPI_USE_MUTUAL_EXCLUSION
must be enabled.[in] | wspip | pointer to the WSPIDriver object |
Definition at line 415 of file hal_wspi.c.
References hal_wspi_driver::mutex, osalDbgCheck, and osalMutexUnlock().
Referenced by __xsnor_bus_release(), and bus_release().
void wspi_lld_init | ( | void | ) |
Low level WSPI driver initialization.
Definition at line 63 of file hal_wspi_lld.c.
References WSPID1, and wspiObjectInit().
Referenced by wspiInit().
void wspi_lld_start | ( | WSPIDriver * | wspip | ) |
Configures and activates the WSPI peripheral.
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 77 of file hal_wspi_lld.c.
References hal_wspi_driver::state, WSPI_STOP, and WSPID1.
Referenced by wspiStart().
void wspi_lld_stop | ( | WSPIDriver * | wspip | ) |
Deactivates the WSPI peripheral.
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 99 of file hal_wspi_lld.c.
References hal_wspi_driver::state, WSPI_READY, and WSPID1.
Referenced by wspiStop().
void wspi_lld_command | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp ) |
Sends a command without data phase.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
Definition at line 123 of file hal_wspi_lld.c.
void wspi_lld_send | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
size_t | n, | ||
const uint8_t * | txbuf ) |
Sends a command with data over the WSPI bus.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to send |
[in] | txbuf | the pointer to the transmit buffer |
Definition at line 140 of file hal_wspi_lld.c.
void wspi_lld_receive | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
size_t | n, | ||
uint8_t * | rxbuf ) |
Sends a command then receives data over the WSPI bus.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[in] | n | number of bytes to send |
[out] | rxbuf | the pointer to the receive buffer |
Definition at line 160 of file hal_wspi_lld.c.
void wspi_lld_map_flash | ( | WSPIDriver * | wspip, |
const wspi_command_t * | cmdp, | ||
uint8_t ** | addrp ) |
Maps in memory space a WSPI flash device.
[in] | wspip | pointer to the WSPIDriver object |
[in] | cmdp | pointer to the command descriptor |
[out] | addrp | pointer to the memory start address of the mapped flash or NULL |
Definition at line 182 of file hal_wspi_lld.c.
void wspi_lld_unmap_flash | ( | WSPIDriver * | wspip | ) |
Unmaps from memory space a WSPI flash device.
[in] | wspip | pointer to the WSPIDriver object |
Definition at line 200 of file hal_wspi_lld.c.
WSPIDriver WSPID1 |
WSPID1 driver identifier.
Definition at line 39 of file hal_wspi_lld.c.
Referenced by wspi_lld_init(), wspi_lld_start(), and wspi_lld_stop().