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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? flash.c

?? flash文件系統(tǒng)實(shí)現(xiàn)
?? 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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区在线观看免费视频播放| 91精品国产综合久久蜜臀| 久久嫩草精品久久久精品一| 精品中文字幕一区二区| 欧美电视剧免费全集观看| 精品一区二区三区在线视频| 久久精子c满五个校花| 懂色中文一区二区在线播放| 国产精品进线69影院| 色香色香欲天天天影视综合网| 亚洲女性喷水在线观看一区| 欧美日韩小视频| 久热成人在线视频| 国产精品网站在线观看| 色狠狠av一区二区三区| 日本成人在线一区| 日本一区二区在线不卡| 91九色02白丝porn| 日本aⅴ精品一区二区三区| 久久中文字幕电影| 色综合天天综合网天天狠天天| 亚洲午夜国产一区99re久久| 日韩欧美黄色影院| 成人激情小说乱人伦| 亚洲高清久久久| 久久日韩精品一区二区五区| 97精品国产露脸对白| 丝袜美腿成人在线| 国产精品视频一区二区三区不卡| 91福利在线播放| 国产做a爰片久久毛片| 亚洲欧美偷拍卡通变态| 日韩欧美一区二区不卡| 99r国产精品| 精品一区二区三区的国产在线播放 | 国产成人在线影院| 一区二区久久久久| 欧美极品美女视频| 91麻豆精品国产无毒不卡在线观看| 国产精品综合一区二区| 亚洲一区二区欧美激情| 欧美国产欧美综合| 欧美成人伊人久久综合网| 色噜噜久久综合| 国产不卡视频在线观看| 男女男精品视频| 亚洲综合区在线| 国产精品视频yy9299一区| 欧美www视频| 欧美天天综合网| 99久久99久久久精品齐齐| 精品在线播放免费| 午夜影院久久久| 亚洲欧美日韩中文播放| 国产欧美精品一区aⅴ影院| 91麻豆精品国产自产在线观看一区| eeuss鲁一区二区三区| 国内精品久久久久影院一蜜桃| 亚洲成人免费观看| 亚洲美女电影在线| 国产精品理论片| 久久免费看少妇高潮| 日韩欧美高清在线| 欧美一区二区播放| 欧美精品久久99| 欧美日韩精品欧美日韩精品| 色婷婷综合久久久久中文一区二区| 国内欧美视频一区二区| 美脚の诱脚舐め脚责91| 日韩国产高清在线| 日韩中文欧美在线| 日韩精品午夜视频| 日本伊人色综合网| 蜜桃一区二区三区在线| 日韩av在线播放中文字幕| 成人污污视频在线观看| 日本伊人精品一区二区三区观看方式 | 国产精品国产精品国产专区不片| 久久久久久久免费视频了| 亚洲精品在线免费播放| 精品99久久久久久| 久久久电影一区二区三区| 久久免费偷拍视频| 国产精品美女久久福利网站| 国产精品欧美一级免费| 国产精品国产精品国产专区不片| 日韩毛片高清在线播放| 亚洲图片一区二区| 日日噜噜夜夜狠狠视频欧美人| 丝袜美腿亚洲综合| 精品一区二区三区视频| 国产传媒日韩欧美成人| 成人动漫av在线| 在线免费精品视频| 欧美久久久久久久久久| 日韩一区二区高清| 国产亚洲欧美日韩在线一区| 亚洲国产精品成人综合色在线婷婷| 国产精品人成在线观看免费| 亚洲乱码国产乱码精品精的特点| 亚洲已满18点击进入久久| 亚洲国产日韩在线一区模特| 蜜乳av一区二区| 粉嫩av亚洲一区二区图片| 色欧美片视频在线观看在线视频| 欧美日韩国产高清一区二区 | 色综合一区二区三区| 欧美伊人久久久久久久久影院| 欧美区视频在线观看| 精品毛片乱码1区2区3区| 国产精品久久久久久久久快鸭 | 亚洲福利视频三区| 黄网站免费久久| 一本色道久久加勒比精品| 欧美日韩电影在线播放| 久久久一区二区三区| 亚洲视频在线一区观看| 久久国产免费看| 国产精品系列在线播放| 在线视频一区二区免费| 精品国产一区二区三区四区四| 国产精品久久久久久户外露出| 亚洲成人久久影院| 成人av电影在线| 日韩你懂的在线播放| 日韩一区有码在线| 国内久久精品视频| 欧美视频一区二区在线观看| 26uuu国产电影一区二区| 一区二区三区av电影| 国产在线精品免费av| 在线精品亚洲一区二区不卡| wwwwww.欧美系列| 亚洲午夜电影网| 99精品在线观看视频| 欧美大尺度电影在线| 亚洲高清免费在线| 91视频观看视频| 国产视频视频一区| 日本va欧美va欧美va精品| 91香蕉视频在线| 国产欧美视频一区二区三区| 蜜臂av日日欢夜夜爽一区| 欧美三级欧美一级| 中文字幕在线免费不卡| 精品一区二区影视| 6080日韩午夜伦伦午夜伦| 亚洲精品成人a在线观看| 成人精品视频一区| 久久午夜色播影院免费高清| 日韩精品电影一区亚洲| 欧美日韩综合在线| 亚洲综合免费观看高清在线观看| 成人精品国产一区二区4080| 2022国产精品视频| 精品一区二区三区在线观看国产| 欧美精品久久99久久在免费线 | 欧美激情自拍偷拍| 国产一区二区三区在线观看免费视频| 5566中文字幕一区二区电影| 亚洲成av人片在线| 欧美日韩色一区| 亚洲123区在线观看| 欧美在线观看视频在线| 亚洲综合激情另类小说区| 91免费视频网| 一区二区视频免费在线观看| 99精品久久99久久久久| 亚洲欧美在线高清| 91久久国产最好的精华液| 一区二区三区自拍| 欧美人体做爰大胆视频| 日日骚欧美日韩| 日韩欧美二区三区| 国产精品综合网| 国产精品美女一区二区三区 | 亚洲精品成人在线| 91久久奴性调教| 亚洲妇熟xx妇色黄| 欧美一区二区三区公司| 蜜桃91丨九色丨蝌蚪91桃色| 精品国产精品网麻豆系列| 国产乱码精品一品二品| 国产精品全国免费观看高清 | 色婷婷久久99综合精品jk白丝 | 国产精品丝袜91| 色偷偷88欧美精品久久久| 亚洲第四色夜色| 日韩欧美三级在线| 国产白丝精品91爽爽久久| 亚洲人被黑人高潮完整版| 欧美亚洲禁片免费| 久久国产三级精品| 国产精品免费看片| 欧美精品第一页| 国产精品一区二区三区乱码 | 一个色综合av| 欧美电影免费观看高清完整版| 国产原创一区二区| 一区二区国产盗摄色噜噜|