OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/rtos/ecos-2.0/packages/devs/flash/arm
    from Rev 27 to Rev 174
    Reverse comparison

Rev 27 → Rev 174

/cerf/v2_0/cdl/flash_cerf.cdl
0,0 → 1,80
# ====================================================================
#
# flash_cerf.cdl
#
# FLASH memory - Hardware support on Intrinsyc CerfCube
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas
# Original data: gthomas
# Contributors:
# Date: 2000-07-26
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_CERF {
display "Intrinsyc SA1110 (Cerf) FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_SA11X0_CERF
 
requires CYGPKG_DEVS_FLASH_STRATA
 
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
 
include_dir cyg/io
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/cerf_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_cerf.h>"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
 
/cerf/v2_0/include/cerf_strataflash.inl
0,0 → 1,70
#ifndef CYGONCE_DEVS_FLASH_CERF_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_CERF_STRATAFLASH_INL
//==========================================================================
//
// cerf_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas, hmt
// Contributors: gthomas
// Date: 2001-02-24
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
#include <cyg/hal/hal_sa11x0.h> // Hardware definitions
#include <pkgconf/hal_arm_sa11x0_cerf.h> // Platform specifics
 
 
// The cerf has one 16-bit device.
// StrataFlash 28F128.
 
#define CYGNUM_FLASH_DEVICES (1)
#define CYGNUM_FLASH_BASE_MASK (0xFF000000u) // 16Mb
 
#define CYGNUM_FLASH_BASE (0x50000000u)
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_CERF_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF cerf_strataflash.inl
/cerf/v2_0/ChangeLog
0,0 → 1,39
2002-02-04 Gary Thomas <gthomas@redhat.com>
 
* include/cerf_strataflash.inl:
* cdl/flash_cerf.cdl: New file(s) - port to Intrinsyc CerfCube.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/innovator/v2_0/cdl/flash_innovator.cdl
0,0 → 1,71
# ====================================================================
#
# flash_innovator.cdl
#
# FLASH memory - Hardware support on OMAP1510DC EVM
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): Patrick Doyle <wpd@delcomsys.com>
# Contributors: Patrick Doyle <wpd@delcomsys.com>
# Date: 2002-11-26
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_ARM_INNOVATOR {
display "TI OMAP1510DC EVM FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_ARM9_INNOVATOR
 
implements CYGHWR_IO_FLASH_DEVICE
 
compile arm_innovator_flash.c
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED {
display "Generic Intel FlashFile driver required"
}
 
implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED
 
requires CYGHWR_DEVS_FLASH_AMD_AM29DL323D
}
/innovator/v2_0/src/arm_innovator_flash.c
0,0 → 1,72
//==========================================================================
//
// arm_innovator_flash.c
//
// Flash programming for AMD Flash devices on TI OMAP1510DC EVM board
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): Patrick Doyle <wpd@delcomsys.com>
// Contributors: Patrick Doyle <wpd@delcomsys.com>
// Date: 2002-11-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <cyg/hal/innovator.h>
 
//--------------------------------------------------------------------------
// Device properties
 
// We use the one AMD Am29DL323D part on the Innovator.
#define CYGNUM_FLASH_INTERLEAVE (1)
#define CYGNUM_FLASH_SERIES (1)
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BASE (INNOVATOR_FLASH_VIRT_BASE)
 
//--------------------------------------------------------------------------
// Platform specific extras
 
//--------------------------------------------------------------------------
// Now include the driver code.
#include "cyg/io/flash_am29xxxxx.inl"
 
// ------------------------------------------------------------------------
// EOF arm_innovator_flash.c
/innovator/v2_0/ChangeLog
0,0 → 1,40
2003-02-05 Patrick Doyle <wpd@delcomsys.com>
* cdl/flash_innovator.cdl
* src/arm_innovator_flash.c: New package - support for Texas
Instruments Innovator board.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
// Copyright (C) 2003 Delphi Communication Systems, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/assabet/v2_0/cdl/flash_assabet.cdl
0,0 → 1,80
# ====================================================================
#
# flash_assabet.cdl
#
# FLASH memory - Hardware support on Intel StrongARM SA1110
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas
# Original data: gthomas
# Contributors:
# Date: 2000-07-26
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_ASSABET {
display "Intel SA1110 (Assabet) FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_SA11X0_ASSABET
 
requires CYGPKG_DEVS_FLASH_STRATA
 
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
 
include_dir cyg/io
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/assabet_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_assabet.h>"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
 
/assabet/v2_0/include/assabet_strataflash.inl
0,0 → 1,68
#ifndef CYGONCE_DEVS_FLASH_ASSABET_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_ASSABET_STRATAFLASH_INL
//==========================================================================
//
// assabet_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas, hmt
// Contributors: gthomas
// Date: 2001-02-24
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
// The assabet system has two 16-bit devices.
// Doc says: a StrataFlash 28F320J3A. The 320 means 32Mbit, so 4Mbyte.
// Reality: a StrataFlash 28F640J3A. The 640 means 64Mbit, so 8Mbyte.
 
#define CYGNUM_FLASH_DEVICES (2)
#define CYGNUM_FLASH_BASE (0x50000000u)
#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb devices
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_ASSABET_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF assabet_strataflash.inl
/assabet/v2_0/ChangeLog
0,0 → 1,78
2001-03-17 Gary Thomas <gthomas@redhat.com>
 
* src/flash_unlock_block.c:
* src/flash_query.c:
* src/flash_program_buf.c:
* src/flash_lock_block.c:
* src/flash_erase_block.c:
* src/flash.h:
* src/assabet_flash.c: Removed - everything now generic.
 
* include/assabet_strataflash.inl:
* cdl/flash_assabet.cdl: Change to use generic StrataFLASH driver.
 
2000-12-05 Jonathan Larmour <jlarmour@redhat.com>
 
* src/assabet_flash.c (flash_code_overlaps): Define stext/etext
as array types so no assumptions can be made by the compiler about
location.
 
2000-10-24 Gary Thomas <gthomas@redhat.com>
 
* src/flash_unlock_block.c (flash_unlock_block):
* src/flash_lock_block.c (flash_lock_block):
* src/flash_program_buf.c (flash_program_buf):
* src/flash_erase_block.c (flash_erase_block): Support up to 32M FLASH.
 
2000-09-10 Gary Thomas <gthomas@redhat.com>
 
* src/flash_unlock_block.c:
* src/flash_lock_block.c: New file(s).
 
* src/flash.h:
* cdl/flash_assabet.cdl: Add region locking functions.
 
2000-08-29 Gary Thomas <gthomas@redhat.com>
 
* src/assabet_flash.c: Improve error decoding.
 
2000-08-24 Gary Thomas <gthomas@redhat.com>
 
* src/flash_query.c:
* src/flash_erase_block.c:
* src/flash.h: FLASH support for Intel SA1110 Assabet.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/mpc50/v2_0/cdl/flash_mpc50.cdl
0,0 → 1,71
# ====================================================================
#
# flash_mpc50.cdl
#
# MPC 5.0 flash package configuration data
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
# -------------------------------------------
# This file is part of eCos, the Embedded Configurable Operating System.
# Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
#
# eCos is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 or (at your option) any later version.
#
# eCos is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with eCos; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
#
# As a special exception, if other files instantiate templates or use macros
# or inline functions from this file, or you compile this file and link it
# with other works to produce a work based on this file, this file does not
# by itself cause the resulting work to be covered by the GNU General Public
# License. However the source code for this file must still be made available
# in accordance with section (3) of the GNU General Public License.
#
# This exception does not invalidate any other reasons why a work based on
# this file might be covered by the GNU General Public License.
#
# Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
# at http://sources.redhat.com/ecos/ecos-license
# -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): woehler
# Date: 2002-09-02
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_MPC50 {
display "MPC 5.0 FLASH memory support"
description "FLASH memory device support for MPC 5.0"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_XSCALE_MPC50
requires CYGPKG_DEVS_FLASH_STRATA
 
include_dir cyg/io
 
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/mpc50_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_mpc50.h>"
}
}
/mpc50/v2_0/include/mpc50_strataflash.inl
0,0 → 1,63
#ifndef CYGONCE_DEVS_FLASH_MPC50_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_MPC50_STRATAFLASH_INL
//==========================================================================
//
// mpc50_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): woehler
// Date: 2002-09-02
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
// There is a single 16-bit device, on the MPC 5.0
// a StrataFlash RC28F128J3A. -> 128Mb Chip
 
#define CYGNUM_FLASH_DEVICES (1)
#define CYGNUM_FLASH_BASE (0x50000000u)
#define CYGNUM_FLASH_BASE_MASK (0xFC000000u)
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_MPC50_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF mpc50_strataflash.inl
/mpc50/v2_0/ChangeLog
0,0 → 1,39
2003-01-24 Knud Woehler <knud.woehler@microplex.de>
2003-01-24 Mark Salter <msalter@redhat.com>
 
