Search This Blog

Dec 1, 2008

Completed 512 bytes sector nand flash driver

Finished the 512 bytes sector nand flash driver, it works ok on nand stress test. However, our SDK is too complicate to accept 512 bytes sector. I need set it in pending status although there still have many other case need to handle.

Nov 19, 2008

512 bytes sector access

I plan to add 512 bytes support in Nand flash driver. That may have a little change. Hope it can be finished this week.

Oct 28, 2008

USBMSC mode work ok

MediaInit locate in use once memory, it calls my init function and cause VMI abort. remove this call and then USBMSC mode work OK. Player mode still has problem.

Oct 17, 2008

Nand flash write speed improve

Trace the USB transfer data. I got impress about the time cost at each stage. Every 64 sectors write will take a block erase and build block map. And when access FAT1, FAT2, Root directory and MBR, it will copy block which take many time.
I list the time cost below, the time is relative.
1.Write sector takes 620 us.
2.Build block map and erase block takes 12ms
3.Copy block takes 180ms.
And then I rewrite block map evict method, just pick up the less time cost block. And then write speed improve 33%. now the read write speed is same as SDK does.
The other way to improve the speed should put our foucs on read redandunt time. Every build block map will read 64 redandunt area and takes 9ms.

Oct 10, 2008

Updater work fine

replace read/write function with mine, updater can copy files into disc. use HDbench test, r/w is 6470/1476(3716). orignal SDK r/w is 5369/4000. read speed is fast than original SDK, write speed too slow, need find out why the root cause.

Oct 9, 2008

Nand flash logical to physical management

Yesterday, use nand stress test for 30 mins, it runs OK. Next step I will try to migrate it into SDK procedure.

Sep 26, 2008

Nand flash driver

I am preparing the Nand flash driver which control logical to physical translation. Almost finish. Will test it in our SDK.

Sep 17, 2008

今天有家长会

今天要开家长会,老婆考9选3一次过。

Aug 10, 2008

奥运会

奥运开始了,时间过得真快。比赛非常精彩,又是个享受的日子。

Jul 13, 2008

转贴:驱动开发入门之中断处理

从网上看到些介绍,贴在下面,最近没有太多时间来看相关的内容。
驱动开发入门之中断处理
驱动程序开发过程中对中断的处理是很重要的一部分,直接关系程序的运行结果与效率,所以需要对其给予足够的重视.
中断处理包含两个方面,与CE系统相关的部分及与硬件相关的部分.
CE系统特定的处理流程(与其它系统有所区别的,或者说这部分代码在其它系统上是无法运行的)一般为:
1.用CreateEvent创建一个自动事件(即不需要使用ResetEvent去重置事件.
2.用InterruptInitialize将些事件与硬件所需要的中断关联起来.
 3.创建一个线程,在此线程中用WaitForSingleObject等待事件,当等到这个事件之后,开始相应的处理,完成之后调用InterruptDone去重新激活中断.


硬件相关部分,
一般的,OAL层的中断处理程序(OEMInterruptHandler),在监测到某个中断后,会将CPU相应的中断标志位清除,同时禁用该中断,以保证系统调度不会被该中断再次打断,而后返回一个中断号给系统,从而使系统开始调度其IST,驱动程序的IST被激活,完成相应的处理之后应该清除硬件级的中断标志,从而使硬件知道中断服务已经完成,而不再产生该中断。当然有些硬件,例如ATA/ATAPI不需要这个动作,这些设备在最后一个字节被读出/写入之后会将其DRQ标志清除,自然,只要还有一个字节没有被读出/写入,DRQ就一直存在。

注意:
5。0以后引入PQOAL的概念,在PQOAL格式的BSP中,有一个SYSINTR与IRQ的概念,SYSINTR是系统使用的中断,IRQ为硬件中断,即CPU使用的中断线,一般的BSP中,将其CPU的中断标志寄存器的各位一一对应,即,IRQ0对应于该寄存器的第0位,IRQ2为第2位。所以,做为驱动程序,必须知道它所驱动的硬件所使用的IRQ,即硬件中断线。然后调用KernelIoControl的IOCTL_HAL_REQUEST_SYSINTR功能得到一个SYSINTR,然后再进入上面描述的流程。这样,驱动程序 以后就只使用申请到的SYSINTR,而不关心其IRQ了。 OAL层会将IRQ与SYSINTR做相互转换。

Jun 23, 2008

WINCE build option.

1.Sysgen to build image when you change the catalog.
2.Build and Sysgen. Build OS kernel and Sysgen, it tooks too much time
3.Build and Sysgen CurrentBSP. Build if you only change platform BSP code, the speed is fast.

When I change config.bib for memory map, with Build and Sysgen CurrentBSP, it does not generate correct image. I found config.bib in release directory is old on. I run "Copy file to release directory" and then run "Build and Sysgen CurrentBSP" and get correcty image.
If you only change one device driver, you can select the "Build project" and then run "Make runtime image", then you can fastest get image.

Jun 16, 2008

PWM setting

SDK setting is too complex, re-organize it.
void backlight_test()
{
unsigned int i,temp;

(*(volatile unsigned int *) HW_PINCTRL_MUXSEL4_CLR_ADDR) = (3<<4); // GPIO config as PWM2
(*(volatile unsigned int *) HW_PWM_ACTIVE2_CLR_ADDR) = 0; // clear count of inactive and active
(*(volatile unsigned int *) HW_PWM_ACTIVE2_SET_ADDR) = 0x00210000; // set active and inactive count
(*(volatile unsigned int *) HW_PWM_PERIOD2_CLR_ADDR) = 0; // clear
(*(volatile unsigned int *) HW_PWM_PERIOD2_SET_ADDR) = 0x000B002F; // set MATT,CDIV,INACTIVE,ACTIVE,PERIOD
(*(volatile unsigned int *) HW_CLKCTRL_XTAL_CLR_ADDR) = 0x20000000; // Clear the gate
(*(volatile unsigned int *) HW_PWM_CTRL_CLR_ADDR) = 0x40000000; // Clear the clock gate
(*(volatile unsigned int *) HW_PWM_CTRL_SET_ADDR) = (1<<5); // PWM2_ANA_CTRL_ENABLE
(*(volatile unsigned int *) HW_LRADC_CTRL0_CLR_ADDR)= 0xC0000000; // LRADC RST and gate clear
(*(volatile unsigned int *) HW_LRADC_CTRL2_CLR_ADDR)= 0x00200000; // LRADC1 feedback control

temp = (*(volatile unsigned int *) HW_LRADC_CTRL2_ADDR) & 0x001F0000;
for(i=0;i<=100;i+=10)
{
(*(volatile unsigned int *) HW_LRADC_CTRL2_ADDR) = temp | ((0x1C*i/100) << 16);
(*(volatile unsigned int *) HW_PWM_CTRL_SET_ADDR) = 0x4; // Pwm2 enable
(*(volatile unsigned int *) HW_LRADC_CTRL2_SET_ADDR) = 0x00400000; // BL enable
}
}

May 27, 2008

Dirver developing in wince

We can compile the driver project and then make run time image, it is fastest way when you developing your device driver. It takes few minutes.

May 20, 2008

HIVE

wanna to store touch panel cordinate data into REG, modify the FlashDSK.reg
; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\init\BootVars]
"SYSTEMHIVE"="system.hv"
"PROFILEDIR"="Documents and Settings"
"Start DevMgr"=dword:1
"RegistryFlags"=dword:1

[HKEY_LOCAL_MACHINE\init\BootVars]
"DefaultUser"="default"

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\MSFlash]
"Profile"="MSFlash"
"IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
"Order"=dword:0
"FriendlyName"="MSFLASH Driver"
"Dll"="smflash.dll"
"Prefix"="DSK"

[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\MSFlash]
"DriverPath"="Drivers\\BuiltIn\\MSFlash"
; LoadFlags 0x01 == load synchronously
"LoadFlags"=dword:1
"Order"=dword:0
"BootPhase"=dword:0



[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\FlashDrv]
"Prefix"="DSK"
"Dll"="FLASH_STMP37XX.dll"
"Order"=dword:1
"Index"=dword:2
"Ioctl"=dword:4
"Profile"="FLASHDISK"
"FriendlyName"="MSFLASH Driver"
"MountFlags"=dword:0
"BootPhase"=dword:0
"IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
"Flags"=dword:1000

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FLASHDISK]
"PartitionDriver"="mspart.dll"
"AutoMount"=dword:1
"AutoPart"=dword:1
"AutoFormat"=dword:1
"MountFlags"=dword:1
"Folder"="ResidentFlash"
"Name"="Microsoft Flash Disk"
"BootPhase"=dword:0


[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FLASHDISK\FATFS]
;"MountFlags"=dword:0
"MountFlags"=dword:2 ; support hive-based registry
"AutoMount"=dword:1
"AutoPart"=dword:1

; @CESYSGEN ENDIF CE_MODULES_SDNPCID
; END HIVE BOOT SECTION

May 19, 2008

wince run on 32MB mDDR platform

1.config.bib modified the macro definition from 64MB to 32MB
#define ROM_IMAGE_START 80100000
; #define ROM_IMAGE_SIZE 01100000
; #define RAM_IMAGE_START 81300000
; #define RAM_IMAGE_SIZE 02D00000
#define ROM_IMAGE_SIZE 01100000
#define RAM_IMAGE_START 81300000
#define RAM_IMAGE_SIZE 00D00000
2. Modify wince37xx_32MB.bd
constants {
LOAD_ADDR = 0x40100000;
ENTRY_ADDR = 0x40100000;
sdram_arg = 0x02010020; // 0x02010040
}
3. Modify SDRAM arg from 64MB to 32MB in elf2sb convert.
elftosb -V -z -f 37xx -p "\." -c wince37xx_32MB.bd -o bootmanager.sb -D sdram_arg=0x02010020

Apr 23, 2008

WINCE5.0

Now the license fees of wince is only 1$, and the cpu is powerful now. Moreover, it is fast way to use wince to design your product.

Mar 25, 2008

云南旅游

请了假,准备下个星期和家人去丽江和中甸旅游,享受一下。

Mar 10, 2008

Rmvb support

There are serveral vendor are supporting rmvb function without transfer. It is hot issue and we need speed up our development.
Have a look on overlay code, it is complex but the idea is good to deal with the overlay with MMU coperate. I still need take more time to famliar with the memory issue. I have tested serveral python script in BIN directory, however, it doesn't works.:-(

Mar 3, 2008

IIC 展览

今天是iic展览,公司只参加了深圳的展示。现在产品趋同性加大,今后竞争会更激烈,需要多关心目前的产品方向。学如逆水行舟,不进则退。

Feb 20, 2008

Read firmware from player

Now we can read firmware under normal USB connection. It looks work well.

Feb 15, 2008

Read10, Write10, ReadCapacity command support

With my co-worker help, it can do read/write through SCSI command. The original data buffer pointer return from structure member. change it to golbal array, it can write data into u-disk now.

Feb 14, 2008

Python access mass storage class device

use SWIG function. Build C dll which access USB port with DDK support. Python implement SCSI command function. Now can send INQUIRY and READ10 command. Try to add more SCSI command support in future.

Jan 28, 2008

Python call C function with pointer parameter

昨天折腾了一下。 可以传递指针参数了。
1. 在useSwig.i 里面加上
%module useSWIG

%inline %{
extern void add(int size, int *result);
%}

%include carrays.i
%array_functions(int, intp);

2. useSWIG.c
void add(int size, int *result)
{
}

3. runme.py
import useSWIG
a = useSWIG.new_intp(100);
useSWIG.add(100,a)
for i in range(0,100):
r = useSWIG.intp_getitem(a,i);
print r
useSWIG.delete_intp(a);

这样有点麻烦,但是能实现指针的传递。暂时先这么用。

Jan 24, 2008

SWIG call C function

Download the Swig, check the Examples\python\simple. It makes a dll project. Something need notice.
1. VC7 tools->option->projects->VC++ Directories->Excutable files "c:\swigwin"
tools->option->projects->VC++ Directories->Include files "c:\python25\include"
tools->option->projects->VC++ Directories->Library files "c:\python25\libs"
tools->option->projects->VC++ Directories->Library files "c:\python25\lib"

2. example.i customer build step->command line
swig -python "$(InputPath)"

3. project properties C/C++->Advanced->Compile As->Compile as C++ code(/TP)

after that, write simple python file and can call windows functions.

Jan 23, 2008

Play for Sure 1.21 with WMP11

Yesterday we found P4S1.21 win WMP10 can pass the error point, and still on going now. We also check another Nand flash which pass the stress test long time ago, it fail with WMP11 installed. It looks it is relate with WMP version. Oh, what Microsoft doing? It already took our 3 weeks to investigate this problem!

Jan 17, 2008

HY27UT088G2A validation

These are working on HY27UT088G2A MTP stress test fail issue. We have tested 3 pcs Nand flash, all of them are fail on deleting 280 or 281 song file. It looks strange here. Every test will take 70 minutes, it is hard to debug the problem. I try to copy some large files into Nand flash with hidden attribute, the failure will happen within 20 minutes. However, the MTP stress test need at least 128 MB free space, I can not cut down to many space to shorten the test time.

Jan 11, 2008

Sdram L2 table remove

Modified MMU initialization part, remove SDRAM l2 table and remove sdram prep initial subproject. And comment Sdram initial part in firmware. The updater.sb can run in OCRAM now.

Jan 9, 2008

Sdram less updater

I am working on Sdramless of updater now. The .text part can be less than 100kB. However, the memory usage is much more than I think. After adjustment, the memory size is fit on OCRAM now. However, SDRAM l2 table in SDRAM which can not move to OCRAM now. I would like to take a look on MMU initliazation part first.

Jan 2, 2008

Vocation on Zhuhai

元旦自驾游去了珠海,我妻子,女儿,母亲,侄子,老姨。待了2天,把珠海逛了个遍,还泡了温泉。整体感觉很好。珠海气候宜人,是个休闲的好地方。