1158124Smarcel/*-
2158124Smarcel * Copyright (c) 2006 Marcel Moolenaar
3158124Smarcel * All rights reserved.
4158124Smarcel *
5158124Smarcel * Redistribution and use in source and binary forms, with or without
6158124Smarcel * modification, are permitted provided that the following conditions
7158124Smarcel * are met:
8158124Smarcel *
9158124Smarcel * 1. Redistributions of source code must retain the above copyright
10158124Smarcel *    notice, this list of conditions and the following disclaimer.
11158124Smarcel * 2. Redistributions in binary form must reproduce the above copyright
12158124Smarcel *    notice, this list of conditions and the following disclaimer in the
13158124Smarcel *    documentation and/or other materials provided with the distribution.
14158124Smarcel *
15158124Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16158124Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17158124Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18158124Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19158124Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20158124Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21158124Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22158124Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23158124Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24158124Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25158124Smarcel *
26158124Smarcel * $FreeBSD$
27158124Smarcel */
28158124Smarcel
29158124Smarcel#ifndef _DEV_PUC_CFG_H_
30251862Spluknet#define	_DEV_PUC_CFG_H_
31158124Smarcel
32158124Smarcel#define	DEFAULT_RCLK	1843200
33158124Smarcel
34158124Smarcel#define	PUC_PORT_NONSTANDARD	0
35158124Smarcel#define	PUC_PORT_1P		1	/* 1 parallel port */
36158124Smarcel#define	PUC_PORT_1S		2	/* 1 serial port */
37158124Smarcel#define	PUC_PORT_1S1P		3	/* 1 serial + 1 parallel ports */
38158124Smarcel#define	PUC_PORT_1S2P		4	/* 1 serial + 2 parallel ports */
39158124Smarcel#define	PUC_PORT_2P		5	/* 2 parallel ports */
40158124Smarcel#define	PUC_PORT_2S		6	/* 2 serial ports */
41158124Smarcel#define	PUC_PORT_2S1P		7	/* 2 serial + 1 parallel ports */
42158124Smarcel#define	PUC_PORT_3S		8	/* 3 serial ports */
43158124Smarcel#define	PUC_PORT_4S		9	/* 4 serial ports */
44158124Smarcel#define	PUC_PORT_4S1P		10	/* 4 serial + 1 parallel ports */
45158124Smarcel#define	PUC_PORT_6S		11	/* 6 serial ports */
46158124Smarcel#define	PUC_PORT_8S		12	/* 8 serial ports */
47158124Smarcel#define	PUC_PORT_12S		13	/* 12 serial ports */
48158124Smarcel#define	PUC_PORT_16S		14	/* 16 serial ports */
49158124Smarcel
50158124Smarcel/* Interrupt Latch Register (ILR) types */
51158124Smarcel#define PUC_ILR_NONE		0
52158124Smarcel#define PUC_ILR_DIGI		1
53158124Smarcel#define PUC_ILR_QUATECH		2
54158124Smarcel
55158124Smarcel/* Configuration queries. */
56158124Smarcelenum puc_cfg_cmd {
57158124Smarcel	PUC_CFG_GET_CLOCK,
58158124Smarcel	PUC_CFG_GET_DESC,
59158124Smarcel	PUC_CFG_GET_ILR,
60158124Smarcel	PUC_CFG_GET_LEN,
61158124Smarcel	PUC_CFG_GET_NPORTS,
62158124Smarcel	PUC_CFG_GET_OFS,
63158124Smarcel	PUC_CFG_GET_RID,
64158124Smarcel	PUC_CFG_GET_TYPE,
65158124Smarcel	PUC_CFG_SETUP
66158124Smarcel};
67158124Smarcel
68158124Smarcelstruct puc_softc;
69158124Smarcel
70158124Smarceltypedef int puc_config_f(struct puc_softc *, enum puc_cfg_cmd, int, intptr_t *);
71158124Smarcel
72158124Smarcelstruct puc_cfg {
73158124Smarcel	uint16_t	vendor;
74158124Smarcel	uint16_t	device;
75158124Smarcel	uint16_t	subvendor;
76158124Smarcel	uint16_t	subdevice;
77158124Smarcel	const char	*desc;
78158124Smarcel	int		clock;
79158124Smarcel	int8_t		ports;
80158124Smarcel	int8_t		rid;		/* Rid of first port */
81158124Smarcel	int8_t		d_rid;		/* Delta rid of next ports */
82238933Sfjoe	int8_t		d_ofs;		/* Delta offset of next ports */
83158124Smarcel	puc_config_f 	*config_function;
84158124Smarcel};
85158124Smarcel
86158124Smarcelpuc_config_f puc_config;
87158124Smarcel
88158124Smarcel#endif /* _DEV_PUC_CFG_H_ */
89