* Initial import from Knud Woehler.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 2003 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/edb7xxx/v2_0/cdl/flash_edb7xxx.cdl
0,0 → 1,126
# ====================================================================
#
# flash_edb7xxx.cdl
#
# FLASH memory - Hardware support on Cirrus Logic EDB7xxx
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas
# Original data: gthomas
# Contributors:
# Date: 2000-07-26
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_EDB7XXX {
display "FLASH support for Cirrus Logic EP7xxx based boards"
description "FLASH memory device support for Cirrus Logic EP7xxx based
development boards"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_EDB7XXX
include_dir cyg/io
 
cdl_component CYGPKG_DEVS_FLASH_EP72XX {
display "Cirrus Logic EP72xx based boards"
description "FLASH memory device support for EP72xx based boards
specifically"
active_if { CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT != "EDB7312" }
calculated 1
no_define
implements CYGHWR_IO_FLASH_DEVICE
implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
compile edb7xxx_flash.c
make -priority 1 {
flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
echo " .globl flash_erase_block_end" >>flash_erase_block.s
echo "flash_erase_block_end:" >>flash_erase_block.s
$(CC) -c -o flash_erase_block.o flash_erase_block.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
}
make -priority 1 {
flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
echo " .globl flash_program_buf_end" >>flash_program_buf.s
echo "flash_program_buf_end:" >>flash_program_buf.s
$(CC) -c -o flash_program_buf.o flash_program_buf.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
}
make -priority 1 {
flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
echo " .globl flash_query_end" >>flash_query.s
echo "flash_query_end:" >>flash_query.s
$(CC) -c -o flash_query.o flash_query.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
}
}
cdl_component CYGPKG_DEVS_FLASH_STRATA_EDB7XXX {
display "Cirrus Logic EDB7xxx StrataFLASH memory support"
description "FLASH memory device support for Cirrus Logic EP73xx"
# Note: currently only available on 7312 boards
active_if { CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7312" }
requires CYGPKG_DEVS_FLASH_STRATA
calculated 1
no_define
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/edb7xxx_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_edb7xxx.h>"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
}
/edb7xxx/v2_0/include/edb7xxx_strataflash.inl
0,0 → 1,66
#ifndef CYGONCE_DEVS_FLASH_EDB7XXX_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_EDB7XXX_STRATAFLASH_INL
//==========================================================================
//
// edb7xxx_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2001-09-24
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
// The edb7xxx system has one 16-bit device.
 
#define CYGNUM_FLASH_DEVICES (1)
#define CYGNUM_FLASH_BASE (0xE0000000u)
#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb devices
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_EDB7XXX_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF edb7xxx_strataflash.inl
/edb7xxx/v2_0/src/flash_program_buf.c
0,0 → 1,112
//==========================================================================
//
// flash_program_buf.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_program_buf(volatile unsigned long *addr, unsigned long *data, int len)
{
volatile unsigned long *ROM;
unsigned long stat = 0;
int timeout = 50000;
int cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
ROM = (volatile unsigned long *)((unsigned long)addr & 0xFF800000);
 
// Clear any error conditions
ROM[0] = FLASH_Clear_Status;
 
while (len > 0) {
ROM[0] = FLASH_Program;
*addr = *data;
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) {
goto bad;
}
}
if (stat & 0x007E007E) {
break;
}
ROM[0] = FLASH_Reset;
if (*addr++ != *data++) {
stat = 0x99109910;
break;
}
len -= 4;
}
 
// Restore ROM to "normal" mode
bad:
ROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/edb7xxx/v2_0/src/flash_query.c
0,0 → 1,94
//==========================================================================
//
// flash_query.c
//
// Flash programming - query device
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
#include CYGHWR_MEMORY_LAYOUT_H
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
#define CNT 2000*1000*10 // At least 20ms
 
int
flash_query(unsigned short *data)
{
volatile unsigned long *ROM;
int cnt;
int cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
ROM = (volatile unsigned long *)0xE0000000;
 
ROM[0] = FLASH_Read_ID;
for (cnt = CNT; cnt > 0; cnt--) ;
*data++ = *ROM++; // Manufacturer code
*data++ = *ROM++; // Device identifier
 
ROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return 0;
}
/edb7xxx/v2_0/src/flash.h
0,0 → 1,70
//==========================================================================
//
// flash.h
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#ifndef _FLASH_HWR_H_
#define _FLASH_HWR_H_
 
#define FLASH_Read_ID 0x90909090
#define FLASH_Read_Status 0x00700070
#define FLASH_Clear_Status 0x50505050
#define FLASH_Status_Ready 0x00800080 // Only low 8 bits
#define FLASH_Program 0x40404040
#define FLASH_Block_Erase 0x20202020
#define FLASH_Confirm 0xD0D0D0D0
#define FLASH_Reset 0xFFFFFFFF
 
#define FLASH_BLOCK_SIZE 0x20000
#define FLASH_BOOT_BLOCK_SIZE 0x4000
 
#define FLASH_Intel_code 0x89
 
#endif // _FLASH_HWR_H_
/edb7xxx/v2_0/src/edb7xxx_flash.c
0,0 → 1,181
//==========================================================================
//
// edb7xxx_flash.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
#define _FLASH_PRIVATE_
#include <cyg/io/flash.h>
 
#include "flash.h"
 
#define _si(p) ((p[0]<<8)|p[1])
 
int
flash_hwr_init(void)
{
unsigned short data[4];
extern char flash_query, flash_query_end;
typedef int code_fun(unsigned char *);
code_fun *_flash_query;
int code_len, stat, num_regions, region_size;
 
// Copy 'program' code to RAM for execution
code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
_flash_query = (code_fun *)flash_info.work_space;
memcpy(_flash_query, &flash_query, code_len);
HAL_DCACHE_SYNC(); // Should guarantee this code will run
 
#if 0
{
volatile int cache_test;
volatile int *cp = 0xE0000000;
// See if the data cache is working
*cp = 0x12345678;
(*flash_info.pf)("ROM cache:\n");
(*flash_info.pf)("cache test = %x\n", *cp);
HAL_DCACHE_INVALIDATE_ALL();
HAL_DCACHE_DISABLE();
(*flash_info.pf)("cache test = %x\n", *cp);
*cp = 0xDEADDEAD;
(*flash_info.pf)("cache test = %x\n", *cp);
HAL_DCACHE_ENABLE();
(*flash_info.pf)("cache test = %x\n", *cp);
cp = 0x00100000;
// See if the data cache is working
*cp = 0x12345678;
(*flash_info.pf)("RAM cache:\n");
(*flash_info.pf)("cache test = %x\n", *cp);
HAL_DCACHE_DISABLE();
(*flash_info.pf)("cache test = %x\n", *cp);
*cp = 0xDEADDEAD;
(*flash_info.pf)("cache test = %x\n", *cp);
HAL_DCACHE_ENABLE();
(*flash_info.pf)("cache test = %x\n", *cp);
}
#endif
 
stat = (*_flash_query)(data);
#if 0
(*flash_info.pf)("stat = %x\n", stat);
dump_buf(data, sizeof(data));
#endif
 
#if 0
{
volatile int cache_test;
volatile int *cp = 0xE0000000;
// See if the data cache is working
(*flash_info.pf)("cache test = %x\n", *cp);
*cp = 0x56781234;
(*flash_info.pf)("cache test = %x\n", *cp);
HAL_DCACHE_INVALIDATE_ALL();
HAL_DCACHE_DISABLE();
(*flash_info.pf)("cache test = %x\n", *cp);
*cp = 0xDEADDEAD;
(*flash_info.pf)("cache test = %x\n", *cp);
HAL_DCACHE_ENABLE();
(*flash_info.pf)("cache test = %x\n", *cp);
}
#endif
 
if (data[0] != FLASH_Intel_code) {
(*flash_info.pf)("Not Intel = %x\n", data[0]);
return FLASH_ERR_HWR;
}
 
if (data[1] == (unsigned short)0x8897) {
num_regions = 64*2;
region_size = 0x20000;
} else {
(*flash_info.pf)("Unknown device type: %x\n", data[1]);
return FLASH_ERR_HWR;
}
 
// Hard wired for now
flash_info.block_size = region_size;
flash_info.blocks = num_regions;
flash_info.start = (void *)0xE0000000;
flash_info.end = (void *)(0xE0000000+(num_regions*region_size));
return FLASH_ERR_OK;
}
 
// Map a hardware status to a package error
int
flash_hwr_map_error(int err)
{
if (err & 0x007E007E) {
(*flash_info.pf)("Err = %x\n", err);
if (err & 0x00100010) {
return FLASH_ERR_PROGRAM;
} else
if (err & 0x00200020) {
return FLASH_ERR_ERASE;
} else
return FLASH_ERR_HWR; // FIXME
} else {
return FLASH_ERR_OK;
}
}
 
// See if a range of FLASH addresses overlaps currently running code
bool
flash_code_overlaps(void *start, void *end)
{
extern char _stext[], _etext[];
 
return ((((unsigned long)&_stext >= (unsigned long)start) &&
((unsigned long)&_stext < (unsigned long)end)) ||
(((unsigned long)&_etext >= (unsigned long)start) &&
((unsigned long)&_etext < (unsigned long)end)));
}
/edb7xxx/v2_0/src/flash_erase_block.c
0,0 → 1,122
//==========================================================================
//
// flash_erase_block.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int flash_erase_block(volatile unsigned long *block)
{
volatile unsigned long *ROM, *sb;
unsigned long stat;
int timeout = 50000;
int cache_on;
int len, block_size;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
ROM = (volatile unsigned long *)((unsigned long)block & 0xFF800000);
 
// Clear any error conditions
ROM[0] = FLASH_Clear_Status;
 
len = FLASH_BLOCK_SIZE;
if (((unsigned long)block - (unsigned long)ROM) < FLASH_BLOCK_SIZE) {
block_size = FLASH_BOOT_BLOCK_SIZE; // First 8 blocks are only 8Kx2 each
} else {
block_size = FLASH_BLOCK_SIZE;
}
sb = block;
while (len > 0) {
// Erase block
ROM[0] = FLASH_Block_Erase;
*block = FLASH_Confirm;
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) break;
}
 
len -= block_size;
block += block_size / sizeof(*block);
}
 
// Restore ROM to "normal" mode
ROM[0] = FLASH_Reset;
 
// If an error was reported, see if the block erased anyway
if (stat & 0x007E007E) {
len = FLASH_BLOCK_SIZE;
block = sb;
while (len > 0) {
if (*block++ != 0xFFFFFFFF) break;
len -= sizeof(*block);
}
if (len == 0) stat = 0;
}
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/edb7xxx/v2_0/ChangeLog
0,0 → 1,86
2001-10-14 Gary Thomas <gthomas@redhat.com>
 
* cdl/flash_edb7xxx.cdl: Missed change in include file location
for StrataFLASH changes.
 
2001-10-12 Jonathan Larmour <jlarmour@redhat.com>
 
* cdl/flash_edb7xxx.cdl: Move EP72xx flash into separate subcomponent.
Clarify package description strings.
Move EP73xx strataflash support into here as another subcomponent.
 
* cdl/flash_strata_edb7xxx.cdl: Delete.
2001-09-25 Gary Thomas <gthomas@redhat.com>
 
* include/edb7xxx_strataflash.inl:
* cdl/flash_strata_edb7xxx.cdl: New setup for EDB7312 which uses
Intel StrataFlash devices.
 
2001-06-11 Gary Thomas <gthomas@redhat.com>
 
* src/edb7xxx_flash.c: Remove dependency on printf() via user functions.
 
2001-05-23 Jesper Skov <jskov@redhat.com>
 
* cdl/flash_edb7xxx.cdl: Needs IO controller to copy functions to
RAM.
 
2000-12-05 Jonathan Larmour <jlarmour@redhat.com>
 
