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

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

?? flashpic_28f640.c

?? 《嵌入式固件開發》一書的源碼
?? C
字號:
/* flashpic_28f640.c:    This file contains the portion of the flash driver code that can be    relocated (pic =  position independent code) to RAM space so that it    is not executing out of the same flash device that it is operating on.    This code is specific to a 16-bit configuration of the 28f640, but    could be made width independent if the need arises.*/#include "config.h"#if INCLUDE_FLASHtypedef 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;#include "cpu.h"#include "flashdev.h"#include "flash.h"#include "flash_28f640.h"#define WBS     0x0080#define WSMS    0x0080#define ESS     0x0040#define ECLBS   0x0020#define PSLBS   0x0010#define VPENS   0x0008#define RSVD2   0x0004#define DPS     0x0002#define RSVD0   0x0001extern struct flashinfo Fdev;extern int FlashProtectWindow;#if 0intFlashlock28F640_16(struct flashinfo *fdev,int snum,int operation){    ulong   add;    int sector;    add = (ulong)(fdev->base);    /* Lock the requested sector(s): */    for (sector=0;sector<fdev->sectorcnt;sector++) {        if ((snum == ALL_SECTORS) || (snum == sector)) {            /* Issue the appropriate command sequence: */            Write_60_to_base();             switch(operation) {            case FLASH_UNLOCK:                Write_d0_to_(add);                break;            case FLASH_LOCK:                Write_01_to_(add);                break;            case FLASH_LOCKDWN:                Write_2f_to_(add);                break;            }        }        add += fdev->sectors[sector].size;    }    Write_ff_to_base();     /* Go to read-array mode */    return(0);}voidEndFlashlock28F640_16(){}#endif/* Flasherase():   Based on the 'snum' value, erase the appropriate sector(s).   Write the "Erase Setup" and "Erase Confirm" commands...   Return 0 if success, else -1.*/intFlasherase28F640_16(struct flashinfo *fdev,int snum){    ulong   add;    int ret, sector;    ret = 0;    add = (ulong)(fdev->base);    /* Erase the request sector(s): */    for (sector=0;sector<fdev->sectorcnt;sector++) {        if ((!FlashProtectWindow) &&            (fdev->sectors[sector].protected)) {            add += fdev->sectors[sector].size;            continue;        }        if ((snum == ALL_SECTORS) || (snum == sector)) {            register ulong *lp, *lp1;            int noterased;            /* See if the sector is already erased: */            noterased = 0;            lp = (ulong *)fdev->sectors[sector].begin;             lp1 = (ulong *)((char *)lp + fdev->sectors[sector].size);             while(lp < lp1) {                if (*lp++ != 0xffffffff) {                    noterased = 1;                    break;                }            }            if (noterased) {                Write_20_to_base();             /* setup */                Write_d0_to_(add);              /* confirm */                while(!(Read_0000() & WSMS));   /* Wait for SMS ready */                if (Read_0000() & ECLBS)        /* Check for error */                    ret = -1;                Write_50_to_base();             /* Clear status register */                Write_ff_to_base();             /* Go to read-array mode */            }            if (ret == -1)                break;        }        add += fdev->sectors[sector].size;    }    return(ret);}/* EndFlasherase():   Function place holder to determine the "end" of the   sectorerase() function.*/voidEndFlasherase28F640_16(){}/* Flashwrite():    Return 0 if successful, else -1.    There are two versions of this function.  The currently removed version    supports the one-word/byte-at-a-time programming mode and it works but    it is slow.  The currently active version uses the 28F640's write buffer    mode of programming.  This is much faster, but it requires a bit more    complexity.  See comments in code.*/#if 0intFlashwrite28F640_16(struct flashinfo *fdev,uchar *dest,uchar *src,long bytecnt){    int     i, ret;    long    cnt;    uchar   *src1;    ftype   val;    /* If destination address is not properly aligned, then build a fake   */    /* source buffer based on the current value in dest[-1] and src[0].    */    /* Then call this function to do that 2-byte operation.  Once that     */    /* completes, simply increment dest and src by 1 and continue in this  */    /* context. */    if (NotAligned(dest)) {        uchar buf[2];        buf[0] = *(dest-1);        buf[1] = *src;        Flashwrite28F640_16(fdev,dest-1,buf,2);        dest++; src++; bytecnt--;    }    /* Each pass through this loop writes 'fdev->width' bytes... */    ret = 0;    cnt = bytecnt & ~1;    src1 = (uchar *)&val;onemore:    for (i=0;i<cnt;i+=fdev->width) {       /* Just in case src is not aligned... */        src1[0] = src[0];        src1[1] = src[1];        Write_40_to_(dest);             /* Flash program setup command */        Fwrite(dest,src1);              /* Write the value */        while(!(Read_0000() & WSMS));   /* Wait for SMS ready */        if (Read_0000() & PSLBS)        /* Check for error */            ret = -1;        Write_50_to_base();             /* Clear status register */        Write_ff_to_base();             /* Go to read-array mode */        dest += fdev->width;         src += fdev->width;    }    /* If bytecount was odd... */    /* If cnt != bytecnt then bytecnt is odd, so one more byte must be */    /* written to flash.  To do this, the one byte must be combined with */    /* the next byte that is already stored in flash; then re-written... */    if (cnt != bytecnt) {        val = (ftype)*dest | ((ftype)(*src) << 8);        src = (uchar *)&val;        bytecnt = cnt = 1;        goto onemore;    }    return(ret);}#endifintFlashwrite28F640_16(struct flashinfo *fdev,uchar *dest,uchar *src,long bytecnt){    int     tot, ret;    long    cnt;    uchar   *src1;    ftype   val;    /* If destination address is not properly aligned, then build a fake   */    /* source buffer based on the current value in dest[-1] and src[0].    */    /* Then call this function to do that 2-byte operation.  Once that     */    /* completes, simply increment dest and src by 1 and continue in this  */    /* context. */    if (NotAligned(dest)) {        uchar buf[2];        buf[0] = *(dest-1);        buf[1] = *src;        Flashwrite28F640_16(fdev,dest-1,buf,2);        dest++; src++; bytecnt--;    }    /* This device supports a write-buffer mode.  The buffer is 32 bytes    */    /* (16 words) and greatly speeds up the programming process.  This      */    /* This function starts up with the word-at-a-time mode and uses it     */    /* until the destination address is mod32.  Then for each successive    */    /* 32-byte block, the write buffer is used. When there is less than 32  */    /* bytes left, the algorithm falls back to the one-word-at-a-time mode  */    /* to finish up. */    ret = 0;    cnt = bytecnt & ~1;    src1 = (uchar *)&val;    for (tot=0;tot<cnt;tot+=2) {        if (((ulong)dest & 0x1f) == 0)  /* Break out when 5 LSBs are zero */            break;        src1[0] = src[0];               /* Just in case src is not aligned... */        src1[1] = src[1];                       Write_40_to_(dest);             /* Flash program setup command */        Fwrite(dest,src1);              /* Write the value */        while(!(Read_0000() & WSMS));   /* Wait for SMS ready */        if (Read_0000() & PSLBS)        /* Check for error */            ret = -1;        Write_50_to_base();             /* Clear status register */        Write_ff_to_base();             /* Go to read-array mode */        dest += 2;         src += 2;    }    /* If tot is less than cnt, then the upper loop reached a point where   */    /* the destination address had the 5 LSBs low.  This means that we can  */    /* use the write-buffer for all remaining blocks of 32 bytes...         */    if (tot < cnt) {        while((cnt-tot) >= 32) {            int i;            uchar *src2, buf32[32], *base;                src2 = buf32;               /* Copy next buffer's worth of data */            for(i=0;i<32;i++)           /* into local buffer just in case */                buf32[i] = *src++;      /* the source is this flash device. */                do {                 Write_e8_to_(dest);         /* Write-to-buffer command */            } while (!(Read_0000() & WBS)); /* Write buffer available? */                            base = dest;            Write_0f_to_(dest);         /* Word count is 16 (load 16-1) */            for(i=0;i<16;i++) {                src1[0] = src2[0];      /* Just in case src is not aligned... */                src1[1] = src2[1];                              Fwrite(dest,src1);      /* Write the value */                dest += 2;                 src2 += 2;             }            Write_d0_to_(base);             /* Write-confirm command */            while(!(Read_0000() & WSMS));   /* Wait for SMS ready */            Write_ff_to_base();             /* Go to read-array mode */            tot += 32;        }    }onemore:    for (;tot<cnt;tot+=2) {        src1[0] = src[0];               /* Just in case src is not aligned... */        src1[1] = src[1];        Write_40_to_(dest);             /* Flash program setup command */        Fwrite(dest,src1);              /* Write the value */        while(!(Read_0000() & WSMS));   /* Wait for SMS ready */        if (Read_0000() & PSLBS)        /* Check for error */            ret = -1;        Write_50_to_base();             /* Clear status register */        Write_ff_to_base();             /* Go to read-array mode */        dest += 2;         src += 2;    }    /* If bytecount was odd... */    /* If cnt != bytecnt then bytecnt is odd, so one more byte must be */    /* written to flash.  To do this, the one byte must be combined with */    /* the next byte that is already stored in flash; then re-written... */    if (cnt != bytecnt) {        val = (ftype)*dest | ((ftype)(*src) << 8);        src = (uchar *)&val;        tot = 0;        bytecnt = cnt = 1;        goto onemore;    }    return(ret);}/* EndFlashwrite():    Function place holder to determine the "end" of the    Flashwrite() function.*/voidEndFlashwrite28F640_16(){}/* Ewrite():   Erase all sectors that are part of the address space to be written,   then write the data to that address space.  This is basically a   concatenation of flasherase and flashwrite done in one step.  This is   necessary primarily for re-writing the bootcode; because after the boot   code is erased, there is nowhere to return so the re-write must be done   while executing out of ram also.*/intFlashewrite28F640_16(struct flashinfo *fdev,ftype *dest,ftype *src,int bytecnt){    int i, err;    ulong   add;    void    (*reset)();    ftype   *src1;    err = 0;    add = (ulong)(fdev->base);    src1 = src;    /* For each sector, if it overlaps any of the destination space */    /* then erase that sector. */    for (i=0;i<fdev->sectorcnt;i++) {        if ((((uchar *)dest) > (fdev->sectors[i].end)) ||            (((uchar *)dest+bytecnt) < (fdev->sectors[i].begin))) {            add += fdev->sectors[i].size;            continue;        }        Write_20_to_base();             /* setup */        Write_d0_to_(add);              /* confirm */        while(!(Read_0000() & WSMS));   /* Wait for SMS ready */        if (Read_0000() & ECLBS)        /* Check for error */            err = 1;        Write_50_to_base();             /* Clear status register */        Write_ff_to_base();             /* Go to read-array mode */        if (err)            return(-1);        add += fdev->sectors[i].size;    }    for(i=0;i<bytecnt;i+=fdev->width) {                /* Just in case src is not aligned... */        src1[0] = src[0];        src1[1] = src[1];        Write_40_to_(dest);             /* Flash program setup command */        Fwrite(dest,src1);              /* Write the value */        while(!(Read_0000() & WSMS));   /* Wait for SMS ready */        if (Read_0000() & PSLBS)        /* Check for error */            err = 1;        Write_50_to_base();             /* Clear status register */        Write_ff_to_base();             /* Go to read-array mode */        if (err)            return(-1);        dest++;         src++;    }        /* Wait till flash is readable, then reset: */    while(1) {        if (Is_Equal((dest-1),src1))            break;    }    /* Now that the re-programming of flash is complete, reset: */    reset = RESETFUNC();    reset();    return(0);  /* won't get here */}/* EndFlashewrite():    Function place holder to determine the "end" of the    FlashEraseAndWrite() function.*/voidEndFlashewrite28F640_16(){}/* Flashtype():   Use the ReadCOnfiguration command (90H) to read manufacturer code (0000)   and device id code (0001).*/intFlashtype28F640_16(struct flashinfo *fdev){    ftype   val;    ushort  man, dev;    ulong   id;    val = Read_0000();    /* Issue the read configuration command: */    Write_90_to_base();    man = (ushort)Read_0000();  /* manufacturer ID */    dev = (ushort)Read_0001();  /* device ID */    id = man;    id <<= 16;    id |= dev;    fdev->id = id;    /* Issue the read array command: */    Write_ff_to_base();    return((int)(fdev->id));}/* EndFlashtype():    Function place holder to determine the "end" of the    Flashtype() function.*/voidEndFlashtype28F640_16(){}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜精品久久久久久久| 在线观看国产日韩| 狠狠色综合色综合网络| 国产九九视频一区二区三区| 国产99精品国产| 99精品久久只有精品| 欧美优质美女网站| 久久久亚洲精品一区二区三区| 欧美国产欧美综合| 亚洲高清不卡在线| 国产99精品国产| 不卡一区中文字幕| 亚洲午夜激情网页| 91亚洲午夜精品久久久久久| eeuss影院一区二区三区| 最新日韩在线视频| 欧美一区二区私人影院日本| 国产成人在线观看| 国产精品久久久久久久久动漫| 日韩午夜电影av| 制服丝袜日韩国产| 欧美高清视频www夜色资源网| 91在线国内视频| 亚洲成av人片一区二区梦乃| 午夜一区二区三区视频| 天天爽夜夜爽夜夜爽精品视频| 天堂一区二区在线| 视频一区二区三区中文字幕| av毛片久久久久**hd| 国产精品影视天天线| 国产69精品久久99不卡| 欧美性大战久久久久久久蜜臀| 国产成人av资源| 欧美日本在线一区| 一区二区三区四区在线| 国产精品一级片| 欧美精品v国产精品v日韩精品| 一区二区三区在线观看动漫| 蜜桃免费网站一区二区三区| 成人黄色在线网站| 亚洲国产精品成人久久综合一区| 久久精品国产99| 欧美精品国产精品| 久久99国产精品尤物| 欧美一级高清片在线观看| 国产精品一二三四五| 欧美一区二区精品久久911| 久久激情五月激情| 成人免费在线观看入口| 国产酒店精品激情| 最新中文字幕一区二区三区| 欧美精品在线一区二区三区| 国内精品写真在线观看| 国产校园另类小说区| 懂色av中文字幕一区二区三区| 亚洲免费观看高清完整版在线 | 一区二区三区成人| 久久久高清一区二区三区| 久久亚洲一区二区三区明星换脸| 国产精品亚洲视频| 国产日韩精品一区| 91麻豆精品久久久久蜜臀| 成人丝袜18视频在线观看| 日本在线不卡视频| 亚洲人成在线观看一区二区| 2023国产一二三区日本精品2022| 91视频一区二区| 岛国一区二区在线观看| 蜜桃av一区二区三区| 首页国产丝袜综合| 亚洲影视资源网| 一区二区三区精品在线观看| 欧美韩国日本一区| 久久精品日产第一区二区三区高清版| 欧美日韩专区在线| 欧美日韩一区二区三区在线看| 一本大道久久a久久精二百| 99久久综合色| 91偷拍与自偷拍精品| 99精品欧美一区二区三区综合在线| 亚洲美女一区二区三区| 中文字幕一区二区三区色视频| 又紧又大又爽精品一区二区| 欧美三区在线观看| 欧美无乱码久久久免费午夜一区| bt7086福利一区国产| 91成人在线精品| 欧美欧美欧美欧美首页| 666欧美在线视频| 日韩一区二区电影在线| 久久久久综合网| 欧美韩日一区二区三区四区| 综合在线观看色| 亚洲成人免费av| 美脚の诱脚舐め脚责91 | 精品99一区二区三区| 欧美一区二区三区的| 久久久久久久久久久久电影| 中文字幕中文字幕一区| 亚洲精品高清在线| 日本女优在线视频一区二区| 国产激情一区二区三区四区 | 美日韩黄色大片| 国产91精品精华液一区二区三区| 色综合激情久久| 亚洲精品一区二区在线观看| 一区二区三区国产豹纹内裤在线| 欧美aⅴ一区二区三区视频| 91视频一区二区| 26uuuu精品一区二区| 日本成人在线电影网| 色综合久久综合网97色综合| 久久婷婷国产综合国色天香| 亚洲成av人片在线观看无码| 色婷婷综合久久久中文一区二区 | 99这里只有精品| 久久久国产综合精品女国产盗摄| 青娱乐精品在线视频| 欧美日韩免费视频| 亚洲精品视频一区| 波多野结衣中文一区| 日本一区二区电影| 国产99久久久国产精品潘金 | 日韩一级片在线播放| 亚洲青青青在线视频| 99精品欧美一区二区蜜桃免费| 亚洲国产成人私人影院tom| 国产精品系列在线播放| 国产日韩欧美精品一区| 成人动漫中文字幕| 亚洲欧美日韩精品久久久久| 9i在线看片成人免费| 亚洲综合一区二区精品导航| 欧美性一二三区| 奇米色一区二区| 国产欧美日韩综合| 99视频有精品| 日本视频一区二区三区| 久久久久久久精| 欧美午夜不卡视频| 国产精品乡下勾搭老头1| 亚洲综合在线视频| 欧美成人精品高清在线播放| 99久久免费精品| 奇米精品一区二区三区在线观看 | 欧美亚洲国产bt| 精品一区二区久久| 一区二区三区高清在线| 26uuu国产一区二区三区| 欧美伊人久久久久久午夜久久久久| 免费观看久久久4p| 亚洲黄色免费网站| 精品久久一区二区| 欧美麻豆精品久久久久久| 国产成人在线色| 韩国视频一区二区| 丝袜美腿亚洲综合| 亚洲欧美日韩中文播放| 久久精品日产第一区二区三区高清版| 日本国产一区二区| 99精品国产热久久91蜜凸| 国产在线精品不卡| 精品一区二区三区蜜桃| 亚洲成人第一页| 亚洲午夜国产一区99re久久| 国产精品不卡在线| 国产精品不卡在线| 国产精品久久久久精k8 | 在线观看一区二区视频| 成人av资源在线| 99久久久久免费精品国产| 成人午夜激情视频| av电影在线观看不卡| 99视频精品全部免费在线| 成人禁用看黄a在线| 不卡av电影在线播放| 91捆绑美女网站| 在线观看视频一区二区欧美日韩| 97精品电影院| 色系网站成人免费| 7799精品视频| 欧美精品乱人伦久久久久久| 欧美日本一道本| 国产亚洲一本大道中文在线| 国产精品女主播av| 亚洲综合色噜噜狠狠| 日韩高清在线电影| 国产一区二区三区免费在线观看 | 亚洲欧洲成人av每日更新| 亚洲美女偷拍久久| 精品亚洲欧美一区| 一道本成人在线| 国产欧美中文在线| 亚洲成人先锋电影| 成人手机电影网| 日韩欧美亚洲国产另类| 亚洲日本在线视频观看| 精品一区二区三区久久| 欧美主播一区二区三区美女| 国产亚洲欧洲997久久综合 |