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

📄 globals.c

📁 Cy68013的应用——USB2.0接口转IDE、CF卡接口
💻 C
字号:
//-----------------------------------------------------------------------------
//   File:      globals.c
//   Contents:   contains all the global variables used by the firmware
//
//   indent 3.  NO TABS!
//
//   Copyright (c) 2001 Cypress Semiconductor
//
// $Workfile: globals.c $
// $Date: 7/23/02 7:37p $
// $Revision: 6 $
//-----------------------------------------------------------------------------
#include "fx2.h"
#include "fx2regs.h"
#include "gpif.h"
#include "atapi.h"
#include "globals.h"

BYTE   AlternateSetting;   // Alternate settings
BYTE   Configuration;      // Current configuration


WORD   pConfigDscr;
WORD   pOtherConfigDscr;  

WORD wPacketSize;

// Globals for storing per-LUN information.  Data about each LUN (Logical Unit) is stored
// in two different places:  1) A struct in DATA space for storing drive geometry, capacity,
// etc., 2) a bit field in the BIT DATA area for storing device flags that we need to access
// efficiently.  For each request (CBW), the firmware will swap in the appropriate LUN
// information

// The flags for the LUN that is currently being accessed.
BYTE bdata ActiveLunBits;
// Storage area for LUN0 and LUN1 flags.  DO NOT use MAX_LUN to define this.  The startup code clears 
// exactly two bytes here.  MAX_LUN is 1 in the CF only case.
BYTE bdata LunBits[2];

// bit defines for the active LUN
sbit bDevicePresent = ActiveLunBits ^ 0;
sbit bMasterSlave = ActiveLunBits ^ 1;   // 0 == device0 (master), 1 == device1 (slave)

sbit bScsi = ActiveLunBits ^ 3;
sbit bExtAddrSupport = ActiveLunBits ^ 4;
sbit bCompactFlash = ActiveLunBits ^ 5;

BYTE currentLunNum;

// Device info for the Active LUN
DEVICE_CONFIG_DATA ActiveLunConfigData;
// Sorage area for the LUN0 and LUN1 device info
DEVICE_CONFIG_DATA DeviceConfigData[MAX_LUN];

// this variable is used to store the number of devices attached to the IDE bus.  This is what
// we will use to forumlate our response to the GET MAX LUN Mass Storage Class request.
BYTE deviceCount;

bit  bSkipPinReset;
bit  bFirstTime;
bit  bSwitchToHighSpeed;
bit  bHighSpeedEnabled;
xdata BYTE halfKBuffer[BUFFER_SIZE];

WORD cbwTagLow;          // Tag from the most recent CBW packet
WORD cbwTagHi;
BYTE currentState;

DWORD dataTransferLen;
volatile BYTE seconds;
volatile BYTE hertz61ticks;

bit noFlashMedia;
bit directionIn;
bit phaseErrorState;

// this bit determines if the current transfer is to be carried out using UDMA (1) or
// PIO (0)
bit useUdma;
bit bShortPacketSent;
BYTE udmaErrorCount;

bit Sleep;
 

⌨️ 快捷键说明

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