首页 > 系统相关 >PS2功能 sa1111 linux驱动程序

PS2功能 sa1111 linux驱动程序

时间:2024-12-23 13:02:03浏览次数:5  
标签:status 驱动程序 int sa1111 unsigned PS2STAT PS2 include define

/*

  • linux/drivers/input/serio/sa1111ps2.c
  • Copyright © 2002 Russell King
  • This program is free software; you can redistribute it and/or modify
  • it under the terms of the GNU General Public License as published by
  • the Free Software Foundation; either version 2 of the License.
    */
    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/input.h>
    #include <linux/serio.h>
    #include <linux/errno.h>
    #include <linux/interrupt.h>
    #include <linux/ioport.h>
    #include <linux/delay.h>
    #include <linux/device.h>
    #include <linux/slab.h>
    #include <linux/spinlock.h>

#include <asm/io.h>

#include <asm/hardware/sa1111.h>

#define PS2CR 0x0000
#define PS2STAT 0x0004
#define PS2DATA 0x0008
#define PS2CLKDIV 0x000c
#define PS2PRECNT 0x0010

#define PS2CR_ENA 0x08
#define PS2CR_FKD 0x02
#define PS2CR_FKC 0x01

#define PS2STAT_STP 0x0100
#define PS2STAT_TXE 0x0080
#define PS2STAT_TXB 0x0040
#define PS2STAT_RXF 0x0020
#define PS2STAT_RXB 0x0010
#define PS2STAT_ENA 0x0008
#define PS2STAT_RXP 0x0004
#define PS2STAT_KBD 0x0002
#define PS2STAT_KBC 0x0001

struct ps2if {
struct serio *io;
struct sa1111_dev *dev;
void __iomem *base;
int rx_irq;
int tx_irq;
unsigned int open;
spinlock_t lock;
unsigned int head;
unsigned int tail;
unsigned char buf[4];
};

/*

  • Read all bytes waiting in the PS2 port. There should be

  • at the most one, but we loop for safety. If there was a

  • framing error, we have to manually clear the status.
    */
    static irqreturn_t ps2_rxint(int irq, void *dev_id)
    {
    struct ps2if *ps2if = dev_id;
    unsigned int scancode, flag, status;

    status = readl_relaxed(ps2if->base + PS2STAT);
    while (status & PS2STAT_RXF) {
    if (status & PS2STAT_STP)
    writel_relaxed(PS2S

标签:status,驱动程序,int,sa1111,unsigned,PS2STAT,PS2,include,define
From: https://blog.csdn.net/baidu_37552881/article/details/144498851

相关文章

  • tps25751初识
    TPS25751I2C接口1.1TPS25751有1个I2C目标接口:I2Ct。I2C端口I2Ct由I2Ct_SDA、I2Ct_SCL和I2Ct_IRQ引脚组成。当TPS25751处于“APP”模式时,TI建议使用标准模式或快速模式(即时钟速度不高于400kHz)。但是,在BOOT模式下,当加载补丁包时,可以使用FastmodePlus(参见fSCLS)。TPS2575......
  • 鼠标 芯片pc110 linux驱动程序
    /*Copyright©2000-2001VojtechPavlikBasedontheworkof:AlanCoxRobinO’Leary*//*IBMPC110touchpaddriverforLinux*//*Thisprogramisfreesoftware;youcanredistributeitand/ormodifyitunderthetermsoftheGNUGeneralPubli......
  • 鼠标 芯片pxa930 linux驱动程序
    /*PXA930trackballmousedriverCopyright©2007MarvellInternationalLtd.initialversionThisprogramisfreesoftware;youcanredistributeitand/ormodifyitunderthetermsoftheGNUGeneralPublicLicenseversion2aspublishe......
  • MSKSSRV.SYS 是一个系统文件,通常与 Microsoft Kernel-Streaming 服务相关。它是 Windo
    MSKSSRV.SYS是一个系统文件,通常与MicrosoftKernel-Streaming服务相关。它是Windows操作系统中的一个驱动程序文件,主要用于处理音频、视频流媒体的传输与处理,尤其是涉及到多媒体设备时的音频和视频流控制。详细解释:文件名称: MSKSSRV.SYS文件类型: 驱动程序文件位置: 通......
  • 【亲测能用】Photoshop 2025 v26.1.0正式版(ps2025下载)最新免费激活版
    软件简介说到AdobePhotoshop,我们可以有把握地说它是当今排名第一的图形软件。世界各地数以百万计的设计师、摄影师和艺术家使用Photoshop将不可能变成可能。从海报到包装,从基本的横幅到精美的网站,从令人难忘的徽标到引人注目的图标,Photoshop不断推动创意世界的发展。直观的......
  • 蜂鸣器 m68kspkr linux 驱动程序
    /*m68kbeeperdriverforLinuxCopyright©2002RichardZidlickyCopyright©2002VojtechPavlikCopyright©1992OrestZborowski*//*Thisprogramisfreesoftware;youcanredistributeitand/ormodifyitunderthetermsoftheGNUGeneralP......
  • 鼠标 芯片bcm5974 linux驱动程序
    /*AppleUSBBCM5974(MacbookAirandPenrynMacbookPro)multitouchdriverThisprogramisfreesoftware;youcanredistributeitand/ormodifyitunderthetermsoftheGNUGeneralPublicLicenseaspublishedbytheFreeSoftwareFoundation;......
  • IO应用程序接口&设备驱动程序接口
    IO应用程序接口&设备驱动程序接口‍​​‍一、输入/输出应用程序接口背景:在设备独立软件层向上提供各种各样的输入/输出应用程序接口的原因是:用户层的应用程序无法用一个统一的系统调用接囗来完成所有类型设备的I/O​​‍三种输入/输出应用程序接口:字符设备接口块设......
  • 芯片sc2731 linux 驱动程序
    //SPDX-License-Identifier:GPL-2.0/*Copyright©2018SpreadtrumCommunicationsInc.*/#include<linux/module.h>#include<linux/of_address.h>#include<linux/platform_device.h>#include<linux/regmap.h>#include<linux/inp......
  • 电源管理 芯片axp20x linux 驱动程序
    /*axp20xpowerbuttondriver.ThisfileissubjecttothetermsandconditionsoftheGNUGeneralPublicLicense.Seethefile“COPYING”inthemaindirectoryofthisarchiveformoredetails.Thisprogramisdistributedinthehopethatitwill......