2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>

* README: Updated
	* console/console.c: Fix polled input.
	Add support for shared printk.
	Add support for more flexible polled I/O with and without termios.
	I/O mode and console is selectable either from NVRAM or from
	mvme167.cfg.  Clean up comments.

2000-08-11  Charles-Antoine Gauthier  <charles.gauthier@nrc.ca>

	* startup/page_table.c (page_table_init): Reorganize NVRAM parameters.
	* include/bsp.h: Reorganize NVRAM parameters.
	Add support for shared printk.
	* times: These are the times for the MVME167, not the MBX860-002.

2000-08-11  John Cotton  <john.cotton@nrc.ca>

	* network/network.c: Fix NVRAM configuration parameter
	handling from previous revision.
	Check J1-4,  restructure NVRAM parameter handling.

2000-08-11  Charles-Antoine Gauthier  <charles.gauthier@nrc.ca>

	* network/network.c: Cleanup of network driver to reduce warnings.
	Addition of second parameter to uti596_attach.
This commit is contained in:
Joel Sherrill
2000-08-11 19:26:31 +00:00
parent b96ca51950
commit ed09fd77fc
6 changed files with 536 additions and 388 deletions

View File

@@ -1,3 +1,29 @@
2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>
* README: Updated
* console/console.c: Fix polled input.
Add support for shared printk.
Add support for more flexible polled I/O with and without termios.
I/O mode and console is selectable either from NVRAM or from
mvme167.cfg. Clean up comments.
2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>
* startup/page_table.c (page_table_init): Reorganize NVRAM parameters.
* include/bsp.h: Reorganize NVRAM parameters.
Add support for shared printk.
* times: These are the times for the MVME167, not the MBX860-002.
2000-08-11 John Cotton <john.cotton@nrc.ca>
* network/network.c: Fix NVRAM configuration parameter
handling from previous revision.
Check J1-4, restructure NVRAM parameter handling.
2000-08-11 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>
* network/network.c: Cleanup of network driver to reduce warnings.
Addition of second parameter to uti596_attach.
2000-08-10 Joel Sherrill <joel@OARcorp.com>
* ChangeLog: New file.

View File

