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

📄 table.c

📁 CF卡读卡程序
💻 C
字号:
/*
; ***********************************************************************
; *             Intel Corporation                                       *
; *             Copyright (C) Intel Corporation 1994-97                 *
; *             All Rights Reserved.                                    *
; ***********************************************************************
; ***********************************************************************
;    INTEL OEM SOFTWARE LICENSE AGREEMENT
;
; BY USING THIS SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE TERMS OF THIS 
; AGREEMENT.  DO NOT USE THE SOFTWARE UNTIL YOU HAVE CAREFULLY READ AND AGREED 
; TO THE FOLLOWING TERMS AND CONDITIONS.  IF YOU DO NOT AGREE TO THE TERMS OF
; THIS AGREEMENT, PROMPTLY RETURN THE SOFTWARE PACKAGE AND ANY ACCOMPANYING
; ITEMS. YOU MUST BE AN ORIGINAL EQUIPMENT MANUFACTURER ("OEM") SYSTEM
; DEVELOPER TO ACQUIRE ANY RIGHTS IN THE SOFTWARE UNDER THIS LICENSE AGREEMENT.
;
; LICENSE: Intel Corporation ("Intel") grants you the non-exclusive and
; royalty-free right to use the enclosed software program ("Software") in
; source code form on the terms set forth below.  You will not use, copy,
; modify, rent, sell or transfer the Software or any portion thereof, except
; as provided in this Agreement.
;
; OEM System Developers may:
;
; 1. Copy the Software for support, backup or archival purposes;
; 2. Install or distribute the Software in object code form only;
; 3. Modify and/or use Software source code that Intel directly ships to you
;    as an OEM;
; 4. Allow authorized contractors ("Subcontractors") engaged by You for the
;    sole purpose of product development work to have access to the Software
;    solely for that purpose.  Subcontractors do NOT acquire any of the OEM
;    rights to the Software provided in this Agreement;
; 5. Install, use, modify, distribute, and/or make or have made derivative
;    works based on the Software ("Derivatives") subject to the terms and
;    conditions in this Agreement.
;
; RESTRICTIONS:
; YOU WILL NOT:
;
; 1.  Copy, disclose or distribute the Software, in whole or in part, except 
;     as provided for in this Agreement;
; 2.  Remove or modify the "Compatibility" module, if any,  in the Software or
;     in any Derivative work,
; 3.  Decompile or reverse engineer any Software  delivered in object code form.
; 
; TRANSFER:  Except as provided above, you may not transfer or disclose the
; Software to another party .
;
; OWNERSHIP AND COPYRIGHT OF SOFTWARE: Title to the Software and all copies
; thereof remain with Intel.  The Software is copyrighted and is protected by
; United States and international copyright laws.  You will not remove the
; copyright notice from the Software.  You agree to prevent any unauthorized
; copying of the Software.
;
; DERIVATIVE WORK: You will not be required to provide Intel with a copy of the
; source or object code for any Derivatives created by You.   You are authorized
; to use, market, sell, and/or distribute Derivatives, other than any source
; code for the Software, at your own risk and expense. Title to Derivatives,
; other than the portion of the Derivative consisting of any of the Software,
; shall remain with you.
;
; CONFIDENTIALITY: You will maintain the confidentiality of the source code for
; the Software with at least the same degree of care that you use to protect
; your own confidential and proprietary information, but with no less than a
; reasonable degree under the circumstances. Disclosure will only be made to
; Your employees on a need-to-know basis. Subject to the licenses granted
; hereunder, You agree to maintain the Software source code and all other
; proprietary information relating to the Software in confidence and shall not
; disclose to others any such source code or other Intel proprietary information
; relating to the Software. Any Subcontractors to whom you disclose the source
; code for the Software must sign a written confidentiality agreement which
; contains terms regarding the Software no less restrictive than those set forth
; in this Agreement.
;
; DUAL MEDIA SOFTWARE:  If the Software package contains multiple media, you
; may only use the medium appropriate for your system.
; 
; WARRANTY:  The Software is provided "AS IS". Intel warrants that the media on
; which the Software is furnished will be free from defects in material and
; workmanship for a period of one (1) year from the date of purchase.  Upon
; return of such defective media, Intel's entire liability and your exclusive
; remedy shall be the replacement of the Software.
; 
; THE ABOVE WARRANTIES ARE THE ONLY WARRANTIES OF ANY KIND GIVEN BY INTEL UNDER
; THIS AGREEMENT. INTEL SPECIFICALLY DISCLAIMS ANY OTHER WARRANTIES, EXPRESS OR
; IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT OR FITNESS
; FOR ANY PARTICULAR PURPOSE.
;
; LIMITATION OF LIABILITY:    NEITHER INTEL NOR ITS VENDORS OR AGENTS SHALL BE
; LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF
; BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF
; ANY KIND WHETHER UNDER THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGES.
;
; TERMINATION OF THIS LICENSE:  Intel reserves the right to conduct or have
; conducted audits to verify your compliance with this Agreement.  Intel may
; terminate this Agreement at any time if you are in breach of any of its terms
; and conditions.  Upon termination, you will immediately destroy, and certify
; in writing the destruction of, the Software or return all copies of the
; Software and documentation to Intel.
;
; U.S. GOVERNMENT RESTRICTED RIGHTS:  The Software and documentation were
; developed at private expense and are provided with "RESTRICTED RIGHTS".
; Use, duplication or disclosure by the Government is subject to restrictions
; as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its successor.
;
; EXPORT LAWS:  You agree that the distribution and export/re-export of the
; Software is in compliance with the laws, regulations, orders or other
; restrictions of the U.S. Export Administration Regulations.
;
; APPLICABLE LAW:  This Agreement is governed by the laws of the State of
; Delaware and the United States, including patent and copyright laws.  Any
; claim arising out of this Agreement will be brought in Santa Clara County,
; California.
;*************************************************************************
*/


