ChibiOS/HAL 9.0.0
hal_wspi_lld.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file hal_wspi_lld.h
19 * @brief PLATFORM WSPI subsystem low level driver header.
20 *
21 * @addtogroup WSPI
22 * @{
23 */
24
25#ifndef HAL_WSPI_LLD_H
26#define HAL_WSPI_LLD_H
27
28#if (HAL_USE_WSPI == TRUE) || defined(__DOXYGEN__)
29
30/*===========================================================================*/
31/* Driver constants. */
32/*===========================================================================*/
33
34/**
35 * @name WSPI implementation capabilities
36 * @{
37 */
38#define WSPI_SUPPORTS_MEMMAP TRUE
39#define WSPI_DEFAULT_CFG_MASKS TRUE
40/** @} */
41
42/*===========================================================================*/
43/* Driver pre-compile time settings. */
44/*===========================================================================*/
45
46/**
47 * @name Configuration options
48 * @{
49 */
50/**
51 * @brief WSPID1 driver enable switch.
52 * @details If set to @p TRUE the support for WSPID1 is included.
53 * @note The default is @p FALSE.
54 */
55#if !defined(PLATFORM_WSPI_USE_WSPI1) || defined(__DOXYGEN__)
56#define PLATFORM_WSPI_USE_WSPI1 FALSE
57#endif
58/** @} */
59
60/*===========================================================================*/
61/* Derived constants and error checks. */
62/*===========================================================================*/
63
64/*===========================================================================*/
65/* Driver data structures and types. */
66/*===========================================================================*/
67
68/*===========================================================================*/
69/* Driver macros. */
70/*===========================================================================*/
71
72/**
73 * @brief Low level fields of the WSPI driver structure.
74 */
75#define wspi_lld_driver_fields \
76 /* Dummy field, it is not needed.*/ \
77 uint32_t dummy;
78
79/**
80 * @brief Low level fields of the WSPI configuration structure.
81 */
82#define wspi_lld_config_fields \
83 /* Dummy configuration, it is not needed.*/ \
84 uint32_t dummy;
85
86/*===========================================================================*/
87/* External declarations. */
88/*===========================================================================*/
89
90#if (PLATFORM_WSPI_USE_WSPI1 == TRUE) && !defined(__DOXYGEN__)
91extern WSPIDriver WSPID1;
92#endif
93
94#ifdef __cplusplus
95extern "C" {
96#endif
97 void wspi_lld_init(void);
98 void wspi_lld_start(WSPIDriver *wspip);
99 void wspi_lld_stop(WSPIDriver *wspip);
100 void wspi_lld_command(WSPIDriver *wspip, const wspi_command_t *cmdp);
101 void wspi_lld_send(WSPIDriver *wspip, const wspi_command_t *cmdp,
102 size_t n, const uint8_t *txbuf);
103 void wspi_lld_receive(WSPIDriver *wspip, const wspi_command_t *cmdp,
104 size_t n, uint8_t *rxbuf);
105#if WSPI_SUPPORTS_MEMMAP == TRUE
106 void wspi_lld_map_flash(WSPIDriver *wspip,
107 const wspi_command_t *cmdp,
108 uint8_t **addrp);
109 void wspi_lld_unmap_flash(WSPIDriver *wspip);
110#endif
111#ifdef __cplusplus
112}
113#endif
114
115#endif /* HAL_USE_WSPI */
116
117#endif /* HAL_WSPI_LLD_H */
118
119/** @} */
void wspi_lld_init(void)
Low level WSPI driver initialization.
struct hal_wspi_driver WSPIDriver
Type of a structure representing an WSPI driver.
Definition hal_wspi.h:83
void wspi_lld_unmap_flash(WSPIDriver *wspip)
Unmaps from memory space a WSPI flash device.
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_stop(WSPIDriver *wspip)
Deactivates the WSPI peripheral.
WSPIDriver WSPID1
WSPID1 driver identifier.
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_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_command(WSPIDriver *wspip, const wspi_command_t *cmdp)
Sends a command without data phase.
void wspi_lld_start(WSPIDriver *wspip)
Configures and activates the WSPI peripheral.
Type of a WSPI command descriptor.
Definition hal_wspi.h:101