C51 COMPILER V9.60.0.0   SYSTEM_UM800X                                                     07/13/2023 13:28:43 PAGE 1   


C51 COMPILER V9.60.0.0, COMPILATION OF MODULE SYSTEM_UM800X
OBJECT MODULE PLACED IN .\Out_Files\system_um800x.obj
COMPILER INVOKED BY: D:\Keil_V5\UV4\C51\BIN\C51.EXE UM800x\system\system_um800x.c LARGE OMF2 OPTIMIZE(8,SIZE) BROWSE INC
                    -DIR(.\APP;.\Common;.\UM800x\driver;.\UM800x\system) DEBUG PRINT(.\Out_Files\system_um800x.lst) OBJECT(.\Out_Files\system
                    -_um800x.obj)

line level    source

   1          /***********************************************************************
   2           * Copyright (c)  2017 - 2020, Unicmicro Co.,Ltd .
   3           * All rights reserved.
   4           * Filename    : system_um800x.c
   5           * Description : system config source file (for example: clock config.....)
   6           * Author(s)   : Dan
   7           * version     : V1.0
   8           * Modify date : 2020-07-16
   9           ***********************************************************************/
  10           
  11          #include  "system_um800x.h"
  12          #include  "config.h"
  13          
  14          uint32_t SRCClock = 48000000;   //RCH源时钟 , (uint:Hz)
  15          
  16          volatile uint32_t SystemCoreClock = 0;                          //core时钟 , (uint:Hz)
  17          volatile uint32_t xdata rch24m = 0;
  18          
  19          /************************************************************************
  20           * function   : clock_init
  21           * Description: clock init, initil several clock variables
  22           * input : 
  23           *                uint32_t system_clk_hz
  24           * return: none
  25           ************************************************************************/
  26          void clock_init(uint32_t system_clk_hz)
  27          {
  28   1          uint32_t crystal_clk = 0;    
  29   1          
  30   1          CLKCON |= (0x1<<2);                                         //RCH时钟源打开
  31   1          while((CLKCON&0x20) != 0x20);                       //等待RC16M时钟稳定
  32   1      
  33   1      
  34   1          rch24m = ((uint32_t)(*(volatile uint8_t xdata*)(0x9037))<<24) |  \
  35   1               ((uint32_t)(*(volatile uint8_t xdata*)(0x9036))<<16) |  \
  36   1               ((uint32_t)(*(volatile uint8_t xdata*)(0x9035))<<8)  |  \
  37   1                (uint32_t)(*(volatile uint8_t xdata*)(0x9034));   
  38   1              
  39   1          if ((rch24m <= 24120000) && (rch24m >= 23880000))
  40   1          {
  41   2              crystal_clk = SRCClock;        
  42   2          }
  43   1          else if(rch24m == 0xffffffff)  
  44   1          {
  45   2              crystal_clk = SRCClock;   
  46   2          }
  47   1          else            //如果实际值在24M的千分之五以外，用实际值
  48   1          {
  49   2              crystal_clk = rch24m*2; 
  50   2          }  
  51   1          switch(system_clk_hz)
  52   1          {
  53   2              case 24000000:
C51 COMPILER V9.60.0.0   SYSTEM_UM800X                                                     07/13/2023 13:28:43 PAGE 2   

  54   2                  RCHDIV = 0x1;                               //RCH 2分频
  55   2                  SystemCoreClock = crystal_clk/2;
  56   2                              OPSET |=(0x1<<3);   //flash读等待时间为1
  57   2                  break;
  58   2              case 16000000:
  59   2                  RCHDIV = 0x2;                               //RCH 3分频
  60   2                  SystemCoreClock = crystal_clk/3;
  61   2                  break;
  62   2              case 12000000:
  63   2                  RCHDIV = 0x3;                               //RCH 4分频
  64   2                  SystemCoreClock = crystal_clk/4;
  65   2                  break;
  66   2              default:
  67   2                  RCHDIV = 0x2;                               //RCH 3分频
  68   2                  SystemCoreClock = crystal_clk/3;
  69   2                  break;
  70   2             
  71   2          }
  72   1                              
  73   1          CLKCON &= ~(0x1<<0);                                        //RCH为系统时钟
  74   1              SYSDIV &= ~(7<<0);                                              //系统时钟不分频        
  75   1      }
  76          
  77          /************************************************************************
  78           * function   : systeminit
  79           * Description: systeminit
  80           * input : none
  81           * return: none
  82           ************************************************************************/
  83          void systeminit(void)
  84          {
  85   1          clock_init(FCLK); 
  86   1      }
  87          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    338    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =     12       8
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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