C51 COMPILER V9.60.0.0   APP                                                               03/02/2021 14:02:58 PAGE 1   


C51 COMPILER V9.60.0.0, COMPILATION OF MODULE APP
OBJECT MODULE PLACED IN .\Out_Files\app.obj
COMPILER INVOKED BY: D:\Keil_C51\C51\BIN\C51.EXE APP\app.c COMPACT OMF2 OPTIMIZE(9,SIZE) BROWSE MOD517(NOAU) INCDIR(.\AP
                    -P;.\Common;.\UM800x\driver;.\UM800x\system) DEBUG PRINT(.\Out_Files\app.lst) OBJECT(.\Out_Files\app.obj)

line level    source

   1          /***********************************************************************
   2           * Copyright (c)  2017 - 2020, Unicmicro Co.,Ltd .
   3           * All rights reserved.
   4           * Filename    : app.c
   5           * Description : app driver source file
   6           * Author(s)   : wanyi
   7           * version     : V1.0
   8           * Modify date : 2020-07-27
   9           ***********************************************************************/
  10          #include  "system_um800x.h"
  11          #include  "app.h"
  12          #include  "config.h"
  13          #include  "common.h"
  14          #include  "uart0.h"
  15          #include  "eflash.h"
  16          
  17          volatile uint8_t rx_flag ;
  18          volatile uint8_t uart0_rx_buf[32];
  19          volatile uint8_t uart0_tx_buf[32];
  20          volatile uint16_t rx_count = 0;
  21          volatile uint16_t tx_count = 0;
  22          /************************************************************************
  23           * function   : uart0_rec_pro
  24           * Description: uart0_rec_pro 串口接收处理回调函数
  25           * input : none
  26           * return: none
  27           ************************************************************************/
  28          void uart0_rec_pro(void)
  29          {
  30   1              uart0_rx_buf[rx_count++]= uart0_recv_byte();
  31   1              rx_flag = 1;    
  32   1      }
  33          /************************************************************************
  34           * function   : uart0_send_pro
  35           * Description: uart0_send_pro 串口发送处理回调函数
  36           * input : none
  37           * return: none
  38           ************************************************************************/
  39          void uart0_send_pro(void)
  40          {
  41   1              tx_flag = 1;
  42   1      }
  43          
  44          /************************************************************************
  45           * function   : uart_init
  46           * Description: uart_init 串口初始化
  47           * input : none
  48           * return: none
  49           ************************************************************************/
  50          void uart_init(void)
  51          {
  52   1              rx_flag = 0;
  53   1              uart0_init(UART0_BAUD_RATE);
  54   1          uart0_irq_init(UART0_IRQ_ENABLE,uart0_rec_pro,uart0_send_pro);
C51 COMPILER V9.60.0.0   APP                                                               03/02/2021 14:02:58 PAGE 2   

  55   1      }
  56          
  57          
  58          void eflash_page_check_8bits(uint16_t base_addr,uint8_t w_val, uint8_t page)
  59          {
  60   1          uint16_t i;
  61   1          
  62   1          for(i = 0; i < PAGE_SIZE; i++)
  63   1          {
  64   2              eflash_write_byte(base_addr+page*PAGE_SIZE+i,w_val);
  65   2          }
  66   1          
  67   1          for(i = 0; i < PAGE_SIZE; i++)
  68   1          {
  69   2              if(eflash_read_byte(base_addr+page*PAGE_SIZE+i) != w_val)
  70   2              {
  71   3                  printf("Error: 8bit Read not equal write![0x%x]\n",(base_addr+page*PAGE_SIZE+i));
  72   3                  break;
  73   3              }
  74   2          }
  75   1      
  76   1      }
  77          void eflash_page_check_bytes(uint16_t base_addr,uint8_t w_val, uint32_t length)
  78          {
  79   1          uint32_t i;
  80   1       
  81   1          uint8_t  write_data[DATA_SIZE]={0};
  82   1          uint8_t  read_data[DATA_SIZE]={0};
  83   1          
  84   1          //多字节读写测试
  85   1          eflash_erase_page(base_addr);                                                               //页擦除
  86   1      
  87   1          for(i = 0; i < length; i++)
  88   1          {
  89   2              if(eflash_read_byte(base_addr+i) != 0xff)
  90   2              {
  91   3                      printf("Error: erase fail![0x%lx]\n",(base_addr+i));
  92   3                      break;
  93   3              }
  94   2          }   
  95   1          
  96   1          for(i=0;i<length;i++)
  97   1          {
  98   2              write_data[i] = w_val;                          
  99   2          }
 100   1          
 101   1          eflash_write_bytes(base_addr, write_data, length);                       //多字节写数据
 102   1              
 103   1              
 104   1         if(length == eflash_read_bytes(base_addr, read_data, length))             //多字节读    
 105   1         {
 106   2              for(i=0;i<length;i++)
 107   2              {
 108   3                  if(read_data[i] != w_val)
 109   3                  {
 110   4                      printf("Error: multibyte Read not equal Write![0x%x]\n",(base_addr+i));
 111   4                      break;
 112   4                  } 
 113   3      //            printf("read_data:[0x%bx]\n",read_data[i]);
 114   3              }          
 115   2         }
 116   1              
C51 COMPILER V9.60.0.0   APP                                                               03/02/2021 14:02:58 PAGE 3   

 117   1          
 118   1      }
 119          
 120          void eflash_page_check_byte(uint16_t base_addr, uint8_t start_page, uint8_t num_page)
 121          {
 122   1          uint16_t i;
 123   1          uint8_t page;
 124   1      
 125   1          //单字节读写测试
 126   1      
 127   1          for(page = start_page; page < num_page; page++)
 128   1          {
 129   2              eflash_erase_page(base_addr + page * PAGE_SIZE);                                                                //页擦除
 130   2              for(i = 0; i < PAGE_SIZE; i++)
 131   2              {
 132   3                  if(eflash_read_byte(base_addr+page*PAGE_SIZE+i) != 0xff)
 133   3                  {
 134   4                          printf("Error: erase fail![0x%lx]\n",(base_addr+page*PAGE_SIZE+i));
 135   4                          break;
 136   4                  }
 137   3              }       
 138   2              eflash_page_check_8bits(base_addr,0x55,page);                                   //单字节读写
 139   2          }
 140   1      
 141   1      
 142   1      }
 143          void eflash_test(void)
 144          {
 145   1              eflash_init(SystemCoreClock);
 146   1      
 147   1              /********MAIN区擦读写测试*********/
 148   1          //单字节读写测试
 149   1              printfS("0x1000- 0x1200 write and read by byte test start\r\n");
 150   1              eflash_page_check_byte(0x1000,0,1);
 151   1              printfS("0x1000- 0x1200 write and read by byte test end\r\n"); 
 152   1          
 153   1          //多字节读写测试
 154   1          printfS("0x1000 write and read by multi bytes test start\r\n");
 155   1          eflash_page_check_bytes(0x1000,0xa5,DATA_SIZE);                                          //多字节读写
 156   1              printfS("0x1000 write and read by multi bytes test end\r\n");
 157   1      
 158   1      
 159   1      }               


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    711    ----
   CONSTANT SIZE    =    352    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =     69      63
   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)
