Initial commit

This commit is contained in:
OneOfEleven
2023-09-09 08:03:56 +01:00
parent 92305117f1
commit 54441e27d9
3388 changed files with 582553 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
/*-----------------------------------------------------------------------------
* Name: CV_Framework.h
* Purpose: Framework header
*----------------------------------------------------------------------------
* Copyright (c) 2017 ARM Limited. All rights reserved.
*----------------------------------------------------------------------------*/
#ifndef __FRAMEWORK_H__
#define __FRAMEWORK_H__
#include "CV_Typedefs.h"
#include "CV_Report.h"
/*-----------------------------------------------------------------------------
* Test framework global definitions
*----------------------------------------------------------------------------*/
/* Test case definition macro */
#define TCD(x, y) {x, #x, y}
/* Test case description structure */
typedef struct __TestCase {
void (*TestFunc)(void); /* Test function */
const char *TFName; /* Test function name string */
BOOL en; /* Test function enabled */
} TEST_CASE;
/* Test suite description structure */
typedef struct __TestSuite {
const char *FileName; /* Test module file name */
const char *Date; /* Compilation date */
const char *Time; /* Compilation time */
const char *ReportTitle; /* Title or name of module under test */
void (*Init)(void); /* Init function callback */
uint32_t TCBaseNum; /* Base number for test case numbering */
TEST_CASE *TC; /* Array of test cases */
uint32_t NumOfTC; /* Number of test cases (sz of TC array)*/
} TEST_SUITE;
/* Defined in user test module */
extern TEST_SUITE ts;
#endif /* __FRAMEWORK_H__ */

View File

@@ -0,0 +1,89 @@
/*-----------------------------------------------------------------------------
* Name: CV_Report.h
* Purpose: Report statistics and layout header
*----------------------------------------------------------------------------
* Copyright (c) 2017 ARM Limited. All rights reserved.
*----------------------------------------------------------------------------*/
#ifndef __REPORT_H__
#define __REPORT_H__
#include "CV_Config.h"
#include "CV_Typedefs.h"
/*-----------------------------------------------------------------------------
* Test report global definitions
*----------------------------------------------------------------------------*/
#define REP_TC_FAIL 0
#define REP_TC_WARN 1
#define REP_TC_PASS 2
#define REP_TC_NOEX 3
/* Test case result definition */
typedef enum {
PASSED = 0,
WARNING,
FAILED,
NOT_EXECUTED
} TC_RES;
/* Assertion result info */
typedef struct {
const char *module; /* Module name */
uint32_t line; /* Assertion line */
} AS_INFO;
/* Test case callback interface definition */
typedef struct {
BOOL (* Result) (TC_RES res);
BOOL (* Dbgi) (TC_RES res, const char *fn, uint32_t ln, char *desc);
} TC_ITF;
/* Assert interface to the report */
extern TC_ITF tcitf;
/* Assertion result buffer */
typedef struct {
AS_INFO passed[BUFFER_ASSERTIONS];
AS_INFO failed[BUFFER_ASSERTIONS];
AS_INFO warnings[BUFFER_ASSERTIONS];
} AS_T_INFO;
/* Assertion statistics */
typedef struct {
uint32_t passed; /* Total assertions passed */
uint32_t failed; /* Total assertions failed */
uint32_t warnings; /* Total assertions warnings */
AS_T_INFO info; /* Detailed assertion info */
} AS_STAT;
/* Test global statistics */
typedef struct {
uint32_t tests; /* Total test cases count */
uint32_t executed; /* Total test cases executed */
uint32_t passed; /* Total test cases passed */
uint32_t failed; /* Total test cases failed */
uint32_t warnings; /* Total test cases warnings */
AS_STAT assertions; /* Total assertions statistics */
} TEST_REPORT;
/* Test report interface */
typedef struct {
BOOL (* Init) (void);
BOOL (* Open) (const char *title, const char *date, const char *time, const char *fn);
BOOL (* Close) (void);
BOOL (* Open_TC) (uint32_t num, const char *fn);
BOOL (* Close_TC) (void);
} REPORT_ITF;
/* Test report statistics */
extern TEST_REPORT test_report;
/* Test report interface */
extern REPORT_ITF ritf;
/* Assertions and test results */
extern TC_RES __set_result (const char *fn, uint32_t ln, TC_RES res, char* desc);
extern TC_RES __assert_true (const char *fn, uint32_t ln, uint32_t cond);
#endif /* __REPORT_H__ */

