示例#1
0
void main(void)
{
	net_init();

	init_app();

	ipsum_len = strlen(lorem_ipsum);

#if defined(CONFIG_NETWORKING_WITH_BT)
	if (bt_enable(NULL)) {
		PRINT("Bluetooth init failed\n");
		return;
	}
	ipss_init();
	ipss_advertise();
#endif

	if (!get_context(&unicast, &multicast)) {
		PRINT("%s: Cannot get network context\n", __func__);
		return;
	}

#if defined(CONFIG_MICROKERNEL)
	receiving();
#else
	task_fiber_start(&stack_receiving[0], STACKSIZE,
			(nano_fiber_entry_t)receiving, 0, 0, 7, 0);
#endif
}
int main(int argc, char **argv )
{
  int rank, size, n, nrange;
  init_app (argc, argv, &rank, &size);
  if( argc < 2 ) {
    if (rank == 0){
     printf("need a problem size\n");
   }
   MPI_Finalize();
   return 0;
 }

 if( argc == 2 ) {
  n  = atoi(argv[1]);
  runPoisson(rank, size, n);
}

else{
  n  = atoi(argv[1]);
  nrange  = atoi(argv[2]);
  for (int i = n; i <= nrange ; ++i){
    runPoisson(rank, size, pow(2,i));
  }
}

MPI_Finalize();
return 0;
}
示例#3
0
int main( int argc, char *argv[] )
{
    gtk_init( &argc, &argv );
    init_app( &app );
    gtk_main();
    return 0;
}
示例#4
0
文件: main.c 项目: bigdinotech/zephyr
void main(void)
{
	int err;

	init_app();

	err = bt_enable(NULL);
	if (err) {
		printk("Bluetooth init failed (err %d)\n", err);
		return;
	}

	printk("Bluetooth initialized\n");

	ipss_init();

	err = ipss_advertise();
	if (err) {
		printk("Advertising failed to start (err %d)\n", err);
		return;
	}

	printk("Advertising successfully started\n");

	k_thread_create(&thread_data, thread_stack, STACKSIZE,
			(k_thread_entry_t)listen,
			NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
}
示例#5
0
int main (int argc, char *argv[]) {
    /* allocate the memory needed by our TutorialTextEditor struct */
    main_window = g_slice_new (WindowElements);


    /* initialize GTK+ libraries */
    gtk_init (&argc, &argv);

    if (init_app (main_window) == FALSE) return 1; /* error loading UI */
	gtk_widget_show (main_window->window);


#ifdef __i386__
	Log("You are in a 32 bit OS\n");
#endif
#ifdef __x86_64__
	Log("You are in a 64 bit OS\n");
#endif

	// Get local IP
	set_local_IP();
	if (valid_local_ipv4)
		set_LocalIPv4(addr_ipv4(&local_ipv4));
	if (valid_local_ipv6)
		set_LocalIPv6(addr_ipv6(&local_ipv6));

	// Infinite loop handled by GTK+3.0
	gtk_main ();

    /* free memory we allocated for TutorialTextEditor struct */
    g_slice_free (WindowElements, main_window);

	return 0;
}
示例#6
0
文件: main.c 项目: AndySze/OpenServo
// Start the application in firmware
void init_application() 
{
    cli();
    boot_rww_enable();   // Enable access to the flash memory
    GICR = (1 << IVCE);  // enable change of interrupt vectors
    GICR = (0 << IVSEL); // move interrupts to application flash section 
    init_app();
}
示例#7
0
文件: main.c 项目: sunkaizhu/zephyr
void main(void)
{
	NET_INFO("In main");

	init_app();

	main_fiber();
}
示例#8
0
    JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_computeparticles_ComputeParticles_init
    (JNIEnv *env, jclass jcls, jint width, jint height)
    {
        ASSERT(load_app(), "Failed to load content");
        init_app(width, height);

        last_tick = 0.0f;
        timer_init();
    }
示例#9
0
int		main(void)
{
  t_app		*app;

  app = init_app();
  select_it(app);
  stop_app(app);
  return (0);
}
示例#10
0
void main(void)
{
	if (init_app() != 0) {
		printf("Cannot initialize network\n");
		return;
	}

	k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t) dtls_client,
			NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);

}
示例#11
0
void main(void)
{
	if (init_app() != 0) {
		printk("Cannot initialize network\n");
		return;
	}

	k_thread_create(&thread_data, stack, STACK_SIZE,
			(k_thread_entry_t) dtls_server,
			NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);

}
示例#12
0
void lcd_init(void)
{
    _Bool ok =
        init_app("LCD", NULL, SDL_INIT_VIDEO) &&
        SDL_SetVideoMode(WIDTH, HEIGHT, 24, SDL_HWSURFACE);

    assert(ok);

    data_sf = SDL_CreateRGBSurfaceFrom(
        buffer, WIDTH, HEIGHT, 24, WIDTH * 3,
        mask32(0), mask32(1), mask32(2), 0);
}
示例#13
0
文件: mxm.c 项目: akva2/tma4280
int main(int argc, char **argv )
{
  int size, rank;
  long i, j, l, m, n, k, iter, loop;
  Matrix a, b, c;
  double t1, t2, dt, dt1, r;

  init_app(argc, argv, &rank, &size);

  if( argc < 3 ) {
    if (rank == 0)
      printf("need atleast 2 arguments - n & flag\n");
    close_app();
    return 1;
  }

  k = m = n = atoi(argv[1]);
  a = createMatrix(m, k);
  b = createMatrix(k, n);
  c = createMatrix(m, n);

  for (i=0; i  < m; i++) {
    for (l=0; l < k; l++) {
      a->data[l][i] = i+1.0;
    }
  }
  for (l=0; l  < k; l++) {
    for (j=0; j < n; j++) {
      b->data[j][l] = j+1.0;
    }
  }
  loop = 5;

  t1 = WallTime(); 
  for (iter=0; iter < loop; iter++)
    mxm (a,b,c,atoi(argv[2]));
  t2 = WallTime();

  dt = t2 - t1;
  dt1 = dt/(m*2*k*n);
  dt1 = dt1/loop;
  r    = 1.e-6/dt1;
  printf (" matrix-matrix : (m,k,n)= (%ld,%ld,%ld)    dt= %lf (s) dt1= %le r= %lf\n" ,m, k, n, dt, dt1, r);

  freeMatrix(a);
  freeMatrix(b);
  freeMatrix(c);

  close_app();

  return 0;
}
示例#14
0
int main(int argc, char** argv)
{
  int rank, size;
  init_app(argc, argv, &rank, &size);

  if (argc < 3) {
    printf("need two parameters, the matrix size and the number of vectors\n");
    close_app();
    return 1;
  }
  int N=atoi(argv[1]);
  int K=atoi(argv[2]);

  Matrix A = createMatrix(N,N);
  // identity matrix
  for (int i=0;i<N;++i)
    A->data[i][i] = 1.0;
  
  int *displ, *cols;
  splitVector(K, size, &cols, &displ);
  Matrix v = createMatrix(N,cols[rank]);
  // fill with column number
  for (int i=0;i<cols[rank];++i)
    for (int j=0;j<N;++j)
      v->data[i][j] = i+displ[rank];

  double time = WallTime();
  double sum = dosum(A,v);

  if (rank == 0) {
    printf("sum: %f\n", sum);
    printf("elapsed: %f\n", WallTime()-time);
  }

  char s[128];
  sprintf(s,"vec-%i.asc", rank);
  saveVectorSerial(s, v->as_vec);
  sprintf(s,"mat-%i.asc", rank);
  saveMatrixSerial(s, v);

  sprintf(s,"vec.asc");
  saveVectorMPI(s, v->as_vec);

  freeMatrix(v);
  freeMatrix(A);
  free(displ);
  free(cols);

  close_app();
  return 0;
}
示例#15
0
int main(
/*******/
    void
) {
    QMSG                qmsg;

    Main_hab = WinInitialize( 0 );
    if( !Main_hab ) {
        return( FALSE );
    }

    Main_hmq = WinCreateMsgQueue( Main_hab, 0 );
    if( !Main_hmq ) {
        return( FALSE );
    }

    if( !init_app( Main_hab ) ) {
        return( FALSE );
    }

    /* Perform initializations that apply to a specific instance */

    three_d_init();
    define_room();
    if (!init_instance( SWP_SHOW | SWP_ACTIVATE ) ) {
        finish_room();
        three_d_fini();
        return( FALSE );
    }

    /* Acquire and dispatch messages until a WM_QUIT message is received. */

    while( WinGetMsg( Main_hab, &qmsg, NULL, NULL, NULL) ) {
        WinDispatchMsg( Main_hab, &qmsg );
    }
    finish_room();
    three_d_fini();

    if( Main_hmq ) {
      WinDestroyMsgQueue( Main_hmq );
    }
    if( Main_hab ) {
      WinTerminate( Main_hab );
    }

    DosExit( EXIT_PROCESS, 0);

    return( SHORT1FROMMP( qmsg.mp1 ) );
}
示例#16
0
int main(int argc, char** argv)
{
  int rank, size;
  init_app(argc, argv, &rank, &size);

  if (argc < 2) {
    printf("usage: %s <N> [L]\n",argv[0]);
    close_app();
    return 1;
  }

  /* the total number of grid points in each spatial direction is (N+1) */
  /* the total number of degrees-of-freedom in each spatial direction is (N-1) */
  int N  = atoi(argv[1]);
  int M  = N-1;
  double L=1.0;
  if (argc > 2)
    L = atof(argv[2]);

  double h = L/N;
  poisson_info_t ctx;
  ctx.A = createPoisson1D(M);

  Vector grid = createVector(M);
  for (int i=0;i<M;++i)
    grid->data[i] = (i+1)*h;

  Matrix u = createMatrix(M, M);
  evalMesh(u->as_vec, grid, grid, poisson_source);
  scaleVector(u->as_vec, h*h);

  double time = WallTime();
  cg(evaluate, u, 1.e-6, &ctx);

  evalMesh2(u->as_vec, grid, grid, exact_solution, -1.0);
  double max = maxNorm(u->as_vec);

  if (rank == 0) {
    printf("elapsed: %f\n", WallTime()-time);
    printf("max: %f\n", max);
  }

  freeMatrix(u);
  freeVector(grid);
  freeMatrix(ctx.A);

  close_app();
  return 0;
}
示例#17
0
/** Entry point from OS.
 *
 * /param argc The number of arguments in the string vector.
 * /param argv The argument string vector.
 * /return The return code to the OS
 */
