annotate packages/devs/flash/intel/stratav2/current/include/flash_strata_v2.inl @ 1754:6a1e54eaaac8

Update following changes to the flash device driver interface
author bartv
date Mon, 22 Nov 2004 20:17:05 +0000
parents 80232dbac7fb
children af5ce7899d45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
1 #ifndef CYGONCE_DEVS_FLASH_STRATA_V2_INL
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
2 #define CYGONCE_DEVS_FLASH_STRATA_V2_INL
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
3 //==========================================================================
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
4 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
5 // flash_strata.inl
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
6 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
7 // Flash programming for the Strata device
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
8 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
9 //==========================================================================
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
10 //####ECOSGPLCOPYRIGHTBEGIN####
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
11 // -------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
12 // This file is part of eCos, the Embedded Configurable Operating System.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
14 // Copyright (C) 2004 Andrew Lunn
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
15 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
16 // eCos is free software; you can redistribute it and/or modify it under
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
17 // the terms of the GNU General Public License as published by the Free
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
18 // Software Foundation; either version 2 or (at your option) any later version.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
19 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
23 // for more details.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
24 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
25 // You should have received a copy of the GNU General Public License along
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
28 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
29 // As a special exception, if other files instantiate templates or use macros
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
30 // or inline functions from this file, or you compile this file and link it
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
31 // with other works to produce a work based on this file, this file does not
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
32 // by itself cause the resulting work to be covered by the GNU General Public
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
33 // License. However the source code for this file must still be made available
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
34 // in accordance with section (3) of the GNU General Public License.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
35 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
36 // This exception does not invalidate any other reasons why a work based on
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
37 // this file might be covered by the GNU General Public License.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
38 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
40 // at http://sources.redhat.com/ecos/ecos-license/
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
41 // -------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
42 //####ECOSGPLCOPYRIGHTEND####
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
43 //==========================================================================
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
44 //#####DESCRIPTIONBEGIN####
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
45 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
46 // Author(s): gthomas, hmt
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
47 // Contributors: gthomas, asl
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
48 // Date: 2001-02-14
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
49 // Purpose:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
50 // Description:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
51 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
52 //####DESCRIPTIONEND####
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
53 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
54 //==========================================================================
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
55
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
56 #include <pkgconf/system.h>
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
57 #include <pkgconf/devs_flash_strata_v2.h>
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
58 #include <pkgconf/hal.h>
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
59 #include <cyg/hal/hal_arch.h>
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
60
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
61 #define _FLASH_PRIVATE_
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
62 #include <cyg/io/flash.h>
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
63 #include <cyg/io/strata_v2_priv.h>
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
64
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
65 #define _si(p) ((p[1]<<8)|p[0])
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
66
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
67 #ifdef CYGOPT_DEV_FLASH_STATE_V2_DUMP_UNKNOWN
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
68 extern void diag_dump_buf(void *buf, CYG_ADDRWORD len);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
69 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
70 extern int strncmp(const char *s1, const char *s2, size_t len);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
71 extern void *memcpy( void *, const void *, size_t );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
72
1726
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
73 // Platforms may define these for special handling when accessing the
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
74 // query data or write buffer .
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
75 #ifndef CYGHWR_FLASH_READ_QUERY
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
76 #define CYGHWR_FLASH_READ_QUERY(a) (*(a))
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
77 #endif
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
78 #ifndef CYGHWR_FLASH_WRITE_BUF
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
79 #define CYGHWR_FLASH_WRITE_BUF(a,b) (*(a) = *(b))
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
80 #endif
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
81
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
82
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
83
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
84 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
85 // Functions that put the flash device into non-read mode must reside
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
86 // in RAM.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
87 static size_t
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
88 strata_query_hwr (struct cyg_flash_dev *dev, void * data,
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
89 size_t len)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
90 __attribute__ ((section (".2ram.flash_query")));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
91
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
92 static int strata_erase_block (struct cyg_flash_dev *dev,
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
93 cyg_flashaddr_t block)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
94 __attribute__ ((section (".2ram.flash_erase_block")));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
95
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
96 static int strata_program_buf (struct cyg_flash_dev *dev,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
97 cyg_flashaddr_t base,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
98 const void* data,
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
99 size_t len)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
100 __attribute__ ((section (".2ram.flash_program_buf")));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
101
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
102 #ifdef CYGOPT_DEVS_FLASH_STRATA_V2_LOCKING
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
103 static int strata_unlock_block(struct cyg_flash_dev *dev,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
104 const cyg_flashaddr_t block_base)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
105 __attribute__ ((section (".2ram.flash_unlock_block")));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
106
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
107 static int strata_lock_block(struct cyg_flash_dev *dev,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
108 const cyg_flashaddr_t block_base)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
109 __attribute__ ((section (".2ram.flash_lock_block")));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
110 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
111
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
112 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
113 // Private structure used by the device.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
114 struct cyg_flash_strata_v2_priv {
1749
80232dbac7fb Flash API clean-ups
bartv
parents: 1726
diff changeset
115 cyg_flash_block_info_t block_info [1];
80232dbac7fb Flash API clean-ups
bartv
parents: 1726
diff changeset
116 unsigned int buffer_size; // Size of write buffer
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
117 };
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
118 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
119
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
120 static int
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
121 strata_init (struct cyg_flash_dev *dev)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
122 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
123 struct FLASH_query data, *qp;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
124 int num_regions, region_size, buffer_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
125 struct cyg_flash_strata_v2_priv *priv = dev->priv;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
126
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
127 dev->funs->flash_query(dev, &data, sizeof(data));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
128 qp = &data;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
129 if ( ((qp->manuf_code == FLASH_Intel_code) ||
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
130 (qp->manuf_code == FLASH_STMicro_code))
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
131 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
132 // device types go as follows: 0x90 for 16-bits, 0xD0 for 8-bits,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
133 // plus 0 or 1 for -T (Top Boot) or -B (Bottom Boot)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
134 // [FIXME: whatever that means :FIXME]
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
135 // [I think it means the boot blocks are top/bottom of addr space]
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
136 // plus the following size codes:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
137 // 0: 16Mbit 2: 8Mbit 4: 4Mbit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
138 // 6: 32Mbit 8: 64Mbit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
139 #if 16 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
140 && (0x90 == (0xF0 & qp->device_code)) // 16-bit devices
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
141 #elif 8 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
142 && (0xD0 == (0xF0 & qp->device_code)) // 8-bit devices
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
143 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
144 && 0
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
145 #error Only understand 16 and 8-bit bootblock flash types
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
146 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
147 ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
148 int lookup[] = { 16, 8, 4, 32, 64 };
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
149 #define BLOCKSIZE (0x10000)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
150 region_size = BLOCKSIZE;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
151 num_regions = qp->device_code & 0x0F;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
152 num_regions >>= 1;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
153 if ( num_regions > 4 )
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
154 goto flash_type_unknown;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
155 num_regions = lookup[num_regions];
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
156 num_regions *= 1024 * 1024; // to bits
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
157 num_regions /= 8; // to bytes
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
158 num_regions /= BLOCKSIZE; // to blocks
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
159 buffer_size = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
160 #else // CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
161 && (strncmp(qp->id, "QRY", 3) == 0)) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
162 num_regions = _si(qp->num_regions)+1;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
163 region_size = _si(qp->region_size)*256;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
164 if (_si(qp->buffer_size)) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
165 buffer_size = CYGNUM_FLASH_INTERLEAVE << _si(qp->buffer_size);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
166 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
167 buffer_size = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
168 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
169 #endif // Not CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
170
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
171 dev->end = dev->start +
1726
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
172 (num_regions*region_size*CYGNUM_FLASH_INTERLEAVE) -1;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
173 priv->buffer_size = buffer_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
174 priv->block_info[0].blocks = num_regions;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
175 priv->block_info[0].block_size = region_size * CYGNUM_FLASH_INTERLEAVE;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
176 dev->block_info = priv->block_info;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
177 dev->num_block_infos = 1;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
178
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
179 #ifdef CYGNUM_FLASH_BASE_MASK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
180 // Then this gives us a maximum size for the (visible) device.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
181 // This is to cope with oversize devices fitted, with some high
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
182 // address lines ignored.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
183 if ( (dev->start & CYGNUM_FLASH_BASE_MASK) !=
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
184 ((dev->end - 1) & CYGNUM_FLASH_BASE_MASK ) ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
185 // then the size of the device appears to span >1 device-worth!
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
186 unsigned int x;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
187 x = (~(CYGNUM_FLASH_BASE_MASK)) + 1; // expected device size
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
188 x += (unsigned int)dev->start;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
189 if ( x < (unsigned int)dev->end ) { // 2nd sanity check
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
190 (dev->pf)("\nFLASH: Oversized device! End addr %p changed to %p\n",
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
191 dev->end, (void *)x );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
192 dev->end = x;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
193 // Also adjust the block count else unlock crashes!
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
194 x = ((cyg_uint8 *)dev->end - (cyg_uint8 *)dev->start)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
195 / priv->block_info[0].block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
196 priv->block_info[0].blocks = x;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
197 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
198 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
199 #endif // CYGNUM_FLASH_BASE_MASK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
200
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
201 return CYG_FLASH_ERR_OK;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
202 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
203 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
204 flash_type_unknown:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
205 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
206 #ifdef CYGOPT_DEV_FLASH_STATE_V2_DUMP_UNKNOWN
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
207 (dev->pf)("Can't identify FLASH, sorry, man %x, dev %x, id [%4s] \n",
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
208 qp->manuf_code, qp->device_code, qp->id );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
209 diag_dump_buf(qp, sizeof(data));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
210 #endif
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
211 return CYG_FLASH_ERR_HWR;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
212 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
213
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
214 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
215 // Map a hardware status to a package error
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
216 static int strata_hwr_map_error (struct cyg_flash_dev *dev, int err)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
217 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
218 if (err & FLASH_ErrorMask) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
219 (dev->pf)("Err = %x\n", err);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
220 if (err & FLASH_ErrorProgram)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
221 return CYG_FLASH_ERR_PROGRAM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
222 else if (err & FLASH_ErrorErase)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
223 return CYG_FLASH_ERR_ERASE;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
224 else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
225 return CYG_FLASH_ERR_HWR; // FIXME
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
226 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
227 return CYG_FLASH_ERR_OK;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
228 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
229 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
230
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
231 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
232 #define CNT 20*1000*10 // Approx 20ms
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
233
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
234 static size_t
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
235 strata_query_hwr (struct cyg_flash_dev *dev, void *data_dst, size_t len)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
236 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
237 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
238 int i, cnt;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
239 unsigned char *data = (unsigned char *)data_dst;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
240
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
241 // Get base address and map addresses to virtual addresses
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
242 ROM = FLASH_P2V( dev->start );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
243 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
244 // BootBlock flash does not support full Read_Query - we have do a
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
245 // table oriented thing above, after getting just two bytes of results:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
246 ROM[0] = FLASH_Read_ID;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
247 i = 2;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
248 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
249 // StrataFlash supports the full Read_Query op:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
250 ROM[0] = FLASH_Read_Query;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
251 i = sizeof(struct FLASH_query);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
252 #endif // Not CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
253
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
254 for (cnt = CNT; cnt > 0; cnt--) ;
1726
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
255 for ( /* i */; i > 0; i--, ++ROM ) {
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
256 // It is very deliberate that data is chars NOT flash_t:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
257 // The info comes out in bytes regardless of device.
1726
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
258 *data++ = (unsigned char) CYGHWR_FLASH_READ_QUERY(ROM);
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
259 #ifndef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
260 # if 8 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
261 // strata flash with 'byte-enable' contains the configuration data
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
262 // at even addresses
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
263 ++ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
264 # endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
265 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
266 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
267 ROM[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
268
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
269 return 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
270 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
271
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
272
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
273 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
274 static int strata_erase_block (struct cyg_flash_dev *dev,
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
275 cyg_flashaddr_t block_base)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
276 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
277 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
278 flash_t stat = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
279 int timeout = 50000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
280 int len, block_len, erase_block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
281 volatile flash_t *eb, *block;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
282
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
283 // Get base address and map addresses to virtual addresses
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
284 ROM = FLASH_P2V(dev->start);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
285 eb = block = FLASH_P2V(block_base);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
286 block_len = dev->block_info[0].block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
287
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
288 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
289 #define BLOCKSIZE (0x10000*CYGNUM_FLASH_INTERLEAVE)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
290 #define ERASE_BLOCKSIZE (0x2000*CYGNUM_FLASH_INTERLEAVE)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
291 if ((eb - ROM) < BLOCKSIZE/(sizeof eb[0])) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
292 erase_block_size = ERASE_BLOCKSIZE;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
293 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
294 erase_block_size = block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
295 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
296 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
297 erase_block_size = dev->block_info[0].block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
298 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
299
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
300 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
301 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
302
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
303 // Erase block
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
304 while (block_len > 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
305 eb[0] = FLASH_Block_Erase;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
306 eb[0] = FLASH_Confirm;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
307
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
308 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
309 while(((stat = eb[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
310 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
311 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
312
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
313 block_len -= erase_block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
314 eb = FLASH_P2V((unsigned int)eb + erase_block_size);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
315 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
316
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
317 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
318 ROM[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
319
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
320 // If an error was reported, see if the block erased anyway
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
321 if (stat & FLASH_ErrorMask ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
322 len = dev->block_info[0].block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
323 while (len > 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
324 if (*block++ != FLASH_BlankValue ) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
325 len -= sizeof(*block);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
326 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
327 if (len == 0) stat = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
328 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
329
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
330 return stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
331 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
332
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
333 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
334 static int
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
335 strata_program_buf (struct cyg_flash_dev *dev,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
336 cyg_flashaddr_t base_addr,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
337 const void* data_addr,
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
338 size_t total_len)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
339 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
340 struct cyg_flash_strata_v2_priv *priv = dev->priv;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
341 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
342 volatile flash_t *BA, *addr;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
343 flash_t * data = (flash_t *)data_addr;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
344 flash_t stat = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
345 int timeout = 50000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
346 int len = total_len;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
347
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
348 #ifdef FLASH_Write_Buffer
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
349 int i, wc;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
350 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
351
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
352 // Get base address and map addresses to virtual addresses
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
353 ROM = FLASH_P2V( dev->start );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
354 BA = addr = FLASH_P2V(base_addr);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
355
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
356 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
357 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
358
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
359 #ifdef FLASH_Write_Buffer
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
360 // Write any big chunks first
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
361 while (len >= priv->buffer_size) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
362 wc = priv->buffer_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
363 if (wc > len) wc = len;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
364 len -= wc;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
365 // convert 'wc' in bytes to 'wc' in 'flash_t'
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
366 wc = wc / sizeof(flash_t); // Word count
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
367 *BA = FLASH_Write_Buffer;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
368 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
369 while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
370 if (--timeout == 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
371 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
372 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
373 *BA = FLASH_Write_Buffer;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
374 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
375 *BA = FLASHWORD(wc-1); // Count is 0..N-1
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
376 for (i = 0; i < wc; i++) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
377 #ifdef CYGHWR_FLASH_WRITE_ELEM
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
378 CYGHWR_FLASH_WRITE_ELEM(addr+i, data+i);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
379 #else
1726
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
380 CYGHWR_FLASH_WRITE_BUF(addr+i, data+i);
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
381 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
382 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
383 *BA = FLASH_Confirm;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
384
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
385 ROM[0] = FLASH_Read_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
386 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
387 while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
388 if (--timeout == 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
389 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
390 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
391 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
392 // Jump out if there was an error
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
393 if (stat & FLASH_ErrorMask) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
394 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
395 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
396 // And verify the data - also increments the pointers.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
397 *BA = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
398 for (i = 0; i < wc; i++) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
399 if ( *addr++ != *data++ ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
400 stat = FLASH_ErrorNotVerified;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
401 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
402 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
403 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
404 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
405 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
406
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
407 while (len > 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
408 BA[0] = FLASH_Program;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
409 #ifdef CYGHWR_FLASH_WRITE_ELEM
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
410 CYGHWR_FLASH_WRITE_ELEM(addr, data);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
411 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
412 *addr = *data;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
413 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
414 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
415 while(((stat = BA[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
416 if (--timeout == 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
417 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
418 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
419 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
420 if (stat & FLASH_ErrorMask) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
421 break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
422 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
423 BA[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
424 if (*addr++ != *data++) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
425 stat = FLASH_ErrorNotVerified;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
426 break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
427 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
428 len -= sizeof( flash_t );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
429 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
430
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
431 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
432 bad:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
433 BA[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
434
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
435 return stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
436 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
437
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
438 #ifdef CYGOPT_DEVS_FLASH_STRATA_V2_LOCKING
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
439 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
440 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
441 // The difficulty with this operation is that the hardware does not support
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
442 // unlocking single blocks. However, the logical layer would like this to
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
443 // be the case, so this routine emulates it. The hardware can clear all of
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
444 // the locks in the device at once. This routine will use that approach and
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
445 // then reset the regions which are known to be locked.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
446 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
447
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
448 #define FLASH_LOCK_MASK 0x1 // which bit of the read query has the lock bit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
449
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
450 static int
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
451 strata_unlock_block(struct cyg_flash_dev *dev,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
452 const cyg_flashaddr_t block_base)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
453 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
454 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
455 flash_t stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
456 int timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
457 #ifndef CYGOPT_FLASH_IS_SYNCHRONOUS
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
458 int i;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
459 volatile flash_t *bp, *bpv, *block;
1718
c8515e560548 2004-08-21 Andrew Lunn <andrew.lunn@ascom.ch>
asl
parents: 1716
diff changeset
460 unsigned char is_locked[CYGNUM_DEVS_FLASH_STRATA_V2_MAX_BLOCKS];
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
461 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
462
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
463 // Get base address and map addresses to virtual addresses
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
464 ROM = FLASH_P2V( dev->start );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
465 block = FLASH_P2V(block_base);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
466
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
467 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
468 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
469
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
470 #ifdef CYGOPT_FLASH_IS_SYNCHRONOUS
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
471 // Clear lock bit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
472 block[0] = FLASH_Clear_Locks;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
473 block[0] = FLASH_Clear_Locks_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
474 while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
475 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
476 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
477 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
478 // Get current block lock state. This needs to access each block on
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
479 // the device so currently locked blocks can be re-locked.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
480 bp = ROM;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
481 for (i = 0; i < dev->block_info[0].blocks; i++) {
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
482 bpv = FLASH_P2V( bp );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
483 *bpv = FLASH_Read_Query;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
484 if (bpv == block) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
485 is_locked[i] = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
486 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
487 #if 8 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
488 is_locked[i] = bpv[4] & FLASH_LOCK_MASK;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
489 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
490 is_locked[i] = bpv[2] & FLASH_LOCK_MASK;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
491 # endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
492 }
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
493 bp += dev->block_info[0].block_size / sizeof(*bp);
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
494 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
495
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
496 // Clears all lock bits
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
497 ROM[0] = FLASH_Clear_Locks;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
498 ROM[0] = FLASH_Clear_Locks_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
499 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
500 while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
501 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
502 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
503
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
504 // Restore the lock state
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
505 bp = ROM;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
506 for (i = 0; i < dev->block_info[0].blocks; i++) {
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
507 bpv = FLASH_P2V( bp );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
508 if (is_locked[i]) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
509 *bpv = FLASH_Set_Lock;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
510 *bpv = FLASH_Set_Lock_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
511 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
512 while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
513 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
514 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
515 }
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
516 bp += dev->block_info[0].block_size / sizeof(*bp);
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
517 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
518 #endif // CYGOPT_FLASH_IS_SYNCHRONOUS
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
519
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
520 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
521 ROM[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
522
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
523 return stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
524 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
525
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
526 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
527 static int
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
528 strata_lock_block(struct cyg_flash_dev *dev,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
529 const cyg_flashaddr_t block_base)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
530 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
531 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
532 flash_t stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
533 int timeout = 5000000;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
534 volatile flash_t *block;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
535
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
536 // Get base address and map addresses to virtual addresses
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
537 ROM = FLASH_P2V(dev->start);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
538 block = FLASH_P2V(block_base);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
539
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
540 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
541 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
542
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
543 // Set lock bit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
544 block[0] = FLASH_Set_Lock;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
545 block[0] = FLASH_Set_Lock_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
546 while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
547 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
548 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
549
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
550 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
551 ROM[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
552
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
553 return stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
554 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
555 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
556
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
557 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
558
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
559 #ifdef CYGOPT_DEVS_FLASH_STRATA_V2_LOCKING
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
560 static CYG_FLASH_FUNS (cyg_flash_strata_v2_funs,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
561 strata_init,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
562 strata_query_hwr,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
563 strata_erase_block,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
564 strata_program_buf,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
565 NULL,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
566 strata_hwr_map_error,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
567 strata_lock_block,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
568 strata_unlock_block);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
569 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
570 static CYG_FLASH_FUNS (cyg_flash_strata_v2_funs,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
571 strata_init,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
572 strata_query_hwr,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
573 strata_erase_block,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
574 strata_program_buf,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
575 NULL,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
576 strata_hwr_map_error,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
577 NULL,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
578 NULL);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
579 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
580 #endif //CYGONCE_DEVS_FLASH_STRATA_V2_INL
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
581 // EOF strata.c