Exemple #1
0
void __printk_emit_notty(char c)
{
    if (c)
        console_send(c);
    if (c == '\n')
        console_send('\r');
}
Exemple #2
0
void InitAll()
{
//	int i;
//	uint8 buffer_in[16]={0};
	//uint8 buffer_out[16]={0};
	
	CONSOLE_USART_INIT();

	console_send("\r\n Motors device start\r");

	
	
	
	LED_INIT();
	I2C_INIT();


	ReadConfig();
	
	/*	
		#ifdef EEPROM
		
	if (ReadConfig()==TRUE)	console_send("\nEEPROM start\r");
			else 
			{
				console_send("\nEEPROM is not connect \r\n parameters is enabled by default\r");
				SettingsDefault();
			}
		#else
			SettingsDefault();
			CheckAndWriteVersion();
			PrintVersion(bufer_cons_out);
			console_send(bufer_cons_out);
		#endif
	*/
		(SysTick_Config(SystemCoreClock / 16));
		

		motorInitTimer();
		motorInitGpio();
		motorInit();	
		motorTest();
		motorSettings();
	
		
		WIZ_GPIO_Install();
		WIZ_Config();
		console_send("\nWIZNET start\r\n>");
}
Exemple #3
0
int main(void)

{
	
	xMutexUSART_CONSOLE = xSemaphoreCreateMutex();
	vSemaphoreCreateBinary(xSemaphoreCONSOLE);
	
	#ifdef FSMC
		vSemaphoreCreateBinary(xSemaphoreFSMCDMA);
		vSemaphoreCreateBinary(xSemaphoreEXTI);
		xMutexFSMC = xSemaphoreCreateMutex();
	#endif
	

	#ifdef WIZNET
		xMutexSPI_WIZ =  xSemaphoreCreateMutex();
		vSemaphoreCreateBinary(xSemaphoreSPIDMA);
	#endif
		
  vFreeRTOSInitAll();
	//	TEST_INIT();
	
//	xTaskCreate(vLedTask1,(signed char *)"LedTask", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1 , NULL);	

	
	if ((xMutexFSMC != NULL)&&(xSemaphoreEXTI !=NULL)&&(xSemaphoreFSMCDMA!=NULL)&&(xSemaphoreCONSOLE!=NULL)&&(xMutexUSART_CONSOLE!=NULL))
		{
			#ifdef FSMC	
				xTaskCreate(ProcessingIntFPGA,(signed char*)"ProcessingIntFPGA", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+4 , NULL);
				xTaskCreate(StartCalcBuferFPGA,(signed char*)"StartCalcBufer", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+2 , NULL);
			#endif
			
			#ifdef WIZNET
				xTaskCreate(TCP_IPConnect,(signed char*)"TCP_IPConnect", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+2 , NULL);
			#endif
			
			xTaskCreate(vLedTask,(signed char *)"LedTask", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1 , NULL);
//			xTaskCreate(ConsoleExchange,(signed char *)"ConsoleExchange", configMINIMAL_STACK_SIZE*10, NULL, tskIDLE_PRIORITY+1 , NULL);
			console_send("\n>");	

			vTaskStartScheduler();
		}

	
	vTaskStartScheduler();
	for( ;; );
}
Exemple #4
0
static int console_put(int s, int ifindex, struct sk_buff *skb)
{
	int rc;
	uint8_t *p;

	p = skb_push(skb, 4);
	*p++ = EGETTY_IN;
	*p++ = conf.console;
	*p++ = skb->len >> 8;
	*p = skb->len & 0xff;
	
	rc = console_send(s, ifindex, skb);
	if(rc == -1) {
		printf("sendto failed: %s\n", strerror(errno));
		return -1;
	}
	return 0;
}
Exemple #5
0
static int console_hup(int s, int ifindex)
{
	int rc;
	uint8_t *p;
	struct sk_buff *skb = alloc_skb(64);

	p = skb_put(skb, 0);
	*p++ = EGETTY_HUP;
	*p++ = conf.console;
	p = skb_put(skb, 2);
	
	rc = console_send(s, ifindex, skb);
	if(rc == -1) {
		printf("sendto failed: %s\n", strerror(errno));
		free_skb(skb);
		return -1;
	}
	free_skb(skb);
	return 0;
}
Exemple #6
0
void vFreeRTOSInitAll()
{
		CONSOLE_USART_INIT();
		console_send("\r\n\r\nDevice_start\r");

		LED_INIT();
	
	
	
		
		#ifdef EEPROM
			I2C_EE_INIT();
			if (ReadConfig()==TRUE)	console_send("\nEEPROM start\r");
			else console_send("\nEEPROM is not connect \r\n parameters is enabled by default\r");
		#else
				SettingsDefault();
				CheckAndWriteVersion();
			  PrintVersion(bufer_cons_out);
				console_send(bufer_cons_out);
				
			
		#endif

		#ifdef FSMC
			FSMC_FPGA_Init();
			if (FSMC_FPGA_Detect()==TRUE)	console_send("\nFPGA is connect\r");
			else console_send("\nFPGA is not detect, check the connection \r");
		#endif

		#ifdef WIZNET
			WIZ_GPIO_Install();
			WIZ_Config();
			console_send("\nWIZNET start\r");
		#endif
	
	
}
Exemple #7
0
/*  ---------------------------------------------------------------------[<]-
    Function: service_begin

    Synopsis: depending on arguments (from the command line):
      -i: install service               (windows)
      -u: remove  service               (windows)
      -d: runs service in console mode  (windows)
      -h: basic help information        (windows)
      -d: runs service in background    (UNIX / Linux)

      if no arguments, the service is actually started.

    NOTE: with Windows, the working directory is set to the one where the
    binary program stands.

    Returns: 0 is everything is OK, negative error code otherwise
    ---------------------------------------------------------------------[>]-*/
