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

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

?? flash.c

?? 《嵌入式固件開發》一書的源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* This file contains all of the flash support code that does not need   to be relocated to RAM.  Two separate files (flash.c and flashpic.c)   are maintained because under certain compilers, they may need to be   compiled with different options to be made position independent.   NOTE: THESE FUNCTIONS ARE NOT RE-ENTRANT!!!  All of the FLASH routines   assume they can copy themselves into the array FlashFunc[]; hence, only   one operation can be active at any time.*/#include "config.h"#if INCLUDE_FLASH#include "cpu.h"#include "flash.h"typedef unsigned char uchar;typedef unsigned short ushort;typedef unsigned long ulong;typedef volatile unsigned char vuchar;typedef volatile unsigned short vushort;typedef volatile unsigned long vulong;typedef volatile unsigned int vuint;typedef volatile int vint;extern int Flashtype16();extern int EndFlashtype16();extern int Flashwrite16();extern int EndFlashwrite16();extern int Flashewrite16();extern int EndFlashewrite16();extern int Flasherase16();extern int EndFlasherase16();int FlashOpError(), FlashWidthNotSupported();/* FlashFunc[]:   This array will contain the flash operation function that is executing.   Recall that to operate on the flash, you cannot be executing out of it.   The flash functions are copied here, then executed through the function   pointer flashfunc which is set to point to FlashFunc.*/long    FlashFunc[FLASHFUNCSIZE];int (*flashfunc)();/* FlashProtectWindow:   Must be set to allow any flash operation to be done on space assumed   to be boot code.*/int FlashProtectWindow;/* FlashBank[]:   This structure contains all of the information that must be made available   to the various flash operation commands.  It is initialized by flashtype()   and used thereafter by the other operations.*/struct  flashinfo FlashBank[FLASHBANKS];/* FlashNamId[]:   Used to correlate between the ID and a string representing the name   of the flash device.*/struct flashdesc FlashNamId[] = {        AMD29F800B, "AMD-29F800B",        AMD29F800T, "AMD-29F800T",};int SectorSizes800B[] = {        0x4000, 0x2000, 0x2000, 0x8000,        0x10000, 0x10000, 0x10000, 0x10000,        0x10000, 0x10000, 0x10000, 0x10000,        0x10000, 0x10000, 0x10000, 0x10000,        0x10000, 0x10000, 0x10000};showflashtype(id)ulong id;{    int i;    for(i=0;i<sizeof FlashNamId/sizeof(struct flashdesc);i++) {        if (id == FlashNamId[i].id) {            printf("Device = %s\n",FlashNamId[i].desc);            return(0);        }    }    printf("Flash id 0x%04x not recognized\n",id);    return(-1);}showflashinfo(fdev)struct flashinfo *fdev;{    int i;    if (showflashtype(fdev->id) < 0)        return(-1);    printf("  Base addr   : 0x%08x\n",fdev->base);    printf("  Sectors     : %d\n",fdev->sectorcnt);    printf("  Bank width  : %d\n",fdev->width);    printf("  Sector     Begin       End        Size     SW-Protected?\n");    for(i=0;i<fdev->sectorcnt;i++) {        printf("    %2d    0x%08x  0x%08x  0x%06x      %s\n",            i,fdev->sectors[i].begin,fdev->sectors[i].end,            fdev->sectors[i].size,            fdev->sectors[i].protected ? "yes" : " no");    }    return(0);}/* flashopload():   Used by all flash operations to load the appropriate flash function into   ram.  It first verifies that the request is not larger than the allocated   area (FlashFunc[]), then it copies, and verifies the copy.  Finally,   caches are flushed.   Note that this function is copying code into data space with the intent   that the code will be executed shortly.  This means that after the code   is copied to data space the data cache MUST be flushed (to insure that the   code is in physical memory) and the instruction cache MUST be invalidated   (to insure that there is no instruction cached from a previous run of   this function that may have copied different code to the data space).   The generic calls to preFlashopload() and postFlashopload() are used   to keep this function generic.*/flashopload(begin,end)ulong   *begin, *end;{    extern  ulong preFlashopload(), postFlashopload();    volatile ulong  *bp, *copy;    int ret, mode;    /* Verify space availability: */    if (((int)end - (int)begin) >= sizeof FlashFunc) {        printf("flashopload overflow ((0x%x-0x%x) > 0x%x)\n",            end,begin,sizeof FlashFunc);        return(-1);    }    ret = 0;    mode = preFlashopload((char *)FlashFunc,        (char *)(&FlashFunc[FLASHFUNCSIZE-1]));    /* Copy function() to RAM, then verify: */    copy = (ulong *)FlashFunc;    bp = begin;    while(bp <= end) {        *copy = *bp;        if (*copy++ != *bp++) {            printf("flashopload failed\n");            ret = -1;            break;        }    }    postFlashopload(mode,(char *)FlashFunc,        (char *)(&FlashFunc[FLASHFUNCSIZE-1]));    flashfunc = (int(*)())FlashFunc;    return(ret);}/* flashtype():   Copy the Flashtype() function to the array FlashFunc[], then use   the function pointer flashfunc to call the routine relocated to   RAM space.*/flashtype(fdev)struct flashinfo *fdev;{    int ret;    if (flashopload((ulong *)Flashtype16,(ulong *)EndFlashtype16) < 0)        return(-1);    ret = flashfunc(fdev);    return(ret);}/* flasherase():   Copy the Flasherase() function to the array FlashFunc[], then use   the function pointer flashfunc to call the routine relocated to   RAM space.*/flasherase(fdev,snum)struct  flashinfo *fdev;int snum;{    if (flashopload((ulong *)Flasherase16,(ulong *)EndFlasherase16) < 0)        return(-1);    return(flashfunc(fdev,snum));}/* flashwrite():   Copy the Flashwrite() function to the array FlashFunc[], then use   the function pointer flashfunc to call the routine relocated to   RAM space.   First make a few checks on the request, then write to flash if all   checks succeed.*/flashwrite(fdev,dest,src,bytecnt)struct  flashinfo *fdev;uchar   *src, *dest;long    bytecnt;{    int i, j, lowsector, highsector;    register uchar  *dp, *sp, *edp;    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++;    }    if (flashopload((ulong *)Flashwrite16,(ulong *)EndFlashwrite16) < 0) {        printf("flashopload() failed\n");        return(-1);    }    return(flashfunc(fdev,dest,src,bytecnt));}/* flashewrite():   Copy the Flashewrite() function to the array FlashFunc[], then use   the function pointer flashfunc to call the routine relocated to   RAM space.*/flashewrite(fdev,dest,src,bytecnt)struct  flashinfo *fdev;ulong   *src, *dest;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... */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产视频在线| 丰满岳乱妇一区二区三区| 欧美日韩亚洲国产综合| 亚洲精品中文字幕在线观看| 色综合久久88色综合天天6| 亚洲视频精选在线| 在线视频国内一区二区| 香蕉加勒比综合久久| 欧美美女一区二区| 麻豆国产一区二区| 国产欧美一区二区精品仙草咪| 国产乱码精品1区2区3区| 中文字幕免费不卡| 国产.精品.日韩.另类.中文.在线.播放| 国产喂奶挤奶一区二区三区| 成人av在线资源网站| 日韩一区有码在线| 欧美丝袜自拍制服另类| 日本aⅴ精品一区二区三区 | 日韩女优av电影在线观看| 精品一区二区三区在线观看国产| 久久久另类综合| av爱爱亚洲一区| 午夜欧美在线一二页| 国产午夜精品一区二区三区视频 | 99视频热这里只有精品免费| 亚洲精品乱码久久久久久| 欧美美女直播网站| 国产一区二区免费在线| 亚洲欧美色一区| 91精品国产美女浴室洗澡无遮挡| 国产自产v一区二区三区c| 亚洲色图在线播放| 日韩一级大片在线观看| 成人精品小蝌蚪| 午夜电影一区二区三区| 国产欧美中文在线| 欧美激情自拍偷拍| 日本在线不卡一区| 国产日韩av一区二区| 欧美性受xxxx| 国精产品一区一区三区mba视频| 亚洲色欲色欲www| 日韩欧美中文一区| 91老司机福利 在线| 看电影不卡的网站| 一区二区三区免费网站| 久久精品亚洲乱码伦伦中文| 欧美色精品天天在线观看视频| 欧美一区二区视频观看视频| 中文字幕亚洲成人| 欧美日韩精品一区视频| 日本中文字幕一区二区有限公司| 国产福利一区二区三区| 26uuuu精品一区二区| 精品一区二区在线播放| 日韩免费性生活视频播放| 免费成人av在线播放| 91精品国产美女浴室洗澡无遮挡| 视频一区在线视频| 国产亚洲午夜高清国产拍精品 | 欧美高清你懂得| 成人黄色大片在线观看| 免费成人深夜小野草| 亚洲激情综合网| 国产欧美日韩久久| 久久夜色精品国产噜噜av| 777xxx欧美| 欧美主播一区二区三区美女| 成人免费福利片| 高清av一区二区| 国产精品香蕉一区二区三区| 精品亚洲成a人| 麻豆一区二区在线| 日本麻豆一区二区三区视频| 亚洲成a天堂v人片| 一区二区三区在线免费观看| 中文字幕在线一区二区三区| 国产精品视频免费| 亚洲福利国产精品| 欧美一级高清大全免费观看| 欧美日韩精品欧美日韩精品 | 日韩美女视频在线| 91精品婷婷国产综合久久竹菊| 在线观看不卡一区| 欧美日韩国产综合一区二区三区| 久草热8精品视频在线观看| 91精品国产乱码| 欧美影视一区在线| 欧美在线观看一区| 欧美日韩激情一区二区| 91精品91久久久中77777| 成人一道本在线| 成人av资源站| 欧美少妇xxx| 91精品国产综合久久香蕉的特点| 欧美精品 国产精品| 欧美一二三区精品| 久久久噜噜噜久久中文字幕色伊伊| 久久精品一区二区| 亚洲欧洲成人精品av97| 亚洲美女视频在线观看| 亚洲一二三四区不卡| 丝袜亚洲另类丝袜在线| 亚洲精品视频自拍| 天堂一区二区在线| 亚洲美女屁股眼交3| 国产在线不卡一卡二卡三卡四卡| 欧美三级日韩在线| 欧美日韩三级视频| 3d成人h动漫网站入口| 欧美丰满美乳xxx高潮www| 正在播放一区二区| 日韩久久久久久| 国产亚洲精品超碰| 亚洲码国产岛国毛片在线| 亚洲色图制服诱惑| 欧美性生活影院| 国产精品66部| 91猫先生在线| 欧美一区二区三区视频在线| 中文字幕av一区二区三区高| 亚洲一区视频在线观看视频| 国产精品系列在线| 色综合天天性综合| 欧美一区二区三区日韩| 国产精品久久毛片| 日韩精品乱码免费| 成人高清在线视频| 欧美人牲a欧美精品| 精品卡一卡二卡三卡四在线| 国产精品乱码人人做人人爱| 日本特黄久久久高潮| hitomi一区二区三区精品| 337p亚洲精品色噜噜狠狠| 亚洲国产精品成人综合色在线婷婷 | 亚洲gay无套男同| 国产不卡在线视频| 欧美亚洲一区二区在线| 国产日韩av一区| 久久99精品国产.久久久久久| 99精品视频在线观看免费| 成人免费视频网站在线观看| 国产精品九色蝌蚪自拍| 精品粉嫩aⅴ一区二区三区四区| 亚洲色图另类专区| 国内精品久久久久影院薰衣草| 91搞黄在线观看| 欧美激情一区不卡| 精品一区二区三区在线视频| 欧美精品一二三区| 一区二区三区在线视频免费| 成人av资源下载| 日本一区二区三区免费乱视频| 麻豆精品视频在线观看视频| 91成人国产精品| 尤物视频一区二区| www.欧美日韩国产在线| 久久精品亚洲精品国产欧美kt∨ | 麻豆国产一区二区| 欧美专区亚洲专区| 亚洲激情自拍偷拍| 91年精品国产| 中文字幕视频一区| 99国产精品久久久久| 国产婷婷色一区二区三区在线| 毛片一区二区三区| 日韩欧美电影一区| 九九热在线视频观看这里只有精品 | 亚洲午夜电影在线观看| 91麻豆视频网站| 亚洲三级视频在线观看| 久久综合视频网| 粉嫩高潮美女一区二区三区| 亚洲高清免费在线| 国产美女娇喘av呻吟久久| 国产精品你懂的在线欣赏| 色综合久久天天综合网| 捆绑紧缚一区二区三区视频 | 色综合天天综合在线视频| 亚洲制服丝袜av| 中文字幕欧美国产| 欧美丝袜自拍制服另类| 日韩精品久久理论片| 欧美日韩色一区| 丝袜脚交一区二区| 在线不卡免费av| 美日韩一区二区三区| 91精品久久久久久蜜臀| 麻豆极品一区二区三区| 久久久午夜精品理论片中文字幕| 国产乱码精品一区二区三区av| 欧美高清在线一区二区| 91美女片黄在线观看91美女| 一区二区三区毛片| 欧美一级二级在线观看| 国产高清不卡一区| 亚洲免费在线视频一区 二区| 欧美视频精品在线| 国产一区二区三区|