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

📄 app.c

📁 此文件是硬盘自伺服刻录代码
💻 C
📖 第 1 页 / 共 3 页
字号:
	SyncDSBNRZ      = 0xff;  //r2460
//Write And Read Mode Controller
	RWModeControl_1 = 0x06;  //r2462
	RWModeControl_2 = 0x70;
	RWModeControl_3 = 0x82;  //Maybe need to verify
	RWModeControl_4 = 0x38;  //Maybe need to verify
	RWModeControl_5 = 0x0a;
	//RWModeControl_6 = 0x7f;
	RWModeControl_7 = 0x60;
	RWModeControl_8 = 0x00;
	RWModeControl_9 = 0xcc;
	RWModeControl_10= 0xcc;
	RWModeControl_11= 0xa1;
//Write Precompensation of setting
	WritePre_0      = 0x30;  //r2478
	//WritePre_1      = 0x56;
	WritePre_2      = 0xaa;
//Servo PES setting
	//ServoPESH       = 0x55;  //r247e
//PowerManagementControl
	//PowerManagementC_0= 0x48;
	//PowerManagementC_1= 0x16;
	//PowerManagementC_2= 0x00;
//Data Mode Auxiliary ADC Control Setting	
	AuxiliaryADCC   = 0x10;  //r248e
	ContinuityTest  = 0x00;  //r2492
//Auto Zero and ABUF Control
	AutoZeroABUFC   = 0xe4;  //r2494
//Timing Loop Test setting
	TimeLoopTest     = 0x00;  //r2498
	//VDDRegulator     = 0x23;  //r249a
    SSFControl       = 0x40;  //r249c
    DataFIRResetC    = 0x00;  //r249e
//
    WR1_ASC          = 0x00;   //r24a0
    AsymmetryControl = 0x40;   //r24a4
    TimingLoopControl= 0x0c;   //r24a6
//Data Acquisition controller
    DataAcquisition_0= 0x05;   //r24a8
    DataAcquisition_1= 0x09;   //r24aa
    DataAcquisition_2= 0x0d;
    DataAcquisition_3= 0x00;
    DataAcquisition_4= 0x80;
    DataAcquisition_5= 0x10;
    DataAcquisition_6= 0x20;
    Test_Control     = 0x00;   //r24b6
//Thermal Asperity Detector Controller
	TherAsperityDete_0= 0x60;  //r24b8
	TherAsperityDete_1= 0x44;
	TherAsperityDete_2= 0xa8;
//Data Mode Gain Threshold setting  
	DataGainThreshold = 0x21;  //r24c2
	Diagnostics_1     = 0x00;  //r24c6
	BaseLineControl_0 = 0x80;  //r24c8
	BaseLineControl_1 = 0x00;
	DataFIRRegistor_12= 0xf8;  //r24d2
	DataFIRRegistor_13= 0x18;
	DataFIRRegistor_14= 0x00;
	ChannelInImpendace= 0x42;  //r24d8
//Auto Zero Corner Frequency
	AutoZeroCorFrecy  = 0x15;  //r24da VGA cornor frequency adjust
	DataHPFCorFrecy   = 0x5d;  //r24dc
	PhaseLongLoop_0   = 0x23;  //r24de
//Noise Predictive Target Control
	NoisePreTar_0     = 0x36;  //r24e0
	NoisePreTar_1     = 0x31;  
	NoisePreTar_2     = 0x00;
	NoisePreTar_3     = 0x00;
    MNPOperControl    = 0x40;  //r24e8
    MNPControlData    = 0x00;  //r24ea old value is 15!
    MNPParameterData  = 0x15;  //r24ee
    ForcedSyncMark    = 0x17;  //r24f0
    WCLKDelay         = 0x02;  //r24f2
    SyncByteDefect    = 0xf1;  //r24f4
    //DefectMonitorScan_0= 0x00; //r24f6
    //DefectMonitorScan_1= 0x00;
   // DefectMonitorScan_2= 0x00;
   // DefectMonitorScan_3= 0x00;
    //ServoPES_1         = 0x00; //r24fe
}

