Beispiel #1
0
/**
 * \brief Initialize the lwIP TCP/IP stack with the network interface driver.
 */
void init_ethernet(void)
{
	/* Initialize lwIP. */
	lwip_init();

	/* Set hw and IP parameters, initialize MAC too. */
	ethernet_configure_interface();

	/* Initialize timer. */
	sys_init_timing();
}
Beispiel #2
0
static LONGLONG sys_get_ms_longlong()
{
  LONGLONG ret;
  LARGE_INTEGER now;
#if NO_SYS
  if (freq.QuadPart == 0) {
    sys_init_timing();
  }
#endif /* NO_SYS */
  QueryPerformanceCounter(&now);
  ret = now.QuadPart-sys_start_time.QuadPart;
  return (u32_t)(((ret)*1000)/freq.QuadPart);
}
Beispiel #3
0
/**
 * \brief Create ethernet task, for ethernet management.
 */
void init_ethernet(void)
{
	/** Initialize lwIP */
	lwip_init();

	/** Init timer service */
	sys_init_timing();

	/** Set hw and IP parameters, initialize MAC too */
	ethernet_configure_interface();

#if defined(HTTP_RAW_USED)
	/** Bring up the web server */
	http_init();
#endif
}
/** \brief Create ethernet task, for ethernet management.
 *
 */
void init_ethernet(const unsigned char ipAddress[], const unsigned char netMask[], const unsigned char gateWay[])
{
	/* Initialize lwIP */
	lwip_init();

	/* Set hw and IP parameters, initialize MAC too */
	ethernet_configure_interface(ipAddress, netMask, gateWay);

	/* Init timer service */
	sys_init_timing();

#if defined(HTTP_RAW_USED)
	/* Bring up the web server */
	httpd_init();
#endif
}
Beispiel #5
0
/*
*	Main program loop
*
*/
int main (void)
{
	char cCommand[64];
	char cCommand_last[64];
	memset(&cCommand, 0, sizeof(cCommand));
	memset(&cCommand_last, 0, sizeof(cCommand_last));
	cCommand[0] = '\0';
	charcount = 0;
	struct ip_addr x_ip_addr, x_net_mask, x_gateway;

	sysclk_init();
	board_init();

	// Set up the GPIO pin for the Mater Select jumper
	ioport_init();
	ioport_set_pin_dir(MASTER_SEL, IOPORT_DIR_INPUT);

	masterselect = ioport_get_pin_level(MASTER_SEL);	// true = slave
	stacking_init(masterselect);	// Initialise the stacking connector as either master or slave

	// Set the IRQ line as either master or slave
	if(masterselect) {
		ioport_set_pin_dir(SPI_IRQ1, IOPORT_DIR_OUTPUT);
	} else {
		ioport_set_pin_dir(SPI_IRQ1, IOPORT_DIR_INPUT);
	}

	irq_initialize_vectors(); // Initialize interrupt vector table support.

	cpu_irq_enable(); // Enable interrupts

	stdio_usb_init();
	spi_init();
	eeprom_init();
	temp_init();
	membag_init();

	loadConfig(); // Load Config

	IP4_ADDR(&x_ip_addr, Zodiac_Config.IP_address[0], Zodiac_Config.IP_address[1],Zodiac_Config.IP_address[2], Zodiac_Config.IP_address[3]);
	IP4_ADDR(&x_net_mask, Zodiac_Config.netmask[0], Zodiac_Config.netmask[1],Zodiac_Config.netmask[2], Zodiac_Config.netmask[3]);
	IP4_ADDR(&x_gateway, Zodiac_Config.gateway_address[0], Zodiac_Config.gateway_address[1],Zodiac_Config.gateway_address[2], Zodiac_Config.gateway_address[3]);

	switch_init();

	/* Initialize lwIP. */
	lwip_init();

	/* Add data to netif */
	netif_add(&gs_net_if, &x_ip_addr, &x_net_mask, &x_gateway, NULL, ethernetif_init, ethernet_input);

	/* Make it the default interface */
	netif_set_default(&gs_net_if);

	netif_set_up(&gs_net_if);

	// Telnet to be included in v0.63
	//telnet_init();

	/* Initialize timer. */
	sys_init_timing();

	int v,p;
	// Create port map
	for (v = 0;v < MAX_VLANS;v++)
	{
		if (Zodiac_Config.vlan_list[v].uActive == 1 && Zodiac_Config.vlan_list[v].uVlanType == 1)
		{
			for(p=0;p<4;p++)
			{
				if (Zodiac_Config.vlan_list[v].portmap[p] == 1) Zodiac_Config.of_port[p] = 1; // Port is assigned to an OpenFlow VLAN
			}
		}

		if (Zodiac_Config.vlan_list[v].uActive == 1 && Zodiac_Config.vlan_list[v].uVlanType == 2)
		{
			for(p=0;p<4;p++)
			{
				if (Zodiac_Config.vlan_list[v].portmap[p] == 1)
				{
					Zodiac_Config.of_port[p] = 0; // Port is assigned to a Native VLAN
					NativePortMatrix += 1<<p;
				}
			}
		}
	}

	while(1)
	{
		task_switch(&gs_net_if);
		task_command(cCommand, cCommand_last);
		// Only run the following tasks if set to Master
		if(masterselect == false)
		{
			sys_check_timeouts();
			task_openflow();	
		} 
	}
}
Beispiel #6
0
void sys_init(void)
{
  sys_init_timing();
  InitSysArchProtect();
}
Beispiel #7
0
void msvc_sys_init()
{
  srand(time(0));
  sys_init_timing();
  InitSysArchProtect();
}