📄 led_testaccess.h
字号:
//*******************************************************************************
//
// TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
//
// Property of Texas Instruments
// For Unrestricted Internal Use Only
// Unauthorized reproduction and/or distribution is strictly prohibited.
// This product is protected under copyright law and trade secret law
// as an unpublished work.
// Created 2000, (C) Copyright 2000 Texas Instruments. All rights reserved.
//
//===============================================================================
#ifndef _LED_TESTACCESS_H
#define _LED_TESTACCESS_H
#include "result_led.h"
//_____________________SPY______________MANAGEMENT_____________________________________
//
// To debug the tests and to know fastly the origin of a failure
// we use the spy_result
//
// The values written in the spy_results file are 16 bits long words
// The goal of the spy_results is to give the maximum of information
// but with an easy way to read and understand
//
// The spy_results is able to receive data, too.
//
// To manage all that requests we use a simple protocole described above :
//
//
// SPY protocol
// --------------
//
// functionnal words
// -----------------
// The Words which MSB bit is one are functionnal words for an easy read
// of the spy_results :
// 0x8XXX
// 0x9XXX
// 0xAXXX
// 0xBXXX
// 0xCXXX
// 0xDXXX
// 0xEXXX
// 0xFXXX
//
// All the words which look like this have functionnal meaning (Except data , see later)
//
// Functionnal words in use are above :
//----------------------------------------------------------------
// An easy way to see that a test part succeed
#define TEST_OK 0x8000
#define TEST_BAD 0x8888
#define ALL_SPY_OK 0x0001
#define SPY_NOT_OK 0x0002
// An easy way to see that we change of section in a big test
#define RESULT_SEPARATOR 0xAAAA
// The word which follows is a data, but be carefull the second word which follows is not a data
#define DATA_STORE 0xF000
// The words which follows are data until we meet the END_ARRAY_DATA
#define START_ARRAY_DATA 0xF001
#define END_ARRAY_DATA 0xF002
// Same thing with these customized array
#define START_ARRAY_DATA_RESET 0xF003
#define START_ARRAY_DATA_ACCESS 0xF004
//****************************************************
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
// Macros to test the reset value of one register.
// ---------------------------------------------
//
// BEGIN_RESET_TEST read the register and store it in tmp variable
//
// TEST_FIELD_RESET test the field specified with the variable tmp
// if there is a difference between the theorical value and the real value
// the spy is written with the following format
//
// FIELD_BAD_RESET_VALUE
// START_ARRAY_DATA
// (Real field)
// (Theorical field)
// END_ARRAY_DATA
//
// END_RESET_TEST close the procedure of register test and write a status for the test OK if it is the case
//
//-----------------------------------------------------------------------------------
#define BEGIN_RESET_MODULE() { \
UWORD16 GlobalStatus=TEST_OK
#define BEGIN_RESET_TEST(Module_Reg,Size) { \
register UWORD##Size TmpRegister=Module_Reg; \
#define TEST_FIELD_RESET(Module_Reg,Field,Size) if (GetGroupBits##Size(TmpRegister,Module_Reg ## _ ##Field ## _POS,Module_Reg ## _##Field ##_NUMB) != Module_Reg##_##Field##_RES_VAL) \
{ \
LED_ResSet(Module_Reg ## _BAD_RESET_VALUE); \
LED_ResSet(START_ARRAY_DATA_RESET); \
LED_ResSet(GetGroupBits##Size(TmpRegister,Module_Reg ## _ ##Field ## _POS,Module_Reg ## _##Field ##_NUMB)); \
LED_ResSet( Module_Reg##_##Field##_RES_VAL); \
LED_ResSet(END_ARRAY_DATA); \
GlobalStatus=TEST_BAD; \
}
#define END_RESET_TEST() }
#define END_RESET_MODULE() if (GlobalStatus==TEST_OK) \
{ \
LED_ResSet(GlobalStatus); \
} \
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
// Macros to test the access to a register.
// ---------------------------------------------
//
// BEGIN_RW_TEST read the register and store it in TmpRegister variable
//
// RW_PREPARE_WRITE prepare the variable field with the opposite value of
// the reset value
//
// RW_WRITE Write the register with the prepared value
//
// FIELD_BAD_RESET_VALUE
// START_ARRAY_DATA
// (Real field)
// (Theorical field)
// END_ARRAY_DATA
//
// END_RESET_TEST close the procedure of register test and write a status for the test OK if it is the case
//
//-----------------------------------------------------------------------------------
#define BEGIN_ACCESS_MODULE() { \
UWORD16 GlobalStatus=TEST_OK; \
#define BEGIN_RW_TEST(Module_Reg,Size) { \
register UWORD##Size TmpRegister=Module_Reg; \
register UWORD##Size TmpRegisterReset=TmpRegister;
#define RW_PREPARE_WRITE(Module_Reg,Field,Size) SetGroupBits##Size(TmpRegister,Module_Reg ##_## Field ## _POS, Module_Reg ##_## Field ## _NUMB, (~(Module_Reg ##_## Field ## _RES_VAL)))
#define RW_WRITE(RegisterName) RegisterName=TmpRegister; \
TmpRegister=RegisterName
#define RW_TEST_READ(Module_Reg,Field,Size) if (GetGroupBits##Size(TmpRegister,Module_Reg ##_## Field ## _POS,Module_Reg ##_## Field ## _NUMB)!= \
GetGroupBits##Size(~(Module_Reg ##_## Field ## _RES_VAL),0,Module_Reg ##_## Field ## _NUMB)) \
{ \
LED_ResSet(Module_Reg ## _BAD_ACCESS); \
LED_ResSet(START_ARRAY_DATA_ACCESS ); \
LED_ResSet(GetGroupBits##Size(~(Module_Reg ##_## Field ## _RES_VAL),0,Module_Reg ##_## Field ## _NUMB)); \
LED_ResSet(GetGroupBits##Size(TmpRegister,Module_Reg ##_## Field ## _POS,Module_Reg ##_## Field ## _NUMB)); \
LED_ResSet(END_ARRAY_DATA ); \
GlobalStatus=TEST_BAD; \
} \
#define RW_WRITE_PREVIOUS_VALUE(Module_Reg) Module_Reg=TmpRegisterReset
#define END_RW_TEST() } \
#define END_ACCESS_MODULE() if (GlobalStatus==TEST_OK) LED_ResSet(GlobalStatus); \
} \
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -