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

📄 map.h

📁 u盘MCU端源代码,开发U盘的可以参考.
💻 H
字号:
/*============================================================================
  ____________________________________________________________________________
                                ______________________________________________
   SSSS  M   M          CCCC          Standard Microsystems Corporation
  S      MM MM   SSSS  C                    Austin Design Center
   SSS   M M M  S      C                 11000 N. Mopac Expressway
      S  M   M   SSS   C                Stonelake Bldg. 6, Suite 500
  SSSS   M   M      S   CCCC                Austin, Texas 78759
                SSSS            ______________________________________________
  ____________________________________________________________________________

  Copyright(C) 1999, Standard Microsystems Corporation
  All Rights Reserved.

  This program code listing is proprietary to SMSC and may not be copied,
  distributed, or used without a license to do so.  Such license may have
  Limited or Restricted Rights. Please refer to the license for further
  clarification.
  ____________________________________________________________________________

  Notice: The program contained in this listing is a proprietary trade
  secret of SMSC, Hauppauge, New York, and is copyrighted
  under the United States Copyright Act of 1976 as an unpublished work,
  pursuant to Section 104 and Section 408 of Title XVII of the United
  States code. Unauthorized copying, adaption, distribution, use, or
  display is prohibited by this law.
  ____________________________________________________________________________

  Use, duplication, or disclosure by the Government is subject to
  restrictions as set forth in subparagraph(c)(1)(ii) of the Rights
  in Technical Data and Computer Software clause at DFARS 52.227-7013.
  Contractor/Manufacturer is Standard Microsystems Corporation,
  80 Arkay Drive, Hauppauge, New York, 1178-8847.
  ____________________________________________________________________________
  ____________________________________________________________________________

  map.h - implements common sector mapping algorithms

  ____________________________________________________________________________

  comments tbd
  ____________________________________________________________________________

  Revision History
  Date      Who  Comment
  ________  ___  _____________________________________________________________
  03/11/02  cds  initial version - moved from former media.c location
  09/19/02  cds  added erase caching functions:
                  map_erase_block() 
                  map_erase_block_cache()
                  map_erase_cache_flush_one()
                  map_erase_cache_flush_all()
                  map_erase_cache_init() 
  09/22/02  cds  - added write caching exports                  
                 - updated caching exported fn's             
  10/29/02  cds  - changed "k_block_free" to 0x0fff (all legal bits HIGH)
                 - added map_block_has_bad_data() fn for clients to call to check if there
                   is a page marked bad in the given log2phy table
  11/02/02  cds  - exported map_resolve_conflict()
                   
==============================================================================*/



//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Logical to Physical Block Table Data Definitions, Structures & functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// #define k_block_free              0xFFFF /* No Assign Logical Block Address */
#define k_block_free              0x0FFF /* no assigned logical block address */



//+-----------------------------------------------------------------------------
// Name:
//   map_build_sector_map()
//
// Declaration:
//   t_result sm_build_sector_map(void) reentrant
//
// Purpose:
//   TBD
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_build_sector_map(void) reentrant ;

//+-----------------------------------------------------------------------------
// Name:
//   map_alloc_wr_blk()
//
// Declaration:
//   t_result map_alloc_wr_blk(void) reentrant ;
//
// Purpose:
//   Physical Block Assign/Release Subroutine, ported from SMIL
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_alloc_wr_blk(void) reentrant ;  

//+-----------------------------------------------------------------------------
// Name:
//   map_erase_rd_blk()
//
// Declaration:
//   t_result map_erase_rd_blk(void) reentrant
//
// Purpose:
//   TBD
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_erase_rd_blk(void) reentrant ;

//+-----------------------------------------------------------------------------
// Name:
//   map_erase_wr_blk()
//
// Declaration:
//   t_result map_erase_wr_blk(void) reentrant
//
// Purpose:
//   TBD
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_erase_wr_blk(void) reentrant ;