int main(int argc, char** argv)
{
    char messages[PATH_MAX];

    setbuf(stderr, NULL);
    setbuf(stdout, NULL);
#ifdef WITH_DBG_LOGFILE
    freopen("stdout.log", "a+", stdout);
    freopen("stderr.log", "a+", stderr);
#endif

    graf_mouse(BUSY_BEE, NULL);

    init_app(NULL);

    init_os_info();

    atari_find_resource((char*)&messages, "messages", "res/messages");
    atari_find_resource((char*)&options, "Choices", "Choices");

    LOG(("Initialising core..."));
    netsurf_init(&argc, &argv, options, messages);

    LOG(("Initializing GUI..."));
    gui_init(argc, argv);

    LOG(("Initializing GUI2"));
    gui_init2(argc, argv);

    graf_mouse( ARROW , NULL);

    LOG(("Creating initial browser window..."));
    browser_window_create(option_homepage_url, 0, 0, true, false);

    LOG(("Entering NetSurf mainloop..."));
    netsurf_main_loop();

    netsurf_exit();
    LOG(("ApplExit"));
#ifdef WITH_DBG_LOGFILE
    fclose(stdout);
    fclose(stderr);
#endif
    exit_gem();

    return 0;
}
示例#18
0
	void init_builtin_commands() {
		LOG_D("command/init") << "Populating command map";
		init_app();
		init_audio();
		init_automation();
		init_edit();
		init_grid();
		init_help();
		init_keyframe();
		init_recent();
		init_subtitle();
		init_time();
		init_timecode();
		init_tool();
		init_video();
		init_visual_tools();
	}
