1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// arm_olpcx2294_flash.c
|
4 |
|
|
//
|
5 |
|
|
// Flash programming for Intel FlashFile devices on Olimex LPC-X2294
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2008 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): Sergei Gavrikov
|
43 |
|
|
// Contributors: Sergei Gavrikov
|
44 |
|
|
// Date: 2008-11-28
|
45 |
|
|
// Purpose:
|
46 |
|
|
// Description:
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//
|
50 |
|
|
//========================================================================*/
|
51 |
|
|
|
52 |
|
|
#include <pkgconf/system.h>
|
53 |
|
|
|
54 |
|
|
#if !defined(CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294) && \
|
55 |
|
|
!defined(CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294) && \
|
56 |
|
|
!defined(CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294)
|
57 |
|
|
# error Unsupported target
|
58 |
|
|
#endif
|
59 |
|
|
|
60 |
|
|
#ifdef CYGPKG_DEVS_FLASH_STRATA_V2
|
61 |
|
|
|
62 |
|
|
#include <cyg/io/flash.h>
|
63 |
|
|
#include <cyg/io/strata_dev.h>
|
64 |
|
|
|
65 |
|
|
// Olimex LPC-E2294 development board and Olimex LPC-H2294 header board both
|
66 |
|
|
// have 28F320C3-B flash memory part, Olimex LPC-L2294-1M development board has
|
67 |
|
|
// 28F160C3-B flash memory part and Olimex LPC-L2294-8M development board has
|
68 |
|
|
// 28F320C3-B flash memory part. All boards have 16-bit access to it's flash
|
69 |
|
|
// devices.
|
70 |
|
|
static const CYG_FLASH_FUNS(hal_olpcx2294_flash_strata_funs,
|
71 |
|
|
&cyg_strata_init_check_devid_16,
|
72 |
|
|
&cyg_flash_devfn_query_nop,
|
73 |
|
|
&cyg_strata_erase_16,
|
74 |
|
|
&cyg_strata_program_16,
|
75 |
|
|
(int (*)(struct cyg_flash_dev*, const cyg_flashaddr_t, void*, size_t))0,
|
76 |
|
|
&cyg_strata_lock_k3_16,
|
77 |
|
|
&cyg_strata_unlock_k3_16);
|
78 |
|
|
|
79 |
|
|
static const cyg_strata_dev hal_olpcx2294_flash_priv = {
|
80 |
|
|
.manufacturer_code = CYG_FLASH_STRATA_MANUFACTURER_INTEL,
|
81 |
|
|
#if defined(CYGHWR_OLIMEX_BOARD_OLPCL2294_1M)
|
82 |
|
|
.device_code = 0x88c3, /* 16-Mbit x 16-B, 28F160C3-B */
|
83 |
|
|
#else
|
84 |
|
|
.device_code = 0x88c5, /* 32-Mbit x 16-B, 28F320C3-B */
|
85 |
|
|
#endif
|
86 |
|
|
.bufsize = 1,
|
87 |
|
|
.block_info = {
|
88 |
|
|
#if defined(CYGHWR_OLIMEX_BOARD_OLPCL2294_1M)
|
89 |
|
|
{ 0x00002000, 8 },/* boot bottom 8 x 8K blocks */
|
90 |
|
|
{ 0x00010000, 31 } /* 31 x 64K blocks */
|
91 |
|
|
#else
|
92 |
|
|
{ 0x00002000, 8 },/* boot bottom 8 x 8K blocks */
|
93 |
|
|
{ 0x00010000, 63 } /* 63 x 64K blocks */
|
94 |
|
|
#endif
|
95 |
|
|
}
|
96 |
|
|
};
|
97 |
|
|
|
98 |
|
|
#if defined(CYGHWR_OLIMEX_BOARD_OLPCL2294_1M)
|
99 |
|
|
CYG_FLASH_DRIVER(hal_olpcx2294_flash,
|
100 |
|
|
&hal_olpcx2294_flash_strata_funs,
|
101 |
|
|
0,
|
102 |
|
|
0x80000000,
|
103 |
|
|
0x801fffff,
|
104 |
|
|
2,
|
105 |
|
|
hal_olpcx2294_flash_priv.block_info,
|
106 |
|
|
&hal_olpcx2294_flash_priv
|
107 |
|
|
);
|
108 |
|
|
#else
|
109 |
|
|
CYG_FLASH_DRIVER(hal_olpcx2294_flash,
|
110 |
|
|
&hal_olpcx2294_flash_strata_funs,
|
111 |
|
|
0,
|
112 |
|
|
0x80000000,
|
113 |
|
|
0x803fffff,
|
114 |
|
|
2,
|
115 |
|
|
hal_olpcx2294_flash_priv.block_info,
|
116 |
|
|
&hal_olpcx2294_flash_priv
|
117 |
|
|
);
|
118 |
|
|
#endif
|
119 |
|
|
|
120 |
|
|
#endif//CYGPKG_DEVS_FLASH_STRATA_V2
|
121 |
|
|
// ------------------------------------------------------------------------
|
122 |
|
|
// EOF arm_olpcx2294_flash.c
|