* src/edb7xxx_flash.c (flash_code_overlaps): Define stext/etext
as array types so no assumptions can be made by the compiler about
location.
 
2000-12-04 Gary Thomas <gthomas@redhat.com>
 
* src/edb7xxx_flash.c (flash_hwr_init): Additional debugging
(*flash_info.pf) statments - in case this stuff fails in the future.
 
2000-11-21 Gary Thomas <gthomas@redhat.com>
 
* src/flash_query.c: Increase startup timing - didn't always work.
 
2000-08-29 Gary Thomas <gthomas@redhat.com>
 
* src/edb7xxx_flash.c: Improve error decoding.
 
2000-08-15 Gary Thomas <gthomas@redhat.com>
 
* src/edb7xxx_flash.c (flash_code_overlaps):
stext,etext now are _stext,_etext
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/ipaq/v2_0/cdl/flash_ipaq.cdl
0,0 → 1,85
#====================================================================
#
# flash_ipaq.cdl
#
# FLASH memory - Hardware support on Intel StrongARM SA1110
#
#====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas, hmt
# Original data: gthomas
# Contributors: gthomas
# Date: 2001-02-14
#
#####DESCRIPTIONEND####
#
#====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_IPAQ {
display "Intel SA1110 (iPAQ) FLASH memory support"
description "FLASH memory device support for Intel StrongARM SA-1110"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_SA11X0_IPAQ
 
requires CYGPKG_DEVS_FLASH_STRATA
 
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
 
compile ipaq_flash.c
 
include_dir cyg/io
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/ipaq_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_ipaq.h>"
puts $::cdl_system_header "// External functions"
puts $::cdl_system_header "#define CYGIMP_FLASH_ENABLE ipaq_flash_enable"
puts $::cdl_system_header "#define CYGIMP_FLASH_DISABLE ipaq_flash_disable"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
/ipaq/v2_0/include/ipaq_strataflash.inl
0,0 → 1,68
#ifndef CYGONCE_DEVS_FLASH_IPAQ_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_IPAQ_STRATAFLASH_INL
//==========================================================================
//
// ipaq_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas, hmt
// Contributors: gthomas
// Date: 2001-02-24
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
// The iPAQ system has two 16-bit devices.
// Doc says: a StrataFlash 28F320J3A. The 320 means 32Mbit, so 4Mbyte.
// Reality: a StrataFlash 28F640J3A. The 640 means 64Mbit, so 8Mbyte.
 
#define CYGNUM_FLASH_DEVICES (2)
#define CYGNUM_FLASH_BASE (0x50000000u)
#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb devices
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_IPAQ_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF ipaq_strataflash.inl
/ipaq/v2_0/src/ipaq_flash.c
0,0 → 1,65
//====================================================================
//
// ipaq_flash.c
//
// FLASH memory - Hardware support on Intel StrongARM SA1110
//
//====================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//====================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Original data: gthomas
// Contributors: gthomas
// Date: 2001-03-01
//
//####DESCRIPTIONEND####
//
//====================================================================
 
#include <pkgconf/hal.h>
#include <cyg/hal/ipaq.h>
 
void
ipaq_flash_enable(void *start, void *end)
{
ipaq_EGPIO(SA1110_EIO_VPP, SA1110_EIO_VPP_ON);
}
 
void
ipaq_flash_disable(void *start, void *end)
{
ipaq_EGPIO(SA1110_EIO_VPP, SA1110_EIO_VPP_OFF);
}
/ipaq/v2_0/ChangeLog
0,0 → 1,46
2001-03-01 Gary Thomas <gthomas@redhat.com>
 
* src/ipaq_flash.c: New file - defines enable/disable functions.
 
* cdl/flash_ipaq.cdl: Add special functions required to enable and
disable FLASH programming.
 
2001-02-24 Gary Thomas <gthomas@redhat.com>
 
* include/ipaq_strataflash.inl:
* cdl/flash_ipaq.cdl: New file(s) - FLASH support on iPAQ.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/nano/v2_0/cdl/flash_nano.cdl
0,0 → 1,78
# ====================================================================
#
# flash_nano.cdl
#
# FLASH memory - Hardware support on Intel StrongARM SA1110
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas, hmt
# Original data: gthomas
# Contributors: gthomas
# Date: 2001-02-15
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_NANO {
display "Intel SA1110 nanoEngine FLASH memory support"
description "FLASH memory device support for Intel StrongARM SA-1110"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_SA11X0_NANO
 
requires CYGPKG_DEVS_FLASH_STRATA
 
include_dir cyg/io
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/nano_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_nano.h>"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
/nano/v2_0/include/nano_strataflash.inl
0,0 → 1,71
#ifndef CYGONCE_DEVS_FLASH_NANO_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_NANO_STRATAFLASH_INL
//==========================================================================
//
// nano_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas, hmt
// Contributors: gthomas
// Date: 2001-02-15
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
// This is a single 16-bit device, on the nanoEngine
// a StrataFlash 28F320B3A. The 320 means 32Mbit, so 4Mbyte.
// The B near the end means Boot Block oriented.
 
#define CYGNUM_FLASH_DEVICES (1)
#define CYGNUM_FLASH_BASE (0x50000000u)
#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb devices
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#define CYGOPT_FLASH_IS_BOOTBLOCK 1
 
 
#endif // CYGONCE_DEVS_FLASH_NANO_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF nano_strataflash.inl
/nano/v2_0/ChangeLog
0,0 → 1,43
2001-02-15 Hugo Tyson <hmt@redhat.com>
 
* devs/flash/arm/nano/...: new package. FLASH memory support for
SA1110 nanoEngine from Bright Star Engineering.
 
* include/nano_strataflash.inl: New file
* cdl/flash_nano.cdl: New file.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/aaed2000/v2_0/cdl/flash_arm_aaed2000.cdl
0,0 → 1,71
# ====================================================================
#
# flash_arm_aaed2000.cdl
#
# FLASH memory - Hardware support on Agilent AAED2000
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): jskov, gthomas
# Original data: jskov
# Contributors:
# Date: 2001-10-27
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_ARM_AAED2000 {
display "Agilent AAED2000 FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_ARM9_AAED2000
 
implements CYGHWR_IO_FLASH_DEVICE
 
compile aaed2000_flash.c
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED {
display "Generic AMD flash driver required"
}
 
implements CYGINT_DEVS_FLASH_AMD_AM29XXXXX_REQUIRED
requires CYGHWR_DEVS_FLASH_AMD_AM29LV640
}
/aaed2000/v2_0/src/aaed2000_flash.c
0,0 → 1,74
//==========================================================================
//
// aaed2000_flash.c
//
// Flash programming for Fujitsu/AMD device on Agilent AAED2000
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): jskov, gthomas
// Contributors: jskov
// Date: 2001-10-27
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <cyg/infra/cyg_type.h>
 
//--------------------------------------------------------------------------
// Device properties
 
#define CYGNUM_FLASH_INTERLEAVE (2)
#define CYGNUM_FLASH_SERIES (2)
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BASE (0x60000000)
 
//static cyg_uint32 plf_flash_base;
 
//--------------------------------------------------------------------------
// Platform specific extras
#define CYGHWR_FLASH_AM29XXXXX_NO_WRITE_PROTECT // This feature fails :-(
 
//--------------------------------------------------------------------------
// Now include the driver code.
#include "cyg/io/flash_am29xxxxx.inl"
 
// ------------------------------------------------------------------------
// EOF aaed2000_flash.c
/aaed2000/v2_0/ChangeLog
0,0 → 1,48
2001-11-08 Jesper Skov <jskov@redhat.com>
 
* cdl/flash_arm_aaed2000.cdl: Removed ARM Boot Monitor protection
requirement.
 
2001-10-31 Jesper Skov <jskov@redhat.com>
 
* cdl/flash_arm_aaed2000.cdl: Require protection from ARM Boot
Monitor.
 
2001-10-30 Jesper Skov <jskov@redhat.com>
 
* Imported sources from Gary Thomas.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/sa1100mm/v2_0/cdl/flash_sa1100mm.cdl
0,0 → 1,92
# ====================================================================
#
# flash_sa1100mm.cdl
#
# FLASH memory - Hardware support on StrongARM SA1100 Multimedia
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): dmoseley
# Original data: gthomas
# Contributors:
# Date: 2000-10-25
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_SA1100MM {
display "StrongARM SA1100 Multimedia FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_SA11X0
 
implements CYGHWR_IO_FLASH_DEVICE
implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
 
include_dir .
include_files ; # none _exported_ whatsoever
description "FLASH memory device support for StrongARM SA1100 Multimedia"
compile sa1100mm_flash.c
 
make -priority 1 {
flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
echo " .globl flash_erase_block_end" >>flash_erase_block.s
echo "flash_erase_block_end:" >>flash_erase_block.s
$(CC) -c -o flash_erase_block.o flash_erase_block.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
}
make -priority 1 {
flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
echo " .globl flash_program_buf_end" >>flash_program_buf.s
echo "flash_program_buf_end:" >>flash_program_buf.s
$(CC) -c -o flash_program_buf.o flash_program_buf.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
}
make -priority 1 {
flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
echo " .globl flash_query_end" >>flash_query.s
echo "flash_query_end:" >>flash_query.s
$(CC) -c -o flash_query.o flash_query.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
}
}
 
