home *** CD-ROM | disk | FTP | other *** search
- /*
- $Id: space.c,v 2.6 90/08/24 11:48:45 sw Exp $
- */
-
- /*
- "Copyright 1990 Piercarlo Grandi. All rights reserved.";
- */
-
- /*
- This driver is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 1, or
- (at your option) any later version.
-
- As a special case, this driver may be incorporated in any OS kernel,
- whether the GNU General Public License applies to it or not.
-
- This driver is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You may have received a copy of the GNU General Public License
- along with this driver; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #include "config.h"
-
- #ifdef PP
-
- #include "sys/types.h"
- #include "sys/param.h"
- #include "sys/buf.h"
- #include "sys/pp.h"
-
- struct pp_config pp_config[] =
- {
- /* data, status, control */
- #if PP_CNTLS >= 1
- { PP_0_SIOA, PP_0_SIOA+1, PP_0_EIOA }, /* /dev/pp0 */
- #endif
- #if PP_CNTLS >= 2
- { PP_1_SIOA, PP_1_SIOA+1, PP_2_EIOA }, /* /dev/pp0 */
- #endif
- #if PP_CNTLS >= 3
- { PP_2_SIOA, PP_2_SIOA+1, PP_2_EIOA }, /* /dev/pp0 */
- #endif
- };
-
- #define ppMAX (sizeof pp_config / sizeof (struct pp_config))
-
- #if ppSTATICSZ != 0
- char pp_sbuf[ppMAX][ppSTATICSZ];
- #endif
-
- short pp_max = ppMAX;
-
- /*
- The exit conditions from the two polling loops here are a bit funny,
- my printer (EPSON SQ850) and parallel port give the following statuses:
-
- NOTBUSY NOTACK NOPAPER ONLINE NOTERROR
-
- port missing 1 1 1 1 1
- printer power off 1 0 0 0 0
- printer not there 1 1 0 1 0
- offline 0 1 0 1 0
- online 1 1 0 1 1
-
- The printer puts NOTBUSY low while we strobe the character in,
- then strobes NOTACK low for 10 usecs afterwards to signal we can
- strobe again. The relationship between the two is to say the
- last bizarre.
-
- Our problem is that we want to distinguish between long term and
- short term busy, where short term busy is defined as the time taken
- by the interface to read a character, and long term busy as paper
- end, offline, power off, interface buffer full.
- */
-
- struct pp_guard pp_guard =
- {
- {
- (ppONLINE|ppNOTERROR|ppNOPAPER), /* pause.mask */
- (ppONLINE|ppNOTERROR) /* pause.done */
- },
- {
- (ppNOTACK|ppNOTBUSY), /* spin.mask */
- (ppNOTACK|ppNOTBUSY) /* spin.done */
- },
- };
-
- /*
- These are the number of clock ticks in a long pause, the number of clock
- ticks in a short pause, and the maximum # of times we busy wait, after
- which we sleep wait; this should be a bit larger than the usual inter
- character processing time of the interface.
- */
-
- short unsigned pp_longpause = HZ/2;
- short unsigned pp_shortpause = HZ/4;
- short unsigned pp_maxspins = 7; /* in 10 usec units */
-
- #endif /* PP */
-