Mercurial > ecos
annotate packages/io/flash/current/include/flash.h @ 2626:a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
| author | jlarmour |
|---|---|
| date | Tue, 18 Nov 2008 00:56:04 +0000 |
| parents | 86d40b65e079 |
| children | 74dbf4c3f2e1 |
| rev | line source |
|---|---|
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
1 //========================================================================== |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
2 // |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
3 // flash.h |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
4 // |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
5 // Flash programming - external interfaces |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
6 // |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
7 //========================================================================== |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
8 //####ECOSGPLCOPYRIGHTBEGIN#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
9 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
11 // copyright (C) 2004 Andrew Lunn |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
12 // Copyright (C) 2004, 2005 eCosCentric Ltd. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
13 // Copyright (C) 2003 Gary Thomas |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
14 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
15 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
16 // eCos is free software; you can redistribute it and/or modify it under |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
17 // the terms of the GNU General Public License as published by the Free |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
18 // Software Foundation; either version 2 or (at your option) any later version. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
19 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
23 // for more details. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
24 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
25 // You should have received a copy of the GNU General Public License along |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
26 // with eCos; if not, write to the Free Software Foundation, Inc., |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
28 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
29 // As a special exception, if other files instantiate templates or use macros |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
30 // or inline functions from this file, or you compile this file and link it |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
31 // with other works to produce a work based on this file, this file does not |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
32 // by itself cause the resulting work to be covered by the GNU General Public |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
33 // License. However the source code for this file must still be made available |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
34 // in accordance with section (3) of the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
35 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
36 // This exception does not invalidate any other reasons why a work based on |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
37 // this file might be covered by the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
38 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
40 // at http://sources.redhat.com/ecos/ecos-license/ |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
41 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
42 //####ECOSGPLCOPYRIGHTEND#### |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
43 //========================================================================== |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
44 //#####DESCRIPTIONBEGIN#### |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
45 // |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
46 // Author(s): gthomas |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
47 // Contributors: gthomas, Andrew Lunn, bartv |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
48 // Date: 2000-07-14 |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
49 // Purpose: |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
50 // Description: |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
51 // |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
52 //####DESCRIPTIONEND#### |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
53 // |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
54 //========================================================================== |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
55 |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
56 #ifndef _IO_FLASH_H_ |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
57 #define _IO_FLASH_H_ |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
58 |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
59 #include <pkgconf/system.h> |
|
119
77cec8369160
Merge from eCos master repository on 2000-09-01-07:47:03-BST
jlarmour
parents:
115
diff
changeset
|
60 #include <pkgconf/io_flash.h> |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
61 #include <stddef.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
62 #include <cyg/infra/cyg_type.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
63 #ifdef CYGPKG_KERNEL |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
64 #include <cyg/kernel/kapi.h> |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
65 #endif |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
66 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
67 // Currently a 32-bit quantity. In future this may be 64-bits on some |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
68 // platforms, e.g. to support very large nand flashes which can only |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
69 // be accessed indirectly. |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
70 typedef CYG_ADDRESS cyg_flashaddr_t; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
71 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
72 typedef struct cyg_flash_block_info |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
73 { |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
74 size_t block_size; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
75 cyg_uint32 blocks; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
76 } cyg_flash_block_info_t; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
77 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
78 // Information about what one device driver drives |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
79 typedef struct { |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
80 cyg_flashaddr_t start; // First address |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
81 cyg_flashaddr_t end; // Last address |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
82 cyg_uint32 num_block_infos; // Number of entries |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
83 const cyg_flash_block_info_t* block_info; // Info about block sizes |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
84 } cyg_flash_info_t; |
|
119
77cec8369160
Merge from eCos master repository on 2000-09-01-07:47:03-BST
jlarmour
parents:
115
diff
changeset
|
85 |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
86 typedef int cyg_flash_printf(const char *fmt, ...); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
87 __externC int cyg_flash_init( cyg_flash_printf *pf ); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
88 __externC int cyg_flash_get_info(cyg_uint32 devno, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
89 cyg_flash_info_t * info); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
90 __externC int cyg_flash_get_info_addr(const cyg_flashaddr_t flash_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
91 cyg_flash_info_t * info); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
92 __externC int cyg_flash_verify_addr(const cyg_flashaddr_t address); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
93 __externC size_t cyg_flash_block_size(const cyg_flashaddr_t flash_base); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
94 __externC int cyg_flash_read(const cyg_flashaddr_t flash_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
95 void *ram_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
96 size_t len, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
97 cyg_flashaddr_t *err_address); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
98 __externC int cyg_flash_erase(cyg_flashaddr_t flash_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
99 size_t len, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
100 cyg_flashaddr_t *err_address); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
101 __externC int cyg_flash_program(cyg_flashaddr_t flash_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
102 const void *ram_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
103 size_t len, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
104 cyg_flashaddr_t *err_address); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
105 __externC int cyg_flash_lock(const cyg_flashaddr_t flash_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
106 size_t len, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
107 cyg_flashaddr_t *err_address); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
108 __externC int cyg_flash_unlock(const cyg_flashaddr_t flash_base, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
109 size_t len, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
110 cyg_flashaddr_t *err_address); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
111 __externC const char *cyg_flash_errmsg(const int err); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
112 #ifdef CYGPKG_KERNEL |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
113 __externC int cyg_flash_mutex_lock(const cyg_flashaddr_t from, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
114 size_t len); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
115 __externC int cyg_flash_mutex_unlock(const cyg_flashaddr_t from, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
116 size_t len); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
117 #endif |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
118 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
119 #define CYG_FLASH_ERR_OK 0x00 // No error - operation complete |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
120 #define CYG_FLASH_ERR_INVALID 0x01 // Invalid FLASH address |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
121 #define CYG_FLASH_ERR_ERASE 0x02 // Error trying to erase |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
122 #define CYG_FLASH_ERR_LOCK 0x03 // Error trying to lock/unlock |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
123 #define CYG_FLASH_ERR_PROGRAM 0x04 // Error trying to program |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
124 #define CYG_FLASH_ERR_PROTOCOL 0x05 // Generic error |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
125 #define CYG_FLASH_ERR_PROTECT 0x06 // Device/region is write-protected |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
126 #define CYG_FLASH_ERR_NOT_INIT 0x07 // FLASH info not yet initialized |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
127 #define CYG_FLASH_ERR_HWR 0x08 // Hardware (configuration?) problem |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
128 #define CYG_FLASH_ERR_ERASE_SUSPEND 0x09 // Device is in erase suspend mode |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
129 #define CYG_FLASH_ERR_PROGRAM_SUSPEND 0x0a // Device is in program suspend mode |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
130 #define CYG_FLASH_ERR_DRV_VERIFY 0x0b // Driver failed to verify data |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
131 #define CYG_FLASH_ERR_DRV_TIMEOUT 0x0c // Driver timed out |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
132 #define CYG_FLASH_ERR_DRV_WRONG_PART 0x0d // Driver does not support device |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
133 #define CYG_FLASH_ERR_LOW_VOLTAGE 0x0e // Not enough juice to complete job |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
134 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
135 #ifdef CYGSEM_IO_FLASH_LEGACY_API |
|
184
022f1e506033
Merge from eCos master repository on 2001-10-02-17:59:22-BST
jlarmour
parents:
177
diff
changeset
|
136 typedef int _printf(const char *fmt, ...); |
|
162
2395031e7a66
Merge from eCos master repository on 2001-06-15-06:43:03-BST
jlarmour
parents:
156
diff
changeset
|
137 |
| 1389 | 138 externC int flash_init(_printf *pf); |
|
141
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
139 externC int flash_erase(void *base, int len, void **err_address); |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
140 externC int flash_program(void *flash_base, void *ram_base, int len, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
141 void **err_address); |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
142 externC int flash_read(void *flash_base, void *ram_base, int len, |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
143 void **err_address); |
|
143
6b5f480c6929
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents:
141
diff
changeset
|
144 externC void flash_dev_query(void *data); |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
174
diff
changeset
|
145 #ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING |
|
141
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
146 externC int flash_lock(void *base, int len, void **err_address); |
|
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
147 externC int flash_unlock(void *base, int len, void **err_address); |
|
119
77cec8369160
Merge from eCos master repository on 2000-09-01-07:47:03-BST
jlarmour
parents:
115
diff
changeset
|
148 #endif |
|
141
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
149 externC int flash_verify_addr(void *base); |
|
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
150 externC int flash_get_limits(void *base, void **start, void **end); |
|
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
151 externC int flash_get_block_info(int *block_size, int *blocks); |
|
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
152 externC bool flash_code_overlaps(void *start, void *end); |
|
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
153 externC char *flash_errmsg(int err); |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
154 #endif // CYGSEM_IO_FLASH_LEGACY_API |
|
141
450e4e1f1e80
Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents:
136
diff
changeset
|
155 |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
156 #if defined(CYGSEM_IO_FLASH_LEGACY_API) || defined(CYGHWR_IO_FLASH_DEVICE_LEGACY) |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
157 #define FLASH_ERR_OK CYG_FLASH_ERR_OK |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
158 #define FLASH_ERR_INVALID CYG_FLASH_ERR_INVALID |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
159 #define FLASH_ERR_ERASE CYG_FLASH_ERR_ERASE |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
160 #define FLASH_ERR_LOCK CYG_FLASH_ERR_LOCK |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
161 #define FLASH_ERR_PROGRAM CYG_FLASH_ERR_PROGRAM |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
162 #define FLASH_ERR_PROTOCOL CYG_FLASH_ERR_PROTOCOL |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
163 #define FLASH_ERR_PROTECT CYG_FLASH_ERR_PROTECT |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
164 #define FLASH_ERR_NOT_INIT CYG_FLASH_ERR_NOT_INIT |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
165 #define FLASH_ERR_HWR CYG_FLASH_ERR_HWR |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
166 #define FLASH_ERR_ERASE_SUSPEND CYG_FLASH_ERR_ERASE_SUSPEND |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
167 #define FLASH_ERR_PROGRAM_SUSPEND CYG_FLASH_ERR_PROGRAM_SUSPEND |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
168 #define FLASH_ERR_DRV_VERIFY CYG_FLASH_ERR_DRV_VERIFY |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
169 #define FLASH_ERR_DRV_TIMEOUT CYG_FLASH_ERR_DRV_TIMEOUT |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
170 #define FLASH_ERR_DRV_WRONG_PART CYG_FLASH_ERR_DRV_WRONG_PART |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
171 #define FLASH_ERR_LOW_VOLTAGE CYG_FLASH_ERR_LOW_VOLTAGE |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
172 #endif |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
173 |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
174 #if defined(CYGPKG_IO_FLASH_BLOCK_DEVICE) || \ |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
175 defined(CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY) |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
176 typedef struct { |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
177 CYG_ADDRESS offset; |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
178 size_t len; |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
179 int flasherr; |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
180 cyg_flashaddr_t err_address; |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
181 } cyg_io_flash_getconfig_erase_t; |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
182 |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
183 typedef cyg_io_flash_getconfig_erase_t cyg_io_flash_getconfig_lock_t; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
184 typedef cyg_io_flash_getconfig_erase_t cyg_io_flash_getconfig_unlock_t; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
185 |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
186 typedef struct { |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
187 size_t dev_size; |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
188 } cyg_io_flash_getconfig_devsize_t; |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
189 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
190 typedef struct { |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
191 cyg_flashaddr_t dev_addr; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
192 } cyg_io_flash_getconfig_devaddr_t; |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
193 |
|
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
194 typedef struct { |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
195 CYG_ADDRESS offset; |
|
2626
a2f5434df2cb
Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents:
1394
diff
changeset
|
196 size_t block_size; |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
197 } cyg_io_flash_getconfig_blocksize_t; |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
198 #endif |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
184
diff
changeset
|
199 |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff
changeset
|
200 #endif // _IO_FLASH_H_ |
