//##############################################################################
//#
//#                 WUTT DOALL.UTS   -  Samsung DoAll Process
//#            ( Run ServoCopy, Functional/BurnIn, and Final Tests )
//#
//#                   For All Promise PATA/SATA Host Adapters
//#                     (PATA UDMA 33/66/100/100TX2/133TX2 and SATA 150TX4)
//#
//#     Version    Date     Description of changes
//#     -------  --------   --------------------------------------------------------
//#      v1.04   11-22-04   Added FMTU_91h(cyl) cmd to Trident shorten BI process
//#      v1.05   12-03-04   Added Final Test Error Logging
//#      v1.07   02-02-04   Added Flash code (DN) download
//#      v1.11   04-12-04   Added Inline CSC code download
//#                         Added new Final test modified from Gumi AT test
//#              
//#     A30HTBI  09-30-07   A300 Script Verification by HyunSoo LEE
//##############################################################################
//#               Copyright (C) Samsung Information Systems, 2004
//##############################################################################


//## SYSTEM:For Declaring DCO Functions// Please Keep This Form


//#----------------------------------------------------------------------
//  LUL TEST WITH RADNOM WR (Will be replaced by "N" BI TEST) about 4/6
//#-----------------------------------------------------------------------

void main()
{
//##--------------------------------------
//##     For e-SPEC
//##--------------------------------------
int SYS_SC;  		// Please Keep This Form
int SYS_HBT;		// Please Keep This Form
int SYS_SCR;		// Please Keep This Form
int SYS_DCO;		// Please Keep This Form
int SYS_CNT;		// Please Keep This Form
int SYS_CNT1;		// Please Keep This Form
//##--------------------------------------

	int nRet,nCnt, iCnt, loaddata;
	int nHalfCYL;
	int nMaxCYL;
	int n14CYL;
	int iTempC;  //Temperature Test 

//##--------------------------------------
//##     For e-SPEC
//##--------------------------------------
//## WILL MODIFY BY SYSTEM// Please Keep This Form
//##--------------------------------------


	strcpy(StringParam1,"MUN42SB.UTS");  
	@MESSAGE_Step(NUM); @MESSAGE_SCRIPTNAME();

//##--------------------------------------
strcpy(StringParam1,"TC_05");   ////// MES
@MESSAGE_TESTPHASE();           ////// MES
//##--------------------------------------


	@WINSTAR_load_port();                        
	@MESSAGE_Step(NUM); delays(NET_PORT * 10);
    
	setvoltage(nCnt, NET_PORT, 5.0, 12.0 ); 
	
	delays(10);
    
	@MESSAGE_Step(NUM); @WINSTAR_set_timeout(120000);
	LastPowerOnLimit = 120000;        
	@MESSAGE_Step(NUM); @WINSTAR_time_stamp(0); 



//##--------------------------------------
//##     For e-SPEC - SCR Section Start
//##--------------------------------------
if( SYS_SCR )  // Please Keep This Form
{


//#-------------------------------------
// verify_burnin & verify_model
//#-------------------------------------    

@MESSAGE_Step(NUM); LastPowerOnLimit = 120000;
@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
@MESSAGE_Step(NUM); @WINSTAR_init();
                    @WINSTAR_set_PIO(4);
@MESSAGE_Step(NUM); @WINSTAR_verify_burnin();
		    @WINSTAR_set_testoption(LOG_RESULT); // Final Test Result Enable



/*
@MESSAGE_Step(NUM); strcpy(PATTERN, "DNE"); 
		    nRet = verify_signature(31, 0, 1, 0x98, BY_TEXT );

				    if( nRet != 0 )
				    {
					strcpy(StringParam1,"NOCOLD");
					@MESSAGE_TEXT3();
			        	strcpy(StringParam1,"CLDN");
					gErrorCode = 206;                              // JJW 1.3g
					@MESSAGE_TEXT4();
					stoptest();
				    }
*/




		    strcpy(PATTERN, "HU030HA");
@MESSAGE_Step(NUM); @WINSTAR_verify_model();
                    delays(2); 
@MESSAGE_Step(NUM); @WINSTAR_power_off();
                    delays(7);  




//##--------------------------------------
strcpy(StringParam1,"FTSTART"); ////// MES 
@MESSAGE_TESTPHASE();           ////// MES 
//##--------------------------------------

@MESSAGE_Step(NUM); @WINSTAR_set_timeout(120000);
@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
                    delays(2);
@MESSAGE_Step(NUM); @WINSTAR_reset();
@MESSAGE_Step(NUM); @WINSTAR_init();
                    strcpy(FILENAME,"MAINCODE"); // main code 
@MESSAGE_Step(NUM); @WINSTAR_download_microcode(7);
@MESSAGE_Step(NUM); @WINSTAR_power_off();
                    delays(7);  





//#-------------------------------------
//  CSS 2000 Loop ( CSS DISABLE FOR REDUCED TIME )
//#-------------------------------------     
        @MESSAGE_Step(NUM); @WINSTAR_css_test( CSS_TEST, 3, 0, 2000);  // CSS TEST FOR SCRATCH DEFECT SCREEN




/*

//#-------------------------------------
//  Physical Random W/R Test Unitl 10K Loop 
//#-------------------------------------     
	@MESSAGE_Step(NUM); LastPowerOnLimit = 120000;
	@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
	@MESSAGE_Step(NUM); @WINSTAR_init();
        	            Lba48Bit = 0;                                                                 
	@MESSAGE_Step(NUM); @WINSTAR_set_UDMA(4); // UDMA 4 LBA Write 
	@MESSAGE_Step(NUM); @WINSTAR_set_pattern(0xffff);
			    @WINSTAR_set_retry(36);
	@MESSAGE_Step(NUM); @WINSTAR_write ( BY_CHS | BY_VENDOR, 0, 10, 256, 0); 
        	            delays(10);                                                 

	srand(3333);  
	for( nCnt=0 ; nCnt<10000 ; )
	{
		rand(CYL,64,MAX_CYL);
		rand(HD,0,MHD);
        		prtk(CYL,HD);
		pwtk(CYL,HD);
	        	prtk(CYL,HD);
      
		nCnt++;
	}
 
 	              	    delays(10);  
	@MESSAGE_Step(NUM); @WINSTAR_power_off();
			    delays(7);  


*/

//#-------------------------------------
//  Physical Sequential Read
//#-------------------------------------    
	@MESSAGE_Step(NUM); LastPowerOnLimit = 10000;
	@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
	@MESSAGE_Step(NUM); @WINSTAR_init();
        	            Lba48Bit = 0;                                                                 
	@MESSAGE_Step(NUM); @WINSTAR_set_UDMA(4);                                                              
	@MESSAGE_Step(NUM); @WINSTAR_set_retry(36);
	@MESSAGE_Step(NUM); @WINSTAR_read ( BY_CHS | BY_VENDOR, 0, MAX_CYL, 256, 0); 
        	            delays(10);   
	@MESSAGE_Step(NUM); @WINSTAR_power_off();
        	            delays(7);  


	@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
			    delays(2);                                      
	@MESSAGE_Step(NUM); @WINSTAR_reset();
	@MESSAGE_Step(NUM); @WINSTAR_init();   
		    strcpy(PATTERN, "SCR");
        @WINSTAR_modify_sector(31,0,1,1,0x198,BY_TEXT);
	@MESSAGE_Step(NUM); @WINSTAR_power_off();
        	            delays(7);  






//#-------------------------------------
//    MC Read
//#------------------------------------- 
	@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
	@MESSAGE_Step(NUM); @WINSTAR_init();                                                    
	@MESSAGE_Step(NUM); @WINSTAR_set_UDMA(4);
        	            Lba48Bit = 0;                                  // disable 48bit mode
	@MESSAGE_Step(NUM); @WINSTAR_read( BY_CHS | BY_VENDOR | BY_MCYL | BY_TRACK, 1, 50, MAX_BLKCNT,0); // Mc Read    
			    delays(2);  





//#-------------------------------------
//    CHECK ALIST
//#------------------------------------- 
	@MESSAGE_Step(NUM); @WINSTAR_init();
	@MESSAGE_Step(NUM); @WINSTAR_set_UDMA(4); // UDMA 4 LBA Write  
        	            Lba48Bit = 0;                                                                 
	        	    strcpy(PATTERN,"00000000");
	@WINSTAR_verify_signature(50,0,105,16,BY_HEXA);    // Check Alist
        	            delays(2);
	@MESSAGE_Step(NUM); @WINSTAR_power_off();
        	            delays(7);  


/*

//#-------------------------------------
//    Physical Sequential Write
//#-------------------------------------    
	@MESSAGE_Step(NUM); LastPowerOnLimit = 120000;
	@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
	@MESSAGE_Step(NUM); @WINSTAR_init();
        	            Lba48Bit = 0;                                                                 
	@MESSAGE_Step(NUM); @WINSTAR_set_UDMA(4);                                                              
	@MESSAGE_Step(NUM); @WINSTAR_set_pattern(0x0000);                                             
	@MESSAGE_Step(NUM); @WINSTAR_set_retry(10);
	@MESSAGE_Step(NUM); @WINSTAR_write ( BY_CHS | BY_VENDOR, 0, 10, 256, 0); 
        	            delays(10);                                                 
	@MESSAGE_Step(NUM); @WINSTAR_write ( BY_CHS | BY_VENDOR, 0, MAX_CYL, 256, 0); 
        	            delays(10);   
	@MESSAGE_Step(NUM); @WINSTAR_power_off();
        	            delays(7);  


	@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
			    delays(2);                                      
	@MESSAGE_Step(NUM); @WINSTAR_reset();
	@MESSAGE_Step(NUM); @WINSTAR_init();   
		    strcpy(PATTERN, "SCR");
        @WINSTAR_modify_sector(31,0,1,1,0x198,BY_TEXT);
	@MESSAGE_Step(NUM); @WINSTAR_power_off();
        	            delays(7);  




//#-------------------------------------
//  Physical Sequential Read
//#-------------------------------------    
	@MESSAGE_Step(NUM); LastPowerOnLimit = 10000;
	@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
	@MESSAGE_Step(NUM); @WINSTAR_init();
        	            Lba48Bit = 0;                                                                 
	@MESSAGE_Step(NUM); @WINSTAR_set_UDMA(4);                                                              
	@MESSAGE_Step(NUM); @WINSTAR_set_retry(36);
	@MESSAGE_Step(NUM); @WINSTAR_read ( BY_CHS | BY_VENDOR, 0, MAX_CYL, 256, 0); 
        	            delays(10);   
	@MESSAGE_Step(NUM); @WINSTAR_power_off();
        	            delays(7);  

*/


//##--------------------------------------
//##     For e-SPEC - SCR Section End
//##--------------------------------------
}
//##--------------------------------------


//##--------------------------------------
//##     For e-SPEC - DCO Section Start
//##--------------------------------------
if( SYS_DCO )  // Please Keep This Form
{
                    LastPowerOnLimit = 120000;
@MESSAGE_Step(NUM); @WINSTAR_power_on(STOP_BURNIN_);
@MESSAGE_Step(NUM); @WINSTAR_init();
                    @WINSTAR_set_PIO(4);
@MESSAGE_Step(NUM); @WINSTAR_power_off();
                    delays(7);  
if( SYS_SCR == 0 )
{
//##--------------------------------------
strcpy(StringParam1,"FTSTART"); ////// MES 
@MESSAGE_TESTPHASE();           ////// MES 
//##--------------------------------------
}
//##--------------------------------------
strcpy(StringParam1,"SNREQ");   ////// MES 
@MESSAGE_TESTPHASE();           ////// MES 
//##--------------------------------------

//##--------------------------------------
//##SYSTEM:For DCO
//##--------------------------------------

strcpy(StringParam1,"CUSTOMREV"); ////// MES 
@MESSAGE_TESTPHASE();             ////// MES 
for(nCnt=0; nCnt<30; )
{
	delays(10);
	nCnt++;
}
strcpy(StringParam1,"FTEND");     ////// MES 
@MESSAGE_TESTPHASE();             ////// MES 
//##--------------------------------------
//##     For e-SPEC - DCO Section End
//##--------------------------------------
}
//##--------------------------------------

//##--------------------------------------
strcpy(StringParam1,"ENDTEST");   ////// MES 
@MESSAGE_TESTPHASE();             ////// MES 
//##--------------------------------------
@MESSAGE_Step(NUM); @WINSTAR_time_stamp(1);
@MESSAGE_Step(NUM); @MESSAGE_DrivePass();
}

