Mercurial > ecos
changeset 972:2dc2a33635aa
* cdl/ser_mipsidt_334a.cdl: Add configuration for second serial port.
* src/mipsidt_serial.c: Updated support for dual serial ports
* src/mipsidt_serial.h: Add some helpful extra defines for debug.
| author | jlarmour |
|---|---|
| date | Tue, 29 Apr 2003 02:27:26 +0000 |
| parents | 061350042e16 |
| children | 468a48fe0e01 |
| files | packages/devs/serial/mips/idt79s334a/current/ChangeLog packages/devs/serial/mips/idt79s334a/current/cdl/ser_mipsidt_334a.cdl packages/devs/serial/mips/idt79s334a/current/src/mipsidt_serial.c packages/devs/serial/mips/idt79s334a/current/src/mipsidt_serial.h |
| diffstat | 4 files changed, 99 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/devs/serial/mips/idt79s334a/current/ChangeLog +++ b/packages/devs/serial/mips/idt79s334a/current/ChangeLog @@ -1,3 +1,9 @@ +2003-03-09 Tim Michals <t.michals@attbi.com> + + * cdl/ser_mipsidt_334a.cdl: Add configuration for second serial port. + * src/mipsidt_serial.c: Updated support for dual serial ports + * src/mipsidt_serial.h: Add some helpful extra defines for debug. + 2003-02-24 Jonathan Larmour <jifl@eCosCentric.com> * cdl/ser_mipsidt_334a.cdl: Remove irrelevant doc link.
--- a/packages/devs/serial/mips/idt79s334a/current/cdl/ser_mipsidt_334a.cdl +++ b/packages/devs/serial/mips/idt79s334a/current/cdl/ser_mipsidt_334a.cdl @@ -84,7 +84,7 @@ cdl_option CYGPKG_IO_SERIAL_MIPS_POLLED_ } cdl_component CYGPKG_IO_SERIAL_MIPS_IDT79S334A_SERIAL_A { - display "MIPS IDT79S334A serial port driver" + display "MIPS IDT79S334A serial port driver 0" flavor bool default_value 1 description " @@ -92,7 +92,7 @@ cdl_component CYGPKG_IO_SERIAL_MIPS_IDT7 MIPS IDT79S334A." cdl_option CYGDAT_IO_SERIAL_MIPS_IDT79S334A_SERIAL_A_NAME { - display "Device name for MIPS IDT79S334A serial port" + display "Device name for MIPS IDT79S334A serial port 0" flavor data default_value {"\"/dev/ser0\""} description " @@ -100,7 +100,7 @@ cdl_component CYGPKG_IO_SERIAL_MIPS_IDT7 } cdl_option CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_A_BAUD { - display "Baud rate for the MIPS IDT79S334A serial port driver" + display "Baud rate for the MIPS IDT79S334A serial port driver 0" flavor data legal_values { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600 4800 7200 9600 14400 19200 38400 57600 115200 230400 @@ -112,7 +112,46 @@ cdl_component CYGPKG_IO_SERIAL_MIPS_IDT7 } cdl_option CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_A_BUFSIZE { - display "Buffer size for the MIPS IDT79S334A serial port driver" + display "Buffer size for the MIPS IDT79S334A serial port driver 0" + flavor data + legal_values 0 to 8192 + default_value 512 + description " + This option specifies the size of the internal buffers used + for the MIPS IDT79S334A 16c550c port." + } +} + +cdl_component CYGPKG_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B { + display "MIPS IDT79S334A serial port driver 1" + flavor bool + default_value 1 + description " + This option includes the serial device driver for the 16C550 on the + MIPS IDT79S334A." + + cdl_option CYGDAT_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_NAME { + display "Device name for MIPS IDT79S334A serial port 1" + flavor data + default_value {"\"/dev/ser1\""} + description " + This option specifies the device name on the MIPS IDT79S334A." + } + + cdl_option CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_BAUD { + display "Baud rate for the MIPS IDT79S334A serial port driver 1" + flavor data + legal_values { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600 + 4800 7200 9600 14400 19200 38400 57600 115200 230400 + } + default_value 115200 + description " + This option specifies the default baud rate (speed) for the + MIPS 16c550 port." + } + + cdl_option CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_BUFSIZE { + display "Buffer size for the MIPS IDT79S334A serial port driver 1" flavor data legal_values 0 to 8192 default_value 512
--- a/packages/devs/serial/mips/idt79s334a/current/src/mipsidt_serial.c +++ b/packages/devs/serial/mips/idt79s334a/current/src/mipsidt_serial.c @@ -98,8 +98,10 @@ static SERIAL_FUNS(mipsidt_serial_funs, mipsidt_serial_stop_xmit ); + +#ifdef CYGPKG_IO_SERIAL_MIPS_IDT79S334A_SERIAL_A static mipsidt_serial_info mipsidt_serial_info0 ={IDTMIPS_SER_16550_BASE_A, - CYGNUM_HAL_INTERRUPT_SIO_0}; + CYGNUM_HAL_INTERRUPT_SIO_0}; #if CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_A_BUFSIZE > 0 static unsigned char mipsidt_serial_out_buf0[CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_A_BUFSIZE]; @@ -139,7 +141,51 @@ DEVTAB_ENTRY(mipsidt_serial_io0, &mipsidt_serial_channel0 ); +#endif +#ifdef CYGPKG_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B +static mipsidt_serial_info mipsidt_serial_info1 ={IDTMIPS_SER_16550_BASE_B, + CYGNUM_HAL_INTERRUPT_SIO_1}; + +#if CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_BUFSIZE > 0 +static unsigned char mipsidt_serial_out_buf1[CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_BUFSIZE]; +static unsigned char mipsidt_serial_in_buf1[CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_BUFSIZE]; + +static SERIAL_CHANNEL_USING_INTERRUPTS(mipsidt_serial_channel1, + mipsidt_serial_funs, + mipsidt_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT, + &mipsidt_serial_out_buf1[0], + sizeof(mipsidt_serial_out_buf1), + &mipsidt_serial_in_buf1[0], + sizeof(mipsidt_serial_in_buf1) + ); +#else +static SERIAL_CHANNEL(mipsidt_serial_channel1, + mipsidt_serial_funs, + mipsidt_serial_info1, + CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_BAUD), + CYG_SERIAL_STOP_DEFAULT, + CYG_SERIAL_PARITY_DEFAULT, + CYG_SERIAL_WORD_LENGTH_DEFAULT, + CYG_SERIAL_FLAGS_DEFAULT + ); +#endif + +DEVTAB_ENTRY(mipsidt_serial_io1, + CYGDAT_IO_SERIAL_MIPS_IDT79S334A_SERIAL_B_NAME, + 0, // Does not depend on a lower level interface + &cyg_io_serial_devio, + mipsidt_serial_init, + mipsidt_serial_lookup, // Serial driver may need initializing + &mipsidt_serial_channel1 + ); + +#endif // Internal function to actually configure the hardware to desired baud rate, etc. static bool @@ -243,7 +289,7 @@ mipsidt_serial_putc(serial_channel *chan cyg_uint8 _lsr; HAL_READ_UINT8(port+SER_16550_LSR, _lsr); - if (_lsr & SIO_LSR_THRE) { + if (((_lsr & (SIO_LSR_THRE | SIO_LSR_TEMT)) == 0x60)) { // Transmit buffer is empty HAL_WRITE_UINT8(port+SER_16550_THR, c); return true;
--- a/packages/devs/serial/mips/idt79s334a/current/src/mipsidt_serial.h +++ b/packages/devs/serial/mips/idt79s334a/current/src/mipsidt_serial.h @@ -101,6 +101,8 @@ #define IDTMIPS_SER_16550_BASE_A 0xB8000803 #define IDTMIPS_SER_16550_BASE_B 0xB8000823 #define SER_16550_BASE IDTMIPS_SER_16550_BASE_A +#define INTR_COM0_REG 0xB8000554 +#define INTR_COM1_REG 0xB8000564 //----------------------------------------------------------------------------- // Define the serial registers. The IDT board is equipped with a 16550C