示例#19
0
int main(int argc, char *argv[])
{
    const char  *desc[] = {
        "[TT]g_xrama[tt] shows a Ramachandran movie, that is, it shows",
        "the Phi/Psi angles as a function of time in an X-Window.[PAR]"
        "Static Phi/Psi plots for printing can be made with [TT]g_rama[tt].[PAR]",
        "Some of the more common X command line options can be used:[BR]",
        "[TT]-bg[tt], [TT]-fg[tt] change colors, [TT]-font fontname[tt], changes the font."
    };

    output_env_t oenv;
    t_x11       *x11;
    t_topology  *ramatop;
    t_app       *app;
    t_filenm     fnm[] = {
        { efTRX, "-f", NULL, ffREAD },
        { efTPX, NULL, NULL, ffREAD }
    };
#define NFILE asize(fnm)

    CopyRight(stderr, argv[0]);
    parse_common_args(&argc, argv, PCA_CAN_TIME, NFILE, fnm, 0, NULL,
                      asize(desc), desc, 0, NULL, &oenv);


    if ((x11 = GetX11(&argc, argv)) == NULL)
    {
        fprintf(stderr, "Can't open display, set your DISPLAY environment variable\n");
        exit(1);
    }
    XSetForeground(x11->disp, x11->gc, x11->fg);
    app = init_app(x11, argc, argv);

    ramatop = init_rama(oenv, ftp2fn(efTRX, NFILE, fnm), ftp2fn(efTPX, NFILE, fnm),
                        app->xr, 3);
    mk_gly(app);

    XMapWindow(x11->disp, app->wd.self);
    XMapSubwindows(x11->disp, app->wd.self);
    x11->MainLoop(x11);
    x11->CleanUp(x11);

    thanx(stderr);

    return 0;
}
示例#20
0
文件: main.c 项目: TheBB/TMA4280
int main(int argc, char **argv)
{
    int rank, size;
    init_app(argc, argv, &rank, &size);

    Vector vec = createVectorMPI(30, &WorldComm, 1);

    if (rank == 0) {
        for (size_t i = 0; i < size; i++) {
            printf(">> Proc %d owns [%d,%d]\n", i, vec->displ[i],
                   vec->displ[i] + vec->sizes[i] - 1);
        }
    }

    close_app();
    return 0;
}
示例#21
0
int main(int argc, char** argv)
{
  int i, j, N, K;
  Matrix A, v;
  double time, sum;
  int rank, size;
  int *displ, *cols;

  init_app(argc, argv, &rank, &size);

  if (argc < 3) {
    printf("need two parameters, the matrix size and the number of vectors\n");
    close_app();
    return 1;
  }
  N=atoi(argv[1]);
  K=atoi(argv[2]);

  A = createMatrix(N,N);
  // identity matrix
  for (i=0;i<N;++i)
    A->data[i][i] = 1.0;
  
  splitVector(K, size, &cols, &displ);
  v = createMatrix(N,cols[rank]);
  // fill with column number
  for (i=0;i<cols[rank];++i)
    for (j=0;j<N;++j)
      v->data[i][j] = i+displ[rank];

  time = WallTime();
  sum = dosum(A,v);

  if (rank == 0) {
    printf("sum: %f\n", sum);
    printf("elapsed: %f\n", WallTime()-time);
  }

  freeMatrix(v);
  freeMatrix(A);
  free(displ);
  free(cols);

  close_app();
  return 0;
}
示例#22
0
文件: mpiio.c 项目: akva2/tma4280
int main(int argc, char** argv)
{
  int i, j, N, flag;
  Vector grid;
  Matrix b, e;
  double time, sum, h;
  int rank, size;
  int mpi_top_coords[2];
  int mpi_top_sizes[2];

  init_app(argc, argv, &rank, &size);

  N=atoi(argv[1]);

  // setup topology
  mpi_top_sizes[0] = mpi_top_sizes[1] = 0;
  MPI_Dims_create(size, 2, mpi_top_sizes);
  int periodic[2] = {0, 0};
  MPI_Comm comm;
  MPI_Cart_create(MPI_COMM_WORLD, 2, mpi_top_sizes, periodic, 0, &comm);
  MPI_Cart_coords(comm, rank, 2, mpi_top_coords);

  int* size1;
  int* displ1;
  int* size2;
  int* displ2;
  splitVector(N, mpi_top_sizes[0], &size1, &displ1);
  splitVector(N, mpi_top_sizes[1], &size2, &displ2);

  b = createMatrix(size1[mpi_top_coords[0]], size2[mpi_top_coords[1]]);
  for (j=0;j<b->cols;++j)
    for(i=0;i<b->rows;++i)
      b->data[j][i] = (j+displ2[mpi_top_coords[1]])*N+1+(i+displ1[mpi_top_coords[0]]);
  b->glob_rows = N;
  b->glob_cols = N;
  b->as_vec->comm = &comm;

  saveMatrixMPI(b, "meh.asc");

  freeMatrix(b);
  MPI_Comm_free(&comm);

  close_app();
  return 0;
}
示例#23
0
文件: main.c 项目: community-ssu/mafw
gint
main (gint   argc,
      gchar *argv[])
{
	setpriority (PRIO_PROCESS, 0, 10);
	mafw_log_init(NULL);
        if (!init_ui (&argc, &argv)) {
           return -2;
        }

        if (!init_app ()) {
           return -3;
        }

        gtk_main ();

        return 0;
}
示例#24
0
int PASCAL WinMain(
/*****************/
    HINSTANCE           inst,
    HINSTANCE           prev_inst,
    LPSTR               cmd_line,
    int                 show
) {
    MSG                 msg;

    while( *cmd_line == ' ' ) ++ cmd_line;
    if( stricmp( cmd_line, "auto" ) == 0 ) {
        Auto_run = 1;
    } else {
        Auto_run = 0;
    }
    if( !prev_inst ) {
        if( !init_app( inst ) ) {
            return( FALSE );
        }
    }

    /* Perform initializations that apply to a specific instance */

    three_d_init();
    define_room();
    if (!init_instance( inst, show ) ) {
        finish_room();
        three_d_fini();
        return( FALSE );
    }

    /* Acquire and dispatch messages until a WM_QUIT message is received. */

    while( GetMessage(&msg, NULL, 0, 0) ) {
        // if( TranslateAccelerators( Main_wnd, haccel, &msg ) ) continue;
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    finish_room();
    three_d_fini();

    return (msg.wParam);           /* Returns the value from PostQuitMessage */
}
示例#25
0
int main(int argc, char** argv)
{
  int rank, size;
  init_app(argc, argv, &rank, &size);

  if (argc < 3) {
    printf("need two parameters, the matrix size and the number of vectors\n");
    close_app();
    return 1;
  }
  int N=atoi(argv[1]);
  int K=atoi(argv[2]);

  int *displ, *cols;
  splitVector(K, size, &cols, &displ);

  Matrix A = createMatrixMPI(N, -1, N, N, &WorldComm);
  // identity matrix
  for (int i=0;i<A->cols;++i)
    A->data[i][i] = 1.0;
  
  Matrix v = createMatrixMPI(-1, K, N, K, &WorldComm);
  // fill with column number
  for (int i=0;i<v->rows;++i)
    for (int j=0;j<v->cols;++j)
      v->data[j][i] = j;

  double time = WallTime();
  double sum = dosum(A,v);

  if (rank == 0) {
    printf("sum: %f\n", sum);
    printf("elapsed: %f\n", WallTime()-time);
  }

  freeMatrix(v);
  freeMatrix(A);
  close_app();
  return 0;
}
示例#26
0
文件: smsg.c 项目: lojikil/smsg
static BOOL CALLBACK dialogfunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_INITDIALOG:
		init_app(hwndDlg, wParam, lParam);
		return TRUE;
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDOK:
			EndDialog(hwndDlg, 1);
			return 1;
		case IDCANCEL:
			EndDialog(hwndDlg, 0);
			return 1;
		}
		break;
	case WM_CLOSE:
		EndDialog(hwndDlg, 0);
		return TRUE;
	}
	return FALSE;
}
示例#27
0
int main(int argc, char **argv)
{
    init_app(argc, argv, "osd");

    event_init();

    char *hdd_cfg = cfg_getstr("HDD_CONF_FILENAME", "etc/hdd.conf");
    hdd_init(hdd_cfg);

    char *self_host = cfg_getstr("OSD2CLIENT_LISTEN_HOST", "*");
    int self_port = cfg_getint32("OSD2CLIENT_LISTEN_PORT", 9527);
    rpc_client_setup(self_host, self_port, MACHINE_OSD);

    struct evhttp *httpd;

    char *listen_host = cfg_getstr("OSD2CLIENT_LISTEN_HOST", "*");
    int port = cfg_getint32("OSD2CLIENT_LISTEN_PORT", 9527);

    httpd = evhttp_start(listen_host, port);
    if (httpd == NULL) {
        logging(LOG_ERROR, "start server error %m");
        exit(1);
    } else {
        printf("Start osd at %s:%d\n", listen_host, port);
    }
    evhttp_set_cb(httpd, "/shutdown", shutdown_handler, NULL);
    evhttp_set_gencb(httpd, gen_handler, NULL);


    struct timeval five_seconds = {2,0};
    struct event *update_clustermap_event= event_new(NULL, -1, EV_PERSIST, update_clustermap_from_cmgr_on_timer_cb, NULL);
    event_add(update_clustermap_event, &five_seconds);

    event_dispatch();

    evhttp_free(httpd);
    return 0;
}
int main(void)
{
	APP_RCV_STRUCT ars;
	
	init_powermesh();

	init_app_nvr_data();
	init_measure();
	init_app();

	while(1)
	{
		powermesh_event_proc();
		debug_uart_cmd_proc();

		ars.apdu = apdu;
		apdu_len = app_rcv(&ars);
		if(apdu_len)
		{
			my_printf("rcv comm_mode:%bx\r\n",ars.comm_mode);
			acp_rcv_proc(&ars);
		}
	}
}
示例#29
0
int main (int argc, char* argv[])
{
    t_window *window = NULL;

    if ((window = init_app()) == NULL)
        kill_app(window);

    int imgFlags = IMG_INIT_JPG|IMG_INIT_PNG|IMG_INIT_TIF; // Flags pour charger le support du JPG, PNG et TIF
     // Demarre SDL
    if ( SDL_Init(SDL_INIT_VIDEO) == -1 )
    {
        fprintf(stderr,"Erreur lors de l'initialisation de la SDL\n");
        return -1;
    }
    if ( IMG_Init(imgFlags) != imgFlags )
    {
        fprintf(stderr,"Erreur lors de l'initialisation de la SDL_image : '%s'\n",IMG_GetError());

        return -1;
    }
    run_app(window);
    kill_app(window);
    return 0;
}
示例#30
0
文件: main.c 项目: 4179e1/misc
int
main (int argc, char *argv[])
{
        TutorialTextEditor      *editor;

        /* allocate the memory needed by our TutorialTextEditor struct */
        editor = g_slice_new (TutorialTextEditor);

        /* initialize GTK+ libraries */
        gtk_init (&argc, &argv);

        if (init_app (editor) == FALSE) return 1; /* error loading UI */

        /* show the window */   
        gtk_widget_show (editor->window);

        /* enter GTK+ main loop */                   
        gtk_main ();

        /* free memory we allocated for TutorialTextEditor struct */
        g_slice_free (TutorialTextEditor, editor);
        
        return 0;
}