/sa1100mm/v2_0/src/flash_program_buf.c
0,0 → 1,103
//==========================================================================
//
// flash_program_buf.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, dmoseley
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_program_buf(volatile unsigned long *addr, unsigned long *data, int len)
{
unsigned long stat = 0;
int timeout = 5000000;
int cache_on;
volatile unsigned long *orig_addr = addr;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
// Clear any error conditions
*addr = FLASH_Clear_Status;
 
while (len > 0) {
*addr = FLASH_Program;
*addr = *data++;
timeout = 5000000;
while (((stat = *addr) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) {
goto bad;
}
}
addr++;
len -= sizeof(unsigned long);
}
 
// Restore ROM to "normal" mode
bad:
*orig_addr = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/sa1100mm/v2_0/src/flash.h
0,0 → 1,75
//==========================================================================
//
// flash.h
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, dmoseley
// Date: 2000-10-25
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#ifndef _FLASH_HWR_H_
#define _FLASH_HWR_H_
 
// SA1100 Multimedia FLASH layout
// 2x 28F016SV
// each device is 16x1M organized as 32x128K blocks
 
#define FLASH_Read_ID 0x00900090
#define FLASH_Read_Status 0x00700070
#define FLASH_Clear_Status 0x00500050
#define FLASH_Status_Ready 0x00800080
#define FLASH_Program 0x00100010
#define FLASH_Block_Erase 0x00200020
#define FLASH_Confirm 0x00D000D0
#define FLASH_Reset 0xFFFFFFFF
 
#define FLASH_BLOCK_SIZE 0x40000
 
#define FLASH_Intel_code 0x89
#define FLASH_28F016SV_low 0xA0
#define FLASH_28F016SV_hi 0x66
 
#endif // _FLASH_HWR_H_
/sa1100mm/v2_0/src/flash_query.c
0,0 → 1,95
//==========================================================================
//
// flash_query.c
//
// Flash programming - query device
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, dmoseley
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
#define CNT 20*1000*10 // Approx 200ms
 
int
flash_query(unsigned char *data)
{
volatile unsigned long *lROM;
volatile unsigned char *cROM;
int i, cnt;
int cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
lROM = (unsigned long *)0x08000000;
cROM = (unsigned char *)0x08000000;
 
lROM[0] = FLASH_Read_ID;
for (cnt = CNT; cnt > 0; cnt--) ;
for (i = 0; i < 8; i++) {
*data++ = cROM[i];
}
lROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return 0;
}
/sa1100mm/v2_0/src/flash_erase_block.c
0,0 → 1,95
//==========================================================================
//
// flash_erase_block.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, dmoseley
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_erase_block(volatile unsigned long *block)
{
unsigned long stat;
int timeout = 5000000;
int cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
// Clear any error conditions
*block = FLASH_Clear_Status;
 
// Set to erase
*block = FLASH_Block_Erase;
*block = FLASH_Confirm;
while(((stat = *block) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) break;
}
 
// Restore ROM to "normal" mode
*block = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/sa1100mm/v2_0/src/sa1100mm_flash.c
0,0 → 1,128
//==========================================================================
//
// sa1100mm_flash.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, dmoseley
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
#define _FLASH_PRIVATE_
#include <cyg/io/flash.h>
 
#include "flash.h"
 
int
flash_hwr_init(void)
{
unsigned char data[96];
extern char flash_query, flash_query_end;
typedef int code_fun(unsigned char *);
code_fun *_flash_query;
int code_len, stat, num_regions, region_size, icache_isenabled;
 
// Copy 'program' code to RAM for execution
code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
_flash_query = (code_fun *)flash_info.work_space;
memcpy(_flash_query, &flash_query, code_len);
HAL_ICACHE_IS_ENABLED(icache_isenabled);
HAL_DCACHE_SYNC(); // Should guarantee this code will run
HAL_ICACHE_DISABLE(); // is also required to avoid old contents
 
stat = (*_flash_query)(data);
 
if (icache_isenabled)
HAL_ICACHE_ENABLE();
 
if ((data[0] == FLASH_Intel_code) &&
(data[4] == FLASH_28F016SV_low) &&
(data[5] == FLASH_28F016SV_hi)) {
num_regions = 32;
region_size = 0x20000;
flash_info.block_size = region_size;
flash_info.blocks = num_regions;
flash_info.start = (void *)0x08000000;
flash_info.end = (void *)(0x08000000+(num_regions*region_size));
return FLASH_ERR_OK;
} else {
(*flash_info.pf)("Can't identify FLASH, sorry\n");
diag_dump_buf(data, sizeof(data));
return FLASH_ERR_HWR;
}
}
 
// Map a hardware status to a package error
int
flash_hwr_map_error(int err)
{
if (err & 0x7E) {
if (err & 0x10) {
return FLASH_ERR_PROGRAM;
} else
if (err & 0x20) {
return FLASH_ERR_ERASE;
} else
return FLASH_ERR_HWR; // FIXME
} else {
return FLASH_ERR_OK;
}
}
 
// See if a range of FLASH addresses overlaps currently running code
bool
flash_code_overlaps(void *start, void *end)
{
extern char _stext[], _etext[];
 
return ((((unsigned long)&_stext >= (unsigned long)start) &&
((unsigned long)&_stext < (unsigned long)end)) ||
(((unsigned long)&_etext >= (unsigned long)start) &&
((unsigned long)&_etext < (unsigned long)end)));
}
/sa1100mm/v2_0/ChangeLog
0,0 → 1,65
2001-09-28 Jonathan Larmour <jlarmour@redhat.com>
 
* src/sa1100mm_flash.c (flash_hwr_init): Only re-enable icache if it
was enabled before.
 
2001-06-11 Gary Thomas <gthomas@redhat.com>
 
* src/sa1100mm_flash.c: Remove dependency on printf() via user functions.
 
2001-05-23 Jesper Skov <jskov@redhat.com>
 
* cdl/flash_sa1100mm.cdl: Needs IO controller to copy functions to
RAM.
 
2000-12-05 Jonathan Larmour <jlarmour@redhat.com>
 
* src/sa1100mm_flash.c (flash_code_overlaps): Define stext/etext
as array types so no assumptions can be made by the compiler about
location.
 
2000-10-25 Drew Moseley <dmoseley@redhat.com>
 
* src/sa1100mm_flash.c: New file. Support for SA1100 Multimedia
board.
* src/flash_query.c: Ditto.
* src/flash_program_buf.c: Ditto.
* src/flash_erase_block.c: Ditto.
* src/flash.h: Ditto.
* cdl/flash_sa1100mm.cdl: Ditto.
* ChangeLog: Ditto.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/cerfpda/v2_0/cdl/flash_cerfpda.cdl
0,0 → 1,80
# ====================================================================
#
# flash_cerfpda.cdl
#
# FLASH memory - Hardware support on Intrinsyc CerfPDA
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas
# Original data: gthomas
# Contributors:
# Date: 2000-07-26
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_CERFPDA {
display "Intrinsyc cerfpda FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_SA11X0_CERFPDA
 
requires CYGPKG_DEVS_FLASH_STRATA
 
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
 
include_dir cyg/io
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/cerfpda_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_cerfpda.h>"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
 
/cerfpda/v2_0/include/cerfpda_strataflash.inl
0,0 → 1,69
#ifndef CYGONCE_DEVS_FLASH_CERFPDA_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_CERFPDA_STRATAFLASH_INL
//==========================================================================
//
// cerfpda_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas, hmt
// Contributors: gthomas
// Date: 2001-02-24
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
#include <cyg/hal/hal_sa11x0.h> // Hardware definitions
#include <pkgconf/hal_arm_sa11x0_cerfpda.h> // Platform specifics
 
 
// The cerfpda has 2 16-bit device.
// StrataFlash 28F128. 16Mbyte.
 
#define CYGNUM_FLASH_DEVICES (2)
#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb
#define CYGNUM_FLASH_BASE (0x50000000u)
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_CERFPDA_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF cerfpda_strataflash.inl
/cerfpda/v2_0/ChangeLog
0,0 → 1,39
2002-02-04 Gary Thomas <gthomas@redhat.com>
 
* include/cerfpda_strataflash.inl:
* cdl/flash_cerfpda.cdl: New file(s) - port to Intrinsyc CerfPDA.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/iq80310/v2_0/cdl/flash_iq80310.cdl
0,0 → 1,110
# ====================================================================
#
# flash_iq80310.cdl
#
# FLASH memory - Hardware support on IQ80200/80310
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
## Copyright (C) 2002 Gary Thomas
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): msalter
# Original data: msalter, gthomas
# Contributors:
# Date: 2000-10-10
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_ARM_XSCALE_IQ80310 {
display "Cyclone IQ80310 FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_XSCALE_IOP310
 
implements CYGHWR_IO_FLASH_DEVICE
implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
 
include_dir .
include_files ; # none _exported_ whatsoever
description "FLASH memory device support for Cyclone IQ80310"
compile iq80310_flash.c
 
make -priority 1 {
flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
echo " .globl flash_erase_block_end" >>flash_erase_block.s
echo "flash_erase_block_end:" >>flash_erase_block.s
$(CC) $(CFLAGS) -c -o flash_erase_block.o flash_erase_block.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
}
make -priority 1 {
flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
echo " .globl flash_program_buf_end" >>flash_program_buf.s
echo "flash_program_buf_end:" >>flash_program_buf.s
$(CC) $(CFLAGS) -c -o flash_program_buf.o flash_program_buf.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
}
make -priority 1 {
flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
echo " .globl flash_query_end" >>flash_query.s
echo "flash_query_end:" >>flash_query.s
$(CC) $(CFLAGS) -c -o flash_query.o flash_query.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
}
make -priority 1 {
flash_lock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c
echo " .globl flash_lock_block_end" >>flash_lock_block.s
echo "flash_lock_block_end:" >>flash_lock_block.s
$(CC) $(CFLAGS) -c -o flash_lock_block.o flash_lock_block.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_lock_block.o
}
make -priority 1 {
flash_unlock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c
echo " .globl flash_unlock_block_end" >>flash_unlock_block.s
echo "flash_unlock_block_end:" >>flash_unlock_block.s
$(CC) $(CFLAGS) -c -o flash_unlock_block.o flash_unlock_block.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_unlock_block.o
}
}
 
/iq80310/v2_0/src/flash_lock_block.c
0,0 → 1,96
//==========================================================================
//
// flash_lock_block.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, msalter
// Date: 2000-09-10
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_lock_block(volatile unsigned char *block)
{
volatile unsigned char *ROM;
unsigned short stat;
int timeout = 5000000;
int cache_on;
 
ROM = FLASH_P2V((unsigned long)block & 0xFF800000);
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
// Clear any error conditions
ROM[0] = FLASH_Clear_Status;
 
// Set lock bit
FLASH_P2V(block)[0] = FLASH_Set_Lock;
FLASH_P2V(block)[0] = FLASH_Set_Lock_Confirm; // Confirmation
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) break;
}
 
// Restore ROM to "normal" mode
ROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/iq80310/v2_0/src/flash_program_buf.c
0,0 → 1,156
//==========================================================================
//
// flash_program_buf.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, msalter
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_program_buf(volatile unsigned char *addr, unsigned char *data, int len)
{
volatile unsigned char *ROM;
volatile unsigned char *BA;
unsigned short stat;
int timeout = 5000000;
int i, wc, cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
ROM = FLASH_P2V((unsigned long)addr & 0xFF800000);
BA = FLASH_P2V((unsigned long)addr & 0xFFFE0000);
 
// Clear any error conditions
ROM[0] = FLASH_Clear_Status;
 
wc = 32;
while (len >= wc) {
len -= wc;
 
// The IQ803010 has a hole in flash which must be avoided.
if (((unsigned char *)0x1000) <= addr && addr < ((unsigned char *)0x2000)) {
addr += wc;
data += wc;
continue;
}
 
*BA = FLASH_Write_Buffer;
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) {
stat |= 0x0100;
goto bad;
}
*BA = FLASH_Write_Buffer;
}
*BA = wc-1; // Count is 0..N-1
if (FLASH_P2V(addr) != addr) {
volatile unsigned char *tmp;
 
tmp = FLASH_P2V(addr);
for (i = 0; i < wc; i++)
*tmp++ = *data++;
addr += wc;
} else {
for (i = 0; i < wc; i++)
*addr++ = *data++;
}
*BA = FLASH_Confirm;
stat = *BA;
}
ROM[0] = FLASH_Read_Status;
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) {
stat |= 0x0200;
goto bad;
}
}
 
