亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tfs.c

?? flash文件系統實現
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* tfs.c: *  Tiny File System *  TFS supports the ability to store/access files in flash.  The TFS *  functions provide a command at the monitor's user interface (the *  "tfs" command) as well as a library of functions that are available to *  the monitor/application code on this target (TFS api). * *  The code that supports TFS in the MicroMonitor package spans across  *  several files.  This is done so that various pieces of TFS can optionally *  be compiled in or out (using INCLUDE_XXX macros in config.h) of the *  monitor package... * *  tfs.c: *      Core TFS code that cannot be optionally omitted without eliminating *      the TFS facility from the monitor. *   *  tfsapi.c: *      This file contains the code that supports the application's ability *      to use the TFS api.  Since some of the api is used by the monitor *      itself, not all of the api-specific code is there, some of it is *      in tfs.c. * *  tfscleanX.c: *      TFS can be configured with one of several different flash defrag *      mechanisms.  Currently, tfsclean[123].c are available. * *  tfscli.c: *      If you don't need the "tfs" command in your command line interface, *      then the code in this file can be omitted. * *  tfsloader.c: *      TFS can support COFF, ELF or A.OUT binary file formats.  The code *      to load each of these formats from flash to RAM is here. * *  tfslog.c: *      If there is a need to log flash interaction to a file, then this *      file contains code to support that. * * *  NOTES: *  * Dealing with multiple task access: *    Since the monitor is inherently a single threaded program *    potentially being used in a multi-tasking environment, the monitor's *    access functions (API) must be provided with a lock/unlock  *    wrapper that will guarantee sequential access to all of the monitor  *    facilities.  Refer to monlib.c to see this implementation.  This *    provides the protection needed by TFS to keep multiple "mon_" *    functions from being executed by different tasks. *    Note that originally this was supported with tfsctrl(TFS_MUTEX ) and *    it only protected the tfs API functions.  This turned out to be *    insufficient because it did not prevent other tasks from calling *    other non-tfs functions in the monitor while tfs access (and *    potentially, flash update) was in progress.  This meant that a flash *    update could be in progress and some other task could call mon_getenv() *    (for example).  This could screw up the flash update because *    mon_getenv() might be fetched out of the same flash device that *    the TFS operation is being performed on. * *  * Dealing with cache coherency: *    I believe the only concern here is that Icache must be invalidated *    and Dcache must be flushed whenever TFS does a memory copy that may *    ultimately be executable code.  This is handled at the end of the *    tfsmemcpy function by calling flushDcache() and invalidateIcache(). *    It is the application's responsibility to give the monitor the *    appropriate functions (see assigncachefuncs()) if necessary. * *  * Configuring a device to run as TFS memory: *    Assuming you are using power-safe cleanup... *    TFS expects that on any given device used for storage of files, the *    device is broken up into some number of sectors with the last sector *    being the largest and used as the spare sector for defragmentation. *    All other sector sizes must be smaller than the SPARE sector and the *    sector just prior to the spare is used for defragmentation state *    overhead.  This sector should be large enough to allow the overhead  *    space to grow down from the top without filling the sector.  For most *    flash devices, these two sectors (spare and overhead) are usually the *    same size and are large.  For FlashRam, the device should be configured *    so that these two sectors are large.  The spare sector will never be *    allowed to contain any file information (because it is 100% dedicated to *    the defragmentation process) and the sector next to this can have files *    in it, but the overhead space is also in this sector. * *  * Testing TFS: *    There are three files dedicated to testing the file system.  Two of them *    (tfstestscript & tfstestscript1) are scripts that are put into the *    file system and run.  The third file (tfstest.c) is a piece of code  *    that can be built into a small application that runs out of TFS to test *    all of the API functionality. *    - tfstestscript: *      This script is used to simply bang on normal defragmentation.  It *      builds files with sizes and names based on the content of memory *      starting at $APPRAMBASE.  Changing the content of memory starting at *      $APPRAMBASE will change the characteristics of this test so it is *      somewhat random.  It is not 100% generic, but can be used as a *      base for testing TFS on various systems. *    - tfstestscript1: *      This script is used to bang on the power-safe defragmentation of *      TFS.  It simulates power hits that might occur during defragmentation. *      This script assumes that the monitor has been built with the *      DEFRAG_TEST_ENABLED flag set. *    - tfstest.c: *      This code can be built into a small application that will thoroughly *      exercise the TFS API.  This file can also be used as a reference for *      some examples of TFS api usage. * *  General notice: *  This code is part of a boot-monitor package developed as a generic base *  platform for embedded system designs.  As such, it is likely to be *  distributed to various projects beyond the control of the original *  author.  Please notify the author of any enhancements made or bugs found *  so that all may benefit from the changes.  In addition, notification back *  to the author will allow the new user to pick up changes that may have *  been made by other users after this version of the code was distributed. * *  Note1: the majority of this code was edited with 4-space tabs. *  Note2: as more and more contributions are accepted, the term "author" *         is becoming a mis-representation of credit. * *  Original author:    Ed Sutter *  Email:              esutter@lucent.com *  Phone:              908-582-2351 */#include "config.h"//#include "cpu.h"#include "stddefs.h"#include "genlib.h"#include "tfs.h"#include "tfsprivate.h"#include "tfsdev.h"#include "flash.h"#include "frmwrk.h"//#include "cli.h"#if INCLUDE_TFSchar    *(*tfsGetAtime)(long,char *,int);long    (*tfsGetLtime)(void);int     (*tfsDocommand)(char *,int);TDEV    tfsDeviceTbl[TFSDEVTOT];TFILE   **tfsAlist;struct  tfsdat tfsSlots[TFS_MAXOPEN];long    tfsTrace;int     TfsCleanEnable;static long     tfsFmodCount;static int      tfsAlistSize, tfsOldDelFlagCheckActive;#define APPLICATION_RAMSTART SDRAM_SADDR/* tfsflgtbl & tfserrtbl: *  Tables that establish an easy lookup mechanism to convert from *  bitfield to string or character. *  Note that TFS_ULVL0 is commented out.  I leave it in here as a place *  holder (comment), but it actually is not needed becasue ulvl_0 is the *  default if no other ulvl is specified. */struct tfsflg tfsflgtbl[] = {    { TFS_BRUN,         'b',    "run_at_boot",          TFS_BRUN },    { TFS_QRYBRUN,      'B',    "qry_run_at_boot",      TFS_QRYBRUN },    { TFS_EXEC,         'e',    "executable",           TFS_EXEC },    { TFS_SYMLINK,      'l',    "symbolic link",        TFS_SYMLINK },    { TFS_EBIN,         'E',    TFS_EBIN_NAME,          TFS_EBIN },    { TFS_IPMOD,        'i',    "inplace_modifiable",   TFS_IPMOD },    { TFS_UNREAD,       'u',    "ulvl_unreadable",      TFS_UNREAD },/*  { TFS_ULVL0,        '0',    "ulvl_0",               TFS_ULVLMSK }, */    { TFS_ULVL1,        '1',    "ulvl_1",               TFS_ULVLMSK },    { TFS_ULVL2,        '2',    "ulvl_2",               TFS_ULVLMSK },    { TFS_ULVL3,        '3',    "ulvl_3",               TFS_ULVLMSK },    { TFS_CPRS,         'c',    "compressed",           TFS_CPRS },    { 0, 0, 0, 0 }};static struct tfserr tfserrtbl[] = {    { TFS_OKAY,             "no error" },    { TFSERR_NOFILE,        "file not found" },    { TFSERR_NOSLOT,        "max fps opened" },    { TFSERR_EOF,           "end of file" },    { TFSERR_BADARG,        "bad argument" },    { TFSERR_NOTEXEC,       "not executable" },    { TFSERR_BADCRC,        "bad crc" },    { TFSERR_FILEEXISTS,    "file already exists" },    { TFSERR_FLASHFAILURE,  "flash operation failed" },    { TFSERR_WRITEMAX,      "max write count exceeded" },    { TFSERR_RDONLY,        "file is read-only" },    { TFSERR_BADFD,         "invalid descriptor" },    { TFSERR_BADHDR,        "bad binary executable header" },    { TFSERR_CORRUPT,       "corrupt file" },    { TFSERR_MEMFAIL,       "memory failure" },    { TFSERR_NOTIPMOD,      "file is not in-place-modifiable" },    { TFSERR_FLASHFULL,     "out of flash space" },    { TFSERR_USERDENIED,    "user level access denied" },    { TFSERR_NAMETOOBIG,    "name or info field too big" },    { TFSERR_FILEINUSE,     "file in use" },    { TFSERR_SCRIPTINSUB,   "can't put script in subroutine" },    { TFSERR_NOTAVAILABLE,  "tfs facility not available" },    { TFSERR_BADFLAG,       "bad flag" },    { TFSERR_CLEANOFF,      "defragmentation is disabled" },    { TFSERR_FLAKEYSOURCE,  "dynamic source data" },    { 0,0 }};/* getAppRamStart(): *  First looks for the content of APPRAMBASE shell variable; *  if present, that string is converted to a long and returned, *  else the value of APPLICATION_RAMSTART is returned. */ulonggetAppRamStart(void){    char    *apprambase;    ulong   value;    apprambase = getenv("APPRAMBASE");    if (apprambase)        value = strtoul(apprambase,0,0);    else        value = APPLICATION_RAMSTART;    return(value);}/* dummyAtime() & dummyLtime(): *  These two functions are loaded into the function pointers as defaults *  for the time-retrieval stuff used in TFS. */static char *dummyAtime(long tval,char *buf,int buflen){/*  strcpy(buf,"Fri Sep 13 00:00:00 1986"); */    *buf = 0;    return(buf);}static longdummyLtime(void){    return(TIME_UNDEFINED);}/* getdfsdev(): *  Input is a file pointer; based on that pointer return the appropriate *  device header pointer.  If error, just return 0. *  A "device" in TFS is some block of some type of memory that is assumed *  to be contiguous space that can be configured as a block of sectors (to *  look like flash).  For most systems, there is only one (the flash);  *  other systems may have battery-backed RAM, etc... *  Note that this is not fully implemented. */static TDEV *gettfsdev(TFILE *fp){    TDEV *tdp;    for(tdp=tfsDeviceTbl;tdp->start != TFSEOT;tdp++) {        if ((fp >= (TFILE *)tdp->start) &&            (fp < (TFILE *)tdp->end))            return(tdp);    }    return(0);}TDEV *gettfsdev_fromprefix(char * prefix, int verbose){    TDEV *tdp;    for(tdp=tfsDeviceTbl;tdp->start != TFSEOT;tdp++) {        if (!strcmp(prefix,tdp->prefix))            return(tdp);    }    if (verbose)        printf("Bad device prefix: %s\n",prefix);    return(0);}/* tfsflasherase(), tfsflasheraseall() & tfsflashwrite(): *  Wrappers for corresponding flash operations.  The wrappers are used *  to provide one place for the incrmentation of tfsFmodCount. */inttfsflasheraseall(TDEV *tdp){    int snum, last;    if (tfsTrace > 2)        printf("     tfsflasheraseall(%s)\n",tdp->prefix);    tfsFmodCount++;    /* Erase the sectors within the device that are used for file store... */    if (addrtosector((uchar *)tdp->start,&snum,0,0) < 0)        return(TFSERR_MEMFAIL);    last = snum + tdp->sectorcount;    while(snum < last) {        if (AppFlashErase(snum++) == -1)            return(TFSERR_MEMFAIL);    }    /* Erase the spare (if there is one)...     * (if this system is configured with tfsclean2.c, then     * there is no need for a spare sector).     */    if (tdp->spare) {        if (addrtosector((uchar *)tdp->spare,&snum,0,0) < 0)            return(TFSERR_MEMFAIL);        if (AppFlashErase(snum) == -1)            return(TFSERR_MEMFAIL);    }    return(TFS_OKAY);}inttfsflasherase(int snum){    if (tfsTrace > 2)        printf("     tfsflasherase(%d)\n",snum);    tfsFmodCount++;    return(AppFlashErase(snum));}inttfsflashwrite(ulong *dest,ulong *src,long bytecnt){    if (tfsTrace > 2)        printf("     tfsflashwrite(0x%lx,0x%lx,%ld)\n",            (ulong)dest,(ulong)src,bytecnt);    if (bytecnt < 0)        return(-1);        tfsFmodCount++;    return(AppFlashWrite(dest,src,bytecnt));}/* tfserrmsg(): *  Return the error message string that corresponds to the incoming *  tfs error number. */char *tfserrmsg(int errno){    struct  tfserr  *tep;        tep = tfserrtbl;    while(tep->msg) {        if (errno == tep->err)            return(tep->msg);        tep++;    }    return("unknown tfs errno");}/* tfsmakeStale(): *  Modify the state of a file to be stale. *  Do this by clearing the TFS_NOTSTALE flag in the tfs header. *  This function is used by tfsadd() when in the process of *  updating a file that already exists in the flash. *  See comments above tfsadd() for more details on the TFS_NOTSTALE flag. */static inttfsmakeStale(TFILE *tfp){    ulong   flags;    flags = TFS_FLAGS(tfp) & ~TFS_NSTALE;    if (tfsflashwrite((ulong *)&tfp->flags,&flags,(long)sizeof(long)) < 0)        return(TFSERR_FLASHFAILURE);    return(TFS_OKAY);}/* tfsflagsbtoa(): *  Convert binary flags to ascii and return the string. */char *tfsflagsbtoa(long flags,char *fstr){    int i;    struct  tfsflg  *tfp;    if ((!flags) || (!fstr))        return((char *)0);    i = 0;    tfp = tfsflgtbl;    *fstr = 0;    while(tfp->sdesc) {        if ((flags & tfp->mask) == tfp->flag)            fstr[i++] = tfp->sdesc;        tfp++;    }    fstr[i] = 0;    return(fstr);}/* tfsflagsatob(): *  Convert ascii flags to binary and return the long. */static inttfsflagsatob(char *fstr, long *flag){    struct  tfsflg  *tfp;    *flag = 0;    if (!fstr)        return(TFSERR_BADFLAG);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久影院午夜论| 国产成人免费网站| 国产高清在线精品| 欧美亚洲动漫精品| 久久久久成人黄色影片| 午夜伦理一区二区| 色乱码一区二区三区88| 久久免费偷拍视频| 麻豆传媒一区二区三区| 在线视频亚洲一区| 亚洲国产精品激情在线观看| 美女mm1313爽爽久久久蜜臀| 欧美日韩免费观看一区二区三区| 国产精品午夜在线| 国产一区二区三区四区五区美女| 51精品视频一区二区三区| 一区二区三区在线观看网站| 成人一区二区三区| 国产亚洲精品资源在线26u| 蜜桃精品在线观看| 欧美疯狂性受xxxxx喷水图片| 亚洲一卡二卡三卡四卡五卡| 91亚洲精品乱码久久久久久蜜桃| 久久久一区二区三区捆绑**| 久久99精品网久久| 精品999久久久| 久久99精品国产麻豆不卡| 日韩欧美国产午夜精品| 三级成人在线视频| 欧美久久久久免费| 日韩有码一区二区三区| 6080日韩午夜伦伦午夜伦| 一区二区欧美视频| 欧美日韩综合在线| 亚洲电影一级片| 911精品国产一区二区在线| 日韩av一级电影| 日韩午夜激情免费电影| 蜜桃av噜噜一区| 日韩精品一区在线| 国产精品综合二区| 中文字幕精品—区二区四季| 波多野结衣亚洲| 依依成人综合视频| 51午夜精品国产| 久久se这里有精品| 国产精品三级电影| 欧美综合欧美视频| 男男成人高潮片免费网站| 2021久久国产精品不只是精品| 国产一区二区在线电影| 中文字幕一区日韩精品欧美| 色婷婷综合久久久中文字幕| 午夜精品免费在线观看| 日韩视频123| 成人性色生活片免费看爆迷你毛片| 国产精品乱码人人做人人爱| 91视频91自| 蜜桃传媒麻豆第一区在线观看| 日本一区二区视频在线| 色婷婷av一区二区三区软件| 五月婷婷欧美视频| 久久精品综合网| 在线一区二区三区四区五区| 美国精品在线观看| 亚洲色图欧洲色图| 日韩亚洲欧美一区| 91色porny| 精品一区二区三区免费毛片爱| 国产精品丝袜久久久久久app| 91福利社在线观看| 国产精品一区在线观看你懂的| 亚洲男同1069视频| 久久综合九色欧美综合狠狠| 91久久人澡人人添人人爽欧美 | 国产精品灌醉下药二区| 欧美日韩国产综合一区二区三区 | 久久久久久一二三区| 91在线观看污| 精品一区二区三区的国产在线播放| 日韩一区欧美小说| 久久综合久久99| 欧美日本在线一区| 91在线精品一区二区| 国内外精品视频| 亚洲国产成人av网| 中文字幕中文乱码欧美一区二区| 欧美成人性战久久| 欧美电影一区二区| 91捆绑美女网站| 国产91精品一区二区麻豆网站| 丝袜美腿亚洲综合| 一区二区三区色| 欧美国产日韩一二三区| 久久综合中文字幕| 日韩欧美一级二级三级| 欧美剧情片在线观看| 色8久久人人97超碰香蕉987| 成人av网站在线| 狠狠色狠狠色综合| 狠狠色综合色综合网络| 午夜成人免费电影| 亚洲网友自拍偷拍| 亚洲一区在线电影| 亚洲在线中文字幕| 亚洲国产精品精华液网站| 亚洲品质自拍视频| 国产精品不卡一区| 国产精品久久久久久户外露出| 久久只精品国产| 精品国内二区三区| 久久影音资源网| 久久蜜桃av一区精品变态类天堂 | 加勒比av一区二区| 久久av老司机精品网站导航| 蜜臀av一区二区在线免费观看| 日韩av在线免费观看不卡| 日韩av网站在线观看| 日本亚洲天堂网| 日本亚洲欧美天堂免费| 久久99久国产精品黄毛片色诱| 久久精品免费观看| 久久精品av麻豆的观看方式| 免费在线观看不卡| 国产麻豆欧美日韩一区| 高清国产一区二区三区| 91亚洲精品乱码久久久久久蜜桃 | 亚洲国产成人av网| 日韩电影一二三区| 国产麻豆视频精品| 99riav久久精品riav| 色8久久精品久久久久久蜜| 欧美午夜寂寞影院| 日韩精品中文字幕一区| 中文字幕乱码亚洲精品一区| 亚洲欧美一区二区久久| 日精品一区二区| 国内成人自拍视频| 91蜜桃在线观看| 91精品久久久久久久久99蜜臂| 精品久久久久久久一区二区蜜臀| 中文字幕国产一区| 亚洲一区二区三区免费视频| 免费精品99久久国产综合精品| 国产麻豆精品在线| 在线观看国产91| 精品国产免费一区二区三区四区| 国产精品久久久久久久裸模| 性感美女极品91精品| 国产在线视视频有精品| 91免费视频网址| 欧美一级黄色片| 亚洲欧美国产三级| 九色|91porny| 欧美色爱综合网| 久久九九国产精品| 日韩制服丝袜先锋影音| av激情综合网| 精品国产麻豆免费人成网站| 一区二区三区精品视频在线| 国产精品一级二级三级| 欧美日韩视频一区二区| 国产精品美女视频| 精品一区精品二区高清| 在线视频中文字幕一区二区| 国产三级精品视频| 麻豆精品一二三| 色综合天天综合| 久久男人中文字幕资源站| 日日欢夜夜爽一区| 91麻豆高清视频| 久久人人爽人人爽| 麻豆成人av在线| 欧洲在线/亚洲| **网站欧美大片在线观看| 国产麻豆成人精品| 日韩一区二区在线观看| 香蕉成人啪国产精品视频综合网| av动漫一区二区| 国产精品无圣光一区二区| 国精产品一区一区三区mba桃花 | 日本高清不卡在线观看| 国产拍揄自揄精品视频麻豆| 精品中文av资源站在线观看| 欧美精品丝袜中出| 亚洲成在线观看| 欧洲人成人精品| 亚洲在线观看免费| 在线亚洲欧美专区二区| 国产精品福利一区| 成人理论电影网| 国产精品私房写真福利视频| 成人午夜视频免费看| 久久精品夜色噜噜亚洲aⅴ| 久久电影网电视剧免费观看| 欧美电视剧在线看免费| 久草在线在线精品观看| 精品国产髙清在线看国产毛片| 久久精品久久综合| 久久伊99综合婷婷久久伊|