linux下W83977驱动的一些问题

wdw1600 2009-04-11 09:55:56
这个是网上一个大侠写的W83977驱动程序。我不明白其中一些为什么那样也,看手册头都看晕了都没办法。
//KBD port--------------------------------------------
w977_select_device(W977_DEVICE_KBC, efbase[1]); //select logic device
w977_write_reg(0x60, 0x0, efbase[1]); //address
w977_write_reg(0x61, 0x60, efbase[1]); //address--0x060
w977_write_reg(0x62, 0x0, efbase[1]); //address
w977_write_reg(0x63, 0x64, efbase[1]); //address--0x064

//set irq number
w977_write_reg(0x70, 0x05, efbase[1]); //irq for keyboard irq5--active H
w977_write_reg(0x72, 0x04, efbase[1]); //irq for mouse irq4--active H

//12MHZ, disable port 92
w977_write_reg(0xf0, 0x80, efbase[1]);
/* Activate device */
w977_write_reg(0x30, 0x01, efbase[1]);


下面是上面要用到的子函数
static unsigned int efbase[] = { W977_EFIO_BASE+nGCS7, W977_EFIO2_BASE+nGCS7 };
static unsigned int efio = W977_EFIO_BASE;

#define readb(x) (*(volatile unsigned char *)x)
#define writeb(val, x) (*(volatile unsigned char *)x)=val
#define readw(x) (*(volatile unsigned short *)x)
#define writew(val, x) (*(volatile unsigned short *)x)=val

static void w977_write_reg(unsigned char reg, unsigned char value, unsigned int efio)
{
unsigned int addr;

writeb(reg, efio);
addr=efio+1;
writeb(value, addr);
}
...全文
45 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
morris88 2009-04-11
  • 打赏
  • 举报
回复
这些都是与硬件相关的,操作硬件寄存器。对照硬件资料,就比较清楚了。没有什么特殊的地方。
百年树人 2009-04-11
  • 打赏
  • 举报
回复
帮顶

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