ChibiOS  21.6.0
chcore.c
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 templates/chcore.c
22  * @brief Port related template code.
23  *
24  * @addtogroup port_core
25  * @details Non portable code templates.
26  * @{
27  */
28 
29 #include "ch.h"
30 
31 /*===========================================================================*/
32 /* Module local definitions. */
33 /*===========================================================================*/
34 
35 /*===========================================================================*/
36 /* Module exported variables. */
37 /*===========================================================================*/
38 
39 /*===========================================================================*/
40 /* Module local types. */
41 /*===========================================================================*/
42 
43 /*===========================================================================*/
44 /* Module local variables. */
45 /*===========================================================================*/
46 
47 /*===========================================================================*/
48 /* Module local functions. */
49 /*===========================================================================*/
50 
51 /*===========================================================================*/
52 /* Module exported functions. */
53 /*===========================================================================*/
54 
55 /**
56  * @brief Port-related initialization code.
57  * @note This function is usually empty.
58  */
59 void _port_init(void) {
60 }
61 
62 /**
63  * @brief Performs a context switch between two threads.
64  * @details This is the most critical code in any port, this function
65  * is responsible for the context switch between 2 threads.
66  * @note The implementation of this code affects <b>directly</b> the context
67  * switch performance so optimize here as much as you can.
68  *
69  * @param[in] ntp the thread to be switched in
70  * @param[in] otp the thread to be switched out
71  */
72 void _port_switch(thread_t *ntp, thread_t *otp) {
73 }
74 
75 /** @} */
ch_thread
Structure representing a thread.
Definition: chobjects.h:156
_port_init
void _port_init(void)
Port-related initialization code.
Definition: chcore.c:59
_port_switch
void _port_switch(thread_t *ntp, thread_t *otp)
Performs a context switch between two threads.
Definition: chcore.c:72