コード例 #1
0
int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_ExtendedTags *tags)
{
	int blk;
	int pg;
	

	CheckInit(dev);
	
	blk = chunkInNAND/32;
	pg = chunkInNAND%32;
	
	
	if(data)
	{
		memcpy(ramdisk.block[blk]->page[pg].data,data,512);
	}
	
	
	if(tags)
	{
		yaffs_PackedTags pt;
		yaffs_PackTags(&pt,tags);
		memcpy(&ramdisk.block[blk]->page[pg].data[512],&pt,sizeof(pt));
	}

	return YAFFS_OK;	

}
コード例 #2
0
int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Tags *tags)
{
	int blk;
	int pg;

	
	CheckInit(dev);
	
	blk = chunkInNAND/32;
	pg = chunkInNAND%32;
	
	
	if(data)
	{
		memcpy(data,ramdisk.block[blk]->page[pg].data,512);
	}
	
	
	if(tags)
	{
		yaffs_PackedTags pt;
		memcpy(&pt,&ramdisk.block[blk]->page[pg].data[512],sizeof(yaffs_PackedTags));
		yaffs_UnpackTags(tags,&pt);
	}

	return YAFFS_OK;
}
コード例 #3
0
/* Parsing results */
CAMLprim value camltk_splitlist (value v)
{
    int argc;
    char **argv;
    int result;
    char *utf;

    CheckInit();

    utf = caml_string_to_tcl(v);
    /* argv is allocated by Tcl, to be freed by us */
    result = Tcl_SplitList(cltclinterp,utf,&argc,&argv);
    switch(result) {
    case TCL_OK:
    {   value res = copy_string_list(argc,argv);
        Tcl_Free((char *)argv);    /* only one large block was allocated */
        /* argv points into utf: utf must be freed after argv are freed */
        stat_free( utf );
        return res;
    }
    case TCL_ERROR:
    default:
        stat_free( utf );
        tk_error(Tcl_GetStringResult(cltclinterp));
    }
}
コード例 #4
0
ファイル: cltkFile.c プロジェクト: retired-camels/ocaml
CAMLprim value camltk_add_file_output(value fd, value cbid)
{
  CheckInit();
  Tcl_CreateFileHandler(tcl_filehandle(fd), TCL_WRITABLE,
                       FileProc, (ClientData) (Long_val(cbid)));
  return Val_unit;
}
コード例 #5
0
void NetworkTable::Initialize() {
    NTSynchronized sync(STATIC_LOCK);
    CheckInit();
    printf("[NT] NetworkTable::Initialize()...\n");
    staticProvider = new NetworkTableProvider(*(staticNode = mode->CreateNode(ipAddress.c_str(), port, threadManager, streamFactory, streamDeleter, typeManager)));
    printf("[NT] ...NetworkTable::Initialize().\n");
}
コード例 #6
0
ファイル: cltkTimer.c プロジェクト: Chris00/ocaml
CAMLprim value camltk_add_timer(value milli, value cbid)
{
  CheckInit();
  /* look at tkEvent.c , Tk_Token is an int */
  return (Val_int(Tcl_CreateTimerHandler(Int_val(milli), TimerProc,
                                       (ClientData) (Long_val(cbid)))));
}
コード例 #7
0
ファイル: SDL_cdrom.c プロジェクト: Bananattack/verge3
SDL_CD *
SDL_CDOpen(int drive)
{
    struct SDL_CD *cdrom;

    if (!CheckInit(0, NULL)) {
        return (NULL);
    }
    if (drive >= SDL_numcds) {
        SDL_SetError("Invalid CD-ROM drive index");
        return (NULL);
    }
    cdrom = (SDL_CD *) SDL_malloc(sizeof(*cdrom));
    if (cdrom == NULL) {
        SDL_OutOfMemory();
        return (NULL);
    }
    SDL_memset(cdrom, 0, sizeof(*cdrom));
    cdrom->id = SDL_CDcaps.Open(drive);
    if (cdrom->id < 0) {
        SDL_free(cdrom);
        return (NULL);
    }
    default_cdrom = cdrom;
    return (cdrom);
}
コード例 #8
0
void
MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st,
                                     double ackSnr, WifiMode ackMode, double dataSnr)
{
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;

  station->m_isSampling = false;
  station->m_sampleRateSlower = false;

  CheckInit (station);
  if (!station->m_initialized)
    {
      return;
    }

  m_minstrelTable[station->m_txrate].numRateSuccess++;
  m_minstrelTable[station->m_txrate].numRateAttempt++;

  UpdateRetry (station);

  m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
  station->m_packetCount++;

  if (m_nsupported >= 1)
    {
      station->m_txrate = FindRate (station);
    }
}
コード例 #9
0
ファイル: cltkCaml.c プロジェクト: Chris00/ocaml
/* Callbacks are always of type _ -> unit, to simplify storage
 * But a callback can nevertheless return something (to Tcl) by
 * using the following. TCL_VOLATILE ensures that Tcl will make
 * a copy of the string
 */
