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

📄 reset.h

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 H
📖 第 1 页 / 共 4 页
字号:
//===============================================================================
//
//            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.
//
//
//   Description        : Reset values and associated macros
//
//
//===============================================================================

#ifndef _RESET_H
#define _RESET_H

#include "errorcodes.h"
#include "test.h"


// Definition of findspy macros :
//================================

//findspy|definemacro|ReadWriteRegister|optional|
// ifvalueis|0001|print|Cannot write register &@|
// ifvalueis|0002|print|Cannot modify undefined register &@|
// ifvalueis|0003|print|Undefined register was modified once but cannot be modified twice &@|
//findspy|endmacro|


#define TEST_RESET_VALUE_SEPARATOR           0xAAA0//findspy|print|$===== $End of test reset value&@$ =====$
#define TEST_MODULE_SEPARATOR                0xAAA1//findspy|print|$===== $End of test module&@$ =====$
#define GLOBAL_TEST_SEPARATOR                0xAAAF//findspy|print|$===== $End of Global test&@$ =====$
#define DATAEXPECTED_DATAREAD                0xAAA2//findspy|2data|Data expected&@:|Data read&@:|




#define TEST_GET_GROUP_BITS(Width,Register,GroupBitName,ValueToTest)\
          GetGroupBits ## Width(Register,GroupBitName ## _POS,GroupBitName ## _NUMB)==\
          GetGroupBits ## Width(ValueToTest,0,GroupBitName ## _NUMB)

