How to use Console Driver of RTEMS on MVME162

AJAI KUMAR MEDHAVI akmedhavi at rrcat.gov.in
Fri Aug 2 07:45:08 UTC 2013


Hi


I am working on RTEMS 4.10.2 on MVME162-522A VME CPU Board. I wish to use
RTEMS consloe driver (..\libbsp\m68k\mvme162\console) functions to read
/write on both channels of CPU board.


Here I have  following queries regarding console driver :


1. How to wish to directly use rtems_io_read and rtems_io_write, for
writing/reading on channels,  by providng console/tty00/tty01 major and
minor number and pointer to arg.


here How should I know Console Major number. Because RTEMS itself
registers console driver if we include
"=define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER" in the application.


To find out Console Major/Minor number pair , I have used following call
in my application :

/*----Get Console Device Major / Minor Number---------------------------*/
	status = rtems_io_lookup_name( "/dev/console",
&Console_low_level_device_info );
	if(status != RTEMS_SUCCESSFUL)
		rtems_fatal_error_occurred(status);

	Console_device_major = Console_low_level_device_info.major;
	Console_device_minor = Console_low_level_device_info.minor;

I have defined Console_device_major, Console_device_minor as global
variables.


printf("\n\nConsole Device Major No. : %d", (int)Console_device_major);
	printf("\nConsole Device Minor No. : %d", (int)Console_device_minor);


but on printing Console Major/ Minor number is coming sometimes 0 / 0 and
sometimes  different values other than 0 / 0 when I compile my application
without making any changes in console.c and above system call in my
application.

When It major/monor comes 0 / 0 I am able to write on channel 0 bu using
console Major no. (zero) and minor number (Zero).


I am not able to understand why I am getting different values of Major /
Minor Values.


2. Second, in console_initialize of
(..\libbsp\m68k\mvme162\console\console.c)

I have found following code :


status = rtems_io_register_name(
		"/dev/console",
		major,
		(rtems_device_minor_number) 1
	);

	if (status != RTEMS_SUCCESSFUL)
		rtems_fatal_error_occurred(status);

	status = rtems_io_register_name(
		"/dev/tty00",
		major,
		(rtems_device_minor_number) 0
	);

	if (status != RTEMS_SUCCESSFUL)
		rtems_fatal_error_occurred(status);

	status = rtems_io_register_name(
		"/dev/tty01",
		major,
		(rtems_device_minor_number) 1
	);


It means Console Minor number must be (One), then I am getting console
minor number as zero, when comming correctly, and I am able to write on
console channel by proving console Major: 0 and Console Minor :0 in
rtems_io_write


Here I am confused whether console channel is channel-0 or Channel-1 of
Channels provided by Z85230 SCC Chip on MVME162 CPU Board. At present my
PC COM1 is connected to Console Port/Serial Port1 of CPU board.


Kindly let me know what are  exact channel number of Console/tty00/tty01.
Please note that Z85230 SCC chip on MVME162 defines two channels CH-B
(channel 0 ) and CH-A (channel-1)


In brief , please let me know following :

1. how to find Console/tty00/tty01  Major/Minor number pair for using
   in rtems_io_read and rtems_io_write


2. exact channel number of Console/tty00/tty01. Please note that Z85230
SCC chip on MVME162 defines two channels CH-B (channel 0 ) and CH-A
(channel-1)
Whther minor number 1 corresponds to Channel 1 of SCC and minor number 0
corresponds to channel number 0 of SCC.


3. Why Console Major/ Minor number is coming  as 0/0 while "/dev/console
has been named as minor 1 in status =
rtems_io_register_name("/dev/console",
major, 	(rtems_device_minor_number) 1 )


Also not always as 0/0, it is coming with different - different values
like -1 / 444768 and 25768/25678 and so many values ....


4. when I set "Console_Is_Initialized" to 1 in console_initialize(...)
then I get no printf on console as per following function in console.c


void _BSP_output_char(char c)
{
  if(Console_Is_Initialized)
    putchar(c);
  else
    _162Bug_output_char(c);

  if ('\n' == c)
    _BSP_output_char('\r');
}

What is exactly happening when I set Console_Is_Initialized to 1.




Kindly reply me at the earliest.


Thanks in advance



Best regards



AJAI KUMAR MEDHAVI
SCIENTIFIC OFFICER
RAJA RAMMANNA CENTRE FOR ADVANCED TECHNOLGY
DEPARTMENT OF ATOMIC ENERGY, GOV. OF INDIA,
PO : CAT, INDORE-452013, INDIA
PH. 91-731-2488052
Email : akmedhavi at rrcat.gov.in , akmedhavi at rediffmail.com








More information about the users mailing list