void Channel_Reg(void)
{
//The power managerment
		PowerManagementC_1		=0x16;  //r248a
		PinConfiguration_0    	=0x70;////r2508
		PinConfiguration_1		=0x00;////
		PinConfiguration_2		=0xf8;
		PinConfiguration_3		=0x80;////
//Servo Configuration setting
		ServoConfiguration0		=0x08;  //r2510
		ServoConfiguration1		=0x01;
//ServoConfiguration2=0x70;If you add this instruction,you will miss sam!
		ServoConfiguration3		=0x9e;
		ServoConfiguration4     =0x00;
		ServoConfiguration5     =0x50;
		ServoConfiguration6     =0x00;
		ServoConfiguration7     =0x10;
//Servo Gain registor setting
		ServoGain_0             =0xc8;  //r2520
		ServoGain_1             =0x63;
		ServoGain_2             =0x79;
		ServoGain_3				=0x3d;////
		ServoGain_4				=0x14;////
		ServoGain_5				=0x41;////
		ServoGain_6				=0x8a;////
		ServoGain_7				=0x00;////
//The Interface of Preamp
		PreampInterface_0		=0x00;////r2530
		PreampInterface_1		=0x00;////
		PreampInterface_2		=0xfb;////
		PreampInterface_3		=0x00;////
//ABUF Pin Define
		ABUFControl_0			=0x82;    //r2538
		ABUFControl_1 			=0x11;////
//SelfServoWrite Define
		SelfServoWrite_0 		=0x00;////r253e
//*(volatile unsigned char *) 0x1000253C =0x11;
		SelfServoWrite_1		=0x00;////
		SelfServoWrite_2		=0x00;////
		SelfServoWrite_3		=0x00;////	
		SelfServoWrite_4		=0x00;////
		SelfServoWrite_5		=0x00;////
		SelfServoWrite_6		=0x00;////
		SelfServoWrite_7		=0x00;////
//In Servo Mode,the FIR Boost Tap setting
		ServoFIRBoostTap_1		=0x00;////r254e
		ServoFIRBoostTap_3		=0x00;////
//Servo mode,The Timing setting
		ServoFIRTiming			=0x24;
		ServoModeAsymmetry		=0x1d;
		ManchesterCode_1		=0x0a;   
		ServoTimingLoop_0		=0x16; //r2558
		ServoTimingLoop_1		=0x68;   
		ServoTimingLoop_2		=0x05;
		ServoTimingLoop_3		=0x04;   
		ServoTimingLoop_4		=0x00;
		ServoTimestamp			=0x8a;
		SSWTimeStamp			=0xeb; 
//Servo pattern information  
		ServoSyncMark			=0x02;    
		RROReadData_0			=0x00;  //r2556
		RROReadData_1			=0xaa;
		RROReadData_2			=0xaa;
		GrayCodeData_0       	=0x32;
		GrayCodeData_1       	=0x31;      
		GrayCodeData_2       	=0x8D;
		GrayCodeData_3       	=0xa0;       
		ChipId_0             	=0x76;           
		ChipId_1             	=0x23;
		ServoPES_2           	=0x3939;
		TimingRecoveryC      	=0x39;
//*(volatile unsigned char *) 0x10002582 =0x39;
//*(volatile unsigned char *) 0x10002584 =0x39;
//*(volatile unsigned char *) 0x10002586 =0x39;
		TimingNeeded			=0x1c;
		LFGControl           	=0xc6;      
		ServoFreGener_0      	=0x66;
		ServoFreGener_1      	=0x87;
		ServoModeAuZeCorFre  	=0x01;
		SevoModeInHPFCorFre  	=0x88;
		RRO1Delay            	=0x05;
		RRO2Delay            	=0x05;
		RROSyncField         	=0x02;
		RROWriteData_0       	=0x05;
		RROWriteData_1       	=0x00;
		RROWriteData_2       	=0x00;
		RROControl           	=0x00;
		SVDControl           	=0x07;  //r25a2
		GrayCodeError_0      	=0x00;
		ServoIndexMark       	=0x14;
//*(volatile unsigned char *) 0x100025A4 =0x30;
//*(volatile unsigned char *) 0x100025A6 =0x00;
		ServoIndexMark       	=0x14;
		ServoAddressMark        =0x27;
		ServoGrayCodeLength  	=0x1f;
		ServoGrayCodeSplit   	=0xc6;
		NRZDiagnostics_0		=0x00;
        ServoCTFControl_0		=0x01;//=80 I dont know why add this instruction,the waveform become shake!?
		ServoCTFControl_1		=0x2c;
		ServoCTFControl_2		=0x78;
		ServoCTFControl_3		=0xff;////
		ServoCTFControl_4		=0x42;////
		STM_Reg13				=0x43;
//Servo Mode,Acquisition setting
        ServoAcquisition_0		=0x04;//R025C8
        ServoAcquisition_1		=0x09;
    	ServoAcquisition_2		=0x10;
		ServoAcquisition_3      =0x00;
       	ServoGainUpdCotl		=0x7f;
		SevoSncMarkDeteTiOut	=0x30;
		ServoBGATEDelay_1		=0x11;
		ServoBGATEDelay_2		=0x10;
		
//The PES setting
		PESIntegration 			=0x37;
		PESBurstFields			=0x03;
		PESBurstFields_1		=0x00;
		PESGapRROGateLength		=0x40;
		PESTransSerInterMode  	=0x00;
		PESScale              	=0x00;
		PESBitShift           	=0x00;
		NRZDiagnostics_1		=0x30;
//for short servo mode setting
		ShortServoControl_0  	=0x37;
		ShortServoControl_1  	=0x03;
		ShortServoControl_2  	=0x00;
//The servo timeout registor control
		ServoTimeoutControl 	=0x05;
		AnalogFrontEndCal_0 	=0x00;
		ServoPES_3          	=0x10;
		
}
	