while (len > 0) {
ROM[0] = FLASH_Program;
*FLASH_P2V(addr) = *data++;
addr++;
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) {
stat |= 0x0300;
goto bad;
}
}
--len;
}
 
// Restore ROM to "normal" mode
bad:
ROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
 
 
/iq80310/v2_0/src/flash_query.c
0,0 → 1,94
//==========================================================================
//
// flash_query.c
//
// Flash programming - query device
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
#include CYGHWR_MEMORY_LAYOUT_H
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
#define CNT 200*1000*10 // Approx 20ms
 
int
flash_query(unsigned char *data)
{
volatile unsigned short *ROM;
int i, cnt;
int cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
ROM = FLASH_P2V(0);
ROM[0] = FLASH_Read_Query;
for (cnt = CNT; cnt > 0; cnt--) ;
for (i = 0; i < sizeof(struct FLASH_query); i++) {
*data++ = ROM[i];
}
 
ROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return 0;
}
/iq80310/v2_0/src/flash.h
0,0 → 1,106
//==========================================================================
//
// flash.h
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, msalter
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#ifndef _FLASH_HWR_H_
#define _FLASH_HWR_H_
 
// First 4K page of flash at physical address zero is
// virtually mapped at address 0xa0000000.
#define FLASH_P2V(x) ((volatile unsigned char *)(((unsigned)(x) < 0x1000) ? \
((unsigned)(x) | 0xd0000000) : \
(unsigned)(x)))
 
#define FLASH_BOOT_BLOCK_SIZE 0x4000
 
#define FLASH_Intel_code 0x89
 
#define FLASH_Read_ID 0x90
#define FLASH_Read_Query 0x98
#define FLASH_Read_Status 0x70
#define FLASH_Clear_Status 0x50
#define FLASH_Status_Ready 0x80
#define FLASH_Write_Buffer 0xE8
#define FLASH_Program 0x10
#define FLASH_Block_Erase 0x20
#define FLASH_Set_Lock 0x60
#define FLASH_Set_Lock_Confirm 0x01
#define FLASH_Clear_Locks 0x60
#define FLASH_Clear_Locks_Confirm 0xD0
#define FLASH_Confirm 0xD0
#define FLASH_Configure 0xB8
#define FLASH_Configure_ReadyWait 0x00
#define FLASH_Configure_PulseOnErase 0x01
#define FLASH_Configure_PulseOnProgram 0x02
#define FLASH_Configure_PulseOnBoth 0x03
#define FLASH_Reset 0xFF
 
#define FLASH_BLOCK_SIZE 0x10000
#define FLASH_WBUF_SIZE 32
 
#define FLASH_Intel_code 0x89
 
// Extended query information
struct FLASH_query {
unsigned char manuf_code;
unsigned char device_code;
unsigned char _unused0[14];
unsigned char id[3]; // Q Q R
unsigned char _unused1[20];
unsigned char device_size;
unsigned char device_interface[2];
unsigned char buffer_size[2];
unsigned char is_block_oriented;
unsigned char num_regions[2];
unsigned char region_size[2];
};
 
#endif // _FLASH_HWR_H_
/iq80310/v2_0/src/iq80310_flash.c
0,0 → 1,132
//==========================================================================
//
// iq80310_flash.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, msalter
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
#define _FLASH_PRIVATE_
#include <cyg/io/flash.h>
 
#include "flash.h"
 
#define _si(p) ((p[1]<<8)|p[0])
 
int
flash_hwr_init(void)
{
struct FLASH_query data, *qp;
extern char flash_query, flash_query_end;
typedef int code_fun(unsigned char *);
code_fun *_flash_query;
int code_len, stat, num_regions, region_size, icache_isenabled;
 
// Copy 'program' code to RAM for execution
code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
_flash_query = (code_fun *)flash_info.work_space;
memcpy(_flash_query, &flash_query, code_len);
HAL_ICACHE_IS_ENABLED(icache_isenabled);
HAL_DCACHE_SYNC(); // Should guarantee this code will run
HAL_ICACHE_DISABLE(); // is also required to avoid old contents
 
memset(&data,0,sizeof(data));
stat = (*_flash_query)((void*)&data);
if (icache_isenabled)
HAL_ICACHE_ENABLE();
 
qp = &data;
if (/*(qp->manuf_code == FLASH_Intel_code) && */
(strncmp(qp->id, "QRY", 3) == 0)) {
num_regions = _si(qp->num_regions)+1;
region_size = _si(qp->region_size)*256;
 
flash_info.block_size = region_size;
flash_info.blocks = num_regions;
flash_info.start = (void *)0x00000000;
flash_info.end = (void *)(0x00000000+(num_regions*region_size));
return FLASH_ERR_OK;
} else {
(*flash_info.pf)("Can't identify FLASH sorry\n");
diag_dump_buf(data, sizeof(data));
return FLASH_ERR_HWR;
}
}
 
// Map a hardware status to a package error
int
flash_hwr_map_error(int err)
{
if (err & 0x7E) {
(*flash_info.pf)("Err = %x\n", err);
if (err & 0x10) {
return FLASH_ERR_PROGRAM;
} else
if (err & 0x20) {
return FLASH_ERR_ERASE;
} else
return FLASH_ERR_HWR; // FIXME
} else {
return FLASH_ERR_OK;
}
}
 
// See if a range of FLASH addresses overlaps currently running code
bool
flash_code_overlaps(void *start, void *end)
{
extern char _stext[], _etext[];
 
return ((((unsigned long)&_stext >= (unsigned long)start) &&
((unsigned long)&_stext < (unsigned long)end)) ||
(((unsigned long)&_etext >= (unsigned long)start) &&
((unsigned long)&_etext < (unsigned long)end)));
}
/iq80310/v2_0/src/flash_unlock_block.c
0,0 → 1,136
//==========================================================================
//
// flash_unlock_block.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, msalter
// Date: 2000-09-10
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
//
// The difficulty with this operation is that the hardware does not support
// unlocking single blocks. However, the logical layer would like this to
// be the case, so this routine emulates it. The hardware can clear all of
// the locks in the device at once. This routine will use that approach and
// then reset the regions which are known to be locked.
//
 
#define MAX_FLASH_BLOCKS 128
 
int
flash_unlock_block(volatile unsigned char *block, int block_size, int blocks)
{
volatile unsigned short *ROM, *bp;
unsigned short stat;
int timeout = 5000000;
unsigned short is_locked[MAX_FLASH_BLOCKS];
int i, cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
ROM = FLASH_P2V((unsigned long)block & 0xFF800000);
 
// Clear any error conditions
ROM[0] = FLASH_Clear_Status;
 
// Get current block lock state. This needs to access each block on
// the device so currently locked blocks can be re-locked.
bp = (unsigned short *)((unsigned long)block & 0xFF800000);
for (i = 0; i < blocks; i++) {
if (bp == block) {
is_locked[i] = 0;
} else {
*(volatile unsigned short *)FLASH_P2V(bp) = FLASH_Read_Query;
is_locked[i] = ((volatile unsigned short *)FLASH_P2V(bp))[2];
}
bp += block_size / sizeof(*bp);
}
 
// Clears all lock bits
FLASH_P2V(block)[0] = FLASH_Clear_Locks;
FLASH_P2V(block)[0] = FLASH_Clear_Locks_Confirm; // Confirmation
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) goto done;
}
 
// Restore the lock state
bp = (unsigned char *)((unsigned long)block & 0xFF800000);
for (i = 0; i < blocks; i++) {
if (is_locked[i]) {
*FLASH_P2V(bp) = FLASH_Set_Lock;
*FLASH_P2V(bp) = FLASH_Set_Lock_Confirm; // Confirmation
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) goto done;
}
}
bp += block_size / sizeof(*bp);
}
 
done:
// Restore ROM to "normal" mode
ROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/iq80310/v2_0/src/flash_erase_block.c
0,0 → 1,114
//==========================================================================
//
// flash_erase_block.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas, msalter
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int flash_erase_block(volatile unsigned char *block)
{
volatile unsigned char *ROM;
unsigned short stat;
int timeout = 50000;
int cache_on;
int len;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
 
// First 4K page of flash at physcial address zero is
// virtually mapped to address 0xa0000000.
ROM = FLASH_P2V((unsigned)block & 0xFF800000);
 
// Clear any error conditions
ROM[0] = FLASH_Clear_Status;
 
// Erase block
ROM[0] = FLASH_Block_Erase;
*FLASH_P2V(block) = FLASH_Confirm;
timeout = 5000000;
while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) break;
}
 
// Restore ROM to "normal" mode
ROM[0] = FLASH_Reset;
 
// If an error was reported, see if the block erased anyway
if (stat & 0x7E) {
len = FLASH_BLOCK_SIZE;
while (len > 0) {
if (*FLASH_P2V(block) != 0xFF)
break;
block++;
len -= sizeof(*block);
}
if (len == 0) stat = 0;
}
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/iq80310/v2_0/ChangeLog
0,0 → 1,81
2002-11-12 Gary Thomas <gary@mlbassoc.com>
 
* cdl/flash_iq80310.cdl: New Xscale platforms layout.
 
2002-04-16 Jonathan Larmour <jlarmour@redhat.com>
 
* cdl/flash_iq80310.cdl: Invoke $(CC) with $(CFLAGS) to ensure the
correct flags are passed.
 
