1 /*
2 * Copyright (c) 2020 Stephanos Ioannidis <root@stephanos.io>
3 * Copyright 2023 NXP
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8 /**
9 * @file
10 * @brief CMSIS extension
11 *
12 * This header provides CMSIS-style register access functions and macros that
13 * are not currently available in the CMSIS.
14 *
15 * NOTE: cmsis.h includes this file; do not manually include this file.
16 */
17
18 #ifndef ZEPHYR_MODULES_CMSIS_CMSIS_A_R_EXT_H_
19 #define ZEPHYR_MODULES_CMSIS_CMSIS_A_R_EXT_H_
20
21 /* FSR Register Definitions */
22 #if defined(CONFIG_AARCH32_ARMV8_R)
23 #define FSR_FS_TRANSLATION_FAULT (4)
24 #define FSR_FS_PERMISSION_FAULT (12)
25 #define FSR_FS_SYNC_EXTERNAL_ABORT (16)
26 #define FSR_FS_ASYNC_EXTERNAL_ABORT (17)
27 #define FSR_FS_SYNC_PARITY_ERROR (24)
28 #define FSR_FS_ASYNC_PARITY_ERROR (25)
29 #define FSR_FS_ALIGNMENT_FAULT (33)
30 #define FSR_FS_DEBUG_EVENT (34)
31 #define FSR_FS_UNSUPPORTED_EXCLUSIVE_ACCESS_FAULT (53)
32 #else
33 #define FSR_FS_BACKGROUND_FAULT (0)
34 #define FSR_FS_ALIGNMENT_FAULT (1)
35 #define FSR_FS_DEBUG_EVENT (2)
36 #define FSR_FS_SYNC_EXTERNAL_ABORT (8)
37 #define FSR_FS_PERMISSION_FAULT (13)
38 #define FSR_FS_ASYNC_EXTERNAL_ABORT (22)
39 #define FSR_FS_ASYNC_PARITY_ERROR (24)
40 #define FSR_FS_SYNC_PARITY_ERROR (25)
41 #endif
42
43 /* DBGDSCR Register Definitions */
44 #define DBGDSCR_MOE_Pos (2U)
45 #define DBGDSCR_MOE_Msk (0xFUL << DBGDSCR_MOE_Pos)
46
47 #define DBGDSCR_MOE_HALT_REQUEST (0)
48 #define DBGDSCR_MOE_BREAKPOINT (1)
49 #define DBGDSCR_MOE_ASYNC_WATCHPOINT (2)
50 #define DBGDSCR_MOE_BKPT_INSTRUCTION (3)
51 #define DBGDSCR_MOE_EXT_DEBUG_REQUEST (4)
52 #define DBGDSCR_MOE_VECTOR_CATCH (5)
53 #define DBGDSCR_MOE_OS_UNLOCK_CATCH (8)
54 #define DBGDSCR_MOE_SYNC_WATCHPOINT (10)
55
__get_DFAR(void)56 __STATIC_FORCEINLINE uint32_t __get_DFAR(void)
57 {
58 uint32_t result;
59 __get_CP(15, 0, result, 6, 0, 0);
60 return result;
61 }
62
__get_IFAR(void)63 __STATIC_FORCEINLINE uint32_t __get_IFAR(void)
64 {
65 uint32_t result;
66 __get_CP(15, 0, result, 6, 0, 2);
67 return result;
68 }
69
__get_DBGDSCR(void)70 __STATIC_FORCEINLINE uint32_t __get_DBGDSCR(void)
71 {
72 uint32_t result;
73 __get_CP(14, 0, result, 0, 1, 0);
74 return result;
75 }
76
77 #endif /* ZEPHYR_MODULES_CMSIS_CMSIS_A_R_EXT_H_ */
78