<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Verdana">Actually, the initDriver() call is inside
bsp_start(), so, as you said, RTEMS is not initialized. If this is the
wrong place, where should this function call would be?<br>
<br>
I also tried declaring </font>CONFIGURE_MAXIMUM_DRIVERS with a high
number in my application, but with the same result
(RTEMS_INVALID_NUMBER). But is this necessary if we are using dynamic
registration (rtems_io_register_driver)?<br>
<br>
Thanks,<br>
<font face="Verdana"><br>
</font><br>
<br>
Joel Sherrill escribió:
<blockquote cite="mid:4787A4E5.2030703@oarcorp.com" type="cite">Gatti
André wrote:
<br>
<blockquote type="cite">We get the error RTEMS_INVALID_NUMBER when
trying to register an IO driver with the call to
rtems_io_register_driver (in the function initDriver()).
<br>
<br>
</blockquote>
Has RTEMS even been initialized yet? Are you in the function
<br>
bsp_start? If so, then it hasn't.
<br>
<br>
_IO_Number_of_drivers could be 0 if RTEMS isn't initialized.
<br>
<br>
<blockquote type="cite">The function initDriver() is call in the
bspStart.c file.
<br>
<br>
The condition that cause the problem inside rtems_io_register_driver()
is
<br>
if ( major >= _IO_Number_of_drivers )
<br>
return RTEMS_INVALID_NUMBER;
<br>
<br>
<br>
<br>
Example:
<br>
<br>
static rtems_status_code rtems_io_initialize(rtems_device_major_number
major, rtems_device_minor_number minor, void * argument);
<br>
static rtems_status_code rtems_io_open(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument);
<br>
static rtems_status_code rtems_io_close(rtems_device_major_number
major, rtems_device_minor_number minor, void * argument);
<br>
static rtems_status_code rtems_io_read(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument);
<br>
static rtems_status_code rtems_io_write(rtems_device_major_number
major, rtems_device_minor_number minor, void * argument);
<br>
static rtems_status_code rtems_io_control(rtems_device_major_number
major, rtems_device_minor_number minor, void * argument);
<br>
<br>
rtems_driver_address_table driver_table = {
<br>
rtems_io_initialize,
<br>
rtems_io_open,
<br>
rtems_io_close,
<br>
rtems_io_read,
<br>
rtems_io_write,
<br>
rtems_io_control,
<br>
};
<br>
<br>
void init(){
<br>
rtems_status_code r;
<br>
rtems_device_major_number registered_major;
<br>
<br>
if ((r = rtems_io_register_driver(0, &driver_table,
®istered_major)) == RTEMS_SUCCESSFUL) {
<br>
printk("Driver successfully registered, major: %d\n",
registered_major);
<br>
} else {
<br>
switch(r) {
<br>
case RTEMS_TOO_MANY:
<br>
printk("rtems_io_register_driver failed: RTEMS_TOO_MANY
(%d)\n", registered_major); break;
<br>
case RTEMS_INVALID_NUMBER:
<br>
printk("rtems_io_register_driver failed:
RTEMS_INVALID_NUMBER (%d)\n", registered_major); break;
<br>
case RTEMS_RESOURCE_IN_USE:
<br>
printk("rtems_io_register_driver failed:
RTEMS_RESOURCE_IN_USE (%d)\n", registered_major); break;
<br>
default:
<br>
printk("rtems_io_register_driver failed (%d)\n",
registered_major);
<br>
}
<br>
}
<br>
return;
<br>
}
<br>
<br>
rtems_status_code rtems_io_initialize(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument){
<br>
rtems_device_major_number registered_major;
<br>
<br>
if(rtems_io_register_name("/dev/iodriver", registered_major, 0) ==
RTEMS_SUCCESSFUL){
<br>
return RTEMS_SUCCESSFUL;
<br>
}
<br>
<br>
return RTEMS_INTERNAL_ERROR;
<br>
}
<br>
<br>
rtems_status_code rtems_io_open(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument){
<br>
printk("Open.\n");
<br>
return RTEMS_SUCCESSFUL;
<br>
}
<br>
<br>
<br>
rtems_status_code rtems_io_close(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument){
<br>
printk("Close.\n");
<br>
return RTEMS_SUCCESSFUL;
<br>
}
<br>
<br>
<br>
rtems_status_code rtems_io_read(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument){
<br>
printk("Read.\n");
<br>
return RTEMS_SUCCESSFUL;
<br>
}
<br>
<br>
<br>
rtems_status_code rtems_io_write(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument){
<br>
printk("Write.\n");
<br>
return RTEMS_SUCCESSFUL;
<br>
}
<br>
<br>
<br>
rtems_status_code rtems_io_control(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument){
<br>
printk("Control.\n");
<br>
return RTEMS_SUCCESSFUL;
<br>
}
<br>
<br>
------------------------------------------------------------------------
<br>
<br>
_______________________________________________
<br>
rtems-users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:rtems-users@rtems.com">rtems-users@rtems.com</a>
<br>
<a class="moz-txt-link-freetext" href="http://rtems.rtems.org/mailman/listinfo/rtems-users">http://rtems.rtems.org/mailman/listinfo/rtems-users</a>
<br>
</blockquote>
<br>
<br>
</blockquote>
</body>
</html>