View File

@@ -0,0 +1,58 @@
/*-----------------------------------------------------------------------------
* Name: CV_Typedefs.h
* Purpose: Test framework filetypes and structures description
*----------------------------------------------------------------------------
* Copyright (c) 2017 - 2018 Arm Limited. All rights reserved.
*----------------------------------------------------------------------------*/
#ifndef __TYPEDEFS_H__
#define __TYPEDEFS_H__
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
typedef unsigned int BOOL;
#ifndef __TRUE
#define __TRUE 1
#endif
#ifndef __FALSE
#define __FALSE 0
#endif
#ifndef ENABLED
#define ENABLED 1
#endif
#ifndef DISABLED
#define DISABLED 0
#endif
#ifndef NULL
#ifdef __cplusplus // EC++
#define NULL 0
#else
#define NULL ((void *) 0)
#endif
#endif
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0]))
#if defined( __GNUC__ ) || defined ( __clang__ )
static const int PATH_DELIMITER = '/';
#else
static const int PATH_DELIMITER = '\\';
#endif
//lint -emacro(9016,__FILENAME__) allow pointer arithmetic for truncating filename
//lint -emacro(613,__FILENAME__) null pointer is checked
#define __FILENAME__ ((strrchr(__FILE__, PATH_DELIMITER) != NULL) ? (strrchr(__FILE__, PATH_DELIMITER) + 1) : __FILE__)
/* Assertions and test results */
#define SET_RESULT(res, desc) (void)__set_result(__FILENAME__, __LINE__, (res), (desc));
//lint -emacro(9031,ASSERT_TRUE) allow boolean condition as parameter
//lint -emacro(613,ASSERT_TRUE) null pointer is checked
#define ASSERT_TRUE(cond) (void)__assert_true (__FILENAME__, __LINE__, (cond) ? 1U : 0U)
#endif /* __TYPEDEFS_H__ */

View File

