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