hal_gpt_lld.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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_gpt_lld.c
  15. * @brief PLATFORM GPT subsystem low level driver source.
  16. *
  17. * @addtogroup GPT
  18. * @{
  19. */
  20. #include "hal.h"
  21. #if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
  22. /*===========================================================================*/
  23. /* Driver local definitions. */
  24. /*===========================================================================*/
  25. /*===========================================================================*/
  26. /* Driver exported variables. */
  27. /*===========================================================================*/
  28. /**
  29. * @brief GPTD1 driver identifier.
  30. */
  31. #if (PLATFORM_GPT_USE_GPT1 == TRUE) || defined(__DOXYGEN__)
  32. GPTDriver GPTD1;
  33. #endif
  34. /*===========================================================================*/
  35. /* Driver local variables and types. */
  36. /*===========================================================================*/
  37. /*===========================================================================*/
  38. /* Driver local functions. */
  39. /*===========================================================================*/
  40. /*===========================================================================*/
  41. /* Driver interrupt handlers. */
  42. /*===========================================================================*/
  43. /*===========================================================================*/
  44. /* Driver exported functions. */
  45. /*===========================================================================*/
  46. /**
  47. * @brief Low level GPT driver initialization.
  48. *
  49. * @notapi
  50. */
  51. void gpt_lld_init(void) {
  52. #if PLATFORM_GPT_USE_GPT1 == TRUE
  53. /* Driver initialization.*/
  54. gptObjectInit(&GPTD1);
  55. #endif
  56. }
  57. /**
  58. * @brief Configures and activates the GPT peripheral.
  59. *
  60. * @param[in] gptp pointer to the @p GPTDriver object
  61. *
  62. * @notapi
  63. */
  64. void gpt_lld_start(GPTDriver *gptp) {
  65. if (gptp->state == GPT_STOP) {
  66. /* Enables the peripheral.*/
  67. #if PLATFORM_GPT_USE_GPT1 == TRUE
  68. if (&GPTD1 == gptp) {
  69. }
  70. #endif
  71. }
  72. /* Configures the peripheral.*/
  73. }
  74. /**
  75. * @brief Deactivates the GPT peripheral.
  76. *
  77. * @param[in] gptp pointer to the @p GPTDriver object
  78. *
  79. * @notapi
  80. */
  81. void gpt_lld_stop(GPTDriver *gptp) {
  82. if (gptp->state == GPT_READY) {
  83. /* Resets the peripheral.*/
  84. /* Disables the peripheral.*/
  85. #if PLATFORM_GPT_USE_GPT1 == TRUE
  86. if (&GPTD1 == gptp) {
  87. }
  88. #endif
  89. }
  90. }
  91. /**
  92. * @brief Starts the timer in continuous mode.
  93. *
  94. * @param[in] gptp pointer to the @p GPTDriver object
  95. * @param[in] interval period in ticks
  96. *
  97. * @notapi
  98. */
  99. void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval) {
  100. (void)gptp;
  101. (void)interval;
  102. }
  103. /**
  104. * @brief Stops the timer.
  105. *
  106. * @param[in] gptp pointer to the @p GPTDriver object
  107. *
  108. * @notapi
  109. */
  110. void gpt_lld_stop_timer(GPTDriver *gptp) {
  111. (void)gptp;
  112. }
  113. /**
  114. * @brief Starts the timer in one shot mode and waits for completion.
  115. * @details This function specifically polls the timer waiting for completion
  116. * in order to not have extra delays caused by interrupt servicing,
  117. * this function is only recommended for short delays.
  118. *
  119. * @param[in] gptp pointer to the @p GPTDriver object
  120. * @param[in] interval time interval in ticks
  121. *
  122. * @notapi
  123. */
  124. void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval) {
  125. (void)gptp;
  126. (void)interval;
  127. }
  128. #endif /* HAL_USE_GPT == TRUE */
  129. /** @} */