test-macros-generic.h.s

来自「OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI」· S 代码 · 共 1,264 行 · 第 1/3 页

S
1,264
字号
;*******************************************************************************
;*
;* The confidential and proprietary information contained in this file may
;* only be used by a person authorised under and to the extent permitted
;* by a subsisting licensing agreement from ARM Limited.
;*
;*                 (C) COPYRIGHT 1994-1999 ARM Limited.
;*                       ALL RIGHTS RESERVED
;*
;* This entire notice must be reproduced on all copies of this file
;* and copies of this file may only be made by a person if such person is
;* permitted to do so under the terms of a subsisting license agreement
;* from ARM Limited.
;*
;*		Validation Suite Macros and Definitions
;*		=======================================
;*
;*	Origin: ARM9 Validation Suite
;*	Author: Jon Rijk 02/10/96
;*     $Author: jrijk $
;*   $Revision: 1.15 $
;*	 $Date: Thu Jul 19 17:20:32 2001 $
;*
;*******************************************************************************
; Purpose: Generic macros for validation suite
;
; Description:
;               a) Default macros used in configuration file
;		   DEFAULT_SETS
;		   DEFAULT_SETL
;		   DEFAULT_SETA
;		b) Test setup
;		   Setup verbosity
;		   Include configuration file
;		   Import symbols
;		c) Programming macros
;		   LOCAL
;		   LOCAL_END
;		   LOCAL_REFER
;		   MSR_M
;		   SYS_ENTER_USER
;		   Init_Regs
;		d) Validation macros
;		   PRAGMA
;		   TEST_AREA
;		   TEST_START
;		   TEST_PASS
;		   TEST_FAIL
;		   CODE_START
;		   SET_VERBOSITY
;		   RESET_VERBOSITY
;		   CHAROUT
;		   EXIT
;		   END_ROUTINE
;		e) Target device macros
;		   ENDIAN
;		   FORCE_PREDICT
;		   BRANCH_PREDICT
;		   SET_EXCEPTION
;		   IMB_FLUSH
;
; Notes:
;
; ***********************************************************************
;

;============================================
;a) Default macros used in configuration file
;============================================

;------------------------------------------------------------------------------
; Macro:        <variable> DEFAULT_VAR <type>, <value>, [override]
; Function:     Define a variable if undefined, or if override specified
;		and the variable was previously defined by a DEFAULT_VAR
; Internally:

                MACRO
$variable       DEFAULT_VAR  $type, $value, $override
		[		:LNOT::DEF: $variable
		GBLL		DEFINED_$variable
		GBL$type	$variable
		[	"$type" = "S"
$variable	SET$type	"$value"
		|
$variable	SET$type	$value
		]
		|
		[	"$override" /= "" :LAND::DEF: DEFINED_$variable
		[	"$type" = "S"
$variable	SET$type	"$value"
		|
$variable	SET$type	$value
		]
		]
		]
		MEND

;------------------------------------------------------------------------------
; Macro:        <variable> DEFAULT_SETS <value>
; Function:     Wrapper for DEFAULT_VAR

                MACRO
$variable       DEFAULT_SETS $value
$variable       DEFAULT_VAR  S, $value
		MEND

;------------------------------------------------------------------------------
; Macro:        <variable> DEFAULT_SETL <value>
; Function:     Wrapper for DEFAULT_VAR

                MACRO
$variable       DEFAULT_SETL $value
$variable       DEFAULT_VAR  L, $value
                MEND

;------------------------------------------------------------------------------
; Macro:        <variable> DEFAULT_SETA <value>
; Function:     Wrapper for DEFAULT_VAR

                MACRO
$variable       DEFAULT_SETA $value
$variable       DEFAULT_VAR  A, $value
                MEND

;------------------------------------------------------------------------------
; Macro:        <variable> CONFIG_SETS <value>
; Function:     Wrapper for DEFAULT_VAR

                MACRO
$variable       CONFIG_SETS $value
$variable       DEFAULT_VAR S, $value, OVERRIDE
		MEND

;------------------------------------------------------------------------------
; Macro:        <variable> CONFIG_SETL <value>
; Function:     Wrapper for DEFAULT_VAR

                MACRO
$variable       CONFIG_SETL $value
$variable       DEFAULT_VAR L, $value, OVERRIDE
                MEND