#include "type.h"
#include "lowlvl.h"

/*
  This file is used to define the flash technologies you wish to support
  with this code.  To add a new technology, simply:

  1 - add an entry to the FlashTechnologyTable below
  2 - add your file, containing the read/write/erase/status/suspend/
      resume routine addresses for your new technology, so that the
      compiler may find them (i.e. to something like LOWLVL.C)

  Here is the definition of the structure for the table.

  -> You will find the definition itself in LOWLVL.H

  If different pointer types are needed, just change the structure, and
  the functions will assign themselves correctly. No assumption is made
  that the pointer neccesarily are words in the LOWLVL.C, but is kept
  this way currently to be compatible with the LOWLVL.ASM

  JEDEC          word           JEDEC ID for the flash
  Blocks         word           number of blocks/device pair
  Read           word           address of the read routine
  Write          word           address of the write routine
  Erase          word           address of the erase routine
  Status         word           address of the status routine
  Suspend        word           address of the suspend routine
  Resume         word           address of the resume routine
  Size           dword          size, in bytes, of component pair
  BlockSize      dword          size, in bytes, of block pair
  Capabilities   word           available options
                                        bit 0: erase suspend to read
                                        bit 1: erase suspend to program
                                        bit 2-15: reserved
*/

/*
  This pragma statement turns off the "Suspicious Pointer Conversion"
  warnings that assigning a function pointer to a WORD pointer generates
  in Borland C++ 3.1.  It could also be fixed by putting (BYTE_PTR) in
  front of each statement, but then that would be a pain to change to
  something else later.
*/
#if SEGMENTED
#pragma warn -sus
#endif
/* Externs Not needed if used as an include (i.e. change to table.h and
   stick in LOWLVL.C) */

extern WORD Intel8MbRead(DWORD, DWORD, BYTE_PTR);
extern WORD Intel8MbWrite(DWORD, DWORD, BYTE_PTR);
extern WORD Intel8MbErase(DWORD);
#if ERASE_BACKGROUND
extern WORD Intel8MbStatus(DWORD);
extern WORD Intel8MbSuspend(void);
extern WORD Intel8MbResume(void);
#endif

extern WORD IntelSCSRead(DWORD, DWORD, BYTE_PTR);
extern WORD IntelSCSWrite(DWORD, DWORD, BYTE_PTR);
extern WORD IntelSCSErase(DWORD);
#if ERASE_BACKGROUND
extern WORD IntelSCSStatus(DWORD);
extern WORD IntelSCSSuspend(void);
extern WORD IntelSCSResume(void);
#endif

#if FALCON
extern WORD Intel16MbWrite(DWORD, DWORD, BYTE_PTR);
#endif

#if CFI_OPTIONAL
extern WORD IntelSCSLock(DWORD);
extern WORD IntelSCSUnlock(void);
extern WORD IntelSCSChipErase(void);
extern WORD IntelSCSConfigureStatus(BYTE);
#endif

