int main( void )
{
#ifdef DEBUG
  debug();
#endif


  //**********************************
  // USED FOR FreeRTOS+TRACE
  //**********************************
  vTraceInitTraceData();
  uiTraceStart();
  //**********************************



	/* Set up the clocks and memory interface. */
	prvSetupHardware();

	/* Create the 'check' task, which is also defined within this file. */
	xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );


    /* Start the scheduler. */
	vTaskStartScheduler();

    /* Will only get here if there was insufficient memory to create the idle
    task.  The idle task is created within vTaskStartScheduler(). */



	for( ;; );
}
Esempio n. 2
0
int main( void )
{
	/* Initialise the trace recorder and create the label used to post user
	events to the trace recording on each tick interrupt. */
	vTraceInitTraceData();
	xTickTraceUserEvent = xTraceOpenLabel( "tick" );

	/* Start the trace recording - the recording is written to a file if
	configASSERT() is called. */
	printf( "\r\nTrace started.  Hit a key to dump trace file to disk.\r\n" );
	uiTraceStart();

	/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
	of this file. */
	#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
	{
		main_blinky();
	}
	#else
	{
		main_full();
	}
	#endif

	return 0;
}
Esempio n. 3
0
int main( void )
{
	/* This demo uses heap_5.c, so start by defining some heap regions.  This
	is only done to provide an example as this demo could easily create one
	large heap region instead of multiple smaller heap regions - in which case
	heap_4.c would be the more appropriate choice.  No initialisation is
	required when heap_4.c is used. */
	prvInitialiseHeap();

	/* Initialise the trace recorder and create the label used to post user
	events to the trace recording on each tick interrupt. */
	vTraceInitTraceData();
	xTickTraceUserEvent = xTraceOpenLabel( "tick" );

	/* Start the trace recording - the recording is written to a file if
	configASSERT() is called. */
	printf( "\r\nTrace started.  Hit a key to dump trace file to disk (does not work from Eclipse console).\r\n" );
	fflush( stdout );
	uiTraceStart();

	/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
	of this file. */
	#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
	{
		main_blinky();
	}
	#else
	{
		main_full();
	}
	#endif

	return 0;
}
Esempio n. 4
0
/* Main ----------------------------------------------------------------------*/
int main(void)
{
	SystemInit();
	prvHardwareInit();

	vTraceInitTraceData();

	c_common_usart_puts(USART2, "Programa iniciado!\n\r");
	vTraceConsoleMessage("Starting application...");

	//sprintf(str, "Line, %d \n\r", __LINE__);
	//c_common_usart_puts(USART2, str);

	if (! uiTraceStart() )
		vTraceConsoleMessage("Could not start recorder!");

	/* create tasks */
	xTaskCreate(blink_led_task, (signed char *)"Blink led", configMINIMAL_STACK_SIZE, (void *)NULL, tskIDLE_PRIORITY+1, NULL);
  xTaskCreate(sonar_task, (signed char *)"Sonar task", configMINIMAL_STACK_SIZE, (void *)NULL, tskIDLE_PRIORITY+1, NULL);
	//xTaskCreate(echo_task, (signed char *)"Echo task", configMINIMAL_STACK_SIZE, (void *)NULL, tskIDLE_PRIORITY+1, NULL);
	//xTaskCreate(blctrl_task,  (signed char *)"blctrl task" , configMINIMAL_STACK_SIZE, (void *)NULL, tskIDLE_PRIORITY+1, NULL);
	//xTaskCreate(uart_task	  , (signed char *)"UART task", configMINIMAL_STACK_SIZE, (void *)NULL, tskIDLE_PRIORITY+1, NULL);
	//xTaskCreate(rc_servo_task , (signed char *)"Servo task", configMINIMAL_STACK_SIZE, (void *)NULL, tskIDLE_PRIORITY+1, NULL);

	/* Start the scheduler. */
	vTaskStartScheduler();

	/* should never reach here! */
	for(;;);
}
Esempio n. 5
0
/*---------------------------------------------------------------------------*
 * Routine:  uEZPlatformStartup
 *---------------------------------------------------------------------------*
 * Description:
 *      When uEZ starts, a special Startup task is created and called.
 *      This task brings up the all the hardware, reports any problems,
 *      starts the main task, and then exits.
 *---------------------------------------------------------------------------*/
