hal_i2s_lld.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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_i2s_lld.c
  15. * @brief PLATFORM I2S subsystem low level driver source.
  16. *
  17. * @addtogroup I2S
  18. * @{
  19. */
  20. #include "hal.h"
  21. #if (HAL_USE_I2S == TRUE) || defined(__DOXYGEN__)
  22. /*===========================================================================*/
  23. /* Driver local definitions. */
  24. /*===========================================================================*/
  25. /*===========================================================================*/
  26. /* Driver exported variables. */
  27. /*===========================================================================*/
  28. /** @brief I2S2 driver identifier.*/
  29. #if (PLATFORM_I2S_USE_I2S1 == TRUE) || defined(__DOXYGEN__)
  30. I2SDriver I2SD1;
  31. #endif
  32. /*===========================================================================*/
  33. /* Driver local variables and types. */
  34. /*===========================================================================*/
  35. /*===========================================================================*/
  36. /* Driver local functions. */
  37. /*===========================================================================*/
  38. /*===========================================================================*/
  39. /* Driver interrupt handlers. */
  40. /*===========================================================================*/
  41. /*===========================================================================*/
  42. /* Driver exported functions. */
  43. /*===========================================================================*/
  44. /**
  45. * @brief Low level I2S driver initialization.
  46. *
  47. * @notapi
  48. */
  49. void i2s_lld_init(void) {
  50. #if PLATFORM_I2S_USE_I2S1
  51. i2sObjectInit(&I2SD1);
  52. #endif
  53. }
  54. /**
  55. * @brief Configures and activates the I2S peripheral.
  56. *
  57. * @param[in] i2sp pointer to the @p I2SDriver object
  58. *
  59. * @notapi
  60. */
  61. void i2s_lld_start(I2SDriver *i2sp) {
  62. /* If in stopped state then enables the SPI and DMA clocks.*/
  63. if (i2sp->state == I2S_STOP) {
  64. #if PLATFORM_I2S_USE_I2S1
  65. if (&I2SD1 == i2sp) {
  66. }
  67. #endif
  68. }
  69. }
  70. /**
  71. * @brief Deactivates the I2S peripheral.
  72. *
  73. * @param[in] i2sp pointer to the @p I2SDriver object
  74. *
  75. * @notapi
  76. */
  77. void i2s_lld_stop(I2SDriver *i2sp) {
  78. /* If in ready state then disables the SPI clock.*/
  79. if (i2sp->state == I2S_READY) {
  80. #if PLATFORM_I2S_USE_I2S1
  81. if (&I2SD1 == i2sp) {
  82. }
  83. #endif
  84. }
  85. }
  86. /**
  87. * @brief Starts a I2S data exchange.
  88. *
  89. * @param[in] i2sp pointer to the @p I2SDriver object
  90. *
  91. * @notapi
  92. */
  93. void i2s_lld_start_exchange(I2SDriver *i2sp) {
  94. (void)i2sp;
  95. }
  96. /**
  97. * @brief Stops the ongoing data exchange.
  98. * @details The ongoing data exchange, if any, is stopped, if the driver
  99. * was not active the function does nothing.
  100. *
  101. * @param[in] i2sp pointer to the @p I2SDriver object
  102. *
  103. * @notapi
  104. */
  105. void i2s_lld_stop_exchange(I2SDriver *i2sp) {
  106. (void)i2sp;
  107. }
  108. #endif /* HAL_USE_I2S */
  109. /** @} */