/*
* Copyright (c) 1997, 1998, 1999 Nicolas Souchu
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/dev/ppbus/ppbconf.h,v 1.17.2.1 2000/05/24 00:20:57 n_hibma Exp $
*
*/
#ifndef __PPBUS_BASE_H
#define __PPBUS_BASE_H
/* Structure to store status information. */
struct ppbus_status {
unsigned char status;
unsigned int timeout:1;
unsigned int error:1;
unsigned int select:1;
unsigned int paper_end:1;
unsigned int ack:1;
unsigned int busy:1;
};
/* How tsleep() is called in ppbus_request_bus(). */
#define PPBUS_DONTWAIT 0
#define PPBUS_NOINTR 0
#define PPBUS_WAIT 0x1
#define PPBUS_INTR 0x2
#define PPBUS_POLL 0x4
#define PPBUS_FOREVER -1
/* PPBUS interface functions (includes parport interface) */
int ppbus_scan_bus(device_t);
void ppbus_pnp_detect(device_t);
int ppbus_request_bus(device_t, device_t, int, unsigned int);
int ppbus_release_bus(device_t, device_t, int, unsigned int);
int ppbus_get_status(device_t, struct ppbus_status *);
int ppbus_poll_bus(device_t, int, char, char, int);
/* Parport interface function prototypes */
int ppbus_read_ivar(device_t, int, unsigned int *);
int ppbus_write_ivar(device_t, int, unsigned int *);
int ppbus_reset_epp_timeout(device_t);
int ppbus_ecp_sync(device_t);
int ppbus_set_mode(device_t, int, int);
int ppbus_get_mode(device_t);
int ppbus_write(device_t, char *, int, int, size_t *);
int ppbus_read(device_t, char *, int, int, size_t *);
int ppbus_exec_microseq(device_t, struct ppbus_microseq * *);
int ppbus_io(device_t, int, u_char *, int, u_char);
int ppbus_dma_malloc(device_t, void **, bus_addr_t *, bus_size_t);
int ppbus_dma_free(device_t, void **, bus_addr_t *, bus_size_t);
int ppbus_add_handler(device_t, void (*)(void *), void *);
int ppbus_remove_handler(device_t, void (*)(void *));