📄 globals.c
字号:
//-----------------------------------------------------------------------------
// File: globals.c
// Contents: contains half of the global variables used by the firmware. This is done
// to give the linker flexibility.
//
// indent 3. NO TABS!
//
// Copyright (c) 2001-2004 Cypress Semiconductor
//
// $Workfile: globals.c $
// $Date: 6/26/05 1:57p $
// $Revision: 3 $
//-----------------------------------------------------------------------------
#include "fx2.h"
#include "fx2regs.h"
#include "gpif.h"
#include "atapi.h"
#include "globals.h"
volatile BYTE AlternateSetting; // Alternate settings
volatile BYTE Configuration; // Current configuration
xdata BYTE eepromAddr; // EEPROM address -- Could be one of two possibilities 0x52 or 0x54
xdata BYTE CSMSerial[IDE_ID_SERIAL_LEN]; // CSM serial number
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];
BYTE sensePtrs[2];
BYTE IOEShadow;
// 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;
sbit bWriteCacheDisabled = ActiveLunBits ^ 6; // Active low so it starts out active when we set ActiveLunBits to 0
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;
xdata BYTE halfKBuffer[BUFFER_SIZE] _at_ 0xe000;
bit noFlashMedia;
bit ejected;
bit directionIn;
bit phaseErrorState;
// this bit determines if the current transfer is to be carried out using UDMA (1) or
// PIO (0)
bit bUseUdma;
bit bShortPacketSent;
BYTE udmaErrorCount;
bit Sleep;
bit driveIsInStandby;
idata BYTE prevCmd[12];
bit attemptFastRead;
bit attemptFastWrite;
bit attemptFastScsi;
bit bScsiRegsPreloaded;
WORD gSectorcount;
idata DWORD prevDataTransferLen;
bit mfgMode;
BYTE report[2];
bit receivedReport_Flag;
BYTE oldButtons;
BYTE bdata miscConfig;
BYTE bdata miscConfig2;
sbit bATA_UDMA_ENABLE = miscConfig^7;
sbit bATAPI_UDMA_ENABLE = miscConfig^6;
sbit bENABLE_WRITE_CACHE_MODE_PAGE= miscConfig^5;
sbit bCOMPLIANCE_MODE = miscConfig^4; // Compliance mode uses the INTRQ pin less, but it will pass the BOT tests.
sbit bWAIT_FOR_BUSY_BIT = miscConfig^3;
sbit bSHORT_PACKET_BEFORE_STALL = miscConfig^2;
sbit bSRST_ENABLE = miscConfig^1;
sbit bSKIP_PIN_RESET = miscConfig^0;
BYTE bdata pinConfig;
sbit bBUTTON_PINOUT = pinConfig ^ 7;
sbit bATA_ENABLED = pinConfig ^ 6;
sbit bBIG_PACKAGE = pinConfig ^ 5;
sbit bATA_EN = pinConfig ^ 4;
sbit bNewAt2pinout = pinConfig ^ 3;
sbit bHS_INDICATOR = pinConfig ^ 2;
sbit bDRVPWRVLD_POLARITY = pinConfig ^ 1;
sbit bDRVPWRVLD_ENABLE = pinConfig ^ 0;
sbit bCF_USES_UDMA = miscConfig2 ^ 3;
sbit b2LUN_SET_BY_EEPROM = miscConfig2 ^ 2;
sbit b1LUN_SET_BY_EEPROM = miscConfig2 ^ 1;
sbit bSEARCH_ATA_ON_WAKEUP = miscConfig2 ^ 0;
xdata BYTE HIDIntrfcDscrOffset;
xdata BYTE CSMIntrfcDscrOffset;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -