/* Device configuration file for the FAS async driver. */

/* This is a generic version for 8-port cards plus the standard
   COM1 and COM2 ports.
*/
 
/* FAS was developed by
Uwe Doering <fas@geminix.in-berlin.de>
Billstedter Pfad 17 b
13591 Berlin
Germany
*/

#if !defined (M_I286)
#ident	"@(#)space.c	2.12"
#endif

#if defined (LOCAL_INCLUDE)
#include "fas.h"
#else
#include <sys/fas.h>
#endif

/* This is the number of devices to be handled by this driver.
   If it is changed, make sure that the initializer parts of all arrays
   dimensioned with `NUM_PHYSICAL_UNITS' have a corresponding number of
   entries. You may define up to 16 devices.
*/
#define NUM_PHYSICAL_UNITS	10

#if NUM_PHYSICAL_UNITS > MAX_UNITS
#undef NUM_PHYSICAL_UNITS
#define NUM_PHYSICAL_UNITS	MAX_UNITS
#endif

/* array of base port addresses
   These values are the base i/o addresses of the UART chips.
*/
uint	fas_port [NUM_PHYSICAL_UNITS] =
{
	0x100,	0x108,	0x110,	0x118,
	0x120,	0x128,	0x130,	0x138,
	0x3f8,	0x2f8
};

#if defined (SCO) || defined (XENIX)
/* array of interrupt vectors (SCO UNIX and Xenix, only)
   FAS doesn't need informations about interrupt vectors during normal
   operation. Therefore, the only function of these values is to be
   displayed by the FAS boot message. So if you want vector infos at
   boot time you can enter the vector numbers here. But make sure that
   the values correspond with the entries in the kernel config files.
   A value of `-1' means that no vector number is displayed for the
   respective port.
   Users of other UNIX flavors can savely ignore this array.
*/
int	fas_vec [NUM_PHYSICAL_UNITS] =
{
	-1,	-1,	-1,	-1,
	-1,	-1,	-1,	-1,
	-1,	-1
};
#endif

/* array of modifier flags
   You can modify certain features of each port. See fas.h for possible
   names and values.
*/
uint	fas_modify [NUM_PHYSICAL_UNITS] =
{
	0,	0,	0,	0,
	0,	0,	0,	0,
	0,	0
};

/* array of FIFO operating mode values
   These values select the mode to which the UART FIFOs are set when
   a port is activated. For device types that don't have FIFOs the
   respective value is ignored, so you can set up this array for
   FIFO operation now and add the FIFO UARTs later. There are several
   operating modes predefined. See fas.h for possible names and values.
*/
uint	fas_fifo_ctl [NUM_PHYSICAL_UNITS] =
{
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT,
	FIFO_DEFAULT
};

/* initialization sequence for serial cards
   This array contains pairs of values of the form:

        portaddress, value,
              :
              :
        portaddress, value,
        0

   For every line `value' will be written to `portaddress'. If
   `value' is replaced with the macro `READ_PORT' then a value
   is read from `portaddress' instead. The value itself will be
   discarded. Therefore, this makes only sense if the read access
   to the port has a side effect like setting or resetting
   certain flags.

   NOTE: This array *must* be terminated with a value of 0
         in the portaddress column!
*/
uint	fas_init_seq [] =
{
	0
};

/* interrupt acknowledge sequence for serial cards
   This sequence is executed by the fasintr () function after all pending
   interrupts on all serial cards have been processed. The contents of this
   array has the same form as in the fas_init_seq [] array above.
*/
uint	fas_int_ack_seq [] =
{
	0
};

/* initial modem control port info
   This value is ored into the modem control value for each UART. This is
   normaly used to force out2 which is used to enable the interrupts of
   the standard com1 and com2 ports. Several brands of cards have modes
   that allow them to work in compatible mode like com1 and com2 or as a
   shared interrupts card. One of these cards is the AST 4-port card. When
   this card is used in shared interrupts mode out2 must _not_ be set.

   Note: This is one of the major trouble-spots with shared interrupts
   cards. Check your manual.
*/
uint	fas_mcb [NUM_PHYSICAL_UNITS] =
{
	MC_SET_OUT2,	MC_SET_OUT2,	MC_SET_OUT2,	MC_SET_OUT2,
	MC_SET_OUT2,	MC_SET_OUT2,	MC_SET_OUT2,	MC_SET_OUT2,
	MC_SET_OUT2,	MC_SET_OUT2
};

/* array of modem control flags
   You can choose which signals to use for modem control. See fas.h
   for possible names and values. Whether or not modem control is
   used is determined by the minor device number at open time.
*/
ulong	fas_modem [NUM_PHYSICAL_UNITS] =
{
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD,
	EO_DTR | EI_DTR | CA_DCD
};

/* array of hardware flow control flags
   You can choose which signals to use for hardware handshake. See fas.h
   for possible names and values. Whether or not hardware handshake is
   used is determined by the minor device number at open time and by the
   RTSFLOW/CTSFLOW termio(7) flags.
*/
ulong	fas_flow [NUM_PHYSICAL_UNITS] =
{
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS,
	HI_RTS | HO_CTS_ON_DSR | HX_RTS
};

/* array of control register addresses
   There are serial boards available that have all serial ports
   multiplexed to one address location in order to save I/O address
   space (Bell Tech HUB-6 card etc.). This multiplexing is controlled
   by a special register that needs to be written to before the actual
   port registers can be accessed. This array contains the addresses
   of these special registers.
   Enter the addresses on a per unit base. An address of zero
   disables this feature.
*/
uint	fas_ctl_port [NUM_PHYSICAL_UNITS] =
{
	0,	0,	0,	0,
	0,	0,	0,	0,
	0,	0
};

