linux下W83977驱动的一些问题

wdw1600 wdw1600 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
这个是网上一个大侠写的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);
}
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
wdw1600
Linux_Kernel 4,469 成员 17,458 内容