Beispiel #1
0
void reinit_vmb_boot_device() {

    int initfn;

    if (bqo->unit_init) {

        initfn = rpb->iovec + bqo->unit_init;
        if (rpb->devtyp == BDEV_UDA || rpb->devtyp == BDEV_TK) {
            /*
             * This reset do not seem to be done in the
             * ROM routines, so we have to do it manually.
             */
            csr = (struct udadevice *)rpb->csrphy;
            csr->udaip = 0;
            /*
             * MP_STEP1 = 0x0800, bits in UDA status register
             * during initialisation. step 1 has started.
             */
            while ((csr->udasa & 0x0800) == 0)
                ;
        }

        /*
         * AP (R12) have a pointer to the VMB argument list,
         * wanted by bqo->unit_init.
         */
        unit_init(initfn, rpb, bootregs[12]);

    }
}
Beispiel #2
0
Datei: wm.c Projekt: oracc/oracc
int
main (int argc, char **argv)
{
#define _MAX_ID 2048
  char idbuf[_MAX_ID], *id;
  options(argc, argv, "i:I:klo:p:r:u");

  if (!project)
    {
      fprintf(stderr,"wm: must give -p PROJECT on command line\n");
      exit(1);
    }

  if (input)
    infp = xfopen(input, "r");
  else
    infp = stdin;

  if (output)
    outfp = xfopen(output, "w");
  else
    outfp = stdout;

  if (wm_type == KU_UNIT)
    {
      unit_init(project);
      if (id_arg)
	unit_controller(id_arg);
      else
	while (NULL != (id = fgets(idbuf,_MAX_ID,infp)))
	  unit_controller(no_newline(id));
      unit_term();
    }
  else if (wm_type == KU_KWIC)
    {
      kwic_init(project);
      if (id_arg)
	kwic_controller(id_arg);
      else
	while (NULL != (id = fgets(idbuf,_MAX_ID,infp)))
	  kwic_controller(no_newline(id));
      kwic_term();
    }
  else if (wm_type == KU_LINE)
    {
      if (id_arg)
	line_controller(id_arg);
      else
	while (NULL != (id = fgets(idbuf,_MAX_ID,infp)))
	  line_controller(no_newline(id));      
    }
  else
    {
      fprintf(stderr, "wm: must give -k, -l or -u (kwic or unit) on command line\n");
      exit(1);
    }
  return 0;
}
Beispiel #3
0
long er_iodb_vmsinit(long dev)
{
#if 0
    struct _ucb * ucb=&er$ucb;
    struct _ddb * ddb=&er$ddb;
    struct _crb * crb=&er$crb;
#endif
    struct _ucb * ucb=kmalloc(sizeof(struct _ucbnidef),GFP_KERNEL);
    struct _ddb * ddb=kmalloc(sizeof(struct _ddb),GFP_KERNEL);
    struct _crb * crb=kmalloc(sizeof(struct _crb),GFP_KERNEL);
    unsigned long idb=0,orb=0;

    memset(ucb,0,sizeof(struct _ucbnidef));
    memset(ddb,0,sizeof(struct _ddb));
    memset(crb,0,sizeof(struct _crb));

#if 0
    init_ddb(&er$ddb,&er$ddt,&er$ucb,"dqa");
    init_ucb(&er$ucb, &er$ddb, &er$ddt, &er$crb);
    init_crb(&er$crb);
#endif

    ucb -> ucb$w_size = sizeof(struct _ucbnidef); // temp placed
    ((struct _ucbnidef *)ucb)->ucb$l_extra_l_1=dev;

    init_ddb(ddb,&er$ddt,ucb,"era");
    init_ucb(ucb, ddb, &er$ddt, crb);
    init_crb(crb);

//  ioc_std$clone_ucb(&er$ucb,&ucb);
    er$init_tables();
    er$struc_init (crb, ddb, idb, orb, ucb);
    er$struc_reinit (crb, ddb, idb, orb, ucb);
    er$unit_init (idb, ucb);

    insertdevlist(ddb);

    return ddb;

}
Beispiel #4
0
long ft_iodb_vmsinit(void)
{
#if 0
    struct _ucb * ucb=&ft$ucb;
    struct _ddb * ddb=&ft$ddb;
    struct _crb * crb=&ft$crb;
#endif
    struct _ucb * ucb=kmalloc(sizeof(struct _ft_ucb),GFP_KERNEL);
    struct _ddb * ddb=kmalloc(sizeof(struct _ddb),GFP_KERNEL);
    struct _crb * crb=kmalloc(sizeof(struct _crb),GFP_KERNEL);
    unsigned long idb=0,orb=0;

    memset(ucb,0,sizeof(struct _ft_ucb));
    memset(ddb,0,sizeof(struct _ddb));
    memset(crb,0,sizeof(struct _crb));

#if 0
    init_ddb(&ft$ddb,&ft$ddt,&ft$ucb,"dqa");
    init_ucb(&ft$ucb, &ft$ddb, &ft$ddt, &ft$crb);
    init_crb(&ft$crb);
#endif

    ucb -> ucb$w_size = sizeof(struct _ft_ucb); // temp placed

    init_ddb(ddb,&ft$ddt,ucb,"fta");
    init_ucb(ucb, ddb, &ft$ddt, crb);
    init_crb(crb);

//  ioc_std$clone_ucb(&ft$ucb,&ucb);
    ft$init_tables();
    ft$struc_init (crb, ddb, idb, orb, ucb);
    ft$struc_reinit (crb, ddb, idb, orb, ucb);
    ft$unit_init (idb, ucb);

    insertdevlist(ddb);

    return ddb;

}
Beispiel #5
0
long kbd_iodb_vmsinit(void) {
#if 0
  struct _ucb * ucb=&kb$ucb;
  struct _ddb * ddb=&kb$ddb;
  struct _crb * crb=&kb$crb;
#endif 
  struct _ucb * ucb=kmalloc(sizeof(struct _ucb),GFP_KERNEL);
  struct _ddb * ddb=kmalloc(sizeof(struct _ddb),GFP_KERNEL);
  struct _crb * crb=kmalloc(sizeof(struct _crb),GFP_KERNEL);
  unsigned long idb=0,orb=0;

  bzero(ucb,sizeof(struct _ucb));
  bzero(ddb,sizeof(struct _ddb));
  bzero(crb,sizeof(struct _crb));

#if 0
  init_ddb(&kb$ddb,&kb$ddt,&kb$ucb,"dqa");
  init_ucb(&kb$ucb, &kb$ddb, &kb$ddt, &kb$crb);
  init_crb(&kb$crb);
#endif

  init_ddb(ddb,&kb$ddt,ucb,"opa");
  init_ucb(ucb, ddb, &kb$ddt, crb);
  init_crb(crb);

//  ioc_std$clone_ucb(&kb$ucb,&ucb);
  kb$init_tables();
  kb$struc_init (crb, ddb, idb, orb, ucb);
  kb$struc_reinit (crb, ddb, idb, orb, ucb);
  kb$unit_init (idb, ucb);

  insertdevlist(ddb);

  return ddb;

}
Beispiel #6
0
Datei: main.c Projekt: odrevet/GE
int main(int argc, char** argv)
{
    SDL_Surface *screen=NULL;

    srand(time(NULL));

    sdl_init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
    sound_init();
    font_init();

    #ifdef GEKKO
	if (!fatInitDefault()) {
		printf("fatInitDefault failure: terminating\n");
		exit(EXIT_FAILURE);
	}
    freopen("sd:/apps/bomberguy/out.txt", "w", stdout);
    freopen("sd:/apps/bomberguy/err.txt", "w", stderr);
    #endif

    // make sure SDL cleans up before exit
    atexit(SDL_Quit);
    SDL_ShowCursor(SDL_DISABLE);

    SDL_WM_SetCaption("bomberguy", NULL);

    // create a new window
    screen = sdl_set_video(SCREEN_WIDTH, SCREEN_HEIGHT, 16, SDL_HWSURFACE);

    if ( !screen )
    {
        fprintf(stderr, "Unable to set video: %s\n", SDL_GetError());
        exit(EXIT_FAILURE);
    }

    backbuffer = SDL_DisplayFormat(screen);

    //load ressources
    ressource* res_bomb = malloc(sizeof(ressource));
    image* img_bomb = image_load("./res/bomb.png");
    res_bomb->name = strdup("bomb");
    res_bomb->data = img_bomb;
    image_set_transp_color(img_bomb, 255, 0, 255);
    images = res_add(images, res_bomb);

    ressource* res_flame = malloc(sizeof(ressource));
    image* img_flame = image_load("./res/flame.png");
    image_set_transp_color(img_flame, 255, 0, 255);
    res_flame->name = strdup("flame");
    res_flame->data = img_flame;
    images = res_add(images, res_flame);

    ressource* res_block = malloc(sizeof(ressource));
    image* img_block = image_load("./res/block_classic.png");
    image_set_transp_color(img_block, 255, 0, 255);
    res_block->name = strdup("block");
    res_block->data = img_block;
    images = res_add(images, res_block);

    //Some game default parameters
    g_game.block_fill = 0.65;
    g_game.time = 180;
    g_game.unit_nb = 2;
    unit_init(g_game.v_unit, UNIT_MAX);

    SDL_EnableKeyRepeat(10,10);

    state_main_menu(screen);

    SDL_Quit();
    return EXIT_SUCCESS;
}
Beispiel #7
0
Datei: game.c Projekt: odrevet/GE
game* game_load(char* file)
{
  game* p_game = malloc(sizeof(game));

  FILE *fp = NULL;
  mxml_node_t *mxml_xml = NULL;
  mxml_node_t *node = NULL;		//parse throught the xml
  mxml_node_t *node_i = NULL;

  fp = fopen(file, "r");
  mxml_xml = mxmlLoadFile(NULL, fp, MXML_OPAQUE_CALLBACK);
  mxml_node_t *node_root = mxmlWalkNext(mxml_xml, mxml_xml, MXML_DESCEND);		//state (hanchor node)

  //UNIT
  mxml_node_t* node_unit = mxmlFindElement(node_root, mxml_xml, "unit", NULL, NULL, MXML_DESCEND);
  p_game->p_unit = unit_load_xml(mxmlElementGetAttr(node_unit, "src"));
  unit_init(p_game->p_unit);
  mxml_node_t* node_location = mxmlFindElement(node_unit, mxml_xml, "location", NULL, NULL, MXML_DESCEND);
  p_game->p_unit->p_sprite->x = atoi(mxmlElementGetAttr(node_location, "x"));
  p_game->p_unit->p_sprite->y = atoi(mxmlElementGetAttr(node_location, "y"));
  node = mxmlFindElement(node_unit, mxml_xml, "HP", NULL, NULL, MXML_DESCEND);
  node = mxmlWalkNext(node, mxml_xml, MXML_DESCEND);			//text
  if(node)p_game->p_unit->HP = atoi(node->value.opaque);
  node = mxmlFindElement(node_unit, mxml_xml, "MP", NULL, NULL, MXML_DESCEND);
  node = mxmlWalkNext(node, mxml_xml, MXML_DESCEND);			//text
  if(node)p_game->p_unit->MP = atoi(node->value.opaque);
  node = mxmlFindElement(node_unit, mxml_xml, "XP", NULL, NULL, MXML_DESCEND);
  node = mxmlWalkNext(node, mxml_xml, MXML_DESCEND);			//text
  if(node)p_game->p_unit->XP = atoi(node->value.opaque);
  node = mxmlFindElement(node_unit, mxml_xml, "gold", NULL, NULL, MXML_DESCEND);
  node = mxmlWalkNext(node, mxml_xml, MXML_DESCEND);			//text
  if(node)p_game->p_unit->gold = atoi(node->value.opaque);


  p_game->name = (char*)strdup("Legend of bozo");

  if(mxmlElementGetAttr(node_location, "file")){
    char* name = strdup(strrchr (mxmlElementGetAttr(node_location, "file"), '/') + 1);
    p_game->context = calloc(strlen(name) + 1, sizeof(char));
    strcpy(p_game->context, name);
    free(name);name=NULL;

    p_game->nb_maps = map_load_xml_all(mxmlElementGetAttr(node_location, "file"), &p_game->p_map);
    p_game->cur_map = map_get_index(mxmlElementGetAttr(node_location, "name"), p_game->p_map, p_game->nb_maps);

  }else{
    printf("The node location do not have a file attribut, in the xml file %s\n", file);
    exit(EXIT_FAILURE);
  }


  //load ennemies
  char* ennemie_path = calloc(strlen("./res/entities/ennemies/") + strlen(p_game->context) + 1, sizeof(char));
  strcpy(ennemie_path, "./res/entities/ennemies/");
  strcat(ennemie_path, p_game->context);
  p_game->ennemie_nb = ennemie_load_xml_name(ennemie_path, mxmlElementGetAttr(node_location, "name"), &p_game->p_ennemie);
  free(ennemie_path);ennemie_path=NULL;

  //load NPCs
  char* NPC_path = calloc(strlen("./res/entities/NPCs/") + strlen(p_game->context) + 1, sizeof(char));
  strcpy(NPC_path, "./res/entities/NPCs/");
  strcat(NPC_path, p_game->context);
  p_game->NPC_nb = NPC_load_xml_name(NPC_path, mxmlElementGetAttr(node_location, "name"), &p_game->p_NPC);
  free(NPC_path);NPC_path=NULL;

  p_game->sound_on = 1;

  //VARS
  p_game->vars=NULL;
  mxml_node_t* node_vars = mxmlFindElement(node_root, mxml_xml, "vars", NULL, NULL, MXML_DESCEND);
  for (node_i = mxmlFindElement(node_vars, mxml_xml, "var", NULL, NULL, MXML_DESCEND);
       node_i != NULL;
       node_i = mxmlFindElement(node_i, mxml_xml, "var", NULL, NULL, MXML_DESCEND))
    {
      var* p_var = malloc(sizeof(var));
      p_var->name = (char*)strdup(mxmlElementGetAttr(node_i, "name"));
      p_var->value = (char*)strdup(mxmlElementGetAttr(node_i, "value"));
      p_game->vars = linked_list_push_front(p_game->vars , p_var);
    }

  mxmlDelete(node_i);
  mxmlDelete(node);
  mxmlDelete(mxml_xml);
  fclose(fp);

  return p_game;
}
Beispiel #8
0
/** ============================================================================
 *  @func   pool_notify_Execute
 *
 *  @desc   This function implements the execute phase for this application.
 *
 *  @modif  None
 *  ============================================================================
 */
