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

📄 control.h

📁 U盘控制器USB97C223的固件代码,对2kPAGE NAND FLASH 有很好的支持.
💻 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.
  ____________________________________________________________________________
  ____________________________________________________________________________

  control.h - the default control pipe module.
  ____________________________________________________________________________

  comments tbd
  ____________________________________________________________________________

  Revision History
  Date      Who  Comment
  ________  ___  _____________________________________________________________
  05/31/00  tbh  initial version
  03/15/01  tbh  converted api macros into functions to facilitate
                 implementation, and facilitate debugging with an ice
  06/07/01  tbh  corrected values of k_usb_dscr_typ_osconfig and
                 k_usb_dscr_typ_ifcpwr
  07/27/01  tbh  tweak port for 20x family
  06/06/03  ds   Added a new flag g_vbus_removed to track the Vbus going away and suspend the app layer
                 accordingly. This is for battery powered devices, where the app needs to relinquish control
                 of the flash interface and go to sleep, while the kernel is still not suspended.               
  06/06/03  ds   Added g_app_suspended for the app layer to inform the kernel that it is done powering down.               
============================================================================*/

//------------------------------------------------------------------------------
// useful constants for laying out descriptors
//------------------------------------------------------------------------------
#define k_usb_devdscrsz     18  // size of a device descriptor
#define k_usb_devqualdscrsz 10  // size of device qualifier descriptor
#define k_usb_cfgdscrsz      9  // size of a configuration descriptor
#define k_usb_oscfgdscrsz    9  // size of other speed configuration descriptor
#define k_usb_ifcdscrsz      9  // size of an interface descriptor
#define k_usb_ndpdscrsz      7  // size of an endpoint descriptor
#define k_lng_str_sz         4  // language id strings are a fixed size
#define k_max_str_len       30  // maximum size allocated for a string resource
#define k_str_char_sz        2  // width of a unicode string in bytes
//------------------------------------------------------------------------------
// For the 97C100 & 97C102 series, the size of a packet header is always 8 bytes.
// You can set k_maxpktsz to any of the 4 legal values.  The data pump is written
// to work just the same regardless of the max packet size.  You can have
// different max packet sizes on each endpoint, if you want.  But, if you do
// then you'll need to hunt and replace all the "k_maxpktsz" references.
//------------------------------------------------------------------------------
#define k_hs_maxpktsz 512  // size of high speed maximum bulk payload
#define k_fs_maxpktsz  64  // size of full speed maximum bulk payload 8,16,32,64
#define k_maxpktsz     64  // size of full speed maximum control payload 8,16,32,64
#define k_pkthdrsz      8  // size of a packet header (not present on the 200)
//------------------------------------------------------------------------------
// standard requests
//------------------------------------------------------------------------------
#define k_dsd_usb_get_status        0x8000
#define k_dsi_usb_get_status        0x8100
#define k_dse_usb_get_status        0x8200
#define k_hsd_usb_clr_feature       0x0001
#define k_hsi_usb_clr_feature       0x0101
#define k_hse_usb_clr_feature       0x0201
#define k_hsd_usb_set_feature       0x0003
#define k_hsi_usb_set_feature       0x0103
#define k_hse_usb_set_feature       0x0203
#define k_hsd_usb_set_address       0x0005
#define k_dsd_usb_get_descriptor    0x8006
#define k_hsd_usb_set_descriptor    0x0007
#define k_dsd_usb_get_configuration 0x8008
#define k_hsd_usb_set_configuration 0x0009
#define k_dsi_usb_get_interface     0x810A
#define k_hsi_usb_set_interface     0x010B
#define k_dse_usb_synch_frame       0x820C
//------------------------------------------------------------------------------
// direction
//------------------------------------------------------------------------------
#define k_usb_dir_h2d 0
#define k_usb_dir_d2h 1
//------------------------------------------------------------------------------
// type of request
//------------------------------------------------------------------------------
#define k_usb_typ_standard 0
#define k_usb_typ_class    1
#define k_usb_typ_vendor   2
#define k_usb_typ_reserved 3
//------------------------------------------------------------------------------
// target
//------------------------------------------------------------------------------
#define k_usb_tgt_device    0
#define k_usb_tgt_interface 1
#define k_usb_tgt_endpoint  2
#define k_usb_tgt_other     3
#define k_usb_tgt_reserved  4
//------------------------------------------------------------------------------
// descriptor type
//------------------------------------------------------------------------------
#define k_usb_dscr_typ_device    0x01
#define k_usb_dscr_typ_config    0x02
#define k_usb_dscr_typ_string    0x03
#define k_usb_dscr_typ_interface 0x04
#define k_usb_dscr_typ_endpoint  0x05
#define k_usb_dscr_typ_devqual   0x06
#define k_usb_dscr_typ_osconfig  0x07
#define k_usb_dscr_typ_ifcpwr    0x08
//------------------------------------------------------------------------------
// pids
//------------------------------------------------------------------------------
#define k_usb_pid_out     0x01
#define k_usb_pid_ack     0x02
#define k_usb_pid_data0   0x03
#define k_usb_pid_sof     0x05
#define k_usb_pid_in      0x09
#define k_usb_pid_nak     0x0A
#define k_usb_pid_data1   0x0B
#define k_usb_pid_pre     0x0C
#define k_usb_pid_setup   0x0D
#define k_usb_pid_stall   0x0E
#define k_usb_pid_error   0x0F
//------------------------------------------------------------------------------
// structures and typedefs
//------------------------------------------------------------------------------
typedef struct s_usb_hdr
{
  uint8 flg;
  uint8 pid;
  uint8 countlo;
  uint8 counthi;
} t_usb_hdr;
//------------------------------------------------------------------------------
typedef struct s_usb_rqst
{
  struct
  {
    uint8 tgt:5;

⌨️ 快捷键说明

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