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

📄 reset.h

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 H
📖 第 1 页 / 共 4 页
字号:
                                                                            \
      if(GetGroupBits32(REG32(RegisterName),                                 \
                        (GroupBitName ## _POS),(GroupBitName ## _NUMB))!=     \
                        (GroupBitName ## _RES_VAL))                            \
      {                                                                         \
        RES_Set( START_ARRAY_DATA);						\
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);                               \
        RES_Set(DATAEXPECTED_DATAREAD);                                           \
        RES_Set(GroupBitName ## _RES_VAL);                                         \
        RES_Set(GetGroupBits32(REG32(RegisterName),                                 \
                        (GroupBitName ## _POS),(GroupBitName ## _NUMB)));            \
        RES_Set( END_ARRAY_DATA);						\
        RES_Set( TEST_BAD);						\
      } \
      else \
      {		\
        RES_Set( TEST_OK);						\
      }
        


// ==========================================================================================
// Macro Name :TEST_REGISTER_RESET_VALUE32

// Parameters : RegisterName : The register to test

// This function also needs a special syntax : RegisterName is the full name
// of the register. The ResetValue expected must be declared as follow :
//                       "RegisterName"_RES_VAL,

// the error associated to a bad reset value :
//                   "RegisterName"_BAD_RESET_VALUE
#define TEST_REGISTER_RESET_VALUE32(RegisterName)      \
                                                        \
      if(REG32(RegisterName)!=(RegisterName ## _RES_VAL))\
      {                                                   \
        RES_Set(RegisterName ## _BAD_RESET_VALUE);         \
        RES_Set(DATAEXPECTED_DATAREAD);   \
        RES_Set(RegisterName ## _RES_VAL); \
        RES_Set(REG32(RegisterName));       \
      }





// ==========================================================================================
// Macro Name : MODIFY_FIELD_RESET_VALUE32

// Description : Some registers are R/W. To test them we must write and
// reread a value. First this macro writes the complemented RESET VALUE.
// Then it rereads it. It ends reseting the field to its reset value.

// Return value : None but writes errors in the spy. The first code written
// is the error associated to the field. Then writes a DATA_STORE code followed by
// 0x0001 to tell the user it is not a reset value problem but a write/read problem.
#define MODIFY_FIELD_RESET_VALUE32(RegisterName,GroupBitName)\
                                                              \
      SetGroupBits32(REG32(RegisterName),                      \
                     (GroupBitName ## _POS),                    \
                     (GroupBitName ## _NUMB),                    \
                     (~(GroupBitName ## _RES_VAL)));              \
      if(GetGroupBits32(REG32(RegisterName),GroupBitName ## _POS,GroupBitName ## _NUMB)!=\
         GetGroupBits32(~(GroupBitName ## _RES_VAL),0,GroupBitName ## _NUMB))\
      {                                                         \
        RES_Set( START_ARRAY_DATA);			\
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);               \
        RES_Set(DATA_STORE);                                      \
        RES_Set(0x0001);                                           \
        RES_Set(DATAEXPECTED_DATAREAD);   \
        RES_Set(GetGroupBits32(~(GroupBitName ## _RES_VAL),0,GroupBitName ## _NUMB)); \
        RES_Set(GetGroupBits32(REG32(RegisterName),GroupBitName ## _POS,GroupBitName ## _NUMB));\
        RES_Set( END_ARRAY_DATA);			\
        RES_Set( TEST_BAD);			\
      }                                                            \
      else			\
      {				\
        RES_Set( TEST_OK);	\
      }				\
      SetGroupBits32(REG32(RegisterName),                      \
                     (GroupBitName ## _POS),                    \
                     (GroupBitName ## _NUMB),                    \
                     (GroupBitName ## _RES_VAL));


// ==========================================================================================
// Macro Name : MODIFY_REGISTER_RESET_VALUE32

// Description : Some registers are R/W. To test them we must write and
// reread a value. First this macro writes the complemented RESET VALUE.
// Then it rereads it. It ends reseting the register to its initial reset value.

// Return value : None but writes errors in the spy. The first code written
// is the error associated to the field. Then writes a DATA_STORE code followed by
// 0x0001 to tell the user it is not a reset value problem but a write/read problem.
#define MODIFY_REGISTER_RESET_VALUE32(RegisterName)    \
                                                        \
      REG32(RegisterName)=~(RegisterName ## _RES_VAL);   \
      if(REG32(RegisterName)!=~(RegisterName ## _RES_VAL))\
      {                                                    \
        RES_Set(RegisterName ## _BAD_RESET_VALUE);          \
        RES_Set(DATA_STORE);                                 \
        RES_Set(0x0001);                                      \
        RES_Set(DATAEXPECTED_DATAREAD);   \
        RES_Set(~(RegisterName ## _RES_VAL)); \
        RES_Set(REG32(RegisterName));       \
      }                                                        \
      REG32(RegisterName)=(RegisterName ## _RES_VAL);


// ==========================================================================================
// Macro Name : MODIFY_REGISTER_UNDEFINED32

// Description : Some registers are R/W. To test them we must write and
// reread a value. First this macro writes the complemented RESET VALUE.
// Then it rereads it. It ends reseting the register to its initial reset value.

// Return value : None but writes errors in the spy. The first code written
// is the error associated to the field. Then writes a DATA_STORE code followed by
// 0x0001 to tell the user it is not a reset value problem but a write/read problem.
#define MODIFY_REGISTER_UNDEFINED32(RegisterName)      \
                                                        \
      REG32(RegisterName)=(~(RegisterName ## _SET_VAL)); \
      if(REG32(RegisterName)!=~(RegisterName ## _SET_VAL))\
      {                                                    \
        RES_Set(RegisterName ## _BAD_RESET_VALUE);          \
        RES_Set(DATA_STORE);                                 \
        RES_Set(0x0002);                                      \
        RES_Set(DATAEXPECTED_DATAREAD);   \
        RES_Set(~(RegisterName ## _SET_VAL)); \
        RES_Set(REG32(RegisterName));       \
      }                                                        \
      else                                                      \
      {                                                          \
        REG32(RegisterName)=(RegisterName ## _SET_VAL);           \
        if(REG32(RegisterName)!=RegisterName ## _SET_VAL)   \
        {                                                    \
          RES_Set(RegisterName ## _BAD_RESET_VALUE);          \
          RES_Set(DATA_STORE);                                 \
          RES_Set(0x0003);                                      \
          RES_Set(DATAEXPECTED_DATAREAD);   \
          RES_Set(RegisterName ## _SET_VAL); \
          RES_Set(REG32(RegisterName));       \
        }                                                        \
      }





//              ============================================
//                          16 bits access macros
//              ============================================


/*

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

TEST_FIELD_RESET_VALUE  !!!  16 is implicit
TEST_REGISTER_RESET_VALUE   !!! 16 is implicit

MODIFY_FIELD_RESET_VALUE16
MODIFY_REGISTER_RESET_VALUE16

MODIFY_FIELD_UNDEFINED16
MODIFY_REGISTER_UNDEFINED16

*/



// ==========================================================================================
// Macro Name :TEST_FIELD_RESET_VALUE

// 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_VALUE(RegisterName,GroupBitName)                  \
                                                                            \
      if(GetGroupBits16(REG16(RegisterName),                                 \
                        (GroupBitName ## _POS),(GroupBitName ## _NUMB))!=     \
                        (GroupBitName ## _RES_VAL))                            \
      {                                                                         \
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);                               \
        RES_Set(DATAEXPECTED_DATAREAD);                                           \
        RES_Set(GroupBitName ## _RES_VAL);                                         \
        RES_Set(GetGroupBits16(REG16(RegisterName),                                 \
                        (GroupBitName ## _POS),(GroupBitName ## _NUMB)));            \
      }

// ==========================================================================================
// Macro Name :TEST_REGISTER_RESET_VALUE

// Parameters : RegisterName : The register to test

// This function also needs a special syntax : RegisterName is the full name
// of the register. The ResetValue expected must be declared as follow :
//                       "RegisterName"_RES_VAL,

// the error associated to a bad reset value :
//                   "RegisterName"_BAD_RESET_VALUE
#define TEST_REGISTER_RESET_VALUE(RegisterName)        \
                                                        \
      if((REG16(RegisterName)&0xFFFF)!=(((RegisterName ## _RES_VAL)&0xFFFF)))\
      {                                                                       \
        RES_Set(RegisterName ## _BAD_RESET_VALUE);                             \
        RES_Set(DATAEXPECTED_DATAREAD);                                         \
        RES_Set(RegisterName ## _RES_VAL);                                       \
        RES_Set(REG16(RegisterName));                                             \
      }




// ==========================================================================================
// Macro Name : MODIFY_FIELD_RESET_VALUE16

// Description : Some registers are R/W. To test them we must write and
// reread a value. First this macro writes the complemented RESET VALUE.
// Then it rereads it. It ends reseting the field to its reset value.

// Return value : None but writes errors in the spy. The first code written
// is the error associated to the field. Then writes a DATA_STORE code followed by
// 0x0001 to tell the user it is not a reset value problem but a write/read problem.
#define MODIFY_FIELD_RESET_VALUE16(RegisterName,GroupBitName)                                    \

⌨️ 快捷键说明

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