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