/*******************************************************************************
 *      pdp11-40.conf
 *      blinkenlightd panel configuration file
 *      Connected panel: PDP-11/40 processor console, KY11-D
 *
 *      I. FILE FORMAT
 *      =================
 *      Describes a struct defined in blinkenlight_panel.h
 *
 *	Grammar:
 *      - reserved words are case-insensitive
 *      - is C-like syntax
 *      - can be run through cpp
 *      - can be formatted with the formatter of Eclipse-CDT, if renamed to "*.h"
 *
 *	Blinkenbus:
 *	board numbers are 0..31
 * 	only one board type now:
 *		type 0: output register OUT0..OUT10, inputs IN0..IN4
 *
 *      II. CONNECTION SCHEME FOR 11/40 console panel (KY11-D)
 *      ==========================================================
 *
 *      DEC documentation:
 *      Schematic: PDP-11-40 system engineering drawings, Rev P(Jun 1974, Rev P).pdf, pages 163-165
 *
 *      Function:  PDP-11-40, -11-35 (21 inch chassis) system manual (Jan 1975, EK-11040-TM-002).pdf, Chapter 3
 *      pdf-pages 39- 52
 *
 *
 *      ------------- panel schematic --------------    ------- BlinkenBoard --------
 *      Control        Comp.   Signalname       Pin     Berg               BlinkenBoard
 *                                              DEC     decimal            (see pdp11-40.def)
 *
 *      LED ADDR17     D35       BA17 L         J1.A    J1.1              OUT2.1
 *      LED ADDR16     D34       BA16 L         J1.B    J1.2              OUT2.0
 *      LED ADDR15     D33       BA15 L         J2.X    J2.20             OUT1.7
 *      LED ADDR14     D32       BA14 L         J2.V    J2.18             OUT1.6
 *      LED ADDR13     D31       BA13 L         J2.T    J2.16             OUT1.5
 *      LED ADDR12     D30       BA12 L         J2.R    J2.14             OUT1.4
 *      LED ADDR11     D29       BA11 L         J2.N    J2.12             OUT1.3
 *      LED ADDR10     D28       BA10 L         J2.L    J2.10             OUT1.2
 *      LED ADDR09     D27       BA09 L         J2.J    J2.8              OUT1.1
 *      LED ADDR08     D26       BA08 L         J2.F    J2.6              OUT1.0
 *      LED ADDR07     D25       BA07 L         J2.D    J2.4              OUT0.7
 *      LED ADDR06     D24       BA06 L         J2.B    J2.2              OUT0.6
 *      LED ADDR05     D23       BA05 L         J2.A    J2.1              OUT0.5
 *      LED ADDR04     D22       BA04 L         J2.C    J2.3              OUT0.4
 *      LED ADDR03     D21       BA03 L         J2.E    J2.5              OUT0.3
 *      LED ADDR02     D20       BA02 L         J2.H    J2.7              OUT0.2
 *      LED ADDR01     D19       BA01 L         J2.K    J2.9              OUT0.1
 *      LED ADDR00     D18       BA00 L         J2.M    J2.11             OUT0.0
 *
 *      LED DATA15     D16       DMUX15 L       J1.F    J1.6              OUT7.7
 *      LED DATA14     D15       DMUX14 L       J1.J    J1.8              OUT7.6
 *      LED DATA13     D14       DMUX13 L       J1.N    J1.12             OUT7.5
 *      LED DATA12     D13       DMUX12 L       J1.L    J1.10             OUT7.4
 *      LED DATA11     D12       DMUX11 L       J1.BB   J1.24             OUT7.3
 *      LED DATA10     D11       DMUX10 L       J1.Z    J1.22             OUT7.2
 *      LED DATA09     D10       DMUX09 L       J1.FF   J1.28             OUT7.1
 *      LED DATA08     D9        DMUX08 L       J1.DD   J1.26             OUT7.0
 *      LED DATA07     D8        DMUX07 L       J1.Y    J1.21             OUT6.7
 *      LED DATA06     D7        DMUX06 L       J1.CC   J1.25             OUT6.6
 *      LED DATA05     D6        DMUX05 L       J1.EE   J1.27             OUT6.5
 *      LED DATA04     D5        DMUX04 L       J1.AA   J1.23             OUT6.4
 *      LED DATA03     D4        DMUX03 L       J1.K    J1.9              OUT6.3
 *      LED DATA02     D3        DMUX02 L       J1.M    J1.11             OUT6.2
 *      LED DATA01     D2        DMUX01 L       J1.H    J1.7              OUT6.1
 *      LED DATA00     D1        DMUX00 L       J1.E    J1.5              OUT6.0
 *
 *      LED RUN        D39       RUN L          J2.U    J2.17             OUT2.2
 *      LED PROCESSOR  D38       PROCESSOR L    J2.W    J2.19             OUT2.7
 *      LED BUS        D37       BUS L          J2.S    J2.15             OUT2.3
 *      LED CONSOLE    D36       CONSOLE L      J2.P    J2.13             OUT2.5
 *      LED USER       D41       USER L         J2.LL   J2.32             OUT2.4
 *      LED VIRTUAL    D40       VIRTUAL L      J2.Z    J2.22             OUT2.6
 *
 *
 *      SWITCH SR17              SR17 H         J1.C    J1.3              IN2.1
 *      SWITCH SR16              SR16 H         J1.D    J1.4              IN2.0
 *      SWITCH SR15              SR15 H         J1.T    J1.16             IN1.7
 *      SWITCH SR14              SR14 H         J1.V    J1.18             IN1.6
 *      SWITCH SR13              SR13 H         J1.R    J1.14             IN1.5
 *      SWITCH SR12              SR12 H         J1.X    J1.20             IN1.4
 *      SWITCH SR11              SR11 H         J1.HH   J1.29             IN1.3
 *      SWITCH SR10              SR10 H         J1.KK   J1.31             IN1.2
 *      SWITCH SR09              SR09 H         J1.SS   J1.37             IN1.1
 *      SWITCH SR08              SR08 H         J1.UU   J1.39             IN1.0
 *      SWITCH SR07              SR07 H         J1.LL   J1.32             IN0.7
 *      SWITCH SR06              SR06 H         J1.VV   J1.40             IN0.6
 *      SWITCH SR05              SR05 H         J1.JJ   J1.30             IN0.5
 *      SWITCH SR04              SR04 H         J1.TT   J1.38             IN0.4
 *      SWITCH SR03              SR03 H         J1.U    J1.17             IN0.3
 *      SWITCH SR02              SR02 H         J1.S    J1.15             IN0.2
 *      SWITCH SR01              SR01 H         J1.W    J1.19             IN0.1
 *      SWITCH SR00              SR00 H         J1.P    J1.13             IN0.0
 *
 *      SWITCH LOADADRS          LOADADRS SW L  J2.AA   J2.23             IN2.2
 *      SWITCH EXAM              EXAM SW L      J2.CC   J2.25             IN2.3
 *      SWITCH CONT              CONT SW L      J2.EE   J2.27             IN2.4
 *      SWITCH HALT              HALT SW L      J2.HH   J2.29             IN2.5
 *      SWITCH START             START SW L     J2.TT   J2.38             IN2.6
 *      SWITCH DEP               DEP SW L       J2.JJ   J2.30             IN2.7
 *
 *
 *                               LAMP +5V       J1.RR   J1.36            Vio
 *                                              J1.PP   J1.35            Vio
 *                                              J1.NN   J1.34            Vio
 *                               SWITCH +5V     J2.VV   J2.40            Vio
 *
 *                               GND            J2.SS   J2.37            GND
 *                                              J2.PP   J2.35
 *                                              J2.KK   J2.31
 *                                              J2.FF   J2.28
 *                                              J2.DD   J2.26
 *                               GND            J2.BB   J2.24            GND
 *
 *      - there are 40 LEDs, with 30mA each -> LAMP +5V must drive 1.2A
 *      - LEDs must be switched by low side driver to GND
 *      - the 6 control switches are inverted
 *      - power rotary switch must be in POWER or OFF position for switches to work.
 *
 *      */

