您现在的位置是:乐刷收付贝 > Mpos机
pos机装驱动,linux LED设备驱动开发源代码
乐刷收付贝2024-11-10 05:56:14【Mpos机】1人已围观
简介横县网上有很多关于pos机装驱动,linux LED设备驱动开发源代码的知识,也有很多人为大家解答关于pos机装驱动的问题,今天乐刷POS机官网(b06.cn)为大家整理了关于这方面的知识,
网上有很多关于pos机装驱动,linux LED设备驱动开发源代码的装驱知识,也有很多人为大家解答关于pos机装驱动的动l动开代码问题,今天乐刷官方代理商(www.zypos.cn)为大家整理了关于这方面的备驱知识,让我们一起来看下吧!
本文目录一览:
1、发源pos机装驱动
pos机装驱动
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/types.h>
//使用宋宝华推荐的装驱普通字符设备框架
#include <linux/fcntl.h>
#include <linux/cdev.h>
#include <linux/version.h>
#include <linux/vmalloc.h>
#include <linux/ctype.h>
#include <linux/pagemap.h>
#include <linux/device.h>
#include <asm/io.h>
//#include <asm/arch/regs-gpio.h> //2.6.12
#include <mach/regs-gpio.h> // 2.6.32
//LED1
#define LED1_OUT __raw_writel(( __raw_readl(S3C2410_GPBCON) & (~(3<<10)))|(1<<10),S3C2410_GPBCON) //
#define LED1_H __raw_writel(__raw_readl(S3C2410_GPBDAT)|(1<<5),S3C2410_GPBDAT)
#define LED1_L __raw_writel(__raw_readl(S3C2410_GPBDAT)&(~(1<<5)),S3C2410_GPBDAT)
//LED2
#define LED2_OUT __raw_writel(( __raw_readl(S3C2410_GPBCON) & (~(3<<12)))|(1<<12),S3C2410_GPBCON) //
#define LED2_H __raw_writel(__raw_readl(S3C2410_GPBDAT)|(1<<6),S3C2410_GPBDAT)
#define LED2_L __raw_writel(__raw_readl(S3C2410_GPBDAT)&(~(1<<6)),S3C2410_GPBDAT)
//LED3
#define LED3_OUT __raw_writel(( __raw_readl(S3C2410_GPBCON) & (~(3<<14)))|(1<<14),S3C2410_GPBCON) //
#define LED3_H __raw_writel(__raw_readl(S3C2410_GPBDAT)|(1<<7),S3C2410_GPBDAT)
#define LED3_L __raw_writel(__raw_readl(S3C2410_GPBDAT)&(~(1<<7)),S3C2410_GPBDAT)
//LED4
#define LED4_OUT __raw_writel(( __raw_readl(S3C2410_GPBCON) & (~(3<<16)))|(1<<16),S3C2410_GPBCON) //
#define LED4_H __raw_writel(__raw_readl(S3C2410_GPBDAT)|(1<<8),S3C2410_GPBDAT)
#define LED4_L __raw_writel(__raw_readl(S3C2410_GPBDAT)&(~(1<<8)),S3C2410_GPBDAT)
#define LEDOFF 0
#define LEDON 1
//#define DEMO_MAJOR 235 //静态分配
#define DEMO_MAJOR 0 //动态分配
#define DEMO_MINOR 0
int devmajor = DEMO_MAJOR;
int devminor = DEMO_MINOR;
dev_t dev = 0;
//设备结构
//设备结构
struct DEMO_dev
{
struct cdev cdev; /* Char device structure*/
};
struct DEMO_dev *DEMO_devices;
struct class *led_class;
int DEMO_open(struct inode *inode, struct file *filp)
{
struct DEMO_dev *demo_dev;
unsigned int temp;
filp->private_data=DEMO_devices;
//5
//LED1_OUT;
temp=__raw_readl(S3C2410_GPBCON); //__raw_readl函数在#include <asm/io.h> 定义
temp &= (~(3<<10))|(1<<10);
__raw_writel(temp,S3C2410_GPBCON);
//printk("S3C2410_GPBCON=%x,S3C2410_GPBDAT=%x",S3C2410_GPBCON,S3C2410_GPBDAT);
//S3C2410_GPBCON=fb000010,S3C2410_GPBDAT=fb000014
//6
//LED2_OUT;
temp=__raw_readl(S3C2410_GPBCON);
temp &= (~(3<<12))|(1<<12);
__raw_writel(temp,S3C2410_GPBCON);
//7
// LED3_OUT;
temp=__raw_readl(S3C2410_GPBCON);
temp &= (~(3<<14))|(1<<14);
__raw_writel(temp,S3C2410_GPBCON);
//8
//LED4_OUT;
temp=__raw_readl(S3C2410_GPBCON);
temp &= (~(3<<16))|(1<<16);
__raw_writel(temp,S3C2410_GPBCON);
return 0;
}
int DEMO_release(struct inode *inode, struct file *filp)
{
return 0;
}
int DEMO_ioctl(struct inode *inode, struct file *filp,unsigned int cmd, unsigned long arg)
{
unsigned int temp;
//printk("
很赞哦!(4)
上一篇: 牙签搅水缸是什么梗
下一篇: 乐刷pos机怎么样?