1 /*-----------------------------------------------------------------------------
2 * Name: cmsis_cv.c
3 * Purpose: Driver validation test cases entry point
4 *----------------------------------------------------------------------------
5 * Copyright (c) 2017 - 2021 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
Interrupt0_Handler(void)24 void Interrupt0_Handler(void) {
25 if (TST_IRQHandler != NULL) TST_IRQHandler();
26 }
27
28 /*-----------------------------------------------------------------------------
29 * Init test suite
30 *----------------------------------------------------------------------------*/
TS_Init(void)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_FaultIRQ, TC_COREAFUNC_FAULTIRQ ),
120 TCD ( TC_CoreAFunc_FPSCR, TC_COREAFUNC_FPSCR ),
121 TCD ( TC_CoreAFunc_CPSR, TC_COREAFUNC_CPSR ),
122 TCD ( TC_CoreAFunc_Mode, TC_COREAFUNC_MODE ),
123 TCD ( TC_CoreAFunc_FPEXC, TC_COREAFUNC_FPEXC ),
124 TCD ( TC_CoreAFunc_ACTLR, TC_COREAFUNC_ACTLR ),
125 TCD ( TC_CoreAFunc_CPACR, TC_COREAFUNC_CPACR ),
126 TCD ( TC_CoreAFunc_DFSR, TC_COREAFUNC_DFSR ),
127 TCD ( TC_CoreAFunc_IFSR, TC_COREAFUNC_IFSR ),
128 TCD ( TC_CoreAFunc_ISR, TC_COREAFUNC_ISR ),
129 TCD ( TC_CoreAFunc_CBAR, TC_COREAFUNC_CBAR ),
130 TCD ( TC_CoreAFunc_TTBR0, TC_COREAFUNC_TTBR0 ),
131 TCD ( TC_CoreAFunc_DACR, TC_COREAFUNC_DACR ),
132 TCD ( TC_CoreAFunc_SCTLR, TC_COREAFUNC_SCTLR ),
133 TCD ( TC_CoreAFunc_MPIDR, TC_COREAFUNC_MPIDR ),
134 TCD ( TC_CoreAFunc_VBAR, TC_COREAFUNC_VBAR ),
135 TCD ( TC_CoreAFunc_MVBAR, TC_COREAFUNC_MVBAR ),
136 TCD ( TC_CoreAFunc_FPU_Enable, TC_COREAFUNC_FPU_ENABLE ),
137 #endif
138 #endif /* RTE_CV_COREFUNC */
139
140 #if defined(RTE_CV_MPUFUNC) && RTE_CV_MPUFUNC
141 TCD ( TC_MPU_SetClear, TC_MPU_SETCLEAR_EN ),
142 TCD ( TC_MPU_Load, TC_MPU_LOAD_EN ),
143 #endif /* RTE_CV_MPUFUNC */
144
145 #if defined(RTE_CV_GENTIMER) && RTE_CV_GENTIMER
146 TCD ( TC_GenTimer_CNTFRQ, TC_GENTIMER_CNTFRQ ),
147 TCD ( TC_GenTimer_CNTP_TVAL, TC_GENTIMER_CNTP_TVAL ),
148 TCD ( TC_GenTimer_CNTP_CTL, TC_GENTIMER_CNTP_CTL ),
149 TCD ( TC_GenTimer_CNTPCT, TC_GENTIMER_CNTPCT ),
150 TCD ( TC_GenTimer_CNTP_CVAL, TC_GENTIMER_CNTP_CVAL ),
151 #endif /* RTE_CV_GENTIMER */
152
153 #if defined(RTE_CV_L1CACHE) && RTE_CV_L1CACHE
154 #if defined(__CORTEX_M)
155 TCD ( TC_CML1Cache_EnDisableICache, TC_CML1CACHE_ENDISABLE_ICACHE ),
156 TCD ( TC_CML1Cache_EnDisableDCache, TC_CML1CACHE_ENDISABLE_DCACHE ),
157 TCD ( TC_CML1Cache_CleanDCacheByAddrWhileDisabled, TC_CML1CACHE_CLEANDCACHEBYADDRWHILEDISABLED),
158 #elif defined(__CORTEX_A)
159 TCD ( TC_CAL1Cache_EnDisable, TC_CAL1CACHE_ENDISABLE ),
160 TCD ( TC_CAL1Cache_EnDisableBTAC, TC_CAL1CACHE_ENDISABLEBTAC ),
161 TCD ( TC_CAL1Cache_log2_up, TC_CAL1CACHE_LOG2_UP ),
162 TCD ( TC_CAL1Cache_InvalidateDCacheAll, TC_CAL1CACHE_INVALIDATEDCACHEALL ),
163 TCD ( TC_CAL1Cache_CleanDCacheAll, TC_CAL1CACHE_CLEANDCACHEALL ),
164 TCD ( TC_CAL1Cache_CleanInvalidateDCacheAll, TC_CAL1CACHE_CLEANINVALIDATEDCACHEALL ),
165 #endif
166 #endif /* RTE_CV_L1CACHE */
167 };
168
169 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
170 #pragma clang diagnostic push
171 #pragma clang diagnostic ignored "-Wdate-time"
172 #endif
173 /*-----------------------------------------------------------------------------
174 * Test suite description
175 *----------------------------------------------------------------------------*/
176 TEST_SUITE ts = {
177 __FILE__, __DATE__, __TIME__,
178 "CMSIS-CORE Test Suite",
179 TS_Init,
180 1,
181 TC_LIST,
182 ARRAY_SIZE (TC_LIST),
183 };
184 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
185 #pragma clang diagnostic pop
186 #endif
187