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

📄 fmc.h

📁 <B>SMSC USB2.0 Flash硬盘驱动源码</B>
💻 H
📖 第 1 页 / 共 2 页
字号:
/*============================================================================
  ____________________________________________________________________________
                                ______________________________________________
   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.
  ____________________________________________________________________________
  ____________________________________________________________________________
  fmcdev.h - USB97210 device specific hardware interface definitions and
             functions that are external to the MCU (ergo external to minimos).
  ____________________________________________________________________________
  comments tbd
  ____________________________________________________________________________
  Revision History
  Date      Who  Comment
  ________  ___  _____________________________________________________________
  09/17/01  cds  initial version - all xdata registers are initially defined
                 here.  I've had mixed feelings about splitting up these
                 registers into the various controller specific headers, but
                 that may prove confusing and/or difficult to maintain, so
                 I think it would be best to have all the registers defined
                 here, then access to registers (via macros or whatever)
                 can be defined by a file specifically for the controller
  11/26/01  cds  moved lun config into options.h
  02/26/02  tbh  added intra-burst callback, g_fmc_options, _fmc_set_options()
  03/05/02  ds   added another option to g_fmc_options, to receive 512 bytes is 1.1 speed
  06/21/02  cds  added fmc_select_nand() 
============================================================================*/

//------------------------------------------------------------------------------
// flash memory controller registers

#ifndef __fmc_dot_c__
  #define t_fmc_register extern unsigned char volatile xdata
  #define at_fmc(__addr)
#else
  #define t_fmc_register unsigned char volatile xdata
  #define at_fmc(__addr)    _at_ 0x##__addr
#endif
typedef t_xdata_ref t_fmc_register_ref;

//------------------------------------------------------------------------------
// ecc & crc config registers
// !!! move these to sm.h???
t_fmc_register ecc_a_add_l      at_fmc(34F0);  // rw ecc address register for part A of data (lo byte)
t_fmc_register ecc_a_add_h      at_fmc(34F1);  // rw ecc address register for part A of data (hi byte)
t_fmc_register ecc_a_data_0     at_fmc(34F8);  // rw ecc data in PIO transfer of SMC
t_fmc_register ecc_a_data_1     at_fmc(34F9);  // rw ecc data in PIO transfer of SMC
t_fmc_register ecc_a_data_2     at_fmc(34FA);  // rw ecc data in PIO transfer of SMC
t_fmc_register ecc_b_add_l      at_fmc(34FE);  // rw ecc address register for part B of data (lo byte)
t_fmc_register ecc_b_add_h      at_fmc(34FF);  // rw ecc address register for part B of data (hi byte)
t_fmc_register ecc_b_data_0     at_fmc(34F5);  // rw ecc data in PIO transfer of SMC
t_fmc_register ecc_b_data_1     at_fmc(34F6);  // rw ecc data in PIO transfer of SMC
t_fmc_register ecc_b_data_2     at_fmc(34F7);  // rw ecc data in PIO transfer of SMC
t_fmc_register ecc_crc_ctl      at_fmc(34F2);  // rw ecc & crc control register
t_fmc_register ecc_crc_stat     at_fmc(34F3);  // rw ecc & crc status register
t_fmc_register ecc_crc_stat_msk at_fmc(34F4);  // rw ecc & crc status mask register
// special smsc hardware debug registers
t_fmc_register x_smsc_dbg       at_fmc(3f10);

//------------------------------------------------------------------------------
// fmc callback function
typedef t_result (code *t_fmc_callback)(void) reentrant;

//+-----------------------------------------------------------------------------
// Name:
//   _fmc_set_start_lb_8
//
// Declaration:
//   void _fmc_set_start_lb_8(uint8 mswmsb, uint8 mswlsb, uint8 lswmsb, uint8 lswlsb);
//
// Purpose:
//   Set the starting logical block for an fmc transfer
//   as four 8 bit numbers.
//
// Arguments:
//   mswmsb - a uint8, the most significant word, most significant byte.
//   mswlsb - a uint8, the most significant word, least significant byte.
//   lswmsb - a uint8, the least significant word, most significant byte.
//   lswlsb - a uint8, the least significant word, least significant byte.
//
// Return:
//   None.
//
// Notes:
//   None.
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
#define _fmc_set_start_lb_8(__mswmsb, __mswlsb, __lswmsb, __lswlsb)            \
{                                                                              \
  g_start_lb_this_xfer.u8.hi = (__mswmsb);                                     \
  g_start_lb_this_xfer.u8.lh = (__mswlsb);                                     \
  g_start_lb_this_xfer.u8.hl = (__lswmsb);                                     \
  g_start_lb_this_xfer.u8.lo = (__lswlsb);                                     \
}

