| 1 | /* $Id$ |
|---|
| 2 | * $URL$ |
|---|
| 3 | * |
|---|
| 4 | * generic driver helper for parallel port displays |
|---|
| 5 | * |
|---|
| 6 | * Copyright (C) 1999, 2000 Michael Reinelt <michael@reinelt.co.at> |
|---|
| 7 | * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> |
|---|
| 8 | * |
|---|
| 9 | * This file is part of LCD4Linux. |
|---|
| 10 | * |
|---|
| 11 | * LCD4Linux is free software; you can redistribute it and/or modify |
|---|
| 12 | * it under the terms of the GNU General Public License as published by |
|---|
| 13 | * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 14 | * any later version. |
|---|
| 15 | * |
|---|
| 16 | * LCD4Linux is distributed in the hope that it will be useful, |
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | * GNU General Public License for more details. |
|---|
| 20 | * |
|---|
| 21 | * You should have received a copy of the GNU General Public License |
|---|
| 22 | * along with this program; if not, write to the Free Software |
|---|
| 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 24 | * |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | /* |
|---|
| 28 | * |
|---|
| 29 | * exported fuctions: |
|---|
| 30 | * |
|---|
| 31 | * int drv_generic_parport_open (void) |
|---|
| 32 | * reads 'Port' entry from config and opens |
|---|
| 33 | * the parallel port |
|---|
| 34 | * returns 0 if ok, -1 on failure |
|---|
| 35 | * |
|---|
| 36 | * int drv_generic_parport_close (void) |
|---|
| 37 | * closes parallel port |
|---|
| 38 | * returns 0 if ok, -1 on failure |
|---|
| 39 | * |
|---|
| 40 | * unsigned char drv_generic_parport_wire_ctrl (char *name, char *deflt) |
|---|
| 41 | * reads wiring for one control signal from config |
|---|
| 42 | * returns DRV_GENERIC_PARPORT_CONTROL_* or 255 on error |
|---|
| 43 | * |
|---|
| 44 | * unsigned char drv_generic_parport_hardwire_ctrl (char *name) |
|---|
| 45 | * returns hardwiring for one control signal |
|---|
| 46 | * same as above, but does not read from config, |
|---|
| 47 | * but checks the config and emits a warning that the config |
|---|
| 48 | * entry will be ignored |
|---|
| 49 | * returns DRV_GENERIC_PARPORT_CONTROL_* or 255 on error |
|---|
| 50 | * |
|---|
| 51 | * unsigned char drv_generic_parport_wire_status (char *name, char *deflt) |
|---|
| 52 | * reads wiring for one status signal from config |
|---|
| 53 | * returns DRV_GENERIC_PARPORT_STATUS_* or 255 on error |
|---|
| 54 | * |
|---|
| 55 | * unsigned char drv_generic_parport_wire_data (char *name, char *deflt) |
|---|
| 56 | * reads wiring for one data signal from config |
|---|
| 57 | * returns 1<<bitpos or 255 on error |
|---|
| 58 | * |
|---|
| 59 | * void drv_generic_parport_direction (int direction) |
|---|
| 60 | * 0 - write to parport |
|---|
| 61 | * 1 - read from parport |
|---|
| 62 | * |
|---|
| 63 | * unsigned char drv_generic_parport_status (void) |
|---|
| 64 | * reads control lines |
|---|
| 65 | * |
|---|
| 66 | * void drv_generic_parport_control (unsigned char mask, unsigned char value) |
|---|
| 67 | * frobs control line and takes care of inverted signals |
|---|
| 68 | * |
|---|
| 69 | * void drv_generic_parport_toggle (unsigned char bit, int level, int delay) |
|---|
| 70 | * toggles the line <bit> to <level> for <delay> nanoseconds |
|---|
| 71 | * |
|---|
| 72 | * void drv_generic_parport_data (unsigned char value) |
|---|
| 73 | * put data bits on DB1..DB8 |
|---|
| 74 | * |
|---|
| 75 | * unsigned char drv_generic_parport_read (void) |
|---|
| 76 | * reads a byte from the parallel port |
|---|
| 77 | * |
|---|
| 78 | * void drv_generic_parport_debug(void) |
|---|
| 79 | * prints status of control lines |
|---|
| 80 | * |
|---|
| 81 | */ |
|---|
| 82 | |
|---|
| 83 | #ifndef _DRV_GENERIC_PARPORT_H_ |
|---|
| 84 | #define _DRV_GENERIC_PARPORT_H_ |
|---|
| 85 | |
|---|
| 86 | int drv_generic_parport_open(const char *section, const char *driver); |
|---|
| 87 | int drv_generic_parport_close(void); |
|---|
| 88 | unsigned char drv_generic_parport_wire_ctrl(const char *name, const char *deflt); |
|---|
| 89 | unsigned char drv_generic_parport_hardwire_ctrl(const char *name, const char *deflt); |
|---|
| 90 | unsigned char drv_generic_parport_wire_status(const char *name, const char *deflt); |
|---|
| 91 | unsigned char drv_generic_parport_wire_data(const char *name, const char *deflt); |
|---|
| 92 | void drv_generic_parport_direction(const int direction); |
|---|
| 93 | unsigned char drv_generic_parport_status(void); |
|---|
| 94 | void drv_generic_parport_control(const unsigned char mask, const unsigned char value); |
|---|
| 95 | void drv_generic_parport_toggle(const unsigned char bit, const int level, const unsigned long delay); |
|---|
| 96 | void drv_generic_parport_data(const unsigned char data); |
|---|
| 97 | unsigned char drv_generic_parport_read(void); |
|---|
| 98 | void drv_generic_parport_debug(void); |
|---|
| 99 | |
|---|
| 100 | #endif |
|---|