libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
scb.c
Go to the documentation of this file.
1/** @defgroup CM3_scb_file SCB
2 *
3 * @ingroup CM3_files
4 *
5 * @brief <b>libopencm3 Cortex-M System Control Block</b>
6 *
7 * The System Control Block (SCB) is a section of the System Control Space
8 * which provides status information and control features for the processor core.
9 * It allows, amongst other:
10 * * software reset control
11 * * exception management and grouping
12 * * fault information
13 * * power management
14 * * debug status information
15 *
16 * @see ARMv7m Architecture Reference Manual (Chapter B3.2.1 About the SCB)
17 *
18 * LGPL License Terms @ref lgpl_license
19 * @{
20 */
21/*
22 * This file is part of the libopencm3 project.
23 *
24 * Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
25 *
26 * This library is free software: you can redistribute it and/or modify
27 * it under the terms of the GNU Lesser General Public License as published by
28 * the Free Software Foundation, either version 3 of the License, or
29 * (at your option) any later version.
30 *
31 * This library is distributed in the hope that it will be useful,
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 * GNU Lesser General Public License for more details.
35 *
36 * You should have received a copy of the GNU Lesser General Public License
37 * along with this library. If not, see <http://www.gnu.org/licenses/>.
38 */
39
40#include <stdlib.h>
41
42#include <libopencm3/cm3/scb.h>
43
44/* Those are defined only on CM3 or CM4 */
45#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
47{
49
50 while (1);
51}
52#endif
53
55{
57
58 while (1);
59}
60
61/* Those are defined only on CM3 or CM4 */
62#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
63void scb_set_priority_grouping(uint32_t prigroup)
64{
65 SCB_AIRCR = SCB_AIRCR_VECTKEY | prigroup;
66}
67#endif
68
69/**@}*/
void scb_set_priority_grouping(uint32_t prigroup)
Definition: scb.c:63
void scb_reset_core(void)
Definition: scb.c:46
void scb_reset_system(void)
Definition: scb.c:54
#define SCB_AIRCR_SYSRESETREQ
SYSRESETREQ System reset request.
Definition: scb.h:314
#define SCB_AIRCR_VECTKEY
Definition: scb.h:294
#define SCB_AIRCR_VECTRESET
VECTRESET cause local system reset.
Definition: scb.h:321
#define SCB_AIRCR
AIRCR: Application Interrupt and Reset Control Register.
Definition: scb.h:52