Re: RE: problems starting JavaKit
"Kris Ardis" <Kristopher.Ardis-6tN4nzCoH/[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <00d801c406db$1d28bcb0$764000b4@kardis> |
> //printf("\r\nAbout to do eth_init...");
> //init_eth();
Here is the problem, you need to add the call to 'init_eth' back in.
Kris
----- Original Message -----
From: "Saurabh Mukadam" <[email protected]>
To: "'Bryan Armstrong'" <bryan.armstrong-6tN4nzCoH/[email protected]>
Cc: <tini-6tN4nzCoH/[email protected]>
Sent: Tuesday, March 09, 2004 4:06 AM
Subject: RE: [TINI]RE: problems starting JavaKit
> Dear Bryan,
>
> We are writing a small socket program (enclosed in mail) in C, which
> does the following:
>
> 1. opens a socket
> 2. binds to a local address with any port
>
> bind() function returns error code as 11. We are unable to fix this
> problem. Can you please help us.
>
> Source code:
>
> void main()
> {
> unsigned char bs;
>
>
> unsigned int result;
> unsigned int i;
> struct sockaddr address;
> unsigned char data1[100];
> unsigned char data2[100];
> unsigned int handle1, handle2;
>
> printf("DS80C400 Initialization \r\n");
>
> printf("About to individually do all inits...\r\n");
> printf("\r\nAbout to clear XSEG...");
> init_clearXSEG();
> printf("\r\nAbout to copy IVT...");
> init_copyivt();
> printf("\r\nAbout to init redirect table...");
> init_redirect();
> printf("\r\nAbout to clear system RAM...");
> init_clearSystemRAM();
> printf("\r\nAbout to do mm_init...");
> init_mm(RAM_START, RAM_END);
> printf("\r\nAbout to do km_init...");
> init_km();
> printf("\r\nAbout to do ow_init...");
> init_ow(INIT_DIVISOR_14MHZ);
> printf("\r\nAbout to do network_init...");
> init_network();
> //printf("\r\nAbout to do eth_init...");
> //init_eth();
> printf("\r\nAbout to do init_sockets...");
> init_sockets();
> printf("\r\nAbout to do tick_init...");
> init_tick();
> printf("\r\nAbout to do task_genesis...");
> task_genesis(ROM_SAVESIZE);
> printf("\r\nAbout to enable interrupts...");
> init_enableinterrupts();
> printf("\r\n");
>
> // let's print out a little version information...
> printf("DS80C400 Initialization Library Version %d\r\n",
> init_version());
> printf("DS80C400 Scheduler Library Version %d\r\n",
> task_version());
>
> bs = init_getbootstate();
> if ((bs & INIT_POWERFAIL_RESET) != 0) printf("Boot was a power-fail
> reset!\r\n");
> if ((bs & INIT_WATCHDOG_RESET) != 0) printf("Boot was a watchdog
> reset!\r\n");
> if ((bs & INIT_CRYSTALFAIL_RESET) != 0) printf("Boot was a crystal-fail
> reset!\r\n");
>
> printf("Hello World! \r\n");
> //printf("Hello World! About to call NetBoot...\r\n");
> //init_netboot();
>
> // we should not see the next statement
> //printf("After the netboot...");
>
> for (i=0;i<100;i++)
> {
> data1[i] = i;
> data2[i] = i;
> }
> clear_param_buffers();
>
> do_static();
> network_config();
>
> for (i=0;i<18;i++)
> address.sin_addr[i] = 0;
> //address.sin_addr[12] = HOST_IP_MSB;
> //address.sin_addr[13] = HOST_IP_2;
> //address.sin_addr[14] = HOST_IP_3;
> //address.sin_addr[15] = HOST_IP_LSB;
> address.sin_port = 0;
>
>
> printf("\r\nMaking socket() call 1\r\n");
> handle1 = socket(0, SOCKET_TYPE_STREAM, 0);
>
> if(handle1 != -1)
> {
> printf("Socket Handle 1 %u\r\n", handle1);
>
> handle2 = socket(0, SOCKET_TYPE_STREAM, 0);
>
> if(handle2 != -1)
> {
> printf("Socket Handle 2 %u\r\n", handle2);
>
> for (i=0;i<18;i++)
> address.sin_addr[i] = 0;
> address.sin_port = 0;
>
> result = bind(handle1,&address, sizeof(address));
>
> printf("\r\nbind() Failure %u\r\n", result);
>
>
>
> if(result == 0)
> {
> printf("\r\nbind() Succcessful\r\n");
>
>
> printf("\r\nEntering critical section\r\n");
>
> task_entercritsection(); // make sure we don't task swap before we can
> get the result out
>
> printf("\r\nforking\r\n");
>
> result = task_fork(NORM_PRIORITY, ROM_SAVESIZE);
>
> if (result==0xFFFF)
> {
> task_leavecritsection();
> printf("Attempt to fork failed\r\n");
> return;
> }
>
> printf("\r\nfork successful\r\n");
>
> //else result is 0 for the child process, else it is the child PID
> if (result==0)
> {
> for (i=0;i<18;i++)
> address.sin_addr[i] = 0;
> //address.sin_addr[12] = HOST_IP_MSB;
> //address.sin_addr[13] = HOST_IP_2;
> //address.sin_addr[14] = HOST_IP_3;
> //address.sin_addr[15] = HOST_IP_LSB;
> //address.sin_port = 10;
>
> if(connect(handle2, &address, sizeof(address)) == 0)
> {
> printf("\r\nconnect() successful\r\n");
> while (1)
> {
> send(handle2, "Hello World", 12, 0);
> task_wait(0, 0, 500);
> }
> }
> else
> {
> printf("\r\nconnect() failure\r\n");
> }
>
>
> }
> else
> {
>
> unsigned int lhandle=0;
> struct sockaddr laddr;
>
> task_leavecritsection();
>
> printf("\r\nCalling listen()\r\n");
>
> if(listen(handle1,2) == 0)
> {
> printf("\r\n Listen Successful\r\n");
>
> lhandle=accept(handle1,&laddr,sizeof(struct sockaddr));
>
> if(lhandle != -1)
> {
> printf("\r\naccept() successful\r\n");
>
> while (1)
> {
> recv(lhandle, data2, 12, 0);
> printf("\r\n%s\r\n",data2);
> task_wait(0, 0, 50);
> }
> }
> else
> {
> printf("\r\naccept() failure\r\n");
> }
> }
> else
> {
> printf("\r\nlisten() failure\r\n");
> }
> }
>
> }
> else
> {
> printf("\r\nbind() Failure %u\r\n", result);
> }
> }
> else
> {
> printf("\r\nsocket() 2 failure\r\n");
> }
> }
> else
> {
> printf("\r\nsocket() 1 failure\r\n");
> }
>
> printf("\r\nThe program will now freeze.");
> while(1)
> {
> }
> }
>
>
> Saurabh
>
> -----Original Message-----
> From: Bryan Armstrong [mailto:bryan.armstrong-6tN4nzCoH/[email protected]]
> Sent: Monday, March 08, 2004 8:29 PM
> To: [email protected]
> Cc: tini-6tN4nzCoH/[email protected]
> Subject: Re: [TINI]RE: problems starting JavaKit
>
>
> Saurabh Mukadam wrote:
> > Board is interface with PC through serial port using only Tx, Rx and Gnd
> > line. There is no DTR line used to reset the board. DS80C400 is
> > resetted manually when required.
>
> Saurabh,
>
> DTR is required to notify the loader that a binary segment load is
complete.
>
> --
> --
> Bryan Armstrong
> bryan.armstrong-6tN4nzCoH/[email protected]
>
> _______________________________________________
> TINI mailing list
> TINI-6tN4nzCoH/[email protected]
> To UNSUBSCRIBE, edit your profile, or see list archives:
> http://lists.dalsemi.com/mailman/listinfo/tini
>
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini