annotate packages/io/flash/current/include/flash.h @ 3292:7f8e529b4d82 default tip

Fix FREESCALE_EDMA_NBYTES_MLOFFYES_MLOFF() so it works with negative offsets.
author vae
date Wed, 29 Apr 2015 23:31:48 +0000
parents ccce4b32433a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 //==========================================================================
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
8 // ####ECOSGPLCOPYRIGHTBEGIN####
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
9 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
10 // This file is part of eCos, the Embedded Configurable Operating System.
2816
422d0a343b4d * include/flash.h: Modest API change: cyg_flash_init() no longer
jlarmour
parents: 2729
diff changeset
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
12 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
13 // 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
14 // 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
15 // 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
16 // version.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
17 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
18 // 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
19 // 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
20 // 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
21 // for more details.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
22 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
23 // 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
24 // 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
25 // 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: 184
diff changeset
26 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
27 // 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
28 // 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
29 // 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
30 // 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
31 // 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
32 // 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
33 // General Public License v2.
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
34 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
35 // 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
36 // 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
37 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 2626
diff changeset
38 // ####ECOSGPLCOPYRIGHTEND####
115
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
39 //==========================================================================
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
40 //#####DESCRIPTIONBEGIN####
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
41 //
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
42 // Author(s): gthomas
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
43 // Contributors: gthomas, Andrew Lunn, bartv
115
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
44 // Date: 2000-07-14
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
45 // Purpose:
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
46 // Description:
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
47 //
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
48 //####DESCRIPTIONEND####
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
49 //
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
50 //==========================================================================
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 #ifndef _IO_FLASH_H_
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
53 #define _IO_FLASH_H_
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
54
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
55 #include <pkgconf/system.h>
119
77cec8369160 Merge from eCos master repository on 2000-09-01-07:47:03-BST
jlarmour
parents: 115
diff changeset
56 #include <pkgconf/io_flash.h>
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
57 #include <stddef.h>
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
58 #include <cyg/infra/cyg_type.h>
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
59 #ifdef CYGPKG_KERNEL
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
60 #include <cyg/kernel/kapi.h>
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
61 #endif
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
62
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
63 // 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
64 // 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
65 // be accessed indirectly.
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
66 typedef CYG_ADDRESS cyg_flashaddr_t;
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
67
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
68 typedef struct cyg_flash_block_info
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
69 {
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
70 size_t block_size;
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
71 cyg_uint32 blocks;
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
72 } cyg_flash_block_info_t;
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 // Information about what one device driver drives
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
75 typedef struct {
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
76 cyg_flashaddr_t start; // First address
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
77 cyg_flashaddr_t end; // Last address
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
78 cyg_uint32 num_block_infos; // Number of entries
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
79 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
80 } cyg_flash_info_t;
119
77cec8369160 Merge from eCos master repository on 2000-09-01-07:47:03-BST
jlarmour
parents: 115
diff changeset
81
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
82 typedef int cyg_flash_printf(const char *fmt, ...);
2826
ccce4b32433a * include/flash.h: Reinstate printf arg to cyg_flash_init, but it
jlarmour
parents: 2816
diff changeset
83 __externC int cyg_flash_init( cyg_flash_printf *pf );
2816
422d0a343b4d * include/flash.h: Modest API change: cyg_flash_init() no longer
jlarmour
parents: 2729
diff changeset
84 __externC int cyg_flash_set_printf(const cyg_flashaddr_t flash_base,
422d0a343b4d * include/flash.h: Modest API change: cyg_flash_init() no longer
jlarmour
parents: 2729
diff changeset
85 cyg_flash_printf *pf);
422d0a343b4d * include/flash.h: Modest API change: cyg_flash_init() no longer
jlarmour
parents: 2729
diff changeset
86 __externC void cyg_flash_set_global_printf(cyg_flash_printf *pf);
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
87 __externC int cyg_flash_get_info(cyg_uint32 devno,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
88 cyg_flash_info_t * info);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
89 __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
90 cyg_flash_info_t * info);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
91 __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
92 __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
93 __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
94 void *ram_base,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
95 size_t len,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
96 cyg_flashaddr_t *err_address);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
97 __externC int cyg_flash_erase(cyg_flashaddr_t flash_base,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
98 size_t len,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
99 cyg_flashaddr_t *err_address);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
100 __externC int cyg_flash_program(cyg_flashaddr_t flash_base,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
101 const void *ram_base,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
102 size_t len,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
103 cyg_flashaddr_t *err_address);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
104 __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
105 size_t len,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
106 cyg_flashaddr_t *err_address);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
107 __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
108 size_t len,
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
109 cyg_flashaddr_t *err_address);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
110 __externC const char *cyg_flash_errmsg(const int err);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
111 #ifdef CYGPKG_KERNEL
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
112 __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
113 size_t len);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
114 __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
115 size_t len);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
116 #endif
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
117
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
118 #define CYG_FLASH_ERR_OK 0x00 // No error - operation complete
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
119 #define CYG_FLASH_ERR_INVALID 0x01 // Invalid FLASH address
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
120 #define CYG_FLASH_ERR_ERASE 0x02 // Error trying to erase
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
121 #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
122 #define CYG_FLASH_ERR_PROGRAM 0x04 // Error trying to program
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
123 #define CYG_FLASH_ERR_PROTOCOL 0x05 // Generic error
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
124 #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
125 #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
126 #define CYG_FLASH_ERR_HWR 0x08 // Hardware (configuration?) problem
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
127 #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
128 #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
129 #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
130 #define CYG_FLASH_ERR_DRV_TIMEOUT 0x0c // Driver timed out
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
131 #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
132 #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
133
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
134 #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
135 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
136
1389
587b0b1c6927 * src/flash.c:
asl
parents: 1223
diff changeset
137 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
138 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
139 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
140 void **err_address);
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
141 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
142 void **err_address);
143
6b5f480c6929 Merge from eCos master repository on 2000-12-08-02:09:36-GMT
jlarmour
parents: 141
diff changeset
143 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
144 #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
145 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
146 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
147 #endif
141
450e4e1f1e80 Merge from eCos master repository on 2000-11-27-23:09:27-GMT
jlarmour
parents: 136
diff changeset
148 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
149 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
150 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
151 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
152 externC char *flash_errmsg(int err);
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
153 #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
154
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
155 #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
156 #define FLASH_ERR_OK CYG_FLASH_ERR_OK
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
157 #define FLASH_ERR_INVALID CYG_FLASH_ERR_INVALID
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
158 #define FLASH_ERR_ERASE CYG_FLASH_ERR_ERASE
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
159 #define FLASH_ERR_LOCK CYG_FLASH_ERR_LOCK
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
160 #define FLASH_ERR_PROGRAM CYG_FLASH_ERR_PROGRAM
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
161 #define FLASH_ERR_PROTOCOL CYG_FLASH_ERR_PROTOCOL
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
162 #define FLASH_ERR_PROTECT CYG_FLASH_ERR_PROTECT
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
163 #define FLASH_ERR_NOT_INIT CYG_FLASH_ERR_NOT_INIT
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
164 #define FLASH_ERR_HWR CYG_FLASH_ERR_HWR
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
165 #define FLASH_ERR_ERASE_SUSPEND CYG_FLASH_ERR_ERASE_SUSPEND
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
166 #define FLASH_ERR_PROGRAM_SUSPEND CYG_FLASH_ERR_PROGRAM_SUSPEND
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
167 #define FLASH_ERR_DRV_VERIFY CYG_FLASH_ERR_DRV_VERIFY
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
168 #define FLASH_ERR_DRV_TIMEOUT CYG_FLASH_ERR_DRV_TIMEOUT
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
169 #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
170 #define FLASH_ERR_LOW_VOLTAGE CYG_FLASH_ERR_LOW_VOLTAGE
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
171 #endif
115
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
172
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
173 #if defined(CYGPKG_IO_FLASH_BLOCK_DEVICE) || \
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
174 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
175 typedef struct {
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
176 CYG_ADDRESS offset;
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
177 size_t len;
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
178 int flasherr;
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
179 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
180 } 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
181
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
182 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
183 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
184
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
185 typedef struct {
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
186 size_t dev_size;
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
187 } 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
188
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
189 typedef struct {
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
190 cyg_flashaddr_t dev_addr;
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
191 } cyg_io_flash_getconfig_devaddr_t;
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
192
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
193 typedef struct {
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
194 CYG_ADDRESS offset;
2626
a2f5434df2cb Merge flashv2 branch to trunk, with eCosCentric additions
jlarmour
parents: 1394
diff changeset
195 size_t block_size;
208
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
196 } 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
197 #endif
e0c0827131d1 Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents: 184
diff changeset
198
115
6ed91473a1cd Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
diff changeset
199 #endif // _IO_FLASH_H_