[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rtems_bsdnet_ifconfig problem using C++



Hi all,

yes, more info.

I found that in all rtems_bsdnet.h files within the RTEMS distribution the 
rtems_bsdnet_ifconfig structure gets a function pointer has the second 
field. The declaration of that function is:

int     (*attach)(struct rtems_bsdnet_ifconfig *conf, int attaching);

I am using the SMC91111 network driver which is declared as follows:

#define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 
rtems_smc91111_driver_attach_leon2

where the rtems_smc91111_driver_attach_leon2 function is declared as:

int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig 
*config);

The problem is that driver function apparently only has ONE argument, but 
in the  rtems_bsdnet_ifconfig a function with TWO arguments is needed, 
even when the extra parameter is ignored for older attach functions.

How can I solve the problem? 

Aitor





Aitor.Viana.Sanchez at esa.int 
Sent by: rtems-users-bounces at rtems.org
12/11/2007 14:39

To
rtems-users at rtems.org
cc

Subject
rtems_bsdnet_ifconfig problem using C++






Hi all, 

I got some problems with the network configuration when using C++.  

In the main.cpp source code I include: 

#include <rtems.h> 
#include <bsp.h> 
#include "../rtems/rtems_config.h" 

extern "C" 
{ 
        #include <rtems/rtems_bsdnet.h>
} 
#include "../rtems/rtems-network.h" 

#include <rtems/rtems_bsdnet.h> is include within the extern statement 
because otherwise i cannot use the rtems_bsdnet_initialize_network() 
method. The rtems-network.h is the network configuration file (pretty 
similar to the one provided with the RTEMS examples) and also is working 
perfectly with previous C projects. 
The problem is that when I try to compile the application i get the next 
error: 

/home/aitor/workspace/OBSFramework/src/rtems/rtems-network.h:97: invalid  
   conversion from `int (*)(rtems_bsdnet_ifconfig*)' to `int 
   (*)(rtems_bsdnet_ifconfig*, int)' 


where the line referenced in the error is the next one 

static struct rtems_bsdnet_ifconfig netdriver_config = { 
        RTEMS_BSP_NETWORK_DRIVER_NAME,                /* name */ 
        RTEMS_BSP_NETWORK_DRIVER_ATTACH,        /* attach function */ 

#ifdef RTEMS_USE_LOOPBACK 
        &loopback_config,                /* link to next interface */ 
#else 
        NULL,                                /* No more interfaces */ 
#endif 

#if (defined (RTEMS_USE_BOOTP)) 
        NULL,                                /* BOOTP supplies IP address 
*/ 
        NULL,                                /* BOOTP supplies IP net mask 
*/ 
#else 
        "192.168.1.29",                /* IP address */ 
        "255.255.255.0",                /* IP net mask */ 
#endif /* !RTEMS_USE_BOOTP */ 

#if (defined (RTEMS_SET_ETHERNET_ADDRESS)) 
        ethernet_address,               /* Ethernet hardware address */ 
#else 
        NULL,                           /* Driver supplies hardware 
address */ 
#endif 
        0                                /* Use default driver parameters 
*/ 
}; 

I don't know why this is happening. Can anyone give a clue? 

Thanks in advance, 

Aitor 




Joel Sherrill <joel.sherrill at oarcorp.com>  
Sent by: rtems-users-bounces+aitor.viana.sanchez=esa.int at rtems.org 

05/11/2007 15:18 

To
Leon Pollak <leonp at plris.com> 
cc
RTEMS Users <rtems-users at rtems.org> 
Subject
Re: TOD differences






Leon Pollak wrote:
> On Monday 05 November 2007 14:24, Joel Sherrill wrote:
>
>> Leon Pollak wrote:
>>
>>> Hello, all.
>>> The question seems to be very simple, but I did not find any answer in
>>> docs, wiki...
>>>
>>> I have two rtems_time_of_day structures containing two times. How can 
I
>>> calculate the difference (in seconds) between them?
>>>
>> Not in the public API.  With the movement in 4.8 to struct timespec
>> in the super core, there are a lot of timespec math routines.  There
>> has always been some TOD to XXX routines.
>>
>> I have considered making the existing set of time math routines
>> available via the public API.  It isn't especially hard to do but
>> would require documentation.  If this is of interest to the
>> community, I will move it from my idea list to my someday we might
>> do this list.
>>
> Thanks, Joel.
> I definitely do not represent the community :-), but I vote "pro"!
> Meanwhile, can you be so kind to "disclose" where I can find any
> internal "TOD_to_XXX" routine?
>
Depends on the version.  For 4.7 and older, the routine
you want is _TOD_To_seconds() from the SuperCore.
 
For 4.8 and newer, it has the same name but is part
of the RTEMS Classic API since the SuperCore doesn't
know the Classic API TOD structure any more.
 
libbsp/shared/tod.c has an example of using it.
 
In 4.8 and newer, there is also a set of timespec math
routines prototyped in score/include/rtems/score/timespec.h
 
--joel
> Again, thanks.
>
 
_______________________________________________
rtems-users mailing list
rtems-users at rtems.com
http://rtems.rtems.org/mailman/listinfo/rtems-users 

_______________________________________________
rtems-users mailing list
rtems-users at rtems.com
http://rtems.rtems.org/mailman/listinfo/rtems-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rtems.rtems.org/pipermail/rtems-users/attachments/20071112/0519ea94/attachment-0001.html