//-----------------------------------------------------------------------------
// 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.
#ifdef __SDCC
# define BITBYTE(name,addr) // SDCC: All done in header
# define BITBIT(name,bytename,addr)
#else
# define BITBYTE(name,addr) BYTE bdata name; // Keil C: Let linker select a suitable bit byte
# define BITBIT(name,bytename,addr) sbit name = bytename ^ (addr&7);
xdata BYTE halfKBuffer[BUFFER_SIZE] _at_ 0xe000;
#endif
BITBYTE(ActiveLunBits,0x2F)
// bit defines for the active LUN
BITBIT(bDevicePresent,ActiveLunBits,0x78)
BITBIT(bMasterSlave,ActiveLunBits,0x79) // 0 == device0 (master), 1 == device1 (slave)
BITBIT(bScsi,ActiveLunBits,0x7B)
BITBIT(bExtAddrSupport,ActiveLunBits,0x7C)
BITBIT(bCompactFlash,ActiveLunBits,0x7D)
BITBIT(bWriteCacheDisabled,ActiveLunBits,0x7E) // Active low so it starts out active when we set ActiveLunBits to 0
// 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.
BITBYTE(LunBitsH,0x2A)
BITBYTE(LunBitsL,0x2B)
BYTE sensePtrs[2];
BYTE IOEShadow;
BYTE currentLunNum;
// Device info for the Active LUN
DEVICE_CONFIG_DATA idata ActiveLunConfigData;
// Sorage area for the LUN0 and LUN1 device info
DEVICE_CONFIG_DATA idata 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 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;
BITBYTE(miscConfig,0x2C)
BITBIT(bATA_UDMA_ENABLE,miscConfig,0x67)
BITBIT(bATAPI_UDMA_ENABLE,miscConfig,0x66)
BITBIT(bENABLE_WRITE_CACHE_MODE_PAGE,miscConfig,0x65)
BITBIT(bCOMPLIANCE_MODE,miscConfig,0x64) // Compliance mode uses the INTRQ pin less, but it will pass the BOT tests.
BITBIT(bWAIT_FOR_BUSY_BIT,miscConfig,0x63)
BITBIT(bSHORT_PACKET_BEFORE_STALL,miscConfig,0x62)
BITBIT(bSRST_ENABLE,miscConfig,0x61)
BITBIT(bSKIP_PIN_RESET,miscConfig,0x60)
BITBYTE(miscConfig2,0x2D)
BITBIT(bCF_USES_UDMA,miscConfig2,0x6B)
BITBIT(b2LUN_SET_BY_EEPROM,miscConfig2,0x6A)
BITBIT(b1LUN_SET_BY_EEPROM,miscConfig2,0x69)
BITBIT(bSEARCH_ATA_ON_WAKEUP,miscConfig2,0x68)
BITBYTE(pinConfig,0x2E)
BITBIT(bBUTTON_PINOUT,pinConfig,0x77)
BITBIT(bATA_ENABLED,pinConfig,0x76)
BITBIT(bBIG_PACKAGE,pinConfig,0x75)
BITBIT(bATA_EN,pinConfig,0x74)
BITBIT(bNewAt2pinout,pinConfig,0x73)
BITBIT(bHS_INDICATOR,pinConfig,0x72)
BITBIT(bDRVPWRVLD_POLARITY,pinConfig,0x71)
BITBIT(bDRVPWRVLD_ENABLE,pinConfig,0x70)
//BYTE HIDIntrfcDscrOffset;
//BYTE CSMIntrfcDscrOffset;
| Vorgefundene Kodierung: ASCII (7 bit) | 2
|