TUInt32 uEZPlatformStartup(T_uezTask aMyTask, void *aParameters)
{
#if FREERTOS_PLUS_TRACE //LPC1788 only as of uEZ v2.04
    TUInt32 traceAddressInMemory = 0;
#endif

    UEZPlatform_Standard_Require();
#if (SIMPLEUI_DOUBLE_SIZED_ICONS)
    SUIInitialize(ETrue, EFalse, EFalse);
#else
    SUIInitialize(EFalse, EFalse, EFalse);
#endif

    // USB Flash drive needed?
    UEZPlatform_USBHost_PortA_Require();
    UEZPlatform_USBFlash_Drive_Require(0);

    // USB Device needed?
    UEZPlatform_USBDevice_Require();

    // SDCard needed?
    UEZPlatform_SDCard_Drive_Require(1);

    // Network needed?
#if UEZ_ENABLE_WIRED_NETWORK
    UEZPlatform_WiredNetwork0_Require();
#endif

#if UEZ_ENABLE_WIRELESS_NETWORK
#if UEZ_WIRELESS_PROGRAM_MODE
    UEZPlatform_WiFiProgramMode();
#endif
    UEZPlatform_WirelessNetwork0_Require();
#endif

#if ENABLE_UEZ_BUTTON
    UEZPlatform_Keypad_Require();
#endif

#if FREERTOS_PLUS_TRACE //LPC1788 only as of uEZ v2.04
    uiTraceStart();
    vTraceStartStatusMonitor();

    traceAddressInMemory = (TUInt32)vTraceGetTraceBuffer();
    printf("%x", traceAddressInMemory);
#endif

    // Create a main task (not running yet)
    UEZTaskCreate((T_uezTaskFunction)MainTask, "Main", MAIN_TASK_STACK_SIZE, 0,
                  UEZ_PRIORITY_NORMAL, &G_mainTask);

    // Done with this task, fall out
    return 0;
}
Esempio n. 6
0
static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *pcParameter;
portBASE_TYPE lParameterStringLength;

	/* Remove compile time warnings about unused parameters, and check the
	write buffer is not NULL.  NOTE - for simplicity, this example assumes the
	write buffer length is adequate, so does not check for buffer overflows. */
	( void ) pcCommandString;
	( void ) xWriteBufferLen;
	configASSERT( pcWriteBuffer );

	/* Obtain the parameter string. */
	pcParameter = FreeRTOS_CLIGetParameter
					(
						pcCommandString,		/* The command string itself. */
						1,						/* Return the first parameter. */
						&lParameterStringLength	/* Store the parameter string length. */
					);

	/* Sanity check something was returned. */
	configASSERT( pcParameter );

	/* There are only two valid parameter values. */
	if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
	{
		/* Start or restart the trace. */
		vTraceStop();
		vTraceClear();
		uiTraceStart();

		sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" );
	}
	else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
	{
		/* End the trace, if one is running. */
		vTraceStop();
		sprintf( pcWriteBuffer, "Stopping trace recording and dumping log to disk.\r\n" );
		prvSaveTraceFile();
	}
	else
	{
		sprintf( pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
	}

	/* There is no more data to return after this single string, so return
	pdFALSE. */
	return pdFALSE;
}
Esempio n. 7
0
File: main.cpp Progetto: 0x00f/stm32
int main(void)
{
  vTraceInitTraceData ();
  if (!uiTraceStart())
  	vTraceConsoleMessage("Could not start recorder!");

  /* Create IPC variables */
  pbq = xQueueCreate(10, sizeof(int));
  if (pbq == 0) {
    while(1); /* fatal error */
  }
  
  /* Create tasks */
  xTaskCreate(
		  ToggleLED_Timer,                 /* Function pointer */
		  "Task1",                          /* Task name - for debugging only*/
		  configMINIMAL_STACK_SIZE,         /* Stack depth in words */
		  (void*) NULL,                     /* Pointer to tasks arguments (parameter) */
		  tskIDLE_PRIORITY + 2UL,           /* Task priority*/
		  NULL                              /* Task handle */
  );
  
  xTaskCreate(
		  DetectButtonPress,
		  "Task2",
		  configMINIMAL_STACK_SIZE,
		  (void*) NULL,
		  tskIDLE_PRIORITY + 2UL,
		  NULL);

  xTaskCreate(
		  ToggleLED_IPC,
		  "Task3",
		  configMINIMAL_STACK_SIZE,
		  (void*) NULL,
		  tskIDLE_PRIORITY + 2UL,
		  NULL);
  
  /* Start the RTOS Scheduler */
  vTaskStartScheduler();
  
  /* HALT */
  while(1); 
}
Esempio n. 8
0
int main (void)
{
	/* Initialize the SAM system */
	sysclk_init();
	
	/* Initialize mcu's peripheral.*/
	board_init();
	
	/* Ensure all priority bits are assigned as preemption priority bits. */
	NVIC_SetPriorityGrouping( 0 );
	
	/* Create freeRTOS START task.*/
	xTaskCreate(task_start, (signed char *)"START", TASK_START_STACKSIZE, NULL,
				TASK_START_PRIORITY, NULL);
	
	/* Start the FreeRTOS + Trace record..*/
	uiTraceStart();
	
	/* Start the scheduler. */
	vTaskStartScheduler();
	
	// Insert application code here, after the board has been initialized.
	return 0;
}
void SYS_Initialize ( void* data )
{
    /* Core Processor Initialization */
    SYS_CLK_Initialize( NULL );
    sysObj.sysDevcon = SYS_DEVCON_Initialize(SYS_DEVCON_INDEX_0, (SYS_MODULE_INIT*)&sysDevconInit);
    SYS_DEVCON_PerformanceConfig(SYS_CLK_SystemFrequencyGet());
    SYS_DEVCON_JTAGDisable();
    SYS_PORTS_Initialize();

    /* Initialize Drivers */
//    DRV_SPI0_Initialize();
//    DRV_SPI1_Initialize();
    //DRV_I2C1_Initialize();

    SYS_INT_VectorPrioritySet(INT_VECTOR_T2, INT_PRIORITY_LEVEL1);
    SYS_INT_VectorSubprioritySet(INT_VECTOR_T2, INT_SUBPRIORITY_LEVEL0);

    /*Initialize CAN0 */
    DRV_CAN0_Initialize();


    //For Debugging
//    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_G, PORTS_BIT_POS_8);
//    SYS_PORTS_PinClear(PORTS_ID_0, PORT_CHANNEL_G, PORTS_BIT_POS_8);
//    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_E, PORTS_BIT_POS_8);
//    SYS_PORTS_PinClear(PORTS_ID_0, PORT_CHANNEL_E, PORTS_BIT_POS_8);

    /* Indicate initializing */
    led_on(LED_RED);

    /* Initialize PMP0 */
    DRV_PMP0_Initialize();
    DRV_PMP0_ModeConfig();

    /* Initialize System Services */
    SYS_INT_Initialize();  

    /* Initialize Middleware */
    /* Set priority of USB interrupt source */
    SYS_INT_VectorPrioritySet(INT_VECTOR_USB1, INT_PRIORITY_LEVEL4);

    /* Wait FPGA_DONE*/
    // while(!FpgaDone);
 /* Set Sub-priority of USB interrupt source */
    SYS_INT_VectorSubprioritySet(INT_VECTOR_USB1, INT_SUBPRIORITY_LEVEL0);


    /* Initialize the USB device layer */
    sysObj.usbDevObject0 = USB_DEVICE_Initialize (USB_DEVICE_INDEX_0 , ( SYS_MODULE_INIT* ) & usbDevInitData);

    /* Enable Global Interrupts */
    SYS_INT_Enable();


#ifdef DEBUG_PERCEPIO
    /* Initialize Percepio */
    vTraceInitTraceData();
    if(uiTraceStart() != 1) {
        while(true);
    }
#endif
    
    /* Initialize the Application */
    APP_Initialize();
    APP1_Initialize();
    APP2_Initialize();
    Xcp_Initialize();
    
}
Esempio n. 10
0
void RTOSTRC_Init(void) {
	vTraceInitTraceData();
	if (uiTraceStart()==0) {
		for(;;); /* error */
	}
}
Esempio n. 11
0
/*---------------------------------------------------------------------------*
* Routine:  uEZPlatformStartup
*---------------------------------------------------------------------------*
* Description:
*      When uEZ starts, a special Startup task is created and called.
*      This task brings up the all the hardware, reports any problems,
*      starts the main task, and then exits.
*---------------------------------------------------------------------------*/
TUInt32 uEZPlatformStartup(T_uezTask aMyTask, void *aParameters)
{
#if FREERTOS_PLUS_TRACE //LPC1788 only as of uEZ v2.04
     TUInt32 traceAddressInMemory = 0;
#endif
     
     UEZPlatform_Standard_Require();
     UEZPlatform_Timer2_Require();
     UEZPlatform_DAC0_Require();
     SUIInitialize(SIMPLEUI_DOUBLE_SIZED_ICONS, EFalse, EFalse); // SWIM not flipped
     G_expdkDetected = UEZGUI_EXP_DK_Detect();
     
     if (G_expdkDetected) { // Add EXP_DK Features we want
#if UEZGUI_EXP_DK_FCT_TEST
     // no command console so functional test can run
     // Setup standard UART without console
     UEZGUI_EXP_DK_RS232_Require(UEZ_CONSOLE_WRITE_BUFFER_SIZE, 
                                     UEZ_CONSOLE_READ_BUFFER_SIZE);
#else
     UEZGUI_EXP_DK_I2S_Require();
#endif

#if UEZ_ENABLE_WIRED_NETWORK
          UEZGUI_EXP_DK_EMAC_Require();
#endif
          UEZGUI_EXP_DK_I2CMux_Require();
          UEZGUI_EXP_DK_Button_Require();
          UEZGUI_EXP_DK_LED_Require();
          UEZGUI_EXP_DK_LightSensor_Require();
          UEZGUI_EXP_DK_ProximitySensor_Require();
          
#if (UEZ_PROCESSOR==NXP_LPC1788)
          UEZGUI_EXP_DK_SDCard_MCI_Require(1); //currently only supported on LPC1788
#endif
          UEZGUI_EXP_DK_FullDuplex_RS485_Require(UEZ_CONSOLE_WRITE_BUFFER_SIZE,
                                                 UEZ_CONSOLE_READ_BUFFER_SIZE);
          UEZGUI_EXP_DK_CAN_Require();
          
          UEZPlatform_DAC0_Require();
          UEZPlatform_Timer2_Require(); // Needed by Video player
          UEZDACWAVConfig("Timer2");
          UEZGUI_EXP_DK_AudioMixer_Require();
     } else {          
          UEZPlatform_SDCard_Drive_Require(1);
     }
     
#if UEZ_ENABLE_USB_HOST_STACK
     #if USB_PORT_B_HOST_DETECT_ENABLED
     if (G_expdkDetected) {
          G_usbIsDevice = UEZGUI_EXP_DK_USB_Host_Port_B_Detect();
     } else {
          G_usbIsDevice = UEZPlatform_Host_Port_B_Detect();
     }
     if (G_usbIsDevice) {       // High for a device
      #if UEZ_ENABLE_USB_DEVICE_STACK
          UEZPlatform_USBDevice_Require();
      #endif
          UEZPlatform_USBHost_PortA_Require();
          UEZPlatform_USBFlash_Drive_Require(0);
     } else {                   // Low for a host
          UEZPlatform_USBHost_PortB_Require();
          UEZPlatform_USBFlash_Drive_Require(0);
     }
     #else
          #if UEZ_ENABLE_USB_DEVICE_STACK
                UEZPlatform_USBDevice_Require();
          #endif
          UEZPlatform_USBHost_PortA_Require();
          UEZPlatform_USBFlash_Drive_Require(0);
     #endif
#else 
    #if UEZ_ENABLE_USB_DEVICE_STACK
        UEZPlatform_USBDevice_Require();
    #endif
        UEZTaskDelay(500);//ensure the host task has itiilaized before continuing.
#endif
     
     // Network needed?
#if UEZ_ENABLE_WIRED_NETWORK
     UEZPlatform_WiredNetwork0_Require();
#endif
     
#if UEZ_ENABLE_WIRELESS_NETWORK
#if UEZ_WIRELESS_PROGRAM_MODE
     UEZPlatform_WiFiProgramMode();
#endif
     UEZPlatform_WirelessNetwork0_Require();
#endif
     
#if FREERTOS_PLUS_TRACE //LPC1788 only as of uEZ v2.04
     uiTraceStart();
     vTraceStartStatusMonitor();
     
     traceAddressInMemory = (TUInt32)vTraceGetTraceBuffer();
     printf("%x", traceAddressInMemory);
#endif
     
#if ENABLE_UEZ_BUTTON
     UEZPlatform_ButtonBoard_Require();
#endif
     
     // Create a main task (not running yet)
     UEZTaskCreate((T_uezTaskFunction)MainTask, "Main", MAIN_TASK_STACK_SIZE, 0,
                   UEZ_PRIORITY_NORMAL, &G_mainTask);
     
     // Done with this task, fall out
     return 0;
}