예제 #1
0
/**
 * @brief Print main menu to terminal program
 */
static void print_main_menu(void)
{
	printf("\n");

	print_app_header();

	printf("\r\n");
	print_node_status();
	printf("\r\n");
	printf("(R) : Reset (step 1) - Cold start\r\n");
	printf("(S) : Start (step 2)\r\n");
	printf("(P) : Push button pairing (step 3)\r\n");
	printf("(A) : All-in-one start (Reset, start, pairing)\r\n");
	printf("(W) : Warm start - reset(0)\r\n");
	printf("(T) : Print pairing table\r\n");
	printf("(U) : Unpair\r\n");
	printf("(C) : Channel agility (periodic mode) - enable/disable\r\n");
	printf("(O) : Channel agility configuration\r\n");
	printf("(B) : Base channel change\r\n");
	printf("(Y) : Power save mode - enable/disable\r\n");
	printf("(D) : Send remote battery status request\r\n");
	printf("(V) : Send remote firmware version request\r\n");
	printf("(Z) : Send alive request\r\n");
	printf(">\r\n");
}
예제 #2
0
int main()
{
	struct netif *netif, server_netif;
	struct ip_addr ipaddr, netmask, gw;

	/* the mac address of the board. this should be unique per board */
	unsigned char mac_ethernet_address[] = { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };

	netif = &server_netif;

	init_platform();

	/* initliaze IP addresses to be used */
	IP4_ADDR(&ipaddr,  192, 168,   1, 10);
	IP4_ADDR(&netmask, 255, 255, 255,  0);
	IP4_ADDR(&gw,      192, 168,   1,  1);

	print_app_header();


	print_ip_settings(&ipaddr, &netmask, &gw);

	lwip_init();

  	/* Add network interface to the netif_list, and set it as default */
	if (!xemac_add(netif, &ipaddr, &netmask, &gw, mac_ethernet_address, PLATFORM_EMAC_BASEADDR)) {
		xil_printf("Error adding N/W interface\n\r");
		return -1;
	}
	netif_set_default(netif);
	
	/* Create a new DHCP client for this interface.
	 * Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at
	 * the predefined regular intervals after starting the client.
	 */
	/* dhcp_start(netif); */

	/* now enable interrupts */
	platform_enable_interrupts();

	/* specify that the network if is up */
	netif_set_up(netif);

	/* start the application (web server, rxtest, txtest, etc..) */
	start_application();

	/* receive and process packets */
	while (1) {
		xemacif_input(netif);
		transfer_data();
	}
  
	/* never reached */
	cleanup_platform();

	return 0;
}
예제 #3
0
int main()
{
	struct ip_addr ipaddr, netmask, gw;

	/* the mac address of the board. this should be unique per board */
	unsigned char mac_ethernet_address[] =
	{ 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };

	echo_netif = &server_netif;
#if defined (__arm__) && !defined (ARMR5)
#if XPAR_GIGE_PCS_PMA_SGMII_CORE_PRESENT == 1 || XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT == 1
	ProgramSi5324();
	ProgramSfpPhy();
#endif
#endif

	init_platform();

#if LWIP_DHCP==1
    ipaddr.addr = 0;
	gw.addr = 0;
	netmask.addr = 0;
#else
	/* initliaze IP addresses to be used */
	IP4_ADDR(&ipaddr,  192, 168,   1, 10);
	IP4_ADDR(&netmask, 255, 255, 255,  0);
	IP4_ADDR(&gw,      192, 168,   1,  1);
#endif	
	print_app_header();

	lwip_init();

  	/* Add network interface to the netif_list, and set it as default */
	if (!xemac_add(echo_netif, &ipaddr, &netmask,
						&gw, mac_ethernet_address,
						PLATFORM_EMAC_BASEADDR)) {
		xil_printf("Error adding N/W interface\n\r");
		return -1;
	}
	netif_set_default(echo_netif);

	/* now enable interrupts */
	platform_enable_interrupts();

	/* specify that the network if is up */
	netif_set_up(echo_netif);

#if (LWIP_DHCP==1)
	/* Create a new DHCP client for this interface.
	 * Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at
	 * the predefined regular intervals after starting the client.
	 */
	dhcp_start(echo_netif);
	dhcp_timoutcntr = 24;

	while(((echo_netif->ip_addr.addr) == 0) && (dhcp_timoutcntr > 0))
		xemacif_input(echo_netif);

	if (dhcp_timoutcntr <= 0) {
		if ((echo_netif->ip_addr.addr) == 0) {
			xil_printf("DHCP Timeout\r\n");
			xil_printf("Configuring default IP of 192.168.1.10\r\n");
			IP4_ADDR(&(echo_netif->ip_addr),  192, 168,   1, 10);
			IP4_ADDR(&(echo_netif->netmask), 255, 255, 255,  0);
			IP4_ADDR(&(echo_netif->gw),      192, 168,   1,  1);
		}
	}

	ipaddr.addr = echo_netif->ip_addr.addr;
	gw.addr = echo_netif->gw.addr;
	netmask.addr = echo_netif->netmask.addr;
#endif

	print_ip_settings(&ipaddr, &netmask, &gw);

	/* start the application (web server, rxtest, txtest, etc..) */
	start_application();

	/* receive and process packets */
	while (1) {
		if (TcpFastTmrFlag) {
			tcp_fasttmr();
			TcpFastTmrFlag = 0;
		}
		if (TcpSlowTmrFlag) {
			tcp_slowtmr();
			TcpSlowTmrFlag = 0;
		}
		xemacif_input(echo_netif);
		transfer_data();
	}
  
	/* never reached */
	cleanup_platform();

	return 0;
}
예제 #4
0
파일: main.c 프로젝트: asuardi/SDK4FPGA
int main()
{

	struct ip_addr ipaddr, netmask, gw;
	unsigned FPGA_port_number;
	char *FPGA_ip_address;
	char *FPGA_netmask;
	char *FPGA_gateway;
	unsigned integer_ip;

	unsigned int  FPGA_ip_address_a1,FPGA_ip_address_a2,FPGA_ip_address_a3,FPGA_ip_address_a4;
	unsigned int  FPGA_netmask_a1,FPGA_netmask_a2,FPGA_netmask_a3,FPGA_netmask_a4;
	unsigned int  FPGA_gateway_a1,FPGA_gateway_a2,FPGA_gateway_a3,FPGA_gateway_a4;

	//EXAMPLE: set FPGA IP and port number
	FPGA_ip_address=FPGA_IP;
	FPGA_netmask=FPGA_NM;
	FPGA_gateway=FPGA_GW;
	FPGA_port_number=FPGA_PORT;

	//extract FPGA IP address from string
	if (ip_to_int (FPGA_ip_address,&FPGA_ip_address_a1,&FPGA_ip_address_a2,&FPGA_ip_address_a3,&FPGA_ip_address_a4) == INVALID) {
		printf ("'%s' is not a valid IP address for FPGA server.\n", FPGA_ip_address);
		return 1;
	}

	//extract FPGA netmask address from string
	if (ip_to_int (FPGA_netmask,&FPGA_netmask_a1,&FPGA_netmask_a2,&FPGA_netmask_a3,&FPGA_netmask_a4) == INVALID) {
		printf ("'%s' is not a valid netmask address for FPGA server.\n", FPGA_netmask);
		return 1;
	}

	//extract FPGA gateway address from string
	if (ip_to_int (FPGA_gateway,&FPGA_gateway_a1,&FPGA_gateway_a2,&FPGA_gateway_a3,&FPGA_gateway_a4) == INVALID) {
		printf ("'%s' is not a valid gateway address for FPGA server.\n", FPGA_gateway);
		return 1;
	}

	/* the mac address of the board. this should be unique per board */
	unsigned char mac_ethernet_address[] =
	{ 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };

	echo_netif = &server_netif;

	init_platform();
	Xil_DCacheDisable();

	/* initliaze IP addresses to be used */
	IP4_ADDR(&ipaddr,  FPGA_ip_address_a4, FPGA_ip_address_a3,   FPGA_ip_address_a2, FPGA_ip_address_a1);
	IP4_ADDR(&netmask, FPGA_netmask_a4, FPGA_netmask_a3, FPGA_netmask_a2,  FPGA_netmask_a1);
	IP4_ADDR(&gw,      FPGA_gateway_a4, FPGA_gateway_a3,   FPGA_gateway_a2,  FPGA_gateway_a1);
	print_app_header();
	print_ip_settings(&ipaddr, &netmask, &gw);
	lwip_init();



  	/* Add network interface to the netif_list, and set it as default */
	if (!xemac_add(echo_netif, &ipaddr, &netmask,&gw, mac_ethernet_address,PLATFORM_EMAC_BASEADDR)) {
		xil_printf("Error adding N/W interface\n\r");
		return -1;
	}
	netif_set_default(echo_netif);

	/* specify that the network if is up */
	netif_set_up(echo_netif);

	/* now enable interrupts */
	platform_enable_interrupts();


	/* start the application (web server, rxtest, txtest, etc..) */
	start_application();

	/* receive and process packets */
	while (1) {
		xemacif_input(echo_netif);
		transfer_data();
	}
  
	/* never reached */
	cleanup_platform();

	return 0;
}
예제 #5
0
/******************************************************************************
* Name:        main
* Description: Program entry point
* 
* Returns:     int   - returns 0 if no errors
******************************************************************************/
int main() {

   /* declare a network interface and network addresses */
   struct netif *netif, server_netif;  
   struct ip_addr ipaddr, netmask, gw;

   /* specify a unique MAC address for the board */
   #ifdef XPAR_CPU_PPC440_CORE_CLOCK_FREQ_HZ    /* set MAC on ML507 board */
   unsigned char mac_ethernet_address[] = {0x00, 0x0a, 0x35, 0x01, 0xC9, 0x76};
   #else                                        /* set MAC on ML410 board */
   unsigned char mac_ethernet_address[] = {0x00, 0x0a, 0x35, 0x01, 0x9A, 0xFE};
   #endif

   /* set the network interface pointer */
   netif = &server_netif;

   /* enable caches */
   XCache_EnableICache( INSTR_CACHE );
   XCache_EnableDCache( DATA_CACHE );

   /* setup interrupts */
   setup_interrupts();

   /* initliaze network addresses to be used */
   IP4_ADDR( &ipaddr,  192, 168,  1, 15 );
   IP4_ADDR( &netmask, 255, 255, 255, 0 );
   IP4_ADDR( &gw,      192, 168,  1,  1 );

   /* print the application header and IP settings */
   print_app_header();
   print_ip_settings(&ipaddr, &netmask, &gw);

   /* initialize lwip */
   lwip_init();

   /* add network interface to the netif_list, and set it as default */
   if( !xemac_add( netif, &ipaddr, &netmask, &gw,
                   mac_ethernet_address, EMAC_BASEADDR ) ) {
      xil_printf( "Error adding N/W interface\n\r" );
      return -1;
   }
   netif_set_default( netif );

   /* now enable interrupts */
   enable_interrupts();

   /* specify that the network if is up */
   netif_set_up( netif );

   /* start the application */
   start_application();
   
   /* print debug header if debug mode set */
   #ifdef QMFIR_DEBUG
   debug_menu();
	while( 1) {
		qmfir_debug();
	}
   #endif   

   /* receive and process packets */
   while( 1 ) {
      xemacif_input( netif );
   }

   /* disable caches */
   XCache_DisableDCache();
   XCache_DisableICache();

   return 0;

} /* main */
예제 #6
0
int main()
{
	// disable caches -- still fast enough for copies, no worries about coherency
	Xil_DCacheDisable();
	struct ip_addr ipaddr, netmask, gw;

	/* the mac address of the board. this should be unique per board */
	unsigned char mac_ethernet_address[] =
	{ 0x00, 0x0a, 0x35, 0x00, 0x05, 0x12 };

	echo_netif = &server_netif;
#if XPAR_GIGE_PCS_PMA_CORE_PRESENT == 1
	ProgramSi5324();
	ProgramSfpPhy();
#endif

	init_platform();

	/* initliaze IP addresses to be used */
	/* 129.241.110.214 */
	ipaddr.addr=0;
	netmask.addr=0;
	gw.addr=0;
	/*IP4_ADDR(&ipaddr,  129, 241,  110, 240);
	IP4_ADDR(&netmask, 255, 255, 254,  0);
	IP4_ADDR(&gw,      129, 241,  110,  1);*/



	print_app_header();
	print_ip_settings(&ipaddr, &netmask, &gw);

	lwip_init();

  	/* Add network interface to the netif_list, and set it as default */
	if (!xemac_add(echo_netif, &ipaddr, &netmask,
						&gw, mac_ethernet_address,
						PLATFORM_EMAC_BASEADDR)) {
		xil_printf("Error adding N/W interface\n\r");
		return -1;
	}
	netif_set_default(echo_netif);

	/* Create a new DHCP client for this interface.
	 * Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at
	 * the predefined regular intervals after starting the client.
	 */
	/* dhcp_start(echo_netif); */
	dhcp_start(echo_netif);

	/* now enable interrupts */
	platform_enable_interrupts();

	/* specify that the network if is up */
	netif_set_up(echo_netif);

	/* start the application (web server, rxtest, txtest, etc..) */
	start_application();

	/* receive and process packets */
	int msg = 0;

	while (!finished) {
		xemacif_input(echo_netif);
		transfer_data();
		if(!msg && echo_netif->ip_addr.addr)
		{
			msg=1;
			xil_printf("Acquired DHCP address!\n");
			print_ip("",&(echo_netif->ip_addr));
		}

	}
  
	xil_printf("Cheetah finished, exiting..\n");
	cleanup_platform();

	return 0;
}