ChibiOS 21.11.5
chcore.c
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
3
4 This file is part of ChibiOS.
5
6 ChibiOS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation version 3 of the License.
9
10 ChibiOS is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/**
20 * @file templates/chcore.c
21 * @brief Port related template code.
22 *
23 * @addtogroup port_core
24 * @details Non portable code templates.
25 * @{
26 */
27
28#include "ch.h"
29
30/*===========================================================================*/
31/* Module local definitions. */
32/*===========================================================================*/
33
34/*===========================================================================*/
35/* Module exported variables. */
36/*===========================================================================*/
37
38/*===========================================================================*/
39/* Module local types. */
40/*===========================================================================*/
41
42/*===========================================================================*/
43/* Module local variables. */
44/*===========================================================================*/
45
46/*===========================================================================*/
47/* Module local functions. */
48/*===========================================================================*/
49
50/*===========================================================================*/
51/* Module exported functions. */
52/*===========================================================================*/
53
54/**
55 * @brief Port-related initialization code.
56 * @note This function is usually empty.
57 */
58void _port_init(void) {
59}
60
61/**
62 * @brief Performs a context switch between two threads.
63 * @details This is the most critical code in any port, this function
64 * is responsible for the context switch between 2 threads.
65 * @note The implementation of this code affects <b>directly</b> the context
66 * switch performance so optimize here as much as you can.
67 *
68 * @param[in] ntp the thread to be switched in
69 * @param[in] otp the thread to be switched out
70 */
71void _port_switch(thread_t *ntp, thread_t *otp) {
72}
73
74/** @} */
struct ch_thread thread_t
Type of a thread structure.
Definition chearly.h:132
void _port_init(void)
Port-related initialization code.
Definition chcore.c:58
void _port_switch(thread_t *ntp, thread_t *otp)
Performs a context switch between two threads.
Definition chcore.c:71