File: IOWarrior.h

package info (click to toggle)
lcdproc 0.5.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,064 kB
  • sloc: ansic: 59,645; sh: 1,740; perl: 681; makefile: 417
file content (140 lines) | stat: -rw-r--r-- 4,680 bytes parent folder | download | duplicates (4)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* This is the LCDproc driver for IO-Warrior devices (http://www.codemercs.de)

     Copyright (C) 2004, Peter Marschall <peter@adpm.de>

   based on GPL'ed code:

   * IOWarrior LCD routines
       Copyright (c) 2004  Christian Vogelgsang <chris@lallafa.de>

   * misc. files from LCDproc source tree

   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
   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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 */


#ifndef IOWARRIOR_H
#define IOWARRIOR_H

#define DEFAULT_SERIALNO	""
#define DEFAULT_SIZE		"20x4"
#define DEFAULT_BACKLIGHT	1
#define DEFAULT_BRIGHTNESS	200

/* define some IOW constants */
#define iowVendor		0x07c0   /* CodeMercs */
#define iowProd40		0x1500   /* IOW40 */
#define iowProd24		0x1501   /* IOW24 */
#define iowProd56		0x1503   /* IOW56 */
#define iowProd24PVa		0x1511   /* IOW24 PowerVampire */
#define iowProd24PVb		0x1512   /* IOW24 PowerVampire */
#define iowTimeout		1000

#define USB_REQ_SET_REPORT	0x09
#define USB_REQ_GET_REPORT	0x01

#define IOW_OK			0
#define IOW_ERROR		-1

#define IOWLCD_BUSY		0x80
#define IOWLCD_ADDR_MASK	0x7F

/* IOW56 uses a different USB request size */
#define IOWLCD_SIZE		((p->productID == 0x1503) ? 64 : 8)

/* IOWarriors drive HD44780 cmpatible displays that have these cells: */
#define CELLWIDTH	LCD_DEFAULT_CELLWIDTH
#define CELLHEIGHT	LCD_DEFAULT_CELLHEIGHT


/* Constants for userdefchar_mode */
#define NUM_CCs		8 /* max. number of custom characters */


typedef struct cgram_cache {
  unsigned char cache[LCD_DEFAULT_CELLHEIGHT];
  int clean;
} CGram;


/** private data for the \c IOWarrior driver */
typedef struct IOWarrior_private_data {
  char manufacturer[LCD_MAX_WIDTH+1];
  char product[LCD_MAX_WIDTH+1];
  char serial[LCD_MAX_WIDTH+1];
  int productID;

  usb_dev_handle *udh;

  int width, height;
  int cellwidth, cellheight;

  /* The framebuffer */
  unsigned char *framebuf;

  /* last LCD contents (for incremental updates) */
  unsigned char *backingstore;

  /* definable characters */
  CGram cc[NUM_CCs];
  CGmode ccmode;

  /* output LED(s) state */
  unsigned int output_mask;
  int output_state;

  /* lastline controls the use of the last line, if pixel addressable (true, default) or */
  /* underline effect (false). To avoid the underline effect in the latter case, the last */
  /* line is always zeroed for whatever redefined character */
  char lastline;

  /* extended mode for some half-compatible modules */
  int ext_mode;

  int brightness;
  int backlight;

  char info[255];
} PrivateData;


/* API: variables for the server core */
MODULE_EXPORT char *api_version = API_VERSION;
MODULE_EXPORT int stay_in_foreground = 0; /* For testing only */
MODULE_EXPORT int supports_multiple = 1;
MODULE_EXPORT char *symbol_prefix = "IOWarrior_";

/* API: functions for the server core */
MODULE_EXPORT int  IOWarrior_init(Driver *drvthis);
MODULE_EXPORT void IOWarrior_close(Driver *drvthis);
MODULE_EXPORT int  IOWarrior_width(Driver *drvthis);
MODULE_EXPORT int  IOWarrior_height(Driver *drvthis);
MODULE_EXPORT int  IOWarrior_cellheight(Driver *drvthis);
MODULE_EXPORT int  IOWarrior_cellwidth(Driver *drvthis);
MODULE_EXPORT void IOWarrior_clear(Driver *drvthis);
MODULE_EXPORT void IOWarrior_chr(Driver *drvthis, int x, int y, char c);
MODULE_EXPORT void IOWarrior_string(Driver *drvthis, int x, int y, const char string[]);
MODULE_EXPORT void IOWarrior_flush(Driver *drvthis);
MODULE_EXPORT void IOWarrior_backlight(Driver *drvthis, int on);
MODULE_EXPORT void IOWarrior_vbar(Driver *drvthis, int x, int y, int len, int promille, int options);
MODULE_EXPORT void IOWarrior_hbar(Driver *drvthis, int x, int y, int len, int promille, int options);
MODULE_EXPORT void IOWarrior_num(Driver *drvthis, int x, int num);
MODULE_EXPORT int  IOWarrior_get_free_chars(Driver *drvthis);
MODULE_EXPORT void IOWarrior_set_char(Driver *drvthis, int n, unsigned char *dat);
MODULE_EXPORT int  IOWarrior_icon(Driver *drvthis, int x, int y, int icon);
MODULE_EXPORT void IOWarrior_output(Driver *drvthis, int state);
MODULE_EXPORT const char *IOWarrior_get_info(Driver *drvthis);

#endif	/* IOWARRIOR_H */