diff options
Diffstat (limited to 'c/src/lib/libbsp/powerpc/ppcn_60x/console')
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/config.c | 487 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/console.c | 348 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/console.h | 29 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/debugio.c | 112 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042.c | 1077 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042_p.h | 196 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.c | 46 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.h | 34 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.c | 52 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.h | 54 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/vga.c | 355 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/vga_p.h | 70 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.c | 95 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.h | 63 |
14 files changed, 0 insertions, 3018 deletions
diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/config.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/config.c deleted file mode 100644 index 20841c84af..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/config.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - * This file contains the TTY driver table for the PPCn_60x - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * $Id$ - */ - -#include <libchip/serial.h> -#include <libchip/mc68681.h> -#include <libchip/z85c30.h> -#include "i8042vga.h" - -#include "ns16550cfg.h" -#include "z85c30cfg.h" - -#include <pci.h> - -#define PMX1553_BUS 2 -#define PMX1553_SLOT 1 - -/* - * Based on BSP configuration information decide whether to do polling IO - * or interrupt driven IO. - */ - -#if (CONSOLE_USE_INTERRUPTS) -#define NS16550_FUNCTIONS &ns16550_fns -#define Z85C30_FUNCTIONS &z85c30_fns -#else -#define NS16550_FUNCTIONS &ns16550_fns_polled -#define Z85C30_FUNCTIONS &z85c30_fns_polled -#endif - -/* - * Configuration specific probe routines - */ -static boolean config_PMX1553_probe(int minor); -static boolean config_z85c30_probe(int minor); - -/* - * The following table configures the console drivers used in this BSP. - * - * The first entry which, when probed, is available, will be named /dev/console, - * all others being given the name indicated. - * - * Each field is interpreted thus: - * - * sDeviceName This is the name of the device. - * pDeviceFns This is a pointer to the set of driver routines to use. - * pDeviceFlow This is a pointer to the set of flow control routines to - * use. Serial device drivers will typically supply RTSCTS - * and DTRCTS handshake routines for DCE to DCE communication, - * however for DCE to DTE communication, no such routines - * should be necessary as RTS will be driven automatically - * when the transmitter is active. - * ulMargin The high water mark in the input buffer is set to the buffer - * size less ulMargin. Once this level is reached, the driver's - * flow control routine used to stop the remote transmitter will - * be called. This figure should be greater than or equal to - * the number of stages of FIFO between the transmitter and - * receiver. - * ulHysteresis After the high water mark specified by ulMargin has been - * reached, the driver's routine to re-start the remote - * transmitter will be called once the level in the input - * buffer has fallen by ulHysteresis bytes. - * pDeviceParams This contains either device specific data or a pointer to a - * device specific structure containing additional information - * not provided in this table. - * ulCtrlPort1 This is the primary control port number for the device. This - * may be used to specify different instances of the same device - * type. - * ulCtrlPort2 This is the secondary control port number, of use when a given - * device has more than one available channel. - * ulDataPort This is the port number for the data port of the device - * ulIntVector This encodes the interrupt vector of the device. - * - */ -console_tbl Console_Port_Tbl[] = { - { - "/dev/vga", /* sDeviceName */ - SERIAL_CUSTOM, /* deviceType */ - &i8042vga_fns, /* pDeviceFns */ - NULL, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 0, /* ulMargin */ - 0, /* ulHysteresis */ - (void *)0, /* pDeviceParams */ - I8042_CS, /* ulCtrlPort1 */ - 0, /* ulCtrlPort2 */ - I8042_DATA, /* ulDataPort */ - Read_ns16550_register, /* getRegister */ - Write_ns16550_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* ulClock */ - PPCN_60X_IRQ_KBD /* ulIntVector */ - }, - { - "/dev/com1", /* sDeviceName */ - SERIAL_NS16550, /* deviceType */ - NS16550_FUNCTIONS, /* pDeviceFns */ - NULL, /* deviceProbe */ - &ns16550_flow_RTSCTS, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - NS16550_PORT_A, /* ulCtrlPort1 */ - 0, /* ulCtrlPort2 */ - NS16550_PORT_A, /* ulDataPort */ - Read_ns16550_register, /* getRegister */ - Write_ns16550_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* ulClock */ - PPCN_60X_IRQ_COM1 /* ulIntVector */ - }, - { - "/dev/ser1", /* sDeviceName */ - SERIAL_NS16550, /* deviceType */ - NS16550_FUNCTIONS, /* pDeviceFns */ - config_PMX1553_probe, /* deviceProbe */ - &ns16550_flow_RTSCTS, /* pDeviceFlow */ - 80, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - PMX1553_BUS, /* PCI bus */ /* ulCtrlPort1 */ - PMX1553_SLOT, /* PCI slot */ /* ulCtrlPort2 */ - 1, /* Channel 1-4 */ /* ulDataPort */ - NULL, /* getRegister */ - NULL, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* ulClock */ - 0 /* RS232 */ /* ulIntVector */ - }, - { - "/dev/ser2", /* sDeviceName */ - SERIAL_NS16550, /* deviceType */ - NS16550_FUNCTIONS, /* pDeviceFns */ - config_PMX1553_probe, /* deviceProbe */ - &ns16550_flow_RTSCTS, /* pDeviceFlow */ - 80, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - PMX1553_BUS, /* PCI bus */ /* ulCtrlPort1 */ - PMX1553_SLOT, /* PCI slot */ /* ulCtrlPort2 */ - 2, /* Channel 1-4 */ /* ulDataPort */ - Read_ns16550_register, /* getRegister */ - Write_ns16550_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* ulClock */ - 0 /* RS232 */ /* ulIntVector */ - }, - { - "/dev/ser3", /* sDeviceName */ - SERIAL_NS16550, /* deviceType */ - NS16550_FUNCTIONS, /* pDeviceFns */ - config_PMX1553_probe, /* deviceProbe */ - &ns16550_flow_RTSCTS, /* pDeviceFlow */ - 96, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)57600, /* baud rate */ /* pDeviceParams */ - PMX1553_BUS, /* PCI bus */ /* ulCtrlPort1 */ - PMX1553_SLOT, /* PCI slot */ /* ulCtrlPort2 */ - 3, /* Channel 1-4 */ /* ulDataPort */ - Read_ns16550_register, /* getRegister */ - Write_ns16550_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* ulClock */ - 0 /* RS232 */ /* ulIntVector */ - }, - { - "/dev/ser4", /* sDeviceName */ - SERIAL_NS16550, /* deviceType */ - NS16550_FUNCTIONS, /* pDeviceFns */ - config_PMX1553_probe, /* deviceProbe */ - &ns16550_flow_RTSCTS, /* pDeviceFlow */ - 96, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)57600, /* baud rate */ /* pDeviceParams */ - PMX1553_BUS, /* PCI bus */ /* ulCtrlPort1 */ - PMX1553_SLOT, /* PCI slot */ /* ulCtrlPort2 */ - 4, /* Channel 1-4 */ /* ulDataPort */ - Read_ns16550_register, /* getRegister */ - Write_ns16550_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* ulClock */ - 0 /* RS232 */ /* ulIntVector */ - }, -#if !PPCN_60X_USE_DINK - { - "/dev/com2", /* sDeviceName */ - SERIAL_NS16550, /* deviceType */ - NS16550_FUNCTIONS, /* pDeviceFns */ - NULL, /* deviceProbe */ - &ns16550_flow_RTSCTS, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - NS16550_PORT_B, /* ulCtrlPort1 */ - 0, /* ulCtrlPort2 */ - NS16550_PORT_B, /* ulDataPort */ - Read_ns16550_register, /* getRegister */ - Write_ns16550_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* ulClock */ - PPCN_60X_IRQ_COM2 /* ulIntVector */ - }, -#endif - { - "/dev/com3", /* sDeviceName */ - SERIAL_Z85C30, /* deviceType */ - Z85C30_FUNCTIONS, /* pDeviceFns */ - config_z85c30_probe, /* deviceProbe */ - &z85c30_flow_RTSCTS, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - Z85C30_CTRL_A, /* ulCtrlPort1 */ - Z85C30_CTRL_A, /* ulCtrlPort2 */ - Z85C30_DATA_A, /* ulDataPort */ - Read_85c30_register, /* getRegister */ - Write_85c30_register, /* setRegister */ - Read_85c30_data, /* getData */ - Write_85c30_data, /* setData */ - 0, /* ulClock */ - PPCN_60X_IRQ_COM3_4 /* ulIntVector */ - }, - { - "/dev/com4", /* sDeviceName */ - SERIAL_Z85C30, /* deviceType */ - Z85C30_FUNCTIONS, /* pDeviceFns */ - config_z85c30_probe, /* deviceProbe */ - &z85c30_flow_RTSCTS, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - Z85C30_CTRL_B, /* ulCtrlPort1 */ - Z85C30_CTRL_A, /* ulCtrlPort2 */ - Z85C30_DATA_B, /* ulDataPort */ - Read_85c30_register, /* getRegister */ - Write_85c30_register, /* setRegister */ - Read_85c30_data, /* getData */ - Write_85c30_data, /* setData */ - 0, /* ulClock */ - PPCN_60X_IRQ_COM3_4 /* ulIntVector */ - } -}; - -/* - * Define serial port write registers structure. - */ -typedef volatile struct _SP_WRITE_REGISTERS { - unsigned char TransmitBuffer; - unsigned char InterruptEnable; - unsigned char FifoControl; - unsigned char LineControl; - unsigned char ModemControl; - unsigned char Reserved1; - unsigned char ModemStatus; - unsigned char ScratchPad; -} SP_WRITE_REGISTERS, *PSP_WRITE_REGISTERS; - -static boolean config_PMX1553_probe(int minor) -{ - uint8_t ucBusNumber, ucSlotNumber, ucChannel; - uint8_t ucIntLine; - uint32_t ulPortBase, ulMemBase, ulDeviceID, ulTemp; - uint8_t *pucSIO_cir, *pucUart_int_sr, *pucUartDevIntReg; - PSP_WRITE_REGISTERS pNS16550Write; - - /* - * Extract PCI bus/slot and channel number - */ - ucBusNumber=Console_Port_Tbl[minor].ulCtrlPort1; - ucSlotNumber=Console_Port_Tbl[minor].ulCtrlPort2; - ucChannel=Console_Port_Tbl[minor].ulDataPort; - - PCIConfigRead32(ucBusNumber, - ucSlotNumber, - 0, - PCI_CONFIG_VENDOR_LOW, - &ulDeviceID); - - if(ulDeviceID!=0x000111b5) - { - return FALSE; - } - - /* - * At this point we know we have a PMC1553 or PMX1553 card - * - * Check for PMX1553 uart legacy IO ports - */ - PCIConfigRead32(ucBusNumber, - ucSlotNumber, - 0, - PCI_CONFIG_BAR_3, - &ulPortBase); - - if(ulPortBase==0) - { - /* - * This is either a PMC1553 or we can't see the uart - * registers - */ - return FALSE; - } - - PCIConfigRead32(ucBusNumber, - ucSlotNumber, - 0, - PCI_CONFIG_BAR_2, - &ulMemBase); - - pucUartDevIntReg=(uint8_t*)(PCI_MEM_BASE+ulMemBase); - pucUart_int_sr=(uint8_t*)(PCI_MEM_BASE+ulMemBase+0x10); - pucSIO_cir=(uint8_t*)(PCI_MEM_BASE+ulMemBase+0x18); - - /* - * Use ulIntVector field to select RS232/RS422 - */ - if(Console_Port_Tbl[minor].ulIntVector==0) - { - /* - * Select RS232 mode - */ - *pucSIO_cir&=~(1<<(ucChannel-1)); - } - else - { - /* - * Select RS422 mode - */ - *pucSIO_cir|=1<<(ucChannel-1); - } - EIEIO; - /* - * Bring device out of reset - */ - *pucSIO_cir&=0xbf; - EIEIO; - /* - * Enable all channels as active - */ - *pucSIO_cir|=0x10; - EIEIO; - *pucSIO_cir&=0xdf; - - PCIConfigRead8(ucBusNumber, - ucSlotNumber, - 0, - PCI_CONFIG_INTERRUPTLINE, - &ucIntLine); - - ulPortBase&=~PCI_ADDRESS_IO_SPACE; - - ulPortBase+=8*(ucChannel-1); - - Console_Port_Tbl[minor].ulCtrlPort1= - Console_Port_Tbl[minor].ulDataPort=ulPortBase; - if(Console_Port_Tbl[minor].pDeviceFns!=&ns16550_fns_polled) - { - Console_Port_Tbl[minor].ulIntVector=PPCN_60X_IRQ_PCI(ucIntLine); - - /* - * Enable interrupt - */ - *pucUart_int_sr=(~*pucUart_int_sr)&(0x08<<ucChannel); - - /* - * Enable interrupt to PCI - */ - *pucUartDevIntReg=(~*pucUartDevIntReg)&0x80; - } - else - { - /* - * Disable interrupt - */ - *pucUart_int_sr&=(0x08<<ucChannel); - } - - /* - * Enable Auto CTS to facilitate flow control - */ - pNS16550Write=(PSP_WRITE_REGISTERS)Console_Port_Tbl[minor].ulCtrlPort1; - /* - * Enable special register set and unlock Enhanced Feature Register - */ - outport_byte(&pNS16550Write->LineControl, 0xbf); - /* - * Unlock enhanced function bits - */ - outport_byte(&pNS16550Write->FifoControl, 0x10); - /* - * Disable special register set and lock Enhanced Feature Register - */ - outport_byte(&pNS16550Write->LineControl, 0); - /* - * Select div 1 - */ - outport_byte(&pNS16550Write->ModemControl, 0x00); - /* - * Enable special register set and unlock Enhanced Feature Register - */ - outport_byte(&pNS16550Write->LineControl, 0xbf); - /* - * Lock enhanced function bits and enable auto CTS - */ - outport_byte(&pNS16550Write->FifoControl, 0x80); - /* - * Disable special register set and lock Enhanced Feature Register - */ - outport_byte(&pNS16550Write->LineControl, 0); - - /* - * The PMX1553 currently uses a 16 MHz clock rather than the - * 7.3728 MHz clock described in the ST16C654 data sheet. When - * available, 22.1184 MHz will be used allowing rates up to - * 1382400 baud (RS422 only). - */ - - ulTemp = (uint32_t)Console_Port_Tbl[minor].pDeviceParams; -#if 1 - /* - * Scale requested baud rate for 16 MHz clock - */ - ulTemp *= 7373; - ulTemp /= 16000; -#else - /* - * Scale requested baud rate for 22.1184 MHz clock - */ - ulTemp /= 3; -#endif - - /* - * In order to maintain maximum data rate accuracy, we will - * apply a div 4 here rather than in hardware (using MCR bit 7). - */ - ulTemp /= 4; - - Console_Port_Tbl[minor].pDeviceParams = (void *)ulTemp; - - return(TRUE); -} - -static boolean config_z85c30_probe(int minor) -{ - /* - * PPC1 and PPC1a do not have this device - */ - if((ucSystemType==SYS_TYPE_PPC1) || - (ucSystemType==SYS_TYPE_PPC1a)) - { - return (FALSE); - } - - /* - * All other boards supported by this BSP have the z85c30 device - */ - - /* - * Ensure that CIO port B is configured for - * default driver enable - */ - outport_byte(0x861, 0x33); - - return(TRUE); -} diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/console.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/console.c deleted file mode 100644 index 54b167efc5..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/console.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * This file contains the TTY driver for the PPCn_60x - * - * This driver uses the termios pseudo driver. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#include <bsp.h> -#include <rtems/libio.h> -#include <stdlib.h> -#include <assert.h> -#include <termios.h> - -#include "console.h" - -/* - * Load configuration table - */ -#include "config.c" - -#define NUM_CONSOLE_PORTS (sizeof(Console_Port_Tbl)/sizeof(console_tbl)) - -console_data Console_Port_Data[NUM_CONSOLE_PORTS]; -unsigned long Console_Port_Count; -rtems_device_minor_number Console_Port_Minor; - -/* PAGE - * - * console_open - * - * open a port as a termios console. - * - */ -rtems_device_driver console_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - rtems_status_code status; - rtems_libio_open_close_args_t *args = arg; - rtems_libio_ioctl_args_t IoctlArgs; - struct termios Termios; - rtems_termios_callbacks Callbacks; - console_fns *c; - - /* - * Verify the port number is valid. - */ - if(minor>Console_Port_Count) - { - return RTEMS_INVALID_NUMBER; - } - - /* - * open the port as a termios console driver. - */ - c = Console_Port_Tbl[minor].pDeviceFns; - Callbacks.firstOpen = c->deviceFirstOpen; - Callbacks.lastClose = c->deviceLastClose; - Callbacks.pollRead = c->deviceRead; - Callbacks.write = c->deviceWrite; - Callbacks.setAttributes = c->deviceSetAttributes; - Callbacks.stopRemoteTx = - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx; - Callbacks.startRemoteTx = - Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx; - Callbacks.outputUsesInterrupts = c->deviceOutputUsesInterrupts; - status = rtems_termios_open ( major, minor, arg, &Callbacks); - Console_Port_Data[minor].termios_data = args->iop->data1; - - /* - * Patch in flow control routines - */ -/* XXX */ -#if 0 - if((status==RTEMS_SUCCESSFUL) && - (Console_Port_Tbl[minor].pDeviceFlow)) - { - status=rtems_termios_flow_control( - major, minor, arg, - Console_Port_Tbl[minor].pDeviceFlow-> - deviceStartRemoteTx, - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx, - Console_Port_Tbl[minor].ulMargin, - Console_Port_Tbl[minor].ulHysteresis); - } -#endif - - if(minor!=Console_Port_Minor) - { - /* - * If this is not the console we do not want ECHO and - * so forth - */ - IoctlArgs.iop=args->iop; - IoctlArgs.command=RTEMS_IO_GET_ATTRIBUTES; - IoctlArgs.buffer=&Termios; - rtems_termios_ioctl(&IoctlArgs); - Termios.c_lflag=ICANON; - IoctlArgs.command=RTEMS_IO_SET_ATTRIBUTES; - rtems_termios_ioctl(&IoctlArgs); - } - - if((args->iop->flags&LIBIO_FLAGS_READ) && - Console_Port_Tbl[minor].pDeviceFlow && - Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx) - { - Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx(minor); - } - - return status; -} - -rtems_device_driver console_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - rtems_libio_open_close_args_t *args = arg; - - if((args->iop->flags&LIBIO_FLAGS_READ) && - Console_Port_Tbl[minor].pDeviceFlow && - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) - { - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor); - } - - return rtems_termios_close (arg); -} - -rtems_device_driver console_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return rtems_termios_read (arg); -} - -rtems_device_driver console_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return rtems_termios_write (arg); -} - -rtems_device_driver console_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return rtems_termios_ioctl (arg); -} - -/* PAGE - * - * console_initialize - * - * Routine called to initialize the console device driver. - */ -rtems_device_driver console_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - rtems_status_code status; - - /* - * initialize the termio interface. - */ - rtems_termios_initialize(); - - Console_Port_Count=NUM_CONSOLE_PORTS; - - for(minor=0; - minor<Console_Port_Count; - minor++) - { - /* - * First perform the configuration dependant probe, then the - * device dependant probe - */ - if((!Console_Port_Tbl[minor].deviceProbe || - Console_Port_Tbl[minor].deviceProbe(minor)) && - Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor)) - { - /* - * Use this device for the console - */ - break; - } - } - if(minor==Console_Port_Count) - { - /* - * Failed to find a working device - */ - rtems_fatal_error_occurred(RTEMS_IO_ERROR); - } - - Console_Port_Minor=minor; - - /* - * Register Device Names - */ - status = rtems_io_register_name("/dev/console", - major, - Console_Port_Minor ); - if (status != RTEMS_SUCCESSFUL) - { - rtems_fatal_error_occurred(status); - } - Console_Port_Tbl[minor].pDeviceFns->deviceInitialize( - Console_Port_Minor); - - for(minor++;minor<Console_Port_Count;minor++) - { - /* - * First perform the configuration dependant probe, then the - * device dependant probe - */ - if((!Console_Port_Tbl[minor].deviceProbe || - Console_Port_Tbl[minor].deviceProbe(minor)) && - Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor)) - { - status = rtems_io_register_name( - Console_Port_Tbl[minor].sDeviceName, - major, - minor ); - if (status != RTEMS_SUCCESSFUL) - { - rtems_fatal_error_occurred(status); - } - - /* - * Initialize the hardware device. - */ - Console_Port_Tbl[minor].pDeviceFns->deviceInitialize( - minor); - - } - } - - return RTEMS_SUCCESSFUL; -} - -/* PAGE - * - * DEBUG_puts - * - * This should be safe in the event of an error. It attempts to ensure - * that no TX empty interrupts occur while it is doing polled IO. Then - * it restores the state of that external interrupt. - * - * Input parameters: - * string - pointer to debug output string - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void DEBUG_puts( - char *string -) -{ - char *s; - uint32_t Irql; - - rtems_interrupt_disable(Irql); - - for ( s = string ; *s ; s++ ) - { - Console_Port_Tbl[Console_Port_Minor].pDeviceFns-> - deviceWritePolled(Console_Port_Minor, *s); - } - - rtems_interrupt_enable(Irql); -} - -/* PAGE - * - * DEBUG_puth - * - * This should be safe in the event of an error. It attempts to ensure - * that no TX empty interrupts occur while it is doing polled IO. Then - * it restores the state of that external interrupt. - * - * Input parameters: - * ulHexNum - value to display - * - * Output parameters: NONE - * - * Return values: NONE - */ -void -DEBUG_puth( - uint32_t ulHexNum - ) -{ - unsigned long i,d; - uint32_t Irql; - - rtems_interrupt_disable(Irql); - - Console_Port_Tbl[Console_Port_Minor].pDeviceFns-> - deviceWritePolled(Console_Port_Minor, '0'); - Console_Port_Tbl[Console_Port_Minor].pDeviceFns-> - deviceWritePolled(Console_Port_Minor, 'x'); - - for(i=32;i;) - { - i-=4; - d=(ulHexNum>>i)&0xf; - Console_Port_Tbl[Console_Port_Minor].pDeviceFns-> - deviceWritePolled(Console_Port_Minor, - (d<=9) ? d+'0' : d+'a'-0xa); - } - - rtems_interrupt_enable(Irql); -} diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/console.h b/c/src/lib/libbsp/powerpc/ppcn_60x/console/console.h deleted file mode 100644 index 71affbf65e..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/console.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file contains the TTY driver table definition for the PPCn_60x - * - * This driver uses the termios pseudo driver. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * $Id$ - */ - -#include <rtems/ringbuf.h> -#include <libchip/serial.h> -#include <libchip/ns16550.h> -#include <libchip/z85c30.h> - -extern console_tbl Console_Port_Tbl[]; -extern console_data Console_Port_Data[]; -extern unsigned long Console_Port_Count; diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/debugio.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/debugio.c deleted file mode 100644 index 6b3234ef06..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/debugio.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This file contains the debug IO support. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#include <bsp.h> -#include <rtems/libio.h> -#include <stdlib.h> -#include <assert.h> -#include <termios.h> - -#include <libchip/serial.h> - -/* - * Load configuration table - */ - -extern console_data Console_Port_Data[]; -extern rtems_device_minor_number Console_Port_Minor; - -/* PAGE - * - * DEBUG_puts - * - * This should be safe in the event of an error. It attempts to ensure - * that no TX empty interrupts occur while it is doing polled IO. Then - * it restores the state of that external interrupt. - * - * Input parameters: - * string - pointer to debug output string - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void DEBUG_puts( - char *string -) -{ - char *s; - uint32_t Irql; - - rtems_interrupt_disable(Irql); - - for ( s = string ; *s ; s++ ) { - Console_Port_Tbl[Console_Port_Minor].pDeviceFns-> - deviceWritePolled(Console_Port_Minor, *s); - } - - rtems_interrupt_enable(Irql); -} - -/* PAGE - * - * DEBUG_puth - * - * This should be safe in the event of an error. It attempts to ensure - * that no TX empty interrupts occur while it is doing polled IO. Then - * it restores the state of that external interrupt. - * - * Input parameters: - * ulHexNum - value to display - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void DEBUG_puth( - uint32_t ulHexNum -) -{ - unsigned long i,d; - uint32_t Irql; - void (*poll)(int minor, char cChar); - - poll = Console_Port_Tbl[Console_Port_Minor].pDeviceFns->deviceWritePolled; - - rtems_interrupt_disable(Irql); - - (*poll)(Console_Port_Minor, '0'); - (*poll)(Console_Port_Minor, 'x'); - - for ( i=32 ; i ; ) { - i -= 4; - d = (ulHexNum>>i)&0xf; - (*poll)(Console_Port_Minor, (d<=9) ? d+'0' : d+'a'-0xa); - } - rtems_interrupt_enable(Irql); -} diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042.c deleted file mode 100644 index b148c0f389..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042.c +++ /dev/null @@ -1,1077 +0,0 @@ -/* - * This file contains the PS2 keyboard driver for the i8042 - * - * Note that this driver will only handle a single i8042 device - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * This driver uses the termios pseudo driver. - * - * $Id$ - */ - -#include <rtems.h> -#include <bsp.h> -#include <rtems/libio.h> -#include <libchip/serial.h> -#include <rtems/ringbuf.h> - -#include "console.h" -#include "i8042_p.h" -#include "vga_p.h" - -/* - * UK style keyboard - */ -char pcUKNormalLookup[] = "1234567890-=\b\tqwertyuiop[]\n\0asdfghjkl;\'" - "`\0#zxcvbnm,./\0*\0 \0\0\0\0\0\0\0\0\0\0\0\0" - "\000789-456+1230.\0\0\\"; -char pcUKShiftedLookup[]= "!\"£$%^&*()_+\b\tQWERTYUIOP{}\n\0ASDFGHJKL:" - "@\0\0~ZXCVBNM<>?\0*\0 \0\0\0\0\0\0\0\0\0\0\0" - "\0\000789-456+1230.\0\0|"; -/* - * US style keyboard - */ -char pcUSNormalLookup[] = "1234567890-=\b\tqwertyuiop[]\n\0asdfghjkl;\'" - "`\0\\zxcvbnm,./\0*\0 \0\0\0\0\0\0\0\0\0\0\0" - "\0\000789-456+1230.\0\0\\"; -char pcUSShiftedLookup[]= "!@#$%^&*()_+\b\tQWERTYUIOP{}\n\0ASDFGHJKL:@~" - "\0|ZXCVBNM<>?\0*\0 \0\0\0\0\0\0\0\0\0\0\0\0" - "\000789-456+1230.\0\0|"; - -static char *pcNormalLookup; -static char *pcShiftedLookup; - -/* - * This is exported to vga.c to provide flow control - */ -volatile boolean bScrollLock=FALSE; - -/* - * If multiple devices are to be supported then a private copy of - * the following will be required for each instance - */ -static boolean bCtrlPressed=FALSE; -static boolean bAltPressed=FALSE; -static boolean bAltGrPressed=FALSE; -static boolean bLShiftPressed=FALSE; -static boolean bRShiftPressed=FALSE; -static boolean bCapsLock=FALSE; -static boolean bNumLock=FALSE; -static boolean bTwoCode=FALSE; - -#if CONSOLE_USE_INTERRUPTS -static volatile Ring_buffer_t KbdOutputBuffer; -static volatile boolean bProcessInterruptInput=FALSE; -static boolean bInterruptsEnabled=FALSE; -static volatile boolean bReceivedAck=TRUE; - -static void i8042_process( - int minor -); - -static void i8042_scan_code( - int minor, - uint8_t ucScan -); -#endif - -static volatile Ring_buffer_t KbdInputBuffer; - -/* - * The following routines enable an interrupt driver to switch - * to polled mode as required for command processing - */ -void i8042_polled_on( - int minor -) -{ -#if CONSOLE_USE_INTERRUPTS - bProcessInterruptInput=FALSE; -#endif -} - -void i8042_polled_off( - int minor -) -{ -#if CONSOLE_USE_INTERRUPTS - uint32_t Irql; - uint8_t ucScan; - - /* - * Make sure we have processed everything outstanding - */ - rtems_interrupt_disable(Irql); - while(!Ring_buffer_Is_empty(&KbdInputBuffer)) - { - rtems_interrupt_enable(Irql); - Ring_buffer_Remove_character(&KbdInputBuffer, - ucScan); - i8042_scan_code(minor, ucScan); - rtems_interrupt_disable(Irql); - } - bProcessInterruptInput=TRUE; - rtems_interrupt_enable(Irql); -#endif -} - -/* - * Send data to the keyboard - */ -static rtems_status_code -i8042_outbyte_raw( - int minor, - uint8_t ucData -) -{ - uint32_t i; - uint8_t Status; - -#if CONSOLE_USE_INTERRUPTS - uint32_t Irql; - - if(bInterruptsEnabled) - { - Ring_buffer_Add_character(&KbdOutputBuffer, - ucData); - if(!Console_Port_Data[minor].bActive) - { - /* - * Wake up the device - */ - rtems_interrupt_disable(Irql); - Console_Port_Data[minor].bActive=TRUE; - i8042_process(minor); - rtems_interrupt_enable(Irql); - - } - return RTEMS_SUCCESSFUL; - } -#endif - for (i=0; i<KBD_TIMEOUT; i++) - { - inport_byte(Console_Port_Tbl[minor].ulCtrlPort1, Status); - if((Status & KBD_IBF_MASK)==0) - { - outport_byte(Console_Port_Tbl[minor].ulDataPort, - ucData); - return RTEMS_SUCCESSFUL; - } - } - return RTEMS_TIMEOUT; -} - -/* - * Read data from the keyboard - */ -static rtems_status_code -i8042_inbyte_polled( - int minor, - uint8_t *pucData -) -{ - uint8_t Status; - - inport_byte(Console_Port_Tbl[minor].ulCtrlPort1, Status); - if(Status & KBD_OBF_MASK) - { - inport_byte(Console_Port_Tbl[minor].ulDataPort, - *pucData); - return RTEMS_SUCCESSFUL; - } - return RTEMS_TIMEOUT; -} - -/* - * Blocking read data from the keyboard - */ -static rtems_status_code -i8042_inbyte_raw( - int minor, - uint8_t *pucData -) -{ - int i; - -#if CONSOLE_USE_INTERRUPTS - if(bInterruptsEnabled) - { - i=0; - while(Ring_buffer_Is_empty(&KbdInputBuffer)) - { - rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); - if(i++==KBD_TIMEOUT) - { - return RTEMS_TIMEOUT; - } - } - Ring_buffer_Remove_character(&KbdInputBuffer, - *pucData); - } - else -#endif - { - for (i=0; i<KBD_TIMEOUT; i++) - { - if(i8042_inbyte_polled(minor, pucData)== - RTEMS_SUCCESSFUL) - { - return RTEMS_SUCCESSFUL; - } - /* - * Wait for a character to be recieved - */ - } - - return RTEMS_TIMEOUT; - } - - return RTEMS_SUCCESSFUL; -} - -#if CONSOLE_USE_INTERRUPTS - -/* - * Send a command to the keyboard controller - */ -static rtems_status_code -i8042_outbyte_cmd_polled( - int minor, - uint8_t ucCommand -) -{ - uint32_t i; - uint8_t Status; - - /* - * This routine may be called when no clock driver is available - * so the timeout is dependant on the ISA bus timing used to access - * the i8042 which will not vary (much) across platforms. - */ - for (i=0; i<KBD_TIMEOUT; i++) - { - inport_byte(Console_Port_Tbl[minor].ulCtrlPort1, Status); - if((Status & KBD_IBF_MASK)==0) - { - outport_byte(Console_Port_Tbl[minor].ulCtrlPort1, - ucCommand); - return RTEMS_SUCCESSFUL; - } - } - return RTEMS_TIMEOUT; -} -#endif - -void EnqueueKbdChar( - int minor, - char cChar -) -{ -#if CONSOLE_USE_INTERRUPTS - rtems_termios_enqueue_raw_characters( - Console_Port_Data[minor].termios_data, - &cChar, - 1); -#else - Ring_buffer_Add_character(&KbdInputBuffer, cChar); -#endif -} -/* - * Process second code in a two code sequence - */ -static void i8042_process_two_code( - int minor, - uint8_t ucScan, - boolean bMakenBreak -) -{ - char cASCIICtrlCode; - char cASCIICode; - - cASCIICtrlCode='\0'; - cASCIICode='\0'; - - switch(ucScan) - { - case KEY_ALT: - { - bAltGrPressed=bMakenBreak; - break; - } - - case KEY_CONTROL: - { - bCtrlPressed=bMakenBreak; - break; - } - - case KEY_INSERT: - { - cASCIICtrlCode='@'; - break; - } - - case KEY_DELETE: - { - cASCIICode=ASCII_DEL; - break; - } - - case KEY_LEFT_ARROW: - { - cASCIICtrlCode='D'; - break; - } - - case KEY_HOME: - { - cASCIICtrlCode='H'; - break; - } - - case KEY_END: - { - cASCIICtrlCode='K'; - break; - } - - case KEY_UP_ARROW: - { - cASCIICtrlCode='A'; - break; - } - - case KEY_DOWN_ARROW: - { - cASCIICtrlCode='B'; - break; - } - - case KEY_PAGE_UP: - { - cASCIICtrlCode='?'; - break; - } - - case KEY_PAGE_DOWN: - { - cASCIICtrlCode='/'; - break; - } - - case KEY_RIGHT_ARROW: - { - cASCIICtrlCode='C'; - break; - } - - case KEY_KEYPAD_SLASH: - { - cASCIICode='/'; - break; - } - - case KEY_KEYPAD_ENTER: - { - cASCIICode=ASCII_CR; - break; - } - - case KEY_PRINT_SCREEN: - { - cASCIICode=ASCII_SYSRQ; - break; - } - - default: - { - /* - * Ignore this code - */ - break; - } - } - - if(bMakenBreak && cASCIICode) - { - EnqueueKbdChar(minor, cASCIICode); - } - else if(bMakenBreak && cASCIICtrlCode) - { - EnqueueKbdChar(minor, ASCII_CSI); - EnqueueKbdChar(minor, cASCIICtrlCode); - } -} - -static boolean i8042_process_qualifiers( - uint8_t ucScan, - boolean bMakenBreak -) -{ - boolean bProcessed; - - /* - * Check for scan codes for shift, control, or alt keys. - */ - bProcessed=TRUE; - - switch (ucScan) - { - case KEY_LEFT_SHIFT: - { - bLShiftPressed=bMakenBreak; - break; - } - - case KEY_RIGHT_SHIFT: - { - bRShiftPressed=bMakenBreak; - break; - } - - case KEY_CONTROL: - { - bCtrlPressed=bMakenBreak; - break; - } - - case KEY_ALT: - { - bAltPressed=bMakenBreak; - break; - } - - default: - { - /* - * Something else needs to process this code - */ - bProcessed=FALSE; - break; - } - } - - return(bProcessed); -} - -static boolean i8042_process_top_row( - int minor, - uint8_t ucScan -) -{ - boolean bProcessed; - char cASCIIFnCode; -#if CONSOLE_USE_INTERRUPTS==0 - uint8_t ucKeyboardAck; -#endif - - /* - * Check for keys on the top row - */ - bProcessed=TRUE; - cASCIIFnCode='\0'; - - switch (ucScan) - { - case KEY_ESC: - { - EnqueueKbdChar(minor, ASCII_ESC); - break; - } - - case KEY_F1: - { - cASCIIFnCode='P'; - break; - } - - case KEY_F2: - { - cASCIIFnCode='Q'; - break; - } - - case KEY_F3: - { - cASCIIFnCode='w'; - break; - } - - case KEY_F4: - { - cASCIIFnCode='x'; - break; - } - - case KEY_F5: - { - cASCIIFnCode='t'; - break; - } - - case KEY_F6: - { - cASCIIFnCode='u'; - break; - } - - case KEY_F7: - { - cASCIIFnCode='q'; - break; - } - - case KEY_F8: - { - cASCIIFnCode='r'; - break; - } - - case KEY_F9: - { - cASCIIFnCode='p'; - break; - } - - case KEY_F10: - { - cASCIIFnCode='M'; - break; - } - - case KEY_F11: - { - cASCIIFnCode='A'; - break; - } - - case KEY_F12: - { - cASCIIFnCode='B'; - break; - } - - case KEY_SYS_REQUEST: - { - EnqueueKbdChar(minor, ASCII_SYSRQ); - break; - } - - case KEY_CAPS_LOCK: - case KEY_NUM_LOCK: - case KEY_SCROLL_LOCK: - { - switch(ucScan) - { - case KEY_CAPS_LOCK: - { - bCapsLock=!bCapsLock; - break; - } - - case KEY_NUM_LOCK: - { - bNumLock=!bNumLock; - break; - } - - case KEY_SCROLL_LOCK: - { -#if CONSOLE_USE_INTERRUPTS - bScrollLock=!bScrollLock; -#endif - break; - } - } - - i8042_outbyte_raw(minor, KBD_CMD_SET_LEDS); -#if CONSOLE_USE_INTERRUPTS==0 - i8042_inbyte_raw(minor, &ucKeyboardAck); -#endif - i8042_outbyte_raw(minor, - (bCapsLock ? KBD_LED_CAPS : 0) | - (bNumLock ? KBD_LED_NUM : 0) | - (bScrollLock ? KBD_LED_SCROLL : 0)); -#if CONSOLE_USE_INTERRUPTS==0 - i8042_inbyte_raw(minor, &ucKeyboardAck); -#endif - - break; - } - - default: - { - /* - * Something else needs to process this code - */ - bProcessed=FALSE; - break; - } - } - - if(cASCIIFnCode) - { - EnqueueKbdChar(minor, ASCII_CSI); - EnqueueKbdChar(minor, 'O'); - EnqueueKbdChar(minor, cASCIIFnCode); - } - - return(bProcessed); -} - -static boolean i8042_process_keypad( - int minor, - uint8_t ucScan -) -{ - char cASCIICtrlCode; - - /* - * Process keys on the keypad - */ - cASCIICtrlCode='\0'; - - switch(ucScan) - { - case KEY_UP_ARROW: - { - cASCIICtrlCode='A'; - break; - } - - case KEY_DOWN_ARROW: - { - cASCIICtrlCode='B'; - break; - } - - case KEY_RIGHT_ARROW: - { - cASCIICtrlCode='C'; - break; - } - - case KEY_LEFT_ARROW: - { - cASCIICtrlCode='D'; - break; - } - - case KEY_HOME: - { - cASCIICtrlCode='H'; - break; - } - - case KEY_END: - { - cASCIICtrlCode='K'; - break; - } - - case KEY_PAGE_UP: - { - cASCIICtrlCode='?'; - break; - } - - case KEY_PAGE_DOWN: - { - cASCIICtrlCode='/'; - break; - } - - case KEY_INSERT: - { - cASCIICtrlCode='@'; - break; - } - - case KEY_DELETE: - { - /* - * This is a special case not requiring an ASCII_CSI - */ - EnqueueKbdChar(minor, ASCII_DEL); - return(TRUE); - } - - default: - { - /* - * Something else needs to process this code - */ - break; - } - } - - if(cASCIICtrlCode) - { - EnqueueKbdChar(minor, ASCII_CSI); - EnqueueKbdChar(minor, cASCIICtrlCode); - return(TRUE); - } - else - { - return(FALSE); - } -} - -/* - * This routine translates the keyboard scan code into an - * ASCII character (or sequence) and queues it - */ -static void i8042_scan_code( - int minor, - uint8_t ucScan -) -{ - char cChar; - boolean bMakenBreak; - - /* - * Check for code 0xe0, which introduces a two key sequence. - */ - - if(ucScan==KEY_TWO_KEY) - { - bTwoCode=TRUE; - return; - } - - /* - * Bit 7 of scan code indicates make or break - */ - if(ucScan & 0x80) - { - bMakenBreak=FALSE; - ucScan&=0x7f; - } - else - { - bMakenBreak=TRUE; - } - - /* - * If we are in a multikey sequence then process the second keypress - */ - if(bTwoCode) - { - i8042_process_two_code(minor, ucScan, bMakenBreak); - - /* - * Revert to prcessing single key sequences - */ - bTwoCode=FALSE; - return; - } - - if(i8042_process_qualifiers(ucScan, bMakenBreak)) - { - /* - * We are all done - */ - return; - } - - /* - * The remaining keys are only processed for make - */ - if(!bMakenBreak) - { - return; - } - - if(i8042_process_top_row(minor, ucScan)) - { - /* - * We are all done - */ - return; - } - - if(!bNumLock && i8042_process_keypad(minor, ucScan)) - { - /* - * We are all done - */ - return; - } - - /* - * Process "normal" keys - */ - - cChar=0; - - /* - * Check to see if the scan code corresponds to an ASCII - * character. - */ - if(((ucScan >= 16) && (ucScan <= 25)) || - ((ucScan >= 30) && (ucScan <= 38)) || - ((ucScan >= 44) && (ucScan <= 50))) - { - if(bCtrlPressed) - { - cChar=pcNormalLookup[ucScan - 2]-'a'+1; - } - else - { - if(((bLShiftPressed || bRShiftPressed) && !bCapsLock) || - (!(bLShiftPressed || bRShiftPressed) && bCapsLock)) - { - cChar=pcShiftedLookup[ucScan - 2]; - } - else - { - cChar=pcNormalLookup[ucScan - 2]; - } - } - } - else if((ucScan > 1) && (ucScan <= 0x56)) - { - /* - * Its ASCII but not alpha, so don't shift on CapsLock. - */ - if(bLShiftPressed || bRShiftPressed) - { - cChar=pcShiftedLookup[ucScan - 2]; - } - else - { - cChar=pcNormalLookup[ucScan - 2]; - } - } - - /* - * If we got a character then queue it - */ - if(cChar) - { - EnqueueKbdChar(minor, cChar); - } -} - -/* - * Console Device Driver Entry Points - */ -boolean i8042_probe(int minor) -{ - uint8_t ucKeyboardAck; - uint8_t ucKeyboardID1, ucKeyboardID2; - - if(!vga_probe(minor)) - { - /* - * There is no VGA adaptor so fail probe - */ - return(FALSE); - } - - Ring_buffer_Initialize(&KbdInputBuffer); -#if CONSOLE_USE_INTERRUPTS - Ring_buffer_Initialize(&KbdOutputBuffer); -#endif - - i8042_polled_on(minor); - /* - * Determine keyboard type - */ - i8042_outbyte_raw(minor, KBD_CMD_READ_ID); - ucKeyboardAck=0; - if((i8042_inbyte_raw(minor, &ucKeyboardAck)==RTEMS_TIMEOUT) || - (ucKeyboardAck==KBD_CMD_RESEND)) - { - /* - * No or incorrect keyboard response so fail probe - */ - return(FALSE); - } - - i8042_inbyte_raw(minor, &ucKeyboardID1); - i8042_inbyte_raw(minor, &ucKeyboardID2); - if((ucKeyboardID1==0xab) && (ucKeyboardID2==0x41)) - { - pcNormalLookup=&pcUKNormalLookup[0]; - pcShiftedLookup=&pcUKShiftedLookup[0]; - } - else - { - pcNormalLookup=&pcUSNormalLookup[0]; - pcShiftedLookup=&pcUSShiftedLookup[0]; - } - i8042_polled_off(minor); - - return(TRUE); -} - -void i8042_init(int minor) -{ - uint8_t ucKeyboardAck; - - vga_init(minor); - - i8042_polled_on(minor); - /* - * Switch all LEDs off - */ - i8042_outbyte_raw(minor, KBD_CMD_SET_LEDS); - i8042_inbyte_raw(minor, &ucKeyboardAck); - i8042_outbyte_raw(minor, 0); - i8042_inbyte_raw(minor, &ucKeyboardAck); - /* - * Select scan code set 1 - */ - i8042_outbyte_raw(minor, KBD_CMD_SEL_SCAN_CODE); - i8042_inbyte_raw(minor, &ucKeyboardAck); - i8042_outbyte_raw(minor, 1); - i8042_inbyte_raw(minor, &ucKeyboardAck); - i8042_polled_off(minor); -} - -/* PAGE - * - * i8042_inbyte_nonblocking_polled - * - * Console Termios polling input entry point. - */ - -int i8042_inbyte_nonblocking_polled( - int minor -) -{ - uint8_t ucScan; - char ucData; - - if(i8042_inbyte_polled(minor, &ucScan)==RTEMS_SUCCESSFUL) - { - i8042_scan_code(minor, ucScan); - } - - if(!Ring_buffer_Is_empty(&KbdInputBuffer)) - { - Ring_buffer_Remove_character(&KbdInputBuffer, - ucData); - return(ucData); - } - - return(-1); -} - -#if CONSOLE_USE_INTERRUPTS -/* - * i8042_isr - * - * This routine is the console interrupt handler for the keyboard - * - * Input parameters: - * vector - vector number - * - * Output parameters: NONE - * - * Return values: NONE - */ -static void i8042_process( - int minor -) -{ - uint8_t Status; - uint8_t ucData; - - inport_byte(Console_Port_Tbl[minor].ulCtrlPort1, Status); - - if(Status & KBD_OBF_MASK) - { - inport_byte(Console_Port_Tbl[minor].ulDataPort, ucData); - - if(bProcessInterruptInput) - { - /* - * Every byte written to the keyboard should be followed - * by an acknowledge - */ - if(ucData==KBD_CMD_ACK) - { - bReceivedAck=TRUE; - } - else - { - i8042_scan_code(minor, ucData); - } - } - else - { - /* - * Store the scan code into the ring buffer where it - * can be read using i8042_inbyte_raw() - */ - Ring_buffer_Add_character(&KbdInputBuffer, ucData); - } - } - - if(((Status & KBD_IBF_MASK)==0) && - bReceivedAck) - { - if(Ring_buffer_Is_empty(&KbdOutputBuffer)) - { - Console_Port_Data[minor].bActive=FALSE; - } - else - { - Ring_buffer_Remove_character(&KbdOutputBuffer, - ucData); - outport_byte(Console_Port_Tbl[minor].ulDataPort, - ucData); - bReceivedAck=FALSE; - } - } -} - -static rtems_isr i8042_isr( - rtems_vector_number vector -) -{ - int minor; - - for(minor=0;minor<Console_Port_Count;minor++) - { - if(vector==Console_Port_Tbl[minor].ulIntVector) - { - i8042_process(minor); - } - } -} - -void i8042_initialize_interrupts(int minor) -{ - i8042_init(minor); - - Console_Port_Data[minor].bActive=FALSE; - - set_vector(i8042_isr, - Console_Port_Tbl[minor].ulIntVector, - 1); - - i8042_outbyte_cmd_polled(minor, KBD_CTR_WRITE_COMMAND); - i8042_outbyte_raw(minor, KBD_CMD_ENABLE_KBD_INT); - - /* - * At this point interrupts should spring into life - */ - bInterruptsEnabled=TRUE; -} - -#endif /* CONSOLE_USE_INTERRUPTS */ diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042_p.h b/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042_p.h deleted file mode 100644 index 544b4ef944..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042_p.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - */ - -#ifndef _I8042_P_H_ -#define _I8042_P_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define KBD_CTR_WRITE_COMMAND 0x60 -#define KBD_CTR_READ_COMMAND 0x20 -#define KBD_CTR_TEST_PASSWORD 0xA4 -#define KBD_CTR_LOAD_PASSWORD 0xA5 -#define KBD_CTR_ENABLE_PASSWORD 0xA6 -#define KBD_CTR_DISABLE_AUX 0xA7 -#define KBD_CTR_ENABLE_AUX 0xA8 -#define KBD_CTR_AUXLINES_TEST 0xA9 -#define KBD_CTR_SELFTEST 0xAA -#define KBD_CTR_KBDLINES_TEST 0xAB -#define KBD_CTR_DISABLE_KBD 0xAD -#define KBD_CTR_ENABLE_KBD 0xAE -#define KBD_CTR_WRITE_AUX 0xD4 -#define KBD_CTR_READ_REV 0xD5 -#define KBD_CTR_READ_VER 0xD6 -#define KBD_CTR_READ_MODEL 0xD7 - -/* Keyboard Controller Data */ -#define KBD_CTR_SELFTEST_PASSED 0x55 -#define KBD_CTR_PASSWORD_INSTALLED 0xFA -#define KBD_CTR_PASSWORD_NOT_INSTALLED 0xF1 - -/* Controller Command Byte bit definitions. */ -#define KBD_CMD_BYTE_DISABLE_AUX 0x20 -#define KBD_CMD_BYTE_DISABLE_KBD 0x10 -#define KBD_CMD_ENABLE_AUX_INT 0x02 -#define KBD_CMD_ENABLE_KBD_INT 0x01 - -/* Keyboard Controller Status byte masks */ -#define KBD_OBF_MASK 0x1 /* Output buffer full */ -#define KBD_IBF_MASK 0x2 /* Input buffer full */ -#define KBD_FROM_AUX_MASK 0x20 /* Byte from Aux Port. */ - -/* Interface Test Results */ -#define INTERFACE_NO_ERROR 0x00 -#define CLOCK_STUCK_LOW 0x01 -#define CLOCK_STUCK_HIGH 0x02 -#define DATA_STUCK_LOW 0x03 -#define DATA_STUCK_HIGH 0x04 - -/* Timeout */ -#define KBD_TIMEOUT 500000 /* Effectively ISA read access times */ - -/* Keyboard Commands */ -#define KBD_CMD_SET_LEDS 0xed /* Set/Reset LEDs */ -#define KBD_CMD_ECHO 0xee /* request keyboard echo resp. "EE" */ -#define KBD_CMD_SEL_SCAN_CODE 0xf0 /* Scan codes 1,2,3 or 0 = rquest current. */ -#define KBD_CMD_READ_ID 0xf2 /* Request for two byte response */ -#define KBD_CMD_SET_RATE 0xf3 /* Set tellematic Rate */ -#define KBD_CMD_ENABLE 0xf4 /* Clears Buffer and Starts Scanning. */ -#define KBD_CMD_DISABLE 0xf5 /* reset to power up */ - -#define KBD_CMD_SET_DEFAULT 0xf6 -#define KBD_CMD_SET_ALL_TLMTIC 0xf7 /* Set all keys telematic */ -#define KBD_CMD_SET_ALL_MKBR 0xf8 /* Set all keys Make /Break */ -#define KBD_CMD_SET_ALL_MAKE 0xf9 /* Set all keys Make only */ -#define KBD_CMD_SET_KEY_TLMTIC 0xfb /* Set individual key telemativ */ -#define KBD_CMD_SET_KEY_MKBR 0xfc /* set individual key make/break */ -#define KBD_CMD_SET_KEY_MK 0xfd /* set individual key make only */ -#define KBD_CMD_RESEND 0xfe /* request to resend last transfer */ -#define KBD_CMD_RESET 0xff /* request to start a program reset */ -#define KBD_CMD_ACK 0xfa /* keyboard ack after reset */ -#define KBD_CMD_BAT 0xaa /* Keyboard Bat completion Response */ - -/* - * Define LED encodings for use with the KbdSetLEDs command - */ -#define KBD_LED_CAPS 0x04 -#define KBD_LED_NUM 0x02 -#define KBD_LED_SCROLL 0x01 - -/* - * Define two code scan codes in keycode order - */ -#define KEY_TWO_KEY 0xe0 -#define KEY_ALT 0x38 -#define KEY_CONTROL 0x1d -#define KEY_INSERT 0x52 -#define KEY_DELETE 0x53 -#define KEY_LEFT_ARROW 0x4b -#define KEY_HOME 0x47 -#define KEY_END 0x4F -#define KEY_UP_ARROW 0x48 -#define KEY_DOWN_ARROW 0x50 -#define KEY_PAGE_UP 0x49 -#define KEY_PAGE_DOWN 0x51 -#define KEY_RIGHT_ARROW 0x4d -#define KEY_KEYPAD_SLASH 0x35 -#define KEY_KEYPAD_ENTER 0x1c -#define KEY_SYS_REQUEST 0x2a -#define KEY_PRINT_SCREEN 0x37 - -#define KEY_LEFT_SHIFT 0x2a -#define KEY_RIGHT_SHIFT 0x36 -#define KEY_TAB 0x0f -#define KEY_CAPS_LOCK 0x3a -#define KEY_NUM_LOCK 0x45 -#define KEY_SCROLL_LOCK 0x46 -#define KEY_ESC 0x01 -#define KEY_F1 0x3b -#define KEY_F2 0x3c -#define KEY_F3 0x3d -#define KEY_F4 0x3e -#define KEY_F5 0x3f -#define KEY_F6 0x40 -#define KEY_F7 0x41 -#define KEY_F8 0x42 -#define KEY_F9 0x43 -#define KEY_F10 0x44 -#define KEY_F11 0x57 -#define KEY_F12 0x58 - -/* - * ASCII control codes - */ -#define ASCII_NUL 0x00 -#define ASCII_SOH 0x01 -#define ASCII_STX 0x02 -#define ASCII_ETX 0x03 -#define ASCII_EOT 0x04 -#define ASCII_ENQ 0x05 -#define ASCII_ACK 0x06 -#define ASCII_BEL 0x07 -#define ASCII_BS 0x08 -#define ASCII_HT 0x09 -#define ASCII_LF 0x0a -#define ASCII_VT 0x0b -#define ASCII_FF 0x0c -#define ASCII_CR 0x0d -#define ASCII_SO 0x0e -#define ASCII_SI 0x0f -#define ASCII_DLE 0x10 -#define ASCII_XON 0x11 -#define ASCII_DC1 0x11 -#define ASCII_DC2 0x12 -#define ASCII_XOFF 0x13 -#define ASCII_DC3 0x13 -#define ASCII_DC4 0x14 -#define ASCII_NAK 0x15 -#define ASCII_SYN 0x16 -#define ASCII_ETB 0x17 -#define ASCII_CAN 0x18 -#define ASCII_EM 0x19 -#define ASCII_SUB 0x1a -#define ASCII_ESC 0x1b -#define ASCII_FS 0x1c -#define ASCII_GS 0x1d -#define ASCII_RS 0x1e -#define ASCII_US 0x1f -#define ASCII_DEL 0x7f -#define ASCII_SYSRQ 0x80 -#define ASCII_CSI 0x9b - -/* - * Exported functions - */ -extern boolean i8042_probe(int minor); - -extern void i8042_init(int minor); -#if CONSOLE_USE_INTERRUPTS -extern void i8042_initialize_interrupts(int minor); - -#else -extern int i8042_inbyte_nonblocking_polled( - int minor -); -#endif /* CONSOLE_USE_INTERRUPTS */ - -#ifdef __cplusplus -} -#endif - -#endif /* _I8042_P_H_ */ diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.c deleted file mode 100644 index 59716da49a..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file contains the TTY driver for the VGA/i8042 console - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * This driver uses the termios pseudo driver. - * - * $Id$ - */ - -#include <rtems.h> -#include <bsp.h> -#include <rtems/libio.h> - -#include "console.h" -#include "vga_p.h" -#include "i8042_p.h" - -console_fns i8042vga_fns = -{ - i8042_probe, /* deviceProbe */ - NULL, /* deviceFirstOpen */ - NULL, /* deviceLastClose */ -#if CONSOLE_USE_INTERRUPTS - NULL, /* deviceRead */ - vga_write_support, /* deviceWrite */ - i8042_initialize_interrupts, /* deviceInitialize */ -#else - i8042_inbyte_nonblocking_polled, /* deviceRead */ - vga_write_support, /* deviceWrite */ - i8042_init, /* deviceInitialize */ -#endif - vga_write, /* deviceWritePolled */ - FALSE, /* deviceOutputUsesInterrupts */ -}; diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.h b/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.h deleted file mode 100644 index 6cbceb92de..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/i8042vga.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * $Id$ - */ - -#ifndef _I8042VGA_H_ -#define _I8042VGA_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Driver function table - */ -extern console_fns i8042vga_fns; - -#ifdef __cplusplus -} -#endif - -#endif /* _I8042VGA_H_ */ diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.c deleted file mode 100644 index e28d02c078..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.c +++ /dev/null @@ -1,52 +0,0 @@ -/* nc16550cfg.c - * - * This include file contains all console driver definations for the nc16550 - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#include <rtems.h> -#include <bsp.h> - -uint8_t Read_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum -) -{ - unsigned char *p = (unsigned char *)ulCtrlPort; - unsigned char ucData; - - inport_byte( &p[ucRegNum], ucData ); - return ucData; -} - -void Write_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum, - uint8_t ucData -) -{ - unsigned char *p = (unsigned char *)ulCtrlPort; - - outport_byte( &p[ucRegNum], ucData ); -} diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.h b/c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.h deleted file mode 100644 index e30e08ab63..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550cfg.h +++ /dev/null @@ -1,54 +0,0 @@ -/* nc16550cfg.h - * - * This include file contains all console driver definations for the nc16550 - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#ifndef __NS16550_CONFIG_H -#define __NS16550_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Board specific register access routines - */ - -uint8_t Read_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum -); - -void Write_ns16550_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum, - uint8_t ucData -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/vga.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/vga.c deleted file mode 100644 index 16b30e1eda..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/vga.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - * This file contains the TTY driver for VGA - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * This driver uses the termios pseudo driver. - */ -/*-------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on: -| outch.c,v 1.4 1995/12/19 20:07:27 joel Exp - go32 BSP -| With the following copyright notice: -| ************************************************************************** -| * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. * -| * On-Line Applications Research Corporation (OAR). * -| ************************************************************************** -+--------------------------------------------------------------------------*/ - -#include <bsp.h> - -#include <stdlib.h> -#include <string.h> - -#include "vga_p.h" - -/*-------------------------------------------------------------------------+ -| Constants -+--------------------------------------------------------------------------*/ -#define DISPLAY_CELL_COUNT (VGA_NUM_ROWS * VGA_NUM_COLS) - /* Number of display cells. */ -#define TABSIZE 4 /* Number of spaces for TAB (\t) char. */ -#define WHITE 0x0007 /* White on Black background colour. */ -#define BLANK (WHITE | (' '<<8)) /* Blank character. */ - -/* - * This is imported from i8042.c to provide flow control - */ -extern volatile boolean bScrollLock; - -/*-------------------------------------------------------------------------+ -| Global Variables -+--------------------------------------------------------------------------*/ -/* Physical address of start of video text memory. */ -static uint16_t *videoRam = (uint16_t*)VGA_FB; -/* Pointer for current output position in display. */ -static uint16_t *videoRamPtr = (uint16_t*)VGA_FB; -static uint8_t videoRows = VGA_NUM_ROWS; /* Number of rows in display. */ -static uint8_t videoCols = VGA_NUM_COLS; /* Number of columns in display. */ -static uint8_t cursRow = 0; /* Current cursor row. */ -static uint8_t cursCol = 0; /* Current cursor column. */ - -/*-------------------------------------------------------------------------+ -| Function: setHardwareCursorPos -| Description: Set hardware video cursor at given offset into video RAM. -| Global Variables: None. -| Arguments: videoCursor - Offset into video memory. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static inline void -setHardwareCursorPos(uint16_t videoCursor) -{ - VGA_WRITE_CRTC(0x0e, (videoCursor >> 8) & 0xff); - VGA_WRITE_CRTC(0x0f, videoCursor & 0xff); -} /* setHardwareCursorPos */ - -/*-------------------------------------------------------------------------+ -| Function: updateVideoRamPtr -| Description: Updates value of global variable "videoRamPtr" based on -| current window's cursor position. -| Global Variables: videoRamPtr, cursRow, cursCol. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static inline void -updateVideoRamPtr(void) -{ - videoRamPtr = videoRam + cursRow * videoCols + cursCol; -} /* updateVideoRamPtr */ - -/*-------------------------------------------------------------------------+ -| Function: scrollUp -| Description: Scrolls display up n lines. -| Global Variables: None. -| Arguments: lines - number of lines to scroll. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static void -scrollUp(uint8_t lines) -{ - /* Number of blank display cells on bottom of window. */ - uint16_t blankCount; - - /* Source and destination pointers for memory copy operations. */ - uint16_t *ptrDst, *ptrSrc; - - if(lines<videoRows) /* Move window's contents up. */ - { - /* - * Number of non-blank cells on upper part - * of display (total - blank). - */ - uint16_t nonBlankCount; - - blankCount = lines * videoCols; - nonBlankCount = DISPLAY_CELL_COUNT - blankCount; - ptrSrc = videoRam + blankCount; - ptrDst = videoRam; - - while(nonBlankCount--) - { - *ptrDst++ = *ptrSrc++; - } - } - else - { - /* - * Clear the whole display. - */ - blankCount = DISPLAY_CELL_COUNT; - ptrDst = videoRam; - } - - /* Fill bottom with blanks. */ - while (blankCount-->0) - { - *ptrDst++ = BLANK; - } -} /* scrollUp */ - -/*-------------------------------------------------------------------------+ -| Function: printCHAR -| Description: Print printable character to display. -| Global Variables: videoRamPtr, cursRow, cursCol. -| Arguments: c - character to write to display. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static void -printCHAR(char c) -{ - *videoRamPtr++ = (c<<8) | WHITE; - cursCol++; - if(cursCol==videoCols) - { - cursCol = 0; - cursRow++; - if(cursRow==videoRows) - { - cursRow--; - scrollUp(1); - videoRamPtr -= videoCols; - } - } -} /* printCHAR */ - -/*-------------------------------------------------------------------------+ -| Function: printBS -| Description: Print BS (BackSpace - '\b') character to display. -| Global Variables: videoRamPtr, cursRow, cursCol. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static inline void -printBS(void) -{ - /* Move cursor back one cell. */ - if(cursCol>0) - { - cursCol--; - } - else if(cursRow>0) - { - cursRow--; - cursCol = videoCols - 1; - } - else - { - return; - } - - /* Write a whitespace. */ - *(--videoRamPtr) = BLANK; -} /* printBS */ - -/*-------------------------------------------------------------------------+ -| Function: printHT -| Description: Print HT (Horizontal Tab - '\t') character to display. -| Global Variables: cursCol. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static inline void -printHT(void) -{ - do - { - printCHAR(' '); - } - while (cursCol % TABSIZE); -} /* printHT */ - -/*-------------------------------------------------------------------------+ -| Function: printLF -| Description: Print LF (Line Feed - '\n') character to display. -| Global Variables: cursRow. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static inline void -printLF(void) -{ - cursRow++; - if(cursRow==videoRows) - { - cursRow--; - scrollUp(1); - } - updateVideoRamPtr(); -} /* printLF */ - -/*-------------------------------------------------------------------------+ -| Function: printCR -| Description: Print CR (Carriage Return - '\r') to display. -| Global Variables: cursCol. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static inline void -printCR(void) -{ - cursCol = 0; - updateVideoRamPtr(); -} /* printCR */ - -/* - * Console Device Driver Entry Points - */ -void -vga_write( - int minor, - char cChar) -{ - switch (cChar) - { - case '\b': - printBS(); - break; - case '\t': - printHT(); - break; - case '\n': - printLF(); - break; - case '\r': - printCR(); - break; - default: - printCHAR(cChar); - break; - } - - setHardwareCursorPos(videoRamPtr - videoRam); -} /* vga_write */ - -/* - * vga_write_support - * - * Console Termios output entry point. - * - */ -int vga_write_support( - int minor, - const char *buf, - int len -) -{ - int nwrite = 0; - - while(bScrollLock) - { - /* - * The Scroll lock on the keyboard is active - */ - /* - * Yield while we wait - */ - rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); - } - - /* - * Write each byte in the string to the display - */ - while (nwrite<len) - { - /* - * transmit character - */ - vga_write(minor, *buf++); - nwrite++; - } - - /* - * return the number of bytes written. - */ - return nwrite; -} - -boolean vga_probe(int minor) -{ - uint8_t ucMiscIn; - - /* - * Check for presence of VGA adaptor - */ - inport_byte(0x3cc, ucMiscIn); - if(ucMiscIn!=0xff) - { - /* - * VGA device is present - */ - return(TRUE); - } - return(FALSE); -} - -void vga_init(int minor) -{ - scrollUp(videoRows); /* Clear entire screen */ - setHardwareCursorPos(0); /* Cursor at upper left corner */ - /* - * Enable the cursor - */ - VGA_WRITE_CRTC(0x0a, 0x0e); /* Crt cursor start */ -} diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/vga_p.h b/c/src/lib/libbsp/powerpc/ppcn_60x/console/vga_p.h deleted file mode 100644 index 8541951bd0..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/vga_p.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - */ - -#ifndef _VGA_P_H_ -#define _VGA_P_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define VGA_FB ((uint32_t)PCI_MEM_BASE+0xb8000) -#define VGA_NUM_ROWS 25 -#define VGA_NUM_COLS 80 - -#define VGA_WRITE_SEQ(reg, val) \ - outport_byte(0x3c4, reg); \ - outport_byte(0x3c5, val) -#define VGA_READ_SEQ(reg, val) \ - outport_byte(0x3c4, reg); \ - inport_byte(0x3c5, val) -#define VGA_WRITE_CRTC(reg, val) \ - outport_byte(0x3d4, reg); \ - outport_byte(0x3d5, val) -#define VGA_WRITE_GRA(reg, val) \ - outport_byte(0x3ce, reg); \ - outport_byte(0x3cf, val) -#define VGA_WRITE_ATT(reg, val) \ - { \ - volatile uint8_t ucDummy; \ - inport_byte(0x3da, ucDummy); \ - outport_byte(0x3c0, reg); \ - outport_byte(0x3c0, val); \ - } - -/* - * Exported functions - */ -extern boolean vga_probe(int minor); - -extern void vga_init(int minor); - -extern void vga_write( - int minor, - char cChar -); - -extern int vga_write_support( - int minor, - const char *buf, - int len -); - -#ifdef __cplusplus -} -#endif - -#endif /* _VGA_P_H_ */ diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.c b/c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.c deleted file mode 100644 index 5072a91b29..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This file contains the console driver chip level routines for the - * z85c30 chip. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#include <rtems.h> -#include <bsp.h> - -/* - * Read_85c30_register - * - * Read a Z85c30 register - */ - -uint8_t Read_85c30_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum -) -{ - uint8_t ucData; - - outport_byte(ulCtrlPort, ucRegNum); - inport_byte(ulCtrlPort, ucData); - return ucData; -} - -/* - * Write_85c30_register - * - * Write a Z85c30 register - */ - -void Write_85c30_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum, - uint8_t ucData -) -{ - if(ucRegNum) { - outport_byte(ulCtrlPort, ucRegNum); - } - outport_byte(ulCtrlPort, ucData); -} - -/* - * Read_85c30_data - * - * Read a Z85c30 data register - */ - -uint8_t Read_85c30_data( - uint32_t ulDataPort -) -{ - uint8_t ucData; - - inport_byte(ulDataPort, ucData); - return ucData; -} - -/* - * Write_85c30_data - * - * Write a Z85c30 data register - */ - -void Write_85c30_data( - uint32_t ulDataPort, - uint8_t ucData -) -{ - outport_byte(ulDataPort, ucData); -} diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.h b/c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.h deleted file mode 100644 index 0b5a6383f9..0000000000 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/console/z85c30cfg.h +++ /dev/null @@ -1,63 +0,0 @@ -/* z85c30cfg.h - * - * This include file contains all console driver definations for the z85c30 - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#ifndef __Z85C30_CONFIG_H -#define __Z85C30_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Board specific register access routines - */ - -uint8_t Read_85c30_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum -); - -void Write_85c30_register( - uint32_t ulCtrlPort, - uint8_t ucRegNum, - uint8_t ucData -); - -uint8_t Read_85c30_data( - uint32_t ulDataPort -); - -void Write_85c30_data( - uint32_t ulDataPort, - uint8_t ucData -); - -#ifdef __cplusplus -} -#endif - -#endif |