@@ -54,33 +54,84 @@ this file if you want S-records.
Port Description
Console driver
---------------
This BSP includes an termios-capable console driver that supports all
four serial ports on the MVME167 model. The RTEMS console, /dev/console,
corresponds to channel 1 in the CD2401. This corresponds to Serial Port
2/TTY01 on the MVME712M. Serial Port 1/Console is normally used by 167Bug;
do not open /dev/tty00 if you are debugging using 167Bug.
The console is initialized with whatever parameters are set up in termios
before it calls the firtOpen driver callback, EXCEPT THAT HARDWARE
HANDSHAKING IS TURNED OFF, i.e. CLOCAL is set in the struct termios
c_cflag field. We use 3-wire cables for I/O, and find hardware handshaking
a pain. If you enable hardware handshaking, you must drive CTS* low on the
CD2401 for output to occur. If the port is in the DTE configuration, you
must drive the RS-232 CTS line to space; if the port is in the DCE
configuration, you must drive the RS-232 RTS line to space.
This BSP includes an termios-capable interrupt-driven I/O console driver
that supports all four serial ports on the MVME167 model. The port labelled
Serial Port 1/Console on the MVME712 is normally used by 167Bug; do not open
/dev/tty00 if you are debugging using 167Bug.
Limited support is provided for polled terminal I/O. This is used when
running the timing tests. Set the CD2401_POLLED_IO manifest constant to 1
in rtems/c/src/lib/libbsp/m68k/mvme167/console/console.c to enable polled
I/O. In this case, I/O is done through 167Bug, usually to the Serial Port
1/Console port. Interrupt-driven and polled I/O cannot be mixed in the
MVME167.
running the timing tests, and by the printk() debug output function.
Polled I/O may use termios, or it may bypass those services. The printk()
function does not use termios. When polled I/O is used, the terminal settings
must be set through 167-Bug; trying to change the line settings through RTEMS
has no effect.
Three is no support for using interrupt-driven I/O without termios support.
The default configuration is to use polled I/O and to bypass termios. This
is done so the test can be built at the same time as the rest of the system.
It is highly recommended that the defaults be changed in the mvme167.cfg file
to reflect the desired defaults, or that the appropriate parameters be set up
in NVRAM to select the appropriate I/O modes at boot time.
When configured for interrupt-driven I/O, the console is initialized with
whatever parameters are set up in termios before it calls the firtOpen driver
callback, EXCEPT THAT HARDWARE HANDSHAKING IS TURNED OFF, i.e. CLOCAL is set
in the struct termios c_cflag field. We use 3-wire cables for I/O, and find
hardware handshaking a pain. If you enable hardware handshaking, you must drive
CTS* low on the CD2401 for output to occur. If the port is in the DTE
configuration, you must drive the RS-232 CTS line to space; if the port is
in the DCE configuration, you must drive the RS-232 RTS line to space.
To use interrupt-driven I/O, set the CD2401_IO_MODE manifest constant to 1 in
rtems/make/custom/mvme167.cfg, or configure the appropriate parameter in
User Area Non-volatile RAM. See the Configuration Parameters section below
for instructions on setting up NVRAM.
To use termios, set the CD2401_USE_TERMIOS manifest constant to 1 in
rtems/make/custom/mvme167.cfg, or configure the appropriate parameter in
User Area Non-volatile RAM. See the Configuration Parameters section
below for instructions on setting up NVRAM.
The RTEMS console, i.e. the port used by stdin, stdout and stderr (do not
confuse it with the port labelled Console on the MVME712), must be
specified in the rtems/make/custom/mvme167.cfg file, or in the NVRAM
parameters. Set the value of CONSOLE_MINOR appropriately. See below for a
list of choices. See the Configuration Parameters section below for
instructions on setting up NVRAM.
The RTEMS printk port, i.e. the port where printk sends it debugging output
text, must be specified in the rtems/make/custom/mvme167.cfg file, or in the
NVRAM parameters. Set the value of PRINTK_MINOR appropriately. See below for a
list of choices. See the Configuration Parameters section below for
instructions on setting up NVRAM.
Interrupt-driven and polled I/O cannot be mixed in the MVME167, except that
printk always used polled I/O without termios. If interrupt-driven I/O is
used and printk is used, do not open the device that printk uses from an
RTEMS application.
Console and printk port choices:
0 - /dev/tty0, Serial Port 1/Console on the MVME712M.
1 - /dev/tty1, Serial Port 2/TTY01 on the MVME712M.
2 - /dev/tty2, Serial Port 3 on the MVME712M.
3 - /dev/tty3, Serial Port 4 on the MVME712M.
Setting the RTEMS console to port 0 when interrupt-driven I/O is specified
will prevent 167-Bug from using that port.
To use polled I/O on port 2 or 3, the port must be configured in 167-Bug. See
the "PF" command in the "Debugging Package for Motorola 68K CISC CPUs User's
Manual", part number 68KBUG.
Floating-point
--------------
The MC68040 has a built-in FPU. This FPU does not implement all the
instruction of the MC68881/MC68882 floating-point coprocessors in
@@ -135,42 +186,68 @@ against.
Configuration Parameters
------------------------
If Jumper J1-4 is installed, certain configuration parameters may be read from
the first 31 bytes of User Area NVRAM starting at 0xFFFC0000. In this case, the
user is responsible for writing the appropriate values to this memory location
(via 167Bug) in order to alter the default behaviour. A zero value results in
the default behaviour. The paramaters that are configurable and their default
settings are described below.
Data Cache Enable (0xFFFC0000 - 1 byte)
write a non-zero value to this location to enable the data cache
default: disabled
Instruction Cache Activation (0xFFFC0001 - 1 byte)
write a non-zero value to this location to enable the instruction cache
default: disabled
remaining J1-[5-7] jumpers are ignored, and the user is responsible for writing
the appropriate values in NVRAM (via 167-Bug) in order to alter the default
behaviour. A zero value in NVRAM results in the default behaviour. The paramaters
that are configurable and their default settings are described below.
Cache Mode (0xFFFC0002 - 2 bytes)
0xFFF0 = cachable, write-through
0xFFF1 = cachable, copyback
0xFFF2 = noncachable, serialized
0xFFF3 = noncachable,
default: cachable, copyback
Cache Mode (0xFFFC0000 - 1 byte)
Set the following bits in the byte to set the desired cache mode:
bit 0
0 - data cache disable
1 - data cache enable
bit 1
0 - instruction cache disable
1 - instruction cache enable
bits 2 & 3:
00 = cachable, write-through
01 = cachable, copyback
10 = noncachable, serialized
11 = noncachable
Console driver I/O mode (0xFFFC0001 - 1 byte)
Set the following bits in the byte to set the desired I/O mode:
bit 0
0 - do not use termios
1 - use termios
bit 1
0 - polled I/O
1 - interrupt-driven I/O
Console driver ports (0xFFFC0002 - 1 byte)
Set the following bits in the byte to select the console and printk ports:
bit 0 & 1 select the RTEMS console port
00 - /dev/tty0, Serial Port 1/Console on the MVME712M.
01 - /dev/tty1, Serial Port 2/TTY01 on the MVME712M.
10 - /dev/tty2, Serial Port 3 on the MVME712M.
11 - /dev/tty3, Serial Port 4 on the MVME712M.
bit 4 & 5 select the RTEMS printk port
00 - /dev/tty0, Serial Port 1/Console on the MVME712M.
01 - /dev/tty1, Serial Port 2/TTY01 on the MVME712M.
10 - /dev/tty2, Serial Port 3 on the MVME712M.
11 - /dev/tty3, Serial Port 4 on the MVME712M.
If the printk port is the same as some other port that will be opened by an
RTEMS application, then the driver must use polled I/O, or the printk port
must not be used.
IP Address (0xFFFC0004 - 4 bytes)
write the hexidecimal representation of the board's IP address in this
location for example, 192.168.1.2 = 0xC0A80102
write the hexadecimal representation of the IP address of the board in this
locatio, e.g. 192.168.1.2 = 0xC0A80102
default: obtain the IP address from an rtems_bsdnet_ifconfig structure
Netmask (0xFFFC0008 - 4 bytes)
write the hexidecimal representation of the netmask in this location
write the hexadecimal representation of the netmask in this location
for example, 255.255.255.0 = 0xFFFFFF00
default: obtain the netmask from an rtems_bsdnet_ifconfig structure
Ethernet Address (0xFFFC000C - 6 bytes)
write the board's hardware address in this location
default: obtain the hardware address from an rtems_bsdnet_ifconfig structure
write the Ethernet address of the board in this location
default: obtain the hardware address from an rtems_bsdnet_ifconfig
structure
Processor ID (0xFFFC0012 - 2 bytes)
reserved for future use
@@ -186,13 +263,14 @@ settings are described below.
Cache Control and Memory Mapping
--------------------------------
If configuration is not obtained from non-volatile RAM (ie. J1-4 is off),
cache control is done through the remaining J1 jumpers as follows:
If Jumper J1-7 is installed, the data cache will be turned on. If Jumper
J1-6 is installed, the instruction cache will be turned on. Removing the
jumper causes the corresponding cache to be left disabled.
J1-6 is installed, the instruction cache will be turned on. (If a jumper
is off, its corresponding cache will remain disabled).
If Jumper J1-5 is installed, the data cache will be placed in copyback
mode. If it is removed, it will be placed in writethrough mode.
@@ -203,7 +281,24 @@ port relies on the hardware to raise exceptions when addressing
non-existent memory. Caching is not controllable on a finer grain.
Networking
----------
If configuration is not obtained from non-volatile RAM (ie. J1-4 is off),
the networking parameters shown above must be specified in an initialized
rtems_bsdnet_ifconfig struct. This structure is declared and initialized to
specify any network devices and includes entries for ip_address, ip_netmask
and hardware_address. See the Network Device Configuration section of the
RTEMS Networking Supplement.
When non-default (non-zero) networking paramaters are provided in NVRAM (ie.
j1-4 is on), the user MUST ensure that the corresponding entries in the
ifconfig struct are NULL. Failing to do so is an error, because it causes
the memory allocated for the initialized struct values to be lost.
Miscellaneous
-------------
The timer and clock drivers were patterned after the MVME162 and MVME152
ports.
@@ -238,12 +333,21 @@ With the latter environment, be patient; builds take a very looong time...
Current development is done on a Pentium III PC running RedHat Linux 6.1.
At the time this README was composed, the latest working compiler that was
used successfully was gcc version 2.96 20000213 (experimental). Both the C
and C++ compilers were working. Binutils 2.9.1 are used.
and C++ compilers were working. Binutils 2.10 are used.
Known Problems
--------------
Polled I/O without termios may not work very well on input. The problem
is that input processing is not done: applications may get characters too
early, and may get characters that they normally would not get, such as
backspace or delete. Furthermore, input is not buffered at all. The latest
versions of rtems seem to set the count field in the rtems_libio_rw_args_t
argument to the buffer size, not to the number of characters expected on
input. Rather than wait for 1024 characters on each call, the driver
returns each character when it is received.
The cdtest will not run with interrupt-driven I/O. The reason is that the
constructors for the static objects are called at boot time when the
interrupts are still disabled. The output buffer fills up, but never empties,
@@ -252,10 +356,6 @@ should have been documented in the rtems/c/src/tests/PROBLEMS file. The moral
of this story is: do not do I/O from the constructors or destructors of static
objects.
The cpuuse and malloctest tests do not work properly, either with polled I/O
or interrupt-driven I/O. They are known not to work with interrupt-driven I/O,
but should work with polled I/O?
Output stops prematurely in the termios test when the console is operating in
interrupt-driven mode because the serial port is re-initialized before all
characters in the last raw output buffer are sent. Adding calls to tcdrain()
@@ -287,8 +387,8 @@ it does not return control to 167Bug. Is this test supposed to work with
interrupt-driven console I/O?
What's new
----------
What is new
-----------
Support for Java is being actively worked on.
@@ -335,209 +435,5 @@ Single processor tests: All tests passed, except the following ones:
Multi-processort tests: not applicable -- No MPCI layer yet.
Timing tests:
Context Switch
context switch: no floating point contexts 12
context switch: self 3
context switch: to another task 3
fp context switch: restore 1st FP task 14
fp context switch: save idle, restore initialized 5
fp context switch: save idle, restore idle 15
fp context switch: save initialized, restore initialized 5
Miscellaneous
Timing tests: See rtems/c/src/lib/libbsp/m68k/mvme167/times
_ISR_Disable 1
_ISR_Flash 0
_ISR_Enable 0
_Thread_Disable_dispatch 0
_Thread_Enable_dispatch 3
_Thread_Set_state 9
_Thread_Disptach (NO FP) 16
_Thread_Resume 6
_Thread_Unblock 4
_Thread_Ready 6
_Thread_Get 3
_Thread_Get: invalid id 0
_Semaphore_Get 2
Task Manager
rtems_task_create 56
rtems_task_ident 106
rtems_task_start 21
rtems_task_restart: calling task 24
rtems_task_restart: suspended task -- returns to caller 27
rtems_task_restart: blocked task -- returns to caller 36
rtems_task_restart: ready task -- returns to caller 27
rtems_task_restart: suspended task -- preempts caller 40
rtems_task_restart: blocked task -- preempts caller 51
rtems_task_restart: ready task -- preempts caller 52
rtems_task_delete: calling task 67
rtems_task_delete: suspended task 52
rtems_task_delete: blocked task 54
rtems_task_delete: ready task 54
rtems_task_suspend: calling task 23
rtems_task_suspend: returns to caller 12
rtems_task_resume: task readied -- returns to caller 13
rtems_task_resume: task readied -- preempts caller 22
rtems_task_set_priority: obtain current priority 8
rtems_task_set_priority: returns to caller 16
rtems_task_set_priority: preempts caller 34
rtems_task_mode: obtain current mode 4
rtems_task_mode: no reschedule 5
rtems_task_mode: reschedule -- returns to caller 12
rtems_task_mode: reschedule -- preempts caller 26
rtems_task_get_note 8
rtems_task_set_note 8
rtems_task_wake_after: yield -- returns to caller 4
rtems_task_wake_after: yields -- preempts caller 19
rtems_task_wake_when 36
Interrupt Manager
interrupt entry overhead: returns to nested interrupt 5
interrupt entry overhead: returns to interrupted task 9
interrupt entry overhead: returns to preempting task 7
interrupt exit overhead: returns to nested interrupt 1
interrupt exit overhead: returns to interrupted task 2
interrupt exit overhead: returns to preempting task 26
Clock Manager
rtems_clock_set 20
rtems_clock_get <1
rtems_clock_tick 8
Timer Manager
rtems_timer_create 8
rtems_timer_ident 104
rtems_timer_delete: inactive 12
rtems_timer_delete: active 13
rtems_timer_fire_after: inactive 17
rtems_timer_fire_after: active 18
rtems_timer_fire_when: inactive 23
rtems_timer_fire_when: active 23
rtems_timer_reset: inactive 16
rtems_timer_reset: active 17
rtems_timer_cancel: inactive 9
rtems_timer_cancel: active 10
Semaphore Manager
rtems_semaphore_create 22
rtems_semaphore_ident 119
rtems_semaphore_delete 24
rtems_semaphore_obtain: available 10
rtems_semaphore_obtain: not available -- NO_WAIT 10
rtems_semaphore_obtain: not available -- caller blocks 35
rtems_semaphore_release: no waiting tasks 11
rtems_semaphore_release: task readied -- returns to caller 17
rtems_semaphore_release: task readied -- preempts caller 27
Message Queue Manager
rtems_message_queue_create 85
rtems_message_queue_ident 103
rtems_message_queue_delete 32
rtems_message_queue_send: no waiting tasks 25
rtems_message_queue_send: task readied -- returns to caller 27
rtems_message_queue_send: task readied -- preempts caller 39
rtems_message_queue_urgent: no waiting tasks 26
rtems_message_queue_urgent: task readied -- returns to caller 28
rtems_message_queue_urgent: task readied -- preempts caller 39
rtems_message_queue_broadcast: no waiting tasks 13
rtems_message_queue_broadcast: task readied -- returns to caller 37
rtems_message_queue_broadcast: task readied -- preempts caller 45
rtems_message_queue_receive: available 21
rtems_message_queue_receive: not available -- NO_WAIT 11
rtems_message_queue_receive: not available -- caller blocks 37
rtems_message_queue_flush: no messages flushed 7
rtems_message_queue_flush: messages flushed 10
Event Manager
rtems_event_send: no task readied 7
rtems_event_send: task readied -- returns to caller 18
rtems_event_send: task readied -- preempts caller 29
rtems_event_receive: obtain current events <1
rtems_event_receive: available 10
rtems_event_receive: not available -- NO_WAIT 5
rtems_event_receive: not available -- caller blocks 28
Signal Manager
rtems_signal_catch 5
rtems_signal_send: returns to caller 15
rtems_signal_send: signal to self 24
exit ASR overhead: returns to calling task 20
exit ASR overhead: returns to preempting task 21
Partition Manager
rtems_partition_create 30
rtems_partition_ident 103
rtems_partition_delete 14
rtems_partition_get_buffer: available 14
rtems_partition_get_buffer: not available 9
rtems_partition_return_buffer 18
Region Manager
rtems_region_create 25
rtems_region_ident 105
rtems_region_delete 13
rtems_region_get_segment: available 13
rtems_region_get_segment: not available -- NO_WAIT 17
rtems_region_get_segment: not available -- caller blocks 49
rtems_region_return_segment: no waiting tasks 16
rtems_region_return_segment: task readied -- returns to caller 35
rtems_region_return_segment: task readied -- preempts caller 58
Dual-Ported Memory Manager
rtems_port_create 13
rtems_port_ident 103
rtems_port_delete 14
rtems_port_external_to_internal 5
rtems_port_internal_to_external 5
IO Manager
rtems_io_initialize <1
rtems_io_open <1
rtems_io_close <1
rtems_io_read <1
rtems_io_write <1
rtems_io_control <1
Rate Monotonic Manager
rtems_rate_monotonic_create 15
rtems_rate_monotonic_ident 103
rtems_rate_monotonic_cancel 16
rtems_rate_monotonic_delete: active 18
rtems_rate_monotonic_delete: inactive 20
rtems_rate_monotonic_period: initiate period -- returns to caller 23
rtems_rate_monotonic_period: conclude periods -- caller blocks 25
rtems_rate_monotonic_period: obtain status 13

