/*
 * (c) d.m.broad. June 1995 (originally for the C= Amiga) & July 2005 (for FREEBSD on the PC).
 *
 * see build notes elsewhere.
 *
 * BSD LICENSE APPLIES.
 */

#ifndef _PEP_H
#define _PEP_H

/* standard includes */
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>

/* freebsd inb/outb */
#include <machine/cpufunc.h>

/* address of the parallel interface */
#define DATA    (0x378)
#define STATUS  (0x379)

/* data port bits */
#define INPUT_STROBE  (1)
#define INPUT_CLOCK   (2)
#define OUTPUT_ENABLE (4)
#define OUTPUT_STROBE (8)
#define OUTPUT_CLOCK  (16)
#define OUTPUT_DATA   (32)
#define OUTPUT_0      (64)
#define OUTPUT_1      (128)

/* status port bits */
#define INPUT_DATA    (16)
#define INPUT_1       (32)    
#define INPUT_0       (128)     /* inverted within parallel interface on PCs */

/* output control */
#define OUT0 (0)
#define OUT1 (1)

/* input control */
#define IN0  (0)
#define IN1  (1)

/* logic values */
#define LOW  (0)
#define HIGH (1)

/* prototypes */
void outPEP(unsigned char out, unsigned char bit);
unsigned char inPEP(unsigned char in);
void writePEP(unsigned short d);
unsigned short readPEP(void);
unsigned short testPEP(unsigned char bit);
void setPEP(unsigned char bit);
void clrPEP(unsigned char bit);
void chgPEP(unsigned char bit);
void enablePEP_OP(void);
void disablePEP_OP(void);
void initPEP_IO(void);

#endif
