chdynamic.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio.
  3. This file is part of ChibiOS.
  4. ChibiOS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. ChibiOS is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. /**
  16. * @file chdynamic.h
  17. * @brief Dynamic threads macros and structures.
  18. *
  19. * @addtogroup dynamic_threads
  20. * @{
  21. */
  22. #ifndef CHDYNAMIC_H
  23. #define CHDYNAMIC_H
  24. #if (CH_CFG_USE_DYNAMIC == TRUE) || defined(__DOXYGEN__)
  25. /*===========================================================================*/
  26. /* Module constants. */
  27. /*===========================================================================*/
  28. /*===========================================================================*/
  29. /* Module pre-compile time settings. */
  30. /*===========================================================================*/
  31. /*===========================================================================*/
  32. /* Derived constants and error checks. */
  33. /*===========================================================================*/
  34. /*
  35. * Module dependencies check.
  36. */
  37. #if CH_CFG_USE_WAITEXIT == FALSE
  38. #error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_WAITEXIT"
  39. #endif
  40. #if CH_CFG_USE_REGISTRY == FALSE
  41. #error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_REGISTRY"
  42. #endif
  43. #if (CH_CFG_USE_HEAP == FALSE) && (CH_CFG_USE_MEMPOOLS == FALSE)
  44. #error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_HEAP and/or CH_CFG_USE_MEMPOOLS"
  45. #endif
  46. /*===========================================================================*/
  47. /* Module data structures and types. */
  48. /*===========================================================================*/
  49. /*===========================================================================*/
  50. /* Module macros. */
  51. /*===========================================================================*/
  52. /*===========================================================================*/
  53. /* External declarations. */
  54. /*===========================================================================*/
  55. /*
  56. * Dynamic threads APIs.
  57. */
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61. #if CH_CFG_USE_HEAP == TRUE
  62. thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
  63. const char *name, tprio_t prio,
  64. tfunc_t pf, void *arg);
  65. #endif
  66. #if CH_CFG_USE_MEMPOOLS == TRUE
  67. thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, const char *name,
  68. tprio_t prio, tfunc_t pf, void *arg);
  69. #endif
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. /*===========================================================================*/
  74. /* Module inline functions. */
  75. /*===========================================================================*/
  76. #endif /* CH_CFG_USE_DYNAMIC == TRUE */
  77. #endif /* CHDYNAMIC_H */
  78. /** @} */