Fixed header file problem.
Enhanced(?) timing.h with DELAY_AUTOSELECT. Cheered up some comments, moved #ifndef FOO_H #define FOO_H to just after the copyright and explanation comment.
This commit is contained in:
@@ -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 <blt@Comports.com>
|
||||
* 2001 Joris Robijn <joris@robijn.net>
|
||||
* 2001 Mark Haemmerling <mail@markh.de>
|
||||
* 2000 Charles Steinkuehler <cstein@newtek.com>
|
||||
* 1999 Andrew McMeikan <andrewm@engineer.com>
|
||||
* 1998 Richard Rognlie <rrognlie@gamerz.net>
|
||||
* 1997 Matthias Prinke <m.prinke@trashcan.mcnet.de>
|
||||
*/
|
||||
|
||||
#ifndef LPT_PORT_H
|
||||
#define LPT_PORT_H
|
||||
|
||||
+15
-15
@@ -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 <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
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 <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Use ioperm, inb and outb in <sys/io.h> (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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <Alexander.Frink@Uni-Mainz.DE>
|
||||
* Parts of this file are based on the kernel driver by Alexander Frink <Alexander.Frink@Uni-Mainz.DE>
|
||||
*
|
||||
*
|
||||
* This file is released under the GNU General Public License. Refer to the
|
||||
@@ -17,9 +17,9 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <asm/io.h>
|
||||
//#include <asm/io.h>
|
||||
#include <sys/perm.h>
|
||||
|
||||
|
||||
#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
|
||||
|
||||
+39
-11
@@ -1,6 +1,3 @@
|
||||
#ifndef _TIMING_H
|
||||
#define _TIMING_H
|
||||
|
||||
/*
|
||||
* Utility header file for timing functions
|
||||
*
|
||||
@@ -19,16 +16,40 @@
|
||||
* 2000 Charles Steinkuehler <cstein@newtek.com>
|
||||
*/
|
||||
|
||||
// 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 <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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 <sys/time.h>
|
||||
# include <time.h>
|
||||
@@ -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 <sched.h>
|
||||
# include <time.h>
|
||||
#else // assume DELAY_IOCALLS
|
||||
# undef DELAY_GETTIMEOFDAY
|
||||
# undef DELAY_NANOSLEEP
|
||||
# include "port.h"
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user