annotate packages/devs/flash/intel/stratav2/current/include/flash_strata_v2.inl @ 1763:42c8ea63b78d

Eliminate hwr_map_error() from the V2 driver interface, it no longer serves any useful purpose
author bartv
date Mon, 29 Nov 2004 14:49:20 +0000
parents 9c1d9e5039c2
children
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;
1761
af5ce7899d45 Apply Andrew's patch to sort out some const usage
bartv
parents: 1754
diff changeset
125 // remove const property. We need to change the block_info and num_blocks
af5ce7899d45 Apply Andrew's patch to sort out some const usage
bartv
parents: 1754
diff changeset
126 struct cyg_flash_strata_v2_priv *priv =
af5ce7899d45 Apply Andrew's patch to sort out some const usage
bartv
parents: 1754
diff changeset
127 (struct cyg_flash_strata_v2_priv *)dev->priv;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
128
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
129 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
130 qp = &data;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
131 if ( ((qp->manuf_code == FLASH_Intel_code) ||
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
132 (qp->manuf_code == FLASH_STMicro_code))
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
133 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
134 // 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
135 // 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
136 // [FIXME: whatever that means :FIXME]
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
137 // [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
138 // plus the following size codes:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
139 // 0: 16Mbit 2: 8Mbit 4: 4Mbit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
140 // 6: 32Mbit 8: 64Mbit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
141 #if 16 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
142 && (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
143 #elif 8 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
144 && (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
145 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
146 && 0
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
147 #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
148 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
149 ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
150 int lookup[] = { 16, 8, 4, 32, 64 };
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
151 #define BLOCKSIZE (0x10000)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
152 region_size = BLOCKSIZE;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
153 num_regions = qp->device_code & 0x0F;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
154 num_regions >>= 1;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
155 if ( num_regions > 4 )
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
156 goto flash_type_unknown;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
157 num_regions = lookup[num_regions];
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
158 num_regions *= 1024 * 1024; // to bits
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
159 num_regions /= 8; // to bytes
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
160 num_regions /= BLOCKSIZE; // to blocks
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
161 buffer_size = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
162 #else // CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
163 && (strncmp(qp->id, "QRY", 3) == 0)) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
164 num_regions = _si(qp->num_regions)+1;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
165 region_size = _si(qp->region_size)*256;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
166 if (_si(qp->buffer_size)) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
167 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
168 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
169 buffer_size = 0;
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 #endif // Not CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
172
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
173 dev->end = dev->start +
1726
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
174 (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
175 priv->buffer_size = buffer_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
176 priv->block_info[0].blocks = num_regions;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
177 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
178 dev->block_info = priv->block_info;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
179 dev->num_block_infos = 1;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
180
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
181 #ifdef CYGNUM_FLASH_BASE_MASK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
182 // 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
183 // 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
184 // address lines ignored.
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
185 if ( (dev->start & CYGNUM_FLASH_BASE_MASK) !=
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
186 ((dev->end - 1) & CYGNUM_FLASH_BASE_MASK ) ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
187 // 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
188 unsigned int x;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
189 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
190 x += (unsigned int)dev->start;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
191 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
192 (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
193 dev->end, (void *)x );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
194 dev->end = x;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
195 // 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
196 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
197 / priv->block_info[0].block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
198 priv->block_info[0].blocks = x;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
199 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
200 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
201 #endif // CYGNUM_FLASH_BASE_MASK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
202
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
203 return CYG_FLASH_ERR_OK;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
204 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
205 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
206 flash_type_unknown:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
207 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
208 #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
209 (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
210 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
211 diag_dump_buf(qp, sizeof(data));
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
212 #endif
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
213 return CYG_FLASH_ERR_HWR;
1709
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
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
216 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
217 // 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
218 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
219 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
220 if (err & FLASH_ErrorMask) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
221 (dev->pf)("Err = %x\n", err);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
222 if (err & FLASH_ErrorProgram)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
223 return CYG_FLASH_ERR_PROGRAM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
224 else if (err & FLASH_ErrorErase)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
225 return CYG_FLASH_ERR_ERASE;
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_HWR; // FIXME
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
228 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
229 return CYG_FLASH_ERR_OK;
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
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 #define CNT 20*1000*10 // Approx 20ms
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
235
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
236 static size_t
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
237 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
238 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
239 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
240 int i, cnt;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
241 unsigned char *data = (unsigned char *)data_dst;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
242
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
243 // 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
244 ROM = FLASH_P2V( dev->start );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
245 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
246 // 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
247 // 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
248 ROM[0] = FLASH_Read_ID;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
249 i = 2;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
250 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
251 // StrataFlash supports the full Read_Query op:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
252 ROM[0] = FLASH_Read_Query;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
253 i = sizeof(struct FLASH_query);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
254 #endif // Not CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
255
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
256 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
257 for ( /* i */; i > 0; i--, ++ROM ) {
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
258 // 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
259 // 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
260 *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
261 #ifndef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
262 # if 8 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
263 // 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
264 // at even addresses
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
265 ++ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
266 # endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
267 #endif
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 ROM[0] = FLASH_Reset;
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 return 0;
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
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
275 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
276 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
277 cyg_flashaddr_t block_base)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
278 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
279 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
280 flash_t stat = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
281 int timeout = 50000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
282 int len, block_len, erase_block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
283 volatile flash_t *eb, *block;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
284
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
285 // 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
286 ROM = FLASH_P2V(dev->start);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
287 eb = block = FLASH_P2V(block_base);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
288 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
289
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
290 #ifdef CYGOPT_FLASH_IS_BOOTBLOCK
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
291 #define BLOCKSIZE (0x10000*CYGNUM_FLASH_INTERLEAVE)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
292 #define ERASE_BLOCKSIZE (0x2000*CYGNUM_FLASH_INTERLEAVE)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
293 if ((eb - ROM) < BLOCKSIZE/(sizeof eb[0])) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
294 erase_block_size = ERASE_BLOCKSIZE;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
295 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
296 erase_block_size = block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
297 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
298 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
299 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
300 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
301
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
302 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
303 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
304
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
305 // Erase block
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
306 while (block_len > 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
307 eb[0] = FLASH_Block_Erase;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
308 eb[0] = FLASH_Confirm;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
309
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
310 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
311 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
312 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
313 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
314
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
315 block_len -= erase_block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
316 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
317 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
318
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
319 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
320 ROM[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
321
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
322 // 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
323 if (stat & FLASH_ErrorMask ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
324 len = dev->block_info[0].block_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
325 while (len > 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
326 if (*block++ != FLASH_BlankValue ) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
327 len -= sizeof(*block);
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 if (len == 0) stat = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
330 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
331
1763
42c8ea63b78d Eliminate hwr_map_error() from the V2 driver interface, it no longer
bartv
parents: 1762
diff changeset
332 return strata_hwr_map_error(dev, stat);
1709
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
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
335 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
336 static int
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
337 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
338 cyg_flashaddr_t base_addr,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
339 const void* data_addr,
1754
6a1e54eaaac8 Update following changes to the flash device driver interface
bartv
parents: 1749
diff changeset
340 size_t total_len)
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
341 {
1761
af5ce7899d45 Apply Andrew's patch to sort out some const usage
bartv
parents: 1754
diff changeset
342 const struct cyg_flash_strata_v2_priv *priv = dev->priv;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
343 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
344 volatile flash_t *BA, *addr;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
345 flash_t * data = (flash_t *)data_addr;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
346 flash_t stat = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
347 int timeout = 50000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
348 int len = total_len;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
349
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
350 #ifdef FLASH_Write_Buffer
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
351 int i, wc;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
352 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
353
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
354 // 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
355 ROM = FLASH_P2V( dev->start );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
356 BA = addr = FLASH_P2V(base_addr);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
357
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
358 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
359 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
360
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
361 #ifdef FLASH_Write_Buffer
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
362 // Write any big chunks first
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
363 while (len >= priv->buffer_size) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
364 wc = priv->buffer_size;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
365 if (wc > len) wc = len;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
366 len -= wc;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
367 // 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
368 wc = wc / sizeof(flash_t); // Word count
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
369 *BA = FLASH_Write_Buffer;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
370 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
371 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
372 if (--timeout == 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
373 goto bad;
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 = FLASH_Write_Buffer;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
376 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
377 *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
378 for (i = 0; i < wc; i++) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
379 #ifdef CYGHWR_FLASH_WRITE_ELEM
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
380 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
381 #else
1726
d2486ee206e4 * include/flash_strata_v2.inl: Return the end address which is the
asl
parents: 1718
diff changeset
382 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
383 #endif
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 *BA = FLASH_Confirm;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
386
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
387 ROM[0] = FLASH_Read_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
388 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
389 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
390 if (--timeout == 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
391 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
392 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
393 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
394 // Jump out if there was an error
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
395 if (stat & FLASH_ErrorMask) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
396 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
397 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
398 // 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
399 *BA = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
400 for (i = 0; i < wc; i++) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
401 if ( *addr++ != *data++ ) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
402 stat = FLASH_ErrorNotVerified;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
403 goto bad;
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 }
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 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
408
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
409 while (len > 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
410 BA[0] = FLASH_Program;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
411 #ifdef CYGHWR_FLASH_WRITE_ELEM
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
412 CYGHWR_FLASH_WRITE_ELEM(addr, data);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
413 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
414 *addr = *data;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
415 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
416 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
417 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
418 if (--timeout == 0) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
419 goto bad;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
420 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
421 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
422 if (stat & FLASH_ErrorMask) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
423 break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
424 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
425 BA[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
426 if (*addr++ != *data++) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
427 stat = FLASH_ErrorNotVerified;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
428 break;
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 len -= sizeof( flash_t );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
431 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
432
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
433 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
434 bad:
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
435 BA[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
436
1763
42c8ea63b78d Eliminate hwr_map_error() from the V2 driver interface, it no longer
bartv
parents: 1762
diff changeset
437 return strata_hwr_map_error(dev, stat);
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
438 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
439
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
440 #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
441 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
442 //
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
443 // 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
444 // 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
445 // 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
446 // 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
447 // 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
448 //
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 #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
451
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
452 static int
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
453 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
454 const cyg_flashaddr_t block_base)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
455 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
456 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
457 flash_t stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
458 int timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
459 #ifndef CYGOPT_FLASH_IS_SYNCHRONOUS
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
460 int i;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
461 volatile flash_t *bp, *bpv, *block;
1718
c8515e560548 2004-08-21 Andrew Lunn <andrew.lunn@ascom.ch>
asl
parents: 1716
diff changeset
462 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
463 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
464
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
465 // 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
466 ROM = FLASH_P2V( dev->start );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
467 block = FLASH_P2V(block_base);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
468
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
469 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
470 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
471
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
472 #ifdef CYGOPT_FLASH_IS_SYNCHRONOUS
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
473 // Clear lock bit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
474 block[0] = FLASH_Clear_Locks;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
475 block[0] = FLASH_Clear_Locks_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
476 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
477 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
478 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
479 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
480 // 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
481 // 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
482 bp = ROM;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
483 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
484 bpv = FLASH_P2V( bp );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
485 *bpv = FLASH_Read_Query;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
486 if (bpv == block) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
487 is_locked[i] = 0;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
488 } else {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
489 #if 8 == CYGNUM_FLASH_WIDTH
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
490 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
491 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
492 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
493 # endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
494 }
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
495 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
496 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
497
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
498 // Clears all lock bits
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
499 ROM[0] = FLASH_Clear_Locks;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
500 ROM[0] = FLASH_Clear_Locks_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
501 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
502 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
503 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
504 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
505
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
506 // Restore the lock state
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
507 bp = ROM;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
508 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
509 bpv = FLASH_P2V( bp );
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
510 if (is_locked[i]) {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
511 *bpv = FLASH_Set_Lock;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
512 *bpv = FLASH_Set_Lock_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
513 timeout = 5000000;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
514 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
515 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
516 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
517 }
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
518 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
519 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
520 #endif // CYGOPT_FLASH_IS_SYNCHRONOUS
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
521
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
522 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
523 ROM[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
524
1763
42c8ea63b78d Eliminate hwr_map_error() from the V2 driver interface, it no longer
bartv
parents: 1762
diff changeset
525 return strata_hwr_map_error(dev, stat);
1709
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
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
528 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
529 static int
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
530 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
531 const cyg_flashaddr_t block_base)
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
532 {
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
533 volatile flash_t *ROM;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
534 flash_t stat;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
535 int timeout = 5000000;
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
536 volatile flash_t *block;
1709
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
537
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
538 // 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
539 ROM = FLASH_P2V(dev->start);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
540 block = FLASH_P2V(block_base);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
541
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
542 // Clear any error conditions
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
543 ROM[0] = FLASH_Clear_Status;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
544
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
545 // Set lock bit
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
546 block[0] = FLASH_Set_Lock;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
547 block[0] = FLASH_Set_Lock_Confirm; // Confirmation
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
548 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
549 if (--timeout == 0) break;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
550 }
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
551
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
552 // Restore ROM to "normal" mode
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
553 ROM[0] = FLASH_Reset;
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
554
1763
42c8ea63b78d Eliminate hwr_map_error() from the V2 driver interface, it no longer
bartv
parents: 1762
diff changeset
555 return strata_hwr_map_error(dev, stat);
1709
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 #endif
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
558
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
559 //----------------------------------------------------------------------------
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
560
1716
e4f7f465ee77 * cdl/flash_strata_v2.cdl: Indicate we implement
asl
parents: 1709
diff changeset
561 #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
562 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
563 strata_init,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
564 strata_query_hwr,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
565 strata_erase_block,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
566 strata_program_buf,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
567 NULL,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
568 strata_lock_block,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
569 strata_unlock_block);
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
570 #else
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
571 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
572 strata_init,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
573 strata_query_hwr,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
574 strata_erase_block,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
575 strata_program_buf,
57655b789e8a * New version of the strata driver based on the old version. This
asl
parents:
diff changeset
576 NULL,
1762
9c1d9e5039c2 Move dummy init/query/lock/unlock functions to the generic flash code,
bartv
parents: 1761
diff changeset
577 cyg_flash_devfn_lock_nop,
9c1d9e5039c2 Move dummy init/query/lock/unlock functions to the generic flash code,
bartv
parents: 1761
diff changeset
578 cyg_flash_devfn_unlock_nop);
1709
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