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

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

?? flash.c

?? eCos1.31版
?? C
字號:
//==========================================================================////        flash.c////        ARM PID7 eval board FLASH program tool////==========================================================================//####COPYRIGHTBEGIN####//                                                                          // -------------------------------------------                              // The contents of this file are subject to the Red Hat eCos Public License // Version 1.1 (the "License"); you may not use this file except in         // compliance with the License.  You may obtain a copy of the License at    // http://www.redhat.com/                                                   //                                                                          // Software distributed under the License is distributed on an "AS IS"      // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the // License for the specific language governing rights and limitations under // the License.                                                             //                                                                          // The Original Code is eCos - Embedded Configurable Operating System,      // released September 30, 1998.                                             //                                                                          // The Initial Developer of the Original Code is Red Hat.                   // Portions created by Red Hat are                                          // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             // All Rights Reserved.                                                     // -------------------------------------------                              //                                                                          //####COPYRIGHTEND####//==========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):     gthomas// Contributors:  gthomas// Date:          1998-11-18// Description:   Tool used to program onboard FLASH image//####DESCRIPTIONEND####//// This program will program the FLASH on the PID board//#include <pkgconf/libc.h>   // Configuration header#include <cyg/kernel/kapi.h>#include <stdlib.h>#include <ctype.h>#include <cyg/infra/testcase.h>#include <sys/cstartup.h>#ifndef FALSE#define FALSE 0#define TRUE  1#endif#define SYNC_COUNT 63extern void diag_printf(const char *, ...);int identify_FLASH(void);void write_sector(int, char *);bool load_srecords(char (*readc)(), CYG_ADDRESS *start, int *size);char dbuf[256];char *raw = (char *)0x10000;char *flash_buffer = (char *)0x30000;int pos, len;// FUNCTIONSexternC voidcyg_package_start( void ){#ifdef CYGPKG_LIBC    cyg_iso_c_start();#else    (void)main(0, NULL);#endif} // cyg_package_start()char nextch(void){    return (raw[pos++]);}intmain( int argc, char *argv[] ){    int i, j, size;    CYG_ADDRESS entry;    char c;    diag_printf("FLASH here!\n");    while (identify_FLASH() == 0) {        diag_printf("... Please change FLASH jumper - hit C/R to continue:");        do {            hal_diag_read_char(&c);        } while ((c != '\r') && (c != '\n'));        diag_printf("\n");    } restart:    diag_printf("Ready file - hit C/R to continue:");    while (TRUE) {        hal_diag_read_char(&c);        if (c == '>') break;    }    i = 0;  j = 0;    while (1) {        hal_diag_read_char(&c);        if (c == '!') {            diag_printf("... Reset\n");            goto restart;        }        raw[i++] = c;        if (++j == SYNC_COUNT) {            hal_diag_write_char(c);            j = 0;        }        if (c == ':') break;    }    diag_printf("\n");    pos = 0;  len = i;    if (load_srecords(nextch, &entry, &size)) {        diag_printf("Read %x bytes, entry: %x\n", size, entry);        dump_buf(flash_buffer, 128);        diag_printf("\nData loaded - hit '!' to continue:");        while (TRUE) {            hal_diag_read_char(&c);            if (c == '!') break;        }        diag_printf("\n");        diag_printf("...Programming FLASH\n");        pos = 0;  i = 0;        while (pos < size) {            write_sector(i++, flash_buffer+pos);            pos += 256;        }    } else {        // Display buffer around failure                dump_buf(&raw[pos-32], 64);    }    diag_printf("All done!\n");    while (1) ;}// Adapted from ARM sample code#define SEQ_ADD1                0x5555#define SEQ_ADD2                0xAAAA#define START_CMD1              0xAA#define START_CMD2              0x55#define ID_CMD                  0x90#define PROG_CMD                0xA0#define STOP_CMD                0xF0#define MAN_ATMEL               0x1F#define ATMEL_AT29C040_ID       0X5B#define ATMEL_AT29C040A_ID      0XA4#define ATMEL_AT29C1024_ID      0X25#define ATMEL_SECTOR_SIZE       256#define ATMEL_MAX_SECTORS       2048int manuf_code, device_code, sector_size, max_no_of_sectors, word_mode;volatile char *FLASH = (volatile char *)0x04000000;intidentify_FLASH(void ){    // Enter Software Product Identification Mode    FLASH[SEQ_ADD1] = START_CMD1;    FLASH[SEQ_ADD2] = START_CMD2;    FLASH[SEQ_ADD1] = ID_CMD;    // Wait at least 10ms    cyg_thread_delay(2);    // Read Manufacturer and device code from the device    manuf_code = FLASH[0];    device_code = FLASH[1];    diag_printf("manuf: %x, device: %x\n", manuf_code, device_code);    // Exit Software Product Identification Mode    FLASH[SEQ_ADD1] = START_CMD1;    FLASH[SEQ_ADD2] = START_CMD2;    FLASH[SEQ_ADD1] = STOP_CMD;    // Wait at least 10ms    cyg_thread_delay(5);    if (manuf_code != MAN_ATMEL) {        diag_printf ( "Error: Wrong Manufaturer: %02x\n",manuf_code );        return (0);    }    switch (device_code) {    case  ATMEL_AT29C040A_ID:        diag_printf ("AT29C040A recognised\n");        sector_size = ATMEL_SECTOR_SIZE;        max_no_of_sectors = ATMEL_MAX_SECTORS;        word_mode = FALSE;        break;    case  ATMEL_AT29C1024_ID:        diag_printf ("AT29C1024 recognised\n");        sector_size = ATMEL_SECTOR_SIZE;        max_no_of_sectors = ATMEL_MAX_SECTORS;        word_mode = TRUE;        break;    default :        diag_printf ( "Error: Unsupported device: %02x\n", device_code);        return (0);    }    return (1);}voidwrite_sector(int num, char *buf){    int i, cnt;    volatile char *wrt = (volatile int *)&FLASH[num*sector_size];//    diag_printf("Writing to %08x\n", wrt);    // Enter Program Mode    FLASH[SEQ_ADD1] = START_CMD1;    FLASH[SEQ_ADD2] = START_CMD2;    FLASH[SEQ_ADD1] = PROG_CMD;    // Note: write bytes as longs regardless of bus width    for (i = 0;  i < sector_size;  i++) {        wrt[i] = buf[i];    }    // Wait for sector to program    cnt = 0;    i = sector_size - 1;    while (wrt[i] != buf[i]) {        if (cnt++ > 0x01000000) break;    }//    diag_printf("Out - i: %d, wrt[i] = %08X.%08X, buf[i] = %08X, count = %x\n", i, &wrt[i], wrt[i], buf[i], cnt);    // Verify    for (i = 0;  i < sector_size;  i++) {        for (cnt = 0;  cnt < 10;  cnt++) {            if (*wrt == *buf) break;            cyg_thread_delay(1);        }        if (cnt == 10) {            diag_printf("Can't program at 0x%08X: %02X not %02X\n", wrt, *wrt, *buf);        }        wrt++;  buf++;    }}// S-record download code - viciously 'adapted' from "kernel/src/sload/sload.c"/*---------------------------------------------------------------------------*//*////      An srecord looks like this://// byte count-+     address// start ---+ |        |       data        +- checksum//          | |        |                   |//        S01000006F6B692D746573742E73726563E4//        S315000448600000000000000000FC00005900000000E9//        S31A0004000023C1400037DE00F023604000377B009020825000348D//        S30B0004485A0000000000004E//        S70500040000F6////      S<type><length><address><data><checksum>////      Where //      - length (2 characters)//        is the number of bytes following upto the checksum. Note that//        this is not the number of chars following, since it takes two//        chars to represent a byte.//      - type (2 characters)//        is one of://        0) header record//        1) two byte address data record//        2) three byte address data record//        3) four byte address data record//        5) record containing the number of S1, S2, or S3 records//        7) four byte address termination record//        8) three byte address termination record//        9) two byte address termination record//       //      - address (4, 6, or 8 characters)//        is the start address of the data following, or in the case of//        a termination record, the start address of the image//      - data (0-2n characters)//        is the data.//      - checksum (2 characters)//        is the sum of all the raw byte data in the record, from the length//        upwards, modulo 256 and subtracted from 255.//// Useful S-records for testing purposes://   Start record://      S00B0000737461303030447563//   This sets the default address to be 0x02005000://      S31A020050002700801481C4E0B0A15000000100000091D02000018F//      S31A0200501500000001000000010000002700801881C4E2E4A150C1//      S311020080A42407070A090B0A0781050000E1//   Termination record://      S70502005000A8//*/#define S0      0#define S1      1#define S2      2#define S3      3#define S5      5#define S7      7#define S8      8#define S9      9/*---------------------------------------------------------------------------*/int hex2digit(char c){    if( c & 0x40 ) c += 9;;    return c &0x0f;    //    return ( c <= '9' ? c - '0' ://             c <= 'Z' ? c - 'A' + 10 ://             c - 'a' + 10);}/*---------------------------------------------------------------------------*/bool load_srecords(char (*readc)(),                    CYG_ADDRESS *start,                   int *size){    CYG_ADDRESS addr, load_addr;    int addrsize;    int length;    int i;    cyg_uint8 chksum, ochksum;    cyg_uint8 val;    cyg_uint8 *tdata;        char s;    char type;    char len0;    char len1;    bool first = true;        do {        // Skip whitespace characters until we find something that        // might be an 'S'.        do {            s = readc();        } while( s == '\r' || s == '\n' || s == ' ');        // Check that this is an S record        if( s != 'S' ) {            diag_printf("Invalid 'S' record\n");            return false;        }        // First 4 bytes are standard S + type + len        type = readc();        len0 = readc();        len1 = readc();                // decode the type        type = hex2digit(type);        // determine address size        switch (type) {        case S0:                        // start records have no address            addrsize = 0;            break;        case S1:                        // two byte address        case S9:            addrsize = 4;            break;        case S2:                        // 3 byte address        case S8:            addrsize = 6;            break;           case S3:                        // 4 byte address        case S7:            addrsize = 8;            break;        }        length  = hex2digit (len0) << 4;        length |= hex2digit (len1);        chksum = length;        // read the address        addr = 0;        for (i = 0; i < addrsize; i++) {            val = hex2digit(readc());            addr = (addr << 4) | val;        }        // calculate the checksum, which is done by the byte, not the digit        for (i = 0; i < addrsize*4; i += 8) {            chksum += ((addr >>  i) & 0xff);        }        // decide where to load this data        if (first && (type != S0)) {            load_addr = addr;            first = false;        }        // read the data and put it directly into memory where it belongs        tdata = (cyg_uint8 *)((addr - load_addr) + flash_buffer);        if (type < S7) {            *size = (addr - load_addr);        }        val = 0;        for (i = 0; i < ((length - 1) * 2) - addrsize; i += 2 ) {            val  = hex2digit (readc()) << 4;            val |= hex2digit (readc());            chksum += val;            if( type != S0 ) *tdata++ = val;            if (type < S7) *size = *size + 1;        }        // now get the old checksum        ochksum = hex2digit(readc()) << 4;        ochksum |= hex2digit(readc());        chksum = ~chksum;        if (chksum != ochksum) {            diag_printf("Bad checksum - addr: %x\n", addr);            return false;        }            } while( type < S7 );    *start = addr;    return true;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜久久久影院| 亚洲日本护士毛茸茸| 精品久久人人做人人爽| 欧美色图片你懂的| 在线精品视频一区二区三四| 欧美在线免费观看视频| 欧美人妖巨大在线| 精品国产乱码久久久久久老虎| 日韩一级精品视频在线观看| 日韩欧美在线影院| 2021久久国产精品不只是精品| 国产欧美视频一区二区三区| 中文字幕在线一区二区三区| 亚洲图片有声小说| 国产成人在线看| 在线看国产日韩| 欧美极品xxx| 青娱乐精品视频在线| 99精品视频一区| 欧美成人高清电影在线| 亚洲高清不卡在线| 成人精品高清在线| 久久中文娱乐网| 国内精品伊人久久久久影院对白| 一本色道亚洲精品aⅴ| 久久久五月婷婷| 久久精品国产网站| 7777精品伊人久久久大香线蕉完整版| 国产精品乱子久久久久| 粉嫩aⅴ一区二区三区四区五区| 欧美无砖砖区免费| 亚洲成人黄色小说| 欧美精品免费视频| 青青草原综合久久大伊人精品 | 欧美日韩视频在线观看一区二区三区| 久久亚洲春色中文字幕久久久| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美精品亚洲二区| 狠狠色丁香久久婷婷综合_中| 欧美高清激情brazzers| 奇米777欧美一区二区| 日韩精品一区二区三区四区视频 | 久久精品综合网| 麻豆精品一区二区| 欧美一二区视频| 国产一区二区三区蝌蚪| 欧美韩国日本一区| 91亚洲大成网污www| 偷窥国产亚洲免费视频| 欧美α欧美αv大片| 97久久超碰国产精品电影| 亚洲综合av网| 国产精品人妖ts系列视频| 91论坛在线播放| 国产制服丝袜一区| 一个色妞综合视频在线观看| 69堂国产成人免费视频| 成人免费电影视频| 全国精品久久少妇| 国产日韩欧美精品在线| 欧美日韩夫妻久久| 91蜜桃视频在线| 粉嫩av一区二区三区粉嫩| 日本亚洲电影天堂| 亚洲精品在线免费播放| 91国产精品成人| 成人视屏免费看| 国产自产v一区二区三区c| 亚洲线精品一区二区三区八戒| 国产午夜精品久久久久久久| 欧美日韩精品欧美日韩精品一综合| 成人污污视频在线观看| 国产乱淫av一区二区三区| 天堂久久久久va久久久久| 制服视频三区第一页精品| 91高清视频免费看| 欧洲av在线精品| 欧美日韩中文另类| 欧美日韩国产片| 日韩精品中文字幕一区 | 亚洲综合在线五月| 国产精品高清亚洲| 亚洲人午夜精品天堂一二香蕉| 中文字幕中文字幕一区二区| 国产精品色眯眯| 自拍偷拍欧美激情| 亚洲视频免费观看| 亚洲久草在线视频| 亚洲成人一二三| 激情综合色播五月| 成人动漫在线一区| 欧洲激情一区二区| www日韩大片| 亚洲欧美综合另类在线卡通| 亚洲乱码国产乱码精品精小说 | 在线不卡免费av| 久久蜜桃香蕉精品一区二区三区| 欧美经典一区二区| 一区二区三区av电影| 久久99久久久欧美国产| 波多野结衣精品在线| 在线播放欧美女士性生活| 色综合久久综合网欧美综合网| 欧美日韩在线免费视频| 日本一区二区免费在线观看视频| 性久久久久久久久久久久| 成人免费av网站| 欧美va在线播放| 亚洲伦在线观看| 福利一区二区在线| 久久亚洲一区二区三区四区| 亚洲另类春色国产| 99re这里只有精品视频首页| 久久蜜桃一区二区| 免费看欧美美女黄的网站| 一本大道久久a久久综合| 久久精品日产第一区二区三区高清版 | 国产精品成人一区二区三区夜夜夜| 日韩综合小视频| 在线亚洲精品福利网址导航| 欧美国产日韩一二三区| 国产福利一区二区| 久久夜色精品国产噜噜av| 麻豆国产精品官网| 欧美不卡一区二区三区| 蜜桃视频在线观看一区| 在线不卡中文字幕播放| 午夜精品福利一区二区三区av| 一本色道a无线码一区v| 一区二区三区四区乱视频| 色哟哟国产精品| 亚洲第一久久影院| 欧洲在线/亚洲| 午夜不卡av在线| 91精品久久久久久久久99蜜臂| 亚洲狼人国产精品| 在线观看91av| 日本三级韩国三级欧美三级| 欧美电影在哪看比较好| 国内精品不卡在线| 中文字幕一区在线观看视频| 国产福利电影一区二区三区| 亚洲欧美激情在线| 日韩一区二区三区电影| 国产91色综合久久免费分享| 亚洲美女视频一区| 日韩美女一区二区三区四区| 国产在线麻豆精品观看| 中文字幕中文乱码欧美一区二区| 色域天天综合网| 久久国产精品色婷婷| 中文字幕一区在线| 久久先锋影音av鲁色资源| 91成人免费网站| 国产不卡视频在线观看| 日本免费新一区视频| 中国色在线观看另类| 91精品国产麻豆| 日本福利一区二区| av在线播放不卡| 国产成人一区二区精品非洲| 亚洲mv在线观看| 亚洲乱码一区二区三区在线观看| 精品毛片乱码1区2区3区| 欧美性感一区二区三区| 东方aⅴ免费观看久久av| 精品亚洲欧美一区| 美女爽到高潮91| 蜜臀99久久精品久久久久久软件| 一区二区三区日韩精品| 中文字幕一区三区| 日韩理论片一区二区| |精品福利一区二区三区| 久久久精品tv| 国产精品久久久久久户外露出 | 亚洲一区二区四区蜜桃| 亚洲国产精品久久人人爱蜜臀| 亚洲日本青草视频在线怡红院| 一区二区免费在线播放| 日韩精品国产欧美| 国产成人精品亚洲777人妖| 成人中文字幕电影| 97精品超碰一区二区三区| 欧美影院午夜播放| 国产日韩精品一区二区三区| 日韩毛片视频在线看| 免费看欧美女人艹b| 95精品视频在线| 久久久国产精品麻豆| 天天综合天天综合色| 波多野结衣亚洲| 久久人人97超碰com| 亚洲国产视频网站| 成人福利视频网站| 欧美成人bangbros| 亚洲女同女同女同女同女同69| 一区二区日韩av| 国产资源在线一区| 欧美一区二区视频在线观看2020 | 中文字幕av一区 二区|