irq_storm.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 irq_storm.h
  15. * @brief IRQ Storm stress test header.
  16. *
  17. * @addtogroup IRQ_STORM
  18. * @{
  19. */
  20. #ifndef IRQ_STORM_H
  21. #define IRQ_STORM_H
  22. /*===========================================================================*/
  23. /* Module constants. */
  24. /*===========================================================================*/
  25. /*===========================================================================*/
  26. /* Module pre-compile time settings. */
  27. /*===========================================================================*/
  28. #ifndef RANDOMIZE
  29. #define RANDOMIZE FALSE
  30. #endif
  31. #ifndef ITERATIONS
  32. #define ITERATIONS 100
  33. #endif
  34. #ifndef NUM_THREADS
  35. #define NUM_THREADS 4
  36. #endif
  37. #ifndef MAILBOX_SIZE
  38. #define MAILBOX_SIZE 4
  39. #endif
  40. /**
  41. * @name Configuration options
  42. * @{
  43. */
  44. /**
  45. * @brief Timings randomization.
  46. */
  47. #if !defined(IRQ_STORM_CFG_RANDOMIZE) || defined(__DOXYGEN__)
  48. #define IRQ_STORM_CFG_RANDOMIZE FALSE
  49. #endif
  50. /**
  51. * @brief Number of test iterations.
  52. */
  53. #if !defined(IRQ_STORM_CFG_ITERATIONS) || defined(__DOXYGEN__)
  54. #define IRQ_STORM_CFG_ITERATIONS 100
  55. #endif
  56. /**
  57. * @brief Number of storm threads.
  58. */
  59. #if !defined(IRQ_STORM_CFG_NUM_THREADS) || defined(__DOXYGEN__)
  60. #define IRQ_STORM_CFG_NUM_THREADS 4
  61. #endif
  62. /**
  63. * @brief Priority of storm threads.
  64. */
  65. #if !defined(IRQ_STORM_CFG_THREADS_PRIORITY) || defined(__DOXYGEN__)
  66. #define IRQ_STORM_CFG_THREADS_PRIORITY (tprio_t)(NORMALPRIO-20)
  67. #endif
  68. /**
  69. * @brief Mailboxes size.
  70. */
  71. #if !defined(IRQ_STORM_CFG_MAILBOX_SIZE) || defined(__DOXYGEN__)
  72. #define IRQ_STORM_CFG_MAILBOX_SIZE 4
  73. #endif
  74. /**
  75. * @brief Stack size for worker threads.
  76. */
  77. #if !defined(IRQ_STORM_CFG_STACK_SIZE) || defined(__DOXYGEN__)
  78. #define IRQ_STORM_CFG_STACK_SIZE 128
  79. #endif
  80. /** @} */
  81. /*===========================================================================*/
  82. /* Derived constants and error checks. */
  83. /*===========================================================================*/
  84. /*===========================================================================*/
  85. /* Module data structures and types. */
  86. /*===========================================================================*/
  87. typedef struct {
  88. /**
  89. * @brief Stream for output.
  90. */
  91. BaseSequentialStream *out;
  92. /**
  93. * @brief LED port.
  94. */
  95. ioportid_t port;
  96. /**
  97. * @brief LED bit.
  98. */
  99. unsigned pad;
  100. /**
  101. * @brief GPT driver 1.
  102. */
  103. GPTDriver *gpt1p;
  104. /**
  105. * @brief GPT driver 2.
  106. */
  107. GPTDriver *gpt2p;
  108. /**
  109. * @brief GPT1 configuration 1.
  110. */
  111. const GPTConfig *gptcfg1p;
  112. /**
  113. * @brief GPT1 configuration 2.
  114. */
  115. const GPTConfig *gptcfg2p;
  116. /**
  117. * @brief System clock.
  118. */
  119. uint32_t sysclk;
  120. } irq_storm_config_t;
  121. /*===========================================================================*/
  122. /* Module macros. */
  123. /*===========================================================================*/
  124. /*===========================================================================*/
  125. /* External declarations. */
  126. /*===========================================================================*/
  127. #ifdef __cplusplus
  128. extern "C" {
  129. #endif
  130. void irq_storm_gpt1_cb(GPTDriver *gptp);
  131. void irq_storm_gpt2_cb(GPTDriver *gptp);
  132. void irq_storm_execute(const irq_storm_config_t *cfg);
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136. /*===========================================================================*/
  137. /* Module inline functions. */
  138. /*===========================================================================*/
  139. #endif /* IRQ_STORM_H */
  140. /** @} */