C51 COMPILER V9.01   SH_IEC60730B_8051F_TESTPROC                                           10/11/2023 14:22:17 PAGE 1   


C51 COMPILER V9.01, COMPILATION OF MODULE SH_IEC60730B_8051F_TESTPROC
OBJECT MODULE PLACED IN .\output\sh_iec60730b_8051f_testproc.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c LARGE OPTIMIZE(7
                    -,SIZE) REGFILE(.\output\McuFlash_ISP.ORC) BROWSE INTVECTOR(0X1000) INCDIR(.\header_app;.\header_drv;.\code_gasguage) DEB
                    -UG OBJECTEXTEND PRINT(.\output\sh_iec60730b_8051f_testproc.lst) OBJECT(.\output\sh_iec60730b_8051f_testproc.obj)

line level    source

   1          /*
   2           * IEC60730 Class B TEST PROCESS for SINOWEALTH 8051 based ICs.
   3           * File:    sh_iec60730b_8051f_testproc.h
   4           * Version: 1.0
   5           * Author:  Robin.zhang Chaoming.luo
   6           * Date:    04/21/2023
   7           * SINOWEALTH IS SUPPLYING THIS SOFTWARE FOR USE EXCLUSIVELY ON SINOWEALTH'S 
   8           * MICROCONTROLLER PRODUCTS. IT IS PROTECTED UNDER APPLICABLE COPYRIGHT LAWS. 
   9           * THIS SOFTWARE IS FOR GUIDANCE IN ORDER TO SAVE TIME. AS A RESULT, SINOWEALTH 
  10           * SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES 
  11           * WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR
  12           * THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN 
  13           * CONNECTION WITH THEIR PRODUCTS.
  14           *
  15           */
  16          #include "sh_iec60730b_8051f_testproc.h"
*** WARNING C318 IN LINE 16 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: can't open file 'sh_iec60730b_80
             -51f_testproc.h'
  17          //#include "MAIN.H"
  18          
  19          
  20          extern SHT_U32 __iec60730b_stack_top;
