<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Verdana">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 </font><font
face="Verdana">rtems_io_register_driver. We think that the correct
place should be inside </font><font face="Verdana">rtems_io_initialize,
but the problem is that the call to </font><font face="Verdana">rtems_io_initialize
already includes the major and minor number as parameters.</font><br>
<font face="Verdana"><br>
</font><font face="Verdana">rtems_status_code
rtems_io_initialize(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument);<br>
<br>
So should be a place before </font><font face="Verdana">rtems_io_initialize,
it would be great if someone can tell us how to do it. <br>
<br>
Apart from that when we call the function </font><font face="Verdana">rtems_io_register_driver(0,
</font><font face="Verdana">&driver_table, ®istered_major)</font><font
face="Verdana"> 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 </font><font face="Verdana">CONFIGURE_MAXIMUM_DRIVERS
in </font><font face="Verdana">confdefs.h</font><font face="Verdana">,
is it automatically incremented?</font><br>
<font face="Verdana"><br>
</font><font face="Verdana"><br>
Please, can anyone tell us which is wrong here:<br>
<br>
Example of our driver:<br>
<br>
<br>
</font><font face="Verdana">static rtems_status_code
rtems_io_initialize(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument);<br>
</font><font face="Verdana">static rtems_status_code
rtems_io_open(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument);<br>
</font><font face="Verdana">static rtems_status_code
rtems_io_close(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument);<br>
</font><font face="Verdana">static rtems_status_code
rtems_io_read(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument);<br>
</font><font face="Verdana">static rtems_status_code
rtems_io_write(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument);<br>
</font><font face="Verdana">static rtems_status_code
rtems_io_control(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument);<br>
</font><font face="Verdana"></font><font face="Verdana"><br>
</font><font face="Verdana">rtems_driver_address_table driver_table =</font><font
face="Verdana"> { <br>
</font><font face="Verdana"> rtems_io_initialize, <br>
</font><font face="Verdana">rtems_io_open, </font><font
face="Verdana"><br>
rtems_io_close,<br>
</font><font face="Verdana"> rtems_io_read,<br>
</font><font face="Verdana"> rtems_io_write,<br>
</font><font face="Verdana"> rtems_io_control,</font><br>
<font face="Verdana">};<br>
</font><font face="Verdana"><br>
</font><font face="Verdana">rtems_status_code
rtems_io_initialize(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument){<br>
</font><font face="Verdana"> </font><font face="Verdana">rtems_device_major_number
</font><font face="Verdana">registered_major;<br>
<br>
</font><font face="Verdana"> if(rtems_io_register_driver(0, </font><font
face="Verdana">driver_table, ®istered_major)</font><font
face="Verdana"> == </font><font face="Verdana">RTEMS_SUCCESSFUL){</font><br>
<font face="Verdana"><br>
</font><font face="Verdana"> rtems_io_register_name("iodriver", </font><font
face="Verdana">registered_major</font><font face="Verdana">, 0);<br>
<br>
</font><font face="Verdana"> return RTEMS_SUCCESSFUL;</font><br>
<font face="Verdana"> }<br>
<br>
</font><font face="Verdana"> return RTEMS_INVALID_NUMBER;</font><br>
<font face="Verdana">}<br>
<br>
</font><font face="Verdana">rtems_status_code
rtems_io_open(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument){<br>
printk("Open.\n");<br>
return RTEMS_SUCCESSFUL;<br>
}<br>
</font><font face="Verdana"><br>
<br>
</font><font face="Verdana">rtems_status_code
rtems_io_close(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument){<br>
printk("Close.\n");<br>
return RTEMS_SUCCESSFUL;<br>
}<br>
</font><font face="Verdana"><br>
<br>
</font><font face="Verdana">rtems_status_code
rtems_io_read(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument){<br>
printk("Read.\n");<br>
return RTEMS_SUCCESSFUL;<br>
}<br>
</font><font face="Verdana"><br>
<br>
</font><font face="Verdana">rtems_status_code
rtems_io_write(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument){<br>
printk("Write.\n");<br>
return RTEMS_SUCCESSFUL;<br>
}<br>
</font><font face="Verdana"><br>
<br>
</font><font face="Verdana">rtems_status_code
rtems_io_control(rtems_device_major_number major, </font><font
face="Verdana">rtems_device_minor_number minor, void * argument){<br>
printk("Control.\n");<br>
return RTEMS_SUCCESSFUL;<br>
}<br>
</font><font face="Verdana"><br>
</font>
</body>
</html>