C51 COMPILER V9.54   CRC                                                                   04/27/2022 18:23:48 PAGE 1   


C51 COMPILER V9.54, COMPILATION OF MODULE CRC
OBJECT MODULE PLACED IN .\Objects\crc.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE source\crc.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\Listing
                    -s\crc.lst) TABS(2) OBJECT(.\Objects\crc.obj)

line level    source

   1          /*_____ I N C L U D E S _________________________________*/
   2          #include "crc.h"
   3          
   4          /*_____ F U N C T I O N S _______________________________*/
   5          
   6          /*_____ D E F I N I T I O N S ___________________________*/
   7          
   8          /*_____ D E C L A R A T I O N S _________________________*/
   9          uint8_t code *AddrprtCRCOption;
  10          
  11          /*_____ M A C R O S _____________________________________*/
  12          
  13          /**
  14           *  @Brief    Initialize CRC status
  15           *  @param    bMode, bRange
  16           *  @retval   None
  17           */
  18          void CRC_Initialization(uint8_t bMode, uint8_t bRange)
  19          {   
  20   1        /*  Initializes and configures the CRC function */
  21   1        CRCM = bMode | bRange | mskCRCM_ENABLE;
  22   1        CRCM |= mskCRCM_RESET;  
  23   1        AddrprtCRCOption = (uint8_t code *)&CRC_CHECK_DATA;
  24   1      }
  25          
  26          /**
  27           *  @Brief    Start to calculate CRC and return calculation result
  28           *  @param    None
  29           *  @retval   dbCrcResult
  30           */
  31          uint16_t CRC_ExecuteRnageCalculation(void)
  32          {
  33   1        uint16_t dbCrcResult;
  34   1        
  35   1        /*  Seed initialization and re-start calculation  */
  36   1        CRCM |= mskCRCM_RESET;                          
  37   1        CRCM |= mskCRCM_RUN;    
  38   1        
  39   1        /*  Check CRC calculation done  */
  40   1        while((CRCM & mskCRCM_BUSY)!=0);
  41   1        
  42   1        dbCrcResult = (CRCDATH << 8) | CRCDATL; 
  43   1        return dbCrcResult;
  44   1      }
  45          
  46          /**
  47           *  @Brief    Accumulate ROM by using one byte CRC calculation
  48           *            Instruction will be stop as CRC executing
  49           *  @param    *bptrData, dbLength
  50           *  @retval   CRCDAT
  51           */
  52          uint16_t CRC_ExecuteRomByteCalculation(uint8_t  code *bptrData, uint16_t dbLength)
  53          {
  54   1        uint16_t i;
C51 COMPILER V9.54   CRC                                                                   04/27/2022 18:23:48 PAGE 2   

  55   1        
  56   1        CRCM |= mskCRCM_RESET;    
  57   1        for(i = 0x0; i < dbLength; i++)
  58   1        {
  59   2          CRCDATL = *bptrData;
  60   2          while((CRCM & mskCRCM_BUSY)!=0);
  61   2          bptrData ++;
  62   2        }
  63   1        return ((CRCDATH << 8) | CRCDATL);
  64   1      }
  65          
  66          /**
  67           *  @Brief    Accumulate RAM by using one byte CRC calculation
  68           *            Instruction will be stop as CRC executing
  69           *  @param    *bDataBuf, dbLength
  70           *  @retval   CRCDAT
  71           */
  72          uint16_t CRC_ExecuteRamByteCalculation(uint8_t *bDataBuf, uint16_t dbLength)
  73          {
  74   1        uint16_t i;
  75   1        
  76   1        CRCM |= mskCRCM_RESET;    
  77   1        for(i = 0x0; i < dbLength; i++)
  78   1        {
  79   2          CRCDATL = *bDataBuf;
  80   2          while((CRCM & mskCRCM_BUSY)!=0);
  81   2          bDataBuf ++;
  82   2        }
  83   1        return ((CRCDATH << 8) | CRCDATL);
  84   1      }
  85          
  86          /**
  87           *  @Brief    Get Sonix tool CRC verify data from option file
  88           *  @param    None
  89           *  @retval   dbAppResult
  90           */
  91          uint16_t CRC_GetVerifyData(void)
  92          {
  93   1        uint16_t dbAppResult;
  94   1        dbAppResult = (*(AddrprtCRCOption+0)<<8) + *(AddrprtCRCOption+1);
  95   1        return dbAppResult;
  96   1      }
  97          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    165    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2       4
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
