⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 efd_api.c

📁 InterFlashDriver关于P30的驱动
💻 C
字号:
/*###########################################################################
###  Intel Confidential
###  Copyright (c) Intel Corporation 2007
###  All Rights Reserved.
###  ----------------------------------------------------------------------
###  Project: Intel Flash Driver
###
###  Module: efd_api.c -
###
###  $Archive: $
###  $Revision: $
###  $Date: $
###
###  $NoKeywords: $
##############################################################################
###
###  NOTICE OF LICENSE AGREEMENT
###
###  This code is provided by Intel Corp., and the use is governed
###  under the terms of a license agreement. See license agreement
###  for complete terms of license.
###
###  YOU MAY ONLY USE THE SOFTWARE SUBJECT TO THE TERMS OF THE
###  INTEL SOFTWARE LICENSE AGREEMENT.
###
########################################################################### */

#include "efd_conf.h"#include "efd_api.h"#include "efd_hal.h"#include "efd_cmd.h"#include "efd_gen.h"
#include "efd_lib.h"
#if defined ( FLASH_TYPE_P3X )
#include "efd_p3x.h"
#endif /* FLASH_TYPE_P3X */

#if defined ( FLASH_TYPE_J3 )
#include "efd_j3.h"
#endif /* FLASH_TYPE_J3 */

#if defined ( FLASH_TYPE_C3 )
#include "efd_c3.h"
#endif /* FLASH_TYPE_C3 */

#if defined ( FLASH_TYPE_A33 )
#include "efd_a33.h"
#endif /* FLASH_TYPE_A33 */


typedef enum
{
   FLASH_DEV_P3X =  0x0,   /* P30/33 Intel StrataFlash(R) Embedded Memory */
   FLASH_DEV_J3,           /* J3D Intel(R) Embedded Flash Memory */
   FLASH_DEV_C3,           /* C3 Intel(R) Advanced+ Boot Flash Memory */
   FLASH_DEV_A33,          /* A33 Intel PCM Memory  */
   FLASH_DEV_NONE          /* Unknown */
} FLASH_TYPE;           


/* FLASH_ID_DESC
 *
 * List of supported devices.
 */
typedef struct _DEVICE_ID 
{
   FLASH_ID    FlashID;
   FLASH_TYPE  FlashType;
} FLASH_ID_DESC, *PFLASH_ID_DESC;


static const FLASH_ID_DESC  FlashList[] = 
{
   {{0x0089, 0x88C2}, FLASH_DEV_C3},   /* C3 (16-Mbit x 16-T) */
   {{0x0089, 0x88C3}, FLASH_DEV_C3},   /* C3 (16-Mbit x 16-B) */
   {{0x0089, 0x88C4}, FLASH_DEV_C3},   /* C3 (32-Mbit x 16-T) */
   {{0x0089, 0x88C5}, FLASH_DEV_C3},   /* C3 (32-Mbit x 16-B) */
   {{0x0089, 0x0016}, FLASH_DEV_J3},   /* J3D (32-Mbit) */
   {{0x0089, 0x0017}, FLASH_DEV_J3},   /* J3D (64-Mbit) */
   {{0x0089, 0x0018}, FLASH_DEV_J3},   /* J3D (128-Mbit) */
   {{0x0089, 0x001D}, FLASH_DEV_J3},   /* J3D (256-Mbit) */
   {{0x0089, 0x8817}, FLASH_DEV_P3X},  /* P30 (64-Mbit T) */
   {{0x0089, 0x8818}, FLASH_DEV_P3X},  /* P30 (128-Mbit T) */
   {{0x0089, 0x8919}, FLASH_DEV_P3X},  /* P30 (256-Mbit T) */
   {{0x0089, 0x881A}, FLASH_DEV_P3X},  /* P30 (64-Mbit B) */
   {{0x0089, 0x881B}, FLASH_DEV_P3X},  /* P30 (128-Mbit B) */
   {{0x0089, 0x891C}, FLASH_DEV_P3X},  /* P30 (256-Mbit B) */
   {{0x0089, 0x881D}, FLASH_DEV_P3X},  /* P33 (64-Mbit T) */
   /* Note: A33 and P33 have identical Defice Id for 128-Mbit T and B */
#if defined ( FLASH_TYPE_A33 )
   {{0x0089, 0x881E}, FLASH_DEV_A33},  /* A33 (128-Mbit T) */
#else
   {{0x0089, 0x881E}, FLASH_DEV_P3X},  /* P33 (128-Mbit T) */
#endif /* FLASH_TYPE_A33 */
   {{0x0089, 0x891F}, FLASH_DEV_P3X},  /* P33 (256-Mbit T) */
   {{0x0089, 0x8820}, FLASH_DEV_P3X},  /* P33 (64-Mbit B) */
   /* Note: A33 and P33 have identical Defice Id for 128-Mbit T and B */
#if defined ( FLASH_TYPE_A33 )
   {{0x0089, 0x8821}, FLASH_DEV_A33},  /* A33 (128-Mbit B) */
#else
   {{0x0089, 0x8821}, FLASH_DEV_P3X},  /* P33 (128-Mbit B) */
#endif /* FLASH_TYPE_A33 */
   {{0x0089, 0x8922}, FLASH_DEV_P3X},  /* P33 (256-Mbit B) */
   {{0x0089, 0x88CE}, FLASH_DEV_A33},  /* A33 (128-Mbit T) */
   {{0x0089, 0x88CF}, FLASH_DEV_A33}   /* A33 (128-Mbit T) */
};

#if defined ( FLASH_TYPE_A33 )
#define ERASE_SUSPEND_THRESHOLD     0
#define PROGRAM_SUSPEND_THRESHOLD   0
#else
#define ERASE_SUSPEND_THRESHOLD     5
#define PROGRAM_SUSPEND_THRESHOLD   3
#endif /* FLASH_TYPE_A33 */


/****************************************************************************
 * Static Function Declarations
 ***************************************************************************/
static FLASH_ERROR set_flash_description( FLASH_DEVICE_OBJECT *fdo );
static FLASH_ERROR set_flash_operation( FLASH_DEVICE_OBJECT *fdo, FLASH_TYPE flash_type );
static FLASH_ERROR check_flash_address( FLASH_DEVICE_OBJECT *fdo, UINT32 addr_offset );
static FLASH_ERROR get_flash_block_address( FLASH_DEVICE_OBJECT *fdo, UINT32 addr_offset, UINT32 *block_addr_offset );

static FLASH_DEVICE_OBJECT fdo_default;

/****************************************************************************
 * EFD_Init
 *
 * DESCRIPTION:
 *    The function is used to recognize flash device and initialize 
 *    internal object referred to by fdo. This function should be called at least
 *    once before using any other function.
 *
 * PARAMETERS:
 *    OUT      fdo         Pointer to internal object that describe flash 
 *                         device and stores set of low-level operations
 *
 * RETURNS:
 *    Success: 
 *       FLASH_ERR_NONE - Function executed successfully;
 *    Failure:  
 *       FLASH_ERR_BAD_ARGUMENT

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -