home *** CD-ROM | disk | FTP | other *** search
- /*
- ** parint.h
- ** contains:
- */
-
-
- /*
- ** DESCRIPTION
- ** Header file for interrupt driven parallel port functions.
- **
- ** AUTHOR
- ** "" Wed 16-Nov-1988 16:17:16
- ** Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
- **
- ** MODIFICATIONS
- **
- */
-
-
- /* PARSTATUSBITS defines the bits inside the StatusBits member of the
- ** PARINT structure.
- */
- typedef struct PARSTATUSBITS {
- unsigned bufferempty: 1;
- unsigned bufferfull: 1;
- unsigned intsrunning: 1;
- unsigned intsenabled: 1;
- unsigned _parstresrv: 12;
- } PARSTATUSBITS;
-
- /* The PARINT structure keeps all of the state information for a
- ** Parallel port.
- **
- */
- typedef struct {
- PARSTATUSBITS StatusBits;
- unsigned BaseIOPARO; /* Base Address of Parallel port */
- unsigned IntNum; /* Software Interrupt Number to use */
- unsigned long PrevVector; /* What was at Interrupt vector previously */
- unsigned PrevBase2; /* What was at Interrupt Enable port of Parallel port */
- unsigned Irq8259; /* Irq # in 8259 to use */
- unsigned Prev8259; /* Previous value of 8259 bit */
- unsigned IOAdd8259; /* Base I/O Address of 8259 */
- unsigned pBufSize; /* Size of buffer */
- unsigned pBufCount; /* Number of characters in buffer */
- unsigned pBufHead; /* Offset into buffer for head */
- unsigned pBufTail; /* Offset into buffer for tail */
- unsigned char *pBuffer; /* Points to actual buffer */
- } PARINT;
-
- #define PARBUFFULL -800 /* Parallel Buffer is Full */
-
-
- #define PRCHARINBUF(p) p->pBufCount /* Characters in buffer */
- #define PRSPACEINBUF(p) (p->pBufSize-p->pBufCount) /* Free Space in buffer */
- #define PRBUFEMPTY(p) (p->StatusBits.bufferempty?1:0) /* Is buffer empty */
- #define PRBUFFULL(p) (p->StatusBits.bufferfull?1:0) /* Is buffer full */
-
- /* PRROOMFORSTR(p,s) returns true (1) if there is room for the string (s)
- ** in the buffer, else returns false. NOTE: Uses strlen().
- **/
-
- #define PRROOMFORSTR(p,s) (strlen(s)>p->pBufSize-p->pBufCount?0:1)
-
-
- #define OpenPrinter(a) openprt(a)
- #define ClosePrinter(a) closeprt(a)
- #define StopPrinter(a) stopprt(a)
- #define StartPrinter(a) strtprt(a)
- #define TestPrinter(a) testprt(a)
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- void GF_CDECL strtprt(PARINT *printdata);
- PARINT * GF_CONV openprt(unsigned buffersize);
- int GF_CDECL PrBufC(PARINT *printdata,unsigned char character);
- unsigned GF_CONV PrBufS(PARINT *printdata,int option,char *string);
- unsigned GF_CDECL PrBufF(PARINT *printdata,int option,char *string,...);
- unsigned char GF_CDECL testprt(PARINT *printdata);
- void GF_CONV closeprt(PARINT *printdata);
- void GF_CDECL stopprt(PARINT *printdata);
- void GF_CDECL _closepar(PARINT *printdata);
- void GF_CDECL _setpari(PARINT *printdata);
-
- #ifdef __cplusplus
- }
- #endif
-