;------------------------------------------------------------------------------
; Macro:        <variable> CONFIG_SETA <value>
; Function:     Wrapper for DEFAULT_VAR

                MACRO
$variable       CONFIG_SETA $value
$variable       DEFAULT_VAR A, $value, OVERRIDE
                MEND

;------------------------------------------------------------------------------
		
;=============
;b) Test setup
;=============

		;--------------------------------------------
        	; Define verbosity settings

VERBOSE_DEFAULT	DEFAULT_SETA 3			; default threshold level
VERBOSE		DEFAULT_SETA VERBOSE_DEFAULT	; normally on assembler command line
VERBOSE_PRINTF	DEFAULT_SETA VERBOSE_DEFAULT	; PRINTF verbosity
VERBOSITY	DEFAULT_SETA VERBOSE		; current verbosity

;********************************************************************************
;***		Configuration
;********************************************************************************

		INCLUDE	Configuration.h.s

;********************************************************************************
		
;=====================
;c) Programming macros
;=====================

;------------------------------------------------------------------------------
; Macro:	LOCAL
;		LOCAL_END
;		LOCAL_REFER <symbol> [,<offset>]
;		<label>$l
; Function:	Cool local label generation for functions and macros.  For each
;		new routine or macro desiring local labelling use, for example:
;
;			LOCAL		; enters a deeper nesting level
;		Rout	[code]		; globally visible label
;		loop$l	[code]		; local label declaration
;			BNE	loop$l	; local label usage
;			[code]
;			LOCAL_END	; restore to previous nesting level
;
;		Local labelling can be nested down to 16 levels (including no
;		nesting).  Each LOCAL --MUST-- have a corresponding LOCAL_END,
;		so care must be taken when using conditional assembly and in
;		macros when using MEXIT.
;
;		The scope of labels is only within the current and global
;		(ie normal labelling) contexts.  To refer to a higher nesting
;		level use (with a relative offset), for example:
;
;			LOCAL_REFER foo 	; foo=$l using current nesting
;		val$l	DCD	0
;			LOCAL
;			LOCAL_REFER bar, 1	; bar=$l of previous nesting
;			STR	r0,val$foo	; refer to val$l
;			LDR	r0,val$bar	; refer to val$l
;			LOCAL_END
;			LDR	r0,val$l
; Internally:	No registers, simply increments a counter for each use

		GBLA	LocalNesting
		GBLA	LocalCount
		GBLA	LocalTemp
		GBLS	l
LocalNesting	SETA	0
LocalCount	SETA	0
LocalTemp	SETA	0
l		SETS	"_$LocalCount"

		WHILE	LocalTemp <= 15
		GBLA	LocalArray$LocalTemp
LocalTemp	SETA	LocalTemp + 1
		WEND

		MACRO
$label		LOCAL
		;OPT	32+8192				; no vars and conditionals
$label
		[	LocalNesting > 15
		!	1, "\n\n\tLOCAL label nesting too deep (max 16)."
		MEXIT
		]
LocalNesting	SETA	LocalNesting + 1
LocalCount	SETA	LocalCount + 1
LocalArray$LocalNesting SETA LocalCount
l		SETS	"_$LocalCount"
		MEND

		MACRO
$label		LOCAL_END
		;OPT	32+8192				; no vars and conditionals
$label
		[	LocalNesting <= 0
		!	1, "\n\n\tLOCAL_END has no matching LOCAL."
		MEXIT
		]
LocalNesting	SETA	LocalNesting - 1
LocalTemp	SETA	LocalArray$LocalNesting
l		SETS	"_$LocalTemp"
		MEND

		MACRO
$label		LOCAL_REFER $sym, $offset
$label
		GBLS	$sym
		[	"$offset" = ""
LocalTemp	SETA	LocalNesting
		|
		[	(LocalNesting - $offset) <= 0
		!	1, "\n\n\tLOCAL_REFER to bad nesting level."
		MEXIT
		]
LocalTemp	SETA	LocalNesting - $offset
		]
LocalTemp	SETA	LocalArray$LocalTemp
$sym		SETS	"_$LocalTemp"
		MEND

;====================
;d) Validation macros
;====================

;------------------------------------------------------------------------------
; Macro:	[label] PRAGMA	<type> [, <argx>]
;
; Function:	Provided so that external scripts/programs can obtain information
;		about the source code and related files.  Currently supports
;		functionality for auto makefile generation.
;
; Internally:	No code.

		MACRO
