void CEcmtMidpDebugPlugin::BindMessagingL(MEcmtMessaging* aMessaging)
{
    TRACE_INIT(aMessaging);
    iMessaging = aMessaging;
    iMessaging->AddMessageEventObserverL(*this, TUid::Uid(
        KECMT_MIDP_DEBUG_PLUGIN_UID));
}
Exemple #2
0
int main( void )
{
  TRACE_INIT();
  TRACE_INFO("Image Boot.\n\r");

//screen
  scrInit();
  fontSetCharPos(0,110);
  fontColor = SCR_COLOR_WHITE;
  TRACE_SCR("FreeRTOS Image\n\r");

  prvSetupHardware();
  void* taskHandle;
  xTaskCreate( MakeStarterTask, (signed char*)"Make", ( 1200 >> 2 ), NULL, 4, &taskHandle );
  // new Task( MakeStarterTask, "Make", 1200, NULL, 4 );

  /*NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
  The processor MUST be in supervisor mode when vTaskStartScheduler is 
  called.  The demo applications included in the FreeRTOS.org download switch
  to supervisor mode prior to main being called.  If you are not using one of
  these demo application projects then ensure Supervisor mode is used here. */
  vTaskStartScheduler();
  
  return 0; // Should never get here!
}
Exemple #3
0
int main() {
    TRACE_INIT(scheme);
    TRACE("Starting...");

    SHOULD_NEVER_BE_HERE;
    CHECK(1 == 0);
    return 0;
}
Exemple #4
0
int main( void )
{
    TRACE_INIT();
    TRACE_INFO("Image Boot.\n\r");

    malloc_lock_init();
/*
    i2c_init();
    rtc_init();
    event_init(100);
*/
    prvSetupHardware();

#ifdef CFG_SCHEDULER_RTT
// MV RTT setup
// boot loader enables PIT we have to turn it off
    AT91C_BASE_PITC->PITC_PIMR = 0;
    /* Configure the RTT period. */
    AT91C_BASE_RTTC->RTTC_RTMR = 32 | AT91C_RTTC_RTTRST;
    AT91C_BASE_RTTC->RTTC_RTSR;
    void sys_isr_wrapper( void );
    AT91F_AIC_ConfigureIt( AT91C_ID_SYS, IRQ_SYS_PRI, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, ( void (*)(void) )sys_isr_wrapper );


    /* Enable the interrupt.  Global interrupts are disables at this point so
    this is safe. */
    AT91C_BASE_AIC->AIC_IECR = 0x1 << AT91C_ID_SYS;
#endif

#if 1
    //screen
    scrInit();
    fontSetCharPos(0,110);
    fontColor = SCR_COLOR_WHITE;
    TRACE_SCR("FreeRTOS Image\n\r");
#endif

    //button_init();
    xTaskCreate( StarterTask, "starter", TASK_STACK_SIZE(TASK_STARTER_STACK), NULL, TASK_STARTER_PRI, NULL );
    // new Task( MakeStarterTask, "Make", 1200, NULL, 4 );

    /*NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
      The processor MUST be in supervisor mode when vTaskStartScheduler is 
      called.  The demo applications included in the FreeRTOS.org download switch
      to supervisor mode prior to main being called.  If you are not using one of
      these demo application projects then ensure Supervisor mode is used here. */
    TRACE_INFO("Starting scheduler\r\n");
    uint32_t mkcr = AT91C_BASE_PMC->PMC_MCKR;
    uint32_t sr = AT91C_BASE_PMC->PMC_SR;
    TRACE_INFO("pmc pcsr %x mckr %x sr %x\r\n", AT91C_BASE_PMC->PMC_PCSR, mkcr, sr);

    //Led_init(&led);
    //Led_setState(&led, 0);
    vTaskStartScheduler();

    return 0; // Should never get here!
}
Exemple #5
0
int  main (void)
{
    OS_ERR  err;

#if (CPU_CFG_NAME_EN == DEF_ENABLED)
    CPU_ERR     cpu_err;
#endif


    CPU_Init();                                                 /* Initialize the CPU abstraction layer.                */

    Mem_Init();                                                 /* Initialize the Memory Management Module.             */

    Math_Init();                                                /* Initialize the Mathematical Module.                  */

#if (CPU_CFG_NAME_EN == DEF_ENABLED)
    CPU_NameSet((CPU_CHAR *)"MKL46Z256VLL4",
                (CPU_ERR  *)&cpu_err);
#endif

    BSP_IntDisAll();                                            /* Disable all interrupts.                              */

#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN > 0u))
    TRACE_INIT();                                               /* Initialize the µC/Trace recorder.                    */
    TRACE_START();                                              /* Start recording.                                     */
#endif

    OSInit(&err);                                               /* Initialize "uC/OS-III, The Real-Time Kernel".        */
	
    OSMutexCreate((OS_MUTEX  *)&AppMutex,
                 (CPU_CHAR   *)"My App. Mutex",
                 (OS_ERR     *)&err);
  
    OSQCreate    ((OS_Q      *)&AppQ,
                 (CPU_CHAR   *)"My App Queue",
                 (OS_MSG_QTY  )10,
                 (OS_ERR     *)&err);

    OSTaskCreate((OS_TCB     *)&App_TaskStartTCB,               /* Create the startup task.                             */
                 (CPU_CHAR   *)"Startup Task",
                 (OS_TASK_PTR ) App_TaskStart,
                 (void       *) 0,
                 (OS_PRIO     ) APP_CFG_TASK_START_PRIO,
                 (CPU_STK    *)&App_TaskStartStk[0],
                 (CPU_STK     )(APP_CFG_TASK_START_STK_SIZE / 10u),
                 (CPU_STK_SIZE) APP_CFG_TASK_START_STK_SIZE,
                 (OS_MSG_QTY  ) 0,
                 (OS_TICK     ) 0,
                 (void       *) 0,
                 (OS_OPT      )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR     *)&err);

    OSStart(&err);                                              /* Start multitasking (i.e. give control to uC/OS-III). */

    while(DEF_ON) {                                             /* Should Never Get Here                                */
    };
}
Exemple #6
0
//---------------------------------------------------------------------------------------------------
// Main
//---------------------------------------------------------------------------------------------------
int  main (void)
{
	OS_ERR  aErr;
    
  SCB_SHPR2=(3<<30);
    
#if (CPU_CFG_NAME_EN == DEF_ENABLED)
    CPU_ERR     aCpuErr;
#endif

	// Initialize the CPU abstraction layer
	CPU_Init();                                                 
	
	//Initialize the Memory Management Module
	Mem_Init();                                                 
	
	// Initialize the Mathematical Module
	Math_Init();                                                

#if (CPU_CFG_NAME_EN == DEF_ENABLED)
	CPU_NameSet((CPU_CHAR *)"MKL46Z256VLL4",(CPU_ERR  *)&aCpuErr);
#endif

	// Disable all interrupts
	BSP_IntDisAll();                                            

#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN > 0u))
    TRACE_INIT();		// Initialize the µC/Trace recorder
    TRACE_START();	// Start recording
#endif
   
	// Initialize "uC/OS-III, The Real-Time Kernel"
	OSInit(&aErr);                                               
	
	// Création de la tâche de démarrage
	OSTaskCreate((OS_TCB     *)&sAppTaskStartTCB,               
							 (CPU_CHAR   *)"Startup Task",
							 (OS_TASK_PTR ) AppTaskStart,
							 (void       *) 0,
							 (OS_PRIO     ) kStartTaskPr,
							 (CPU_STK    *)&sAppTaskStartStk[0],
							 (CPU_STK     )(kStackSize / 10u),
							 (CPU_STK_SIZE) kStackSize,
							 (OS_MSG_QTY  ) 0,
							 (OS_TICK     ) 0,
							 (void       *) 0,
							 (OS_OPT      )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
							 (OS_ERR     *)&aErr);

	// Démarrage du multitâche
	OSStart(&aErr);                                              
	
	// On ne doit jamais se trouver ici...
	while(1);
}
Exemple #7
0
int main (int argc, char **argv) {

	struct main_pars pars = init_main_pars(argc, argv);
	
	COND_VAR_INIT(sync_barrier);
	MUTEX_INIT(main_lock);
	TRACE_INIT();
	
	run_main(pars);	
	
	free_main(pars);

	TRACE_END();

	return 0;
}
Exemple #8
0
/*
************************************************************************************************************************
*                                       Init raw os
*
* Description: This function is called to init raw os.
*
* Arguments  :None
*                 -----
*                 
*
*				         
* Returns		RAW_U16:	 RAW_SUCCESS.
*						
* Note(s)    	
*
*             
************************************************************************************************************************
*/
RAW_U16 raw_os_init(void)
{

	TRACE_INIT();
	
	raw_os_active = RAW_OS_STOPPED;
	run_queue_init(&raw_ready_queue);

	/*Init the tick heart system*/
	tick_list_init();

	#if (RAW_SYSTEM_CHECK > 0)
	/*Init the task head list*/
	list_init(&(system_debug.task_head));
	#endif
	
	#if (CONFIG_RAW_USER_HOOK > 0)
	raw_os_init_hook();
	#endif

	/*Start the first idle task*/
	raw_task_create(&raw_idle_obj, (RAW_U8  *)"idle_task",  0, 
									IDLE_PRIORITY, 0,  idle_stack, 
									IDLE_STACK_SIZE,  raw_idle_task, 1);
	
	#if (CONFIG_RAW_TIMER > 0)
	raw_timer_init();
	#endif

	#if (CONFIG_RAW_TASK_0 > 0)
	raw_task_0_init();
	#endif

	#if (CONFIG_RAW_TICK_TASK > 0)
	tick_task_start();
	#endif

	#if (RAW_CONFIG_CPU_TASK > 0)
	cpu_task_start();
	#endif
	
	return RAW_SUCCESS;
}
Exemple #9
0
/*
************************************************************************************************************************
*                                       Init raw os
*
* Description: This function is called to init raw os.
*
* Arguments  :None
*                 -----
*                 
*
*				         
* Returns		RAW_U16:	 RAW_SUCCESS.
*						
* Note(s)    	
*
*             
************************************************************************************************************************
*/
RAW_OS_ERROR raw_os_init(void)
{

	TRACE_INIT();
	
	raw_os_active = RAW_OS_STOPPED;
	run_queue_init(&raw_ready_queue);

	/*Init the tick heart system*/
	tick_list_init();

	/*Init the task debug head list*/
	list_init(&(raw_task_debug.task_head));

	#if (CONFIG_RAW_USER_HOOK > 0)
	raw_os_init_hook();
	#endif

	/*Start the first idle task*/
	raw_task_create(&raw_idle_obj, (RAW_U8  *)"idle_task",  0, 
									IDLE_PRIORITY, 0,  idle_stack, 
									IDLE_STACK_SIZE,  raw_idle_task, 1);

	/*The timer module need mutex*/
	#if (CONFIG_RAW_TIMER > 0)
	raw_timer_init();
	raw_mutex_create(&timer_mutex, (RAW_U8 *)"timer_mutex", RAW_MUTEX_INHERIT_POLICY, 0);
	#endif

	/*tick task to reduce interrupt time*/
	#if (CONFIG_RAW_TICK_TASK > 0)
	tick_task_start();
	#endif

	/*For  statistic*/
	#if (RAW_CONFIG_CPU_TASK > 0)
	cpu_task_start();
	#endif
	
	return RAW_SUCCESS;
}
// DllMain: Entry-point for the DLL.
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        g_hModule = (HMODULE)hModule;
        TRACE_INIT();
        break;

    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
        break;

    case DLL_PROCESS_DETACH:
        TRACE_CLOSE();
        break;
    }
    return TRUE;
}
Exemple #11
0
//------------------------------------------------------------------------------
//          Main
//------------------------------------------------------------------------------
int main()
{
    unsigned int dPioStatus;
    S_mse_report *pReport = &(sMse.sReport);
    bool         isChanged;

    TRACE_INIT();
    TRACE_INFO("\n\rMain HID mouse\n\r");

    // Initialize the HID mouse driver
    MSE_Init(&sMse, &sUsb);

    TRACE_INFO("Connecting ... ");

    // Wait for the device to be powered before connecting it
    while (!ISSET(USB_GetState(&sUsb), USB_STATE_POWERED));
    USB_Connect(&sUsb);

    TRACE_INFO("OK\n\r");

    // Main loop
    while (1) {

        // Retrieve PIO status change
        isChanged = false;
        dPioStatus = SWITCH_PIO->PIO_PDSR;

        // Check for clicks on any button
        // Left mouse button
        if (ISCLEARED(dPioStatus, SW_LEFTCLICK)) {

            SET(pReport->bButtons, MSE_LEFT_BUTTON);
            CLEAR(dPioStatus, SW_LEFTCLICK);
            isChanged = true;
        }
        else {

            // Check if button was previously pressed
            if (ISSET(pReport->bButtons, MSE_LEFT_BUTTON)) {

                CLEAR(pReport->bButtons, MSE_LEFT_BUTTON);
                isChanged = true;
            }
        }

        // Right mouse button
        if (ISCLEARED(dPioStatus, SW_RIGHTCLICK)) {

            SET(pReport->bButtons, MSE_RIGHT_BUTTON);
            CLEAR(dPioStatus, SW_RIGHTCLICK);
            isChanged = true;
        }
        else {

            // Check if button was previously pressed
            if (ISSET(pReport->bButtons, MSE_RIGHT_BUTTON)) {

                CLEAR(pReport->bButtons, MSE_RIGHT_BUTTON);
                isChanged = true;
            }
        }

        // Check pointer for movement
        // Left
        if (ISCLEARED(dPioStatus, SW_LEFT)) {

            pReport->bX = -SPEED_X;
            isChanged = true;
        }
        // Right
        else if (ISCLEARED(dPioStatus, SW_RIGHT)) {

            pReport->bX = SPEED_X;
            isChanged = true;
        }
        else {

            pReport->bX = 0;
        }

        // Up
        if (ISCLEARED(dPioStatus, SW_UP)) {

            pReport->bY = -SPEED_Y;
            isChanged = true;
        }
        // Down
        else if (ISCLEARED(dPioStatus, SW_DOWN)) {

            pReport->bY = SPEED_Y;
            isChanged = true;
        }
        else {

            pReport->bY = 0;
        }

        // Send report if a change has occured
        if (isChanged) {

            LED_TOGGLE(LED_MEM);
            MSE_SendReport(&sMse, 0, 0);
        }
    }
}
Exemple #12
0
int
main (int argc, char **argv)
{
  char *socket_file = NULL;
  const char *debug_log_flag_str = getenv ("BML_DEBUG");
  const int debug_log_flags =
      debug_log_flag_str ? atoi (debug_log_flag_str) : 0;
  BMLDebugLogger logger;
  int server_socket, client_socket;
  socklen_t addrlen;
  ssize_t size;
  struct sockaddr_un address = { 0, };
  int running = TRUE;
  BmlIpcBuf bo = IPC_BUF_INIT, bi = IPC_BUF_INIT;
  BmAPI id;

  logger = TRACE_INIT (debug_log_flags);
  TRACE ("beg\n");

  if (argc > 1) {
    socket_file = argv[1];
  } else {
    fprintf (stderr, "Usage: bmlhost <socket file>\n");
    return EXIT_FAILURE;
  }
  TRACE ("socket file: '%s'\n", socket_file);

  if (!_bmlw_setup (logger)) {
    TRACE ("bmlw setup failed\n");
    return EXIT_FAILURE;
  }
  // TODO: maybe switch to SOCK_SEQPACKET
  if ((server_socket = socket (PF_LOCAL, SOCK_STREAM, 0)) > 0) {
    TRACE ("server socket created\n");
  }

  unlink (socket_file);
  address.sun_family = PF_LOCAL;
  strcpy (&address.sun_path[1], socket_file);
  if (bind (server_socket, (struct sockaddr *) &address,
          sizeof (sa_family_t) + strlen (socket_file) + 1) != 0) {
    TRACE ("socket path already in use!\n");
  }
  // number of pending connections
  // upper limmit is /proc/sys/net/core/somaxconn usually 128 == SOMAXCONN
  // right we just have one anyway
  listen (server_socket, /* backlog of pending connections */ SOMAXCONN);
  addrlen = sizeof (struct sockaddr_in);
  client_socket =
      accept (server_socket, (struct sockaddr *) &address, &addrlen);
  if (client_socket > 0) {
    TRACE ("client connected\n");
  }
  while (running) {
    TRACE ("waiting for command ====================\n");
    bmlipc_clear (&bi);
    size = recv (client_socket, bi.buffer, IPC_BUF_SIZE, 0);
    if (size == 0) {
      TRACE ("got EOF\n");
      running = FALSE;
      continue;
    }
    if (size == -1) {
      TRACE ("ERROR: recv returned %d: %s\n", errno, strerror (errno));
      // TODO(ensonic): specific action depending on error
      continue;
    }
    bi.size = (int) size;
    TRACE ("got %d bytes\n", bi.size);
    // parse message
    id = bmlipc_read_int (&bi);
    if (bi.io_error) {
      TRACE ("message should be at least 4 bytes");
      continue;
    }
    TRACE ("command: %d\n", id);
    bmlipc_clear (&bo);
    switch (id) {
      case 0:
        running = FALSE;
        break;
      case BM_SET_MASTER_INFO:
        _bmlw_set_master_info (&bi, &bo);
        break;
      case BM_OPEN:
        _bmlw_open (&bi, &bo);
        break;
      case BM_CLOSE:
        _bmlw_close (&bi, &bo);
        break;
      case BM_GET_MACHINE_INFO:
        _bmlw_get_machine_info (&bi, &bo);
        break;
      case BM_GET_GLOBAL_PARAMETER_INFO:
        _bmlw_get_global_parameter_info (&bi, &bo);
        break;
      case BM_GET_TRACK_PARAMETER_INFO:
        _bmlw_get_track_parameter_info (&bi, &bo);
        break;
      case BM_GET_ATTRIBUTE_INFO:
        _bmlw_get_attribute_info (&bi, &bo);
        break;
      case BM_DESCRIBE_GLOBAL_VALUE:
        _bmlw_describe_global_value (&bi, &bo);
        break;
      case BM_DESCRIBE_TRACK_VALUE:
        _bmlw_describe_track_value (&bi, &bo);
        break;
      case BM_NEW:
        _bmlw_new (&bi, &bo);
        break;
      case BM_FREE:
        _bmlw_free (&bi, &bo);
        break;
      case BM_INIT:
        _bmlw_init (&bi, &bo);
        break;
      case BM_GET_TRACK_PARAMETER_VALUE:
        _bmlw_get_track_parameter_value (&bi, &bo);
        break;
      case BM_SET_TRACK_PARAMETER_VALUE:
        _bmlw_set_track_parameter_value (&bi, &bo);
        break;
      case BM_GET_GLOBAL_PARAMETER_VALUE:
        _bmlw_get_global_parameter_value (&bi, &bo);
        break;
      case BM_SET_GLOBAL_PARAMETER_VALUE:
        _bmlw_set_global_parameter_value (&bi, &bo);
        break;
      case BM_GET_ATTRIBUTE_VALUE:
        _bmlw_get_attribute_value (&bi, &bo);
        break;
      case BM_SET_ATTRIBUTE_VALUE:
        _bmlw_set_attribute_value (&bi, &bo);
        break;
      case BM_TICK:
        _bmlw_tick (&bi, &bo);
        break;
      case BM_WORK:
        _bmlw_work (&bi, &bo);
        break;
      case BM_WORK_M2S:
        _bmlw_work_m2s (&bi, &bo);
        break;
      case BM_STOP:
        _bmlw_stop (&bi, &bo);
        break;
      case BM_ATTRIBUTES_CHANGED:
        _bmlw_attributes_changed (&bi, &bo);
        break;
      case BM_SET_NUM_TRACKS:
        _bmlw_set_num_tracks (&bi, &bo);
        break;
      case BM_SET_CALLBACKS:
        TRACE ("FIXME");
        break;
      default:
        break;
    }
    if (bo.size) {
      size = send (client_socket, bo.buffer, bo.size, MSG_NOSIGNAL);
      TRACE ("sent %d of %d bytes\n", size, bo.size);
      if (size == -1) {
        TRACE ("ERROR: send returned %d: %s\n", errno, strerror (errno));
        // TODO(ensonic): specific action depending on error
      }
    }
  }
  close (client_socket);
  close (server_socket);
  unlink (socket_file);

  _bmlw_finalize ();
  TRACE ("end\n");
  return EXIT_SUCCESS;
}