Browse Source

support for mini2440 emulator

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@336 bbd45198-f89e-11dd-88c7-29a3b14d5316
qiuyiuestc 15 years ago
parent
commit
9fb4908710

+ 1 - 1
bsp/mini2440/application.c

@@ -76,7 +76,7 @@ void rt_init_thread_entry(void* parameter)
 
 #ifdef RT_USING_RTGUI
 	{
-		rt_hw_key_init();
+		//rt_hw_key_init();
 	}
 #endif
 

+ 1 - 1
bsp/mini2440/board.c

@@ -88,7 +88,7 @@ void rt_hw_uart_init(void)
 	GPHUP |= 0xF;
 
 	/* FIFO enable, Tx/Rx FIFO clear */
-	uart0.uart_device->ufcon = 0x1;
+	uart0.uart_device->ufcon = 0x0;
 	/* disable the flow control */
 	uart0.uart_device->umcon = 0x0;
 	/* Normal,No parity,1 stop,8 bit */

+ 11 - 5
bsp/mini2440/debug.Opt

@@ -13,7 +13,13 @@
 Target (RT-Thread Debug), 0x0004 // Tools: 'ARM-ADS'
 
 
-ExtF <E:\Projects\opensvn\rt-thread\google\bsp\mini2440\startup.c> 118,127,0,{ 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,113,2,0,0,32,1,0,0 }
+ExtF <E:\SVN-Google-Source\bsp\mini2440\application.c> 49,56,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,188,2,0,0,7,1,0,0 }
+ExtF <E:\SVN-Google-Source\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c> 47,54,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,236,2,0,0,66,1,0,0 }
+ExtF <E:\SVN-Google-Source\bsp\mini2440\sdcard.c> 602,602,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,57,3,0,0,190,0,0,0 }
+ExtF <E:\SVN-Google-Source\libcpu\arm\s3c24x0\start_rvds.s> 844,848,0,{ 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,201,2,0,0,128,1,0,0 }
+ExtF <E:\SVN-Google-Source\bsp\mini2440\startup.c> 124,135,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,88,0,0,0,116,0,0,0,223,2,0,0,157,1,0,0 }
+ExtF <E:\SVN-Google-Source\src\kservice.h> 80,84,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,179,2,0,0,82,1,0,0 }
+ExtF <E:\SVN-Google-Source\src\idle.c> 56,66,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,179,2,0,0,82,1,0,0 }
 
 TARGOPT 1, (RT-Thread Debug)
  ADSCLK=12000000
@@ -25,15 +31,15 @@ TARGOPT 1, (RT-Thread Debug)
   OPTXL 1,1,1,1,1,1,1,0,0
   OPTFL 1,0,1
   OPTAX 255