void Channel_Setting(void)
{
//The Power Managerment of Registor
        PowerManagementC_2=0x00;
		PowerManagementC_1=0x07;
        PowerManagementC_0=0x48;  //r2488
//The Serial Interface setting      
	    SerInface_0=0x80;
	    SerInface_1=0x80;
	    SerInface_1=0x00;         //r2402
//The Timing Recovery Control  
	   	TimingRecoveryC=0x23;     //r2580
		TimeBaseGC     =0x6d;     //r240a
		TimeBaseGC     =0x1a;
//The Test configuration setting
		TestOutputEnable   =0xFFFF;  //r800c  
		TestOutputControl_0=0xc730;  //ra820
		TestOutputControl_1=0x7243;
//The Pin configuration setting
        PinConfiguration_2=0xf0;     //r250c
        PinConfiguration_3=0x81;
//The gain control        
		ChanStatisMeasure_6=0xb9;
		VGARegistor_4      =0xfc;    //r242e
		ABUFControl_0      =0xc6;    //r2538
//The servo pattation		
		ServoConfiguration2=0xf0;    //r2514
	    ServoIndexMark     =0x14;    //  
	    ServoAddressMark   =0x27;
	   
}

void WPwrCtl(void)
{
    //The same setting to the Servo Mode
	//disable standby, sleep, enable servo clk(11), enable BM and HBI clk, enable DM, DF, SAIL, ECU
	PWR_CTL = 0x083f;
	// set sys and cpu frequency
//	CLK_DVD0 = 0x46a4;
	// sel servo clk from osc, 20MHz?or 40MHz!
	SRV_CLK_SEL &= 0xffff0000;
	SRV_CLK_SEL |= 0x0000a424;
	// channel power control, disable sleep and PD and PPD
 	*(volatile unsigned char *)0x10002488 = 0x00;
 	// analog front end pwr ctl, disable write
 	*(volatile unsigned char *)0x1000248a = 0x17;
 	*(volatile unsigned char *)0x1000248a = 0x00;
}
void WWCSInit(void)
{
	// init output
	*(volatile unsigned *)0x10002688 = 0x2000; 
 	// read current value
 	wcs_value = WCS_VALUE&0x0000FFFF;  //WCS_VALUE = 0x10002688
 	// index time out
 	SRV_SYNC_TO &= 0xffff0000;  //R02692
 	SRV_SYNC_TO |= 0x00000100;  //WHY?
}
void WSetupWCS(void)
{
	// write
	int j;
    unsigned * tmp1 = (unsigned *)WWCS_BASE;
	for (j=0;j<30;j++)
	{
		* tmp1 &= 0x00000000;
		* tmp1 |= WData[j];	// set	
		tmp1 ++;
	}
}
//Write\Read Sequencer start Mode!
void WSequencerStart(void)
{
	SequenStartAddr = 0x0010;
	DiskFormatCmnd  &=0xeffe;
	DiskFormatCmnd  |=0x1001; // YTW 2005-9-13
}
void WSequencerStop(void)
{
	DiskFormatCmnd  &=0xfffe;
	//DiskFormatCmnd  =0x0000;	        
}
//The Sail Registor Initial Setting
//Verify by Gary 09/06/2005
void SailRegistorInit(void)
{
	//SailCtrl         = 0x002d;
	//ZSD1_Set         = 0x8000;
	//ZSD0_Set         = 0x823e;
	//ZSD2_Set         = 0x8003;
	//Current_ZSD      = 0x0001;
	//Maybe we need to verify the ZSD table value!
	
	Initial_ZSD      = 0x0000;   //Need to verify the Values!
	//Current_PSN      = 0x013b;
	Max_ZSD          = 0x0001;
	Initial_PSN      = 0x0000;  //need to caution the value a0
 	Expect_SSA       = 0x0044;  //need to caution the value
	Max_PSN          = 0x0063;  //need to caution the value 
	SailErrorMask    = 0x00c2;  //mask all Errors  00df //02 YTW 2005-9-14
	SAIL_Status      = 0x05ed;  //clear error staturs bits in SAIL
    //Sector_Size      = 0x0451;
    //ServoGateInCont  = 0x0000;
 
    IndexWedInterCont= 0x0000;  // modify by WY 
     //ServoGateAlowCont= 0x0000;
    ClockContDivide  = 0x0000; 
    IndexWedAlowCont = 0x0000;  // modify by WY 
    ZSDAddressOffset = 0x00a8; 
    Initial_SSA      = 0x0000;  //old value is 44
    //Current_SSA      = 0x0042;
    Max_SSA          = 0x0063;
    Sector_Size      = 0x0430;  //add by Gary 09/12/2005
    SailCtrl         = 0x0021; //0001 YTW 2005-9-13 
    
}	
//HDC Interface Initial Registor Setting
//Add by Gary 09/06/2005
void HDC_Inter_Init(void)           
{
	HDCInterruptMask = 0x07f8;//0xffec;     //Modify 09092005 value=07fc
    //HDCInterrupt     = 0x0000;   //Modify by Gary 09092005 old value 0x0004;
    //MPIFStatus       = 0x0000;
    BlocksReset      = 0x007f;     //Modify by Gary 09092005 old valud 0x007f;
    BlocksReset      = 0x0000;
    WaitCounter      = 0x0fff;     //Modify by Gary 09092005 old value 0x00ff;
     
}

