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

📄 reset.h

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 H
📖 第 1 页 / 共 4 页
字号:
/*

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

TEST_FIELD_RESET_VALUE8
TEST_REGISTER_RESET_VALUE8

MODIFY_FIELD_RESET_VALUE8
MODIFY_REGISTER_RESET_VALUE8

MODIFY_FIELD_UNDEFINED8

*/

// ==========================================================================================
// Macro Name :TEST_FIELD_RESET_VALUE8

// Same as TEST_FIELD_RESET_VALUE using an 8 bits register
#define TEST_FIELD_RESET_VALUE8(RegisterName,GroupBitName)               \
                                                                          \
      if(GetGroupBits8(REG8(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(REG8(RegisterName),                               \
                        (GroupBitName ## _POS),(GroupBitName ## _NUMB)));          \
      }



// ==========================================================================================
// Macro Name :TEST_REGISTER_RESET_VALUE8

// Same as TEST_REGISTER_RESET_VALUE using an 8 bits register
#define TEST_REGISTER_RESET_VALUE8(RegisterName)                           \
                                                                            \
      if((REG8(RegisterName)&0xFF)!=(((RegisterName ## _RES_VAL))&0xFF))     \
      {                                                                       \
        RES_Set(RegisterName ## _BAD_RESET_VALUE);                             \
        RES_Set(DATAEXPECTED_DATAREAD);                                         \
        RES_Set(RegisterName ## _RES_VAL);                                       \
        RES_Set(REG8(RegisterName));                                              \
      }


// ==========================================================================================
// Macro Name : MODIFY_FIELD_RESET_VALUE8

// 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.

//      if(TEST_GET_GROUP_BITS(8,(REG8(RegisterName)),GroupBitName,(~(GroupBitName ## _RES_VAL))))\

#define MODIFY_FIELD_RESET_VALUE8(RegisterName,GroupBitName)\
                                                             \
      SetGroupBits8(REG8(RegisterName),                       \
                     (GroupBitName ## _POS),                   \
                     (GroupBitName ## _NUMB),                   \
                     (~(GroupBitName ## _RES_VAL)));             \
      if(GetGroupBits8(REG8(RegisterName),GroupBitName ## _POS,GroupBitName ## _NUMB)!=            \
         GetGroupBits8(~(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(GetGroupBits8(~(GroupBitName ## _RES_VAL),0,GroupBitName ## _NUMB));\
        RES_Set(GetGroupBits8(REG8(RegisterName),GroupBitName ## _POS,GroupBitName ## _NUMB)); \
      }                                                             \
      SetGroupBits8(REG8(RegisterName),                        \
                     (GroupBitName ## _POS),                    \
                     (GroupBitName ## _NUMB),                    \
                     (GroupBitName ## _RES_VAL));


// ==========================================================================================
// Macro Name : MODIFY_REGISTER_RESET_VALUE8

// 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_VALUE8(RegisterName)     \
                                                        \
      REG8(RegisterName)=(~(RegisterName ## _RES_VAL)&0xFF);    \
      if((REG8(RegisterName)&0xFF)!=((~(RegisterName ## _RES_VAL))&0xFF)) \
      {                                                    \
        RES_Set(RegisterName ## _BAD_RESET_VALUE);          \
        RES_Set(DATA_STORE);                                 \
        RES_Set(0x0001);                                      \
      }


// ==========================================================================================
// Macro Name : MODIFY_FIELD_UNDEFINED8

// 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_UNDEFINED8(RegisterName,GroupBitName)\
                                                           \
      SetGroupBits8(REG8(RegisterName),                     \
                   (GroupBitName ## _POS),                   \
                   (GroupBitName ## _NUMB),                   \
                   (~(GroupBitName ## _SET_VAL)));             \
      if(GetGroupBits8(REG8(RegisterName),              \
                       (GroupBitName ## _POS),           \
                       (GroupBitName ## _NUMB))!=         \
         GetGroupBits8(~(GroupBitName ## _SET_VAL),        \
                        0,                                  \
                        (GroupBitName ## _NUMB)))            \
      {                                                       \
        RES_Set(GroupBitName ## _BAD_RESET_VALUE);             \
        RES_Set(DATA_STORE);                                    \
        RES_Set(0x0002);                                         \
      }                                                           \
      else                                                         \
      {                                                       \
        SetGroupBits8(REG8(RegisterName),                      \
                     (GroupBitName ## _POS),                    \
                     (GroupBitName ## _NUMB),                    \
                     (GroupBitName ## _SET_VAL));                 \
        if(GetGroupBits8(REG8(RegisterName),                \
                         (GroupBitName ## _POS),             \
                         (GroupBitName ## _NUMB))!=           \
                         (GroupBitName ## _SET_VAL))           \
        {                                                       \
          RES_Set(GroupBitName ## _BAD_RESET_VALUE);             \
          RES_Set(DATA_STORE);                                    \
          RES_Set(0x0003);                                         \
        }                                                           \
      }


// ==========================================================================================
// Macro Name : ARE_RESET_VALUES_OK

// Description : At the end of the check of all reset values of a module,
// this function is called to confirm everything is OK or to confirm there
// was a problem.
#define PRINT_CURRENT_ERROR_STATUS(ValueOK) RES_Set(RES_GetCurrentRes2(ValueOK))
#define ARE_RESET_VALUES_OK() RES_Set(RES_GetCurrentRes())








//              ============================================
//                              IT macros
//              ============================================

// ==========================================================================================
// Macro Name : ABORT_UNEXPECTED

// Description : In the test that do not use the abort, this macro can check
// an unexpected abort returning an error.
#define ABORT_UNEXPECTED()                   RES_Set(GENERAL_ABORT_UNEXPECTED);\
                                             RES_GetFinal2();                   \
                                             RES_StopVhdl();

// ==========================================================================================
// Macro Name : IRQ_UNEXPECTED

// Description : In the test that do not use the irq, this macro can check
// an unexpected irq returning an error and the irq number.
#define IRQ_UNEXPECTED()                     RES_Set(GENERAL_IRQ_UNEXPECTED);\
                                             RES_Set(DATA_STORE);             \
                                             RES_Set(INTH2_GetCurrentIt(INTH_IRQ));      \
                                             INTH2_ValidNextInterrupt(INTH_IRQ);

// ==========================================================================================
// Macro Name : FIQ_UNEXPECTED

// Description : In the test that do not use the fiq, this macro can check
// an unexpected fiq returning an error and the fiq number.
#define FIQ_UNEXPECTED()                     RES_Set(GENERAL_FIQ_UNEXPECTED);\
                                             RES_Set(DATA_STORE);             \
                                             RES_Set(INTH2_GetCurrentIt(INTH_FIQ));      \
                                             INTH2_ValidNextInterrupt(INTH_FIQ);

// ==========================================================================================
// Macro Name : EXT_IRQ_UNEXPECTED

// Description : In the test that do not use the external irq, this macro can check
// an unexpected external irq returning an error and the ext irq number.
#define EXT_IRQ_UNEXPECTED()                 RES_Set(GENERAL_EXT_IRQ_UNEXPECTED);       \
                                             RES_Set(DATA_STORE);                        \
                                             RES_Set(INTH2_Ack(INTH_IRQ,INTH_EXTERNAL));  \
                                             INTH_ValidNext(INTH_IRQ,INTH_EXTERNAL);

// ==========================================================================================
// Macro Name : EXT_FIQ_UNEXPECTED

// Description : In the test that do not use the external fiq, this macro can check
// an unexpected external fiq returning an error and the ext fiq number.
#define EXT_FIQ_UNEXPECTED()                 RES_Set(GENERAL_EXT_FIQ_UNEXPECTED);       \
                                             RES_Set(DATA_STORE);                        \
                                             RES_Set(INTH2_Ack(INTH_FIQ,INTH_EXTERNAL));  \
                                             INTH_ValidNext(INTH_FIQ,INTH_EXTERNAL);



#define WAIT_FOR_IT_HAPPENS(ConditionToStopWaiting,WD_Var,Error) \
    for((WD_Var)=0;                                               \
        !(ConditionToStopWaiting) && (WD_Var)<MAX_SOFT_WD_VALUE;   \
        (WD_Var)++);                                                \
    if((WD_Var)>=MAX_SOFT_WD_VALUE)                                  \
      RES_Set(Error);                                                 \
    else                                                               \
      RES_Set(TEST_OK);


#define MAX_SOFT_WD_VALUE                    0xFFFE

#endif

⌨️ 快捷键说明

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