summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i960/rxgen960/console
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2004-09-29 17:25:02 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2004-09-29 17:25:02 +0000
commitc774850d227c53c35d7c99ecb390e2f02113b0fb (patch)
tree5a40759b80ec1b595aa8f76c1855baaf1347921b /c/src/lib/libbsp/i960/rxgen960/console
parent2004-09-27 Greg Menke <gregory.menke@gsfc.nasa.gov> (diff)
downloadrtems-c774850d227c53c35d7c99ecb390e2f02113b0fb.tar.bz2
2004-09-29 Joel Sherrill <joel@OARcorp.com>
* .cvsignore, ChangeLog, Makefile.am, acinclude.m4, configure.ac, cvme961/.cvsignore, cvme961/ChangeLog, cvme961/Makefile.am, cvme961/bsp_specs, cvme961/configure.ac, cvme961/times, cvme961/clock/ckinit.c, cvme961/console/console.c, cvme961/include/.cvsignore, cvme961/include/bsp.h, cvme961/include/tm27.h, cvme961/shmsupp/addrconv.c, cvme961/shmsupp/getcfg.c, cvme961/shmsupp/lock.c, cvme961/shmsupp/mpisr.c, cvme961/start/start.S, cvme961/startup/bspclean.c, cvme961/startup/bspstart.c, cvme961/startup/exit.c, cvme961/startup/linkcmds, cvme961/startup/setvec.c, cvme961/timer/timer.c, cvme961/timer/timerisr.S, i960sim/.cvsignore, i960sim/ChangeLog, i960sim/Makefile.am, i960sim/bsp_specs, i960sim/configure.ac, i960sim/clock/clockdrv.c, i960sim/console/console-io.c, i960sim/console/mon-syscalls.S, i960sim/include/.cvsignore, i960sim/include/bsp.h, i960sim/include/tm27.h, i960sim/start/start.c, i960sim/startup/bspstart.c, i960sim/startup/linkcmds, rxgen960/.cvsignore, rxgen960/ChangeLog, rxgen960/Makefile.am, rxgen960/README, rxgen960/bsp_specs, rxgen960/configure.ac, rxgen960/clock/ckinit.c, rxgen960/console/concntl.h, rxgen960/console/console.c, rxgen960/console/serial.c, rxgen960/console/serial.h, rxgen960/include/.cvsignore, rxgen960/include/bsp.h, rxgen960/include/rxgen960_config.h, rxgen960/include/tm27.h, rxgen960/start/rxgen_romld.S, rxgen960/startup/asmfault.S, rxgen960/startup/asmfault.h, rxgen960/startup/asmstub.S, rxgen960/startup/asmstub.h, rxgen960/startup/bspstart.c, rxgen960/startup/cntrltbl.c, rxgen960/startup/cntrltbl.h, rxgen960/startup/dram.ld, rxgen960/startup/exit.c, rxgen960/startup/fault.c, rxgen960/startup/fault.h, rxgen960/startup/faultret.h, rxgen960/startup/flttbl.c, rxgen960/startup/flttbl.h, rxgen960/startup/frmstr.c, rxgen960/startup/frmstr.h, rxgen960/startup/i960.h, rxgen960/startup/ihandler.S, rxgen960/startup/ihandler.h, rxgen960/startup/intrtbl.c, rxgen960/startup/intrtbl.h, rxgen960/startup/kkprintf.c, rxgen960/startup/linkcmds, rxgen960/startup/linkcmds.real, rxgen960/startup/main.h, rxgen960/startup/memchnl.h, rxgen960/startup/nmi.c, rxgen960/startup/nulsystbl.c, rxgen960/startup/pmc901_memmap.h, rxgen960/startup/prcb.c, rxgen960/startup/prcb.h, rxgen960/startup/rom.ld, rxgen960/startup/rom_cntrltbl.c, rxgen960/startup/rom_ibr.c, rxgen960/startup/rom_ibr.h, rxgen960/startup/rom_prcb.c, rxgen960/startup/rommon.h, rxgen960/startup/sctns.c, rxgen960/startup/sctns.h, rxgen960/startup/setvec.c, rxgen960/startup/systbl.c, rxgen960/startup/systbl.h, rxgen960/startup/time.h, rxgen960/timer/timer.c, rxgen960/timer/timerisr.S: Removed.
Diffstat (limited to 'c/src/lib/libbsp/i960/rxgen960/console')
-rw-r--r--c/src/lib/libbsp/i960/rxgen960/console/concntl.h16
-rw-r--r--c/src/lib/libbsp/i960/rxgen960/console/console.c254
-rw-r--r--c/src/lib/libbsp/i960/rxgen960/console/serial.c348
-rw-r--r--c/src/lib/libbsp/i960/rxgen960/console/serial.h8
4 files changed, 0 insertions, 626 deletions
diff --git a/c/src/lib/libbsp/i960/rxgen960/console/concntl.h b/c/src/lib/libbsp/i960/rxgen960/console/concntl.h
deleted file mode 100644
index c1632a6ed7..0000000000
--- a/c/src/lib/libbsp/i960/rxgen960/console/concntl.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * $Id$
- */
-
-typedef enum
-{
- CON_KBHIT,
- CON_GET_RAW_BYTE,
- CON_SEND_RAW_BYTE
-} console_ioctl_t;
-
-typedef struct
-{
- console_ioctl_t ioctl_type;
- uint32_t param;
-} console_ioctl_request_t;
diff --git a/c/src/lib/libbsp/i960/rxgen960/console/console.c b/c/src/lib/libbsp/i960/rxgen960/console/console.c
deleted file mode 100644
index 959a91deae..0000000000
--- a/c/src/lib/libbsp/i960/rxgen960/console/console.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * This file contains the template for a console IO package.
- *
- * 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 <bsp.h>
-#include <rtems/libio.h>
-#include "concntl.h"
-/* #include "pcimsgreg.h" XXX JRS */
-
-#ifndef lint
-static char _sccsid[] = "@(#)console.c 09/12/96 1.13\n";
-#endif
-
-/* console_initialize
- *
- * This routine initializes the console IO driver.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * Return values:
- */
-
-rtems_device_driver console_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg
-)
-{
- rtems_status_code status;
-
- if ( console_pmr_init(*(uint32_t*)arg) )
- return RTEMS_INVALID_NUMBER;
-
- status = rtems_io_register_name(
- "/dev/console",
- major,
- (rtems_device_minor_number) 0
- );
-
- if (status != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred(status);
-
- return RTEMS_SUCCESSFUL;
-}
-
-/* is_character_ready
- *
- * This routine returns TRUE if a character is available.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * Return values:
- */
-
-rtems_boolean is_character_ready(
- char *ch
-)
-{
- *ch = '\0'; /* return NULL for no particular reason */
- return(console_pmr_kbhit());
-}
-
-/* inbyte
- *
- * This routine reads a character from the SOURCE.
- *
- * Input parameters: NONE
- *
- * Output parameters: NONE
- *
- * Return values:
- * character read from SOURCE
- */
-
-char inbyte( unsigned int minor )
-{
- /*
- * If polling, wait until a character is available.
- */
- return console_pmr_getc();
-}
-
-/* outbyte
- *
- * This routine transmits a character out the SOURCE. It may support
- * XON/XOFF flow control.
- *
- * Input parameters:
- * ch - character to be transmitted
- *
- * Output parameters: NONE
- */
-
-void outbyte( unsigned int minor,
- char ch
-)
-{
- console_pmr_putc( ch );
-
- /*
- * Carriage Return/New line translation.
- */
-
- if ( ch == '\n' )
- outbyte( minor, '\r' );
-}
-
-/*
- * Open entry point
- */
-
-rtems_device_driver console_open(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * Close entry point
- */
-
-rtems_device_driver console_close(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return RTEMS_SUCCESSFUL;
-}
-
-/*
- * read bytes from the serial port. We only have stdin.
- */
-
-rtems_device_driver console_read(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- rtems_libio_rw_args_t *rw_args;
- uint8_t *buffer;
- uint32_t maximum;
- uint32_t count = 0;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- buffer[ count ] = inbyte(minor);
- if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
- buffer[ count++ ] = '\n';
- buffer[ count ] = 0;
- outbyte( minor, '\n' ); /* newline */
- break;
- }
- else if (buffer[ count ] == '\b' && count > 0 )
- {
- outbyte( minor, '\b' ); /* move back one space */
- outbyte( minor, ' ' ); /* erase the character */
- outbyte( minor, '\b' ); /* move back one space */
- count-=2;
- }
- else
- outbyte( minor, buffer[ count ] ); /* echo the character */
- }
-
- rw_args->bytes_moved = count;
- return (count > 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
-}
-
-/*
- * write bytes to the serial port. Stdout and stderr are the same.
- */
-
-rtems_device_driver console_write(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- int count;
- int maximum;
- rtems_libio_rw_args_t *rw_args;
- uint8_t *buffer;
-
- rw_args = (rtems_libio_rw_args_t *) arg;
-
- buffer = rw_args->buffer;
- maximum = rw_args->count;
-
- for (count = 0; count < maximum; count++) {
- if ( buffer[ count ] == '\n') {
- outbyte(minor,'\r');
- }
- outbyte( minor,buffer[ count ] );
- }
-
- rw_args->bytes_moved = maximum;
- return 0;
-}
-
-/*
- * IO Control entry point
- */
-
-rtems_device_driver console_control(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- if (!arg)
- return RTEMS_INVALID_ADDRESS;
-
- switch( ((console_ioctl_request_t *)arg)->ioctl_type )
- {
- case CON_KBHIT:
- /* check if keyboard was hit */
- ((console_ioctl_request_t *)arg)->param = console_pmr_kbhit();
- break;
-
- case CON_GET_RAW_BYTE:
- ((console_ioctl_request_t *)arg)->param = inbyte(minor);
- break;
-
- case CON_SEND_RAW_BYTE:
- outbyte(minor, ((console_ioctl_request_t *)arg)->param);
- break;
-
- default:
- break;
- }
-
- return RTEMS_SUCCESSFUL;
-}
diff --git a/c/src/lib/libbsp/i960/rxgen960/console/serial.c b/c/src/lib/libbsp/i960/rxgen960/console/serial.c
deleted file mode 100644
index 2a1b061efe..0000000000
--- a/c/src/lib/libbsp/i960/rxgen960/console/serial.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * $Id$
- */
-
-#include "serial.h"
-#include "rtems.h"
-
-typedef unsigned char uchar ; /* Abbreviations */
-typedef unsigned short ushort ;
-typedef unsigned long ulong ;
-int DBGConsole_make_sync = 0;
-#define CONSOLE_CHANNELS 1
-
-#define MAX_CONSOLE 4
-static int consoles[MAX_CONSOLE];
-static int active_consoles = 0;
-static struct{
- rtems_id sem;
- int rx;
- int cnt;
- char in_line[128];
-}cons_input[MAX_CONSOLE];
-
-/* This uses the message out and in buffers as serial emulator.
- Pretty stupid eh?
-*/
-
-#define uart1 ((volatile unsigned char *)0x1318)
-#define uart1_rx ((volatile unsigned int *)0x1310)
-
-#define NUM_UARTS 1
-static volatile unsigned int * uart = { uart1 };
-static volatile unsigned int * uart_rx = { uart1_rx };
-
-extern void display_msg(void);
-/*extern int sprintf();*/
-
-int
-console_uartinit(unsigned int BAUDRate)
-{
-#ifdef CONSOLE_CHANNELS
- void cons_isr();
- rpmu_attach_inmsg0(cons_isr);
-#endif
- return(0);
-}
-
-/* Introduce a new console channel */
-console_new(char * name)
-{
-#ifdef CONSOLE_CHANNELS
- unsigned int x, stat;
- x = 0xfe000000 | (name[0] << 16) | (name[1] << 8) | name[2];
- do {
- stat = *uart;
- } while (DBGConsole_make_sync && (stat != 0));
- *uart = x;
- x = ( name[3] << 24) | ( name[4] << 16) | ( name[5] << 8) | name[6] ;
- do {
- stat = *uart;
- } while (DBGConsole_make_sync && (stat != 0));
- *uart = x;
- active_consoles += 1;
- rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &consoles[active_consoles] );
-#endif
-}
-
- /***********************************************************************
- *** Transmit character to host.
- *** put the console ID in upper byte
- ***
- ***********************************************************************/
-
-int console_sps_putc(int cc)
-{
- register unsigned char stat;
- int rtid, i;
- unsigned int ch;
- unsigned int level;
-#ifdef CONSOLE_CHANNELS
- rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &rtid );
- ch = cc & 0xff;
- for(i=1; i <= active_consoles; i++){
- if( rtid == consoles[i]){
- ch |= (i ) << 24 ;
- break;
- }
- }
-#else
- ch = cc;
-#endif
-
- /*
- * Pause until there is room in the UART transmit
- * buffer.
- */
-
- if (ch == -1)
- return ch;
-
-wait:
- do {
- stat = *uart;
- } while (DBGConsole_make_sync && (stat != 0));
- rtems_interrupt_disable(level);
- if( (*uart != 0) && DBGConsole_make_sync){
- rtems_interrupt_enable(level);
- goto wait;
- }
-
- /*
- * Transmit data. (Junk)
- */
-
- *uart = ch;
- rtems_interrupt_enable(level);
- return cc;
-
-}
-
- /*
- * putnum -- print a 32 bit number in hex
- */
- int
- putnum (num)
- unsigned int num;
- {
- char buffer[9];
- int count;
- int digit;
-
- for (count = 7 ; count >= 0 ; count--) {
- digit = (num >> (count * 4)) & 0xf;
-
- if (digit <= 9)
- console_sps_putc( (char) ('0' + digit));
- else
- console_sps_putc( (char) ('A' - 10 + digit));
- }
- }
-
- /*
- * putmem -- print the specified memory block
- */
- void
- putmem (addr, num)
- char *addr;
- unsigned int num;
- {
- int i = 0;
- int j = 0;
- int val = 0;
- int digit = 0;
-
- console_sps_putc(13);
- console_sps_putc(10);
- putnum((unsigned int) addr);
- console_sps_putc(':');
- console_sps_putc(' ');
- while(num)
- {
- val = *addr;
-
- for (j = 0; j < 2; j++)
- {
- digit = (val & 0xf0) >> 4;
- val <<= 4;
-
- if (digit < 10)
- {
- console_sps_putc(digit + '0');
- }
- else
- {
- console_sps_putc(digit - 10 + 'A');
- }
- }
- console_sps_putc(' ');
-
- num--;
- addr++;
- if (++i == 16)
- {
- console_sps_putc(13);
- console_sps_putc(10);
- putnum((unsigned int) addr);
- console_sps_putc(':');
- console_sps_putc(' ');
- i = 0;
- }
- }
- console_sps_putc(13);
- console_sps_putc(10);
- }
-
- /*
- * putcmem -- print the specified pci config memory block
- */
- void
- putcmem (addr, num)
- unsigned char *addr;
- unsigned int num;
- {
- int i = 0;
- int j = 0;
- unsigned short val = 0;
- int digit = 0;
- unsigned int *satucmd = (unsigned int *) 0x1298;
- unsigned int *soccar = (unsigned int *) 0x12a8;
- unsigned int *soccdp = (unsigned int *) 0x12b0;
-
- *satucmd = 4;
-
- console_sps_putc(13);
- console_sps_putc(10);
- putnum((unsigned int) addr);
- console_sps_putc(':');
- console_sps_putc(' ');
- while(num)
- {
- *soccar = (unsigned int) addr;
- val = *soccdp;
-
- for (j = 0; j < 4; j++)
- {
- digit = (val & 0xf000) >> 12;
- val <<= 4;
-
- if (digit < 10)
- {
- console_sps_putc(digit + '0');
- }
- else
- {
- console_sps_putc(digit - 10 + 'A');
- }
- }
- console_sps_putc(' ');
-
- num -= 2;
- addr += 2;
- if (++i == 8)
- {
- console_sps_putc(13);
- console_sps_putc(10);
- putnum((unsigned int) addr);
- console_sps_putc(':');
- console_sps_putc(' ');
- i = 0;
- }
- }
- console_sps_putc(13);
- console_sps_putc(10);
- }
-
- /***********************************************************************
- *** Read character from host.
- ***********************************************************************/
-#ifdef CONSOLE_CHANNELS
-int console_sps_getc()
-{
-
- int consinx;
- int rtid, i;
- unsigned int level, level2;
- char ch;
- consinx = 0;
- rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &rtid );
- for(i=1; i <= active_consoles; i++){
- if( rtid == consoles[i]){
- consinx = i ;
- break;
- }
- }
- if( i > active_consoles)
- consinx = 0;
- if( cons_input[consinx].sem == 0){
- rtems_name sname;
- sname = rtems_build_name('S','U','X',(char)(consinx + '0'));
- rtems_semaphore_create(sname, 0, RTEMS_DEFAULT_ATTRIBUTES, 0, &cons_input[consinx].sem);
- cons_input[consinx].rx = 0;
- }
- while( cons_input[consinx].cnt == cons_input[consinx].rx){
- rtems_semaphore_obtain(cons_input[consinx].sem, RTEMS_WAIT, 0);
-/* rtems_task_wake_after( RTEMS_YIELD_PROCESSOR);*/
-}
- rtems_interrupt_disable(level);
- i = cons_input[consinx].rx;
- ch = cons_input[consinx].in_line[i];
- i++;
- if( i >= sizeof( cons_input[consinx].in_line))
- i = 0;
- cons_input[consinx].rx = i;
- rtems_interrupt_enable(level);
- return ch;
-}
-
-void cons_isr()
-{
- unsigned int i, chin, consinx, st;
- chin = *uart_rx;
- consinx = chin >> 24;
- if( consinx > active_consoles)
- goto release;
- i = cons_input[consinx].cnt;
- cons_input[consinx].in_line[i] = chin & 0xff;
- i++;
- if( i >= sizeof( cons_input[consinx].in_line))
- i = 0;
- cons_input[consinx].cnt = i;
- st = rtems_semaphore_release( cons_input[consinx].sem);
-release:
- *uart_rx = 0;
-}
-
-#else
-volatile int console_foo = 0;
-int console_sps_getc()
-{
- volatile unsigned int stat;
- register int ch;
-
- stat = *uart_rx;
- while (stat == 0)
- {
- rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
- stat = *uart_rx;
- console_foo++;
- }
- *uart_rx = 0;
-
- ch = stat;
-
- return ch;
-}
-#endif
-
- /***********************************************************************
- *** check character from host.
- ***********************************************************************/
-
-int console_sps_kbhit()
-{
- register unsigned short stat;
-
- stat = *uart;
- return ( stat != 0);
-}
diff --git a/c/src/lib/libbsp/i960/rxgen960/console/serial.h b/c/src/lib/libbsp/i960/rxgen960/console/serial.h
deleted file mode 100644
index 55f13ccb6f..0000000000
--- a/c/src/lib/libbsp/i960/rxgen960/console/serial.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * $Id$
- */
-
-int console_uartinit(unsigned int BAUDRate);
-int console_sps_putc(int ch);
-int console_sps_getc();
-int console_sps_kbhit();