int
service_begin (
    int                   argc, 
    char                **argv,
    SMT_AGENTS_INIT_FCT  *init_fct, 
    SMT_AGENTS_TERM_FCT  *term_fct,
    const char           *appl_version)
{  
    int
        action;
    int
        rc = 0;

#if (defined(WIN32)) 
    static char
        buffer [LINE_MAX];
    char
        *p_char;

    SERVICE_TABLE_ENTRY 
        dispatch_table [] = {
        { NULL, (LPSERVICE_MAIN_FUNCTION) service_main },
        { NULL, NULL }
    };

    /*  Change to the correct working directory, where config file stands    */
    GetModuleFileName (NULL, buffer, LINE_MAX);
    if ((p_char = strrchr (buffer, '\\')) != NULL)
        *p_char = '\0';
    SetCurrentDirectory (buffer);
#endif

    rc = init_resources (argv[0], appl_version, init_fct, term_fct);
    if (rc != 0)
        return (1);

    ASSERT (application_config);        /* init_resources post condition     */
    if (load_service_config (application_config) != 0)
      {
        free_resources ();
        return (1);
      }

    ASSERT (service_trace_file);        /* load_service_config postcondition */
    console_set_mode (CONSOLE_DATETIME);
    console_capture (service_trace_file, 'a');

#if (defined(WIN32)) 
    dispatch_table [0].lpServiceName = service_name;
    win_version = get_windows_version ();
#endif

    action = parse_command_line (argc, argv);

    if (action == ACTION_HELP)
      {
        puts (USAGE);
      }
#if (defined(WIN32)) 
    else
    if (action == ACTION_INSTALL)
      {
        if (win_version == WINDOWS_95)
            set_win95_service (TRUE);
        else
            install_service ();
      }
    else 
    if (action == ACTION_UNINSTALL)
      {
        if (win_version == WINDOWS_95)
            set_win95_service (FALSE);
        else
            remove_service ();
      }
    else
    if (action == ACTION_CONSOLE)
      {
        console_mode  = TRUE;
        console_service (argc, argv);
      }
    else
    if (action == ACTION_NOARG)
      {
        console_send (NULL, FALSE);

        if (win_version == WINDOWS_95)
          {
            hide_window ();
            console_mode = TRUE;
            console_service (argc, argv);
          }
        else
        if (win_version == WINDOWS_NT_3X
        ||  win_version == WINDOWS_NT_4
        ||  win_version == WINDOWS_2000)
          {
            log_printf ("%s: initialising service ...", application_name);
            if (!StartServiceCtrlDispatcher (dispatch_table))
                add_to_message_log ("StartServiceCtrlDispatcher failed");
          }
      }
#elif (defined(__UNIX__))
    else
    if (action == ACTION_BACKGROUND)
      {
        const char
           *background_args [] = { "-s", NULL };

        log_printf ("Moving into the background");
        if (process_server (NULL, NULL, argc, argv, background_args) != 0)
          {
            log_printf ("Backgrounding failed.  Giving up.");
            rc = -1;
          }
        else
          action = ACTION_NOARG;
      }
    if (action == ACTION_NOARG)
      {
        rc = smt_init ();
        if (!rc && (init_fct != NULL))
            rc = (*init_fct)(application_config);
        if (!rc)
            smt_exec_full ();
        if (term_fct != NULL)
            (*term_fct)();
        smt_term ();
      }
#endif
    else
    if (action == ACTION_ERROR)
        puts (USAGE);
    
    free_resources ();
    return rc;
}