Mercurial > ecos
annotate packages/io/flash/current/include/flash_dev.h @ 2729:74dbf4c3f2e1 after-copyright-change-20090129
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
| author | jlarmour |
|---|---|
| date | Thu, 29 Jan 2009 17:47:46 +0000 |
| parents | a2f5434df2cb |
| children |
| rev | line source |
|---|---|
|
154
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
1 #ifndef CYGONCE_IO_FLASH_FLASH_DEV_H |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
2 #define CYGONCE_IO_FLASH_FLASH_DEV_H |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
3 //========================================================================== |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
4 // |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
5 // flash_dev.h |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
6 // |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
7 // Common flash device driver definitions |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
8 // |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
9 //========================================================================== |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
10 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
11 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
12 // This file is part of eCos, the Embedded Configurable Operating System. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
14 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
15 // eCos is free software; you can redistribute it and/or modify it under |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
16 // the terms of the GNU General Public License as published by the Free |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
17 // Software Foundation; either version 2 or (at your option) any later |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
18 // version. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
19 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
20 // eCos is distributed in the hope that it will be useful, but WITHOUT |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
21 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
23 // for more details. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
24 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
25 // You should have received a copy of the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
26 // along with eCos; if not, write to the Free Software Foundation, Inc., |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
27 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
28 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
29 // As a special exception, if other files instantiate templates or use |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
30 // macros or inline functions from this file, or you compile this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
31 // and link it with other works to produce a work based on this file, |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
32 // this file does not by itself cause the resulting work to be covered by |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
33 // the GNU General Public License. However the source code for this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
34 // must still be made available in accordance with section (3) of the GNU |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
35 // General Public License v2. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
36 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
37 // This exception does not invalidate any other reasons why a work based |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
38 // on this file might be covered by the GNU General Public License. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
39 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2626
diff
changeset
|
40 // ####ECOSGPLCOPYRIGHTEND#### |
|
154
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
41 //========================================================================== |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
42 //#####DESCRIPTIONBEGIN#### |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
43 // |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
44 // Author(s): gthomas |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
45 // Contributors: gthomas, Andrew Lunn, bartv |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
46 // Date: 2000-07-14 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
47 // Purpose: |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
48 // Description: |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
49 // |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
50 //####DESCRIPTIONEND#### |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
51 // |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
52 //========================================================================== |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
53 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
54 #include <pkgconf/system.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
55 #include <pkgconf/io_flash.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
56 #include <cyg/infra/cyg_type.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
57 #include <cyg/io/flash.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
58 #include <cyg/hal/hal_cache.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
59 #include <cyg/hal/hal_tables.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
60 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
61 // Forward reference of the device structure |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
62 struct cyg_flash_dev; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
63 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
64 // Structure of pointers to functions in the device driver |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
65 struct cyg_flash_dev_funs { |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
66 int (*flash_init) (struct cyg_flash_dev *dev); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
67 size_t (*flash_query) (struct cyg_flash_dev *dev, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
68 void * data, size_t len); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
69 int (*flash_erase_block) (struct cyg_flash_dev *dev, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
70 cyg_flashaddr_t block_base); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
71 int (*flash_program) (struct cyg_flash_dev *dev, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
72 cyg_flashaddr_t base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
73 const void* data, size_t len); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
74 int (*flash_read) (struct cyg_flash_dev *dev, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
75 const cyg_flashaddr_t base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
76 void* data, size_t len); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
77 #ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
78 int (*flash_block_lock) (struct cyg_flash_dev *dev, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
79 const cyg_flashaddr_t block_base); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
80 int (*flash_block_unlock) (struct cyg_flash_dev *dev, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
81 const cyg_flashaddr_t block_base); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
82 #endif |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
83 }; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
84 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
85 // Dummy functions for some of the above operations, if a device does |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
86 // not support e.g. locking. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
87 externC int cyg_flash_devfn_init_nop(struct cyg_flash_dev*); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
88 externC size_t cyg_flash_devfn_query_nop(struct cyg_flash_dev*, void*, const size_t); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
89 externC int cyg_flash_devfn_lock_nop(struct cyg_flash_dev*, const cyg_flashaddr_t); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
90 externC int cyg_flash_devfn_unlock_nop(struct cyg_flash_dev*, const cyg_flashaddr_t); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
91 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
92 // Facilitate function calls between flash-resident code and .2ram |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
93 // functions. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
94 externC void* cyg_flash_anonymizer(void*); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
95 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
96 // Structure each device places in the HAL table |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
97 struct cyg_flash_dev { |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
98 const struct cyg_flash_dev_funs *funs; // Function pointers |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
99 cyg_uint32 flags; // Device characteristics |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
100 cyg_flashaddr_t start; // First address |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
101 cyg_flashaddr_t end; // Last address |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
102 cyg_uint32 num_block_infos; // Number of entries |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
103 const cyg_flash_block_info_t *block_info; // Info about one block size |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
104 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
105 const void *priv; // Devices private data |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
106 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
107 // The following are only written to by the FLASH IO layer. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
108 cyg_flash_printf *pf; // Pointer to diagnostic printf |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
109 bool init; // Device has been initialised |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
110 #ifdef CYGPKG_KERNEL |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
111 cyg_mutex_t mutex; // Mutex for thread safeness |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
112 #endif |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
113 #if (CYGHWR_IO_FLASH_DEVICE > 1) |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
114 struct cyg_flash_dev *next; // Pointer to next device |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
115 #endif |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
116 } CYG_HAL_TABLE_TYPE; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
117 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
118 // Macros for instantiating the above structures. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
119 #ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
120 # define CYG_FLASH_FUNS(_funs_, _init_, _query_ , _erase_, _prog_ , _read_, _lock_, _unlock_) \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
121 struct cyg_flash_dev_funs _funs_ = \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
122 { \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
123 .flash_init = _init_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
124 .flash_query = _query_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
125 .flash_erase_block = _erase_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
126 .flash_program = _prog_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
127 .flash_read = _read_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
128 .flash_block_lock = _lock_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
129 .flash_block_unlock = _unlock_ \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
130 } |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
131 #else |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
132 # define CYG_FLASH_FUNS(_funs_, _init_, _query_ , _erase_, _prog_ , _read_, _lock_, _unlock_) \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
133 struct cyg_flash_dev_funs _funs_ = \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
134 { \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
135 .flash_init = _init_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
136 .flash_query = _query_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
137 .flash_erase_block = _erase_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
138 .flash_program = _prog_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
139 .flash_read = _read_ \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
140 } |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
141 #endif |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
142 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
143 // We assume HAL tables are placed into RAM. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
144 #define CYG_FLASH_DRIVER(_name_, _funs_, _flags_, _start_, _end_, _num_block_infos_, _block_info_, _priv_) \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
145 struct cyg_flash_dev _name_ CYG_HAL_TABLE_ENTRY(cyg_flashdev) = \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
146 { \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
147 .funs = _funs_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
148 .flags = _flags_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
149 .start = _start_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
150 .end = _end_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
151 .num_block_infos = _num_block_infos_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
152 .block_info = _block_info_, \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
153 .priv = _priv_ \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
154 } |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
155 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
156 // Additional support for legacy device drivers. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
157 #ifdef CYGHWR_IO_FLASH_DEVICE_LEGACY |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
158 struct flash_info { |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
159 int block_size; // Assuming fixed size "blocks" |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
160 int blocks; // Number of blocks |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
161 int buffer_size; // Size of write buffer (only defined for some devices) |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
162 unsigned long block_mask; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
163 void *start, *end; // Address range |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
164 int init; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
165 cyg_flash_printf *pf; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
166 }; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
167 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
168 externC struct flash_info flash_info; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
169 externC int flash_hwr_init(void); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
170 externC int flash_hwr_map_error(int err); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
171 externC void flash_dev_query(void *data); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
172 #endif // CYGHWR_IO_FLASH_DEVICE_LEGACY |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
173 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
174 // ---------------------------------------------------------------------------- |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
175 // This section provides utility macros used by some flash drivers, especially |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
176 // the legacy ones. Such flash drivers need to #define _FLASH_PRIVATE before |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
177 // including this file. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
178 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
179 #ifdef _FLASH_PRIVATE_ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
180 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
181 //========================================================================== |
|
154
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
182 // Author(s): hmt |
|
194
feb0fcf83327
Merge from eCos master repository on 2001-10-26-06:43:03-BST
jlarmour
parents:
160
diff
changeset
|
183 // Contributors: hmt, jskov, Jose Pascual <josepascual@almudi.com> |
|
154
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
184 // Date: 2001-02-22 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
185 // Purpose: Define common flash device driver definitions |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
186 // Description: The flash_data_t type is used for accessing |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
187 // devices at the correct width. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
188 // The FLASHWORD macro must be used to create constants |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
189 // of suitable width. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
190 // The FLASH_P2V macro can be used to fix up non-linear |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
191 // mappings of flash blocks (defaults to a linear |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
192 // implementation). |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
193 //========================================================================== |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
194 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
195 // No mapping on this target - but these casts would be needed if some |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
196 // manipulation did occur. An example of this might be: |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
197 // // First 4K page of flash at physical address zero is |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
198 // // virtually mapped at address 0xa0000000. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
199 // #define FLASH_P2V(x) ((volatile flash_t *)(((unsigned)(x) < 0x1000) ? |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
200 // ((unsigned)(x) | 0xa0000000) : |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
201 // (unsigned)(x))) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
202 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
203 #ifndef FLASH_P2V |
|
160
0d0f03f76f6a
Merge from eCos master repository on 2001-06-01-18:52:13-BST
jlarmour
parents:
154
diff
changeset
|
204 #define FLASH_P2V( _a_ ) ((volatile flash_t *)((CYG_ADDRWORD)(_a_))) |
|
154
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
205 #endif |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
206 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
207 // ------------------------------------------------------------------------ |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
208 // |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
209 // This generic code is intended to deal with all shapes and orientations |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
210 // of Intel StrataFlash. Trademarks &c belong to their respective owners. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
211 // |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
212 // It therefore needs some trickery to define the constants and accessor |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
213 // types that we use to interact with the device or devices. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
214 // |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
215 // The assumptions are that |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
216 // o Parallel devices, we write to, with the "opcode" replicated per |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
217 // device |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
218 // o The "opcode" and status returns exist only in the low byte of the |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
219 // device's interface regardless of its width. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
220 // o Hence opcodes and status are only one byte. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
221 // An exception is the test for succesfully erased data. |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
222 // |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
223 // ------------------------------------------------------------------------ |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
224 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
225 #if 8 == CYGNUM_FLASH_WIDTH |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
226 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
227 # if 1 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
228 # define FLASHWORD( k ) ((flash_data_t)(k)) // To narrow a 16-bit constant |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
229 typedef cyg_uint8 flash_data_t; |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
230 # elif 2 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
231 // 2 devices to make 16-bit |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
232 # define FLASHWORD( k ) ((k)+((k)<<8)) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
233 typedef cyg_uint16 flash_data_t; |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
234 # elif 4 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
235 // 4 devices to make 32-bit |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
236 # define FLASHWORD( k ) ((k)+((k)<<8)+((k)<<16)+((k)<<24)) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
237 typedef cyg_uint32 flash_data_t; |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
238 # elif 8 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
239 // 8 devices to make 64-bit - intermediate requires explicit widening |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
240 # define FLASHWORD32( k ) ((flash_data_t)((k)+((k)<<8)+((k)<<16)+((k)<<24))) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
241 # define FLASHWORD( k ) (FLASHWORD32( k ) + (FLASHWORD32( k ) << 32)); |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
242 typedef cyg_uint64 flash_data_t; |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
243 # else |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
244 # error How many 8-bit flash devices? |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
245 # endif |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
246 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
247 #elif 16 == CYGNUM_FLASH_WIDTH |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
248 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
249 # if 1 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
250 # define FLASHWORD( k ) (k) |
|
160
0d0f03f76f6a
Merge from eCos master repository on 2001-06-01-18:52:13-BST
jlarmour
parents:
154
diff
changeset
|
251 typedef cyg_uint16 flash_data_t; |
|
154
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
252 # elif 2 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
253 // 2 devices to make 32-bit |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
254 # define FLASHWORD( k ) ((k)+((k)<<16)) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
255 typedef cyg_uint32 flash_data_t; |
|
194
feb0fcf83327
Merge from eCos master repository on 2001-10-26-06:43:03-BST
jlarmour
parents:
160
diff
changeset
|
256 # elif 4 == CYGNUM_FLASH_INTERLEAVE |
|
154
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
257 // 4 devices to make 64-bit - intermediate requires explicit widening |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
258 # define FLASHWORD32( k ) ((flash_data_t)((k)+((k)<<16))) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
259 # define FLASHWORD( k ) (FLASHWORD32( k ) + (FLASHWORD32( k ) << 32)); |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
260 typedef cyg_uint64 flash_data_t; |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
261 # else |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
262 # error How many 16-bit flash devices? |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
263 # endif |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
264 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
265 #elif 32 == CYGNUM_FLASH_WIDTH |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
266 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
267 # if 1 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
268 # define FLASHWORD( k ) (k) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
269 typedef cyg_uint32 flash_data_t; |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
270 # elif 2 == CYGNUM_FLASH_INTERLEAVE |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
271 // 2 devices to make 64-bit - intermediate requires explicit widening |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
272 # define FLASHWORD32( k ) ((flash_data_t)(k)) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
273 # define FLASHWORD( k ) (FLASHWORD32( k ) + (FLASHWORD32( k ) << 32)); |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
274 typedef cyg_uint64 flash_data_t; |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
275 # else |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
276 # error How many 32-bit flash devices? |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
277 # endif |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
278 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
279 #else |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
280 # error What flash width? |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
281 #endif |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
282 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
283 // Data (not) that we read back: |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
284 #if 0 == CYGNUM_FLASH_BLANK |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
285 # define FLASH_BlankValue ((flash_data_t)0) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
286 #elif 1 == CYGNUM_FLASH_BLANK |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
287 # define FLASH_BlankValue ((flash_data_t)(-1ll)) |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
288 #else |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
289 # error What blank value? |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
290 #endif |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
291 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
292 #endif // _FLASH_PRIVATE_ |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
293 |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
294 #endif // CYGONCE_IO_FLASH_FLASH_DEV_H |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
295 //---------------------------------------------------------------------------- |
|
e2d866e32dac
Merge from eCos master repository on 2001-02-26-23:18:05-GMT
jlarmour
parents:
diff
changeset
|
296 // end of flash_dev.h |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
944
diff
changeset
|
297 |
