ChibiOS/RT 7.0.6
chrfcu.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 rt/src/chrfcu.c
21 * @brief Runtime Faults Collection Unit code.
22 *
23 * @addtogroup rfcu
24 * @details Runtime Faults Collection Unit service.
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 Adds fault flags to the current mask.
56 *
57 * @param[in] mask fault flags to be added
58 */
60
61#if CH_CFG_SMP_MODE == FALSE
62 currcore->rfcu.mask |= mask;
63#else
64 ch_system.rfcu.mask |= mask;
65#endif
66
68}
69
70/**
71 * @brief Returns the current faults mask clearing it.
72 *
73 * @param[in] mask mask of faults to be read and cleared
74 * @return The current faults mask.
75 * @retval 0 if no faults were collected since last call to this
76 * function.
77 */
80
81#if CH_CFG_SMP_MODE == FALSE
83
84 m = oip->rfcu.mask & mask;
85 oip->rfcu.mask &= ~m;
86#else
87
88 m = ch_system.rfcu.mask & mask;
89 ch_system.rfcu.mask &= ~m;
90#endif
91
92 return m;
93}
94/** @} */
ChibiOS/RT main include file.
#define CH_CFG_RUNTIME_FAULTS_HOOK(mask)
Runtime Faults Collection Unit hook.
Definition chconf.h:805
struct ch_os_instance os_instance_t
Type of an OS instance structure.
Definition chearly.h:137
void chRFCUCollectFaultsI(rfcu_mask_t mask)
Adds fault flags to the current mask.
Definition chrfcu.c:59
uint32_t rfcu_mask_t
Type of a faults mask.
Definition chrfcu.h:62
rfcu_mask_t chRFCUGetAndClearFaultsI(rfcu_mask_t mask)
Returns the current faults mask clearing it.
Definition chrfcu.c:78
#define currcore
Access to current core's instance structure.
Definition chsys.h:89
rfcu_t rfcu
Runtime Faults Collection Unit for this instance.
Definition chobjects.h:429
rfcu_mask_t mask
Mask of the pending runtime faults.
Definition chrfcu.h:71
Type of system data structure.
Definition chobjects.h:466
rfcu_t rfcu
Runtime Faults Collection Unit.
Definition chobjects.h:494