aboutsummaryrefslogtreecommitdiffstats
path: root/drv_LCDLinux.h
blob: 1a364540e820e2b2e151af14fa6c30de118cb648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* lcd.h
 *
 * $Id: drv_LCDLinux.h,v 1.5 2005/06/15 05:24:35 reinelt Exp $
 *
 * LCD driver for HD44780 compatible displays connected to the parallel port.
 * 
 * External interface header file.
 * 
 * Copyright (C) 2004, 2005  Mattia Jona-Lasinio (mjona@users.sourceforge.net)
 *
 *  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, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef LCD_LINUX_H
#define LCD_LINUX_H

#ifndef HD44780_MAIN
#warning
#warning LCD-Linux is still in development stage and
#warning aims at speed and optimization. For these
#warning reasons there is no guarantee of backward
#warning compatibility between different LCD-Linux
#warning versions. Be sure to use the lcd-linux.h
#warning file of the same version as the module.
#warning
#endif

#define LCD_LINUX_VERSION	"0.8.9-CVS"	/* Version number */

#define LCD_MAJOR		120	/* Major number for this device
					 * Set this to 0 for dynamic allocation
					 */

#include <linux/types.h>

struct lcd_driver {
	/* Hardware */
	unsigned short io;		/* Parport base address */
	unsigned short flags;		/* Flags (see Documentation) */

	/* Display geometry */
	unsigned short num_cntr;	/* Number of available controllers */
	unsigned short cntr_rows;	/* Rows per controller */
	unsigned short disp_cols;	/* Columns */
	unsigned short frames;		/* Framebuffer frames */

	unsigned short tabstop;		/* Length of tab character */
};

/* IOCTLs */
#include <asm/ioctl.h>
#define IOCTL_SET_PARAM		_IOW(LCD_MAJOR, 0, struct lcd_driver *)
#define IOCTL_GET_PARAM		_IOR(LCD_MAJOR, 1, struct lcd_driver *)
#define IOCTL_RAW_CMD		_IOW(LCD_MAJOR, 2, unsigned char *)
#define IOCTL_RESET_CHARMAP	_IOW(LCD_MAJOR, 3, void *)
#define IOCTL_SAVE_CHARMAP	_IOW(LCD_MAJOR, 4, void *)
#define IOCTL_RESTORE_CHARMAP	_IOW(LCD_MAJOR, 5, void *)
#define IOCTL_SWAP_CHARMAP	_IOW(LCD_MAJOR, 6, void *)

#define LCD_CHECK_BF	0x0001		/* Do busy flag checking */
#define LCD_CONSOLE	0x0002		/* Enable the console support */
#define LCD_4BITS_BUS	0x0004		/* Set the bus length to 4 bits */
#define LCD_5X10_FONT	0x0008		/* Use 5x10 dots fonts */



#ifdef __KERNEL__ /* The rest is for kernel only */

#include <linux/version.h>

#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#endif

#ifndef LINUX_VERSION_CODE
#error - LINUX_VERSION_CODE undefined.
#endif

/* External interface */
int lcd_init(struct lcd_driver *);
void lcd_exit(void);
int lcd_ioctl(unsigned int, void *);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
ssize_t lcd_write(const char *, size_t, unsigned int);
ssize_t lcd_read(char *, size_t, unsigned int);
#else
int lcd_write(const char *, int, unsigned int);
int lcd_read(char *, int, unsigned int);
#endif

#endif /* __KERNEL__ */

#endif /* External interface included */