View File

@@ -133,6 +133,35 @@
#include <bsp.h> /* Must be before libio.h */
#include <rtems/libio.h>
/* Utility functions */
void cd2401_udelay( unsigned long delay );
void cd2401_chan_cmd( rtems_unsigned8 channel, rtems_unsigned8 cmd, rtems_unsigned8 wait );
rtems_unsigned16 cd2401_bitrate_divisor( rtems_unsigned32 clkrate, rtems_unsigned32* bitrate );
void cd2401_initialize( void );
void cd2401_interrupts_initialize( rtems_boolean enable );
/* ISRs */
rtems_isr cd2401_modem_isr( rtems_vector_number vector );
rtems_isr cd2401_re_isr( rtems_vector_number vector );
rtems_isr cd2401_rx_isr( rtems_vector_number vector );
rtems_isr cd2401_tx_isr( rtems_vector_number vector );
/* Termios callbacks */
int cd2401_firstOpen( int major, int minor, void *arg );
int cd2401_lastClose( int major, int minor, void *arg );
int cd2401_setAttributes( int minor, const struct termios *t );
int cd2401_startRemoteTx( int minor );
int cd2401_stopRemoteTx( int minor );
int cd2401_write( int minor, const char *buf, int len );
int cd2401_drainOutput( int minor );
int _167Bug_pollRead( int minor );
int _167Bug_pollWrite( int minor, const char *buf, int len );
/* Printk function */
static void _BSP_output_char( char c );
BSP_output_char_function_type BSP_output_char = _BSP_output_char;
/* Channel info */
/* static */ volatile struct {
@@ -145,7 +174,7 @@
rtems_unsigned32 buserr_type; /* Reason of bus error during DMA */
rtems_unsigned8 own_buf_A; /* If true, buffer A belongs to the driver */
rtems_unsigned8 own_buf_B; /* If true, buffer B belongs to the driver */
rtems_unsigned8 txEmpty; /* If true, the output FIFO is supposed to be empty */
rtems_unsigned8 txEmpty; /* If true, the output FIFO should be empty */
} CD2401_Channel_Info[4];
/*
@@ -172,31 +201,6 @@ rtems_isr_entry Prev_modem_isr; /* Previous modem/timer isr */
#include "console-recording.c"
/* Utility functions */
void cd2401_udelay( unsigned long delay );
void cd2401_chan_cmd( rtems_unsigned8 channel, rtems_unsigned8 cmd, rtems_unsigned8 wait );
rtems_unsigned16 cd2401_bitrate_divisor( rtems_unsigned32 clkrate, rtems_unsigned32* bitrate );
void cd2401_initialize( void );
void cd2401_interrupts_initialize( rtems_boolean enable );
/* ISRs */
rtems_isr cd2401_modem_isr( rtems_vector_number vector );
rtems_isr cd2401_re_isr( rtems_vector_number vector );
rtems_isr cd2401_rx_isr( rtems_vector_number vector );
rtems_isr cd2401_tx_isr( rtems_vector_number vector );
/* Termios callbacks */
int cd2401_firstOpen( int major, int minor, void *arg );
int cd2401_lastClose( int major, int minor, void *arg );
int cd2401_setAttributes( int minor, const struct termios *t );
int cd2401_startRemoteTx( int minor );
int cd2401_stopRemoteTx( int minor );
int cd2401_write( int minor, const char *buf, int len );
int cd2401_drainOutput( int minor );
int _167Bug_pollRead( int minor );
int _167Bug_pollWrite( int minor, const char *buf, int len );
/*
* Utility functions.
*/
@@ -259,7 +263,7 @@ void cd2401_chan_cmd(
if ( channel < 4 ) {
cd2401->car = channel; /* Select channel */
while ( cd2401->ccr != 0 ); /* Wait for completion of any previous command */
while ( cd2401->ccr != 0 ); /* Wait for completion of previous command */
cd2401->ccr = cmd; /* Send command */
if ( wait )
while( cd2401->ccr != 0 );/* Wait for completion */
@@ -298,7 +302,7 @@ rtems_unsigned16 cd2401_bitrate_divisor(
divisor = *bitrate << 3; /* temporary; multiply by 8 for CLK/8 */
divisor = (clkrate + (divisor>>1)) / divisor; /* divisor for clk0 (CLK/8) */
/* Use highest speed clock source for best precision - try from clk0 to clk4: */
/* Use highest speed clock source for best precision - try clk0 to clk4 */
for( clksource = 0; clksource < 0x0400 && divisor > 0x100; clksource += 0x0100 )
divisor >>= 2;
divisor--; /* adjustment, see specs */
@@ -358,10 +362,10 @@ void cd2401_initialize( void )
* THE USER MUST PROGRAM CHANNEL NUMBER IN LICR! It is not set automatically
* by the hardware, as suggested by the manual.
*
* The updated manual (part no 542400-007) has the story strait. The CD2401
* automatically initializes the LICR to contain the channel number in bits
* 2 and 3. However, these bits are not preserved when the user defined bits
* are written.
* The updated manual (part no 542400-007) has the story straight. The
* CD2401 automatically initializes the LICR to contain the channel number
* in bits 2 and 3. However, these bits are not preserved when the user
* defined bits are written.
*
* The same vector number is used for all four channels. Different vector
* numbers could be programmed for each channel, thus avoiding the need to
@@ -603,7 +607,8 @@ rtems_isr cd2401_tx_isr(
if ( status & 0x80 ) {
/*
* Bus error occurred during DMA transfer. For now, just record.
* Get reason for DMA bus error and clear the report for the next occurrence
* Get reason for DMA bus error and clear the report for the next
* occurrence
*/
buserr = pccchip2->SCC_error;
pccchip2->SCC_error = 0x01;
@@ -1017,15 +1022,15 @@ int cd2401_setAttributes(
/* Clear channel */
cd2401_chan_cmd (minor, 0x40, 1);
cd2401->car = minor; /* Select channel */
cd2401->cmr = 0x42; /* Interrupt Rx, DMA Tx, async mode */
cd2401->car = minor; /* Select channel */
cd2401->cmr = 0x42; /* Interrupt Rx, DMA Tx, async mode */
cd2401->cor1 = parodd | parenb | ignpar | csize;
cd2401->cor2 = sw_flow_ctl | hw_flow_ctl;
cd2401->cor3 = extra_flow_ctl | cstopb;
cd2401->cor4 = 0x0A; /* No DSR/DCD/CTS detect; FIFO threshold of 10 */
cd2401->cor5 = 0x0A; /* No DSR/DCD/CTS detect; DTR threshold of 10 */
cd2401->cor4 = 0x0A; /* No DSR/DCD/CTS detect; FIFO threshold of 10 */
cd2401->cor5 = 0x0A; /* No DSR/DCD/CTS detect; DTR threshold of 10 */
cd2401->cor6 = igncr | icrnl | inlcr | ignbrk | brkint | parmrk | inpck;
cd2401->cor7 = istrip; /* No LNext; ignore XON/XOFF if frame error; no tx translations */
cd2401->cor7 = istrip; /* No LNext; ignore XON/XOFF if frame error; no tx translations */
/* Special char 1: XON character */
cd2401->u1.async.schr1 = t->c_cc[VSTART];
/* special char 2: XOFF character */
@@ -1040,7 +1045,7 @@ int cd2401_setAttributes(
cd2401->rbpr = (unsigned char)rx_period;
cd2401->rcor = (unsigned char)(rx_period >> 8); /* no DPLL */
cd2401->tbpr = (unsigned char)tx_period;
cd2401->tcor = (tx_period >> 3) & 0xE0; /* no x1 ext clk, no loopback */
cd2401->tcor = (tx_period >> 3) & 0xE0; /* no x1 ext clk, no loopback */
/* Timeout for 4 chars at 9600, 8 bits per char, 1 stop bit */
cd2401->u2.w.rtpr = 0x04; /* NEED TO LOOK AT THIS LINE! */
@@ -1238,6 +1243,10 @@ int cd2401_write(
*
* MUST NOT BE EXECUTED WITH THE CD2401 INTERRUPTS DISABLED!
* The txEmpty flag is set by the tx ISR.
*
* DOES NOT WORK! DO NOT ENABLE THIS CODE. THE CD2401 DOES NOT COOPERATE!
* The code is here to document that the output FIFO is NOT empty when
* the CD2401 reports that the Tx buffer is empty.
*/
int cd2401_drainOutput(
int minor
@@ -1272,8 +1281,6 @@ int cd2401_drainOutput(
* -1 if no character is present in the input FIFO.
*
* CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O!
* This function is invoked when the device driver is compiled with
* CD2401_POLLED_IO set to 1 above. All I/O is then done through 167Bug.
*/
int _167Bug_pollRead(
int minor
@@ -1281,28 +1288,38 @@ int _167Bug_pollRead(
{
int char_not_available;
unsigned char c;
rtems_interrupt_level previous_level;
/* Check for a char in the input FIFO */
asm volatile( "movew #0x1, -(%%sp) /* Code for .INSTAT */
movew %1, -(%%sp) /* Channel */
/*
* Redirection of .INSTAT does not work: 167-Bug crashes.
* Switch the input stream to the specified port.
* Make sure this is atomic code.
*/
rtems_interrupt_disable( previous_level );
asm volatile( "movew %1, -(%%sp) /* Channel */
trap #15 /* Trap to 167Bug */
.short 0x60 /* Code for .REDIR */
.short 0x61 /* Code for .REDIR_I */
trap #15 /* Trap to 167Bug */
.short 0x01 /* Code for .INSTAT */
move %%cc, %0 /* Get condition codes */
andil #4, %0" /* Keep the Zero bit */
: "=d" (char_not_available) : "d" (minor): "%%cc" );
if (char_not_available)
if (char_not_available) {
rtems_interrupt_enable( previous_level );
return -1;
}
/* Read the char and return it */
asm volatile( "subq.l #2,%%a7 /* Space for result */
movew #0x0, -(%%sp) /* Code for .INCHR */
movew %1, -(%%sp) /* Channel */
trap #15 /* Trap to 167 Bug */
.short 0x60 /* Code for .REDIR */
.short 0x00 /* Code for .INCHR */
moveb (%%a7)+, %0" /* Pop char into c */
: "=d" (c) : "d" (minor) );
: "=d" (c) : );
rtems_interrupt_enable( previous_level );
return (int)c;
}
@@ -1323,8 +1340,6 @@ int _167Bug_pollRead(
* Return value: IGNORED
*
* CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O!
* This function is invoked when the device driver is compiled with
* CD2401_POLLED_IO set to 1 above. All I/O is then done through 167Bug.
*/
int _167Bug_pollWrite(
int minor,
@@ -1348,40 +1363,109 @@ int _167Bug_pollWrite(
/*
* Print functions: prototyped in bsp.h
* Debug printing on Channel 1
* do_poll_read
*
* Input characters through 167Bug. Returns has soon as a character has been
* received. Otherwise, if we wait for the number of requested characters, we
* could be here forever!
*
* CR is converted to LF on input. The terminal should not send a CR/LF pair
* when the return or enter key is pressed.
*
* Input parameters:
* major - ignored. Should be the major number for this driver.
* minor - selected channel.
* arg->buffer - where to put the received characters.
* arg->count - number of characters to receive before returning--Ignored.
*
* Output parameters:
* arg->bytes_moved - the number of characters read. Always 1.
*
* Return value: RTEMS_SUCCESSFUL
*
* CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O!
*/
void printk( char *fmt, ... )
rtems_status_code do_poll_read(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
va_list ap; /* points to each unnamed argument in turn */
static char buf[256];
unsigned int level;
_CPU_ISR_Disable(level);
va_start(ap, fmt); /* make ap point to 1st unnamed arg */
vsprintf(buf, fmt, ap); /* send output to buffer */
BSP_output_string(buf); /* print buffer -- Channel 1 */
va_end(ap); /* clean up and re-enable interrupts */
_CPU_ISR_Enable(level);
rtems_libio_rw_args_t *rw_args = arg;
int c;
while( (c = _167Bug_pollRead (minor)) == -1 );
rw_args->buffer[0] = (unsigned8)c;
if( rw_args->buffer[0] == '\r' )
rw_args->buffer[0] = '\n';
rw_args->bytes_moved = 1;
return RTEMS_SUCCESSFUL;
}
/*
* do_poll_write
*
* Output characters through 167Bug. Returns only once every character has
* been sent.
*
* CR is transmitted AFTER a LF on output.
*
* Input parameters:
* major - ignored. Should be the major number for this driver.
* minor - selected channel
* arg->buffer - where to get the characters to transmit.
* arg->count - the number of characters to transmit before returning.
*
* Output parameters:
* arg->bytes_moved - the number of characters read
*
* Return value: RTEMS_SUCCESSFUL
*
* CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O!
*/
rtems_status_code do_poll_write(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
rtems_libio_rw_args_t *rw_args = arg;
unsigned32 i;
char cr ='\r';
for( i = 0; i < rw_args->count; i++ ) {
_167Bug_pollWrite(minor, &(rw_args->buffer[i]), 1);
if ( rw_args->buffer[i] == '\n' )
_167Bug_pollWrite(minor, &cr, 1);
}
rw_args->bytes_moved = i;
return RTEMS_SUCCESSFUL;
}
void BSP_output_string( char * buf )
/*
* _BSP_output_char
*
* printk() function prototyped in bspIo.h. Does not use termios.
*/
void _BSP_output_char(char c)
{
int len = strlen(buf);
rtems_status_code sc;
rtems_device_minor_number printk_minor;
/* The first argument forces a print to Port2 (ttyS1) */
sc = _167Bug_pollWrite(1, buf, len);
if (sc != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred (sc);
/*
* Can't rely on console_initialize having been called before this function
* is used.
*/
if ( NVRAM_CONFIGURE )
/* J1-4 is on, use NVRAM info for configuration */
printk_minor = nvram->console_printk_port & 0x30;
else
printk_minor = PRINTK_MINOR;
_167Bug_pollWrite(printk_minor, &c, 1);
}
/*
***************
* BOILERPLATE *
@@ -1400,14 +1484,29 @@ rtems_device_driver console_initialize(
)
{
rtems_status_code status;
rtems_device_minor_number console_minor;
/*
* Set up TERMIOS
* Set up TERMIOS if needed
*/
rtems_termios_initialize ();
if ( NVRAM_CONFIGURE ) {
/* J1-4 is on, use NVRAM info for configuration */
console_minor = nvram->console_printk_port & 0x03;
if ( nvram->console_mode & 0x01 )
/* termios */
rtems_termios_initialize ();
}
else {
console_minor = CONSOLE_MINOR;
#if CD2401_USE_TERMIOS == 1
rtems_termios_initialize ();
#endif
}
/*
* Do device-specific initialization
* Does not affect 167-Bug.
*/
cd2401_initialize ();
@@ -1422,7 +1521,7 @@ rtems_device_driver console_initialize(
if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred (status);
status = rtems_io_register_name ("/dev/console", major, 1);
status = rtems_io_register_name ("/dev/console", major, console_minor);
if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred (status);
@@ -1446,10 +1545,7 @@ rtems_device_driver console_open(
void * arg
)
{
#if CD2401_POLLED_IO
/* I/O is limited to 167Bug console. minor is ignored! */
static const rtems_termios_callbacks callbacks = {
static const rtems_termios_callbacks pollCallbacks = {
NULL, /* firstOpen */
NULL, /* lastClose */
_167Bug_pollRead, /* pollRead */
@@ -1459,10 +1555,8 @@ rtems_device_driver console_open(
NULL, /* startRemoteTx */
0 /* outputUsesInterrupts */
};
#else
static const rtems_termios_callbacks callbacks = {
static const rtems_termios_callbacks intrCallbacks = {
cd2401_firstOpen, /* firstOpen */
cd2401_lastClose, /* lastClose */
NULL, /* pollRead */
@@ -1473,11 +1567,37 @@ rtems_device_driver console_open(
1 /* outputUsesInterrupts */
};
if ( NVRAM_CONFIGURE )
/* J1-4 is on, use NVRAM info for configuration */
if ( nvram->console_mode & 0x01 )
/* termios */
if ( nvram->console_mode & 0x02 )
/* interrupt-driven I/O */
return rtems_termios_open (major, minor, arg, &intrCallbacks);
else
/* polled I/O */
return rtems_termios_open (major, minor, arg, &pollCallbacks);
else
/* no termios -- default to polled I/O */
return RTEMS_SUCCESSFUL;
#if CD2401_USE_TERMIOS == 1
#if CD2401_IO_MODE != 1
else
/* termios & polled I/O*/
return rtems_termios_open (major, minor, arg, &pollCallbacks);
#else
else
/* termios & interrupt-driven I/O*/
return rtems_termios_open (major, minor, arg, &intrCallbacks);
#endif
#else
else
/* no termios -- default to polled I/O */
return RTEMS_SUCCESSFUL;
#endif
return rtems_termios_open (major, minor, arg, &callbacks);
}
/*
* Close the device
*/
@@ -1487,9 +1607,27 @@ rtems_device_driver console_close(
void * arg
)
{
return rtems_termios_close (arg);
if ( NVRAM_CONFIGURE ) {
/* J1-4 is on, use NVRAM info for configuration */
if ( nvram->console_mode & 0x01 )
/* termios */
return rtems_termios_close (arg);
else
/* no termios */
return RTEMS_SUCCESSFUL;
}
#if CD2401_USE_TERMIOS == 1
else
/* termios */
return rtems_termios_close (arg);
#else
else
/* no termios */
return RTEMS_SUCCESSFUL;
#endif
}
/*
* Read from the device
*/
@@ -1499,9 +1637,27 @@ rtems_device_driver console_read(
void * arg
)
{
return rtems_termios_read (arg);
if ( NVRAM_CONFIGURE ) {
/* J1-4 is on, use NVRAM info for configuration */
if ( nvram->console_mode & 0x01 )
/* termios */
return rtems_termios_read (arg);
else
/* no termios -- default to polled */
return do_poll_read (major, minor, arg);
}
#if CD2401_USE_TERMIOS == 1
else
/* termios */
return rtems_termios_read (arg);
#else
else
/* no termios -- default to polled */
return do_poll_read (major, minor, arg);
#endif
}
/*
* Write to the device
*/
@@ -1511,9 +1667,27 @@ rtems_device_driver console_write(
void * arg
)
{
return rtems_termios_write (arg);
if ( NVRAM_CONFIGURE ) {
/* J1-4 is on, use NVRAM info for configuration */
if ( nvram->console_mode & 0x01 )
/* termios */
return rtems_termios_write (arg);
else
/* no termios -- default to polled */
return do_poll_write (major, minor, arg);
}
#if CD2401_USE_TERMIOS == 1
else
/* termios */
return rtems_termios_write (arg);
#else
else
/* no termios -- default to polled */
return do_poll_write (major, minor, arg);
#endif
}
/*
* Handle ioctl request.
*/
@@ -1523,5 +1697,22 @@ rtems_device_driver console_control(
void * arg
)
{
return rtems_termios_ioctl (arg);
if ( NVRAM_CONFIGURE ) {
/* J1-4 is on, use NVRAM info for configuration */
if ( nvram->console_mode & 0x01 )
/* termios */
return rtems_termios_ioctl (arg);
else
/* no termios -- default to polled */
return RTEMS_SUCCESSFUL;
}
#if CD2401_USE_TERMIOS == 1
else
/* termios */
return rtems_termios_ioctl (arg);
#else
else
/* no termios -- default to polled */
return RTEMS_SUCCESSFUL;
#endif
}

View File

@@ -1657,6 +1657,7 @@ int uti596_attach(
{
uti596_softc_ *sc = &uti596_softc; /* device dependent data structure */
struct ifnet * ifp = (struct ifnet *)&sc->arpcom.ac_if; /* ifnet structure */
unsigned char j1; /* State of J1 jumpers */
int unitNumber;
char *unitName;
char *pAddr;
@@ -1687,38 +1688,72 @@ int uti596_attach(
ifp->if_mtu = ETHERMTU;
/*
* If an IP address and netmask are provided in NVRAM, cheat,
* and stuff them into the ifconfig structure, overriding any
* existing or NULL values.
* Check whether parameters should be obtained from NVRAM. If
* yes, and if an IP address, netmask, or ethernet address are
* provided in NVRAM, cheat, and stuff them into the ifconfig
* structure, OVERRIDING and existing or NULL values.
*
* Warning: If values are provided in NVRAM, the ifconfig entries
* should be NULL because buffer memory allocated to hold the
* must be NULL because buffer memory allocated to hold the
* structure values is unrecoverable and would be lost here.
*/
if ( (addr = nvram->ipaddr) ) {
if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
pConfig->ip_address = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
else
rtems_panic("Can't allocate ip_address buffer!\n");
}
if ( (addr = nvram->netmask) ) {
if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
pConfig->ip_netmask = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
else
rtems_panic("Can't allocate ip_netmask buffer!\n");
}
/* Ethernet address can be specified in NVRAM, or in the ifconfig
* structure. It will be read by default from BBRAM at $FFFC1F2C
* (6 bytes) mvme167 manual p. 1-47
*/
if ( nvram->enaddr ) {
memcpy ((void *)sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
/* Read the J1 header */
j1 = (unsigned char)(lcsr->vector_base & 0xFF);
if ( !(j1 & 0x10) ) {
/* Jumper J1-4 is on, configure from NVRAM */
if ( (addr = nvram->ipaddr) ) {
/* We have a non-zero entry, copy the value */
if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
pConfig->ip_address = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
else
rtems_panic("Can't allocate ip_address buffer!\n");
}
if ( (addr = nvram->netmask) ) {
/* We have a non-zero entry, copy the value */
if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
pConfig->ip_netmask = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
else
rtems_panic("Can't allocate ip_netmask buffer!\n");
}
/* Ethernet address requires special handling -- it must be copied into
* the arpcom struct. The following if construct serves only to give the
* NVRAM parameter the highest priority if J1-4 indicates we are configuring
* from NVRAM.
*
* If the ethernet address is specified in NVRAM, go ahead and copy it.
* (ETHER_ADDR_LEN = 6 bytes).
*/
if ( nvram->enaddr[0] || nvram->enaddr[1] || nvram->enaddr[2] ) {
/* Anything in the first three bytes indicates a non-zero entry, copy value */
memcpy ((void *)sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
}
else if ( pConfig->hardware_address) {
/* There is no entry in NVRAM, but there is in the ifconfig struct, so use it. */
memcpy ((void *)sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
}
else {
/* There is no ethernet address provided, so it will be read
* from BBRAM at $FFFC1F2C by default. [mvme167 manual p. 1-47]
*/
memcpy ((void *)sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
}
}
else if ( pConfig->hardware_address) {
/* We are not configuring from NVRAM (J1-4 is off), and the ethernet address
* is given in the ifconfig structure. Copy it.
*/
memcpy ((void *)sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
}
else {
/* We are not configuring from NVRAM (J1-4 is off), and there is no ethernet
* address provided in the ifconfig struct, so it will be read from BBRAM at
* $FFFC1F2C by default. [mvme167 manual p. 1-47]
*/
memcpy ((void *)sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
}

View File

@@ -33,12 +33,12 @@
* errors if we address non-existent memory within this range. Our two
* MVME167s are configured to exist at physical addresses 0x00800000 to
* 0x00BFFFFF and 0x00C00000 to 0x00FFFFFF respectively. If jumper J1-4 is
* installed, memeory and cache control can be done by providing parameters
* in NVRAM. See the README for details. If J1-4 is removed, behaviour
* defaults to the following. We map the space from 0x0 to 0x7FFFFFFF as
* copyback, unless jumper J1-5 is removed, in which case we map as writethrough.
* If jumper J1-7 is removed, the data cache is NOT enabled. If jumper J1-6
* is removed, the instruction cache is not enabled.
* installed, memory and cache control can be done by providing parameters
* in NVRAM and jumpers J1-[5-7] are ignored. See the README for details.
* If J1-4 is removed, behaviour defaults to the following. We map the space
* from 0x0 to 0x7FFFFFFF as copyback, unless jumper J1-5 is removed, in which
* case we map as writethrough. If jumper J1-7 is removed, the data cache is
* NOT enabled. If jumper J1-6 is removed, the instruction cache is not enabled.
*
* Copyright (c) 1998, National Research Council of Canada
*
@@ -94,25 +94,25 @@ void page_table_init(
if ( !(j1 & 0x10) ) {
/* Jumper J1-4 is on, configure from NVRAM */
if ( nvram->dcache_enable )
if ( nvram->cache_mode & 0x01 )
cacr |= 0x80000000;
if ( nvram->icache_enable )
if ( nvram->cache_mode & 0x02 )
cacr |= 0x00008000;
if ( nvram->cache_mode )
dtt0 = ((nvram->cache_mode & 0x0003) << 5) | (dtt0 & 0xFFFFFF9F);
dtt0 = ((nvram->cache_mode & 0x0C) << 3) | (dtt0 & 0xFFFFFF9F);
}
else {
/* Configure according to other jumper settings */
if ( j1 & 0x80 )
/* Jumper J1-7 if off, disable data caching */
cacr &= 0x7FFFFFFF;
if ( !(j1 & 0x80) )
/* Jumper J1-7 if on, enable data caching */
cacr |= 0x80000000;
if ( j1 & 0x40 )
/* Jumper J1-6 if off, disable instruction caching */
cacr &= 0xFFFF7FFF;
if ( !(j1 & 0x40) )
/* Jumper J1-6 if on, enable instruction caching */
cacr |= 0x00008000;
if ( j1 & 0x20 )
/* Jumper J1-5 is off, enable writethrough caching */

View File

@@ -1,5 +1,5 @@
#
# Timing Test Suite Results for the MBX860-002
# Timing Test Suite Results for the MVME167
#
# $Id$
#