FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/services/ffs/intelsbdrv.c @ 1007:3bfeee466b0a
gsm-fw feature tch-reroute: downlink sending implemented
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 20 Mar 2016 19:31:39 +0000 |
parents | 51f580665110 |
children |
rev | line source |
---|---|
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /****************************************************************************** |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * Flash File System (ffs) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * FFS AMD single bank low level flash driver RAM code |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * $Id: intelsbdrv.c 1.13 Thu, 08 Jan 2004 15:05:23 +0100 tsj $ |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 * |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 ******************************************************************************/ |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
11 #include "../../include/config.h" |
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
12 #include "ffs.h" |
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
13 #include "drv.h" |
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
14 #include "ffstrace.h" |
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
15 #include "intctl.h" |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
944
51f580665110
gsm-fw: C139 works with non-volatile FFS enabled
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
939
diff
changeset
|
17 #define INTEL_UNLOCK_SLOW 1 |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 #undef tlw |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 #define tlw(contents) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 #undef ttw |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 #define ttw(contents) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 // Status bits for Intel flash memory devices |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 #define INTEL_STATE_MACHINE_DONE (1<<7) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 #define FLASH_READ(addr) (*(volatile uint16 *) (addr)) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 #define FLASH_WRITE(addr, data) (*(volatile uint16 *) (addr)) = data |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 /****************************************************************************** |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 * INTEL Single Bank Driver Functions |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 ******************************************************************************/ |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 // Actually we should have disabled and enable the interrupts in this |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 // function, but when the interrupt functions are used Target don't run! |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 // Anyway, currently the interrupts are already disabled at this point thus |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 // it does not cause any problems. |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 int ffsdrv_ram_intel_sb_init(void) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 { |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
38 uint32 i; |
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
39 volatile uint16 *addr; |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 for (i = 0; i < dev.numblocks; i++) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 { |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
43 addr = (volatile uint16 *) block2addr(i); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 *addr = 0x60; // Intel Config Setup |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 *addr = 0xD0; // Intel Unlock Block |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
48 *addr = 0xFF; // Intel Read Array |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 } |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 return 0; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 } |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 void ffsdrv_ram_intel_sb_write_halfword(volatile uint16 *addr, uint16 value) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 { |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 uint32 cpsr; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 ttw(ttr(TTrDrv, "wh(%x,%x)" NL, addr, value)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 if (~*addr & value) { |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 ttw(ttr(TTrFatal, "wh(%x,%x->%x) fatal" NL, addr, *addr, value)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 return; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 } |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
65 cpsr = int_disable(); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 tlw(led_on(LED_WRITE)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 #if (INTEL_UNLOCK_SLOW == 1) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 *addr = 0x60; // Intel Config Setup |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 *addr = 0xD0; // Intel Unlock Block |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 #endif |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 *addr = 0x50; // Intel Clear Status Register |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 *addr = 0x40; // Intel program byte/word |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 *addr = value; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 while ((*addr & 0x80) == 0) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 ; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 *addr = 0xFF; // Intel read array |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 tlw(led_off(LED_WRITE)); |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
80 int_enable(cpsr); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 } |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 void ffsdrv_ram_intel_sb_erase(uint8 block) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 { |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
85 volatile uint16 *addr; |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 uint32 cpsr; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 uint16 poll; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 ttw(ttr(TTrDrvEra, "e(%d)" NL, block)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
91 addr = (volatile uint16 *) block2addr(block); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
93 cpsr = int_disable(); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 tlw(led_on(LED_ERASE)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 #if (INTEL_UNLOCK_SLOW == 1) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 *addr = 0x60; // Intel Config Setup |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 *addr = 0xD0; // Intel Unlock Block |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 #endif |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 *addr = 0x50; // Intel Clear Status Register |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 *addr = 0x20; // Intel Erase Setup |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 *addr = 0xD0; // Intel Erase Confirm |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
104 *addr = 0x70; // Intel Read Status Register |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 // Wait for erase to finish. |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 while ((*addr & 0x80) == 0) { |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 tlw(led_toggle(LED_ERASE)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 // Poll interrupts, taking interrupt mask into account. |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 if (INT_REQUESTED) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 { |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 // 1. suspend erase |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 // 2. enable interrupts |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 // .. now the interrupt code executes |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 // 3. disable interrupts |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 // 4. resume erase |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 tlw(led_on(LED_ERASE_SUSPEND)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 *addr = 0xB0; // Intel Erase Suspend |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 *addr = 0x70; // Intel Read Status Register |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 while (((poll = *addr) & 0x80) == 0) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 ; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 // If erase is complete, exit immediately |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 if ((poll & 0x40) == 0) |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 break; |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 *addr = 0xFF; // Intel read array |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 tlw(led_off(LED_ERASE_SUSPEND)); |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
132 int_enable(cpsr); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 // Other interrupts and tasks run now... |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
136 cpsr = int_disable(); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 tlw(led_on(LED_ERASE_SUSPEND)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 *addr = 0xD0; // Intel erase resume |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 // The following "extra" Read Status command is required because Intel has |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 // changed the specification of the W30 flash! (See "1.8 Volt Intel® |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 // Wireless Flash Memory with 3 Volt I/O 28F6408W30, 28F640W30, 28F320W30 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 // Specification Update") |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
144 *addr = 0x70; // Intel Read Status Register |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 tlw(led_off(LED_ERASE_SUSPEND)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 } |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 } |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 *addr = 0xFF; // Intel read array |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 tlw(led_on(LED_ERASE)); |
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 tlw(led_off(LED_ERASE)); |
939
62ca61292b77
gsm-fw: Intel single bank flash driver (Compal) compiles and links
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
938
diff
changeset
|
153 int_enable(cpsr); |
938
1db4da08b9b4
gsm-fw/services/ffs/intelsbdrv.c: initial import from TCS211 source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 } |