📄 flash.lst
字号:
C51 COMPILER V8.16 FLASH 02/05/2010 12:14:15 PAGE 1
C51 COMPILER V8.16, COMPILATION OF MODULE FLASH
OBJECT MODULE PLACED IN flash.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE flash.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <c8051f310.h>
2 #include <intrins.h>
3 #include <string.h>
4 #include <stdio.h>
5 #include "bootloader.h"
6 #include "flash.h"
7 #include "xmodem.h"
8
9 /******************************************************************************
10 **函数功能:flash_c8051f310 PageEras
11 **入参: addr
12 **返回值: 无
13 **作者: jerkoh
14 **日期: 2009-03-16
15 **说明: c8051f310
16 ******************************************************************************/
17
18 void FLASH_PageErase (UINT addr)
19 {
20 1 bit EA_SAVE = EA; // preserve EA
21 1 UCHAR xdata * data pwrite; // FLASH write pointer
22 1
23 1 EA = 0; // disable interrupts
24 1
25 1 // change clock speed to slow, then restore later
26 1 VDM0CN = 0x80; // enable VDD monitor
27 1 RSTSRC = 0x02; // enable VDD monitor as a reset source
28 1 pwrite = (UCHAR xdata *) addr;
29 1 FLKEY = 0xA5; // Key Sequence 1
30 1 FLKEY = 0xF1; // Key Sequence 2
31 1 PSCTL |= 0x03; // PSWE = 1; PSEE = 1
32 1 VDM0CN = 0x80; // enable VDD monitor
33 1 RSTSRC = 0x02; // enable VDD monitor as a reset source
34 1 *pwrite = 0; // initiate page erase
35 1 PSCTL &= ~0x03; // PSWE = 0; PSEE = 0
36 1 EA = EA_SAVE; // restore interrupts
37 1 }
38 /******************************************************************************
39 **函数功能:flash_c8051f310 ByteWrite
40 **入参: addr
41 **返回值: 无
42 **作者: jerkoh
43 **日期: 2009-03-16
44 **说明: c8051f310
45 ******************************************************************************/
46 void FLASH_ByteWrite (UINT addr, UCHAR byte)
47 {
48 1 bit EA_SAVE = EA; // preserve EA
49 1 UCHAR xdata * data pwrite; // FLASH write pointer
50 1
51 1 EA = 0; // disable interrupts
52 1
53 1 // change clock speed to slow, then restore later
54 1 VDM0CN = 0x80; // enable VDD monitor
55 1 RSTSRC = 0x02; // enable VDD monitor as a reset source
C51 COMPILER V8.16 FLASH 02/05/2010 12:14:15 PAGE 2
56 1 pwrite = (UCHAR xdata *) addr;
57 1
58 1 FLKEY = 0xA5; // Key Sequence 1
59 1 FLKEY = 0xF1; // Key Sequence 2
60 1 PSCTL |= 0x01; // PSWE = 1
61 1 VDM0CN = 0x80; // enable VDD monitor
62 1 RSTSRC = 0x02; // enable VDD monitor as a reset source
63 1 *pwrite = byte; // write the byte
64 1 PSCTL &= ~0x01; // PSWE = 0
65 1 EA = EA_SAVE; // restore interrupts
66 1 }
67 /******************************************************************************
68 **函数功能:flash_c8051f310 PageRead
69 **入参: addr
70 **返回值: 无
71 **作者: jerkoh
72 **日期: 2009-03-16
73 **说明: c8051f310
74 ******************************************************************************/
75 UCHAR FLASH_PageRead(UINT addr)
76 {
77 1 bit EA_SAVE = EA; // preserve EA
78 1 UCHAR dat;
79 1 char code * data pread; // FLASH read pointer
80 1 EA = 0;
81 1
82 1 pread=(char code *)addr;
83 1 dat=*pread;
84 1 EA = EA_SAVE; // restore interrupts
85 1 return dat;
86 1 }
87
88 /***********************(C) COPYRIGHT 2009 SKsystem***************************/
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 116 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 6
IDATA SIZE = ---- ----
BIT SIZE = ---- 3
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -