2008年10月31日星期五

Mobile: USB Host interface

正在写mobile上的USB Host Client Driver,今天终于知道了USBD.dll输出的函数如何使用啦!
USB毕竟只有一条通路,软件上在如何多线程,最终数据还是会以序列发送或者接收。
microsoft的函数很稳定,你可以大胆相信他们可以帮你做完你想做的事情,太多的超时处理只会是你陷入困境

2008年10月7日星期二

OHCI规定寄存器组和共享内存



从上图可以看出,左半边是OHCI中规定的寄存器组,这些寄存器中的一些是指针,指向共享内存。符合OHCI标准的USB Host Controller就是靠这两部分来维护下游设备的状态。

这里是一组真实的OHCI标准的USB Host Controller的寄存器,他们都指向共享内存,你可以看见他们的名字和OHCI标准一致。

2008年10月6日星期一

USB host初识

今天想了解一下USB host的驱动架构,嵌入式领域OHCI还是很常用的。
针对OHCI我今天才知道,它已经定义了内部寄存器组,包括每个bit的定义都有统一标准。
如果某个SOC说它支持OHCI,那么代码几乎不需要改,拿一个OHCI的代码就可以跑,只要提供寄存器组的首地址,那么其中每一个寄存器就确定了。另外就是中断号对应不一样。
不过虽然移植可能不难,但是搞清楚整个数据流程还是有必要的。

Linux on SAMSUNG s3c2443

我移植linux kernel 2.6.26.2到三星s3c2443处理器上,当我一直完,linux kernel已经更新到2.6.26.5了。不过其间的修改没有影响到s3c244x处理器系列。
总的来说,kernel2.6.26.2对s3c2443的支持非常的不好,它的许多代码只是移植了s3c2410的内核代码,因此在体系结构方面只是一个框架。根本不能用。
s3c2443的更好的官方支持要等2.6.28系列内核了,就目前kernel 2.6.27-rc一直在紧急的修补当中,不过我发现没有多少kernel修改者提交针对s3c2443的补丁,可能是市面上拿到s3c2443 CPU的人比较少?!
当然kernel 2.6.26.2经过修改已经可以启动,下面是我的boot log:

#Uncompressing Linux................................................................................................ done, booting the kernel.
Linux version 2.6.26.2 (cpuwolf@MyLin.localdomain) (gcc version 3.4.4) #36 Mon Sep 1 23:24:45 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SMDK2443
Warning: bad configuration page, trying to continue
Ignoring unrecognised tag 0x00000000
Memory policy: ECC disabled, Data cache writeback
CPU S3C2443 (id 0x32443001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C2443: mpll on 800.000 MHz, cpu 400.000 MHz, mem 133.333 MHz, pclk 66.666 MHz
Warning: USB host bus not at 48MHz
S3C2443: epll on 96.000 MHz, usb-bus 96.000 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttySAC2,115200n8 console=tty0
irq: clearing pending ext status 00007200
irq: clearing subpending status 000000c0
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00000009, tcnt d902, tcfg 0000020e,00000002, usec 0000170a
Console: colour dummy device 80x30
console [tty0] enabled
console [ttySAC2] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61708KB available (2744K code, 277K data, 116K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 192 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2443: Initialising architecture
S3C2443: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 88
DMA channel 1 at c4800100, irq 89
DMA channel 2 at c4800200, irq 90
DMA channel 3 at c4800300, irq 91
DMA channel 4 at c4800400, irq 92
DMA channel 5 at c4800500, irq 93
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 120
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
s3c2410-lcd s3c2410-lcd: cannot get irq 32 - err -22
s3c2410-lcd: probe of s3c2410-lcd failed with error -16
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
dm9000 Ethernet Driver, V1.30
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2412-nand s3c2410-nand: Tacls=3, 22ns Twrph0=7 52ns, Twrph1=3 22ns
s3c2412-nand s3c2410-nand: System booted from NAND
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3V 8-bit)
s3c2410_nand_update_chip: chip c3da52bc: 11
Scanning device for bad blocks
Bad eraseblock 0 at 0x00000000
Bad eraseblock 1 at 0x00040000
Bad eraseblock 2 at 0x00080000
Bad eraseblock 3 at 0x000c0000
Bad eraseblock 4 at 0x00100000
Bad eraseblock 5 at 0x00140000
Bad eraseblock 6 at 0x00180000
Bad eraseblock 7 at 0x001c0000
Bad eraseblock 8 at 0x00200000
Bad eraseblock 9 at 0x00240000
Bad eraseblock 10 at 0x00280000
Bad eraseblock 11 at 0x002c0000
Bad eraseblock 12 at 0x00300000
Bad eraseblock 13 at 0x00340000
Bad eraseblock 14 at 0x00380000

fedora kernel 2.6.26.3 update


My ASUS A8 notebook cannot boot up after I update kernel package of fedora linux. The system is halted as the above screen