DEVICE_TABLE FlashTechnologyTable[7] =
{
   {
      0x89A6,
      0x0010,
#if SEGMENTED
      Intel8MbRead,
      Intel8MbWrite,
      Intel8MbErase,
#if ERASE_BACKGROUND
      Intel8MbStatus,
      Intel8MbSuspend,
      Intel8MbResume,
#endif      
#else
      (DWORD)Intel8MbRead,
      (DWORD)Intel8MbWrite,
      (DWORD)Intel8MbErase,
#if ERASE_BACKGROUND
      (DWORD)Intel8MbStatus,
      (DWORD)Intel8MbSuspend,
      (DWORD)Intel8MbResume,
#endif
#endif
      0x00200000,
      0x00020000,
      0x0003
   },
   {
      0x89A7,
      0x0008,
#if SEGMENTED
      Intel8MbRead,
      Intel8MbWrite,
      Intel8MbErase,
#if ERASE_BACKGROUND
      Intel8MbStatus,
      Intel8MbSuspend,
      Intel8MbResume,
#endif
#else
      (DWORD)Intel8MbRead,
      (DWORD)Intel8MbWrite,
      (DWORD)Intel8MbErase,
#if ERASE_BACKGROUND
      (DWORD)Intel8MbStatus,
      (DWORD)Intel8MbSuspend,
      (DWORD)Intel8MbResume,
#endif
#endif
      0x00100000,
      0x00020000,
      0x0003
   },
   {
      0x89AA,
      0x0020,
#if SEGMENTED
      Intel8MbRead,
      Intel8MbWrite,
      Intel8MbErase,
#if ERASE_BACKGROUND
      Intel8MbStatus,
      Intel8MbSuspend,
      Intel8MbResume,
#endif
#else
      (DWORD)Intel8MbRead,
      (DWORD)Intel8MbWrite,
      (DWORD)Intel8MbErase,
#if ERASE_BACKGROUND
      (DWORD)Intel8MbStatus,
      (DWORD)Intel8MbSuspend,
      (DWORD)Intel8MbResume,
#endif
#endif
      0x00400000,
      0x00020000,
      0x0003
   },
   {
      0x89A2,
      0x0010,
#if SEGMENTED
      Intel8MbRead,
      Intel8MbWrite,
      Intel8MbErase,
#if ERASE_BACKGROUND
      Intel8MbStatus,
      Intel8MbSuspend,
      Intel8MbResume,
#endif
#else
      (DWORD)Intel8MbRead,
      (DWORD)Intel8MbWrite,
      (DWORD)Intel8MbErase,
#if ERASE_BACKGROUND
      (DWORD)Intel8MbStatus,
      (DWORD)Intel8MbSuspend,
      (DWORD)Intel8MbResume,
#endif
#endif
      0x00200000,
      0x00020000,
      0x0001
   },
   {
      0x89A1,
      0x0010,
#if SEGMENTED
      Intel8MbRead,
      Intel8MbWrite,
      Intel8MbErase,
#if ERASE_BACKGROUND
      Intel8MbStatus,
      Intel8MbSuspend,
      Intel8MbResume,
#endif
#else
      (DWORD)Intel8MbRead,
      (DWORD)Intel8MbWrite,
      (DWORD)Intel8MbErase,
#if ERASE_BACKGROUND
      (DWORD)Intel8MbStatus,
      (DWORD)Intel8MbSuspend,
      (DWORD)Intel8MbResume,
#endif
#endif
      0x00200000,
      0x00020000,
      0x0001
   },
#if FALCON
   {
      0x89A0,
      0x0020,
#if SEGMENTED
      Intel8MbRead,
      Intel16MbWrite,
      Intel8MbErase,
#if ERASE_BACKGROUND
      Intel8MbStatus,
      Intel8MbSuspend,
      Intel8MbResume,
#endif
#else
      (DWORD)Intel8MbRead,
      (DWORD)Intel16MbWrite,
      (DWORD)Intel8MbErase,
#if ERASE_BACKGROUND
      (DWORD)Intel8MbStatus,
      (DWORD)Intel8MbSuspend,
      (DWORD)Intel8MbResume,
#endif
#endif
      0x00400000,
      0x00020000,
      0x0003
   },
#endif
   {0xFFFF} /* End */
};

CFI_TABLE CFITable[3] =
{
   {
      0x0001, /* Intel SCS command Set */
      0xFFFF,
#if SEGMENTED
      IntelSCSRead,
      IntelSCSWrite,
      IntelSCSErase,
#if ERASE_BACKGROUND
      IntelSCSStatus,
      IntelSCSSuspend,
      IntelSCSResume,
#endif
#if CFI_OPTIONAL
      IntelSCSLock,
      IntelSCSUnlock,
      IntelSCSChipErase,
      IntelSCSConfigureStatus,
#endif
#else
      (DWORD)IntelSCSRead,
      (DWORD)IntelSCSWrite,
      (DWORD)IntelSCSErase,
#if ERASE_BACKGROUND
      (DWORD)IntelSCSStatus,
      (DWORD)IntelSCSSuspend,
      (DWORD)IntelSCSResume,
#endif
#if CFI_OPTIONAL
      (DWORD)IntelSCSLock,
      (DWORD)IntelSCSUnlock,
      (DWORD)IntelSCSChipErase,
      (DWORD)IntelSCSConfigureStatus,
#endif
#endif
   },
   {
      0x0003, /* Intel 8Mb command set */
      0xFFFF,
#if SEGMENTED
      Intel8MbRead,
      Intel8MbWrite,
      Intel8MbErase,
#if ERASE_BACKGROUND
      Intel8MbStatus,
      Intel8MbSuspend,
      Intel8MbResume,
#endif
#if CFI_OPTIONAL
      IntelSCSLock,
      IntelSCSUnlock,
      IntelSCSChipErase,
      IntelSCSConfigureStatus,
#endif
#else
      (DWORD)Intel8MbRead,
      (DWORD)Intel8MbWrite,
      (DWORD)Intel8MbErase,
#if ERASE_BACKGROUND
      (DWORD)Intel8MbStatus,
      (DWORD)Intel8MbSuspend,
      (DWORD)Intel8MbResume,
#endif
#if CFI_OPTIONAL
      (DWORD)IntelSCSLock,
      (DWORD)IntelSCSUnlock,
      (DWORD)IntelSCSChipErase,
      (DWORD)IntelSCSConfigureStatus,
#endif
#endif
   },
   {0xFFFF} /* End */
};

⌨️ 快捷键说明

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