Mercurial > flash_v2
annotate packages/io/flash/current/src/flashiodev.c @ 1764:96ec7e534d98
V2 flash header files clean-up. Eliminate flash_priv.h, moving the
functionality into flash_dev.h instead.
| author | bartv |
|---|---|
| date | Tue, 22 Feb 2005 21:03:43 +0000 |
| parents | c4240af0fa28 |
| children |
| rev | line source |
|---|---|
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
1 //========================================================================== |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
2 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
3 // flashiodev.c |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
4 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
5 // Flash device interface to I/O subsystem |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
6 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
7 //========================================================================== |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
8 //####ECOSGPLCOPYRIGHTBEGIN#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
9 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
| 1706 | 12 // Copyright (C) 2004 Andrew Lunn |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
13 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
14 // 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:
diff
changeset
|
15 // 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:
diff
changeset
|
16 // 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:
diff
changeset
|
17 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
18 // 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:
diff
changeset
|
19 // 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:
diff
changeset
|
20 // 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:
diff
changeset
|
21 // for more details. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
22 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
23 // 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:
diff
changeset
|
24 // 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:
diff
changeset
|
25 // 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:
diff
changeset
|
26 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
27 // 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:
diff
changeset
|
28 // 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:
diff
changeset
|
29 // 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:
diff
changeset
|
30 // 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:
diff
changeset
|
31 // 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:
diff
changeset
|
32 // 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:
diff
changeset
|
33 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
34 // 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:
diff
changeset
|
35 // 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:
diff
changeset
|
36 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
37 // 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
|
38 // 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:
diff
changeset
|
39 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
40 //####ECOSGPLCOPYRIGHTEND#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
41 //========================================================================== |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
42 //#####DESCRIPTIONBEGIN#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
43 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
44 // Author(s): jlarmour |
| 1706 | 45 // Contributors: woehler, Andrew Lunn |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
46 // Date: 2002-01-16 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
47 // Purpose: |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
48 // Description: |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
49 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
50 //####DESCRIPTIONEND#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
51 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
52 //========================================================================== |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
53 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
54 #include <pkgconf/io_flash.h> |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
55 #include <errno.h> |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
56 #include <cyg/infra/cyg_type.h> |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
57 #include <cyg/io/devtab.h> |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
58 #include <cyg/io/config_keys.h> |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
59 #include <cyg/io/flash.h> |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
60 #include <string.h> // memcpy |
|
791
a2dfa8bf3c57
Export RedBoot FIS functions - from Knud Woehler <knud.woehler@microplex.de>
gthomas
parents:
210
diff
changeset
|
61 #include <cyg/hal/hal_if.h> |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
62 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
63 #define MIN(x,y) ((x)<(y) ? (x) : (y)) |
| 1706 | 64 #define MAX(x,y) ((x)>(y) ? (x) : (y)) |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
65 |
|
791
a2dfa8bf3c57
Export RedBoot FIS functions - from Knud Woehler <knud.woehler@microplex.de>
gthomas
parents:
210
diff
changeset
|
66 struct flashiodev_priv_t{ |
| 1706 | 67 cyg_flashaddr_t start; |
| 68 cyg_flashaddr_t end; | |
| 69 cyg_bool use_fis; | |
| 70 cyg_bool use_absolute; | |
| 71 cyg_bool use_offset; | |
| 72 char * fis_name; | |
| 73 cyg_uint32 block_size; | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
74 cyg_bool init; |
|
791
a2dfa8bf3c57
Export RedBoot FIS functions - from Knud Woehler <knud.woehler@microplex.de>
gthomas
parents:
210
diff
changeset
|
75 }; |
|
a2dfa8bf3c57
Export RedBoot FIS functions - from Knud Woehler <knud.woehler@microplex.de>
gthomas
parents:
210
diff
changeset
|
76 |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
77 static int dummy_printf( const char *fmt, ... ) {return 0;} |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
78 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
79 static bool |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
80 flashiodev_init( struct cyg_devtab_entry *tab ) |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
81 { |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
82 int stat = cyg_flash_init( &dummy_printf ); |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
83 |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
84 return (stat == CYG_FLASH_ERR_OK); |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
85 } // flashiodev_init() |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
86 |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
87 static Cyg_ErrNo |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
88 flashiodev_lookup(struct cyg_devtab_entry **tab, |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
89 struct cyg_devtab_entry *sub_tab, |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
90 const char *name) |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
91 { |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
92 struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)(*tab)->priv; |
| 1706 | 93 cyg_flash_info_t info; |
| 94 cyg_uint32 i; | |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
95 int stat; |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
96 |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
97 if (dev->init) |
|
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
98 return ENOERR; |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
99 |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
100 if (dev->use_fis) { |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
101 CYG_ADDRESS flash_base; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
102 unsigned long size; |
| 1706 | 103 |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
104 if(!CYGACC_CALL_IF_FLASH_FIS_OP(CYGNUM_CALL_IF_FLASH_FIS_GET_FLASH_BASE, |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
105 dev->fis_name, |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
106 &flash_base)) |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
107 return ENOERR; |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
108 // Strange, yes, but needed since we have to do a lookup in order to |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
109 // set the name using cyg_io_config_set. If we fail here you cannot |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
110 // do a set. Since dev->init will still be false and attempts to |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
111 // actually use the device will fail, so it is safe. |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
112 |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
113 if(!CYGACC_CALL_IF_FLASH_FIS_OP(CYGNUM_CALL_IF_FLASH_FIS_GET_SIZE, |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
114 dev->fis_name, |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
115 &size)) |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
116 return ENOERR; // Ditto. |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
117 dev->start = flash_base; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
118 dev->end = flash_base + size; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
119 } |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
120 if (dev->use_offset) { |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
121 // dev->start the contain the offset to the beginning of the block |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
122 // dev->end is the length of the block |
| 1722 | 123 cyg_flash_info_t info; |
| 124 | |
| 125 cyg_flash_get_info(0, &info); | |
| 126 dev->start = dev->start + info.start; | |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
127 dev->end = dev->start + dev->end; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
128 } |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
129 if (dev->use_absolute) { |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
130 // dev->start is the absolute address of the start |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
131 // dev->end is the length; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
132 dev->end = dev->start + dev->end; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
133 } |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
134 |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
135 stat = cyg_flash_get_info_addr(dev->start, &info); |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
136 if (stat != CYG_FLASH_ERR_OK) { |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
137 return ENODEV; |
| 1706 | 138 } |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
139 dev->block_size = 0; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
140 for (i=0; i < info.num_block_infos; i++){ |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
141 dev->block_size = MAX(dev->block_size, info.block_info[i].block_size); |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
142 } |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
143 |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
144 dev->init = 1; |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
145 return ENOERR; |
|
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
146 } // flashiodev_lookup() |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
147 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
148 static Cyg_ErrNo |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
149 flashiodev_bread( cyg_io_handle_t handle, void *buf, cyg_uint32 *len, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
150 cyg_uint32 pos) |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
151 { |
| 1706 | 152 struct cyg_devtab_entry *tab = (struct cyg_devtab_entry *)handle; |
| 153 struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)tab->priv; | |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
154 |
| 1706 | 155 cyg_flashaddr_t startpos = dev->start + pos; |
| 156 Cyg_ErrNo err; | |
| 157 | |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
158 if (!dev->init) { |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
159 return -EINVAL; |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
160 } |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
161 |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
162 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time |
| 1706 | 163 cyg_flashaddr_t endpos = startpos + *len - 1; |
| 164 if ( startpos < dev->start ) | |
| 165 return -EINVAL; | |
| 166 if ( endpos > dev->end ) | |
| 167 return -EINVAL; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
168 #endif |
| 1706 | 169 |
| 170 err = cyg_flash_read( startpos,(void *)buf, *len, NULL ); | |
| 171 | |
| 172 if ( err != CYG_FLASH_ERR_OK ) | |
| 173 err = -EIO; // just something sane | |
| 174 return err; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
175 } // flashiodev_bread() |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
176 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
177 static Cyg_ErrNo |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
178 flashiodev_bwrite( cyg_io_handle_t handle, const void *buf, cyg_uint32 *len, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
179 cyg_uint32 pos ) |
| 1706 | 180 { |
| 181 struct cyg_devtab_entry *tab = (struct cyg_devtab_entry *)handle; | |
| 182 struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)tab->priv; | |
| 183 | |
| 184 Cyg_ErrNo err; | |
| 185 cyg_flashaddr_t startpos = dev->start + pos; | |
| 186 | |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
187 if (!dev->init) { |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
188 return -EINVAL; |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
189 } |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
190 |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
191 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time |
| 1706 | 192 cyg_flashaddr_t endpos = startpos + *len - 1; |
| 193 if ( startpos < dev->start ) | |
| 194 return -EINVAL; | |
| 195 if ( endpos > dev->end ) | |
| 196 return -EINVAL; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
197 #endif |
| 1706 | 198 err = cyg_flash_program( startpos, (void *)buf, *len, NULL ); |
| 199 | |
| 200 if ( err ) | |
| 201 err = -EIO; // just something sane | |
| 202 return err; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
203 } // flashiodev_bwrite() |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
204 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
205 static Cyg_ErrNo |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
206 flashiodev_get_config( cyg_io_handle_t handle, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
207 cyg_uint32 key, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
208 void* buf, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
209 cyg_uint32* len) |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
210 { |
| 1706 | 211 struct cyg_devtab_entry *tab = (struct cyg_devtab_entry *)handle; |
| 212 struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)tab->priv; | |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
213 |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
214 if (!dev->init) { |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
215 return -EINVAL; |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
216 } |
|
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
217 |
| 1706 | 218 switch (key) { |
| 219 case CYG_IO_GET_CONFIG_FLASH_ERASE: | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
220 { |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
221 if (*len != sizeof( cyg_io_flash_getconfig_erase_t ) ) |
| 1706 | 222 return -EINVAL; |
| 223 { | |
| 224 cyg_io_flash_getconfig_erase_t *e = (cyg_io_flash_getconfig_erase_t *)buf; | |
| 225 cyg_flashaddr_t startpos = dev->start + e->offset; | |
| 226 | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
227 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time |
| 1706 | 228 cyg_flashaddr_t endpos = startpos + e->len - 1; |
| 229 if ( startpos < dev->start ) | |
| 230 return -EINVAL; | |
| 231 if ( endpos > dev->end ) | |
| 232 return -EINVAL; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
233 #endif |
| 1706 | 234 e->flasherr = cyg_flash_erase( startpos, e->len, e->err_address ); |
| 235 } | |
| 236 return ENOERR; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
237 } |
| 1706 | 238 case CYG_IO_GET_CONFIG_FLASH_DEVSIZE: |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
239 { |
| 1706 | 240 if ( *len != sizeof( cyg_io_flash_getconfig_devsize_t ) ) |
| 241 return -EINVAL; | |
| 242 { | |
| 243 cyg_io_flash_getconfig_devsize_t *d = | |
| 244 (cyg_io_flash_getconfig_devsize_t *)buf; | |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
245 |
| 1706 | 246 d->dev_size = dev->end - dev->start; |
| 247 } | |
| 248 return ENOERR; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
249 } |
| 1706 | 250 |
| 251 case CYG_IO_GET_CONFIG_FLASH_BLOCKSIZE: | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
252 { |
| 1706 | 253 cyg_io_flash_getconfig_blocksize_t *b = |
| 254 (cyg_io_flash_getconfig_blocksize_t *)buf; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
255 #ifdef CYGPKG_INFRA_DEBUG // don't bother checking this all the time |
| 1706 | 256 cyg_flashaddr_t startpos = dev->start + b->offset; |
| 257 | |
| 258 if ( startpos < dev->start ) | |
| 259 return -EINVAL; | |
| 260 if ( startpos > dev->end ) | |
| 261 return -EINVAL; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
262 #endif |
| 1706 | 263 if ( *len != sizeof( cyg_io_flash_getconfig_blocksize_t ) ) |
| 264 return -EINVAL; | |
| 265 | |
| 266 // offset unused for now | |
| 267 b->block_size = dev->block_size; | |
| 268 return ENOERR; | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
269 } |
| 1706 | 270 |
| 271 default: | |
| 272 return -EINVAL; | |
| 273 } | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
274 } // flashiodev_get_config() |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
275 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
276 static Cyg_ErrNo |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
277 flashiodev_set_config( cyg_io_handle_t handle, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
278 cyg_uint32 key, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
279 const void* buf, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
280 cyg_uint32* len) |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
281 { |
| 1706 | 282 struct cyg_devtab_entry *tab = (struct cyg_devtab_entry *)handle; |
| 283 struct flashiodev_priv_t *dev = (struct flashiodev_priv_t *)tab->priv; | |
| 284 | |
| 285 switch (key) { | |
| 286 case CYG_IO_SET_CONFIG_FLASH_FIS_NAME: | |
|
1411
5e52f3febc7d
Specify flash block device names at runtime - from David Woodhouse
gthomas
parents:
1391
diff
changeset
|
287 { |
| 1706 | 288 cyg_flashaddr_t flash_base; |
| 289 unsigned long size; | |
| 290 cyg_flash_info_t info; | |
| 291 cyg_uint32 i; | |
| 292 int stat; | |
| 293 | |
| 294 if(!CYGACC_CALL_IF_FLASH_FIS_OP(CYGNUM_CALL_IF_FLASH_FIS_GET_FLASH_BASE, | |
| 295 (char *)buf, &flash_base)) | |
| 296 return -ENOENT; | |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
297 |
| 1706 | 298 if(!CYGACC_CALL_IF_FLASH_FIS_OP(CYGNUM_CALL_IF_FLASH_FIS_GET_SIZE, |
| 299 (char *)buf, &size)) | |
| 300 return -ENOENT; | |
| 301 | |
| 302 dev->start = flash_base; | |
| 303 dev->end = flash_base + size; | |
|
1411
5e52f3febc7d
Specify flash block device names at runtime - from David Woodhouse
gthomas
parents:
1391
diff
changeset
|
304 |
| 1706 | 305 stat = cyg_flash_get_info_addr(dev->start, &info); |
|
1719
c506b95a6346
* src/flashiodev.c Ordering problem again. If an invalid name is
asl
parents:
1715
diff
changeset
|
306 |
| 1706 | 307 if (stat != CYG_FLASH_ERR_OK) { |
| 308 return -ENOENT; | |
| 309 } | |
| 310 dev->block_size = 0; | |
| 311 for (i=0; i < info.num_block_infos; i++){ | |
| 312 dev->block_size = MAX(dev->block_size, info.block_info[i].block_size); | |
| 313 } | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
314 dev->init = 1; |
|
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
315 |
| 1706 | 316 return ENOERR; |
|
1411
5e52f3febc7d
Specify flash block device names at runtime - from David Woodhouse
gthomas
parents:
1391
diff
changeset
|
317 } |
| 1706 | 318 default: |
| 319 return -EINVAL; | |
| 320 } | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
321 } // flashiodev_set_config() |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
322 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
323 // get_config/set_config should be added later to provide the other flash |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
324 // operations possible, like erase etc. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
325 |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
326 #define CYG_FLASHIODEV_DEV(start, end, fis, static, offset, name) \ |
|
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
327 { start, end, fis, static, offset, name, 0, 0 } |
|
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
328 |
| 1706 | 329 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_FIS_1 |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
330 static struct flashiodev_priv_t priv1 = CYG_FLASHIODEV_DEV( |
| 1706 | 331 0, // start |
| 332 0, // end | |
| 333 1, // use_fis | |
| 334 0, // use_static | |
|
1711
3bafac44ac03
* src/flashiodev.c: Fix typo in macro and configuration options
asl
parents:
1706
diff
changeset
|
335 0, // use_offset |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
336 CYGDAT_IO_FLASH_BLOCK_FIS_NAME_1); |
|
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
337 #endif |
| 1706 | 338 |
| 339 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_ABSOLUTE_1 | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
340 static struct flashiodev_priv_t priv1 = CYG_FLASHIODEV_DEV( |
| 1706 | 341 CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_1, // start |
| 342 CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_1 + CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_LENGTH_1, | |
| 343 0, // use_fis | |
| 344 1, // use_static | |
| 345 0, // use_offset | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
346 ""); // fis_name |
|
1711
3bafac44ac03
* src/flashiodev.c: Fix typo in macro and configuration options
asl
parents:
1706
diff
changeset
|
347 #endif |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
348 |
|
1711
3bafac44ac03
* src/flashiodev.c: Fix typo in macro and configuration options
asl
parents:
1706
diff
changeset
|
349 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_1 |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
350 static struct flashiodev_priv_t priv1 = CYG_FLASHIODEV_DEV( |
| 1706 | 351 CYGNUM_IO_FLASH_BLOCK_OFFSET_1, // start |
| 352 CYGNUM_IO_FLASH_BLOCK_LENGTH_1, // end | |
| 353 0, // use_fis | |
| 354 0, // use_static | |
| 355 1, // use_offset | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
356 ""); // fis_name |
| 1706 | 357 #endif |
| 358 | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
359 BLOCK_DEVIO_TABLE( cyg_io_flashdev1_ops, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
360 &flashiodev_bwrite, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
361 &flashiodev_bread, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
362 0, // no select |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
363 &flashiodev_get_config, |
|
1411
5e52f3febc7d
Specify flash block device names at runtime - from David Woodhouse
gthomas
parents:
1391
diff
changeset
|
364 &flashiodev_set_config |
| 1706 | 365 ); |
| 366 | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
367 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
368 BLOCK_DEVTAB_ENTRY( cyg_io_flashdev1, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
369 CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
370 0, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
371 &cyg_io_flashdev1_ops, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
372 &flashiodev_init, |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
373 &flashiodev_lookup, |
| 1706 | 374 &priv1 ); |
| 375 | |
| 376 #ifdef CYGSEM_IO_FLASH_BLOCK_DEVICE_2 | |
| 377 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_FIS_2 | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
378 static struct flashiodev_priv_t priv2 = CYG_FLASHIODEV_DEV( |
| 1706 | 379 0, // start |
| 380 0, // end | |
| 381 1, // use_fis | |
| 382 0, // use_static | |
|
1711
3bafac44ac03
* src/flashiodev.c: Fix typo in macro and configuration options
asl
parents:
1706
diff
changeset
|
383 0, // use_offset |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
384 CYGDAT_IO_FLASH_BLOCK_FIS_NAME_2); |
| 1706 | 385 #endif |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
386 |
| 1706 | 387 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_ABSOLUTE_2 |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
388 static struct flashiodev_priv_t priv2 = CYG_FLASHIODEV_DEV( |
| 1706 | 389 CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_2, // start |
| 390 CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_START_2 + CYGNUM_IO_FLASH_BLOCK_ABSOLUTE_LENGTH_2, | |
| 391 0, // use_fis | |
| 392 1, // use_static | |
| 393 0, // use_offset | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
394 ""); // fis_name |
|
1711
3bafac44ac03
* src/flashiodev.c: Fix typo in macro and configuration options
asl
parents:
1706
diff
changeset
|
395 #endif |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
396 |
|
1711
3bafac44ac03
* src/flashiodev.c: Fix typo in macro and configuration options
asl
parents:
1706
diff
changeset
|
397 #ifdef CYGNUM_IO_FLASH_BLOCK_CFG_STATIC_2 |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
398 static struct flashiodev_priv_t priv2 = CYG_FLASHIODEV_DEV( |
| 1706 | 399 CYGNUM_IO_FLASH_BLOCK_OFFSET_2, // start |
| 400 CYGNUM_IO_FLASH_BLOCK_LENGTH_2, // end | |
| 401 0, // use_fis | |
| 402 0, // use_static | |
| 403 1, // use_offset | |
|
1715
868c3fa9315f
* src/flash.c: Make the flock lock/unlock code compile without
asl
parents:
1714
diff
changeset
|
404 ""); // fis_name |
| 1706 | 405 #endif |
| 406 | |
| 407 BLOCK_DEVTAB_ENTRY( cyg_io_flashdev2, | |
| 408 CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_2, | |
| 409 0, | |
| 410 &cyg_io_flashdev1_ops, | |
| 411 &flashiodev_init, | |
|
1714
39063f315a19
* src/flashiodev.c (flashiodev_lookup): Moved most of the
asl
parents:
1711
diff
changeset
|
412 &flashiodev_lookup, |
| 1706 | 413 &priv2 ); |
| 414 #endif | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
415 |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
diff
changeset
|
416 // EOF flashiodev.c |
