- 論壇徽章:
- 0
|
BOARD:S3C2410_V4 KERNEL:KERNEL-2.6.8.1
LED寄存器讀寫的問題
pREG = ioremap(0x56000010, 0x20); //GPBCON 地址56000010
printk("Virtual addr base = 0x%lx\n", (unsigned long)pREG);
tmp = * (volatile unsigned long *)pREG;
printk("GPBCON = 0x%lx\n", tmp);
tmp = * (volatile unsigned long *)(pREG + 1);
printk("GPBDAT = 0x%lx\n", tmp);
printk("Seting LED Test Driver...\n");
//GPB0是GPBCON的最底兩位,led接GPB0 00:IN 01:OUT
* (volatile unsigned long *)pREG = 0x155555;//0101010101010101010101 GPBCON共22位
* (volatile unsigned long *)(pREG + 1) = 0xfff;
tmp = * (volatile unsigned long *)pREG;
printk("GPBCON = 0x%lx\n", tmp);
tmp = * (volatile unsigned long *)(pREG + 1);
printk("GPBDAT = 0x%lx\n", tmp);
printk("LED Test Driver initiated.\n");
此模塊insmod時就將 LED熄滅了, 可我把底2位值改為,00時也沒見它再亮啊.
問題:pREG = 0x155555 它的寄存器位設(shè)置就是轉(zhuǎn)化2進(jìn)制對位的設(shè)置 10101010101010101吧?
問題:GPBCON 有沒有大小端的說法? 我要把它的狀態(tài)改變是否把最底2位變?yōu)?0 就可以把燈再點(diǎn)亮呢?
基礎(chǔ)差.含涵~
[ 本帖最后由 jn200002 于 2008-6-20 14:59 編輯 ] |
|