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
|
#ifndef LPT_PORT_H
|
||||||
#define LPT_PORT_H
|
#define LPT_PORT_H
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
#ifndef PORT_H
|
|
||||||
#define PORT_H
|
|
||||||
|
|
||||||
/* $id$
|
/* $id$
|
||||||
* Low level I/O functions taken from led-stat.txt
|
* Low level I/O functions taken from led-stat.txt
|
||||||
* Jan 22 95 copyright damianf@wpi.edu
|
* Jan 22 95 copyright damianf@wpi.edu
|
||||||
@@ -13,12 +10,6 @@
|
|||||||
* NetBSD port by Guillaume Filion, copyright 12/2001
|
* 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:
|
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
|
// 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)
|
// Use ioperm, inb and outb in <sys/io.h> (Linux)
|
||||||
#if defined HAVE_IOPERM && HAVE_SYS_IO_H
|
#if defined HAVE_IOPERM && HAVE_SYS_IO_H
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <asm/io.h>
|
//#include <asm/io.h>
|
||||||
#include <sys/perm.h>
|
#include <sys/perm.h>
|
||||||
|
|
||||||
#include "shared/str.h"
|
#include "shared/str.h"
|
||||||
|
|||||||
+35
-7
@@ -1,6 +1,3 @@
|
|||||||
#ifndef _TIMING_H
|
|
||||||
#define _TIMING_H
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utility header file for timing functions
|
* Utility header file for timing functions
|
||||||
*
|
*
|
||||||
@@ -19,16 +16,40 @@
|
|||||||
* 2000 Charles Steinkuehler <cstein@newtek.com>
|
* 2000 Charles Steinkuehler <cstein@newtek.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Uncomment one of the lines below to select your desired delay generation
|
#ifndef _TIMING_H
|
||||||
// mechanism. If both defines are commented, the original I/O read timing
|
#define _TIMING_H
|
||||||
// loop is used. Using DELAY_NANOSLEEP seems to provide the best performance.
|
|
||||||
|
// 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
|
//#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
|
# ifdef HAVE_SCHED_H
|
||||||
# define DELAY_NANOSLEEP
|
# define DELAY_NANOSLEEP
|
||||||
# else
|
# else
|
||||||
# define DELAY_GETTIMEOFDAY
|
# define DELAY_GETTIMEOFDAY
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Include the correct time.h stuff (regardless of selected mechanism)
|
||||||
#if TIME_WITH_SYS_TIME
|
#if TIME_WITH_SYS_TIME
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
@@ -41,11 +62,18 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Only one alternate delay method at a time, please ;-)
|
// Only one alternate delay method at a time, please ;-)
|
||||||
|
// And include extra header files here...
|
||||||
#if defined DELAY_GETTIMEOFDAY
|
#if defined DELAY_GETTIMEOFDAY
|
||||||
# undef DELAY_NANOSLEEP
|
# undef DELAY_NANOSLEEP
|
||||||
|
# undef DELAY_IOCALLS
|
||||||
#elif defined DELAY_NANOSLEEP
|
#elif defined DELAY_NANOSLEEP
|
||||||
|
# undef DELAY_GETTIMEOFDAY
|
||||||
|
# undef DELAY_IOCALLS
|
||||||
# include <sched.h>
|
# include <sched.h>
|
||||||
# include <time.h>
|
#else // assume DELAY_IOCALLS
|
||||||
|
# undef DELAY_GETTIMEOFDAY
|
||||||
|
# undef DELAY_NANOSLEEP
|
||||||
|
# include "port.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user