NORMAL_API
DSP_STATUS
pool_notify_Execute (IN Uint32 numIterations, Uint8 processorId, IN Char8 * strFeatures, IN Char8 * strFrames)
{
    DSP_STATUS  status    = DSP_SOK ;

    long long start;
	
	// Variables for klt
    unsigned char *img1, *img2;
    char fnamein[100], fnameout[100];
    KLT_TrackingContext tc;
    KLT_FeatureList fl;
    KLT_FeatureTable ft;
    int ncols, nrows;
    int i;
    int nFeatures;
    int nFrames;


#if defined(DSP)
    unsigned char *buf_dsp;
#endif

#ifdef DEBUG
    printf ("Entered pool_notify_Execute ()\n") ;
#endif

    nFeatures = atoi(strFeatures);
    nFrames = atoi(strFrames);


    unit_init();

    start = get_usec();

	tc = KLTCreateTrackingContext();
    fl = KLTCreateFeatureList(nFeatures);
    ft = KLTCreateFeatureTable(nFrames, nFeatures);
    tc->sequentialMode = TRUE;
    tc->writeInternalImages = FALSE;
    tc->affineConsistencyCheck = -1;  /* set this to 2 to turn on affine consistency check */

    //startTimer(&appTimer);
    img1 = pgmReadFile("img0.pgm", NULL, &ncols, &nrows);
    img2 = (unsigned char *) malloc(ncols*nrows*sizeof(unsigned char));

    KLTSelectGoodFeatures(tc, img1, ncols, nrows, fl);
    KLTStoreFeatureList(fl, ft, 0);
    KLTWriteFeatureListToPPM(fl, img1, ncols, nrows, "feat0.ppm");

    for (i = 1 ; i < nFrames ; i++)
    {
        sprintf(fnamein, "img%d.pgm", i);
        pgmReadFile(fnamein, img2, &ncols, &nrows);
        KLTTrackFeatures(tc, img1, img2, ncols, nrows, fl);

        #ifdef REPLACE
        KLTReplaceLostFeatures(tc, img2, ncols, nrows, fl);
        #endif

        KLTStoreFeatureList(fl, ft, i);
        sprintf(fnameout, "feat%d.ppm", i);
        KLTWriteFeatureListToPPM(fl, img2, ncols, nrows, fnameout);
    }
    //stopTimer(&appTimer);
    //printTime(appTimer);
    //printf("Frames per second = %4.2f\n", nFrames / getTime(appTimer) *1000 );

    KLTWriteFeatureTable(ft, "features.txt", "%5.1f");
    KLTWriteFeatureTable(ft, "features.ft", NULL);

    KLTFreeFeatureTable(ft);
    KLTFreeFeatureList(fl);
    KLTFreeTrackingContext(tc);
    free(img1);
    free(img2);




#if !defined(DSP)
    printf(" Result is %d \n", sum_dsp(pool_notify_DataBuf,pool_notify_BufferSize));
#endif

#if defined(DSP)
    POOL_writeback (POOL_makePoolId(processorId, SAMPLE_POOL_ID),
                    pool_notify_DataBuf,
                    pool_notify_BufferSize);

    POOL_translateAddr ( POOL_makePoolId(processorId, SAMPLE_POOL_ID),
                         (void*)&buf_dsp,
                         AddrType_Dsp,
                         (Void *) pool_notify_DataBuf,
                         AddrType_Usr) ;
    NOTIFY_notify (processorId,pool_notify_IPS_ID,pool_notify_IPS_EVENTNO,1);

    sem_wait(&sem);
#endif

    printf("Sum execution time %lld us.\n", get_usec()-start);

    return status ;
}
Beispiel #9
0
void apic_init(void) {
	unit_init();
}
Beispiel #10
0
int main()
{
	unit_init(44100,2,44100,2,3);
}
Beispiel #11
0
jint Java_com_thinpad_audiotransfer_AudiotransferActivity_unitInit(JNIEnv *env, jobject thiz, jint play_rate, jint play_channels, jint rec_rate, jint rec_channels, jint flags)
{
 	return unit_init(play_rate, play_channels, rec_rate, rec_channels, flags);
}