annotate packages/io/flash/current/src/flash_legacy.h @ 1777:c16341b1bac6 default tip

* Added execute permissions to files missed in conversion from CVS
author alexs
date Mon, 12 Oct 2009 02:26:09 +0100
parents 8667859d61ab
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1750
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
1 //==========================================================================
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
2 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
3 // flash_legacy.h
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
4 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
5 // Flash programming - some internal implementation details.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
6 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
7 //==========================================================================
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
8 //####ECOSGPLCOPYRIGHTBEGIN####
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
9 // -------------------------------------------
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
10 // This file is part of eCos, the Embedded Configurable Operating System.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
11 // copyright (C) 2004 Andrew Lunn
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
12 // Copyright (C) 2003 Gary Thomas
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
1769
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
14 // Copyright (C) 2004 eCosCentric Limited
1750
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
15 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
16 // eCos is free software; you can redistribute it and/or modify it under
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
17 // the terms of the GNU General Public License as published by the Free
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
18 // Software Foundation; either version 2 or (at your option) any later version.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
19 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
23 // for more details.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
24 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
25 // You should have received a copy of the GNU General Public License along
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
28 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
29 // As a special exception, if other files instantiate templates or use macros
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
30 // or inline functions from this file, or you compile this file and link it
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
31 // with other works to produce a work based on this file, this file does not
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
32 // by itself cause the resulting work to be covered by the GNU General Public
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
33 // License. However the source code for this file must still be made available
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
34 // in accordance with section (3) of the GNU General Public License.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
35 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
36 // This exception does not invalidate any other reasons why a work based on
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
37 // this file might be covered by the GNU General Public License.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
38 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
40 // at http://sources.redhat.com/ecos/ecos-license/
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
41 // -------------------------------------------
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
42 //####ECOSGPLCOPYRIGHTEND####
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
43 //==========================================================================
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
44 //#####DESCRIPTIONBEGIN####
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
45 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
46 // Author(s): gthomas
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
47 // Contributors: gthomas, Andrew Lunn
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
48 // Date: 2000-07-14
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
49 // Purpose:
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
50 // Description:
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
51 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
52 //####DESCRIPTIONEND####
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
53 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
54 //==========================================================================
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
55
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
56 #include <pkgconf/system.h>
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
57 #include <pkgconf/io_flash.h>
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
58 #include <cyg/infra/cyg_type.h>
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
59 #include <cyg/hal/hal_arch.h>
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
60 #include <cyg/hal/hal_cache.h>
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
61
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
62
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
63 // Some FLASH devices may require additional support, e.g. to turn on
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
64 // appropriate voltage drivers, before any operation.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
65 #ifdef CYGIMP_FLASH_ENABLE
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
66 # define FLASH_Enable CYGIMP_FLASH_ENABLE
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
67 extern void CYGIMP_FLASH_ENABLE(void *, void *);
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
68 #else
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
69 # define FLASH_Enable(_start_, _end_) CYG_EMPTY_STATEMENT
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
70 #endif
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
71 #ifdef CYGIMP_FLASH_DISABLE
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
72 # define FLASH_Disable CYGIMP_FLASH_DISABLE
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
73 extern void CYGIMP_FLASH_DISABLE(void *, void *);
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
74 #else
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
75 # define FLASH_Disable(_start_, _end_) CYG_EMPTY_STATEMENT
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
76 #endif
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
77
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
78 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
79 // Some platforms have a DIP switch or jumper that tells the software that
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
80 // the flash is write protected.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
81 //
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
82 #ifdef CYGSEM_IO_FLASH_SOFT_WRITE_PROTECT
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
83 externC cyg_bool plf_flash_query_soft_wp(void *addr, int len);
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
84 #endif
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
85
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
86 //---------------------------------------------------------------------------
1769
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
87 // If all of the flash devices handle cache themselves, or do not need any
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
88 // special cache treatment, then the flash macros can be no-ops.
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
89 #ifndef CYGHWR_IO_FLASH_DEVICE_NEEDS_CACHE_HANDLED
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
90 # undef HAL_FLASH_CACHES_OFF
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
91 # undef HAL_FLASH_CACHES_ON
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
92 # undef HAL_FLASH_CACHES_STATE
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
93 # define HAL_FLASH_CACHES_OFF(_d_, _i_) CYG_EMPTY_STATEMENT
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
94 # define HAL_FLASH_CACHES_ON(_d_, _i_) CYG_EMPTY_STATEMENT
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
95 # define HAL_FLASH_CACHES_STATE(_d_, _i_) CYG_EMPTY_STATEMENT
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
96 #endif
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
97
1750
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
98 // Execution of flash code must be done inside a
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
99 // HAL_FLASH_CACHES_OFF/HAL_FLASH_CACHES_ON region - disabling the
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
100 // cache on unified cache systems is necessary to prevent burst access
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
101 // to the flash area being programmed. With Harvard style caches, only
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
102 // the data cache needs to be disabled, but the instruction cache is
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
103 // disabled for consistency.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
104
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
105 // Targets may provide alternative implementations for these macros in
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
106 // the hal_cache.h (or var/plf) files.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
107
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
108 // The first part below is a generic, optimal implementation. The
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
109 // second part is the old implementation that has been tested to work
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
110 // on some targets - but it is not be suitable for targets that would
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
111 // do burst access to the flash (it does not disable the data cache).
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
112
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
113 // Both implementations must be called with interrupts disabled.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
114
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
115 // NOTE: Do _not_ change any of the below macros without checking that
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
116 // the changed code still works on _all_ platforms that rely on these
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
117 // macros. There is no such thing as logical and correct when dealing
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
118 // with different cache and IO models, so _do not_ mess with this code
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
119 // unless you test it properly afterwards.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
120
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
121 #ifndef HAL_FLASH_CACHES_OFF
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
122
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
123 // Some drivers have only been tested with the old macros below.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
124 #ifndef HAL_FLASH_CACHES_OLD_MACROS
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
125
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
126 #ifdef HAL_CACHE_UNIFIED
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
127
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
128 // Note: the ucache code has not been tested yet on any target.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
129 #define HAL_FLASH_CACHES_OFF(_d_, _i_) \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
130 CYG_MACRO_START \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
131 _i_ = 0; /* avoids warning */ \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
132 HAL_UCACHE_IS_ENABLED(_d_); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
133 HAL_UCACHE_SYNC(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
134 HAL_UCACHE_INVALIDATE_ALL(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
135 HAL_UCACHE_DISABLE(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
136 CYG_MACRO_END
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
137
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
138 #define HAL_FLASH_CACHES_ON(_d_, _i_) \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
139 CYG_MACRO_START \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
140 if (_d_) HAL_UCACHE_ENABLE(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
141 CYG_MACRO_END
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
142
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
143 #else // HAL_CACHE_UNIFIED
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
144
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
145 #define HAL_FLASH_CACHES_OFF(_d_, _i_) \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
146 CYG_MACRO_START \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
147 _i_ = 0; /* avoids warning */ \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
148 HAL_DCACHE_IS_ENABLED(_d_); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
149 HAL_DCACHE_SYNC(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
150 HAL_DCACHE_INVALIDATE_ALL(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
151 HAL_DCACHE_DISABLE(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
152 HAL_ICACHE_INVALIDATE_ALL(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
153 CYG_MACRO_END
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
154
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
155 #define HAL_FLASH_CACHES_ON(_d_, _i_) \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
156 CYG_MACRO_START \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
157 if (_d_) HAL_DCACHE_ENABLE(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
158 CYG_MACRO_END
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
159
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
160 #endif // HAL_CACHE_UNIFIED
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
161
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
162 #else // HAL_FLASH_CACHES_OLD_MACROS
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
163
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
164 // Note: This implementation is broken as it will always enable the i-cache
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
165 // even if it was not enabled before. It also doesn't work if the
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
166 // target uses burst access to flash since the d-cache is left enabled.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
167 // However, this does not mean you can change this code! Leave it as
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
168 // is - if you want a different implementation, provide it in the
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
169 // arch/var/platform cache header file.
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
170
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
171 #define HAL_FLASH_CACHES_OFF(_d_, _i_) \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
172 _d_ = 0; /* avoids warning */ \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
173 _i_ = 0; /* avoids warning */ \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
174 HAL_DCACHE_SYNC(); \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
175 HAL_ICACHE_DISABLE();
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
176
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
177 #define HAL_FLASH_CACHES_ON(_d_, _i_) \
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
178 HAL_ICACHE_ENABLE();
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
179
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
180 #endif // HAL_FLASH_CACHES_OLD_MACROS
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
181
fac0499dabd6 Move legacy macros from a public to an internal header file, to
bartv
parents:
diff changeset
182 #endif // HAL_FLASH_CACHES_OFF
1769
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
183
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
184 #ifndef HAL_FLASH_CACHES_STATE
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
185 # define HAL_FLASH_CACHES_STATE(_d_, _i_) int _d_, _i_
8667859d61ab * src/flash_legacy.h: Undef HAL_FLASH_CACHES_* macros if the HAL
jlarmour
parents: 1750
diff changeset
186 #endif