]> begriffs open source - cmsis/blob - CMSIS/CoreValidation/Source/cmsis_cv.c
Core(M): Add LDA/STL memory clobbers
[cmsis] / CMSIS / CoreValidation / Source / cmsis_cv.c
1 /*-----------------------------------------------------------------------------
2  *      Name:         cmsis_cv.c
3  *      Purpose:      Driver validation test cases entry point
4  *----------------------------------------------------------------------------
5  *      Copyright (c) 2017 - 2018 Arm Limited. All rights reserved.
6  *----------------------------------------------------------------------------*/
7 #include "cmsis_cv.h"
8 #include "RTE_Components.h"
9 #include "CV_Framework.h"
10 #include "CV_Config.h"
11
12 /*-----------------------------------------------------------------------------
13  *      Prototypes
14  *----------------------------------------------------------------------------*/
15
16 void Interrupt0_Handler(void);
17
18 /*-----------------------------------------------------------------------------
19  *      Variables declarations
20  *----------------------------------------------------------------------------*/
21
22 void (*TST_IRQHandler)(void);
23
24 void Interrupt0_Handler(void) {
25   if (TST_IRQHandler != NULL) TST_IRQHandler();
26 }
27
28 /*-----------------------------------------------------------------------------
29  *      Init test suite
30  *----------------------------------------------------------------------------*/
31 static void TS_Init (void) {
32   TST_IRQHandler = NULL;
33
34 #ifdef RTE_CV_MEASURETICKS
35   StartCortexCycleCounter();
36 #endif
37 }
38
39 /*-----------------------------------------------------------------------------
40  *      Test cases list
41  *----------------------------------------------------------------------------*/
42 static TEST_CASE TC_LIST[] = {
43 #if defined(RTE_CV_COREINSTR) && RTE_CV_COREINSTR
44   #if defined(__CORTEX_M)
45     TCD ( TC_CoreInstr_NOP,                        TC_COREINSTR_NOP_EN                       ),
46     TCD ( TC_CoreInstr_WFI,                        TC_COREINSTR_WFI_EN                       ),
47     TCD ( TC_CoreInstr_WFE,                        TC_COREINSTR_WFE_EN                       ),
48     TCD ( TC_CoreInstr_SEV,                        TC_COREINSTR_SEV_EN                       ),
49     TCD ( TC_CoreInstr_BKPT,                       TC_COREINSTR_BKPT_EN                      ),
50     TCD ( TC_CoreInstr_ISB,                        TC_COREINSTR_ISB_EN                       ),
51     TCD ( TC_CoreInstr_DSB,                        TC_COREINSTR_DSB_EN                       ),
52     TCD ( TC_CoreInstr_DMB,                        TC_COREINSTR_DMB_EN                       ),
53     TCD ( TC_CoreInstr_REV,                        TC_COREINSTR_REV_EN                       ),
54     TCD ( TC_CoreInstr_REV16,                      TC_COREINSTR_REV16_EN                     ),
55     TCD ( TC_CoreInstr_REVSH,                      TC_COREINSTR_REVSH_EN                     ),
56     TCD ( TC_CoreInstr_ROR,                        TC_COREINSTR_ROR_EN                       ),
57     TCD ( TC_CoreInstr_RBIT,                       TC_COREINSTR_RBIT_EN                      ),
58     TCD ( TC_CoreInstr_CLZ,                        TC_COREINSTR_CLZ_EN                       ),
59     TCD ( TC_CoreInstr_SSAT,                       TC_COREINSTR_SSAT_EN                      ),
60     TCD ( TC_CoreInstr_USAT,                       TC_COREINSTR_USAT_EN                      ),
61     TCD ( TC_CoreInstr_RRX,                        TC_COREINSTR_RRX_EN                       ),
62     TCD ( TC_CoreInstr_LoadStoreExclusive,         TC_COREINSTR_LOADSTOREEXCLUSIVE_EN        ),
63     TCD ( TC_CoreInstr_LoadStoreUnpriv,            TC_COREINSTR_LOADSTOREUNPRIV_EN           ),
64     TCD ( TC_CoreInstr_LoadStoreAcquire,           TC_COREINSTR_LOADSTOREACQUIRE_EN          ),
65     TCD ( TC_CoreInstr_LoadStoreAcquireExclusive,  TC_COREINSTR_LOADSTOREACQUIREEXCLUSIVE_EN ),
66     TCD ( TC_CoreInstr_UnalignedUint16,            TC_COREINSTR_UNALIGNEDUINT16_EN           ),
67     TCD ( TC_CoreInstr_UnalignedUint32,            TC_COREINSTR_UNALIGNEDUINT32_EN           ),
68
69   #elif defined(__CORTEX_A)
70     TCD (TC_CoreInstr_NOP,                         TC_COREINSTR_NOP_EN                 ),
71     TCD (TC_CoreInstr_REV,                         TC_COREINSTR_REV_EN                 ),
72     TCD (TC_CoreInstr_REV16,                       TC_COREINSTR_REV16_EN               ),
73     TCD (TC_CoreInstr_REVSH,                       TC_COREINSTR_REVSH_EN               ),
74     TCD (TC_CoreInstr_ROR,                         TC_COREINSTR_ROR_EN                 ),
75     TCD (TC_CoreInstr_RBIT,                        TC_COREINSTR_RBIT_EN                ),
76     TCD (TC_CoreInstr_CLZ,                         TC_COREINSTR_CLZ_EN                 ),
77     TCD (TC_CoreInstr_SSAT,                        TC_COREINSTR_SSAT_EN                ),
78     TCD (TC_CoreInstr_USAT,                        TC_COREINSTR_USAT_EN                ),
79     TCD (TC_CoreInstr_LoadStoreExclusive,          TC_COREINSTR_EXCLUSIVES_EN          ),
80   #endif
81 #endif /* RTE_CV_COREINSTR */
82
83 #if defined (RTE_CV_CORESIMD) && RTE_CV_CORESIMD
84     TCD ( TC_CoreSimd_SatAddSub,                   TC_CORESIMD_SATADDSUB_EN                  ),
85     TCD ( TC_CoreSimd_ParSat16,                    TC_CORESIMD_PARSAT16_EN                   ),
86     TCD ( TC_CoreSimd_PackUnpack,                  TC_CORESIMD_PACKUNPACK_EN                 ),
87     TCD ( TC_CoreSimd_ParSel,                      TC_CORESIMD_PARSEL_EN                     ),
88     TCD ( TC_CoreSimd_ParAddSub8,                  TC_CORESIMD_PARADDSUB8_EN                 ),
89     TCD ( TC_CoreSimd_AbsDif8,                     TC_CORESIMD_ABSDIF8_EN                    ),
90     TCD ( TC_CoreSimd_ParAddSub16,                 TC_CORESIMD_PARADDSUB16_EN                ),
91     TCD ( TC_CoreSimd_ParMul16,                    TC_CORESIMD_PARMUL16_EN                   ),
92     TCD ( TC_CoreSimd_Pack16,                      TC_CORESIMD_PACK16_EN                     ),
93     TCD ( TC_CoreSimd_MulAcc32,                    TC_CORESIMD_MULACC32_EN                   ),
94 #endif /* RTE_CV_CORESIMD */
95
96 #if defined(RTE_CV_COREFUNC) && RTE_CV_COREFUNC
97   #if defined(__CORTEX_M)
98     TCD ( TC_CoreFunc_EnDisIRQ,                    TC_COREFUNC_ENDISIRQ_EN                   ),
99     TCD ( TC_CoreFunc_IRQPrio,                     TC_COREFUNC_IRQPRIO_EN                    ),
100     TCD ( TC_CoreFunc_EncDecIRQPrio,               TC_COREFUNC_ENCDECIRQPRIO_EN              ),
101     TCD ( TC_CoreFunc_IRQVect,                     TC_COREFUNC_IRQVECT_EN                    ),
102     TCD ( TC_CoreFunc_Control,                     TC_COREFUNC_CONTROL_EN                    ),
103     TCD ( TC_CoreFunc_IPSR,                        TC_COREFUNC_IPSR_EN                       ),
104     TCD ( TC_CoreFunc_APSR,                        TC_COREFUNC_APSR_EN                       ),
105     TCD ( TC_CoreFunc_PSP,                         TC_COREFUNC_PSP_EN                        ),
106     TCD ( TC_CoreFunc_MSP,                         TC_COREFUNC_MSP_EN                        ),
107     TCD ( TC_CoreFunc_PSPLIM,                      TC_COREFUNC_PSPLIM_EN                     ),
108     TCD ( TC_CoreFunc_PSPLIM_NS,                   TC_COREFUNC_PSPLIM_NS_EN                  ),
109     TCD ( TC_CoreFunc_MSPLIM,                      TC_COREFUNC_MSPLIM_EN                     ),
110     TCD ( TC_CoreFunc_MSPLIM_NS,                   TC_COREFUNC_MSPLIM_NS_EN                  ),
111     TCD ( TC_CoreFunc_PRIMASK,                     TC_COREFUNC_PRIMASK_EN                    ),
112     TCD ( TC_CoreFunc_FAULTMASK,                   TC_COREFUNC_FAULTMASK_EN                  ),
113     TCD ( TC_CoreFunc_BASEPRI,                     TC_COREFUNC_BASEPRI_EN                    ),
114     TCD ( TC_CoreFunc_FPUType,                     TC_COREFUNC_FPUTYPE_EN                    ),
115     TCD ( TC_CoreFunc_FPSCR,                       TC_COREFUNC_FPSCR_EN                      ),
116
117   #elif defined(__CORTEX_A)
118     TCD ( TC_CoreAFunc_IRQ,                        TC_COREAFUNC_IRQ                          ),
119     TCD ( TC_CoreAFunc_FPSCR,                      TC_COREAFUNC_FPSCR                        ),
120     TCD ( TC_CoreAFunc_CPSR,                       TC_COREAFUNC_CPSR                         ),
121     TCD ( TC_CoreAFunc_Mode,                       TC_COREAFUNC_MODE                         ),
122     TCD ( TC_CoreAFunc_SP,                         TC_COREAFUNC_SP                           ),
123     TCD ( TC_CoreAFunc_SP_usr,                     TC_COREAFUNC_SP_USR                       ),
124     TCD ( TC_CoreAFunc_FPEXC,                      TC_COREAFUNC_FPEXC                        ),
125     TCD ( TC_CoreAFunc_ACTLR,                      TC_COREAFUNC_ACTLR                        ),
126     TCD ( TC_CoreAFunc_CPACR,                      TC_COREAFUNC_CPACR                        ),
127     TCD ( TC_CoreAFunc_DFSR,                       TC_COREAFUNC_DFSR                         ),
128     TCD ( TC_CoreAFunc_IFSR,                       TC_COREAFUNC_IFSR                         ),
129     TCD ( TC_CoreAFunc_ISR,                        TC_COREAFUNC_ISR                          ),
130     TCD ( TC_CoreAFunc_CBAR,                       TC_COREAFUNC_CBAR                         ),
131     TCD ( TC_CoreAFunc_TTBR0,                      TC_COREAFUNC_TTBR0                        ),
132     TCD ( TC_CoreAFunc_DACR,                       TC_COREAFUNC_DACR                         ),
133     TCD ( TC_CoreAFunc_SCTLR,                      TC_COREAFUNC_SCTLR                        ),
134     TCD ( TC_CoreAFunc_ACTRL,                      TC_COREAFUNC_ACTRL                        ),
135     TCD ( TC_CoreAFunc_MPIDR,                      TC_COREAFUNC_MPIDR                        ),
136     TCD ( TC_CoreAFunc_VBAR,                       TC_COREAFUNC_VBAR                         ),
137     TCD ( TC_CoreAFunc_MVBAR,                      TC_COREAFUNC_MVBAR                        ),
138     TCD ( TC_CoreAFunc_FPU_Enable,                 TC_COREAFUNC_FPU_ENABLE                   ),
139   #endif
140 #endif /* RTE_CV_COREFUNC */
141
142 #if defined(RTE_CV_MPUFUNC) && RTE_CV_MPUFUNC
143     TCD ( TC_MPU_SetClear,                         TC_MPU_SETCLEAR_EN                        ),
144     TCD ( TC_MPU_Load,                             TC_MPU_LOAD_EN                            ),
145 #endif /* RTE_CV_MPUFUNC */
146
147 #if defined(RTE_CV_GENTIMER) && RTE_CV_GENTIMER
148     TCD ( TC_GenTimer_CNTFRQ,                      TC_GENTIMER_CNTFRQ                        ),
149     TCD ( TC_GenTimer_CNTP_TVAL,                   TC_GENTIMER_CNTP_TVAL                     ),
150     TCD ( TC_GenTimer_CNTP_CTL,                    TC_GENTIMER_CNTP_CTL                      ),
151     TCD ( TC_GenTimer_CNTPCT,                      TC_GENTIMER_CNTPCT                        ),
152     TCD ( TC_GenTimer_CNTP_CVAL,                   TC_GENTIMER_CNTP_CVAL                     ),
153 #endif /* RTE_CV_GENTIMER */
154
155 #if defined(RTE_CV_L1CACHE) && RTE_CV_L1CACHE
156     TCD ( TC_L1Cache_EnDisable,                    TC_L1CACHE_ENDISABLE                      ),
157     TCD ( TC_L1Cache_EnDisableBTAC,                TC_L1CACHE_ENDISABLEBTAC                  ),
158     TCD ( TC_L1Cache_log2_up,                      TC_L1CACHE_LOG2_UP                        ),
159     TCD ( TC_L1Cache_InvalidateDCacheAll,          TC_L1CACHE_INVALIDATEDCACHEALL            ),
160     TCD ( TC_L1Cache_CleanDCacheAll,               TC_L1CACHE_CLEANDCACHEALL                 ),
161     TCD ( TC_L1Cache_CleanInvalidateDCacheAll,     TC_L1CACHE_CLEANINVALIDATEDCACHEALL       ),
162 #endif /* RTE_CV_L1CACHE */
163 };
164
165 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
166 #pragma clang diagnostic push
167 #pragma clang diagnostic ignored "-Wdate-time"
168 #endif
169 /*-----------------------------------------------------------------------------
170  *      Test suite description
171  *----------------------------------------------------------------------------*/
172 TEST_SUITE ts = {
173   __FILE__, __DATE__, __TIME__,
174   "CMSIS-CORE Test Suite",
175   TS_Init,
176   1,
177   TC_LIST,
178   ARRAY_SIZE (TC_LIST),
179 };
180 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
181 #pragma clang diagnostic pop
182 #endif