This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Still on ethernet configuration


Hi Gary,

I put some diag_printf's in it. Here is the deal. If I call init_net
from the main function it works fine. If I call it from a created
thread it doesn't return.

And more. When I initialize the network with init_net and try to create a thread after, the thread does not get created. If I remove the code for initializing the network the thread is created fine.

Does anyone possibly know why this is happening?

Here is the simple piece of code.

...

#define THREAD 1

static struct bootp bootp_info;

void cyg_user_start(void)
{
cyg_net_init();

build_bootp_record(&bootp_info,
"128.195.11.220",
"255.255.255.0",
"128.195.11.255",
"128.195.11.1",
"");

init_net("eth0", &bootp_info);

#if !THREAD
// just loops infinitely
for ( ; ; ) ;
#else
diag_printf("creating thread\n");
cyg_thread_create(10, // Priority - just a number
net_test, // entry
0, // entry parameter
"Network test", // Name
&stack, // Stack
STACK_SIZE, // Size
&thread_handle, // Handle
&thread_s // Thread data structure
);
cyg_thread_resume(thread_handle); // Start it
#endif
}

#if THREAD
void
net_test(cyg_addrword_t p)
{
diag_printf("net_test created\n");
// just loops infinitely
for ( ; ; ) {
cyg_thread_delay(5);
}
}
#endif

When THREAD is 1 the net_test thread does not print what it should. If
I remove the net initialization code it works perfectly.

Thanks,
Cristiano.

On Thu, 2002-10-10 at 17:44, Cristiano Pereira wrote:
> Hi all,
>
> Simple question regarding ethernet initialization. I've been trying to
> configure
> everyting using the ecos.ecc file but haven't been sucessfull. Seems like my
> init_net function never returns.
>
> Now I'm trying to initialize everything manually and the problem seems to
> persist. Perhaps I'm over simplifying the problem but that's what I'm trying
> so far (all
> the variables are of course defined and the code compiles and run):
>
> int main(void)
> {
> cyg_thread_create(20, // Priority - just a number
> net_test, // entry
> 0, // entry parameter
> "Network test", // Name
> &stack[0], // Stack
> STACK_SIZE, // Size
> &thread_handle[0], // Handle
> &thread_s[0] // Thread data structure
> );
> cyg_thread_resume(thread_handle[0]); // Start it
> }
>
> void
> net_test(cyg_addrword_t p)
> {
> struct bootp bootp_info;
>
> cyg_net_init();
>
> build_bootp_record(&bootp_info,
> "128.195.11.220",
> "255.255.255.0",
> "128.195.11.255",
> "128.195.11.1",
> "");
>
> init_net("eth0", &bootp_info);
>
> // just loops infinitely
> for ( ; ; ) ;
> }
>
>
> but never returns from the init_net function. What am I missing? Should this
> get the ethernet interface up and working?

How do you know that it never returned?
How are your starting/debugging this code?

--
------------------------------------------------------------
Gary Thomas |
eCosCentric, Ltd. |
+1 (970) 229-1963 | eCos & RedBoot experts
gthomas@ecoscentric.com |
http://www.ecoscentric.com/ |
------------------------------------------------------------



_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]