/* array of control register values
   These values are written to the corresponding control register
   before the first access to the actual port registers. If not only
   entire UART chips (blocks of 8 contiguous addresses) but even the
   single registers of the UART chips need to be multiplexed to one
   address you have to "or" a bit mask (shifted 8 times to the left)
   to the control register value. This mask determines at which bit
   locations the UART chip register number is "xored" into the control
   register value at runtime. This implies that you can also use
   negative logic by setting the bits in the control register value
   to 1 at the locations corresponding to the bit mask.
*/
uint	fas_ctl_val [NUM_PHYSICAL_UNITS] =
{
	0,	0,	0,	0,
	0,	0,	0,	0,
	0,	0
};

/* This is the number of available port layout tables.
   If this number is changed the arrays below must be filled
   in accordingly.
*/
#define NUM_PORT_LAYOUTS	1

/* array of port layout table selection values
   These values select the port layout table in fas_layout [] []
   that is used for the respective port.
*/
uint	fas_pl_select [NUM_PHYSICAL_UNITS] =
{
	0,	0,	0,	0,
	0,	0,	0,	0,
	0,	0
};

/* array of port layout tables
   This two-dimensional array contains the base port offsets of the
   seven UART registers used by FAS. There are one or more port layout
   tables that are selected by the values in fas_pl_select [].

   Each port layout table is arranged like this (the position of the values
   corresponds to the respective UART register acronym):

	RBR/THR, IER,	IIR/FCR, LCR,	MCR,	LSR,	MSR
*/
uint	fas_layout [NUM_PORT_LAYOUTS] [NUM_UART_REGS] =
{
  {	/* table 0 */
	0,	1,	2,	3,	4,	5,	6
  }
};

/* This is the number of available baud rate tables.
   You may define up to 256 tables.  If this number is changed
   the arrays below must be filled in accordingly.
*/
#define NUM_BAUD_TABLES	2

#if NUM_BAUD_TABLES > MAX_BAUD_TABLES
#undef NUM_BAUD_TABLES
#define NUM_BAUD_TABLES	MAX_BAUD_TABLES
#endif

/* array of baud rate table selection values
   These values select the baud rate table in fas_baud [] []
   that is used for the respective port.
*/
uint	fas_bt_select [NUM_PHYSICAL_UNITS] =
{
	0,	0,	0,	0,
	0,	0,	0,	0,
	0,	0
};

/* array of baud rate tables
   This two-dimensional array contains the 15 possible UNIX baud rates
   plus the baud rate base that these 15 baud rates are derived from. There
   are one or more baud rate tables that are selected by the values in
   fas_bt_select [].

   The values in the baud rate tables are multiplied by ten to allow an
   accuracy of 0.1 baud. The baud rate base can be computed by dividing the
   external oscillator frequency (fed to the UART) by 16, and afterwards it
   is also mutiplied by ten to make its scale match the scale of the baud
   rate values.

   Each baud rate table is arranged like this (the position of the values
   corresponds to the respective baud rate symbol):

	BASE,		B50,		B75,		B110,
	B134,		B150,		B200,		B300,
	B600,		B1200,		B1800,		B2400,
	B4800,		B9600,		B19200,		B38400
*/
ulong	fas_baud [NUM_BAUD_TABLES] [CBAUD + 1] =
{
  {	/* table 0 */
	1152000,	500,		750,		1100,
	1345,		1500,		2000,		3000,
	6000,		12000,		18000,		24000,
	48000,		96000,		192000,		384000
  },
  {	/* table 1 */
	1152000,	500,		750,		1100,
	1345,		1500,		2000,		3000,
	6000,		12000,		18000,		24000,
	48000,		96000,		576000,		1152000
  }
};

/* NOTHING NEEDS TO BE CHANGED BELOW THIS LINE.
   ============================================
*/

/* let the driver know the number of devices */
uint	fas_physical_units = NUM_PHYSICAL_UNITS;

/* let the driver know the number of port layout tables */
uint	fas_port_layouts = NUM_PORT_LAYOUTS;

/* let the driver know the number of baud rate tables */
uint	fas_baud_tables = NUM_BAUD_TABLES;

/* array of structures to hold all info for a physical minor device */
struct fas_internals	fas_internals [NUM_PHYSICAL_UNITS];

/* array of tty structures for logical devices */
struct tty	fas_tty [NUM_PHYSICAL_UNITS * 2];

/* array of fas_speed structure arrays that contain baud rate dependent
   informations
*/
struct fas_speed	fas_speed [NUM_BAUD_TABLES] [CBAUD + 1];

/* array of pointers to fas_internals structures
   this prevents time consuming multiplications for index calculation
*/
struct fas_internals	*fas_internals_ptr [NUM_PHYSICAL_UNITS];

/* array of pointers to tty structures
   this prevents time consuming multiplications for index calculation
*/
struct tty	*fas_tty_ptr [NUM_PHYSICAL_UNITS * 2];

/* array of pointers to fas_speed structure arrays
   this prevents time consuming multiplications for index calculation
*/
struct fas_speed	*fas_speed_ptr [NUM_BAUD_TABLES];

/* array of pointers to the baud rate tables in fas_baud [] []
   this prevents time consuming multiplications for index calculation
*/
ulong	*fas_baud_ptr [NUM_BAUD_TABLES];