$label		PRAGMA	$type, $arg1, $arg2, $arg3, $arg4
$label
		[	"$type" = ""
		!	1, "\n\n\tSyntax: PRAGMA <type> [, <argx>]\nsee Test-Macros"
		MEXIT
		]
	; Syntax: PRAGMA IMPORT, <file>
	; Note file is without its suffix, so .s/.o etc can be matched
		[	"$type" = "IMPORT"
		[	"$arg2" /= ""
		$arg2
		]
		]
		MEND

;------------------------------------------------------------------------------
; Macro:	TEST_AREA
;
; Function:	Define a common AREA that all of the Validation Suite ought to
;		use to enable the linkage order to be specified on the command
;		line.  Also sets the assembler options suitable for code.
;
;		The area name includes the local label so that TEST_AREA can
;		be used more than once per source file.
;
;		NB the new area is aligned to a 32 byte boundary.  Tests can
;		then align code/data to any boundary up to this maximum, and
;		will be undefined if greater than it.
;
; Internally:	No code.

		MACRO
		TEST_AREA
		LOCAL
		LCLS	BarStringBar
BarStringBar	SETS	"  Validation$l"
BarStringBar	SETS	"|":CC:BarStringBar:CC:"|"
		AREA	$BarStringBar, CODE, ALIGN=AREA_PAD_OUT
		LOCAL_END
		MEND

;------------------------------------------------------------------------------
; Macro:	[label] CODE_START
;
; Function:	Provides initialisation for subroutine code and ought to be defined
;		before any test code.  It defines and exports the label passed to
;		it and also imports symbols in Test-Header.  TEST_START uses it
;		for generic declarations
;
; Internally:	Must not define any code

		MACRO
$label		CODE_START
		TEST_AREA
		
		[	"$label" /= ""
$label
		EXPORT	$label
		]
		
		; import symbols for TEST_PASS and TEST_FAIL macros
		EXTERN	Test_Header_Test_Pass
		EXTERN	Test_Header_Test_Fail
		EXTERN	Test_Header_Test_End
		EXTERN	Test_Header_Test_Status

		GBLL	Test_Started

		; setup variables for debug tests
		[	:LNOT::DEF:SETUP_DEBUG
		GBLL	SETUP_DEBUG
		
	; label used as reference point
Wpt_Ref
	; assumed absolute value of Wpt_Ref
VWpt_Ref	DEFAULT_SETA	0x1000

		[	HIGH_VECTORS
VWpt_Ref	SETA	VWpt_Ref + 0xFFFF0000	; adjust for HIVECS
		]
		
		; some variables for use in debug tests
		GBLA	Wpt0
		GBLA	Wpt1
		GBLA	Wpt2
		GBLA	Wpt3
		GBLA	Wpt4
		GBLA	Wpt5
		GBLA	Wpt6
		GBLA	Wpt7
		GBLA	Wpt8
		GBLA	Wpt9
		GBLA	WptA
		GBLA	WptB
		GBLA	WptC
		GBLA	WptD
		GBLA	WptE
		GBLA	WptF
		]
		
		[	:DEF: CHECK_VFP_BOUNCES
		EXPORT	VFP_BOUNCE_LIST
		EXPORT	VFP_BOUNCELIST_END
		]
		MEND

;------------------------------------------------------------------------------
; Macro:	[label] TEST_START
;
; Function:	Provides initialisation for the test environment, must be
;		present before any test code.  It defines the symbol __testmain, which
;		Test-Header calls.  Calls CODE_START for generic beginning of code declarations
;		
; Internally:	Must not define any code

		MACRO
$label		TEST_START
$label		CODE_START
		EXPORT	__testmain
__testmain
		MEND

;------------------------------------------------------------------------------
; Macro:	[label] TEST_PASS
;
; Function:	Replaces END_ROUTINE, simply returns back to the test harness
;		indicating the test has passed.
;
; Internally:	Branch to test harness "test passed" code

		MACRO
$label		TEST_PASS
$label
		[	:DEF: SWI_TEST_EXIT
		SWI	SWI_TestPass
		|
		[	{CODESIZE} = 16
		LOCAL
		ADR	r0,return$l

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?