예제 #1
0
void main(void)
{
	/*
	 * All initialization of TCP/IP, clients, servers, and I/O
	 * must be done by the user prior to using any console
	 * functions.
	 */
	sock_init();

	/*
	 * Initialize the console
	 */
	if (console_init() != 0) {
		printf("Could not load the console configuration!\n");
		/*
		 * Save the backup information to the console.
		 */
		con_backup();
	}

	while (1) {
		/*
		 * console_tick() drives the console.
		 */
		console_tick();
		tcp_tick(NULL);
	}
}
예제 #2
0
파일: ninja.c 프로젝트: pfalcon/bus-ninja
void driver_tick(void)
{
    watchdog_reset();
#ifdef CONFIG_HW_UART
    hw_uart_tick();
#endif
#ifdef CONFIG_USBDEV
    usbdev_tick();
#endif

    console_tick();
    led_tick(tick_get());
}
예제 #3
0
int main()
{
	CLEAR_WRITE();
	SET_STOPMOTOR();
	CLEAR_SCANMEDIA();
	CLEAR_MEDIASET();
	CLEAR_READY();
	
	//setup led and button gpio
    GPIO_SetMode(LED_G_PORT, LED_G_PIN, GPIO_PMD_OUTPUT);
    GPIO_SetMode(LED_R_PORT, LED_R_PIN, GPIO_PMD_OUTPUT);
    GPIO_SetMode(SWITCH_PORT, SWITCH_PIN, GPIO_PMD_INPUT);
    GPIO_SetMode(IRDATA_PORT, IRDATA_PIN, GPIO_PMD_INPUT);
	LED_GREEN(0);
	LED_RED(1);

	detect_board_version();

    /* Unlock protected registers */
    SYS_UnlockReg();

    SYS_Init();

    /* Lock protected registers */
    SYS_LockReg();

    UART0_Init();
	SPI_Init();

	TIMER_Open(TIMER0, TIMER_CONTINUOUS_MODE, 6000000);
	TIMER_Open(TIMER1, TIMER_PERIODIC_MODE, TRANSFER_RATE * 2);
	TIMER_Open(TIMER3, TIMER_PERIODIC_MODE, TRANSFER_RATE * 2);
	TIMER_EnableInt(TIMER1);
	TIMER_EnableInt(TIMER3);

	/* Open USB controller */
    USBD_Open(&gsInfo, HID_ClassRequest, NULL);

    /* Init Endpoint configuration for HID */
    HID_Init();

    /* Start USB device */
    USBD_Start();

    /* Enable USB device interrupt */
    NVIC_EnableIRQ(USBD_IRQn);

	LED_GREEN(1);
	LED_RED(0);
    printf("\n\nnuc123-fdsemu v%d.%02d build %d started.  Compiled on "__DATE__" at "__TIME__"\n",version / 100,version % 100,BUILDNUM);
    printf("--CPU @ %0.3f MHz\n", (double)SystemCoreClock / 1000000.0f);
    printf("--SPI0 @ %0.3f MHz\n", (double)SPI_GetBusClock(SPI0) / 1000000.0f);
    printf("--SPI1 @ %0.3f MHz\n", (double)SPI_GetBusClock(SPI1) / 1000000.0f);
    printf("--Detected board version: %d (config = %d %d %d)\n", boardver,PA12,PA13,PA14);
	
	NVIC_SetPriority(USBD_IRQn,2);
	NVIC_SetPriority(TMR1_IRQn,1);
	NVIC_SetPriority(TMR2_IRQn,0);
	NVIC_SetPriority(TMR3_IRQn,0);
	NVIC_SetPriority(GPAB_IRQn,0);
	NVIC_SetPriority(EINT0_IRQn,0);

	flash_init();
	sram_init();

	fds_init();

	print_block_info(0);
	while(1) {
		if(havepacket) {
			havepacket = 0;
//			process_send_feature(epdata,64);
		}
		console_tick();
		fds_tick();
	}
}