*** ERROR C129 IN LINE 20 OF CODE_CLASSB\IEC60730_PROC\SH_IEC60730B_8051F_TESTPROC.C: missing ';' before '__iec60730b_st
             -ack_top'
  21          extern SHT_U32 __iec60730b_stack_bottom;
  22          
  23          SHT_U8         __iec60730b_bist_step;
  24          static SHT_U32 __iec60730b_crc_addr;
  25          
  26          
  27          SHT_RESULT sh_iec60730b_8051f_test_post(void)
  28          {
  29              SHT_RESULT checkResult = SH_CHK_PASS;
  30              /******************************************************/
  31              /*Initial global variables*/
  32              __iec60730b_bist_step = 0;
  33              __iec60730b_crc_addr = 0;
  34          
  35              /******************************************************/
  36              /* check watch dog */
  37          #if SH_CHK_WDG_EN == 1
*** WARNING C322 IN LINE 37 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  checkResult = sh_8051f_wdg_test();
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              #endif
  42              /*******************************************************/    
  43              /* Disable Interrupt */
  44              EA = 0;
  45              
  46              /******** CHECK CPU REGISTERS *********/
  47          #if SH_CHK_CPU_EN == 1
*** WARNING C322 IN LINE 47 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
C51 COMPILER V9.01   SH_IEC60730B_8051F_TESTPROC                                           10/11/2023 14:22:17 PAGE 2   

                  checkResult = sh_8051f_cpu_register1();
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              
                  checkResult = sh_8051f_cpu_register2();
                  if(checkResult != SH_CHK_PASS)
                   return checkResult;
              #endif
  56              
  57              /******** CHECK PROGRAM COUNTER *********/
  58          #if SH_CHK_PC_EN == 1
*** WARNING C322 IN LINE 58 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  checkResult = sh_8051f_pc_test();
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              #endif
  63              
  64              /******** CHECK RAM ADDRESSING LINE *********/
  65          #if SH_CHK_ADDRLINE_TEST_EN == 1
*** WARNING C322 IN LINE 65 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  __iec60730b_addrline_address = 0;
                  checkResult = sh_8051f_addrline_data1();      
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;     
              
                  checkResult = sh_8051f_addrline_data2();      
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;     
              
                  checkResult = sh_8051f_addrline_xdata_test();      
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;     
              #endif
  79              
  80              /******** CHECK RAM *********/
  81          #if SH_CHK_XDATA_EN == 1
*** WARNING C322 IN LINE 81 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  __iec60730b_ram_data_address = 0;
                  __iec60730b_ram_xdata_address = 0;
                  checkResult = sh_8051f_ram_data_test();      
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              
                  checkResult = sh_8051f_ram_xdata_test();      
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              #endif
  92              CLR_WDT();
  93          
  94              /* Enable Interrupt */
  95              EA = 1;   
  96          
  97              /******** CHECK BOOT *********/
  98          #if SH_CHK_BOOT_EN == 1
*** WARNING C322 IN LINE 98 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  __iec60730b_boot_checksum = CWORD[(SH_CHK_BOOT_END_ADDR-2)/2];
                  if(sh_8051f_crc_code(SH_CHK_BOOT_START_ADDR,SH_CHK_BOOT_END_ADDR,MCU_CRC_FLASH) != __iec60730b_boot_ch
             -ecksum)
                      checkResult = SH_CHK_FAIL_BOOT;
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              
C51 COMPILER V9.01   SH_IEC60730B_8051F_TESTPROC                                           10/11/2023 14:22:17 PAGE 3   

                  CLR_WDT();
              #endif
 107          
 108              /******** CHECK FLASH *********/
 109          #if SH_CHK_FLASH_EN == 1
*** WARNING C322 IN LINE 109 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  __iec60730b_flash_addr = SH_CHK_FLASH_START_ADDR;
                  if(sh_8051f_crc_code(SH_CHK_FLASH_START_ADDR,SH_CHK_FLASH_END_ADDR,MCU_CRC_FLASH) != __iec60730b_flash
             -_checksum)
                      checkResult = SH_CHK_FAIL_FLASH;                 
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              
                  CLR_WDT();
              #endif
 118          
 119              /******** CHECK EEPROM *********/
 120          #if SH_CHK_EE_EN == 1
*** WARNING C322 IN LINE 120 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  __iec60730b_ee1_addr = SH_CHK_EE1_START_ADDR;
                  __iec60730b_ee2_addr = SH_CHK_EE2_START_ADDR;
                  
                  sh_8051f_ee_readchecksum((SH_CHK_EE1_END_ADDR-2), (SHT_RESULT xdata *)&__iec60730b_ee1_checksum, 2);
                  if(sh_8051f_crc_code(SH_CHK_EE1_START_ADDR,SH_CHK_EE1_END_ADDR,MCU_CRC_EE) != __iec60730b_ee1_checksum
             -)
                      checkResult = SH_CHK_FAIL_EE;                 
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              
                  CLR_WDT();
                  
                  /******** CHECK EEPROM *********/
                  sh_8051f_ee_readchecksum((SH_CHK_EE2_END_ADDR-2), (SHT_RESULT xdata *)&__iec60730b_ee2_checksum, 2);
                  if(sh_8051f_crc_code(SH_CHK_EE2_START_ADDR,SH_CHK_EE2_END_ADDR,MCU_CRC_EE) != __iec60730b_ee2_checksum
             -)
                      checkResult = SH_CHK_FAIL_EE;                 
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              
                  CLR_WDT();
              #endif
 141          
 142              /******** STACK CHECK *********/
 143          #if SH_CHK_STACK_EN == 1
*** WARNING C322 IN LINE 143 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  sh_8051f_stack_init();
                  checkResult = sh_8051f_stack_test();      
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              #endif
 149              
 150              /********* CLOCK CHECK ********/
 151          #if SH_CHK_CLOCK_EN == 1
*** WARNING C322 IN LINE 151 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  {
                      SHT_U16 timeout = 0x8000;
                      sh_8051f_clk_init();              
                      __iec60730b_clk_limit_high = 0Xff00;
                      __iec60730b_clk_limit_low  = 1;
                      SH_CHK_CLOCK_TIMER_START();
                      while(timeout)
                      {
C51 COMPILER V9.01   SH_IEC60730B_8051F_TESTPROC                                           10/11/2023 14:22:17 PAGE 4   

                          EA = 0;
                          checkResult = sh_8051f_clk_check();
                          EA = 1;
                          if(checkResult != SH_CHK_FAIL_CLK_PROGRESS)
                              break;
                          timeout--;
                          CLR_WDT();
                      }
                      //CALCULATE CLOCK TOLERANCE RANGE
                      if(checkResult == SH_CHK_PASS)
                      {
                           SHT_U16 tmp = (__iec60730b_clk_context * SH_CHK_CLK_TOLERANCE) / 100;
                           __iec60730b_clk_limit_low  = __iec60730b_clk_context - tmp;
                           __iec60730b_clk_limit_high = __iec60730b_clk_context + tmp;
                      }
                  }
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              #endif
 179              CLR_WDT();
 180          
 181              /********** AIO CHECK ****************/
 182          #if SH_CHK_AIO_TEST_EN == 1
*** WARNING C322 IN LINE 182 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  __iec60730b_aio_state = SH_CHK_PASS;
                  checkResult = sh_8051f_aio_test();
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;
              #endif
 188              
 189              /********** DIO CHECK ****************/
 190          #if SH_CHK_DIO_TEST_EN == 1
*** WARNING C322 IN LINE 190 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                  checkResult = sh_8051f_dio_test();
                  if(checkResult != SH_CHK_PASS)
                      return checkResult;     
              #endif
 195              
 196              return checkResult;
 197          }
 198            
 199          SHT_RESULT sh_iec60730b_8051f_test_bist(void)
 200          {
 201              SHT_RESULT checkResult = SH_CHK_PASS;
 202          
 203              if((__iec60730b_bist_step >> 4) == 0)
 204              {/************** 0: CHECK CPU REGISTERS **************/        
 205          #if SH_CHK_CPU_EN == 1
*** WARNING C322 IN LINE 205 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      EA = 0;
                      switch(__iec60730b_bist_step&0x0F)
                      {
                          case 0:         
                              checkResult = sh_8051f_cpu_register1();
                          break;
                          case 1:         
                              checkResult = sh_8051f_cpu_register2();
                          break;
                      }
                      EA = 1;
                      __iec60730b_bist_step++;
                      if((__iec60730b_bist_step&0xF) >= 2)
C51 COMPILER V9.01   SH_IEC60730B_8051F_TESTPROC                                           10/11/2023 14:22:17 PAGE 5   

                      {
                          __iec60730b_bist_step = 0x10;
                      }
              #else
 223                  __iec60730b_bist_step = 0x10;
 224          #endif
 225              }    
 226              else if((__iec60730b_bist_step >> 4) == 1)
 227              {/************** 1: CHECK PROGRAM COUNTER **************/
 228          #if SH_CHK_PC_EN == 1
*** WARNING C322 IN LINE 228 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      EA = 0;
                      checkResult = sh_8051f_pc_test();
                      EA = 1;
              #endif
 233                  __iec60730b_bist_step = 0x20;
 234              }
 235              else if((__iec60730b_bist_step >> 4) == 2)
 236              {/************** 2: CHECK RAM ADDRESSING LINE **************/
 237          #if SH_CHK_ADDRLINE_TEST_EN == 1
*** WARNING C322 IN LINE 237 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      EA = 0;
                      if((__iec60730b_bist_step&0x0F) == 0)
                      {
                          checkResult = sh_8051f_addrline_data1();
                          __iec60730b_bist_step++;
                      }
                      else if((__iec60730b_bist_step&0x0F) == 1)
                      {
                          checkResult = sh_8051f_addrline_data2(); 
                          __iec60730b_bist_step++;
                      }
                      else if((__iec60730b_bist_step&0x0F) == 2)
                      {
                          checkResult = sh_8051f_addrline_xdata_runtime(); 
                          __iec60730b_bist_step++;
                      }
                      else
                          __iec60730b_bist_step = 0x30;
                      EA = 1;
              #else
 258                  __iec60730b_bist_step = 0x30;
 259          #endif
 260              }
 261              else if((__iec60730b_bist_step >> 4) == 3)
 262              {/************** 3: CHECK RAM **************/
 263          #if SH_CHK_XDATA_EN == 1
*** WARNING C322 IN LINE 263 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      EA = 0;
                      if((__iec60730b_bist_step&0x0F) == 0)
                      {
                          checkResult = sh_8051f_ram_data_runtime();
                          __iec60730b_bist_step++;
                      }
                      else if((__iec60730b_bist_step&0x0F) == 1)
                      {
                          checkResult = sh_8051f_ram_xdata_runtime(); 
                          __iec60730b_bist_step++;
                      }
                      else
                          __iec60730b_bist_step = 0x40;
                      EA = 1;
C51 COMPILER V9.01   SH_IEC60730B_8051F_TESTPROC                                           10/11/2023 14:22:17 PAGE 6   

              #else
 279                  __iec60730b_bist_step = 0x40;
 280          #endif
 281              }
 282          
 283              else if((__iec60730b_bist_step >> 4) == 4)
 284              {/************** 4: CHECK CODE ROM **************/
 285          #if SH_CHK_FLASH_EN == 1
*** WARNING C322 IN LINE 285 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      checkResult = sh_8051f_flash_runtime();
              #endif
 288                  __iec60730b_bist_step = 0x50;
 289              }
 290              else if((__iec60730b_bist_step >> 4) == 5)
 291              {/************** 5: CHECK STACK **************/
 292          #if SH_CHK_STACK_EN == 1
*** WARNING C322 IN LINE 292 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      checkResult = sh_8051f_stack_test();
              #endif
 295                  __iec60730b_bist_step = 0x60;
 296              }
 297              else if((__iec60730b_bist_step >> 4) == 6)
 298              {/************** 6: CHECK CLOCK **************/
 299          #if SH_CHK_CLOCK_EN == 1
*** WARNING C322 IN LINE 299 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      EA = 0;
                      checkResult = sh_8051f_clk_check();
                      EA = 1;
              #endif
 304                  __iec60730b_bist_step = 0x70;
 305              }
 306              else if((__iec60730b_bist_step >> 4) == 7)
 307              {/************** 7: CHECK AIO **************/
 308          #if SH_CHK_AIO_TEST_EN == 1
*** WARNING C322 IN LINE 308 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      checkResult = sh_8051f_aio_test_runtime();
              #endif
 311                  __iec60730b_bist_step = 0x80;
 312              }
 313              else if((__iec60730b_bist_step >> 4) == 8)
 314              {/************** 8: CHECK EEPROM1 **************/
 315          #if SH_CHK_EE_EN == 1
*** WARNING C322 IN LINE 315 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      checkResult = sh_8051f_ee1_runtime();
              #endif
 318                  __iec60730b_bist_step = 0x90;
 319              }
 320              else if((__iec60730b_bist_step >> 4) == 9)
 321              {/************** 8: CHECK EEPROM2 **************/
 322          #if SH_CHK_EE_EN == 1
*** WARNING C322 IN LINE 322 OF code_classb\iec60730_proc\sh_iec60730b_8051f_testproc.c: unknown identifier
                      checkResult = sh_8051f_ee2_runtime();
              #endif
 325                  __iec60730b_bist_step = 0x00;
 326              }
 327              return checkResult;    
 328          }

C51 COMPILATION COMPLETE.  23 WARNING(S),  1 ERROR(S)
