#include <linux/module.h>
#include <linux/init.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/cdev.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <linux/device.h>
#include <linux/semaphore.h>
#include <linux/kernel.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/unistd.h>
//#define Delay_50us(x) usleep(x*50)
#define Delay_1ms(x) msleep(x)
#define Delay_50us(x) usleep_range(50*x,50*x+20)
#define D0_GPIO_NO 32*8+7-8 //gpio2_a7
#define D1_GPIO_NO 32*8+1-8 //gpio2_b0
static struct workqueue_struct *queue = NULL;
static struct work_struct work;
static int even =0;
static int odd =0;
struct Wiegand26{
bool flag;
char data[24];
};
struct Wiegand34{
bool flag;
char data[32];
};
struct Wiegand26 wiegand26;
struct Wiegand34 wiegand34;
static int major;
static struct class *cls;
static struct device *dev;
static int wiegandOut_open(struct inode *inode, struct file *file){
return 0;
}
static ssize_t wiegandOut_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos){
return 0;
}
static struct file_operations wiegandOut_fops = {
.owner = THIS_MODULE,
.open = wiegandOut_open,
.write = wiegandOut_write,
};
int Wiegand26_IntToChar(int data)
{
int i = 0;
odd=0;
even=0;
for (i = 0; i < 24; i++)
{
if ((1 << i) & data)
{
wiegand26.data[23-i] = '1';
if(i<12)
odd++;
else
even++;
}
else
wiegand26.data[23-i] = '0';
}
printk("in str %s \n", wiegand26.data);
printk("check even=%d,odd=%d \n",even,odd);
return 0;
}
int Wiegand34_IntToChar(int data)
{