//+-----------------------------------------------------------------------------
// Name:
//   _fmc_set_lb_count_8
//
// Declaration:
//   void _fmc_set_lb_count_8(uint8 mswmsb, uint8 mswlsb, uint8 lswmsb, uint8 lswlsb);
//
// Purpose:
//   Set the logical block count for an fmc transfer
//   as four 8 bit numbers.
//
// Arguments:
//   mswmsb - a uint8, the most significant word, most significant byte.
//   mswlsb - a uint8, the most significant word, least significant byte.
//   lswmsb - a uint8, the least significant word, most significant byte.
//   lswlsb - a uint8, the least significant word, least significant byte.
//
// Return:
//   None.
//
// Notes:
//   None.
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
#define _fmc_set_lb_count_8(__mswmsb, __mswlsb, __lswmsb, __lswlsb)            \
{                                                                              \
  g_n_lb_this_split.u8.hi = g_n_lb_this_xfer.u8.hi = (__mswmsb);               \
  g_n_lb_this_split.u8.lh = g_n_lb_this_xfer.u8.lh = (__mswlsb);               \
  g_n_lb_this_split.u8.hl = g_n_lb_this_xfer.u8.hl = (__lswmsb);               \
  g_n_lb_this_split.u8.lo = g_n_lb_this_xfer.u8.lo = (__lswlsb);               \
}

//+-----------------------------------------------------------------------------
// Name:
//   _fmc_get_start_lb_8
//
// Declaration:
//   void _fmc_get_start_lb_8(uint8 mswmsb, uint8 mswlsb, uint8 lswmsb, uint8 lswlsb);
//
// Purpose:
//   Get the current starting logical block for the current fmc transfer
//   as four 8 bit numbers.
//
// Arguments:
//   mswmsb - a uint8, the most significant word, most significant byte.
//   mswlsb - a uint8, the most significant word, least significant byte.
//   lswmsb - a uint8, the least significant word, most significant byte.
//   lswlsb - a uint8, the least significant word, least significant byte.
//
// Return:
//   None.  BUT its a macro that overwrites its arguments...
//
// Notes:
//   None.
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
#define _fmc_get_start_lb_8(__mswmsb, __mswlsb, __lswmsb, __lswlsb)            \
{                                                                              \
  (__mswmsb) = g_start_lb_this_xfer.u8.hi;                                     \
  (__mswlsb) = g_start_lb_this_xfer.u8.lh;                                     \
  (__lswmsb) = g_start_lb_this_xfer.u8.hl;                                     \
  (__lswlsb) = g_start_lb_this_xfer.u8.lo;                                     \
}

//+-----------------------------------------------------------------------------
// Name:
//   _fmc_get_lb_count_8
//
// Declaration:
//   void _fmc_get_lb_count_8(uint8 mswmsb, uint8 mswlsb, uint8 lswmsb, uint8 lswlsb);
//
// Purpose:
//   Get the remaining logical block count for the current fmc transfer
//   as four 8 bit numbers.
//
// Arguments:
//   mswmsb - a uint8, the most significant word, most significant byte.
//   mswlsb - a uint8, the most significant word, least significant byte.
//   lswmsb - a uint8, the least significant word, most significant byte.
//   lswlsb - a uint8, the least significant word, least significant byte.
//
// Return:
//   None.  BUT its a macro that overwrites its arguments...
//
// Notes:
//   None.
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
#define _fmc_get_lb_count_8(__mswmsb, __mswlsb, __lswmsb, __lswlsb)            \
{                                                                              \
  (__mswmsb) = g_n_lb_this_split.u8.hi;                                        \
  (__mswlsb) = g_n_lb_this_split.u8.lh;                                        \
  (__lswmsb) = g_n_lb_this_split.u8.hl;                                        \
  (__lswlsb) = g_n_lb_this_split.u8.lo;                                        \
}

//+-----------------------------------------------------------------------------
// Name:
//   _fmc_set_timeout
//
// Declaration:
//   void _fmc_set_timeout(uint16 ticks);
//
// Purpose:
//   Set the timeout for an fmc transfer.
//
// Arguments:
//   ticks - a uint16 specifying the timeout.
//
// Return:
//   None.
//
// Notes:
//   None.
//
// Since:
//   fmc-1.0
//------------------------------------------------------------------------------
#define _fmc_set_timeout(__ticks)                                              \
{                                                                              \
  g_fmc_timeout = (uint16)(__ticks);                                           \

⌨️ 快捷键说明

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