CAMLprim value camltk_return (value v)
{
  CheckInit();

  Tcl_SetResult(cltclinterp, String_val(v), TCL_VOLATILE);
  return Val_unit;
}
コード例 #10
0
int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare)
{
    int nread;

    CheckInit(dev);



    if(data)
    {
        lseek(filedisk.handle,chunkInNAND * 528,SEEK_SET);
        nread = read(filedisk.handle,data,512);

        if(nread != 512) return YAFFS_FAIL;
    }

    if(spare)
    {
        lseek(filedisk.handle,chunkInNAND * 528 + 512,SEEK_SET);
        nread= read(filedisk.handle,spare,16);

        if(nread != 16) return YAFFS_FAIL;
    }


    return YAFFS_OK;

}
コード例 #11
0
int yflash_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare)
{
    int written;

    CheckInit(dev);



    if(data)
    {
        lseek(filedisk.handle,chunkInNAND * 528,SEEK_SET);
        written = write(filedisk.handle,data,512);

        if(written != 512) return YAFFS_FAIL;
    }

    if(spare)
    {
        lseek(filedisk.handle,chunkInNAND * 528 + 512,SEEK_SET);
        written = write(filedisk.handle,spare,16);

        if(written != 16) return YAFFS_FAIL;
    }


    return YAFFS_OK;

}
コード例 #12
0
ファイル: yaffs_fileem2k.c プロジェクト: Blackrose/yaffs2
static int yflash2_EraseBlock(struct yaffs_dev *dev, int block_no)
{
	int i;
	int h;

	CheckInit();

	if(block_no < 0 || block_no >= filedisk.nBlocks)
	{
		yaffs_trace(YAFFS_TRACE_ALWAYS,"Attempt to erase non-existant block %d",block_no);
		return YAFFS_FAIL;
	}
	else
	{

		u8 pg[PAGE_SIZE];
		int syz = PAGE_SIZE;
		int pos;

		memset(pg,0xff,syz);


		h = filedisk.handle[(block_no / ( BLOCKS_PER_HANDLE))];
		lseek(h,((block_no % BLOCKS_PER_HANDLE) * dev->param.chunks_per_block) * PAGE_SIZE,SEEK_SET);
		for(i = 0; i < dev->param.chunks_per_block; i++)
		{
			write(h,pg,PAGE_SIZE);
		}
		pos = lseek(h, 0,SEEK_CUR);

		return YAFFS_OK;
	}
}
コード例 #13
0
int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
{

    int i;

    CheckInit(dev);

    if(blockNumber < 0 || blockNumber >= filedisk.nBlocks)
    {
        T(YAFFS_TRACE_ALWAYS,("Attempt to erase non-existant block %d\n",blockNumber));
        return YAFFS_FAIL;
    }
    else
    {

        yflash_Page pg;

        memset(&pg,0xff,sizeof(yflash_Page));

        lseek(filedisk.handle, blockNumber * 32 * 528, SEEK_SET);

        for(i = 0; i < 32; i++)
        {
            write(filedisk.handle,&pg,528);
        }
        return YAFFS_OK;
    }

}
コード例 #14
0
CAMLprim value camltk_setvar(value var, value contents)
{
  char *s;
  char *stable_var = NULL;
  char *utf_contents;
  CheckInit();

  /* SetVar makes a copy of the contents. */
  /* In case we have write traces in OCaml, it's better to make sure that
     var doesn't move... */
  stable_var = string_to_c(var);
  utf_contents = caml_string_to_tcl(contents);
  s = (char *)Tcl_SetVar(cltclinterp,stable_var, utf_contents,
                         TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
  stat_free(stable_var);
  if( s == utf_contents ){
    tk_error("camltk_setvar: Tcl_SetVar returned strange result. Call the author of mlTk!");
  }
  stat_free(utf_contents);

  if (s == NULL)
    tk_error(Tcl_GetStringResult(cltclinterp));
  else 
    return(Val_unit);
}
コード例 #15
0
int SDL_CDNumDrives(void)
{
	if ( ! CheckInit(0, NULL) ) {
		return(-1);
	}
	return(SDL_numcds);
}
コード例 #16
0
/*
 * Calling Tcl from Caml
 *   this version works on an arbitrary Tcl command,
 *   and does parsing and substitution
 */
CAMLprim value camltk_tcl_eval(value str)
{
  int code;
  char *cmd = NULL;

  CheckInit();

  /* Tcl_Eval may write to its argument, so we take a copy
   * If the evaluation raises a Caml exception, we have a space
   * leak
   */
  Tcl_ResetResult(cltclinterp);
  cmd = caml_string_to_tcl(str);
  code = Tcl_Eval(cltclinterp, cmd);
  stat_free(cmd);

  switch (code) {
  case TCL_OK:
    return tcl_string_to_caml(Tcl_GetStringResult(cltclinterp));
  case TCL_ERROR:
    tk_error(Tcl_GetStringResult(cltclinterp));
  default:  /* TCL_BREAK, TCL_CONTINUE, TCL_RETURN */
    tk_error("bad tcl result");
  }
}
コード例 #17
0
ファイル: cltkFile.c プロジェクト: retired-camels/ocaml
CAMLprim value camltk_add_file_output(value fd, value cbid)
{
  CheckInit();
  Tcl_CreateChannelHandler(tcl_channel(fd, TCL_WRITABLE),
                           TCL_WRITABLE,
                           FileProc, (ClientData) (Int_val(cbid)));
  return Val_unit;
}
コード例 #18
0
ファイル: yaffs_fileem2k.c プロジェクト: Blackrose/yaffs2
static int yflash2_Initialise(struct yaffs_dev *dev)
{
	(void) dev;

	CheckInit();

	return YAFFS_OK;
}
コード例 #19
0
int SDL_CDEject(SDL_CD *cdrom)
{
	
	if ( ! CheckInit(1, &cdrom) ) {
		return(CD_ERROR);
	}
	return(SDL_CDcaps.Eject(cdrom));
}
コード例 #20
0
int SDL_CDEject(SDL_CD *cdrom)
{
	/* Check if the CD-ROM subsystem has been initialized */
	if ( ! CheckInit(1, &cdrom) ) {
		return(CD_ERROR);
	}
	return(SDL_CDcaps.Eject(cdrom));
}
コード例 #21
0
ファイル: GUI_X_uCOS.c プロジェクト: Seok-Jung/STM32F207
int GUI_X_GetKey(void)
{
    int r;
    r = KeyPressed;
    CheckInit();
    KeyPressed = 0;
    return (r);
}
コード例 #22
0
int SDL_CDPlay(SDL_CD *cdrom, int sframe, int length)
{
	/* Check if the CD-ROM subsystem has been initialized */
	if ( ! CheckInit(1, &cdrom) ) {
		return(CD_ERROR);
	}

	return(SDL_CDcaps.Play(cdrom, sframe, length));
}
コード例 #23
0
int SDL_CDPlay(SDL_CD *cdrom, int sframe, int length)
{
	
	if ( ! CheckInit(1, &cdrom) ) {
		return(CD_ERROR);
	}

	return(SDL_CDcaps.Play(cdrom, sframe, length));
}
コード例 #24
0
ファイル: cltkEvent.c プロジェクト: puppeh/ocaml-sh4
CAMLprim value camltk_dooneevent(value flags)
{
  int ret;

  CheckInit();

  ret = Tk_DoOneEvent(convert_flag_list(flags, event_flag_table));
  return Val_int(ret);
}
コード例 #25
0
void SDL_CDClose(SDL_CD *cdrom)
{
	
	if ( ! CheckInit(1, &cdrom) ) {
		return;
	}
	SDL_CDcaps.Close(cdrom);
	SDL_free(cdrom);
	default_cdrom = NULL;
}
コード例 #26
0
ファイル: binder.cpp プロジェクト: ArildF/masters
MethodTable *Binder::GetClass(BinderClassID id)
{
    THROWSCOMPLUSEXCEPTION();

    MethodTable *pMT = FetchClass(id);

    CheckInit(pMT);

    return pMT;
}
コード例 #27
0
ファイル: binder.cpp プロジェクト: ArildF/masters
MethodDesc *Binder::GetMethod(BinderMethodID id)
{
    THROWSCOMPLUSEXCEPTION();

    MethodDesc *pMD = FetchMethod(id);

    CheckInit(pMD->GetMethodTable());

    return pMD;
}
コード例 #28
0
void SDL_CDClose(SDL_CD *cdrom)
{
	/* Check if the CD-ROM subsystem has been initialized */
	if ( ! CheckInit(1, &cdrom) ) {
		return;
	}
	SDL_CDcaps.Close(cdrom);
	free(cdrom);
	default_cdrom = NULL;
}
コード例 #29
0
ファイル: binder.cpp プロジェクト: ArildF/masters
FieldDesc *Binder::GetField(BinderFieldID id)
{
    THROWSCOMPLUSEXCEPTION();

    FieldDesc *pFD = FetchField(id);

    CheckInit(pFD->GetMethodTableOfEnclosingClass());

    return pFD;
}
コード例 #30
0
static URET femu_initDevice(uffs_Device *dev)
{
	uffs_Perror(UFFS_ERR_NORMAL,  "femu device init.");

	dev->ops = &emu_flash_ops;							/* EMU device operations */

	CheckInit(dev);

	return U_SUCC;
}