-  OPTBL 0,(User's Manual)<DATASHTS\SAMSUNG\S3C2410_UM.PDF>
-  OPTDL (SARM.DLL)()(DARMSS9.DLL)(-pS3C2410A)(SARM.DLL)()(TARMSS9.DLL)(-pS3C2410A)
+  OPTBL 0,(User's Manual)<DATASHTS\SAMSUNG\S3C2440_UM.PDF>
+  OPTDL (SARM.DLL)()(DARMSS9.DLL)(-pS3C2440A)(SARM.DLL)()(TARMSS9.DLL)(-pS3C2440A)
   OPTDBG 47614,6,()()()()()()()()()(.\Ext_RAM.ini) (Segger\JLTAgdi.dll)()()()
   OPTKEY 0,(DLGTARM)((113=-1,-1,-1,-1,0)(100=90,124,666,445,0)(102=-1,-1,-1,-1,0)(103=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0)(108=-1,-1,-1,-1,0)(109=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(112=-1,-1,-1,-1,0))
-  OPTKEY 0,(JLTAgdi)(-O1070 -J1 -Y1000 -Z1 -FO7 -FD40000000 -FC800 -FN0)
+  OPTKEY 0,(JLTAgdi)(-O1070 -J1 -Y800 -Z4 -FO7 -FD30000000 -FC8000 -FN1 -FF0S3C2440_NAND_SP -FS030000000 -FL08000000)
   OPTKEY 0,(JLTDLG)()
   OPTKEY 0,(DLGDARM)((113=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(102=-1,-1,-1,-1,0)(103=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0)(108=-1,-1,-1,-1,0)(109=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(112=-1,-1,-1,-1,0))
   OPTKEY 0,(ARMDBGFLAGS)(-T5F)
-  OPTMM 1,2,(0)
+  OPTMM 1,2,(0x3020000)
   OPTDF 0x86
   OPTLE <>
   OPTLC <>

+ 11 - 11
bsp/mini2440/debug.Uv2

@@ -7,14 +7,14 @@ Target (RT-Thread Debug), 0x0004 // Tools: 'ARM-ADS'
 
 
 Options 1,0,0  // Target 'RT-Thread Debug'
- Device (S3C2410A)
+ Device (S3C2440A)
  Vendor (Samsung)
- Cpu (IRAM(0x40000000-0x40001FFF) CLOCK(12000000) CPUTYPE(ARM920T))
+ Cpu (IRAM(0x40000000-0x40000FFF) CLOCK(12000000) CPUTYPE(ARM920T))
  FlashUt ()
- StupF ("STARTUP\Samsung\S3C2410A.s" ("Samsung S3C2410A Startup Code"))
- FlashDR ()
- DevID (4252)
- Rgf (S3C2410A.H)
+ StupF ("STARTUP\Samsung\S3C2440.s" ("Samsung S3C2440 Startup Code"))
+ FlashDR (UL2ARM(-UV2077N9E -O40 -S0 -C0 -N00("ARM920T Core") -D00(0032409D) -L00(4) -FO7 -FD40000000 -FC1000 -FN1 -FF0S3C2440_NAND_SP -FS030000000 -FL07FFC000))
+ DevID (4277)
+ Rgf (S3C2440.H)
  Mem ()
  C ()
  A ()
@@ -55,10 +55,10 @@ Options 1,0,0  // Target 'RT-Thread Debug'
  RVDEV ()
  ADSTFLGA { 0,8,64,0,96,0,64,64,0,0,0,0,0,0,0,0,0,0,0,0 }
  OCMADSOCM { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
- OCMADSIRAM { 0,0,0,0,64,0,32,0,0 }
+ OCMADSIRAM { 0,0,0,0,64,0,16,0,0 }
  OCMADSIROM { 0,0,0,0,0,0,0,0,0 }
  OCMADSXRAM { 0,0,0,0,0,0,0,0,0 }
- OCR_RVCT { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,32,0,0,0,0,0,0,0,0,0,0,0 }
+ OCR_RVCT { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,16,0,0,0,0,0,0,0,0,0,0,0 }
  RV_STAVEC ()
  ADSCCFLG { 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
  ADSCMISC ()
@@ -88,10 +88,10 @@ Options 1,0,0  // Target 'RT-Thread Debug'
  ADSLDMC ()
  ADSLDIF ()
  ADSLDDW ()
-  OPTDL (SARM.DLL)()(DARMSS9.DLL)(-pS3C2410A)(SARM.DLL)()(TARMSS9.DLL)(-pS3C2410A)
+  OPTDL (SARM.DLL)()(DARMSS9.DLL)(-pS3C2440A)(SARM.DLL)()(TARMSS9.DLL)(-pS3C2440A)
   OPTDBG 47614,6,()()()()()()()()()(.\Ext_RAM.ini) (Segger\JLTAgdi.dll)()()()
- FLASH1 { 1,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0 }
- FLASH2 ()
+ FLASH1 { 1,0,0,0,1,0,0,0,4,16,0,0,0,0,0,0,0,0,0,0 }
+ FLASH2 (Segger\JLTAgdi.dll)
  FLASH3 ("" ())
  FLASH4 ()
 EndOpt

+ 10 - 54
bsp/mini2440/sdcard.c

@@ -74,8 +74,8 @@ static int sd_cmd_end(int cmd, int be_resp)
 		{
 		    	if( (finish0&0x1f00) != 0xa00 )
 		    	{
-                    rt_kprintf("CMD%d:SDICSTA=0x%x, SDIRSP0=0x%x\n",
-                        cmd, SDICSTA, SDIRSP0);
+                    		rt_kprintf("CMD%d:SDICSTA=0x%x, SDIRSP0=0x%x\n",
+                        		cmd, SDICSTA, SDIRSP0);
 
 		    		SDICSTA=finish0;
 		    		if(((finish0&0x400)==0x400))
@@ -100,7 +100,7 @@ static int sd_data_end(void)
 	finish=SDIDSTA;
 
 	while( !( ((finish&0x10)==0x10) | ((finish&0x20)==0x20) ))
-	{   rt_kprintf("data end\n");
+	{
 		finish=SDIDSTA;
 	}
 
@@ -139,7 +139,10 @@ static int sd_cmd55(void)
 	SDICCON = (0x1 << 9) | (0x1 << 8) | 0x77;
 
 	if(sd_cmd_end(55, 1) == RT_ERROR)
+	{
+		rt_kprintf("CMD55 error\n");
 		return RT_ERROR;
+	}	
 
 	SDICSTA=0xa00;
 	return RT_EOK;
@@ -197,34 +200,6 @@ static void sd_setbus(void)
     SDICSTA=0xa00;	    /* Clear cmd_end(with rsp) */
 }
 
-/**
- * This function will set a hook function, which will be invoked when a memory
- * block is allocated from heap memory.
- *
- * @param hook the hook function
- */
-int sd_mmc_ocr(void)
-{
-	int i;
-
-	/* Negotiate operating condition for MMC, it makes card ready state */
-	for(i=0; i<100; i++)
-	{
-		SDICARG = 0xff8000;
-		SDICCON = (0x1<<9)|(0x1<<8)|0x41;
-
-		/* Check end of CMD1 */
-		if((sd_cmd_end(1, 1) == RT_EOK) && (SDIRSP0>>16)==0x80ff)
-		{
-			SDICSTA=0xa00;
-			return RT_EOK;
-		}
-	}
-	SDICSTA=0xa00;
-
-	return RT_ERROR;
-}
-
 /**
  * This function will set a hook function, which will be invoked when a memory
  * block is allocated from heap memory.
@@ -271,7 +246,7 @@ rt_uint8_t sd_init(void)
 	/* Important notice for MMC test condition */
 	/* Cmd & Data lines must be enabled by pull up resister */
 	SDIPRE  = PCLK/(INICLK)-1;
-	SDICON  = (1<<4) | 1;	// Type B, clk enable
+	SDICON  = (0<<4) | 1;	// Type A, clk enable
 	SDIFSTA = SDIFSTA | (1<<16);
 	SDIBSIZE = 0x200;       /* 512byte per one block */
 	SDIDTIMER=0x7fffff;     /* timeout count */
@@ -280,13 +255,6 @@ rt_uint8_t sd_init(void)
 	for(i=0; i<0x1000; i++);
 
 	sd_cmd0();
-	/* Check MMC card OCR */
-	if(sd_mmc_ocr() == RT_EOK)
-	{
-		rt_kprintf("In MMC ready\n");
-		goto RECMD2;
-	}
-	rt_kprintf("MMC check end!!\n");
 
 	/* Check SD card OCR */
 	if(sd_ocr() == RT_EOK)
@@ -362,19 +330,7 @@ RERDCMD:
 		status = SDIFSTA;
 		if((status & 0x1000) == 0x1000)
 		{
-#if 1
-			register rt_uint32_t value;
-
-			value = SDIDAT;
-
-			/* swap 4 bytes */
-			buf[0] = (value >> 24) & 0xff;
-			buf[1] = (value >> 16) & 0xff;
-			buf[2] = (value >> 8) & 0xff;
-			buf[3] = value & 0xff;
-#else
 			*(rt_uint32_t *)buf = SDIDAT;
-#endif
 			rd_cnt++;
 			buf += 4;
 		}
@@ -422,7 +378,7 @@ REWTCMD:
     		{
         		SDIDAT=*(rt_uint32_t*)buf;
         		wt_cnt++;
-				buf += 4;
+			buf += 4;
     		}
     	}
 	if(sd_data_end() == RT_ERROR)
@@ -564,8 +520,8 @@ void rt_hw_sdcard_init()
 	CLKCON |= 1 << 9;
 
 	/* Setup GPIO as SD and SDCMD, SDDAT[3:0] Pull up En */
-    GPEUP  = GPEUP  & (~(0x3f << 5))   | (0x01 << 5);
-    GPECON = GPECON & (~(0xfff << 10)) | (0xaaa << 10);
+	GPEUP  = GPEUP  & (~(0x3f << 5))   | (0x01 << 5);
+	GPECON = GPECON & (~(0xfff << 10)) | (0xaaa << 10);
 
 	RCA = 0;
 

+ 1 - 1
bsp/mini2440/touch.c

@@ -103,7 +103,7 @@ void report_touch_input(int updown)
 
 	emouse.button |= RTGUI_MOUSE_BUTTON_LEFT;
 
-	rtgui_server_post_event((&emouse.parent), sizeof(emouse));
+	//rtgui_server_post_event((&emouse.parent), sizeof(emouse));
 }
 #endif
 

+ 6 - 6
filesystem/dfs/filesystems/efsl/src/fs/vfat/ui.c

@@ -35,7 +35,7 @@
 /*****************************************************************************/
 #include "ui.h"
 #include "ls.h"
-#include "efs.h"
+#include "efs.h"
 /*****************************************************************************/
 
 /* ****************************************************************************  
@@ -65,12 +65,13 @@ esint16 un_link(FileSystem *fs,euint8* filename)
 		firstCluster <<= 16;
 		firstCluster += ex_getb16(buf+loc.Offset*32+26);
 		attr = ex_getb16(buf+loc.Offset*32+11);
+		part_relSect(fs->part,buf);
+
 		if(attr == ATTR_DIRECTORY)
 		{
 			dlist = (DirList *)rt_malloc(sizeof(DirList));
 			if(dlist == RT_NULL)
 			{
-				part_relSect(fs->part,buf);
 				
 				dfs_log(DFS_DEBUG_INFO, ("Memory alloc failed"));				
 				return -DFS_STATUS_ENOMEM;	
@@ -91,9 +92,7 @@ esint16 un_link(FileSystem *fs,euint8* filename)
 					{
 						/* '.' and '..' */
 						if(dlist->currentEntry.FileName[0] == '.') continue;
-						
-						part_relSect(fs->part,buf);
-						
+												
 						dfs_log(DFS_DEBUG_INFO, ("Directory not empty"));
 						return -DFS_STATUS_ENOTEMPTY;
 					}
@@ -101,7 +100,8 @@ esint16 un_link(FileSystem *fs,euint8* filename)
 				}
 			}
 		}
-
+		
+		buf = part_getSect(fs->part,loc.Sector,IOM_MODE_READWRITE);
 		memClr(buf+(loc.Offset*32),32);
 		part_relSect(fs->part,buf);
 		cache.DiscCluster = cache.LastCluster = cache.Linear = cache.LogicCluster = 0;

BIN
tools/SDCARD.zip


BIN
tools/SDL.dll


BIN
tools/libz-1.dll


BIN
tools/qemu-system-arm.exe


+ 1 - 0
tools/run-mini2440-net-sdcard.bat

@@ -0,0 +1 @@
+qemu-system-arm.exe -M mini2440 -kernel ..\bsp\mini2440\rtthread-mini2440.axf -show-cursor -serial telnet:127.0.0.1:1200,server -net nic -net tap,ifname=virtual -sd SDCARD