2001-09-28 Jonathan Larmour <jlarmour@redhat.com>
 
* src/iq80310_flash.c (flash_hwr_init): Only re-enable icache if it
was enabled before.
 
2001-08-04 Mark Salter <msalter@redhat.com>
 
* src/flash.h (FLASH_P2V): First 4K of flash now mapped at 0xd0000000.
 
2001-06-11 Gary Thomas <gthomas@redhat.com>
 
* src/iq80310_flash.c: Remove dependency on printf() via user functions.
 
2001-05-23 Jesper Skov <jskov@redhat.com>
 
* cdl/flash_iq80310.cdl: Needs IO controller to copy functions to
RAM.
 
2000-12-05 Jonathan Larmour <jlarmour@redhat.com>
 
* src/iq80310_flash.c (flash_code_overlaps): Define stext/etext
as array types so no assumptions can be made by the compiler about
location.
 
2000-11-22 Mark Salter <msalter@redhat.com>
 
* src/flash_unlock_block.c (flash_unlock_block): Fix broken
read of lock bits.
 
2000-11-19 Mark Salter <msalter@redhat.com>
 
* src/flash_unlock_block.c (flash_unlock_block): Fix lock state
query to properly use FLASH_P2V macro. Don't issue lock state
query for block we are unlocking.
 
* src/flash_program_buf.c (flash_program_buf): Fix code to skip
over Yavapai registers in flash memory space.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/flexanet/v2_0/cdl/flash_flexanet.cdl
0,0 → 1,80
# ====================================================================
#
# flash_flexanet.cdl
#
# FLASH memory - Hardware support on Intel StrongARM SA1110
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas
# Original data: gthomas
# Contributors:
# Date: 2000-07-26
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_FLEXANET {
display "SA1110/Flexanet FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_SA11X0_FLEXANET
 
requires CYGPKG_DEVS_FLASH_STRATA
 
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
 
include_dir cyg/io
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/flexanet_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_flexanet.h>"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
 
/flexanet/v2_0/include/flexanet_strataflash.inl
0,0 → 1,68
#ifndef CYGONCE_DEVS_FLASH_FLEXANET_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_FLEXANET_STRATAFLASH_INL
//==========================================================================
//
// flexanet_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas, hmt
// Contributors: gthomas
// Date: 2001-02-24
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
// The flexanet system has two 16-bit devices.
// Doc says: a StrataFlash 28F320J3A. The 320 means 32Mbit, so 4Mbyte.
// Reality: a StrataFlash 28F640J3A. The 640 means 64Mbit, so 8Mbyte.
 
#define CYGNUM_FLASH_DEVICES (2)
#define CYGNUM_FLASH_BASE (0x50000000u)
#define CYGNUM_FLASH_BASE_MASK (0xFE000000u) // 32Mb devices
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_FLEXANET_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF flexanet_strataflash.inl
/flexanet/v2_0/ChangeLog
0,0 → 1,38
2001-07-27 Jordi Colomer <jco@ict.es>
 
* Add SA11x0/Flexanet flash driver support
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/iq80321/v2_0/cdl/flash_iq80321.cdl
0,0 → 1,80
# ====================================================================
#
# flash_iq80321.cdl
#
# FLASH memory - Hardware support on Intel IQ80321 board
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): msalter
# Original data: gthomas
# Contributors:
# Date: 2001-12-07
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_IQ80321 {
display "Intel IQ80321 FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_XSCALE_IQ80321
 
requires CYGPKG_DEVS_FLASH_STRATA
 
implements CYGHWR_IO_FLASH_BLOCK_LOCKING
 
include_dir cyg/io
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_STRATA_REQUIRED {
display "Generic StrataFLASH driver required"
}
 
implements CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
define_proc {
puts $::cdl_system_header "/***** strataflash driver proc output start *****/"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_INL <cyg/io/iq80321_strataflash.inl>"
puts $::cdl_system_header "#define CYGDAT_DEVS_FLASH_STRATA_CFG <pkgconf/devs_flash_iq80321.h>"
puts $::cdl_system_header "/***** strataflash driver proc output end *****/"
}
}
 
/iq80321/v2_0/include/iq80321_strataflash.inl
0,0 → 1,65
#ifndef CYGONCE_DEVS_FLASH_IQ80321_STRATAFLASH_INL
#define CYGONCE_DEVS_FLASH_IQ80321_STRATAFLASH_INL
//==========================================================================
//
// iq80321_strataflash.inl
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): msalter
// Contributors: gthomas
// Date: 2001-12-07
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
// The iq80321 system has one 16-bit device.
 
#define CYGNUM_FLASH_DEVICES (1)
#define CYGNUM_FLASH_BASE IQ80321_FLASH_ADDR
#define CYGNUM_FLASH_BASE_MASK (0xFF800000u) // 8Mb devices
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BLANK (1)
 
#endif // CYGONCE_DEVS_FLASH_IQ80321_STRATAFLASH_INL
// ------------------------------------------------------------------------
// EOF iq80321_strataflash.inl
/iq80321/v2_0/ChangeLog
0,0 → 1,44
2002-01-28 Mark Salter <msalter@redhat.com>
 
* include/iq80321_strataflash.inl: Include cyg/hal/plf_io.h.
* include/iq80321_strataflash.inl: Doh. Just remove it as unneccessary.
 
2002-01-09 Mark Salter <msalter@redhat.com>
 
* include/iq80321_strataflash.inl: Use platform provided FLASH addr.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/ebsa285/v2_0/cdl/flash_ebsa285.cdl
0,0 → 1,92
# ====================================================================
#
# flash_ebsa285.cdl
#
# FLASH memory - Hardware support on StrongARM EBSA-285
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas
# Original data: gthomas
# Contributors:
# Date: 2000-07-26
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_EBSA285 {
display "StrongARM EBSA-285 FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_EBSA285
 
implements CYGHWR_IO_FLASH_DEVICE
implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
 
include_dir .
include_files ; # none _exported_ whatsoever
description "FLASH memory device support for StrongARM EBSA-285"
compile ebsa285_flash.c
 
make -priority 1 {
flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
echo " .globl flash_erase_block_end" >>flash_erase_block.s
echo "flash_erase_block_end:" >>flash_erase_block.s
$(CC) -c -o flash_erase_block.o flash_erase_block.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
}
make -priority 1 {
flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
echo " .globl flash_program_buf_end" >>flash_program_buf.s
echo "flash_program_buf_end:" >>flash_program_buf.s
$(CC) -c -o flash_program_buf.o flash_program_buf.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
}
make -priority 1 {
flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
echo " .globl flash_query_end" >>flash_query.s
echo "flash_query_end:" >>flash_query.s
$(CC) -c -o flash_query.o flash_query.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
}
}
 
