ppilcd.c (6c7c20ce2892400a2ea8af9e89339c072e9a8cea) | ppilcd.c (b1303e6e75b3942b3c95d49d31be243d7a457d84) |
---|---|
1/* 2 * Control LCD module hung off parallel port using the 3 * ppi 'geek port' interface. 4 * | 1/* 2 * Control LCD module hung off parallel port using the 3 * ppi 'geek port' interface. 4 * |
5 * $FreeBSD$ | 5 * $Id$ |
6 */ 7 8#include <stdio.h> 9#include <stdlib.h> 10#include <string.h> 11#include <ctype.h> 12#include <fcntl.h> 13#include <unistd.h> 14#include <err.h> 15#include <sysexits.h> 16 | 6 */ 7 8#include <stdio.h> 9#include <stdlib.h> 10#include <string.h> 11#include <ctype.h> 12#include <fcntl.h> 13#include <unistd.h> 14#include <err.h> 15#include <sysexits.h> 16 |
17#include <dev/ppbus/ppbconf.h> 18#include <dev/ppbus/ppi.h> | 17/* XXX should be in <machine/> */ 18#include "ppbconf.h" 19#include "ppi.h" |
19 20#define debug(lev, fmt, args...) if (debuglevel >= lev) fprintf(stderr, fmt "\n" , ## args); 21 22static void usage(void); 23static char *progname; 24 25#define DEFAULT_DEVICE "/dev/ppi0" 26 --- 56 unchanged lines hidden (view full) --- 83 } 84}; 85 86static void do_char(struct lcd_driver *driver, char ch); 87 88int debuglevel = 0; 89int vflag = 0; 90 | 20 21#define debug(lev, fmt, args...) if (debuglevel >= lev) fprintf(stderr, fmt "\n" , ## args); 22 23static void usage(void); 24static char *progname; 25 26#define DEFAULT_DEVICE "/dev/ppi0" 27 --- 56 unchanged lines hidden (view full) --- 84 } 85}; 86 87static void do_char(struct lcd_driver *driver, char ch); 88 89int debuglevel = 0; 90int vflag = 0; 91 |
91int | 92void |
92main(int argc, char *argv[]) 93{ 94 extern char *optarg; 95 extern int optind; 96 struct lcd_driver *driver = &lcd_drivertab[0]; 97 char *drivertype, *cp; 98 char *devname = DEFAULT_DEVICE; 99 char *drvopts = NULL; 100 int ch, i; 101 102 if ((progname = strrchr(argv[0], '/'))) { 103 progname++; 104 } else { 105 progname = argv[0]; 106 } 107 108 drivertype = getenv("LCD_TYPE"); 109 | 93main(int argc, char *argv[]) 94{ 95 extern char *optarg; 96 extern int optind; 97 struct lcd_driver *driver = &lcd_drivertab[0]; 98 char *drivertype, *cp; 99 char *devname = DEFAULT_DEVICE; 100 char *drvopts = NULL; 101 int ch, i; 102 103 if ((progname = strrchr(argv[0], '/'))) { 104 progname++; 105 } else { 106 progname = argv[0]; 107 } 108 109 drivertype = getenv("LCD_TYPE"); 110 |
110 while ((ch = getopt(argc, argv, "Dd:f:o:v")) != -1) { | 111 while ((ch = getopt(argc, argv, "Dd:f:o:v")) != EOF) { |
111 switch(ch) { 112 case 'D': 113 debuglevel++; 114 break; 115 case 'd': 116 drivertype = optarg; 117 break; 118 case 'f': --- 124 unchanged lines hidden (view full) --- 243 * to be found on one- and two-line alphanumeric LCDs. 244 * 245 * This driver assumes the following connections : 246 * 247 * Parallel Port LCD Module 248 * -------------------------------- 249 * Strobe (1) Enable (6) 250 * Data (2-9) Data (7-14) | 112 switch(ch) { 113 case 'D': 114 debuglevel++; 115 break; 116 case 'd': 117 drivertype = optarg; 118 break; 119 case 'f': --- 124 unchanged lines hidden (view full) --- 244 * to be found on one- and two-line alphanumeric LCDs. 245 * 246 * This driver assumes the following connections : 247 * 248 * Parallel Port LCD Module 249 * -------------------------------- 250 * Strobe (1) Enable (6) 251 * Data (2-9) Data (7-14) |
251 * Select In (17) RS (4) | 252 * Select(13) RS (4) |
252 * Auto Feed (14) R/W (5) 253 * 254 * In addition, power must be supplied to the module, normally with 255 * a circuit similar to this: 256 * 257 * VCC (+5V) O------o-------o--------O Module pin 2 258 * | | + 259 * / --- --- 179 unchanged lines hidden --- | 253 * Auto Feed (14) R/W (5) 254 * 255 * In addition, power must be supplied to the module, normally with 256 * a circuit similar to this: 257 * 258 * VCC (+5V) O------o-------o--------O Module pin 2 259 * | | + 260 * / --- --- 179 unchanged lines hidden --- |