Home::Home(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Home)
{
    ui->setupUi(this);
display_events();
display_stock();
}
Esempio n. 2
0
void
State::display()
{

	dprintf( D_ALWAYS,
		"\t%-14s%-20s",
		StateNames.get_name(id),
		StateFuncNames.get_name((long)func)
	);

	display_events();
	dprintf( D_ALWAYS | D_NOHEADER, "\n" );
}
Esempio n. 3
0
/*****************************************************************************
 * Function name: App_ImaSetup
 * Description  : IMA groups and links are created in this function. It takes 
 *    some time for the IMA group to reach operational state. A check is done
 *    for the IMA group state, for reaching operational state with a 20 sec 
 *    timeout before initial traffic flow.
 * Input  params: None
 * Output params: None
 * Return val   : None
 *****************************************************************************/
void App_ImaSetup (void)
{
   WP_U32 ii = 0;
   WP_U32 expected_group_op, actual_group_op;
   WP_U16 prev_grp_state[NUM_OF_GROUPS];
   WP_U16 prev_fe_grp_state[NUM_OF_GROUPS];
   WP_U32 i, x, j;

   /* Group State information used for detecting change */
   WP_ima_group_state_info group_state[NUM_OF_GROUPS];

   /* IMA group create */
   for (ii = 0; ii < NUM_OF_GROUPS; ii++)
   {
      ima_group.group_alloc = &group_alloc[ii];
      ima_group_handle[ii] =
         WP_ImaGroupCreate (ima_sys_handle, &ima_group);
      App_TerminateOnError (ima_group_handle[ii], "WP_ImaGroupCreate()");

      /* Get the Group started before adding the link */
      status = WP_ImaGroupStartup (ima_group_handle[ii]);
      App_TerminateOnError (status, "WP_ImaGroupStartup()");

      j = 0;
#if 0
      /* Enable individual events (errors) */
      j = (1 << WP_IMA_EVENT_TTS) |
         (1 << WP_IMA_EVENT_TOS) |
         (1 << WP_IMA_EVENT_TXQEMPTY) |
         (1 << WP_IMA_EVENT_TXQFULL) |
         (1 << WP_IMA_EVENT_GSU_LASR_RX) | (1 << WP_IMA_EVENT_GSU_LASR_TX);

      printf ("TEst\n");
      status = WP_ImaGroupEventEnable (ima_group_handle[ii], j);
      App_TerminateOnError (status, "WP_ImaGroupEventEnable()");
#endif
   }

   /*Enable UFE phy system and ufe line */
   App_EnableUFESystem ();

   for (ii = 0; ii < NUM_OF_GROUPS; ii++)
   {
      ima_link_handle[2 * ii] = WP_ImaLinkAdd (ima_group_handle[ii],
                                               h_dev_ima[2 * ii],
                                               h_dev_ima[2 * ii],
                                               ima_link);
      App_TerminateOnError (ima_link_handle[2 * ii], "WP_ImaLinkAdd()");

      ima_link_handle[2 * ii + 1] = WP_ImaLinkAdd (ima_group_handle[ii],
                                                   h_dev_ima[2 * ii + 1],
                                                   h_dev_ima[2 * ii + 1],
                                                   ima_link);
      App_TerminateOnError (ima_link_handle[2 * ii + 1],
                            "WP_ImaLinkAdd()");
   }

   WP_Delay (10000);

   /* Initialize group NE state to "START_UP."  Note, this element */
   /* is updated by the WP_ImaGroupState() function.               */
   expected_group_op = 0;
   for (i = 0; i < NUM_OF_GROUPS; i++)
   {
      group_state[i].ne_state = WP_IMA_GSM_START_UP;
      group_state[i].fe_state = WP_IMA_GSM_START_UP;
      expected_group_op |= 0x80000000 >> i;
   }

   for (i = 0; i < NUM_OF_GROUPS; i++)
   {
      prev_grp_state[i] = WP_IMA_GSM_START_UP;
      prev_fe_grp_state[i] = WP_IMA_GSM_START_UP;
   }

   /* Wait until all groups are operational before sending any data */
   actual_group_op = 0;
   x = 0;

   while (expected_group_op != actual_group_op)
   {
      /* If we've waited more than 20 seconds, something is wrong */
      if (ticks > SECONDS (20))
      {

         printf ("Test Abort: Group Not Operational, check cable.\n");
         printf ("Test Failed\n");
         return;

      }
      /* Check for IMA related events */
      display_events ();
      /* Get state of groups */
      for (i = 0; i < NUM_OF_GROUPS; i++)
      {
         status = WP_ImaGroupState (ima_group_handle[i], &group_state[i]);
         App_TerminateOnError (status, "WP_ImaGroupState()");
         printf ("group_state[i].ne_state=%d\n", group_state[i].ne_state);
         if (prev_grp_state[i] != group_state[i].ne_state)
         {
            prev_grp_state[i] = group_state[i].ne_state;
            if (group_state[i].ne_state == WP_IMA_GSM_OPERATIONAL)
               actual_group_op |= 0x80000000 >> i;
         }
      }
   }
Esempio n. 4
0
/****************************************************************************************************************************
 * Function name: main()
 * Description  : Main function of the application. 
 *
 * Input  params: none
 * Output params: 
 * Return val   : none
 *****************************************************************************************************************************/
int main (int argc, char *argv[])
{
   WP_status status;
   app_task *task, a_task;
   WP_CHAR comm;

   status = WP_DriverInit ();
   App_TerminateOnError (status, "WP_DriverInit()");

   /* Initialize the Tags */
   App_TestInit ();

   /* Configure the context and initialize the System */
   App_SysInit ();

   /* Commit system resources */
   /* Enet Physical ports and UFE Card are initialzed */
   App_InitHW ();

   App_SystemSetup ();

   App_ResetUfe ();

   WUFE_SystemInterruptDisable (0);

   /* Create Enet and emphy ports */
   App_PortsCreate ();

   /* Create Host, Enet devices and allocate IMA(emphy) devices */
   App_DevicesAllocCreate ();

   /* Create Host, Buffer Pools and Qnodes */
   App_BufferPoolsCreate ();
   /* Initialize the Control registers, Create IMA system and Commit the system */

   status = WP_SysCommit ();
   App_TerminateOnError (status, "WP_SysCommit()");

   App_enableEmphyPort ();

   /*Initialize the framer. Configure and create UFE line and phy create */
   App_ufeSystem ();

   /* ASU sheduler Enable */
   status = WP_SysAsuEnable (WP_WINPATH (0));
   App_TerminateOnError (status, "WP_SysAsuEnable()");

   /* Create IMA groups and add links to the group */
   App_ImaSetup ();

   /* IMA group event generate */
   App_ImaGroupEvent ();

   /* Create Host, Enet and Host Channels */
   App_ChannelsCreate ();

   /* Create ATM channels for IMA */
   App_ImaChannelsCreate ();

   /* Sets up ENET --> UFE bridging interworking */
   App_CreateEnetUfeIwSystem ();

   /* Sets up Ufe  --> ENET interworking */
   App_CreateUfeEnetIwSystem ();

   /* Enable the ports and devices created earlier */
   App_PortsDevicesEnable ();

   /* Enable the Channels created earlier */
   App_ChannelsEnable ();

   display_events ();
   WP_Delay (1000000);
   display_events ();
  
printf ("ready to show MENU\n");
// fflush(stdout);

   if (argc <= 1)
   {
      /*default mode, no parameters */
      while (1)
      {
         printf ("\n");
         printf ("a. Stats & Status\n");
         printf ("d. Debug\n");
         printf ("p. Send Packet\n");
         printf ("s. Simulate Interrupts\n");
         printf ("x. Exit\n");

         do
         {
            comm = getchar ();
         }
         while (!('a' <= comm && 'z' >= comm));

         switch (comm)
         {
         case 'a':
            App_ShowStats ();
            break;
         case 'p':
            App_DataSend (h_enet1_tx, h_pool_buffer_iw);
            break;
            /*Not supported....Added code for future use. 
               case 'd':
               App_Debug(debug_on);
               break;
               case 's':
               WPI_SimulateInterrupts();
               break; */
         case 'x':
            {
               WP_DriverRelease ();
               exit (0);
            }
         }
         WPI_SimulateInterrupts ();
         while ((task = next_task (irq_task_list, &a_task)) != NULL)
            app_perform_action (task);
      }
   }
   else if ((argc == 3) && (!strcmp (argv[1], "freerun")))
   {
      /*free run mode */
      App_perform_freerun ();

   }
   else
   {
      printf ("Wrong parameter! Only \"go\" or \"go freerun\" supported!");
      /*Quit test */
      App_Quit (1);
   }
   return 0;
}