/*---------------------------------------------------------------------------*/
PROCESS_THREAD(rrnet_drv_process, ev, data)
{
  PROCESS_POLLHANDLER(pollhandler());
  
  PROCESS_BEGIN();

  
  uip_setethaddr(addr);
  init_rrnet();
  cs8900a_init();

  ctk_window_new(&window, DUMP_WIDTH, DUMP_HEIGHT, "RR-Net dump");
  CTK_WIDGET_ADD(&window, &dumplabel);
  ctk_window_open(&window);
  
  
  SERVICE_REGISTER(rrnet_drv_service);

  process_poll(&rrnet_drv_process);
  
  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT);
  }

  ctk_window_close(&window);
  
  PROCESS_END();
}
Exemplo n.º 2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(rrnet_drv_process, ev, data)
{
  PROCESS_POLLHANDLER(pollhandler());
  
  PROCESS_BEGIN();
  
  uip_setethaddr(addr);
  init_rrnet();
  cs8900a_init();
  
  SERVICE_REGISTER(rrnet_drv_service);

  process_poll(&rrnet_drv_process);
  
  while(1) {
    PROCESS_YIELD();
  }
  
  PROCESS_END();
}
Exemplo n.º 3
0
/*---------------------------------------------------------------------------*/
EK_EVENTHANDLER(eventhandler, ev, data)
{
    switch(ev) {
    case EK_EVENT_INIT:
    case EK_EVENT_REPLACE:
        uip_setethaddr(addr);
        cs8900a_init();
        break;
    case EK_EVENT_REQUEST_REPLACE:
        ek_replace((struct ek_proc *)data, NULL);
        LOADER_UNLOAD();
        break;
    case EK_EVENT_REQUEST_EXIT:
        ek_exit();
        LOADER_UNLOAD();
        break;
    default:
        break;
    }
}
Exemplo n.º 4
0
/*-----------------------------------------------------------------------------------*/
int
main(int argc, char **argv)
{
  /*  irqload_init();*/

#ifdef WITH_UIP
  uip_init();
  uip_main_init();
  resolv_init();

#ifdef WITH_TFE
  cs8900a_init();
#endif /* WITH_TFE */


#ifdef WITH_RS232
  rs232dev_init();
#endif /* WITH_RS232 */

#ifdef WITH_TAPDEV
  tapdev_init();
#endif /* WITH_TAPDEV */


#endif /* WITH_UIP */

	conio_init();
    textcolor(1);bgcolor(0);
	clrscr();
	conio_update();
  //joy_load_driver(joy_stddrv);
#if 0
{
 int i,j;
 clrscr();
 textcolor(0);bgcolor(1);
 while(1)
 {
	gotoxy(0,0);
	cprintf("%d\n",i++);
	conio_update();

 	if(kbhit())
	{
		cprintf("       ");
	    cprintf("%02x",cgetc());
		cprintf("\n");
	}
	else
	{
		cprintf("pressed: ---------\n");
	}

	j=joy_read(0);
	cprintf("%08x\n",j);
 }
}
#endif

  ek_init();
  dispatcher_init();
  ctk_init();

  contiki_init();

  programs_init();

  ctk_redraw();
  ek_run();

  clrscr();

  return 0;

  argv = argv;
  argc = argc;
}
Exemplo n.º 5
0
BOOL ethernet_test(void)
{
    int t, len;
    static BYTE *tx;
    
    if(!cs8900a_detect()) {
        printf("No cs8900a detected.\n");
        return FALSE;
    }
    
    cs8900a_init();
    
    // prepare to send broadcast packet
    eth_header(&tx_buffer[0], 0x0800);
    ip_header (&tx_buffer[14], 270, 17, 0L, 0xFFFFFFFF);
    udp_header(&tx_buffer[34], 262, 68, 67);
    
    // payload
    tx = &tx_buffer[42];

    // generate DHCP Discovery
    *(tx++) = 0x01; // Boot request
    *(tx++) = 0x01; // Htype = Ethernet
    *(tx++) = 0x06; // Address length = 6
    *(tx++) = 0x00; // Hops = 0
    
    *(tx++) = 0x39; // ID
    *(tx++) = 0x03;
    *(tx++) = 0xF3;
    *(tx++) = 0x26;

    for(t=0;t<20;t++) {
        *(tx++) = 0;
    }

    for(t=0;t<6;t++) {
        *(tx++) = mac[t];
    }

    for(t=6;t<208;t++) {
        *(tx++) = 0;
    }

    *(tx++) = 0x63; // Magic cookie
    *(tx++) = 0x82; // 
    *(tx++) = 0x53; // 
    *(tx++) = 0x63; // 
    
    *(tx++) = 0x35; // DHCP Discover option
    *(tx++) = 0x01; // Length = 1
    *(tx++) = 0x01; // 

    *(tx++) = 0x3D; // DHCP Client ID option
    *(tx++) = 0x07; // Length = 7
    *(tx++) = 0x01; // 
    for(t=0;t<6;t++) {
        *(tx++) = mac[t];
    }

    *(tx++) = 0x37; // DHCP Request list
    *(tx++) = 0x06; // Length = 1

    *(tx++) = 0x01; // Subnet Mask
    *(tx++) = 0x0F; // Domain Name
    *(tx++) = 0x03; // Router
    *(tx++) = 0x06; // DNS
    *(tx++) = 0x1F; // Router discover
    *(tx++) = 0x21; // Static Route

    *(tx++) = 0xFF; // DHCP End
    *(tx++) = 0x00; // Length = 0
    *(tx++) = 0x00; // Length = 0

    // send packet
    cs8900a_tx_frame(tx_buffer, 304);
    
    // we should receive a response!
    for(t=0;t<5000;t++) {
        len = cs8900a_rx_frame(rx_buffer);
        if(len > 10) {
            printf("Frame received: Len = %d.\n", len);
            dump_hex(rx_buffer, 128);
            return TRUE;
        }
        TIMER = 250;
        while(TIMER)
            ;
    }
    printf("No frame received.\n");

    // send packet
    cs8900a_tx_frame(tx_buffer, 304);
    
    // we should receive a response!
    for(t=0;t<5000;t++) {
        len = cs8900a_rx_frame(rx_buffer);
        if(len > 10) {
            printf("Frame received: Len = %d.\n", len);
            dump_hex(rx_buffer, 128);
            return TRUE;
        }
        TIMER = 250;
        while(TIMER)
            ;
    }
    printf("No frame received.\n");


    return FALSE;
}