panel =
{
        // Name: must match the cpu type in SimH "set cpu <type>" command
        // and is compiled into "realcons.c" panel_controller_descr_tab[] table
	name = "11/40",
	radix = 8, // all numbers octal

	// list of controls
	control =
	{
		// 18 switches, for data and address input
		name = "SR",  // "Switch register"
		type = SWITCH,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			// 18 wires, connected to board 1, input register chips 0, 1 and 2
			register_wiring =
			{
				value_bit_offset = 0, // define bits 0..7 of value
				board = 0x01,
				register = IN0,
				bits = 0..7, // lsb on register = lsb in value!
                                levels = active_high // is default
			}, //
			register_wiring =
			{
				value_bit_offset = 8, // define bits 8..15 of value
				board = 0x01,
				register = IN1,
				bits = 0..7  // lsb on register = lsb in value!
			}, //
			register_wiring =
			{
				value_bit_offset = 16, // define bits 16..17 of value
				board = 0x01,
				register = IN2,
				bits = 0..1// only 2 lsb bits  for addr 16 & 17
			}
		}
	},
	control =
	{
		// 1 wire, connected to board 1, input register 2
		name = "LOAD ADRS",
		type = SWITCH,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = IN2,
				bits = 2,
                                levels = active_low
			}
		}
	},
	control =
	{
		name = "EXAM",
		type = SWITCH,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = IN2,
				bits = 3,
                                levels = active_low
			}
		}
	},
	control =
	{
		name = "CONT",
		type = SWITCH,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = IN2,
				bits = 4,
                                levels = active_low
			}
		}
	},
	control =
	{
		name = "HALT", // required for SimH-REALCONS
		type = SWITCH,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = IN2,
				bits = 5,
                                levels = active_low
			}
		}
	},
	control =
	{
		name = "START",
		type = SWITCH,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = IN2,
				bits = 6,
                                levels = active_low
			}
		}
	},
	control =
	{
		name = "DEPOSIT",
		type = SWITCH,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = IN2,
				bits = 7,
                                levels = active_low
			}
		}
	},
	control =
	{
		// 18 bit
		name = "ADDRESS",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			// 18 wires, connected to board 1, output register chips 0, 1 and 2
			register_wiring =
			{
				value_bit_offset = 0, // define bits 0..7 of value
				board = 0x01,
				register = OUT0,
				bits = 0..7// lsb on register = lsb in value!
			}, //
			register_wiring =
			{
				value_bit_offset = 8, // define bits 8..15 of value
				board = 0x01,
				register = OUT1,
				bits = 0..7 // lsb on register = lsb in value!
			}, //
			register_wiring =
			{
				value_bit_offset = 16, // define bits 16..17 of value
				board = 0x01,
				register = OUT2,
				bits = 0..1 // only 2 lsb bits  for addr 16 & 17
			}
		}
	}, control =
	{
		// 16 bit
		name = "DATA",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			// 16 wires, connected to board 1, output register chips 6 and 7
			register_wiring =
			{
				value_bit_offset = 0, // define bits 0..7 of value
				board = 0x01,
				register = OUT6,
				bits = 0..7 // lsb on register = lsb in value!
			}, //
			register_wiring =
			{
				value_bit_offset = 8, // define bits 8..15 of value
				board = 0x01,
				register = OUT7,
				bits = 0..7// lsb on register = lsb in value!
			}
		}
	}, control =
	{
		name = "RUN",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = OUT2,
				bits = 2
			}
		}
	},
	control =
	{
		name = "BUS",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register =  OUT2,
				bits = 3
			}
		}
	},
	control =
	{
		name = "USER",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register =  OUT2,
				bits = 4
			}
		}
	},
	control =
	{
		name = "PROCESSOR",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register =  OUT2,
				bits = 7
			}
		}
	},
	control =
	{
		name = "CONSOLE",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register =  OUT2,
				bits = 5
			}
		}
	},
	control =
	{
		name = "VIRTUAL",
		type = LAMP,
		encoding = BINARY,
		blinkenbus_wiring =
		{
			register_wiring =
			{
				value_bit_offset = 0,
				board = 0x01,
				register = OUT2,
				bits = 6
			}
		}
	}
};
