diff options
Diffstat (limited to 'c/src/lib/libbsp/m68k/mrm332/console/sci.c')
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/console/sci.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/c/src/lib/libbsp/m68k/mrm332/console/sci.c b/c/src/lib/libbsp/m68k/mrm332/console/sci.c index 97c4a5c1b5..823ee215b2 100644 --- a/c/src/lib/libbsp/m68k/mrm332/console/sci.c +++ b/c/src/lib/libbsp/m68k/mrm332/console/sci.c @@ -36,6 +36,9 @@ * $Id$ * * $Log$ +* Revision 1.7 2004/04/21 10:42:52 ralf +* Remove stray white spaces. +* * Revision 1.6 2004/04/15 13:26:13 ralf * Remove stray white spaces. * @@ -162,14 +165,12 @@ #define SCI_MINOR 0 // minor device number - // IMPORTANT - if the device driver api is opened, it means the sci is being // used for direct hardware access, so other users (like termios) get ignored #define DRIVER_CLOSED 0 // the device driver api is closed #define DRIVER_OPENED 1 // the device driver api is opened - // system clock definitions, i dont have documentation on this... #if 0 // Not needed, this is provided in mrm332.h @@ -188,7 +189,6 @@ Section C - External Data *****************************************************************************/ - /***************************************************************************** @@ -266,7 +266,6 @@ void SciPrintStats(); // test routine static struct rtems_termios_tty *SciTermioTty; - static uint8_t SciInited = 0; // has the driver been inited static uint8_t SciOpened; // has the driver been opened @@ -292,7 +291,6 @@ BSP_polling_getchar_function_type BSP_poll_char = NULL; #endif - // cvs id string so you can use the unix ident command on the object #ifdef ID_STRINGS @@ -338,7 +336,6 @@ static const rtems_termios_callbacks SciInterruptCallbacks = TRUE // output uses interrupts }; - /***************************************************************************** Section I - RTEMS termios callbacks for the polled version of the driver *****************************************************************************/ @@ -363,7 +360,6 @@ static const rtems_termios_callbacks SciPolledCallbacks = // ///////////////////////////////////////////////////////////////////////////// - /**************************************************************************** * Func: SCI_output_char * Desc: used by rtems printk function to send a char to the uart @@ -419,13 +415,11 @@ rtems_isr SciIsr( rtems_vector_number vector ) { uint8_t ch; - if ( (*SCSR) & SCI_ERROR_PARITY ) SciErrorsParity ++; if ( (*SCSR) & SCI_ERROR_FRAMING ) SciErrorsFraming ++; if ( (*SCSR) & SCI_ERROR_NOISE ) SciErrorsNoise ++; if ( (*SCSR) & SCI_ERROR_OVERRUN ) SciErrorsOverrun ++; - // see if it was a transmit interrupt if ( (*SCSR) & SCI_XMTR_AVAILABLE ) // data reg empty, xmt complete @@ -474,7 +468,6 @@ rtems_isr SciIsr( rtems_vector_number vector ) // ///////////////////////////////////////////////////////////////////////////// - /**************************************************************************** * Func: SciRcvBufGetChar * Desc: read a character from the circular buffer @@ -511,7 +504,6 @@ static int8_t SciRcvBufGetChar() } - /**************************************************************************** * Func: SciRcvBufPutChar * Desc: put a character into the rcv data circular buffer @@ -584,7 +576,6 @@ static void SciRcvBufFlush( void ) // ///////////////////////////////////////////////////////////////////////////// - /**************************************************************************** * Func: SciInterruptOpen * Desc: open routine for the interrupt based device driver @@ -635,7 +626,6 @@ SciSetBaud( 19200); // set the baud rate SciSetDataBits(SCI_8_DATA_BITS); // set data bits to 8 - // Install our interrupt handler into RTEMS, where does 66 come from? rtems_interrupt_catch( SciIsr, 66, &old_vector ); @@ -778,7 +768,6 @@ int32_t SciSetAttributes( sci_parity = SCI_PARITY_NONE; // no parity, most common } - // set the number of data bits, 8 is most common if (t->c_cflag & CSIZE) // was it specified? @@ -794,7 +783,6 @@ int32_t SciSetAttributes( sci_databits = SCI_8_DATA_BITS; // default to 8 data bits } - // the number of stop bits; always 1 for SCI if (t->c_cflag & CSTOPB) @@ -802,7 +790,6 @@ int32_t SciSetAttributes( // do nothing } - // setup the hardware with these serial port parameters SciSetBaud(sci_rate); // set the baud rate @@ -811,7 +798,6 @@ int32_t SciSetAttributes( SciSetDataBits(sci_databits); // set the data bits - return RTEMS_SUCCESSFUL; } @@ -978,7 +964,6 @@ int32_t SciPolledWrite( // ///////////////////////////////////////////////////////////////////////////// - /**************************************************************************** * Func: SciInit * Desc: Initialize the lasers device driver and hardware @@ -1000,7 +985,6 @@ rtems_device_driver SciInitialize ( //printk("%s\r\n", __FUNCTION__); - // register the SCI device name for termios console i/o // this is done over in console.c which doesn't seem exactly right // but there were problems doing it here... @@ -1010,15 +994,12 @@ rtems_device_driver SciInitialize ( // if (status != RTEMS_SUCCESSFUL) // rtems_fatal_error_occurred(status); - SciMajor = major; // save the rtems major number SciOpened = DRIVER_CLOSED; // initial state is closed - // if you have an interrupt handler, install it here - SciInited = 1; // set the inited flag return RTEMS_SUCCESSFUL; @@ -1129,7 +1110,6 @@ rtems_device_driver SciRead ( rw_args = (rtems_libio_rw_args_t *) arg; // arguments to read() - if (minor != SCI_MINOR) { return RTEMS_INVALID_NAME; // check the minor number @@ -1281,7 +1261,6 @@ rtems_device_driver SciControl ( // ///////////////////////////////////////////////////////////////////////////// - /**************************************************************************** * Func: SciSetBaud * Desc: setup the uart based on the termios modules requests @@ -1299,7 +1278,6 @@ static void SciSetBaud(uint32_t rate) // when you open the console you need to set the termio struct baud rate // it has a default value of 9600, when someone calls tcsetattr it reverts! - SciBaud = rate; // save the rate // calculate the register value as a float and convert to an int @@ -1499,7 +1477,6 @@ void SciWriteCharWait(uint8_t c) return; } - /**************************************************************************** * Func: SciWriteCharNoWait * Desc: if no room in the fifo throw the char on the floor @@ -1554,7 +1531,6 @@ uint8_t inline SciReadCharWait( void ) return ch; // return the char } - /**************************************************************************** * Func: SciReadCharNoWait * Desc: try to get a char but dont wait for one @@ -1579,7 +1555,6 @@ uint8_t inline SciReadCharNoWait( void ) } - /**************************************************************************** * Func: SciCharAvailable * Desc: is there a receive character in the data register @@ -1628,7 +1603,6 @@ void SciSendBreak( void ) // ///////////////////////////////////////////////////////////////////////////// - /**************************************************************************** * Func: SciUnitTest * Desc: test the device driver @@ -1646,17 +1620,14 @@ void SciUnitTest() uint16_t fd; // file descriptor for device uint16_t result; // result of ioctl - fd = open("/dev/sci",O_RDWR); // open the device printk("SCI open fd=%d\r\n",fd); - result = write(fd, "abcd\r\n", 6); // send a string printk("SCI write result=%d\r\n",result); - result = read(fd, &byte, 1); // read a byte printk("SCI read result=%d,byte=%x\r\n",result,byte); |