/ebsa285/v2_0/src/flash_program_buf.c
0,0 → 1,103
//==========================================================================
//
// flash_program_buf.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_program_buf(volatile unsigned long *addr, unsigned long *data, int len)
{
unsigned long stat;
int timeout = 5000000;
int cache_on;
volatile unsigned long *orig_addr = addr;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
// Clear any error conditions
*addr = FLASH_Clear_Status;
 
while (len > 0) {
*addr = FLASH_Program;
*addr = *data++;
timeout = 5000000;
while(((stat = *addr) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) {
goto bad;
}
}
addr++;
len -= sizeof(unsigned long);
}
 
// Restore ROM to "normal" mode
bad:
*orig_addr = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/ebsa285/v2_0/src/flash.h
0,0 → 1,74
//==========================================================================
//
// flash.h
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#ifndef _FLASH_HWR_H_
#define _FLASH_HWR_H_
 
// EBSA-285 FLASH layout
// 4x 28F008SA, one device per byte-lane
// each device is 16x64k blocks
 
#define FLASH_Read_ID 0x90909090
#define FLASH_Read_Status 0x70707070
#define FLASH_Clear_Status 0x50505050
#define FLASH_Status_Ready 0x80808080
#define FLASH_Program 0x10101010
#define FLASH_Block_Erase 0x20202020
#define FLASH_Confirm 0xD0D0D0D0
#define FLASH_Reset 0xFFFFFFFF
 
#define FLASH_BLOCK_SIZE 0x40000
 
#define FLASH_Intel_code 0x89
#define FLASH_28F008SA 0xA2
#define FLASH_28F008SC 0xA6
#endif // _FLASH_HWR_H_
/ebsa285/v2_0/src/flash_query.c
0,0 → 1,95
//==========================================================================
//
// flash_query.c
//
// Flash programming - query device
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
#define CNT 20*1000*10 // Approx 200ms
 
int
flash_query(unsigned char *data)
{
volatile unsigned long *lROM;
volatile unsigned char *cROM;
int i, cnt;
int cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
lROM = 0x41000000;
cROM = 0x41000000;
 
lROM[0] = FLASH_Read_ID;
for (cnt = CNT; cnt > 0; cnt--) ;
for (i = 0; i < 8; i++) {
*data++ = cROM[i];
}
lROM[0] = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return 0;
}
/ebsa285/v2_0/src/ebsa285_flash.c
0,0 → 1,127
//==========================================================================
//
// ebsa285_flash.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-26
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
#define _FLASH_PRIVATE_
#include <cyg/io/flash.h>
 
#include "flash.h"
 
int
flash_hwr_init(void)
{
unsigned char data[96];
extern char flash_query, flash_query_end;
typedef int code_fun(unsigned char *);
code_fun *_flash_query;
int code_len, stat, num_regions, region_size, icache_isenabled;
 
// Copy 'program' code to RAM for execution
code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
_flash_query = (code_fun *)flash_info.work_space;
memcpy(_flash_query, &flash_query, code_len);
HAL_ICACHE_IS_ENABLED(icache_isenabled);
HAL_DCACHE_SYNC(); // Should guarantee this code will run
HAL_ICACHE_DISABLE(); // is also required to avoid old contents
 
stat = (*_flash_query)(data);
 
if (icache_isenabled)
HAL_ICACHE_ENABLE();
 
if ((data[0] == FLASH_Intel_code) && ((data[4] == FLASH_28F008SA) ||
(data[4] == FLASH_28F008SC))) {
num_regions = 16;
region_size = 0x40000;
flash_info.block_size = region_size;
flash_info.blocks = num_regions;
flash_info.start = (void *)0x41000000;
flash_info.end = (void *)(0x41000000+(num_regions*region_size));
return FLASH_ERR_OK;
} else {
(*flash_info.pf)("Can't identify FLASH, sorry\n");
diag_dump_buf(data, sizeof(data));
return FLASH_ERR_HWR;
}
}
 
// Map a hardware status to a package error
int
flash_hwr_map_error(int err)
{
if (err & 0x7E) {
if (err & 0x10) {
return FLASH_ERR_PROGRAM;
} else
if (err & 0x20) {
return FLASH_ERR_ERASE;
} else
return FLASH_ERR_HWR; // FIXME
} else {
return FLASH_ERR_OK;
}
}
 
// See if a range of FLASH addresses overlaps currently running code
bool
flash_code_overlaps(void *start, void *end)
{
extern char _stext[], _etext[];
 
return ((((unsigned long)&_stext >= (unsigned long)start) &&
((unsigned long)&_stext < (unsigned long)end)) ||
(((unsigned long)&_etext >= (unsigned long)start) &&
((unsigned long)&_etext < (unsigned long)end)));
}
/ebsa285/v2_0/src/flash_erase_block.c
0,0 → 1,95
//==========================================================================
//
// flash_erase_block.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-07-14
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_erase_block(volatile unsigned long *block)
{
unsigned long stat;
int timeout = 5000000;
int cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
// Clear any error conditions
*block = FLASH_Clear_Status;
 
// Set to erase
*block = FLASH_Block_Erase;
*block = FLASH_Confirm;
while(((stat = *block) & FLASH_Status_Ready) != FLASH_Status_Ready) {
if (--timeout == 0) break;
}
 
// Restore ROM to "normal" mode
*block = FLASH_Reset;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return stat;
}
/ebsa285/v2_0/ChangeLog
0,0 → 1,80
2001-09-28 Jonathan Larmour <jlarmour@redhat.com>
 
* src/ebsa285_flash.c (flash_hwr_init): Only re-enable icache if it
was enabled before.
 
2001-07-11 Andrew Lunn <andrew.lunn@ascom.ch>
 
* src/flash.h:
* src/ebsa285_flash.c (flash_hwr_init): Support new device 28F008SC.
 
2001-06-11 Gary Thomas <gthomas@redhat.com>
 
* src/ebsa285_flash.c: Remove dependency on printf() via user functions.
 
2001-05-23 Jesper Skov <jskov@redhat.com>
 
* cdl/flash_ebsa285.cdl: Needs IO controller to copy functions to
RAM.
 
2000-12-05 Jonathan Larmour <jlarmour@redhat.com>
 
* src/ebsa285_flash.c (flash_code_overlaps): Define stext/etext
as array types so no assumptions can be made by the compiler about
location.
 
2000-08-29 Gary Thomas <gthomas@redhat.com>
 
* src/ebsa285_flash.c: Improve error decoding.
 
2000-08-22 Hugo Tyson <hmt@cygnus.co.uk>
 
* src/ebsa285_flash.c (flash_hwr_init): Add
HAL_ICACHE_DISABLE/ENABLE pairs around calls to RAM copy of query
function - this is necessary to get reliable operation on EBSA285
and similar. Otherwise, what is in the instruction cache might be
run instead.
 
2000-08-15 Gary Thomas <gthomas@redhat.com>
 
* src/ebsa285_flash.c (flash_code_overlaps):
stext,etext now are _stext,_etext
 
2000-08-14 Gary Thomas <gthomas@redhat.com>
 
* src/ebsa285_flash.c: New file(s).
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/pid/v2_0/cdl/flash_arm_pid.cdl
0,0 → 1,69
# ====================================================================
#
# flash_pid.cdl
#
# FLASH memory - Hardware support on ARM PID board
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas, hmt, jskov
# Original data: gthomas
# Contributors: gthomas
# Date: 2001-02-20
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_ARM_PID {
display "ARM PID board FLASH memory support"
description "FLASH memory device support for ARM PID board"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_PID
 
compile arm_pid_flash.c
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_ATMEL_AT29CXXXX_REQUIRED {
display "Generic AMD AM29F040 driver required"
}
 
implements CYGINT_DEVS_FLASH_ATMEL_AT29CXXXX_REQUIRED
}
/pid/v2_0/src/arm_pid_flash.c
0,0 → 1,65
//==========================================================================
//
// arm_pid_flash.c
//
// Flash programming for Atmel device on ARM PID board
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): jskov
// Contributors: jskov
// Date: 2001-02-21
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
 
// There's a single AT29C040 on the PID board.
 
#define CYGPKG_DEVS_FLASH_ATMEL_AT29C040A
#define CYGNUM_FLASH_INTERLEAVE (1)
#define CYGNUM_FLASH_SERIES (1)
#define CYGNUM_FLASH_BASE (0x4000000u)
 
#include "cyg/io/flash_at29cxxxx.inl"
 
 
// ------------------------------------------------------------------------
// EOF arm_pid_flash.c
/pid/v2_0/ChangeLog
0,0 → 1,43
2001-02-20 Jesper Skov <jskov@redhat.com>
 
* devs/flash/arm/pid/...: new package. FLASH memory support for
ARM PID board.
 
* include/arm_pid_flash.inl: New file
* cdl/flash_arm_pid.cdl: New file.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/integrator/v2_0/cdl/flash_integrator.cdl
0,0 → 1,71
# ====================================================================
#
# flash_integrator.cdl
#
# FLASH memory - Hardware support on ARM Integrator
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): jskov, nickg
# Contributors: jskov
# Date: 2002-02-27
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_ARM_INTEGRATOR {
display "ARM Integrator FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_INTEGRATOR
 
implements CYGHWR_IO_FLASH_DEVICE
 
compile arm_integrator_flash.c
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED {
display "Generic Intel FlashFile driver required"
}
 
implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED
 
requires CYGHWR_DEVS_FLASH_INTEL_28F320S3
}
/integrator/v2_0/src/arm_integrator_flash.c
0,0 → 1,106
//==========================================================================
//
// arm_integrator_flash.c
//
// Flash programming for Intel FlashFile devices on ARM Integrator board
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): jskov
// Contributors: jskov
// Date: 2001-08-07
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
//--------------------------------------------------------------------------
// Device properties
 
// We use the eight Intel 28F320S3 parts on the Integrator board.
// These are arranged in a 2x4 grid, giving 32 bits wide by 32MB long.
 
#define CYGNUM_FLASH_INTERLEAVE (2)
#define CYGNUM_FLASH_SERIES (4)
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BASE (0x24000000)
 
//--------------------------------------------------------------------------
// Platform specific extras
 
