OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [char/] [lcdtxt.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/*****************************************************************************/
2
 
3
/*
4
 *      lcdtxt.c -- driver for a text based LCD display
5
 *
6
 *      (C) Copyright 2000, greg Ungerer (gerg@moreton.com.au)
7
 */
8
 
9
/*****************************************************************************/
10
 
11
#include <linux/config.h>
12
#include <linux/types.h>
13
#include <linux/kernel.h>
14
#include <linux/fs.h>
15
#include <linux/mm.h>
16
#include <linux/delay.h>
17
#include <asm/param.h>
18
#include <asm/coldfire.h>
19
#include <asm/mcfsim.h>
20
 
21
/*****************************************************************************/
22
 
23
/*
24
 *      Define driver major number.
25
 */
26
#define LCDTXT_MAJOR    120
27
 
28
/*
29
 *      Define LCD hardware address.
30
 */
31
#define LCDTXT_ADDR     0x30800000
32
 
33
/*****************************************************************************/
34
 
35
int lcdtxt_open(struct inode *inode, struct file *filp)
36
{
37
#if 0
38
        printk("lcdtxt_open()\n");
39
#endif
40
 
41
        return(0);
42
}
43
 
44
/*****************************************************************************/
45
 
46
void lcdtxt_release(struct inode *inode, struct file *filp)
47
{
48
#if 0
49
        printk("lcdtxt_close()\n");
50
#endif
51
}
52
 
53
/*****************************************************************************/
54
 
55
int lcdtxt_write(struct inode *inode, struct file *filp, const char *buf, int count)
56
{
57
        volatile char   *lcdp;
58
        char            *dp;
59
        int             num;
60
 
61
#if 0
62
        printk("lcdtxt_write(buf=%x,count=%d)\n", (int) buf, count);
63
#endif
64
 
65
        dp = (char *) buf;
66
        lcdp = (volatile char *) LCDTXT_ADDR;
67
 
68
        for (num = count; (num >= 0); num--) {
69
                *lcdp = get_user(dp++);
70
                udelay(1);
71
        }
72
 
73
        return(count);
74
}
75
 
76
/*****************************************************************************/
77
 
78
int lcdtxt_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
79
{
80
        int     rc = 0;
81
 
82
#if 0
83
        switch (cmd) {
84
        default:
85
                rc = -EINVAL;
86
                break;
87
        }
88
#endif
89
 
90
        return(rc);
91
}
92
 
93
/*****************************************************************************/
94
 
95
/*
96
 *      Exported file operations structure for driver...
97
 */
98
 
99
struct file_operations  lcdtxt_fops = {
100
        NULL,           /* lseek */
101
        NULL,           /* read */
102
        lcdtxt_write,   /* write */
103
        NULL,           /* readdir */
104
        NULL,           /* poll */
105
        lcdtxt_ioctl,   /* ioctl */
106
        NULL,           /* mmap */
107
        lcdtxt_open,    /* open */
108
        lcdtxt_release, /* release */
109
        NULL,           /* fsync */
110
        NULL,           /* fasync */
111
        NULL,           /* check_media_change */
112
        NULL            /* revalidate */
113
};
114
 
115
/*****************************************************************************/
116
 
117
void lcdtxt_init(void)
118
{
119
        int     rc;
120
 
121
        /* Register lcdtxt as character device */
122
        rc = register_chrdev(LCDTXT_MAJOR, "lcdtxt", &lcdtxt_fops);
123
        if (rc < 0) {
124
                printk(KERN_WARNING "LCDTXT: can't get major %d\n",
125
                        LCDTXT_MAJOR);
126
                return;
127
        }
128
 
129
        printk("LCDTXT: Copyright (C) 2000, Greg Ungerer "
130
                "(gerg@moreton.com.au)\n");
131
 
132
#if 0
133
        /* Setup CS4 for our external hardware */
134
#ifdef CONFIG_OLDMASK
135
        *((volatile unsigned short *) (MCF_MBAR + MCFSIM_CSMR4)) = 0x0001;
136
        *((volatile unsigned short *) (MCF_MBAR + MCFSIM_CSCR4)) = 0x3d40;
137
#else
138
        *((volatile unsigned short *) (MCF_MBAR + MCFSIM_CSAR4)) = 0x30c0;
139
        *((volatile unsigned long *) (MCF_MBAR + MCFSIM_CSMR4)) = 0x000f0001;
140
        *((volatile unsigned short *) (MCF_MBAR + MCFSIM_CSCR4)) = 0x3d40;
141
#endif
142
#endif
143
}
144
 
145
/*****************************************************************************/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.