?? globals.h
字號:
//--------------------------------------------------------------------------
// globals.h
//
// global variables used by the firmware
//
// Format: indent 3. NO TABS!
//
//--------------------------------------------------------------------------
// $Archive: /USB/atapifx2/NX2LP/SRC/CY3686FW/GLOBALS.H $
// $Modtime: 8/08/05 10:01a $
// $Revision: 1 $
//--------------------------------------------------------------------------
//
// Copyright 2005, Cypress Semiconductor Corporation.
//
// This software is owned by Cypress Semiconductor Corporation (Cypress)
// and is protected by and subject to worldwide patent protection (United
// States and foreign), United States copyright laws and international
// treaty provisions. Cypress hereby grants to licensee a personal,
// non-exclusive, non-transferable license to copy, use, modify, create
// derivative works of, and compile the Cypress Source Code and derivative
// works for the sole purpose of creating custom software in support of
// licensee product to be used only in conjunction with a Cypress integrated
// circuit as specified in the applicable agreement. Any reproduction,
// modification, translation, compilation, or representation of this
// software except as specified above is prohibited without the express
// written permission of Cypress.
//
// Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,
// WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Cypress reserves the right to make changes without further notice to the
// materials described herein. Cypress does not assume any liability arising
// out of the application or use of any product or circuit described herein.
// Cypress does not authorize its products for use as critical components in
// life-support systems where a malfunction or failure may reasonably be
// expected to result in significant injury to the user. The inclusion of
// Cypress' product in a life-support systems application implies that the
// manufacturer assumes all risk of such use and in doing so indemnifies
// Cypress against all charges.
//
// Use may be limited by and subject to the applicable Cypress software
// license agreement.
//
//--------------------------------------------------------------------------
#ifndef GLOBALS_H
#define GLOBALS_H
#include "scsi.h"
#include "fx2.h"
#include "fx2regs.h"
#include "gpif.h"
#include "globals.h"
#include "inand.h"
#include "intrins.h"
#define cCKCON_1 0x11 // FW_STRETCH_VALUE = 1
#define cCKCON_0 0x10 // FW_STRETCH_VALUE = 0
typedef BYTE xdata xbyte;
typedef WORD xdata xword;
typedef DWORD xdata xdword;
typedef BYTE volatile pdata pbyte;
//==========================================================================
// prototypes for ide.c
//==========================================================================
bit IDECommand();
bit ProcessCBW();
BYTE SCSICommand();
void loadEP8BC(WORD dataLen);
void waitForInBuffer();
//==========================================================================
// prototypes for fw.c
//==========================================================================
void SetupCommand(void);
void TD_Init(void);
void TD_Poll(void);
void sendDescriptor(BYTE offset, BYTE len);
void softReset();
void gpifwait();
bit ChkErr();
void nCopyBlock();
void nSearchFreeBlock(BYTE i);
//==========================================================================
// prototypes for vend_cbw.c
//==========================================================================
void GetNandType();
void GetNandCfg();
void NandSendCmd(BYTE cmd);
void loadEP2BC();
bit handleVendorCBW();
void NandSetAdd(BYTE cmd, BYTE msk);
bit CheckSignature();
void NandDetect();
void NandRead(BYTE ep, WORD len);
void CheckECC();
//==========================================================================
// prototypes for inand.c
//==========================================================================
void nNandMove(BYTE cnt, BYTE cc);
void InitNAND();
void BuildTable();
void Log2Phy();
void nReadPages();
void nWritePages();
void nCopyPages(BYTE cnt, BYTE head);
void ECCSetup(WORD offset);
bit CorrectData();
void memset16(BYTE xdata *dest, BYTE c, BYTE len);
void Fifo6In();
void nEraseBlock();
void nMarkBadBlk();
void nGetFreeBlk();
//==========================================================================
// prototypes for periph.c
//==========================================================================
void ResetAndArmEp2();
void failedIn();
void stallEP2OUT();
void mymemmovexx(BYTE xdata * dest, BYTE xdata * src, WORD len);
void sendUSBS(BYTE passOrFail);
//==========================================================================
// global variables from dscr.a51
//==========================================================================
extern WORD DscrEndOffset;
extern WORD DeviceDscrOffset;
extern WORD DeviceQualDscrOffset;
extern WORD HighSpeedConfigDscrOffset;
extern WORD UserDscrOffset;
extern WORD IntrfcSubClassHighSpeedOffset;
extern WORD IntrfcSubClassFullSpeedOffset;
extern WORD DscrEndOffset;
extern WORD SerialNumberStringDscrOffset;
extern WORD SerialNumberIndexOffset;
extern WORD DscrVIDOffset;
extern BYTE Str3Offset;
extern BYTE VendorOffset;
extern WORD HighSpeedConfigLen;
// HID external variables
extern WORD HIDDscrOffset;
extern WORD HIDReportDscrOffset;
extern WORD HIDReportDscrLen;
extern code HIDDscr;
extern code HIDIntrfcDscr;
extern WORD HIDIntrfcDscrOffset;
extern BYTE AlternateSetting; // Alternate settings
extern BYTE Configuration; // Current configuration
extern WORD wPacketSize;
extern const char code WaveDataPioUDMA[];
extern xdata BYTE halfKBuffer[];
extern char sensePtr;
extern WORD cbwTagLow; // Tag from the most recent CBW packet
extern WORD cbwTagHi;
extern bit currentState;
extern bit bCnt;
extern DWORD dataTransferLen;
extern volatile BYTE seconds;
extern volatile BYTE hertz61ticks;
extern pbyte P_GPIFTCB0;
extern pbyte P_GPIFTCB1;
extern pbyte P_XAUTODAT1;
extern pbyte P_XAUTODAT2;
extern pbyte P_ECCRESET;
extern pbyte P_ECC1B0[];
extern pbyte P_EP6BCH;
extern pbyte P_EP6BCL;
extern pbyte P_EP4BCH;
extern pbyte P_EP4BCL;
extern pbyte P_GPIFREADYSTAT;
extern pbyte P_FIFORESET;
extern pbyte P_EP6CFG;
extern pbyte P_EP2FIFOCFG;
extern pbyte P_XGPIFSGLDATLX;
extern pbyte P_XGPIFSGLDATLNOX;
extern pbyte P_OUTPKTEND;
extern pbyte P_EP2CS;
extern pbyte P_EP4CS;
extern pbyte P_ECCCFG;
extern pbyte P_INPKTEND;
extern bit directionIn;
extern bit phaseErrorState;
extern bit bLBA0;
extern bit bShortPacketSent;
extern bit Sleep;
extern bit bLUN1;
extern DWORD dwLBA, gNextLBA; // This is global to help the optimizer
extern DWORD gDriveCapacity;
extern DWORD gPhyAdd;
extern BYTE gBank, gEnableBanks, gEnableBank0, gSrcBlk0, gPartialCpy;
extern BYTE bdata NandCfg; // bit0=cache read, bit1=prog cache, bit2=30ns/50ns
extern BYTE bdata FwCfg; // bit0=WriteProtec, bit1=ECC enable
extern BYTE bdata gNandBits; // globals bits for NAND
extern bit b30nsCycle;
extern bit bWriteProtectEnable;
extern bit bInterLeave;
extern bit bNeedErase;
extern bit bCnt;
extern bit bReload;
extern bit bFreeFound;
extern bit bEject;
extern bit b2BitErr;
extern bit bErr;
extern bit bFreeBlk;
extern bit bInternalMove;
extern bit bSoftErr;
extern bit bMsk;
extern BYTE gZones; // Total Zones in a NAND
extern BYTE ecc0[], ecc1[]; // Optimize ECC variables
extern bit bWPSwitchState; // Used to detect changes in the WP switch state
extern xdata WORD gLog2Phy[];
extern WORD gSectorcount;
extern bit bNand2k;
extern BYTE gCurZone;
extern WORD gSrc, gDst, gFreeBlk;
extern DWORD gSrcAdd;
extern const char code aBank[];
extern const char code nBank[];
extern const char code nadd0[5];
extern const char code nadd1[5];
extern xword *pDst;
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -