示例#1
0
/**
 *
 * Initializes the clock system, board and USB.
 * Then runs the wireless task continuously.
 */
int main(void)
{
	SYS_Init();
	stdio_usb_init();
	while (1) {
	}
}
/** \brief Initialize the Sensor Platform Hardware
 *
 * This function initializes the Atmel \c Xplained platform hardware and
 * must be called once from the client application before any of the Sensors
 * Xplained API routines can be used.
 *
 * After the platform board initialization (i.e. board_init()) configures
 * GPIO pins, interrupts, etc., this routine initializes the AVR and AVR32
 * hardware abstraction layer (HAL) for the Xplained Sensor API.
 *
 * \return  bool    true if the call succeeds, else false is returned.
 */
bool sensor_platform_init(void)
{
	bool initialized = false;

	/* Initialize the system clock and all clocks derived from it. */

	sysclk_init();

	/* Initialize the board (UC3/XMEGA Xplained & Sensor Xplained boards)
	 * I/O pin mappings and any other configurable resources selected in
	 * the build configuration.
	 */

	board_init();

	/* Initialize the sensor bus I/O interface. */

	if (BUSIO_TYPE != BUS_TYPE_UNKNOWN) {
		initialized = sensor_bus_init(&BUSIO_IF, BUSIO_SPEED);
	}

	/* Initialize C Standard I/O (stdio) Redirection. */

#if defined(CONF_STDIO_REDIRECT)
#  if defined(CONF_STDIO_USB)

	/* Start and attach USB CDC device interface for devices with
	 * integrated USB interfaces.
	 */

	stdio_usb_init();
#  elif defined(CONF_STDIO_SERIAL)

	/* Assume the USART is mapped to an appropriate phy in the board
	 * initialization code (e.g. board_init) and initialize terminal
	 * and clib I/O facilities here.
	 */

	usart_serial_options_t const USART_SERIAL_OPTIONS = {
		.baudrate     = CONFIG_USART_BAUDRATE,
		.charlength   = CONFIG_USART_CHAR_LENGTH,
		.paritytype   = CONFIG_USART_PARITY,
		.stopbits     = CONFIG_USART_STOP_BIT
	};

	stdio_serial_init(&CONFIG_USART_IF, &USART_SERIAL_OPTIONS);
#  endif
#endif  /* defined(CONF_STDIO_REDIRECT) */

	/* Sensor devices typically require time to settle after power
	 * is applied.  Wait here for a standard time.  (Individual sensor
	 * drivers may need to wait an additional period during initialization
	 * if the device is particularly slow to settle.)
	 */
	delay_ms(SENSOR_START_DELAY_MSEC);

	return initialized;
}
示例#3
0
/*!
 * \brief Initialize Display function
 *          - Initializa stdio interface using the USB CDC Interface,
 *          - Print startup message.
 * \param fcpu_hz CPU Frequency Value in Hz.
 */
void display_init(uint32_t fcpu_hz)
{
 	/* Start and attach USB CDC device interface for devices with
 	 * integrated USB interfaces.
 	 */
	stdio_usb_init(NULL);

	// Display default message.
	puts("\x1B[5;1H");
	puts("ATMEL  UC3\r\n");
	puts("lwIP with DHCP demo \r\n");
	puts("Not Connected \r\n");
}
/**
 * \brief Run Wireless Module unit tests
 *
 * Initializes the clock system, board and USB.
 * Then runs the wireless task continuously.
 */
int main(void)
{
	irq_initialize_vectors();
	board_init();
	sysclk_init();

	sw_timer_init();
	nwk_init();
	/* Enable interrupts */
	cpu_irq_enable();

	stdio_usb_init();

	while (1) {
		nwk_task();
	}
}
示例#5
0
/**
 * \brief Run Wireless Module unit tests
 *
 * Initializes the clock system, board and USB.
 * Then runs the wireless task continuously.
 */
int main(void)
{
	// Initialize the board and all the peripheral required
	sysclk_init();
	board_init();

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

	// Enable interrupts
	cpu_irq_enable();

	// Enable interrupts
	stdio_usb_init();

	while (1) {
		at86rfx_task();
	};
}
示例#6
0
/**
 * \brief Run Wireless Module unit tests
 *
 * Initializes the clock system, board and USB.
 * Then runs the wireless task continuously.
 */
int main(void)
{
	irq_initialize_vectors();
	sysclk_init();

	/* Initialize the board.
	 * The board-specific conf_board.h file contains the configuration of
	 * the board initialization.
	 */
	board_init();

	sw_timer_init();
	tal_init();
	/* Enable interrupts */
	cpu_irq_enable();

	stdio_usb_init();

	while (1) {
		tal_task();
	}
}
示例#7
0
void init()
{
	// board init
	sysclk_init();
	board_init();
	busy_delay_init(BOARD_OSC0_HZ);
	
	// interrupts init
	cpu_irq_disable();
    INTC_init_interrupts();
	INTC_register_interrupt(&interrupt_J3,   AVR32_GPIO_IRQ_3, AVR32_INTC_INT1);
	cpu_irq_enable();

	//  stdio init
	stdio_usb_init(&CONFIG_USART_IF);

	// Specify that stdout and stdin should not be buffered.

#if defined(__GNUC__) && defined(__AVR32__)
	setbuf(stdout, NULL);
	setbuf(stdin,  NULL);
#endif
}
示例#8
0
void init()
{
	// board init
	board_init();
	
#if UC3L
	// clock frequencies
	#define EXAMPLE_TARGET_DFLL_FREQ_HZ     96000000  // DFLL target frequency, in Hz
	#define EXAMPLE_TARGET_MCUCLK_FREQ_HZ   12000000  // MCU clock target frequency, in Hz
	#define EXAMPLE_TARGET_PBACLK_FREQ_HZ   12000000  // PBA clock target frequency, in Hz

	// parameters to pcl_configure_clocks().
	static scif_gclk_opt_t gc_dfllif_ref_opt = { SCIF_GCCTRL_SLOWCLOCK, 0, false};
	static pcl_freq_param_t pcl_dfll_freq_param = {
		.main_clk_src = PCL_MC_DFLL0,
		.cpu_f        = EXAMPLE_TARGET_MCUCLK_FREQ_HZ,
		.pba_f        = EXAMPLE_TARGET_PBACLK_FREQ_HZ,
		.pbb_f        = EXAMPLE_TARGET_PBACLK_FREQ_HZ,
		.dfll_f       = EXAMPLE_TARGET_DFLL_FREQ_HZ,
		.pextra_params = &gc_dfllif_ref_opt
	};
	pcl_configure_clocks(&pcl_dfll_freq_param);
#else
	pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP);
#endif	
	
	// stdio init
	stdio_usb_init(&CONFIG_USART_IF);

	// Specify that stdout and stdin should not be buffered.

#if defined(__GNUC__) && defined(__AVR32__)
	setbuf(stdout, NULL);
	setbuf(stdin,  NULL);
#endif
}
示例#9
0
文件: main.c 项目: Tjalling7/asf
/*! \brief Main function. Execution starts here.
 */
int main(void)
{
    irq_initialize_vectors();
    cpu_irq_enable();

    /* Initialize ASF services */
    sleepmgr_init();
    sysclk_init();
    board_init();
    gfx_mono_init();
    sd_mmc_init();
    rtc_init();
    stdio_usb_init(); /* Initialize STDIO and start USB */
    udc_stop(); /* Stop USB by default */

    main_introduction();

    /* Initialize tasks */
    app_touch_init();
    app_cpu_load_init();
    app_sampling_init();

    /* The main loop */
    while (true) {
        /* Enter in sleep mode */
        app_cpu_load_enter_sleep();
        sleepmgr_enter_sleep();

        /* Execute tasks */
        app_usb_task();
        app_microsd_task();
        app_sampling_task();
        app_touch_task();
        app_cpu_load_task();
    }
}
示例#10
0
/**
 * \brief main function
 */
int main (void)
{
	/* Initialize basic board support features.
	 * - Initialize system clock sources according to device-specific
	 *   configuration parameters supplied in a conf_clock.h file.
	 * - Set up GPIO and board-specific features using additional configuration
	 *   parameters, if any, specified in a conf_board.h file.
	 */
	sysclk_init();
	board_init();

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

	// Enable interrupts
	cpu_irq_enable();

	/* Call a local utility routine to initialize C-Library Standard I/O over
	 * a USB CDC protocol. Tunable parameters in a conf_usb.h file must be
	 * supplied to configure the USB device correctly.
	 */
	stdio_usb_init();

	// Get and echo characters forever.

	uint8_t ch;

	while (true) {

		scanf("%c",&ch); // get one input character

		if (ch) {
			printf("%c",ch); // echo to output
		}
	}
}
示例#11
0
void uart_usb_cdc_init(void)
{
	LED_On(LED_VBUS);
	
	uart_open(0);
	
	// Start USB stack to authorize VBus monitoring
	stdio_usb_init();

	if(!udc_include_vbus_monitoring())
	{
		// VBUS monitoring is not available on this product
#if (USB_SELF_POWERED == 1)
		// SO, VBUS is monitoring by I/O PD 2 IRQ
		PORTD.INTCTRL				|= (PORT_INT0LVL0_bm | PORT_INT0LVL1_bm);	// High Level Int
		PORTD.INT0MASK				= (1 << USB_VBUS_GPIO);						// VBUS pin
		PORTD.PIN5CTRL				= PORT_ISC_BOTHEDGES_gc;					// Enable Both Edge Int
		PMIC.CTRL					|= PMIC_HILVLEN_bm;							// Enable HIGH Level Int
#else
		// activate always!
		driver_vbus_action(true);
#endif
	}
}
示例#12
0
void app_usb_task(void)
{
	static bool sw0_released = true;
	static bool usb_running = false;
	static bool cdc_running = false;
	static bool toggle = true;

	if (sw0_released && ioport_pin_is_low(GPIO_PUSH_BUTTON_0)) {
		/* A new press has been done */
		sw0_released = false;
		/* Switch USB state */
		if (usb_running) {
			udc_stop();
			gfx_mono_draw_filled_rect(DISPLAY_USB_STA_POS_X,
					DISPLAY_USB_STA_POS_Y,
					DISPLAY_USB_STA_SIZE_X,
					DISPLAY_USB_STA_SIZE_Y,
					GFX_PIXEL_CLR);
			app_microsd_start();
		} else {
			/* Stop FatFS on uSD card if enabled */
			app_microsd_stop();
			stdio_usb_init(); /* Start USB */
			gfx_mono_generic_put_bitmap(&bitmap_usb,
					DISPLAY_USB_STA_POS_X,
					DISPLAY_USB_STA_POS_Y);
		}

		usb_running = !usb_running;
		cdc_running = true;
	} else {
		/* Wait switch release */
		sw0_released = ioport_pin_is_high(GPIO_PUSH_BUTTON_0);
	}

	if (!usb_running) {
		return;
	}

	/* USB MSC task */
	while (udi_msc_process_trans()) {
	}

	if (app_usb_cdc_open && !cdc_running) {
		printf("\x0CSensor data logs:\r\n");
		cdc_running = true;
	}

	if (!app_usb_cdc_open && cdc_running) {
		cdc_running = false;
	}

	/* Toggle USB icon */
	if ((app_usb_cdc_open && app_usb_rec_toggle) ||
			(toggle && app_usb_rec_toggle)) {
		app_usb_rec_toggle = false;
		toggle = !toggle;
		gfx_mono_draw_rect(DISPLAY_USB_STACDC_POS_X,
				DISPLAY_USB_STACDC_POS_Y,
				DISPLAY_USB_STACDC_SIZE_X,
				DISPLAY_USB_STACDC_SIZE_Y,
				toggle ? GFX_PIXEL_SET : GFX_PIXEL_CLR);
	}
}
示例#13
0
int main(void)
{ 	
	ioport_init();
	board_init();
	sysclk_init();			
	irq_initialize_vectors();
	cpu_irq_enable();	
	stdio_usb_init();	
			
	delay_ms(200);
	
	// Power on LED on board
	ioport_set_pin_level(GPIO_LED_GREEN, IOPORT_PIN_LEVEL_HIGH);		
	
	ad9834_init();	
	
    while(true)
    {   
		enum ad9834_waveform waveform;
		float frequency, vout; // start_frequency, end_frequency, 
		//uint32_t delay;
		     			
		// Read command from PC
		Byte cmd = usb_data_read_byte(); 				
		switch (cmd)
		{
			case CMD_FREQ:	
				frequency = usb_data_read_float();
				ad9834_set_frequency(frequency);
				break;
			case CMD_VOUT:
				vout = usb_data_read_float();												
				ad9834_set_output_voltage(vout);
				break;
			case CMD_WAVEFORM:				
				waveform = (enum ad9834_waveform)usb_data_read_byte();
				ad9834_set_waveform(waveform);
				break;				
			case CMD_FREQ_REG:				
				ad9834_set_frequency_register(usb_data_read_byte());
				break;
			/*	Not implemented yet			
			case CMD_PHASE:
				// ad9834_set_phase()
				break;
			case CMD_PHASE_REG:
				// ad9834_set_phase_register(usb_data_read_byte())
				break;
			case CMD_SWEEP:
				start_frequency = usb_data_read_float();
				end_frequency = usb_data_read_float();
				delay = usb_data_read_uint32();
				for (uint32_t frequency = start_frequency; frequency < end_frequency; frequency += 1)
				{
					ad9834_set_frequency(frequency);
					delay_us(delay);
				}
				usb_data_write_byte(MSG_DONE);
				break;
			case CMD_RESET:
				break;
			*/
			default:			
				// Do nothing if not recognized command
				break;
		}						
    }
}
示例#14
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();	
		} 
	}
}
示例#15
0
int_t main(void)
{
    error_t error;
    NetInterface *interface;
    OsTask *task;
    MacAddr macAddr;
#if (APP_USE_DHCP == DISABLED)
    Ipv4Addr ipv4Addr;
#endif
#if (APP_USE_SLAAC == DISABLED)
    Ipv6Addr ipv6Addr;
#endif

    //Update system core clock
    sysclk_init();
    board_init();

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

    // Enable interrupts
    cpu_irq_enable();

    /* Call a local utility routine to initialize C-Library Standard I/O over
     * a USB CDC protocol. Tunable parameters in a conf_usb.h file must be
     * supplied to configure the USB device correctly.
     */
    stdio_usb_init();

    //Initialize kernel
    osInitKernel();
    //Configure debug UART

    //Start-up message
    TRACE_INFO("\r\n");
    TRACE_INFO("**********************************\r\n");
    TRACE_INFO("*** CycloneTCP Web Server Demo ***\r\n");
    TRACE_INFO("**********************************\r\n");
    TRACE_INFO("Copyright: 2010-2014 Oryx Embedded\r\n");
    TRACE_INFO("Compiled: %s %s\r\n", __DATE__, __TIME__);
    TRACE_INFO("Target: SAM4E\r\n");
    TRACE_INFO("\r\n");

    //TCP/IP stack initialization
    error = tcpIpStackInit();
    //Any error to report?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to initialize TCP/IP stack!\r\n");
    }

    //Configure the first Ethernet interface
    interface = &netInterface[0];

    //Set interface name
    tcpIpStackSetInterfaceName(interface, "eth0");
    //Set host name
    tcpIpStackSetHostname(interface, "WebServerDemo");
    //Select the relevant network adapter
    tcpIpStackSetDriver(interface, &sam4eEthDriver);
    tcpIpStackSetPhyDriver(interface, &ksz8081PhyDriver);
    //Set external interrupt line driver
    tcpIpStackSetExtIntDriver(interface, &extIntDriver);
    //Set host MAC address
    macStringToAddr(APP_MAC_ADDR, &macAddr);
    tcpIpStackSetMacAddr(interface, &macAddr);

    //Initialize network interface
    error = tcpIpStackConfigInterface(interface);
    //Any error to report?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to configure interface %s!\r\n", interface->name);
    }

#if (IPV4_SUPPORT == ENABLED)
#if (APP_USE_DHCP == ENABLED)
    //Get default settings
    dhcpClientGetDefaultSettings(&dhcpClientSettings);
    //Set the network interface to be configured by DHCP
    dhcpClientSettings.interface = interface;
    //Disable rapid commit option
    dhcpClientSettings.rapidCommit = FALSE;

    //DHCP client initialization
    error = dhcpClientInit(&dhcpClientContext, &dhcpClientSettings);
    //Failed to initialize DHCP client?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to initialize DHCP client!\r\n");
    }

    //Start DHCP client
    error = dhcpClientStart(&dhcpClientContext);
    //Failed to start DHCP client?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start DHCP client!\r\n");
    }
#else
    //Set IPv4 host address
    ipv4StringToAddr(APP_IPV4_HOST_ADDR, &ipv4Addr);
    ipv4SetHostAddr(interface, ipv4Addr);

    //Set subnet mask
    ipv4StringToAddr(APP_IPV4_SUBNET_MASK, &ipv4Addr);
    ipv4SetSubnetMask(interface, ipv4Addr);

    //Set default gateway
    ipv4StringToAddr(APP_IPV4_DEFAULT_GATEWAY, &ipv4Addr);
    ipv4SetDefaultGateway(interface, ipv4Addr);

    //Set primary and secondary DNS servers
    ipv4StringToAddr(APP_IPV4_PRIMARY_DNS, &ipv4Addr);
    ipv4SetDnsServer(interface, 0, ipv4Addr);
    ipv4StringToAddr(APP_IPV4_SECONDARY_DNS, &ipv4Addr);
    ipv4SetDnsServer(interface, 1, ipv4Addr);
#endif
#endif

#if (IPV6_SUPPORT == ENABLED)
#if (APP_USE_SLAAC == ENABLED)
    //Get default settings
    slaacGetDefaultSettings(&slaacSettings);
    //Set the network interface to be configured
    slaacSettings.interface = interface;

    //SLAAC initialization
    error = slaacInit(&slaacContext, &slaacSettings);
    //Failed to initialize SLAAC?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to initialize SLAAC!\r\n");
    }

    //Start IPv6 address autoconfiguration process
    error = slaacStart(&slaacContext);
    //Failed to start SLAAC process?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start SLAAC!\r\n");
    }
#else
    //Set link-local address
    ipv6StringToAddr(APP_IPV6_LINK_LOCAL_ADDR, &ipv6Addr);
    ipv6SetLinkLocalAddr(interface, &ipv6Addr, IPV6_ADDR_STATE_VALID);

    //Set IPv6 prefix
    ipv6StringToAddr(APP_IPV6_PREFIX, &ipv6Addr);
    ipv6SetPrefix(interface, &ipv6Addr, APP_IPV6_PREFIX_LENGTH);

    //Set global address
    ipv6StringToAddr(APP_IPV6_GLOBAL_ADDR, &ipv6Addr);
    ipv6SetGlobalAddr(interface, &ipv6Addr, IPV6_ADDR_STATE_VALID);

    //Set router
    ipv6StringToAddr(APP_IPV6_ROUTER, &ipv6Addr);
    ipv6SetRouter(interface, &ipv6Addr);

    //Set primary and secondary DNS servers
    ipv6StringToAddr(APP_IPV6_PRIMARY_DNS, &ipv6Addr);
    ipv6SetDnsServer(interface, 0, &ipv6Addr);
    ipv6StringToAddr(APP_IPV6_SECONDARY_DNS, &ipv6Addr);
    ipv6SetDnsServer(interface, 1, &ipv6Addr);
#endif
#endif

    //Get default settings
    httpServerGetDefaultSettings(&httpServerSettings);
    //Bind HTTP server to the desired interface
    httpServerSettings.interface = &netInterface[0];
    //Listen to port 80
    httpServerSettings.port = HTTP_PORT;
    //Specify the server's root directory
    strcpy(httpServerSettings.rootDirectory, "/www/");
    //Set default home page
    strcpy(httpServerSettings.defaultDocument, "index.shtm");
    //Callback functions
    httpServerSettings.authCallback = httpServerAuthCallback;
    httpServerSettings.cgiCallback = httpServerCgiCallback;
    httpServerSettings.uriNotFoundCallback = httpServerUriNotFoundCallback;

    //HTTP server initialization
    error = httpServerInit(&httpServerContext, &httpServerSettings);
    //Failed to initialize HTTP server?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to initialize HTTP server!\r\n");
    }

    //Start HTTP server
    error = httpServerStart(&httpServerContext);
    //Failed to start HTTP server?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start HTTP server!\r\n");
    }

    //Start TCP echo service
    error = tcpEchoStart();
    //Failed to TCP echo service?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start TCP echo service!\r\n");
    }

    //Start UDP echo service
    error = udpEchoStart();
    //Failed to TCP echo service?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start UDP echo service!\r\n");
    }

    //Start TCP discard service
    error = tcpDiscardStart();
    //Failed to TCP echo service?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start TCP discard service!\r\n");
    }

    //Start UDP discard service
    error = udpDiscardStart();
    //Failed to TCP echo service?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start UDP discard service!\r\n");
    }

    //Start TCP chargen service
    error = tcpChargenStart();
    //Failed to TCP echo service?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start TCP chargen service!\r\n");
    }

    //Start UDP chargen service
    error = udpChargenStart();
    //Failed to TCP echo service?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start UDP chargen service!\r\n");
    }

    //Create user task
    task = osCreateTask("User Task", userTask, NULL, 500, 1);
    //Failed to create the task?
    if(task == OS_INVALID_HANDLE)
    {
        //Debug message
        TRACE_ERROR("Failed to create task!\r\n");
    }

    //Create a task to blink the LED
    task = osCreateTask("Blink", blinkTask, NULL, 500, 1);
    //Failed to create the task?
    if(task == OS_INVALID_HANDLE)
    {
        //Debug message
        TRACE_ERROR("Failed to create task!\r\n");
    }

    //Start the execution of tasks
    osStartKernel();

    //This function should never return
    return 0;
}
示例#16
0
文件: usb_int.c 项目: JohsBL/MobRob
void usb_int_init(void)
{
	stdio_usb_init(NULL);
	stdio_usb_enable();
} 
示例#17
0
void sio2host_init(void)
{
    stdio_usb_init();
}