@@ -0,0 +1,135 @@
/*-----------------------------------------------------------------------------
* Name: cmsis_cv.h
* Purpose: cmsis_cv header
*----------------------------------------------------------------------------
* Copyright (c) 2017 - 2021 Arm Limited. All rights reserved.
*----------------------------------------------------------------------------*/
#ifndef __CMSIS_CV_H
#define __CMSIS_CV_H
#include <stdint.h>
#include "CV_Config.h"
/* Expansion macro used to create CMSIS Driver references */
#define EXPAND_SYMBOL(name, port) name##port
#define CREATE_SYMBOL(name, port) EXPAND_SYMBOL(name, port)
// Simulator counter
#ifndef HW_PRESENT
extern uint32_t SIM_CYCCNT;
#endif
// SVC interrupt callback
extern void (*TST_IRQHandler)(void);
// Test main function
extern void cmsis_cv (void);
extern void cmsis_cv_abort (const char *fn, uint32_t ln, char *desc);
// Test cases
extern void TC_CoreInstr_NOP (void);
extern void TC_CoreInstr_SEV (void);
extern void TC_CoreInstr_BKPT (void);
extern void TC_CoreInstr_ISB (void);
extern void TC_CoreInstr_DSB (void);
extern void TC_CoreInstr_DMB (void);
extern void TC_CoreInstr_WFI (void);
extern void TC_CoreInstr_WFE (void);
extern void TC_CoreInstr_REV (void);
extern void TC_CoreInstr_REV16 (void);
extern void TC_CoreInstr_REVSH (void);
extern void TC_CoreInstr_ROR (void);
extern void TC_CoreInstr_RBIT (void);
extern void TC_CoreInstr_CLZ (void);
extern void TC_CoreInstr_SSAT (void);
extern void TC_CoreInstr_USAT (void);
extern void TC_CoreInstr_RRX (void);
extern void TC_CoreInstr_LoadStoreExclusive (void);
extern void TC_CoreInstr_LoadStoreUnpriv (void);
extern void TC_CoreInstr_LoadStoreAcquire (void);
extern void TC_CoreInstr_LoadStoreAcquireExclusive (void);
extern void TC_CoreInstr_UnalignedUint16 (void);
extern void TC_CoreInstr_UnalignedUint32 (void);
extern void TC_CoreSimd_SatAddSub (void);
extern void TC_CoreSimd_ParSat16 (void);
extern void TC_CoreSimd_PackUnpack (void);
extern void TC_CoreSimd_ParSel (void);
extern void TC_CoreSimd_ParAddSub8 (void);
extern void TC_CoreSimd_AbsDif8 (void);
extern void TC_CoreSimd_ParAddSub16 (void);
extern void TC_CoreSimd_ParMul16 (void);
extern void TC_CoreSimd_Pack16 (void);
extern void TC_CoreSimd_MulAcc32 (void);
#if defined(__CORTEX_M)
extern void TC_CoreFunc_EnDisIRQ (void);
extern void TC_CoreFunc_IRQPrio (void);
extern void TC_CoreFunc_EncDecIRQPrio (void);
extern void TC_CoreFunc_IRQVect (void);
extern void TC_CoreFunc_Control (void);
extern void TC_CoreFunc_IPSR (void);
extern void TC_CoreFunc_APSR (void);
extern void TC_CoreFunc_PSP (void);
extern void TC_CoreFunc_MSP (void);
extern void TC_CoreFunc_PSPLIM (void);
extern void TC_CoreFunc_PSPLIM_NS (void);
extern void TC_CoreFunc_MSPLIM (void);
extern void TC_CoreFunc_MSPLIM_NS (void);
extern void TC_CoreFunc_PRIMASK (void);
extern void TC_CoreFunc_FAULTMASK (void);
extern void TC_CoreFunc_BASEPRI (void);
extern void TC_CoreFunc_FPUType (void);
extern void TC_CoreFunc_FPSCR (void);
#elif defined(__CORTEX_A)
extern void TC_CoreAFunc_IRQ (void);
extern void TC_CoreAFunc_FaultIRQ (void);
extern void TC_CoreAFunc_FPSCR (void);
extern void TC_CoreAFunc_CPSR (void);
extern void TC_CoreAFunc_Mode (void);
extern void TC_CoreAFunc_SP (void);
extern void TC_CoreAFunc_SP_usr (void);
extern void TC_CoreAFunc_FPEXC (void);
extern void TC_CoreAFunc_ACTLR (void);
extern void TC_CoreAFunc_CPACR (void);
extern void TC_CoreAFunc_DFSR (void);
extern void TC_CoreAFunc_IFSR (void);
extern void TC_CoreAFunc_ISR (void);
extern void TC_CoreAFunc_CBAR (void);
extern void TC_CoreAFunc_TTBR0 (void);
extern void TC_CoreAFunc_DACR (void);
extern void TC_CoreAFunc_SCTLR (void);
extern void TC_CoreAFunc_ACTRL (void);
extern void TC_CoreAFunc_MPIDR (void);
extern void TC_CoreAFunc_VBAR (void);
extern void TC_CoreAFunc_MVBAR (void);
extern void TC_CoreAFunc_FPU_Enable (void);
#endif
#if defined(__CORTEX_M)
extern void TC_MPU_SetClear (void);
extern void TC_MPU_Load (void);
#endif
#if defined(__CORTEX_A)
extern void TC_GenTimer_CNTFRQ (void);
extern void TC_GenTimer_CNTP_TVAL (void);
extern void TC_GenTimer_CNTP_CTL (void);
extern void TC_GenTimer_CNTPCT(void);
extern void TC_GenTimer_CNTP_CVAL(void);
#endif
#if defined(__CORTEX_M)
extern void TC_CML1Cache_EnDisableICache(void);
extern void TC_CML1Cache_EnDisableDCache(void);
extern void TC_CML1Cache_CleanDCacheByAddrWhileDisabled(void);
#elif defined(__CORTEX_A)
extern void TC_CAL1Cache_EnDisable(void);
extern void TC_CAL1Cache_EnDisableBTAC(void);
extern void TC_CAL1Cache_log2_up(void);
extern void TC_CAL1Cache_InvalidateDCacheAll(void);
extern void TC_CAL1Cache_CleanDCacheAll(void);
extern void TC_CAL1Cache_CleanInvalidateDCacheAll(void);
#endif
#endif /* __CMSIS_CV_H */