//+-----------------------------------------------------------------------------
// Name:
//   map_erase_block()
//
// Declaration:
//   t_result map_erase_block(void) reentrant ;
//
// Purpose:
//   TBD
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_lba2addr_rd(uint32 media_lba)reentrant;

//+-----------------------------------------------------------------------------
// Name:
//   map_erase_block()
//
// Declaration:
//   t_result map_erase_block(void) reentrant ;
//
// Purpose:
//   TBD
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_reassign_block_head(void)reentrant;

//+-----------------------------------------------------------------------------
// Name:
//   map_erase_block()
//
// Declaration:
//   t_result map_erase_block(void) reentrant ;
//
// Purpose:
//   TBD
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_bool map_is_addr_first_in_block(void)reentrant;

//+-----------------------------------------------------------------------------
// Name:
//   map_erase_block()
//
// Declaration:
//   t_result map_erase_block(void) reentrant ;
//
// Purpose:
//   TBD
//
// Arguments:
//   TBD
//
// Return:
//   TBD
//
// Notes:
//   TBD
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_bool map_is_addr_last_in_block(void)reentrant;


//+-----------------------------------------------------------------------------
// Name:
//   map_write_begin()
//
// Declaration:
//   t_result map_write_begin(unsigned long start) reentrant
//
// Purpose:
//
// Arguments:
//
// Return:
//
// Notes:
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_write_begin(unsigned long lba) reentrant ;

//+-----------------------------------------------------------------------------
// Name:
//   map_write_flush()
//
// Declaration:
//   t_result map_write_flush(void) reentrant
//
// Purpose:
//
// Arguments:
//
// Return:
//
// Notes:
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_write_flush(void) reentrant ;

//+-----------------------------------------------------------------------------
// Name:
//   map_release_read_block()
//
// Declaration:
//   t_result map_release_read_block(void) reentrant
//
// Purpose:
//
// Arguments:
//
// Return:
//
// Notes:
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_bind_wr_blk(void) reentrant ;

//------------------------------------------------------------------------------
// rebind log blk from rd_phy to wr_phy, and erase the rd_phy blk in one call
//------------------------------------------------------------------------------
t_result map_rebind_log_blk(void) reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern void map_erase_block() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// extern t_result map_erase_block_cache(uint8 zone, uint16 phy_block) reentrant;
extern t_result map_erase_block_cache() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern void map_erase_cache_init() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern t_result map_erase_cache_flush_one() reentrant;

//------------------------------------------------------------------------------
// having this separate from flush_all makes life a lot simpler
//------------------------------------------------------------------------------
extern t_result map_erase_cache_flush_zone(uint8 zone) reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern t_result map_erase_cache_flush_all() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void map_write_cache_init() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void map_write_cache_set_tail() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void map_write_cache_get_tail() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void map_write_cache_free() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
t_result map_copy_block_head_cache(void) reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
t_result map_copy_block_tail() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
t_result map_copy_block_tail_cache(void) reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
t_result map_write_cache_flush_one() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
t_result map_write_cache_flush_all() reentrant;

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
t_bool map_log_blk_has_bad_data() reentrant;

//+-----------------------------------------------------------------------------
// Name:
//   map_resolve_conflict()
//
// Declaration:
//  t_result sm_media_resolve_conflict(void) reentrant
//
// Purpose:
//  resolve a log2phy binding in a media-specific algorithm
//
// Arguments:
//  - see Notes
//
// Return:
//  k_success always
//
// Notes:
//  when called,
//    g_addr_rd_phy_blk contains one of the bindings,
//    g_addr_wr_phy_blk contains the original mapping
//
//  before returning, ensure:
//    g_addr_rd_phy_blk should contain the correct mapping
//    g_addr_wr_phy_blk should contain the block to be erased (or not used)
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
t_result map_resolve_conflict(void) reentrant;

//---eof------------------------------------------------------------------------

⌨️ 快捷键说明

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