linux下W83977驱动的一些问题
这个是网上一个大侠写的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);
}
//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);
}
...全文
相关推荐
linux UART串口驱动开发文档
在硬件层面,驱动需要处理串口的硬件资源,例如配置寄存器。例如,W83697和W83977在ep93xx板子上分别映射到0x20000000起始的1K空间和0x30000000起始的1K空间。
linux串口驱动讲解
例如,在EP93xx平台上的w83697/w83977 Super I/O芯片,它们的地址映射情况如下:- **w83697**:物理地址0x20000000起始,映射1K空间。
linux串口驱动和中断共享
#define IO_W83697_UART_SIZE 0x1000#define IO_W83977_UART_BASE 0x30000000```#### 二、Linux的中断机制及中断共享机制Linux
linux_uart_driver 串口驱动
例如,W83697和W83977的串口映射基址分别为`IO_W83697_UART_BASE`和`IO_W83977_UART_BASE`。
linux UART 串口驱动开发文档
##### 1.1 串口硬件资源的处理以W83697及W83977为例,这两种芯片在EP93xx板上分别占用0x20000000起始的1K空间和0x30000000起始的1K空间。


