diff --git a/server/drivers/lpt-port.h b/server/drivers/lpt-port.h index b7281eb..45c7f20 100644 --- a/server/drivers/lpt-port.h +++ b/server/drivers/lpt-port.h @@ -1,5 +1,20 @@ -// This file contains defines to control the LPT port. -// A lot of this was originally in hd44780-low.h +/* + * This file contains defines to control the LPT port. + * A lot of this was originally in hd44780-low.h + * + * Moved from the HD44780 driver by Joris Robijn. + * + * This file is released under the GNU General Public License. Refer to the + * COPYING file distributed with this package. + * + * Copyright (c) 2000, 1999, 1995 Benjamin Tse + * 2001 Joris Robijn + * 2001 Mark Haemmerling + * 2000 Charles Steinkuehler + * 1999 Andrew McMeikan + * 1998 Richard Rognlie + * 1997 Matthias Prinke + */ #ifndef LPT_PORT_H #define LPT_PORT_H diff --git a/server/drivers/port.h b/server/drivers/port.h index ce84f18..59acea2 100644 --- a/server/drivers/port.h +++ b/server/drivers/port.h @@ -1,7 +1,4 @@ -#ifndef PORT_H -#define PORT_H - -/* $id$ +/* $id$ * Low level I/O functions taken from led-stat.txt * Jan 22 95 copyright damianf@wpi.edu * @@ -13,12 +10,6 @@ * NetBSD port by Guillaume Filion, copyright 12/2001 */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - /* This file defines 4 static inline functions for port I/O: @@ -39,6 +30,15 @@ static inline int port_access_full (unsigned short int port); // Returns 0 if successful, -1 if failed */ +#ifndef PORT_H +#define PORT_H + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + // ------------------------------------------------------------- // Use ioperm, inb and outb in (Linux) #if defined HAVE_IOPERM && HAVE_SYS_IO_H @@ -99,22 +99,22 @@ static inline void setaccess(u_long * map, u_int bit, int allow) { // Get access to a specific port static inline int port_access (unsigned short int port) { u_long iomap[32]; - + if (i386_get_ioperm(iomap) == -1) return -1; setaccess(iomap, port , 1); if (i386_set_ioperm(iomap) == -1) return -1; - + return 0; } // Get access to 3 ports: port (CONTROL), port+1 (STATUS) and port+2 (DATA) static inline int port_access_full (unsigned short int port) { u_long iomap[32]; - + if (i386_get_ioperm(iomap) == -1) return -1; - + setaccess(iomap, port , 1); setaccess(iomap, port+1, 1); setaccess(iomap, port+2, 1); @@ -154,7 +154,7 @@ static inline int port_access_full (unsigned short int port) { } else { return( -1 ); // Failure }; - + return -1; } diff --git a/server/drivers/t6963.c b/server/drivers/t6963.c index 9a824d5..431ac13 100644 --- a/server/drivers/t6963.c +++ b/server/drivers/t6963.c @@ -1,7 +1,7 @@ /* * Base driver module for Toshiba T6963 based LCD displays. ver 1.2 * - * Parts of this file are based on the kernel driver by Alexander Frink + * Parts of this file are based on the kernel driver by Alexander Frink * * * This file is released under the GNU General Public License. Refer to the @@ -17,9 +17,9 @@ #include #include #include -#include +//#include #include - + #include "shared/str.h" #include "shared/debug.h" @@ -88,7 +88,7 @@ t6963_init (struct lcd_logical_driver *driver, char *args) } DEBUG3 ("Getting permissions to %i...\n", t6963_out_port); - for (i = t6963_out_port; i < t6963_out_port+2; i++) + for (i = t6963_out_port; i < t6963_out_port+2; i++) if( port_access(i) ) { //ioperm(t6963_out_port, 3, 1)) { fprintf (stderr, "T6963_init: failed (%s)\n", strerror (errno)); return -1; @@ -100,7 +100,7 @@ t6963_init (struct lcd_logical_driver *driver, char *args) } DEBUG3 (" cool, got 'em!\nSetting width and height\n"); - + DEBUG3 ("done\nAllocating memory: %i x %i bytes = %i...\n", driver->wid, driver->hgt, driver->wid * driver->hgt); // Set display size @@ -218,7 +218,7 @@ t6963_clear () void t6963_graphic_clear (int x1, int y1, int x2, int y2) { - int x; + int x; DEBUG4 ("Clearing Graphic %i bytes\n", (x2-x1)*(y2-y1)); @@ -352,7 +352,7 @@ t6963_vbar (int x, int len) for (y = 0; y < len/t6963->cellhgt; y++) t6963_chr (x, 6-y, 219); - if (len % t6963->cellhgt) + if (len % t6963->cellhgt) t6963_chr (x, 6-y, 211 + (len % t6963->cellhgt)); DEBUG4 ("Done\n"); @@ -386,7 +386,7 @@ t6963_icon (int which, char dest) } ///////////////////////////////////////////////////////////////// -// Does the heartbeat +// Does the heartbeat // void t6963_heartbeat (int type) @@ -410,7 +410,7 @@ t6963_heartbeat (int type) } ////////////////////////////////////////////////////////////////////// -// Gets a whole screen buffer as argument... +// Gets a whole screen buffer as argument... // void diff --git a/server/drivers/timing.h b/server/drivers/timing.h index c481a26..e5fe1c4 100644 --- a/server/drivers/timing.h +++ b/server/drivers/timing.h @@ -1,6 +1,3 @@ -#ifndef _TIMING_H -#define _TIMING_H - /* * Utility header file for timing functions * @@ -19,16 +16,40 @@ * 2000 Charles Steinkuehler */ -// Uncomment one of the lines below to select your desired delay generation -// mechanism. If both defines are commented, the original I/O read timing -// loop is used. Using DELAY_NANOSLEEP seems to provide the best performance. +#ifndef _TIMING_H +#define _TIMING_H + +// Uncomment one of the lines below this paragraph to select your desired +// delay generation mechanism. +// Mechanism DELAY_NANOSLEEP seems to provide the best performance. +// Mechanism DELAY_IOCALLS can be quite inaccurate. +// Mechanism DELAY_AUTOSELECT lets the system determine a mechanism, and is +// the default. + +#define DELAY_AUTOSELECT //#define DELAY_GETTIMEOFDAY -#ifdef HAVE_SCHED_H -# define DELAY_NANOSLEEP -#else -# define DELAY_GETTIMEOFDAY +//#define DELAY_NANOSLEEP +//#define DELAY_IOCALLS + + +#include +#include +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" #endif +// Autoselect... Does this always work well ? +#ifdef DELAY_AUTOSELECT +# ifdef HAVE_SCHED_H +# define DELAY_NANOSLEEP +# else +# define DELAY_GETTIMEOFDAY +# endif +#endif + +// Include the correct time.h stuff (regardless of selected mechanism) #if TIME_WITH_SYS_TIME # include # include @@ -41,11 +62,18 @@ #endif // Only one alternate delay method at a time, please ;-) +// And include extra header files here... #if defined DELAY_GETTIMEOFDAY # undef DELAY_NANOSLEEP +# undef DELAY_IOCALLS #elif defined DELAY_NANOSLEEP +# undef DELAY_GETTIMEOFDAY +# undef DELAY_IOCALLS # include -# include +#else // assume DELAY_IOCALLS +# undef DELAY_GETTIMEOFDAY +# undef DELAY_NANOSLEEP +# include "port.h" #endif /////////////////////////////////////////////////////////////////