Пример #1
0
static void
sdt_load(void *dummy)
{
	int ind;

#ifdef SDT_DEBUG
	printf("sdt: %s\n", __func__);
#endif

	sdt_init(dtrace_probe);

	sdt_list = kmem_alloc(sizeof(sdt_provider_t *) * SDT_MAX_PROVIDER,
	    KM_SLEEP);

	mutex_init(&sdt_mutex, "sdt_mutex", MUTEX_DEFAULT, NULL);

	sdt_count = 0;

	if (sdt_list == NULL) {
		printf("sdt: failed to alloc provider list\n");
		return;
	}

	for (ind = 0; sdt_providers[ind] != NULL; ind++) {
	    	if (sdt_count >= SDT_MAX_PROVIDER) {
			printf("sdt: too many providers\n");
			break;
		}
		sdt_register(sdt_providers[ind]);

#ifdef SDT_DEBUG
		printf("sdt: registered %s id = 0x%x\n",
			sdt_providers[ind]->name,
			sdt_providers[ind]->id);
#endif
	}
}
Пример #2
0
int main()
{
  PRINTF("%s","Hello ACN World\n");

   /* note, this may not work in all cases. 
   1) all systems might boot at the same time
   2) when they get to this point, they may not have an ip yet
   */

  /* init our acn stack */
  acn_port_protect_startup();
#if CONFIG_NSK
  srand(microsecsonds_since_midnight_GMT() + netx_getmyip(0));
  netx_init();
  netx_startup();
#endif

#if CONFIG_SLP
  slp_init();
  slp_open();
  slp_active_discovery_start();
#endif

#if CONFIG_RLP
  rlp_init();
#if CONFIG_SDT
  sdt_init();
  sdt_startup(true);
#endif
  /* dmp_startup(); */
#endif /* RLP */

  pthread_create(&timer_thread_id, NULL, timer_funct, NULL);
  pthread_create(&recv_thread_id, NULL, recv_funct, NULL);

  process_keys();

  /* shut things down - these require the threads to continue run... */
#if CONFIG_SDT
  sdt_shutdown();
#endif
#if CONFIG_SLP
  slp_close();  
#endif
  /* dmp_shutdown() */

  /* close threads */
  pthread_cancel(recv_thread_id);
  pthread_join(recv_thread_id, NULL);
  pthread_cancel(timer_thread_id);
  pthread_join(timer_thread_id, NULL);

#if CONFIG_NSK
  netx_shutdown();
#endif
  acn_port_protect_shutdown();

  slp_stats();
  sdt_stats();
  PRINTF("%s","========================\n");

  PRINTF("%s","Done...\n");
  return 0;
}
Пример #3
0
void UserMain(void * pd) {
  int x;
  DWORD flag = 0;
  int cnt;

  InitializeStack();
  GetDHCPAddressIfNecessary();
  if (EthernetIP == 0) GetDHCPAddress();
  OSChangePrio(MAIN_PRIO);
  EnableAutoUpdate();

  #ifdef _DEBUG
    /* InitializeNetworkGDB_and_Wait(); */
    InitializeNetworkGDB();
  #endif

  /* note, this may not work in all cases.
  1) all systems might boot at the same time
  2) when they get to this point, they may not have an ip yet
  */
    /* init our acn stack */
    acn_port_protect_startup();
#if CONFIG_NSK
  srand(GetPreciseTime() + netx_getmyip(0));
  netx_init();
  netx_startup();
#endif

#if CONFIG_SLP
  slp_init();
  slp_open();
  slp_active_discovery_start();
#endif

#if CONFIG_RLP
  rlp_init();
#if CONFIG_SDT
  sdt_init(); /* indirectly calls sdtm_init(), rlp_init(), rlpm_init() */
  sdt_startup(true);
#endif

#if CONFIG_DMP
  /* dmp_startup(); */
#endif

#endif /* RLP */

  CreateTasks();

  x = OSChangePrio( DEBUG_TERM_PRIORITY );
  if (x) {
    PRINTF("%s","OUCH\n");
  }

  PRINTF("%s","Hello ACN World\n");

  ioctl( 0, IOCTL_CLR | IOCTL_RX_ECHO ); /* turn sdtin echo off */

  process_keys();

  /* shut things down - these require the threads to continue run... */
#if CONFIG_SDT
  sdt_shutdown();
#endif

#if CONFIG_SLP
  slp_close();
#endif

#if CONFIG_DMP
  /* dmp_shutdown() */
#endif

  /* shut down receive thread */
  OSFlagClear(&recv_flag, 1);
  PRINTF("%s","Waiting for task to recv to shut down..");
  cnt = 0;
  flag = 0;
  while (!flag) {
    cnt++;
    if (cnt == 80) {
      cnt = 0;
      PRINTF("%s","\n");
    }
    PRINTF("%s",".");
    flag = OSFlagState(&recv_flag);
  }

  /* shut down tick thread */
  OSFlagClear(&tick_flag, 1);
  PRINTF("%s","Waiting for task to tick to shut down..");
  cnt = 0;
  flag = 0;
  while (!flag) {
    cnt++;
    if (cnt == 80) {
      cnt = 0;
      PRINTF("%s","\n");
    }
    PRINTF("%s",".");
    flag = OSFlagState(&tick_flag);
  }

#if CONFIG_NSK
  netx_shutdown();
#endif
  acn_port_protect_shutdown();

  slp_stats();
  sdt_stats();
  PRINTF("%s","========================\n");

  PRINTF("%s","\nDone....\n");
  while (1) {
    OSTimeDly(20);
  }
}