xref: /freebsd/sys/dev/puc/puc_cfg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
164220a7eSMarcel Moolenaar /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
464220a7eSMarcel Moolenaar  * Copyright (c) 2006 Marcel Moolenaar
564220a7eSMarcel Moolenaar  * All rights reserved.
664220a7eSMarcel Moolenaar  *
764220a7eSMarcel Moolenaar  * Redistribution and use in source and binary forms, with or without
864220a7eSMarcel Moolenaar  * modification, are permitted provided that the following conditions
964220a7eSMarcel Moolenaar  * are met:
1064220a7eSMarcel Moolenaar  *
1164220a7eSMarcel Moolenaar  * 1. Redistributions of source code must retain the above copyright
1264220a7eSMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer.
1364220a7eSMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
1464220a7eSMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
1564220a7eSMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
1664220a7eSMarcel Moolenaar  *
1764220a7eSMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1864220a7eSMarcel Moolenaar  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1964220a7eSMarcel Moolenaar  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2064220a7eSMarcel Moolenaar  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2164220a7eSMarcel Moolenaar  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2264220a7eSMarcel Moolenaar  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2364220a7eSMarcel Moolenaar  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2464220a7eSMarcel Moolenaar  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2564220a7eSMarcel Moolenaar  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2664220a7eSMarcel Moolenaar  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2764220a7eSMarcel Moolenaar  */
2864220a7eSMarcel Moolenaar 
2964220a7eSMarcel Moolenaar #ifndef _DEV_PUC_CFG_H_
3077b2b60dSSergey Kandaurov #define	_DEV_PUC_CFG_H_
3164220a7eSMarcel Moolenaar 
3264220a7eSMarcel Moolenaar #define	DEFAULT_RCLK	1843200
3364220a7eSMarcel Moolenaar 
3464220a7eSMarcel Moolenaar #define	PUC_PORT_NONSTANDARD	0
3564220a7eSMarcel Moolenaar #define	PUC_PORT_1P		1	/* 1 parallel port */
3664220a7eSMarcel Moolenaar #define	PUC_PORT_1S		2	/* 1 serial port */
3764220a7eSMarcel Moolenaar #define	PUC_PORT_1S1P		3	/* 1 serial + 1 parallel ports */
3864220a7eSMarcel Moolenaar #define	PUC_PORT_1S2P		4	/* 1 serial + 2 parallel ports */
3964220a7eSMarcel Moolenaar #define	PUC_PORT_2P		5	/* 2 parallel ports */
4064220a7eSMarcel Moolenaar #define	PUC_PORT_2S		6	/* 2 serial ports */
4164220a7eSMarcel Moolenaar #define	PUC_PORT_2S1P		7	/* 2 serial + 1 parallel ports */
4264220a7eSMarcel Moolenaar #define	PUC_PORT_3S		8	/* 3 serial ports */
4364220a7eSMarcel Moolenaar #define	PUC_PORT_4S		9	/* 4 serial ports */
4464220a7eSMarcel Moolenaar #define	PUC_PORT_4S1P		10	/* 4 serial + 1 parallel ports */
4564220a7eSMarcel Moolenaar #define	PUC_PORT_6S		11	/* 6 serial ports */
4664220a7eSMarcel Moolenaar #define	PUC_PORT_8S		12	/* 8 serial ports */
4764220a7eSMarcel Moolenaar #define	PUC_PORT_12S		13	/* 12 serial ports */
4864220a7eSMarcel Moolenaar #define	PUC_PORT_16S		14	/* 16 serial ports */
4964220a7eSMarcel Moolenaar 
5064220a7eSMarcel Moolenaar /* Interrupt Latch Register (ILR) types */
5164220a7eSMarcel Moolenaar #define PUC_ILR_NONE		0
5264220a7eSMarcel Moolenaar #define PUC_ILR_DIGI		1
5364220a7eSMarcel Moolenaar #define PUC_ILR_QUATECH		2
5464220a7eSMarcel Moolenaar 
5564220a7eSMarcel Moolenaar /* Configuration queries. */
5664220a7eSMarcel Moolenaar enum puc_cfg_cmd {
5764220a7eSMarcel Moolenaar 	PUC_CFG_GET_CLOCK,
5864220a7eSMarcel Moolenaar 	PUC_CFG_GET_DESC,
5964220a7eSMarcel Moolenaar 	PUC_CFG_GET_ILR,
6064220a7eSMarcel Moolenaar 	PUC_CFG_GET_LEN,
6164220a7eSMarcel Moolenaar 	PUC_CFG_GET_NPORTS,
6264220a7eSMarcel Moolenaar 	PUC_CFG_GET_OFS,
6364220a7eSMarcel Moolenaar 	PUC_CFG_GET_RID,
6464220a7eSMarcel Moolenaar 	PUC_CFG_GET_TYPE,
6564220a7eSMarcel Moolenaar 	PUC_CFG_SETUP
6664220a7eSMarcel Moolenaar };
6764220a7eSMarcel Moolenaar 
6864220a7eSMarcel Moolenaar struct puc_softc;
6964220a7eSMarcel Moolenaar 
7064220a7eSMarcel Moolenaar typedef int puc_config_f(struct puc_softc *, enum puc_cfg_cmd, int, intptr_t *);
7164220a7eSMarcel Moolenaar 
7264220a7eSMarcel Moolenaar struct puc_cfg {
7364220a7eSMarcel Moolenaar 	uint16_t	vendor;
7464220a7eSMarcel Moolenaar 	uint16_t	device;
7564220a7eSMarcel Moolenaar 	uint16_t	subvendor;
7664220a7eSMarcel Moolenaar 	uint16_t	subdevice;
7764220a7eSMarcel Moolenaar 	const char	*desc;
7864220a7eSMarcel Moolenaar 	int		clock;
7964220a7eSMarcel Moolenaar 	int8_t		ports;
8064220a7eSMarcel Moolenaar 	int8_t		rid;		/* Rid of first port */
8164220a7eSMarcel Moolenaar 	int8_t		d_rid;		/* Delta rid of next ports */
8251cb024fSMax Khon 	int8_t		d_ofs;		/* Delta offset of next ports */
8364220a7eSMarcel Moolenaar 	puc_config_f 	*config_function;
8464220a7eSMarcel Moolenaar };
8564220a7eSMarcel Moolenaar 
8664220a7eSMarcel Moolenaar puc_config_f puc_config;
8764220a7eSMarcel Moolenaar 
8864220a7eSMarcel Moolenaar #endif /* _DEV_PUC_CFG_H_ */
89