?? flash.lst
字號:
C51 COMPILER V6.20c FLASH 11/28/2002 23:26:59 PAGE 1
C51 COMPILER V6.20c, COMPILATION OF MODULE FLASH
OBJECT MODULE PLACED IN FLASH.OBJ
COMPILER INVOKED BY: E:\WIN98\HARDWARE\KEIL620\C51\BIN\C51.EXE FLASH.C DB OE SMALL ROM(LARGE)
stmt level source
1
2 #include "FLASH.H"
3 #include "HAL.H"
4 #include "USBD12.H"
5 #include "VDOR.H"
6
7 extern unsigned char idata GenBuf[GENBUF_LENGH];
8 extern CODE_DATA idata CodeData;
9
10 void FlashDisableSDP(void)
11 {
12 1 // 1st command
13 1 outportb(0x5555, 0xaa);
14 1 // 2nd command
15 1 outportb(0x2aaa, 0x55);
16 1 // 3th command
17 1 outportb(0x5555, 0x80);
18 1 // 4th command
19 1 outportb(0x5555, 0xaa);
20 1 // 5th command
21 1 outportb(0x2aaa, 0x55);
22 1 // 6th command
23 1 outportb(0x5555, 0x20);
24 1 }
25
26 void FlashGetSPMI(unsigned char nMID, unsigned char nDID)
27 {
28 1 ENABLE_FLASH;
29 1
30 1 // 1st command
31 1 outportb(0x5555, 0xaa);
32 1 // 2nd command
33 1 outportb(0x2aaa, 0x55);
34 1 // 3th command
35 1 outportb(0x5555, 0x90);
36 1 // Pause 10 ms
37 1 DelayMs(10);
38 1 // Get manufaturer code
39 1 nMID = inportb(0);
40 1 // Get device ID code
41 1 nDID = inportb(1);
42 1 // 4th command
43 1 outportb(0x5555, 0xaa);
44 1 // 5th command
45 1 outportb(0x2aaa, 0x55);
46 1 // 6th command
47 1 outportb(0x5555, 0xf0);
48 1 // Pause 10 ms
49 1 DelayMs(10);
50 1
51 1 DISABLE_FLASH;
52 1 }
53
54 void FlashCHipErase(void)
55 {
C51 COMPILER V6.20c FLASH 11/28/2002 23:26:59 PAGE 2
56 1 DISABLE_FLASH;
57 1 // Pause
58 1 Delay(10);
59 1 // 1st 0xaa -> 0x5555
60 1 ENABLE_FLASH;
61 1 outportb(0x5555, 0xaa);
62 1 DISABLE_FLASH;
63 1 // 2nd 0x55 -> 0x2aaa
64 1 ENABLE_FLASH;
65 1 outportb(0x2aaa, 0x55);
66 1 DISABLE_FLASH;
67 1 // 3rd 0x80 -> 0x5555
68 1 ENABLE_FLASH;
69 1 outportb(0x5555, 0x80);
70 1 DISABLE_FLASH;
71 1 // 4th 0xaa -> 0x5555
72 1 ENABLE_FLASH;
73 1 outportb(0x5555, 0xaa);
74 1 DISABLE_FLASH;
75 1 // 5th 0x55 -> 0x2aaa
76 1 ENABLE_FLASH;
77 1 outportb(0x2aaa, 0x55);
78 1 DISABLE_FLASH;
79 1 // 6th 0x10 -> 0x5555
80 1 ENABLE_FLASH;
81 1 outportb(0x5555, 0x10);
82 1 DISABLE_FLASH;
83 1 // Pause 20 ms
84 1 DelayMs(20);
85 1 }
86
87 unsigned char FlashWrite(unsigned char idata* pSrc, unsigned char xdata* pDst, unsigned char nLen)
88 {
89 1 unsigned char i, j;
90 1
91 1 // performs 3 steps of SDP sequence
92 1 // 1st 0xaa -> 0x5555
93 1 ENABLE_FLASH;
94 1 outportb(0x5555, 0xaa);
95 1 DISABLE_FLASH;
96 1 // 2nd 0x55 -> 0x2aaa
97 1 ENABLE_FLASH;
98 1 outportb(0x2aaa, 0x55);
99 1 DISABLE_FLASH;
100 1 // 3rd 0xa0 -> 0x05555
101 1 ENABLE_FLASH;
102 1 outportb(0x5555, 0xa0);
103 1 DISABLE_FLASH;
104 1
105 1 // First, Write every bytes in GenBuf to the flash
106 1 for(i=0; i<nLen; i++)
107 1 {
108 2 ENABLE_FLASH;
109 2 outportb(pDst + i, *(pSrc + i));
110 2 DISABLE_FLASH;
111 2 }
112 1
113 1 // Pause 20 ms for programming cycle
114 1 DelayMs(200);
115 1
116 1 return j;
117 1 }
C51 COMPILER V6.20c FLASH 11/28/2002 23:26:59 PAGE 3
118
119 void FlashRead(unsigned char xdata* pSrc, unsigned char idata* pDst, unsigned char nLen)
120 {
121 1 unsigned char i;
122 1
123 1 ENABLE_FLASH;
124 1 for(i=0; i<nLen; i++)
125 1 *(pDst + i) = inportb(pSrc + i);
126 1
127 1 DISABLE_FLASH;
128 1
129 1 }
130
131
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 425 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 11
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -