/* * NAND Flash Controller Device Driver * Copyright (c) 2011-2012, Intel Corporation and its suppliers. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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 * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * */ #include "ffsport.h" //! \file /** @addtogroup raw_data_access */ /*@{*/ /** This command forcibly erases a NAND block, no matter it¡¯s a good block or not.
Usage: \code ioctl(int fd, GLOB_SBD_IOCTL_ERASE_RAW, ADDRESSTYPE arg) \endcode
Parameters:
[in]fd - file descriptor
[in]arg - The block number to be erased.
Return values:
0success
1failure
*/ /** \anchor GLOB_SBD_IOCTL_ERASE_RAW */ #define GLOB_SBD_IOCTL_ERASE_RAW (0x9910) /** This command checks manufacture bad block marker first before erasing a block, and will return failure quickly once it is a manufacture bad block.
Usage: \code ioctl(int fd, GLOB_SBD_IOCTL_ERASE_BYMARKER, ADDRESSTYPE arg) \endcode
Parameters:
[in]fd - file descriptor
[in]arg - The block number to be erased.
Return values:
0success
-1failure
*/ #define GLOB_SBD_IOCTL_ERASE_BYMARKER (0x9915) /*@}*/ /** @defgroup boot_paraition_bad Boot Partition Bad Block Table management */ /** @addtogroup boot_paraition_bad */ /*@{*/ /** Command to read BBT content.
Usage: \code ioctl(int fd, GLOB_SBD_IOCTL_RD_BT, (BOOT_BLOCKTABLE_IO_CMD)* arg) \endcode
Parameters:
[in]fd - file descriptor
[in]arg - structure to receive BBT content from driver. The parameter should follow below prototype.
Return values:
0success
-1failure
*/ #define GLOB_SBD_IOCTL_RD_BT (0x9911) /** Command to create a dummy BBT in NAND that shows all blocks are good.
Usage: \code result = ioctl(int fd, GLOB_SBD_IOCTL_CREATE_BT_DUMMY, ADDRESSTYPE arg); \endcode
Parameters:
[in]arg = 0 create a dummy BBT when there's no BBT exist in NAND.
[in]arg = 1 forcibly create a dummy BBT, no matter BBT exist or not
Return values:
0if success
1if failed to create
2if there's block table exist
*/ #define GLOB_SBD_IOCTL_CREATE_BT_DUMMY (0x9912) /** Create a BBT by erasing the entire Boot Partition, and marking any blocks as bad which return failure status during the erase operation. The driver will read out MBH first before block erase and rewrite it to NAND with the new BBT. Thus there's no need to rewrite new MBH manually.
Usage: \code result = ioctl (int fd, GLOB_SBD_IOCTL_CREATE_BT_BYERASE); \endcode
Return values:
0success
-1failure
*/ #define GLOB_SBD_IOCTL_CREATE_BT_BYERASE (0x9913) /** Create a BBT by scanning the initial manufactured bad block markers in the entire boot partition.
Usage: \code result = ioctl (int fd, GLOB_SBD_IOCTL_CREATE_BT_BYMARKER) \endcode
Return values:
0success
-1failure
*/ #define GLOB_SBD_IOCTL_CREATE_BT_BYMARKER (0x9914) typedef struct _boot_blocktable_info_tag { byte bt_sig[4];/**< "GOOD" means a block table exist */ byte nSpareSkipByteInZone1;/**