#define GET_NOT_GROUP_BIT_RESVAL(Width,GroupBitName)    \
         GetGroupBits##Width(~(GroupBitName ## _RES_VAL),\
                              (GroupBitName ## _POS),     \
                              (GroupBitName ## _NUMB)))


/* =============================================================================

      Reset values are an important part of the development of any module.
      To minimize the code to write to check that a module has its reset values
      well defined, some macros were written. They can be modified by anybody as
      long as their initial tests are still performed.

      There are four types of macros : One for 32 bits registers, another for 16
      bits registers, one for mcbsp registers and a last one for 8 bits registers.

      Mcbsp has some dedicated macros as it did not followed the other module
      filosophy. Its position field are referenced from the left while all
      other position field register modules are referenced from the right.

      Some other IT macros were written. They can be used when an IT or an Abort
      is not expected.

   =============================================================================*/


// Functions Written
//-------------------

// READ_ACCESS_WORK_WITH_REGISTER(RegisterName,Width)

// TEST_FIELD_RES_VAL(GroupBitName,Width)

// END

#define READ_ACCESS_WORK_WITH_REGISTER(RegisterName,Width)\
{\
  UWORD32 OnlyUsedHereVar=REG##Width(RegisterName);


#define TEST_FIELD_RES_VAL(GroupBitName,Width)                             \
                                                                            \
      if(GetGroupBits##Width(OnlyUsedHereVar,                                \
                        (GroupBitName ## _POS),(GroupBitName ## _NUMB))!=     \
                        (GroupBitName ## _RES_VAL))                            \
      {                                                                         \
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);                               \
        RES_Set(DATAEXPECTED_DATAREAD);                                           \
        RES_Set(GroupBitName ## _RES_VAL);                                         \
        RES_Set(GetGroupBits##Width(OnlyUsedHereVar,                                \
                        (GroupBitName ## _POS),(GroupBitName ## _NUMB)));            \
      }

#define END }


/*
           Fastest Macros available
          ==========================


  + READWRITE_ACCESS_WORK_WITH_REGISTER(RegisterName,Width)

  + READWRITE_ACCESS_PREPARE_OPPOSED_MASK(GroupBitName,Width)

  + READWRITE_ACCESS_PREPARE_FIRST_UNDEFINED_MASK(GroupBitName,Width)

  + READWRITE_ACCESS_PREPARE_SECOND_UNDEFINED_MASK(GroupBitName,Width)

  + WRITE_MASK(RegisterName,Width)

  + READ_WRITE_CHECK_TEST_FIELD(GroupBitName,Width)

  + READ_WRITE_CHECK_FIRST_UNDEFINED_TEST_FIELD(GroupBitName,Width)

  + READ_WRITE_CHECK_SECOND_UNDEFINED_TEST_FIELD(GroupBitName,Width)

  + WRITE_PREVIOUS_VALUE(RegisterName,Width)

*/

#define READWRITE_ACCESS_WORK_WITH_REGISTER(RegisterName,Width)\
{                                                               \
  UWORD##Width OnlyUsedHereVar=0;                                  \
  UWORD##Width CreateMaskVarOnlyUsedHereVar=REG##Width(RegisterName);

#define READWRITE_ACCESS_PREPARE_OPPOSED_MASK(GroupBitName,Width)\
      SetGroupBits##Width(CreateMaskVarOnlyUsedHereVar,           \
                     (GroupBitName ## _POS),                       \
                     (GroupBitName ## _NUMB),                       \
                     (~(GroupBitName ## _RES_VAL)));

#define READWRITE_ACCESS_PREPARE_FIRST_UNDEFINED_MASK(GroupBitName,Width)\
      SetGroupBits##Width(CreateMaskVarOnlyUsedHereVar,                 \
                     (GroupBitName ## _POS),                             \
                     (GroupBitName ## _NUMB),                             \
                     (~(GroupBitName ## _SET_VAL)));

#define READWRITE_ACCESS_PREPARE_SECOND_UNDEFINED_MASK(GroupBitName,Width)\
      SetGroupBits##Width(CreateMaskVarOnlyUsedHereVar,                    \
                     (GroupBitName ## _POS),                                \
                     (GroupBitName ## _NUMB),                                \
                     (GroupBitName ## _SET_VAL));

#define WRITE_MASK(RegisterName,Width)                 \
  REG##Width(RegisterName)=CreateMaskVarOnlyUsedHereVar;\
  OnlyUsedHereVar=REG##Width(RegisterName);

#define READ_WRITE_CHECK_TEST_FIELD(GroupBitName,Width)                                 \
      if(GetGroupBits##Width(OnlyUsedHereVar,GroupBitName ## _POS,GroupBitName ## _NUMB)!=\
         GetGroupBits##Width(~(GroupBitName ## _RES_VAL),0,GroupBitName ## _NUMB))         \
      {                                                                                     \
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);                                           \
        RES_Set(DATA_STORE);                                                                  \
        RES_Set(0x0001);                                                                       \
        RES_Set(DATAEXPECTED_DATAREAD);                                                         \
        RES_Set(GetGroupBits##Width(~(GroupBitName ## _RES_VAL),0,GroupBitName ## _NUMB));       \
        RES_Set(GetGroupBits##Width(OnlyUsedHereVar,GroupBitName ## _POS,GroupBitName ## _NUMB)); \
      }                                                             \
      SetGroupBits32(OnlyUsedHereVar,                                \
                     (GroupBitName ## _POS),                          \
                     (GroupBitName ## _NUMB),                          \
                     (GroupBitName ## _RES_VAL));

#define READ_WRITE_CHECK_FIRST_UNDEFINED_TEST_FIELD(GroupBitName,Width)                  \
      if(GetGroupBits##Width(OnlyUsedHereVar,GroupBitName ## _POS,GroupBitName ## _NUMB)!=\
         GetGroupBits##Width(~(GroupBitName ## _SET_VAL),0,GroupBitName ## _NUMB))         \
      {                                                                                     \
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);                                           \
        RES_Set(DATA_STORE);                                                                  \
        RES_Set(0x0002);                                                                       \
        RES_Set(DATAEXPECTED_DATAREAD);                                                         \
        RES_Set(GetGroupBits##Width(~(GroupBitName ## _SET_VAL),0,GroupBitName ## _NUMB));       \
        RES_Set(GetGroupBits##Width(OnlyUsedHereVar,GroupBitName ## _POS,GroupBitName ## _NUMB)); \
      }

#define READ_WRITE_CHECK_SECOND_UNDEFINED_TEST_FIELD(GroupBitName,Width)                 \
      if(GetGroupBits##Width(OnlyUsedHereVar,GroupBitName ## _POS,GroupBitName ## _NUMB)!=\
         GetGroupBits##Width((GroupBitName ## _SET_VAL),0,GroupBitName ## _NUMB))          \
      {                                                                                     \
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);                                           \
        RES_Set(DATA_STORE);                                                                  \
        RES_Set(0x0003);                                                                       \
        RES_Set(DATAEXPECTED_DATAREAD);                                                         \
        RES_Set(GetGroupBits##Width(~(GroupBitName ## _SET_VAL),0,GroupBitName ## _NUMB));       \
        RES_Set(GetGroupBits##Width(OnlyUsedHereVar,GroupBitName ## _POS,GroupBitName ## _NUMB)); \
      }

#define WRITE_PREVIOUS_VALUE(RegisterName,Width)\
  REG##Width(RegisterName)=OnlyUsedHereVar;



//              ============================================
//                          32 bits access macros
//              ============================================

/*

 Macros available are :
======================

TEST_FIELD_RESET_VALUE32
TEST_REGISTER_RESET_VALUE32

MODIFY_FIELD_RESET_VALUE32
MODIFY_REGISTER_RESET_VALUE32

MODIFY_REGISTER_UNDEFINED32

*/



// ==========================================================================================
// Macro Name :TEST_FIELD_RESET_VALUE32

// Parameters : RegisterName : The register of the field to test
//              GroupBitName : The base name of the field to test

// Description : Test the reset value of a field. From the base name of
// the field, the macro creates the field position, width, reset value
// expected and resetvalue errors constants.

// To use this macro the syntax to follow is "GroupBitName"_POS,
// "GroupBitName"_NUMB, "GroupBitName"_RES_VAL, "GroupBitName"_BAD_RESET_VALUE

// The first first constants are usually defined in the library of the file.
// The error constant is usually defined in the test.h file (this file).
#define TEST_FIELD_RESET_VALUE32(RegisterName,GroupBitName)                \

⌨️ 快捷键说明

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