⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_functions.h

📁 Freescale MCF5445evb 参考测试代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef __TEST_FUNCTIONS_H#define __TEST_FUNCTIONS_H/************************//*  DEFINITIONS & TYPES *//************************/voidburst_writes(int, int);/* * Standard data types for read/write */typedef unsigned long   tWORD;typedef unsigned short  tHALF;typedef unsigned char   tBYTE;typedef unsigned long   tADDRESS;extern  tWORD fail_cnt;//#include <mem_map.h>#define SUCCESS_1(cmd, arg1) \  do { \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define SUCCESS_2(cmd, arg1, arg2) \  do { \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define SUCCESS_3(cmd, arg1, arg2, arg3) \  do { \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *) (CPRINT_ARG2)) = (arg3); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define SUCCESS_4(cmd, arg1, arg2, arg3, arg4) \  do { \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *) (CPRINT_ARG2)) = (arg3); \    (*(volatile tWORD *) (CPRINT_ARG3)) = (arg4); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define SUCCESS_5(cmd, arg1, arg2, arg3, arg4, arg5) \  do { \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *) (CPRINT_ARG2)) = (arg3); \    (*(volatile tWORD *) (CPRINT_ARG3)) = (arg4); \    (*(volatile tWORD *) (CPRINT_ARG4)) = (arg5); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define FAIL_1(cmd, arg1) \  do { \    fail_cnt = fail_cnt + 1; \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define FAIL_2(cmd, arg1, arg2) \  do { \    fail_cnt = fail_cnt + 1; \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define FAIL_3(cmd, arg1, arg2, arg3) \  do { \    fail_cnt = fail_cnt + 1; \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *) (CPRINT_ARG2)) = (arg3); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define FAIL_4(cmd, arg1, arg2, arg3, arg4) \  do { \    fail_cnt = fail_cnt + 1; \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *) (CPRINT_ARG2)) = (arg3); \    (*(volatile tWORD *) (CPRINT_ARG3)) = (arg4); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)#define FAIL_5(cmd, arg1, arg2, arg3, arg4, arg5) \  do { \    fail_cnt = fail_cnt + 1; \    (*(volatile tWORD *) (CPRINT_ARG0)) = (arg1); \    (*(volatile tWORD *) (CPRINT_ARG1)) = (arg2); \    (*(volatile tWORD *) (CPRINT_ARG2)) = (arg3); \    (*(volatile tWORD *) (CPRINT_ARG3)) = (arg4); \    (*(volatile tWORD *) (CPRINT_ARG4)) = (arg5); \    (*(volatile tWORD *)  (CPRINT_CMD)) = (cmd); \  } while(0)/****************************************************************************** * Macro:    DEBUG     (Sends a string out to the screen and the .log file) * * Parameters:         Stimname        A NULL or `\004` terminated string *                     String          A NULL or `\004` terminated string * * Returns:      * * Notes:      This macro uses the CPRINT facility *****************************************************************************/#define DEBUG( Stimname, String )                                            \{                                                                            \   SUCCESS_2( (tWORD)( CPRINT_DEBUG ), (tWORD)( Stimname ), (tWORD)( String ) );  \}/****************************************************************************** * Macro:    INFO     (Sends a string out to the screen and the .log file) * * Parameters:         Stimname        A NULL or `\004` terminated string *                     String          A NULL or `\004` terminated string * * Returns:      * * Notes:      This macro uses the CPRINT facility *****************************************************************************/#define INFO( Stimname, String )                                             \{                                                                            \   SUCCESS_2( (tWORD)( CPRINT_INFO ), (tWORD)( Stimname ), (tWORD)( String ) );  \}/****************************************************************************** * Macro:    WARN     (Sends a string out to the screen and the .log file) * * Parameters:         Stimname        A NULL or `\004` terminated string *                     String          A NULL or `\004` terminated string * * Returns:      * * Notes:      This macro uses the CPRINT facility *****************************************************************************/#define WARN( Stimname, String )                                             \{                                                                            \   FAIL_2( (tWORD)( CPRINT_WARN ), (tWORD)( Stimname ), (tWORD)( String ) );  \}/****************************************************************************** * Macro:    ERROR  (Sends an error string out to the screen, .log, and                      the .out file) * * Parameters:         Stimname        A NULL or `\004` terminated string *                     String          A NULL or `\004` terminated string * * Returns:      * * Notes:      This macro uses the CPRINT facility *****************************************************************************/#define ERROR( Stimname, String )                                            \{                                                                            \   FAIL_2( (tWORD)( CPRINT_ERROR ), (tWORD)( Stimname ), (tWORD)( String ));  \}/****************************************************************************** * Macro:    FATAL     (Sends a string out to the screen and the .log file) * * Parameters:         Stimname        A NULL or `\004` terminated string *                     String          A NULL or `\004` terminated string * * Returns:      * * Notes:      This macro uses the CPRINT facility *****************************************************************************/#define FATAL( Stimname, String )                                            \{                                                                            \   FAIL_2( (tWORD)( CPRINT_FATAL ), (tWORD)( Stimname ), (tWORD)( String ));  \}/****************************************************************************** * Macro:    SHOW     (Sends a string out to the screen and the .log file) * * Parameters:          String          A NULL or `\004` terminated string * * Returns:      * * Notes:      This macro uses the CPRINT facility *****************************************************************************/#define SHOW( String, dvalue )                                               \{                                                                            \   SUCCESS_2( (tWORD)( CPRINT_SHOW ), (tWORD)( dvalue ), (tWORD)( String ) );  \}/****************************************************************************** * Macro:    R	(read) * * Parameters:		Reg		The register                         var		The variable to be written * * Returns:	 * * Notes:      Transfer a register's value to a variable *****************************************************************************/#define R8( address, destvar ) 	                                                \    (( destvar ) = *(volatile tBYTE *)( address ))#define R16( address, destvar )                                                 \    (( destvar ) = *(volatile tHALF *)( address ))#define R32( address, destvar )                                                 \    (( destvar ) = *(volatile tWORD *)( address ))/****************************************************************************** * Macro:    RE	(read and check Expected) * * Parameters:		Reg		The register         	 	ExpData		The Expected value * * Returns:	 * * Notes:     The test performed is:     if (( (Reg) ) != ( (ExpData) )) *****************************************************************************/#define RE8( Reg, ExpData )							\{										\    tBYTE tmp;									\    tmp = (volatile tBYTE)(*(volatile tBYTE *)(Reg));				\    if ((tBYTE)( tmp )!=( (tBYTE)(ExpData) )) { /* means the test failed */	\      FAIL_3( (tWORD)( CPRINT_E_RE8 ), (tWORD)( Reg ), (tWORD)( tmp ), (tWORD)( ExpData ) );    \    }                								\    else {                                                                      \      SUCCESS_3( (tWORD)( CPRINT_S_RE8 ), (tWORD)( Reg ), (tWORD)( tmp ), (tWORD)( ExpData ) ); \    }                                                                           \}									#define RE16( Reg, ExpData )							\{										\    tHALF tmp;									\    tmp = (volatile tHALF)(*(volatile tHALF *)(Reg));				\    if ((tHALF)( tmp )!=( (tHALF)(ExpData) )) { /* means the test failed */	\      FAIL_3( (tWORD)( CPRINT_E_RE16 ), (tWORD)( Reg ), (tWORD)( tmp ), (tWORD)( ExpData ) );   \    }              								\    else {                                                                      \      SUCCESS_3( (tWORD)( CPRINT_S_RE16 ), (tWORD)( Reg ), (tWORD)( tmp ), (tWORD)( ExpData ) ); \    }                                                                           \}									#define RE32( Reg , ExpData )							\{                                                                               \    tWORD tmp;									\    tmp = (volatile tWORD)(*(volatile tWORD *)(Reg));				\

⌨️ 快捷键说明

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