| 1 | /* $Id: drv_generic_parport.h,v 1.11 2005/05/08 04:32:44 reinelt Exp $ |
|---|
| 2 | * |
|---|
| 3 | * generic driver helper for parallel port displays |
|---|
| 4 | * |
|---|
| 5 | * Copyright (C) 1999, 2000 Michael Reinelt <reinelt@eunet.at> |
|---|
| 6 | * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> |
|---|
| 7 | * |
|---|
| 8 | * This file is part of LCD4Linux. |
|---|
| 9 | * |
|---|
| 10 | * LCD4Linux is free software; you can redistribute it and/or modify |
|---|
| 11 | * it under the terms of the GNU General Public License as published by |
|---|
| 12 | * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 13 | * any later version. |
|---|
| 14 | * |
|---|
| 15 | * LCD4Linux is distributed in the hope that it will be useful, |
|---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 18 | * GNU General Public License for more details. |
|---|
| 19 | * |
|---|
| 20 | * You should have received a copy of the GNU General Public License |
|---|
| 21 | * along with this program; if not, write to the Free Software |
|---|
| 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 23 | * |
|---|
| 24 | * |
|---|
| 25 | * $Log: drv_generic_parport.h,v $ |
|---|
| 26 | * Revision 1.11 2005/05/08 04:32:44 reinelt |
|---|
| 27 | * CodingStyle added and applied |
|---|
| 28 | * |
|---|
| 29 | * Revision 1.10 2005/05/04 06:13:05 reinelt |
|---|
| 30 | * parport_wire_status() added |
|---|
| 31 | * |
|---|
| 32 | * Revision 1.9 2005/01/18 06:30:23 reinelt |
|---|
| 33 | * added (C) to all copyright statements |
|---|
| 34 | * |
|---|
| 35 | * Revision 1.8 2004/10/17 09:24:31 reinelt |
|---|
| 36 | * I2C support for HD44780 displays by Luis (does not work by now) |
|---|
| 37 | * |
|---|
| 38 | * Revision 1.7 2004/09/18 15:58:57 reinelt |
|---|
| 39 | * even more HD44780 cleanups, hardwiring for LCM-162 |
|---|
| 40 | * |
|---|
| 41 | * Revision 1.6 2004/09/18 08:22:59 reinelt |
|---|
| 42 | * drv_generic_parport_status() to read status lines |
|---|
| 43 | * |
|---|
| 44 | * Revision 1.5 2004/06/26 12:04:59 reinelt |
|---|
| 45 | * |
|---|
| 46 | * uh-oh... the last CVS log message messed up things a lot... |
|---|
| 47 | * |
|---|
| 48 | * Revision 1.4 2004/06/26 09:27:21 reinelt |
|---|
| 49 | * |
|---|
| 50 | * added '-W' to CFLAGS |
|---|
| 51 | * changed all C++ comments to C ones |
|---|
| 52 | * cleaned up a lot of signed/unsigned mistakes |
|---|
| 53 | * |
|---|
| 54 | * Revision 1.3 2004/06/20 10:09:55 reinelt |
|---|
| 55 | * |
|---|
| 56 | * 'const'ified the whole source |
|---|
| 57 | * |
|---|
| 58 | * Revision 1.2 2004/01/20 15:32:49 reinelt |
|---|
| 59 | * first version of Next Generation HD44780 (untested! but it compiles...) |
|---|
| 60 | * some cleanup in the other drivers |
|---|
| 61 | * |
|---|
| 62 | * Revision 1.1 2004/01/20 14:35:38 reinelt |
|---|
| 63 | * drv_generic_parport added, code from parport.c |
|---|
| 64 | * |
|---|
| 65 | */ |
|---|
| 66 | |
|---|
| 67 | /* |
|---|
| 68 | * |
|---|
| 69 | * exported fuctions: |
|---|
| 70 | * |
|---|
| 71 | * int drv_generic_parport_open (void) |
|---|
| 72 | * reads 'Port' entry from config and opens |
|---|
| 73 | * the parallel port |
|---|
| 74 | * returns 0 if ok, -1 on failure |
|---|
| 75 | * |
|---|
| 76 | * int drv_generic_parport_close (void) |
|---|
| 77 | * closes parallel port |
|---|
| 78 | * returns 0 if ok, -1 on failure |
|---|
| 79 | * |
|---|
| 80 | * unsigned char drv_generic_parport_wire_ctrl (char *name, char *deflt) |
|---|
| 81 | * reads wiring for one control signal from config |
|---|
| 82 | * returns DRV_GENERIC_PARPORT_CONTROL_* or 255 on error |
|---|
| 83 | * |
|---|
| 84 | * unsigned char drv_generic_parport_hardwire_ctrl (char *name) |
|---|
| 85 | * returns hardwiring for one control signal |
|---|
| 86 | * same as above, but does not read from config, |
|---|
| 87 | * but checks the config and emits a warning that the config |
|---|
| 88 | * entry will be ignored |
|---|
| 89 | * returns DRV_GENERIC_PARPORT_CONTROL_* or 255 on error |
|---|
| 90 | * |
|---|
| 91 | * unsigned char drv_generic_parport_wire_status (char *name, char *deflt) |
|---|
| 92 | * reads wiring for one status signal from config |
|---|
| 93 | * returns DRV_GENERIC_PARPORT_STATUS_* or 255 on error |
|---|
| 94 | * |
|---|
| 95 | * unsigned char drv_generic_parport_wire_data (char *name, char *deflt) |
|---|
| 96 | * reads wiring for one data signal from config |
|---|
| 97 | * returns 1<<bitpos or 255 on error |
|---|
| 98 | * |
|---|
| 99 | * void drv_generic_parport_direction (int direction) |
|---|
| 100 | * 0 - write to parport |
|---|
| 101 | * 1 - read from parport |
|---|
| 102 | * |
|---|
| 103 | * unsigned char drv_generic_parport_status (void) |
|---|
| 104 | * reads control lines |
|---|
| 105 | * |
|---|
| 106 | * void drv_generic_parport_control (unsigned char mask, unsigned char value) |
|---|
| 107 | * frobs control line and takes care of inverted signals |
|---|
| 108 | * |
|---|
| 109 | * void drv_generic_parport_toggle (unsigned char bit, int level, int delay) |
|---|
| 110 | * toggles the line <bit> to <level> for <delay> nanoseconds |
|---|
| 111 | * |
|---|
| 112 | * void drv_generic_parport_data (unsigned char value) |
|---|
| 113 | * put data bits on DB1..DB8 |
|---|
| 114 | * |
|---|
| 115 | * unsigned char drv_generic_parport_read (void) |
|---|
| 116 | * reads a byte from the parallel port |
|---|
| 117 | * |
|---|
| 118 | * void drv_generic_parport_debug(void) |
|---|
| 119 | * prints status of control lines |
|---|
| 120 | * |
|---|
| 121 | */ |
|---|
| 122 | |
|---|
| 123 | #ifndef _DRV_GENERIC_PARPORT_H_ |
|---|
| 124 | #define _DRV_GENERIC_PARPORT_H_ |
|---|
| 125 | |
|---|
| 126 | int drv_generic_parport_open(const char *section, const char *driver); |
|---|
| 127 | int drv_generic_parport_close(void); |
|---|
| 128 | unsigned char drv_generic_parport_wire_ctrl(const char *name, const char *deflt); |
|---|
| 129 | unsigned char drv_generic_parport_hardwire_ctrl(const char *name, const char *deflt); |
|---|
| 130 | unsigned char drv_generic_parport_wire_status(const char *name, const char *deflt); |
|---|
| 131 | unsigned char drv_generic_parport_wire_data(const char *name, const char *deflt); |
|---|
| 132 | void drv_generic_parport_direction(const int direction); |
|---|
| 133 | unsigned char drv_generic_parport_status(void); |
|---|
| 134 | void drv_generic_parport_control(const unsigned char mask, const unsigned char value); |
|---|
| 135 | void drv_generic_parport_toggle(const unsigned char bit, const int level, const int delay); |
|---|
| 136 | void drv_generic_parport_data(const unsigned char data); |
|---|
| 137 | unsigned char drv_generic_parport_read(void); |
|---|
| 138 | void drv_generic_parport_debug(void); |
|---|
| 139 | |
|---|
| 140 | #endif |
|---|