ChibiOS/RT 7.0.5
chdynamic.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013,2014,
3 2015,2016,2017,2018,2019,2020,2021 Giovanni Di Sirio.
4
5 This file is part of ChibiOS.
6
7 ChibiOS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation version 3 of the License.
10
11 ChibiOS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20/**
21 * @file rt/include/chdynamic.h
22 * @brief Dynamic threads macros and structures.
23 *
24 * @addtogroup dynamic_threads
25 * @{
26 */
27
28#ifndef CHDYNAMIC_H
29#define CHDYNAMIC_H
30
31#if (CH_CFG_USE_DYNAMIC == TRUE) || defined(__DOXYGEN__)
32
33/*===========================================================================*/
34/* Module constants. */
35/*===========================================================================*/
36
37/*===========================================================================*/
38/* Module pre-compile time settings. */
39/*===========================================================================*/
40
41/*===========================================================================*/
42/* Derived constants and error checks. */
43/*===========================================================================*/
44
45/*
46 * Module dependencies check.
47 */
48#if CH_CFG_USE_WAITEXIT == FALSE
49#error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_WAITEXIT"
50#endif
51
52#if CH_CFG_USE_REGISTRY == FALSE
53#error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_REGISTRY"
54#endif
55
56#if (CH_CFG_USE_HEAP == FALSE) && (CH_CFG_USE_MEMPOOLS == FALSE)
57#error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_HEAP and/or CH_CFG_USE_MEMPOOLS"
58#endif
59
60/*===========================================================================*/
61/* Module data structures and types. */
62/*===========================================================================*/
63
64/*===========================================================================*/
65/* Module macros. */
66/*===========================================================================*/
67
68/*===========================================================================*/
69/* External declarations. */
70/*===========================================================================*/
71
72/*
73 * Dynamic threads APIs.
74 */
75#ifdef __cplusplus
76extern "C" {
77#endif
78#if CH_CFG_USE_HEAP == TRUE
79 thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
80 const char *name, tprio_t prio,
81 tfunc_t pf, void *arg);
82#endif
83#if CH_CFG_USE_MEMPOOLS == TRUE
85 tprio_t prio, tfunc_t pf, void *arg);
86#endif
87#ifdef __cplusplus
88}
89#endif
90
91/*===========================================================================*/
92/* Module inline functions. */
93/*===========================================================================*/
94
95#endif /* CH_CFG_USE_DYNAMIC == TRUE */
96
97#endif /* CHDYNAMIC_H */
98
99/** @} */
thread_t * chThdCreateFromHeap(memory_heap_t *heapp, size_t size, const char *name, tprio_t prio, tfunc_t pf, void *arg)
Creates a new thread allocating the memory from the heap.
Definition chdynamic.c:82
thread_t * chThdCreateFromMemoryPool(memory_pool_t *mp, const char *name, tprio_t prio, tfunc_t pf, void *arg)
Creates a new thread allocating the memory from the specified memory pool.
Definition chdynamic.c:137
uint32_t tprio_t
Definition chearly.h:87
struct ch_thread thread_t
Type of a thread structure.
Definition chearly.h:133
struct memory_heap memory_heap_t
Type of a memory heap.
Definition chmemheaps.h:72
void(* tfunc_t)(void *p)
Thread function.
Definition chthreads.h:52
Memory pool descriptor.
Definition chmempools.h:64