!
rem                                     
rem NAND flash programming include file                                                       
rem                                             
rem --------------------                                                                     
rem Init system register                                                                     
rem--------------------                                                                     
rem init mpmc                                                                                
long 0xb1000000 0x01                                                                 
long 0xb1000200 0x80                                                                 
long 0xb1000220 0x81                                                                 
rem enable nand flash                                                                        
long 0xb2000064 0x100                                                                
long 0xb2000008 0x1                                                                  
rem-----------------------                                                                  
rem page write cycle                                                                        
rem-----------------------  
$port=0xb0000000
rem deassert WP# Write protect                                                              
output $port+0xa 0x1                                                                
rem deassert SP#                                                                            
output $port+0x8 0x1                                                                
rem assert CE#                                                                              
output $port+0x1 0x1                                                                
rem assert CLE                                                                              
output $port+0x4 0x1   
rem Issue readid data command                                                                 
output $port 0x90       

rem deassert CLE                                                                            
output $port+0x3 0x1                                                                
rem assert ALE                                                                              
output $port+0x6 0x1 

rem Issue start address                                                                     
output $port 0x0
rem deassert ALE                                                                            
output $port+0x5 0x1 

pause 1

inport $port 0x1 -B
inport $port 0x1 -B

!



