Hi,
I am also looking at getting the LCD running, but i have absolute no idea.
Which ptf do you use ? I use the std_2c35.ptf, is that enough ? Or do i have to use the full featured one ?
Can you also elaborate how what state the code is in ? Is it working ?
I need some help and guide here.
--- Quote Start ---
originally posted by snail1@Aug 8 2006, 09:06 PM
#include <linux/module.h># include <linux/errno.h># include <linux/cdev.h># include <linux/config.h># include <linux/types.h># include <linux/errno.h># include <linux/miscdevice.h># include <linux/slab.h># include <linux/ioport.h># include <linux/fcntl.h># include <linux/mc146818rtc.h># include <linux/netdevice.h># include <linux/sched.h># include <linux/delay.h>
# include <asm/io.h># include <asm/uaccess.h># include <asm/system.h># include <linux/delay.h>
# define lcd_on 1# define lcd_off 2# define lcd_clear 3# define lcd_reset 4# define lcd_cursor_left 5# define lcd_cursor_right 6# define lcd_disp_left 7# define lcd_disp_right 8# define lcd_get_cursor 9# define lcd_set_cursor 10# define lcd_home 11# define lcd_read 12# define lcd_write 13# define lcd_cursor_off 14# define lcd_cursor_on 15# define lcd_get_cursor_pos 16# define lcd_set_cursor_pos 17# define lcd_blink_off 18
# define klcd_ir na_lcd_16207_0# define klcd_dr (na_lcd_16207_0 + 8)
# define lcdwritedata(x) outl(x , klcd_dr)# define lcdwriteinst(x) outl(x , klcd_ir)
# define lcdreaddata inl(klcd_dr)# define lcdreadinst inl(klcd_ir)
# define major 250
static int device_open = 0;
static int lcd_16207_ioctl(struct inode *inode,struct file *filp,
unsigned int cmd,unsigned long arg);
static int lcd_16207_open(struct inode *inode,struct file *filp)
{
static int counter = 0;
if(device_open)return -ebusy;
device_open++;
printk("you have open the device %d times\n",counter++);
return 0;
}
static int lcd_16207_release(struct inode *inode,struct file *filp)
{
device_open--;
printk("you have release the device\n");
return 0;
}
static int lcd_16207_ioctl(struct inode *inode,struct file *filp,
unsigned int cmd,unsigned long arg)
{
volatile unsigned long display;
switch (cmd) {
case lcd_on:
if (copy_from_user
(&display, (unsigned long *) arg,
sizeof(display)))
return -efault;
lcdwriteinst(display);
break;
case lcd_off:
if (copy_from_user
(&display, (unsigned long *) arg,
sizeof(display)))
return -efault;
lcdwritedata(display);
break;
default:
return -einval;
}
return 0;
}
static struct file_operations lcd_16207_fops={
.ioctl = lcd_16207_ioctl,
.open = lcd_16207_open,
.release = lcd_16207_release,
};
static int lcd_16207_init(void)
{
int ret = register_chrdev(major,"lcd_pio",&lcd_16207_fops);
if(ret<0)
{
printk("registering the device failed with %d\n",major);
return major;
}
printk("you have init device %d\n",major);
return 0;
}
static void lcd_16207_exit(void)
{
if(unregister_chrdev(major,"lcd_pio"))
printk("exit failed");
}
module_init(lcd_16207_init);
module_exit(lcd_16207_exit);
module_author("andrew bose");
module_license("gpl");
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17462)
--- quote end ---
--- Quote End ---