# HG changeset patch # User Ross Younger # Date 1411778137 -43200 # Node ID 77f93339ffd8275d5bfa84713e304415f3d9e27e # Parent c1cbf062a826e8cbd040c42386935e5480135d7d io/nand include/nand_internal.h: Create header to expose internal functions to NAND drivers. diff --git a/packages/io/nand/current/ChangeLog b/packages/io/nand/current/ChangeLog --- a/packages/io/nand/current/ChangeLog +++ b/packages/io/nand/current/ChangeLog @@ -3,6 +3,8 @@ 2014-09-27 Ross Younger diff --git a/packages/io/nand/current/include/nand_internal.h b/packages/io/nand/current/include/nand_internal.h new file mode 100644 --- /dev/null +++ b/packages/io/nand/current/include/nand_internal.h @@ -0,0 +1,90 @@ +#ifndef CYGONCE_NAND_INTERNAL_H +# define CYGONCE_NAND_INTERNAL_H +//============================================================================= +// +// nand_internal.h +// +// NAND library internal calls, for use by drivers and the BBT. +// This file should not be included by application code. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 2009 eCosCentric Limited. +// +// 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): wry +// Date: 2009-03-11 +// +//####DESCRIPTIONEND#### +//============================================================================= + +#ifndef CYG_NAND_ALLOW_INTERNALS +/* BEWARE! + * + * Applications should not include this file. + * All the contents are internal interfaces and subject to + * change without notice. + */ +#error "Applications should not include this file directly." +#endif + + +#include +#include +#include + +/* Raw unchecked NAND access, for use by the BBT and drivers ========= */ + +/* Takes a DEVICE address. Caller must hold the devlock! */ +int nandi_read_whole_page_raw(cyg_nand_device *dev, cyg_nand_page_addr page, + CYG_BYTE * dest, + CYG_BYTE * spare, size_t spare_size, + int check_ecc); + +/* Takes a DEVICE address. Caller must hold the devlock! */ +int nandi_write_page_raw(cyg_nand_device *dev, cyg_nand_page_addr page, + const CYG_BYTE * src, + const CYG_BYTE * spare, size_t spare_size); + +/* NOTE for driver authors: + * If calling these functions from within a plf_partition_setup function, + * i.e. within the cyg_nand_lookup call chain, the device lock is + * irrelevant as it has not yet been set up. */ + +/* Code outside of the BBT can use the pagebuffer ==================== */ +CYG_BYTE* nandi_grab_pagebuf(void); +void nandi_release_pagebuf(void); + +/* =================================================================== */ + +#endif diff --git a/packages/io/nand/current/src/nand.c b/packages/io/nand/current/src/nand.c --- a/packages/io/nand/current/src/nand.c +++ b/packages/io/nand/current/src/nand.c @@ -52,6 +52,8 @@ #include #include #include +#define CYG_NAND_ALLOW_INTERNALS +#include #include #include "nand_bbt.h" #include CYGBLD_ISO_ERRNO_CODES_HEADER diff --git a/packages/io/nand/current/src/nand_bbt.c b/packages/io/nand/current/src/nand_bbt.c --- a/packages/io/nand/current/src/nand_bbt.c +++ b/packages/io/nand/current/src/nand_bbt.c @@ -53,6 +53,8 @@ #include #include #include +#define CYG_NAND_ALLOW_INTERNALS +#include #include #include "nand_bbt.h" #include CYGBLD_ISO_ERRNO_CODES_HEADER diff --git a/packages/io/nand/current/src/nand_bbt.h b/packages/io/nand/current/src/nand_bbt.h --- a/packages/io/nand/current/src/nand_bbt.h +++ b/packages/io/nand/current/src/nand_bbt.h @@ -120,23 +120,6 @@ int cyg_nand_bbti_build_tables(cyg_nand_ */ #endif -/* Raw unchecked NAND access, for use by the BBT ===================== */ - -/* Takes a DEVICE address. Caller must hold the devlock! */ -int nandi_read_whole_page_raw(cyg_nand_device *dev, cyg_nand_page_addr page, - CYG_BYTE * dest, - CYG_BYTE * spare, size_t spare_size, - int check_ecc); - -/* Takes a DEVICE address. Caller must hold the devlock! */ -int nandi_write_page_raw(cyg_nand_device *dev, cyg_nand_page_addr page, - const CYG_BYTE * src, - const CYG_BYTE * spare, size_t spare_size); - -/* Code outside of the BBT can use the pagebuffer ==================== */ -CYG_BYTE* nandi_grab_pagebuf(void); -void nandi_release_pagebuf(void); - /* =================================================================== */ #endif