#define CYGHWR_FLASH_WRITE_ENABLE() \
{ \
volatile cyg_uint32 *ebi_csr1 = (volatile cyg_uint32 *)INTEGRATOR_EBI_CSR1; \
\
/* allow write access to EBI_CSR1 area (Flash) */ \
*ebi_csr1 |= INTEGRATOR_EBI_WRITE_ENABLE; \
\
if (!(*ebi_csr1 & INTEGRATOR_EBI_WRITE_ENABLE)) { \
*(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0xA05F; \
*ebi_csr1 |= INTEGRATOR_EBI_WRITE_ENABLE; \
*(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0; \
} \
\
/* Enable Vpp and allow write access to Flash in system controller */ \
*(volatile unsigned int *)INTEGRATOR_SC_CTRLS = FL_SC_CONTROL; \
}
 
#define CYGHWR_FLASH_WRITE_DISABLE() \
{ \
volatile cyg_uint32 *ebi_csr1 = (volatile cyg_uint32 *)INTEGRATOR_EBI_CSR1; \
\
/* disable write access to EBI_CSR1 area (Flash) */ \
*ebi_csr1 &= ~INTEGRATOR_EBI_WRITE_ENABLE; \
\
if (*ebi_csr1 & INTEGRATOR_EBI_WRITE_ENABLE) { \
*(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 0xA05F; \
*ebi_csr1 &= ~INTEGRATOR_EBI_WRITE_ENABLE; \
*(volatile cyg_uint32 *)INTEGRATOR_EBI_LOCK = 1; \
} \
\
/* Disable Vpp and disable write access to Flash in system controller */ \
*(volatile unsigned int *)INTEGRATOR_SC_CTRLS = 0; \
}
 
//--------------------------------------------------------------------------
// Now include the driver code.
#include "cyg/io/flash_28fxxx.inl"
 
// ------------------------------------------------------------------------
// EOF arm_integrator_flash.c
/integrator/v2_0/ChangeLog
0,0 → 1,55
2002-03-06 Nick Garnett <nickg@redhat.com>
 
* cdl/flash_integrator.cdl: Converted to use generic 28Fxxx flash
driver.
 
* src/arm_integrator_flash.c:
This file added to parameterize generic FLASH driver. Also define
here CYGHWR_FLASH_WRITE_ENABLE() and CYGHWR_FLASH_WRITE_DISABLE()
to turn FLASH writing on and off.
 
* src/flash.h:
* src/flash_erase_block.c:
* src/flash_program_buf.c:
* src/flash_query.c:
Files removed. These are the old flash driver.
2001-10-30 Philippe Robin <Philippe.Robin@arm.com>
2001-10-30 Jonathan Larmour <jlarmour@redhat.com>
 
* Initial version of ARM Integrator flash driver.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/excalibur/v2_0/cdl/flash_excalibur.cdl
0,0 → 1,71
# ====================================================================
#
# flash_excalibur.cdl
#
# FLASH memory - Hardware support on Altera ARM9/Excalibur
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): jskov
# Contributors: jskov
# Date: 2001-08-07
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_ARM_EXCALIBUR {
display "Altera ARM9/Excalibur FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_ARM9_EXCALIBUR
 
implements CYGHWR_IO_FLASH_DEVICE
 
compile arm_excalibur_flash.c
 
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED {
display "Generic Intel FlashFile driver required"
}
 
implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED
 
requires CYGHWR_DEVS_FLASH_INTEL_28F320C3
}
/excalibur/v2_0/src/arm_excalibur_flash.c
0,0 → 1,72
//==========================================================================
//
// arm_excalibur_flash.c
//
// Flash programming for Intel FlashFile devices on ARM Excalibur board
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): jskov
// Contributors: jskov
// Date: 2001-08-07
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <cyg/hal/excalibur.h>
 
//--------------------------------------------------------------------------
// Device properties
 
// We use the four Intel 28F320C3 parts on the Excalibur board.
#define CYGNUM_FLASH_INTERLEAVE (1)
#define CYGNUM_FLASH_SERIES (4)
#define CYGNUM_FLASH_WIDTH (16)
#define CYGNUM_FLASH_BASE (EXCALIBUR_FLASH_PHYS_BASE)
 
//--------------------------------------------------------------------------
// Platform specific extras
 
//--------------------------------------------------------------------------
// Now include the driver code.
#include "cyg/io/flash_28fxxx.inl"
 
// ------------------------------------------------------------------------
// EOF arm_excalibur_flash.c
/excalibur/v2_0/ChangeLog
0,0 → 1,44
2001-08-17 Jesper Skov <jskov@redhat.com>
[from branch]
* src/arm_excalibur_flash.c: Use all 4 flash parts.
 
* cdl/flash_excalibur.cdl: Fix typo.
 
2001-08-10 Jesper Skov <jskov@redhat.com>
 
* Created.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
/at91/v2_0/cdl/flash_at91.cdl
0,0 → 1,93
# ====================================================================
#
# flash_at91.cdl
#
# FLASH memory - Hardware support on Atmel At91/EB40
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): gthomas
# Original data: gthomas
# Contributors:
# Date: 2001-07-17
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_DEVS_FLASH_AT91 {
display "Atmel At91/EB40 FLASH memory support"
 
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
requires CYGPKG_HAL_ARM_AT91
 
implements CYGHWR_IO_FLASH_DEVICE
implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
 
include_dir .
include_files ; # none _exported_ whatsoever
 
description "FLASH memory device support for Atmel At91/EB40 boards"
compile at91_flash.c
 
make -priority 1 {
flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
echo " .globl flash_erase_block_end" >>flash_erase_block.s
echo "flash_erase_block_end:" >>flash_erase_block.s
$(CC) -c -o flash_erase_block.o flash_erase_block.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
}
make -priority 1 {
flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
echo " .globl flash_program_buf_end" >>flash_program_buf.s
echo "flash_program_buf_end:" >>flash_program_buf.s
$(CC) -c -o flash_program_buf.o flash_program_buf.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
}
make -priority 1 {
flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
$(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
echo " .globl flash_query_end" >>flash_query.s
echo "flash_query_end:" >>flash_query.s
$(CC) -c -o flash_query.o flash_query.s
$(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
}
}
 
/at91/v2_0/src/flash_program_buf.c
0,0 → 1,127
//==========================================================================
//
// flash_program_buf.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2001-07-17
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int
flash_program_buf(volatile unsigned short *addr, unsigned short *data, int len)
{
volatile unsigned short *PAGE, *ROM;
int timeout = 50000;
int cache_on;
int i, offset;
unsigned short hold[FLASH_PAGE_SIZE/2];
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
if (len != FLASH_PAGE_SIZE) {
return FLASH_LENGTH_ERROR;
}
 
ROM = (volatile unsigned short *)((unsigned long)addr & 0xFFFF0000);
PAGE = (volatile unsigned short *)((unsigned long)addr & FLASH_PAGE_MASK);
 
// Copy current contents (allows for partial updates)
for (i = 0; i < FLASH_PAGE_SIZE/2; i++) {
hold[i] = PAGE[i];
}
 
// Merge data into holding buffer
offset = (unsigned long)addr & FLASH_PAGE_OFFSET;
for (i = 0; i < (len/2); i++) {
hold[offset+i] = data[i];
}
 
// Now write the data
 
// Send lead-in sequence
ROM[FLASH_Key_Addr0] = FLASH_Key0;
ROM[FLASH_Key_Addr1] = FLASH_Key1;
 
// Send 'write' command
ROM[FLASH_Key_Addr0] = FLASH_Program;
 
// Send one page/sector of data
for (i = 0; i < FLASH_PAGE_SIZE/2; i++) {
PAGE[i] = hold[i];
}
 
// Wait for data to be programmed
while (timeout-- > 0) {
if (PAGE[(FLASH_PAGE_SIZE/2)-1] == hold[(FLASH_PAGE_SIZE/2)-1]) {
break;
}
}
 
if (timeout <= 0) {
return FLASH_PROGRAM_ERROR;
}
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return FLASH_PROGRAM_OK;
}
/at91/v2_0/src/flash_query.c
0,0 → 1,109
//==========================================================================
//
// flash_query.c
//
// Flash programming - query device
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2001-07-17
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
#include CYGHWR_MEMORY_LAYOUT_H
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
#define CNT 2000*1000*10 // At least 20ms
 
int
flash_query(unsigned short *data)
{
volatile unsigned short *ROM;
int cnt, cache_on;
 
HAL_DCACHE_IS_ENABLED(cache_on);
if (cache_on) {
HAL_DCACHE_SYNC();
HAL_DCACHE_DISABLE();
}
 
ROM = (volatile unsigned short *)0x01010000;
 
// Send lead-in sequence
ROM[FLASH_Key_Addr0] = FLASH_Key0;
ROM[FLASH_Key_Addr1] = FLASH_Key1;
 
// Send 'identify' command
ROM[FLASH_Key_Addr0] = FLASH_Read_ID;
 
// Need a delay of 20ms!
for (cnt = 0; cnt < 50000; cnt++) ;
 
data[0] = ROM[0]; // Manufacturer code
data[1] = ROM[1]; // Device identifier
 
// Send lead-in sequence
ROM[FLASH_Key_Addr0] = FLASH_Key0;
ROM[FLASH_Key_Addr1] = FLASH_Key1;
 
// Send 'reset' command
ROM[FLASH_Key_Addr0] = FLASH_Reset;
 
// Need a delay of 20ms!
for (cnt = 0; cnt < 50000; cnt++) ;
 
if (cache_on) {
HAL_DCACHE_ENABLE();
}
 
return 0;
}
/at91/v2_0/src/flash.h
0,0 → 1,78
//==========================================================================
//
// flash.h
//
// Flash programming - device constants, etc.
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2001-07-17
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#ifndef _FLASH_HWR_H_
#define _FLASH_HWR_H_
 
// Atmel AT29LV1024
 
#define FLASH_Read_ID 0x9090
#define FLASH_Program 0xA0A0
#define FLASH_Reset 0xF0F0
 
#define FLASH_Key_Addr0 0x5555
#define FLASH_Key_Addr1 0x2AAA
#define FLASH_Key0 0xAAAA
#define FLASH_Key1 0x5555
 
#define FLASH_Atmel_code 0x1F
#define FLASH_ATMEL_29LV1024 0x26
 
#define FLASH_PROGRAM_OK 0x0000
#define FLASH_LENGTH_ERROR 0x0001
#define FLASH_PROGRAM_ERROR 0x0002
 
#define FLASH_PAGE_SIZE 0x100
#define FLASH_PAGE_MASK ~(FLASH_PAGE_SIZE-1)
#define FLASH_PAGE_OFFSET (FLASH_PAGE_SIZE-1)
 
#endif // _FLASH_HWR_H_
/at91/v2_0/src/flash_erase_block.c
0,0 → 1,71
//==========================================================================
//
// flash_erase_block.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2001-07-17
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include "flash.h"
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
 
//
// CAUTION! This code must be copied to RAM before execution. Therefore,
// it must not contain any code which might be position dependent!
//
 
int flash_erase_block(volatile unsigned long *block)
{
 
// This device is implicitly erased as each sector needs to be written
// as a whole. Thus, this is a NOP
 
return 0;
}
/at91/v2_0/src/at91_flash.c
0,0 → 1,129
//==========================================================================
//
// at91_flash.c
//
// Flash programming
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2001-07-17
// Purpose:
// Description:
//
//####DESCRIPTIONEND####
//
//==========================================================================
 
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/hal_cache.h>
#include <cyg/hal/hal_io.h>
 
#define _FLASH_PRIVATE_
#include <cyg/io/flash.h>
 
#include "flash.h"
 
#define _si(p) ((p[0]<<8)|p[1])
 
int
flash_hwr_init(void)
{
unsigned short data[4];
extern char flash_query, flash_query_end;
typedef int code_fun(unsigned char *);
code_fun *_flash_query;
int code_len, stat, num_regions, region_size;
 
// Copy 'program' code to RAM for execution
code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
_flash_query = (code_fun *)flash_info.work_space;
memcpy(_flash_query, &flash_query, code_len);
HAL_DCACHE_SYNC(); // Should guarantee this code will run
 
stat = (*_flash_query)(data);
#if 0
(*flash_info.pf)("stat = %x\n", stat);
dump_buf(data, sizeof(data));
#endif
 
if (data[0] != FLASH_Atmel_code) {
(*flash_info.pf)("Not Atmel = %x\n", data[0]);
return FLASH_ERR_HWR;
}
 
if (data[1] == (unsigned short)FLASH_ATMEL_29LV1024) {
num_regions = 256;
region_size = 0x100;
} else {
(*flash_info.pf)("Unknown device type: %x\n", data[1]);
return FLASH_ERR_HWR;
}
 
// Hard wired for now
flash_info.block_size = region_size;
flash_info.blocks = num_regions;
flash_info.start = (void *)0x01010000;
flash_info.end = (void *)(0x01010000+(num_regions*region_size));
return FLASH_ERR_OK;
}
 
// Map a hardware status to a package error
int
flash_hwr_map_error(int err)
{
if (err) {
(*flash_info.pf)("Err = %x\n", err);
return FLASH_ERR_PROGRAM;
} else {
return FLASH_ERR_OK;
}
}
 
// See if a range of FLASH addresses overlaps currently running code
bool
flash_code_overlaps(void *start, void *end)
{
extern char _stext[], _etext[];
 
return ((((unsigned long)&_stext >= (unsigned long)start) &&
((unsigned long)&_stext < (unsigned long)end)) ||
(((unsigned long)&_etext >= (unsigned long)start) &&
((unsigned long)&_etext < (unsigned long)end)));
}
/at91/v2_0/ChangeLog
0,0 → 1,49
2001-07-19 Gary Thomas <gthomas@redhat.com>
 
* src/flash_program_buf.c: Fix - needs to have A16 set.
 
* src/at91_flash.c: Remove debugging code.
 
2001-07-18 Gary Thomas <gthomas@redhat.com>
 
* src/flash_query.c:
* src/flash_program_buf.c:
* src/flash_erase_block.c:
* src/flash.h:
* src/at91_flash.c:
* cdl/flash_at91.cdl: New package - AT29LV1024 FLASH for AT91/EB40.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.