xref: /freebsd/sys/dev/puc/puc_cfg.h (revision 4abd7edcbde21ba7a089c7d1a0bba8f87ebece06)
1 /*-
2  * Copyright (c) 2006 Marcel Moolenaar
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _DEV_PUC_CFG_H_
30 #define	_DEV_PUC_CFG_H_
31 
32 #define	DEFAULT_RCLK	1843200
33 
34 #define	PUC_PORT_NONSTANDARD	0
35 #define	PUC_PORT_1P		1	/* 1 parallel port */
36 #define	PUC_PORT_1S		2	/* 1 serial port */
37 #define	PUC_PORT_1S1P		3	/* 1 serial + 1 parallel ports */
38 #define	PUC_PORT_1S2P		4	/* 1 serial + 2 parallel ports */
39 #define	PUC_PORT_2P		5	/* 2 parallel ports */
40 #define	PUC_PORT_2S		6	/* 2 serial ports */
41 #define	PUC_PORT_2S1P		7	/* 2 serial + 1 parallel ports */
42 #define	PUC_PORT_3S		8	/* 3 serial ports */
43 #define	PUC_PORT_4S		9	/* 4 serial ports */
44 #define	PUC_PORT_4S1P		10	/* 4 serial + 1 parallel ports */
45 #define	PUC_PORT_6S		11	/* 6 serial ports */
46 #define	PUC_PORT_8S		12	/* 8 serial ports */
47 #define	PUC_PORT_12S		13	/* 12 serial ports */
48 #define	PUC_PORT_16S		14	/* 16 serial ports */
49 
50 /* Interrupt Latch Register (ILR) types */
51 #define PUC_ILR_NONE		0
52 #define PUC_ILR_DIGI		1
53 #define PUC_ILR_QUATECH		2
54 
55 /* Configuration queries. */
56 enum puc_cfg_cmd {
57 	PUC_CFG_GET_CLOCK,
58 	PUC_CFG_GET_DESC,
59 	PUC_CFG_GET_ILR,
60 	PUC_CFG_GET_LEN,
61 	PUC_CFG_GET_NPORTS,
62 	PUC_CFG_GET_OFS,
63 	PUC_CFG_GET_RID,
64 	PUC_CFG_GET_TYPE,
65 	PUC_CFG_SETUP
66 };
67 
68 struct puc_softc;
69 
70 typedef int puc_config_f(struct puc_softc *, enum puc_cfg_cmd, int, intptr_t *);
71 
72 struct puc_cfg {
73 	uint16_t	vendor;
74 	uint16_t	device;
75 	uint16_t	subvendor;
76 	uint16_t	subdevice;
77 	const char	*desc;
78 	int		clock;
79 	int8_t		ports;
80 	int8_t		rid;		/* Rid of first port */
81 	int8_t		d_rid;		/* Delta rid of next ports */
82 	int8_t		d_ofs;		/* Delta offset of next ports */
83 	puc_config_f 	*config_function;
84 };
85 
86 puc_config_f puc_config;
87 
88 #endif /* _DEV_PUC_CFG_H_ */
89