hal_wspi_lld.h 4.1 KB

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