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

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

?? flash.c

?? 完整的Bell實驗室的嵌入式文件系統(tǒng)TFS
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* flashcom.c: *  This file contains the portions of the flash code that are device *  independent.  Refer to the appropriate device sub-directory for the *  code that is specific to the flash device on the target. * *  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"#if INCLUDE_FLASH#include "cpu.h"#include "flashdev.h"#include "flash.h"#include "genlib.h"#include "ctype.h"#include "stddefs.h"#include "tfs.h"#include "cli.h"extern struct flashdesc FlashNamId[];int     FlashCurrentBank;int     sectortoaddr(int,int *,uchar **);#define SRANGE_ERROR    -1#define SRANGE_SINGLE   1#define SRANGE_RANGE    2#define SRANGE_ALL      3    /* FlashProtectWindow: *  Must be set to allow any flash operation to be done on space assumed *  to be software protected. */int FlashProtectWindow;/* FlashBank[]: *  This table contains all of the information that is needed to keep the *  flash code somewhat generic across multiple flash devices. */struct  flashinfo FlashBank[FLASHBANKS];#ifdef DISABLE_INTERRUPTS_DURING_FLASHOPS#define FLASH_INTSOFF()             intsoff()#define FLASH_INTSRESTORE(ival)     intsrestore(ival)#else#define FLASH_INTSOFF()             0#define FLASH_INTSRESTORE(ival)#endif/* showflashtype(): *  Find a match between the incoming id and an entry in the FlashNamId[] *  table.  The FlashNamId[] table is part of the device-specific code. */intshowflashtype(ulong id){    struct flashdesc *fdp;    fdp = FlashNamId;    while(fdp->desc) {        if (id == fdp->id) {            printf("Device = %s\n",fdp->desc);            return(0);        }        fdp++;    }    printf("Flash id 0x%lx not recognized\n",id);    return(-1);}/* flasherased(): * Return 1 if range of memory is all 0xff; else 0. * Scan through the range of memor specified by begin-end (inclusive) * looking for anything that is not 0xff.  Do this in three sections so * that the pointers can be 4-byte aligned for the bulk of the comparison * range... * The beginning steps through as a char pointer until aligned on a 4-byte * boundary.  Then do ulong * comparisons until the just before the end * where we once again use char pointers to align on the last few * non-aligned bytes (if any). */intflasherased(uchar *begin, uchar *end){    ulong *lp, *lp1;    /* Get pointers aligned so that we can do the bulk of the comparison     * with long pointers...     */    while(((long)begin & 3) && (begin != end)) {        if (*begin != 0xff) {            return(0);        }        begin++;    }    if (begin >= end)        return(1);    lp = (ulong *)begin;    lp1 = (ulong *)end;    (long)lp1 &= ~3;    while(lp < lp1) {        if (*lp != 0xffffffff) {            return(0);        }        lp++;    }    if (lp >= (ulong *)end)        return(1);        begin = (uchar *)lp;    do {        if (*begin++ != 0xff)            return(0);    } while(begin != end);    return(1);}/* showflashinfo(): * Dump information about specified flash device. */intshowflashinfo(struct flashinfo *fdev, char *range){    int i;    struct  sectorinfo *sp;    if (showflashtype(fdev->id) < 0)        return(-1);    printf("  Base addr   : 0x%08lx\n",(ulong)(fdev->base));    printf("  Sectors     : %d\n",fdev->sectorcnt);    printf("  Bank width  : %d\n",fdev->width);    printf("  Sector     Begin       End        Size     SWProt?  Erased?\n");    for(i=0;i<fdev->sectorcnt;i++) {        sp = &fdev->sectors[i];        if (inRange(range,sp->snum)) {            printf("    %2d    0x%08lx  0x%08lx  0x%06lx    %s       %s\n",                sp->snum, (ulong)(sp->begin), (ulong)(sp->end), sp->size,                sp->protected ? "yes" : " no",                flasherased(sp->begin,sp->end) ? "yes" : "no");        }    }    return(0);}/* flashopload(): *  Copy flash operation to ram space.   *  Note that this function assumes that cache is disabled at this point. *  This is important because we are copying text into bss space and if *  cache was on, there could be a coherency problem. */intflashopload(ulong *begin,ulong *end,ulong *copy,int size){    volatile ulong  *bp;    int ret;    /* Verify space availability: */    if (((int)end - (int)begin) >= size) {        printf("flashopload overflow ((0x%lx-0x%lx) > 0x%x)\n",            (ulong)end,(ulong)begin,size);        return(-1);    }    ret = 0;    /* Copy function() to RAM, then verify: */    bp = begin;    while(bp <= end) {        *copy = *bp;        if (*copy++ != *bp++) {            printf("flashopload failed\n");            ret = -1;            break;        }    }    return(ret);}/* flashtype(): *  Use the device-specific function pointer to call the routine *  relocated to RAM space. */intflashtype(fdev)struct flashinfo *fdev;{    return(fdev->fltype(fdev));}/* flasherase(): *  Use the device-specific function pointer to call the routine *  relocated to RAM space. *  Note that flasherase() is called with a sector number.  The sector *  number is relative to the entire system, not just the particular device. *  This means that if there is more than one flash device in the system that *  the actual sector number (relative to the device) may not be the same *  value.  This adjustment is made here so that the underlying code that is *  pumped into ram for execution does not have to be aware of this. */intflasherase(fdev,snum)struct  flashinfo *fdev;int snum;{    int size;    unsigned char *base, *end;    if (fdev->id == FLASHRAM) {        if (snum == ALL_SECTORS) {            size = fdev->end - fdev->base;            base = fdev->base;        }        else {            sectortoaddr(snum,&size,&base);        }        end = base+size;        while(base < end) {            *base = 0xff;            if (*base++ != 0xff)                return(-1);        }        return(0);    }    if ((snum != ALL_SECTORS) && (fdev->sectors[0].snum != 0)) {/*      printf("Adjusting snum from %d to",snum); */        snum -= fdev->sectors[0].snum;/*      printf(" %d.\n",snum); */    }    return(fdev->flerase(fdev,snum));}/* flashwrite(): *  Use the device-specific function pointer to call the routine *  relocated to RAM space. *  First make a few checks on the request, then write to flash if all *  checks succeed. */intflashwrite(struct flashinfo *fdev,uchar *dest,uchar *src,long bytecnt){    int j, lowsector, highsector;    register uchar  *dp, *sp, *edp;    if (fdev->id == FLASHRAM) {        uchar *sp, *dp, *end;        sp = src;        dp = dest;        end = dp+bytecnt;        while(dp < end) {            *dp = *sp;            if (*dp != *sp)                return(-1);            dp++; sp++;        }        return(0);    }    dp = dest;    sp = src;    edp = (dest + bytecnt) - 1;    /* If outside the devices space, return failed.. */    if ((edp < fdev->sectors[0].begin) ||        (dp > fdev->sectors[fdev->sectorcnt-1].end)) {        printf("flashwrite() failed: dest out of flash range\n");        return(-1);    }    /* Make sure the destination is not within a protected sector */    if (FlashProtectWindow == FLASH_PROTECT_WINDOW_CLOSED) {        /* First determine the sectors that overlap with the         * flash space to be written...         */        lowsector = highsector = -1;        for(j=0;j<fdev->sectorcnt;j++) {            if ((dp >= fdev->sectors[j].begin) &&                (dp <= fdev->sectors[j].end))                lowsector = j;        }        for(j=0;j<fdev->sectorcnt;j++) {            if ((edp >= fdev->sectors[j].begin) &&                (edp <= fdev->sectors[j].end))                highsector = j;        }        if ((lowsector == -1) || (highsector == -1)) {            printf("flashwrite() failed: can't find sector\n");            return(-1);        }        /* Now that the range of affected sectors is known,         * verify that those sectors are not protected...         */        for(j=lowsector;j<=highsector;j++) {            if (fdev->sectors[j].protected) {                printf("flashwrite() failed: sector protected\n");                return(-1);            }        }    }    /* Now make sure that there is no attempt to transition a bit     * in the affected range from 0 to 1...  A flash write can only     * bring bits low (erase brings them  high).     */    while(dp < edp) {        if ((*dp & *sp) != *sp) {            printf("flashwrite() failed: bit 0->1 rqst denied.\n");            return(-1);        }        dp++;         sp++;    }    return(fdev->flwrite(fdev,dest,src,bytecnt));}/* flashewrite(): *  Use the device-specific function pointer to call the routine *  relocated to RAM space. */intflashewrite(struct flashinfo *fdev,uchar *dest,uchar *src,long bytecnt){    int i;    /* Source and destination addresses must be long-aligned. */    if (((int)src & 3) || ((int)dest & 3))        return(-1);    /* If the protection window is closed, then verify that no protected     * sectors will be written over...     */    if (FlashProtectWindow == FLASH_PROTECT_WINDOW_CLOSED) {        for (i=0;i<fdev->sectorcnt;i++) {            if((((uchar *)dest) > (fdev->sectors[i].end)) ||                (((uchar *)dest+bytecnt) < (fdev->sectors[i].begin)))                continue;            else                if (fdev->sectors[i].protected)                    return(-1);        }    }    return(fdev->flewrite(fdev,dest,src,bytecnt));}/* addrtosector(): *  Incoming address is translated to sector number, size of sector *  and base of sector. *  Return 0 if successful; else -1. */intaddrtosector(uchar *addr,int *sector,int *size,uchar **base){    struct flashinfo *fbnk;    struct  sectorinfo *sinfo;    int     dev, sec, i;    sec = 0;    for(dev=0;dev<FLASHBANKS;dev++) {        fbnk = &FlashBank[dev];        for(i=0;i<fbnk->sectorcnt;i++,sec++) {            sinfo = &fbnk->sectors[i];            if ((addr >= sinfo->begin) && (addr <= sinfo->end)) {                if (sector) {                    *sector = sec;                }                if (base) {                    *base = sinfo->begin;                }                if (size) {                    *size = sinfo->size;                }                return(0);            }        }    }    printf("addrtosector(0x%lx) failed\n",(ulong)addr);    return(-1);}/* addrtobank(): *  From the incoming address, return a pointer to the flash bank that *  this address is within. */struct flashinfo *addrtobank(uchar *addr){    struct flashinfo *fbnk;    int     dev;    for(dev=0;dev<FLASHBANKS;dev++) {        fbnk = &FlashBank[dev];        if ((addr >= fbnk->base) && (addr <= fbnk->end))            return(fbnk);    }    printf("addrtobank(0x%lx) failed\n",(ulong)addr);    return(0);}int

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产日韩一区二区| 色香色香欲天天天影视综合网| 成人精品视频一区二区三区| 欧美午夜一区二区三区免费大片| 精品国产乱码久久久久久久 | 亚洲激情图片一区| 国产一区欧美一区| 欧美精品xxxxbbbb| 亚洲一区二区三区四区在线观看 | 久久精品欧美一区二区三区不卡 | 日韩码欧中文字| 极品少妇一区二区三区精品视频| 色婷婷av一区二区三区gif| 精品美女被调教视频大全网站| 亚洲综合色网站| 日本道精品一区二区三区| 国产精品丝袜黑色高跟| 国产麻豆91精品| 精品国产乱码久久久久久浪潮| 天天综合色天天| 欧美日韩精品电影| 五月婷婷综合网| 欧美三级日韩三级国产三级| 一级日本不卡的影视| 99国产一区二区三精品乱码| 中文字幕不卡在线| 成人福利在线看| 国产精品网站在线播放| 成人久久视频在线观看| 中文字幕精品—区二区四季| 国产a视频精品免费观看| 国产色婷婷亚洲99精品小说| 韩国av一区二区三区四区| 欧美一区二区不卡视频| 久久精品国产澳门| 精品少妇一区二区三区免费观看| 久久精品国产亚洲高清剧情介绍| 欧美一二三区精品| 蜜臀av亚洲一区中文字幕| 日韩欧美国产三级| 久久国内精品视频| 国产亚洲福利社区一区| 成人久久视频在线观看| 亚洲美女视频在线| 欧美日韩一本到| 免费看欧美女人艹b| 欧美精品一区二区三区视频| 成人综合在线观看| 亚洲黄色小说网站| 在线不卡一区二区| 激情国产一区二区| 国产日韩视频一区二区三区| 色综合久久中文字幕综合网 | 欧美色中文字幕| 视频一区二区不卡| 久久久噜噜噜久久人人看| 成人黄色电影在线 | 欧美日韩色一区| 久久99精品久久久久久| 日韩毛片精品高清免费| 欧美一区二区三区在线看| 国产成人h网站| 一级日本不卡的影视| 精品国一区二区三区| 91亚洲男人天堂| 久久97超碰国产精品超碰| 亚洲欧美在线高清| 日韩欧美一二三区| 91一区在线观看| 狠狠色丁香久久婷婷综| 亚洲狼人国产精品| 久久精品一区二区三区不卡牛牛| 91黄视频在线观看| 国产精品中文有码| 亚洲成人综合网站| 中文字幕第一区二区| 欧美一区二区私人影院日本| 夫妻av一区二区| 麻豆精品一区二区三区| 亚洲最新在线观看| 国产精品伦一区二区三级视频| 91麻豆精品91久久久久久清纯 | 丁香另类激情小说| 午夜欧美在线一二页| 1000精品久久久久久久久| 精品噜噜噜噜久久久久久久久试看| 色婷婷综合久久久| 国产成人av资源| 狠狠色丁香婷综合久久| 日韩精品一卡二卡三卡四卡无卡| 亚洲日本青草视频在线怡红院 | 精品国产乱码久久久久久浪潮| 色拍拍在线精品视频8848| 国产另类ts人妖一区二区| 免费三级欧美电影| 视频在线观看91| 亚洲成人tv网| 亚洲一区二区三区精品在线| 亚洲少妇最新在线视频| 国产精品久久看| 国产欧美一区二区三区鸳鸯浴| 日韩免费高清视频| 91精品国产入口| 欧美老女人第四色| 欧美日韩国产乱码电影| 欧美午夜免费电影| 在线观看国产日韩| 在线免费观看日本一区| 色94色欧美sute亚洲13| 成人福利在线看| av电影一区二区| 色综合中文字幕国产| 国产成人免费视频网站高清观看视频 | 亚洲综合精品自拍| 一区二区三区欧美| 天天做天天摸天天爽国产一区 | 亚洲国产日日夜夜| 亚洲高清中文字幕| 日本午夜一本久久久综合| 免费在线观看精品| 国内外精品视频| 成人91在线观看| 色婷婷亚洲综合| 欧美日产在线观看| 精品久久久久久久久久久久久久久 | 国产精品久久福利| 亚洲男人天堂av网| 亚洲精品视频免费看| 亚洲成av人影院| 久久国产精品露脸对白| 国产精品18久久久久久vr| 高清在线不卡av| 91免费观看国产| 91麻豆精品91久久久久同性| 久久亚洲精华国产精华液| 国产偷v国产偷v亚洲高清| 亚洲欧美另类在线| 性欧美疯狂xxxxbbbb| 国产一区二区精品在线观看| 成人免费三级在线| 欧美日韩精品一区二区在线播放| 日韩免费视频线观看| 亚洲国产精品成人综合色在线婷婷| 亚洲视频每日更新| 久久狠狠亚洲综合| 色婷婷综合五月| 日韩一级黄色片| 中文字幕视频一区二区三区久| 五月婷婷综合在线| 国产成人精品免费在线| 欧美喷潮久久久xxxxx| 久久久久久**毛片大全| 亚洲国产毛片aaaaa无费看| 国产真实乱偷精品视频免| 色激情天天射综合网| 精品国产3级a| 亚洲一卡二卡三卡四卡| 国产99久久久国产精品| 777精品伊人久久久久大香线蕉| 久久久久国产精品免费免费搜索| 亚洲一区二区三区免费视频| 国产一区91精品张津瑜| 欧美日韩三级在线| 国产精品久久精品日日| 国产在线播放一区三区四| 欧美在线影院一区二区| 国产精品污网站| 精品亚洲欧美一区| 91精品国产综合久久蜜臀| 中文字幕亚洲在| 国产一区二区按摩在线观看| 欧美丰满少妇xxxbbb| 亚洲人123区| 国产99精品国产| 亚洲精品一区二区三区精华液| 午夜久久久久久| 91福利在线导航| 亚洲人成网站精品片在线观看| 国产成人在线观看免费网站| 91精品国产91综合久久蜜臀| 一区二区在线免费观看| 成人av免费网站| 国产欧美一区视频| 国产成人免费在线观看| 久久噜噜亚洲综合| 黄网站免费久久| 欧美精品一区二区蜜臀亚洲| 日本亚洲最大的色成网站www| 在线观看一区不卡| 一区二区久久久久| 日本黄色一区二区| 一区二区三区色| 91老师国产黑色丝袜在线| 亚洲日本va在线观看| gogogo免费视频观看亚洲一| 国产精品久久久久9999吃药| 成人性生交大片免费看在线播放| 国产色综合久久| 成人激情视频网站| 国产精品福利av|