<!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">Is there an example of the use of </font>CONFIGURE_APPLICATION_EXTRA_DRIVER?<br>
<br>
Where can I get an example of how to add a driver dinamically in the
BSP (not in the application)?<br>
<br>
Thanks,<br>
<br>
André<br>
<br>
<br>
Joel Sherrill escribió:
<blockquote cite="mid:477E63CF.8090006@oarcorp.com" type="cite">Gatti
André wrote:
<br>
<blockquote type="cite">We are making a BSP and want to register an
IO driver but we are not sure where tu put the call to the function
rtems_io_register_driver. We think that the correct place should be
inside rtems_io_initialize, but the problem is that the call to
rtems_io_initialize already includes the major and minor number as
parameters.
<br>
<br>
rtems_status_code rtems_io_initialize(rtems_device_major_number major,
rtems_device_minor_number minor, void * argument);
<br>
<br>
So should be a place before rtems_io_initialize, it would be great if
someone can tell us how to do it.
<br>
<br>
</blockquote>
It is called automatically during RTEMS initialization.
<br>
<blockquote type="cite">Apart from that when we call the function
rtems_io_register_driver(0, &driver_table, ®istered_major)
we get the error RTEMS_TOO_MANY. This is because there is not enought
space in the device driver table, but we don't want to modified the
constant CONFIGURE_MAXIMUM_DRIVERS in confdefs.h, is it automatically
incremented?
<br>
<br>
</blockquote>
In 4.7 and older, you had to do your own driver table with the same
name.
<br>
confdefs.h should pick up the name and size automatically.
<br>
<br>
4.8 and newer have CONFIGURE_APPLICATION_EXTRA_DRIVERS which lets you
<br>
add to the table generated by confdefs.h easily.
<br>
<br>
CONFIGURE_NUMBER_OF_DRIVERS is the number of statically configured
<br>
drivers. <br>
CONFIGURE_MAXIMUM_DRIVERS is the maximum number of driver and
<br>
includes those dynamically registered.
<br>
<blockquote type="cite"><br>
Please, can anyone tell us which is wrong here:
<br>
<br>
Example of our driver:
<br>
<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>
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_driver(0, driver_table, ®istered_major)
== RTEMS_SUCCESSFUL){
<br>
<br>
rtems_io_register_name("iodriver", registered_major, 0);
<br>
<br>
return RTEMS_SUCCESSFUL;
<br>
}
<br>
<br>
return RTEMS_INVALID_NUMBER;
<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>