void WgateInitial(void)
{
	DiskFormatErrMask  = 0x0050;   // modify by WY (old 3efe)//3e3f YTW 2005-9-14
	DiskFormatStaMask  = 0x0000;
	DiskFormatStatus   = 0xffff;
	RetryCount         = 0x000f;
	TargetHeadAddr     = 0x0000;
	//CylAdd0            
	//DiskFormatCmnd=0x0000;//r02c00
	DiskFormatMode     = 0x0000;//The Write mode Open,some other bit need to verify
	//Sequencer Start Address
	SequenStartAddr    = 0x0010;//Start From the Address 10
	//These three values provide the exact
    //location of the head at a specified time.
	WriteCylinAddr     = 0x00005000;
    TargetSectorAddr   = 0x0020;//YTW 2005-9-13
	TargetHeadAddr     = 0x0000;
	//SequenAddrStack=0x0000;
	//The Start Sector 
	LoopContAdjust     = 0x0000;
	LoopCont           = 0x0004;
	//The ID Check Retry times Must be The Location Correcttly
	//RetryCount = 0x0060;//If you add this instruction,you may miss the Wgate! 
	//Extended Field Count
	ExtendFieldCount   = 0x0c06;
	DiskFormatCmnd     = 0x0000;   //old value 2000  ; modify by WY
	LoopCountNumSector = 0x0010;
	//PinConfiguration_2 = 0xb8;
	//SailCtrl           = 0x0007;   //3f
	//DM register
	//DM_SR              = 0x0001;
	BufTransMode       = 0x8c00;   //verify by Gary 0908 //modify by WY (old 8000)
}

void DataPatternInit(void)
{
	DataPattern_0      = 0x00cc;          //REG r02d02	
	DataPattern_1      = 0x0333; //0311          //REG r02d00
	DataPattern_2      = 0x0365;
	DataPattern_3      = 0x0323;
	DataPattern_4      = 0x0387;
	DataPattern_5      = 0x0398;	

}
void DefectManager(void)
{
	DM_CR              = 0x000f;
	DefectSKEW         = 0x0000;//Verify by Gary 09/13/2005
	
}
void ErrorCorrectUnit(void)
{
	ECCMode            = 0x0998;
	ECCBufferMode      = 0x0000;
		
}
void DiskFormmater(void)
{
	DiskFormatCmnd     = 0x0000;
	DiskFormatMode     = 0x0000;
	DiskFormatStaMask  = 0x0000;  //003c   YTW 2005-9-13
	DiskFormatStatus   = 0x0000;  //ffff
	DiskFormatErrMask  = 0x0050;  //0800   YTW 2005-9-13
	DiskFormatErr      = 0x0000;
	SequenStartAddr    = 0x0010;
	RetryCount         = 0x000f;
	LoopContAdjust     = 0x0000;
	LoopCont           = 0x0004;//0004
	ExtendFieldCount   = 0x0501;
	ECCLogMode         = 0x0000;
	PowerControlReg    = 0x0000;
	MaxHeadAddr        = 0x000f;
	MinHeadAddr        = 0x0000;
	MinCylinderAddr    = 0x0000;
	MaxCylinderAddr    = 0xffff0000;

⌨️ 快捷键说明

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