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

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

?? flashutil.c

?? 采用ST20 CPU的機頂盒的燒寫程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*
 * File     : flashutil.c
 * Synopsys : FLASH utilities.
 *
 * Copyright (c) 2003-2007 STMicroelectronics Limited. All right reserved.
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <os21.h>

/*
 * Define device specific macro based on platform type;
 * should be removed when defined externally.
 */
#if defined(__st200__)
#if defined(__mb379__) || defined(__mb392__)
#define __stm8000__
#elif defined(__mb385__)
#define __stm5700__
#elif defined(__mb390__) || defined(__mb424__) || defined(__mb435__)
#define __stb5301__
#elif defined(__mb421__) || defined(__mb426__)
#define __stm8010__
#elif defined(__mb428__)
#define __stx5525__
#endif /* board types */
#else /* !__st200__ */
#include <boardreg.h>
#if defined(__db457__) || defined(__mb293__) || defined(__mb350__) || defined(__mb360__) || defined(__mb374__)
#define __st40ra__
#elif defined(__mb317a__) || defined(__mb317b__) || defined(__mediaref__)
#define __st40gx1__
#elif defined(__espresso__) || defined(__mb376__)
#define __sti5528__
#elif defined(__mb379__) || defined(__mb392__) || defined(__tmmidr04__) || defined(__tmmlr1__) || defined(__tmmlr2__)
#define __stm8000__
#elif defined(__mb411__) || defined(__mb411stb7100__) || defined(__mb442__) || defined(__mb442stb7100__) || defined(__stb7100ref__)
#define __stb7100__
#elif defined(__mb411stb7109__) || defined(__mb442stb7109__) || defined(__mb448__)
#define __stb7109__
#elif defined(__mb422__)
#define __std2000__
#elif defined(__mb519__)
#define __sti7200__
#elif defined(__mb521__)
#define __stv0498__
#elif defined(__mb548__)
#define __std1000__
#endif /* platform types */
#endif /* __st200__ */

#include "flash.h"
#ifdef __ST231__
#include "tlbhelper.h"
#endif /* __ST231__ */

#define ST_ID16                    0x00000020
#define ST_ID                      0x00200020
#define AMD_ID16                   0x00000001
#define AMD_ID                     0x00010001
#define INTEL_ID16                 0x00000089
#define INTEL_ID                   0x00890089
#define MICRON_ID16                0x0000002C
#define MICRON_ID                  0x002C002C
#define SPANSION_ID 0x01

#define BLOCK_ERASE_TIMEOUT        10
#define UNPROTECT_TIMEOUT          10
#define WRITE_TIMEOUT              10
#define CHIP_ERASE_TIMEOUT         60
#define PAUSE_PERIOD               (time_ticks_per_sec () / 2)

/*
 * Flash commands
 */
#define CMD_ERASE_SETUP            0x00200020
#define CMD_PROGRAM_SETUP          0x00400040
#define CMD_CLEAR_STATUS_REG       0x00500050
#define CMD_READ_ESIG              0x00900090
#define CMD_CONFIRM                0x00D000D0
#define CMD_PROTECTION_SETUP       0x00600060
#define CMD_READ_STATUS_REG        0x00700070
#define CMD_READ_ARRAY             0x00FF00FF

#define CMD_ERASE_SETUP16          0x00000020
#define CMD_PROGRAM_SETUP16        0x00000040
#define CMD_CLEAR_STATUS_REG16     0x00000050
#define CMD_READ_ESIG16            0x00000090
#define CMD_CONFIRM16              0x000000D0
#define CMD_PROTECTION_SETUP16     0x00000060
#define CMD_READ_STATUS_REG16      0x00000070
#define CMD_READ_ARRAY16           0x000000FF

/*
 * Status register bits
 */
#define PECS_STATUS_BIT            0x00800080
#define STATUS_MASK                0x00FE00FE
#define PROTECT_STATUS_BIT         0x00010001
#define VPP_STATUS_BIT             0x00080008
#define ESS_STATUS_BIT             0x00400040
#define ES_STATUS_BIT              0x00200020

#define PECS_STATUS_BIT16          0x00000080
#define STATUS_MASK16              0x000000FE
#define PROTECT_STATUS_BIT16       0x00000001
#define VPP_STATUS_BIT16           0x00000008
#define ESS_STATUS_BIT16           0x00000040
#define ES_STATUS_BIT16            0x00000020

/*
 * Polynomial value used for CRCs
 */
#define CRC_POLY                   0x04C14BD7

/* PIO setup macros - derived from OSPlus code (may be needed for VPP control) */
#define PIO_CFG_IN                 0x0
#define PIO_CFG_BIDIR              0x1
#define PIO_CFG_OUT                0x2
#define PIO_CFG_ALT_IN             0x5
#define PIO_CFG_ALT_OUT            0x6
#define PIO_CFG_ALT_BIDIR          0x7

#define PIO_CONFIGURE(BASE, BIT, MODE)\
  (*((volatile unsigned int*) (BASE+0x28)) = (1<<(BIT)));\
  (*((volatile unsigned int*) (BASE+0x38)) = (1<<(BIT)));\
  (*((volatile unsigned int*) (BASE+0x48)) = (1<<(BIT)));\
  (*((volatile unsigned int*) (BASE+0x24)) = (((MODE)&0x1)?1:0)<<(BIT));\
  (*((volatile unsigned int*) (BASE+0x34)) = (((MODE)&0x2)?1:0)<<(BIT));\
  (*((volatile unsigned int*) (BASE+0x44)) = (((MODE)&0x4)?1:0)<<(BIT));

/*
 * Local prototypes
 */
static void switchOnVDD(flashTarget_t* target);
static void switchOffVDD(flashTarget_t* target);
static void writeEnable(flashTarget_t* target);
static void writeDisable(flashTarget_t* target);
static void resetM29W(flashDevice_t* device);
static void resetM29W16(flashDevice_t* device);
static void resetM58LT16(flashDevice_t* device);
static void resetM58LW(flashDevice_t* device);
static void resetM58LW16(flashDevice_t* device);
static void blockUnprotectCFI16(flashDevice_t* device, unsigned int blockAddress);
static void blockUnprotectCFI(flashDevice_t* device, unsigned int blockAddress);
static void chipEraseM29W(flashTarget_t* target, flashDevice_t* device, flashProgress_t progressFn);
static void chipEraseSimple(flashTarget_t* target, flashDevice_t* device, flashProgress_t progressFn);
static void blockEraseM29W(flashDevice_t* device, unsigned int blockAddress);
static void blockEraseM29W16(flashDevice_t* device, unsigned int blockAddress);
static void blockEraseCFI16(flashDevice_t* device, unsigned int blockAddress);
static void blockEraseCFI(flashDevice_t* device, unsigned int blockAddress);
static void checkErase(flashDevice_t* device, unsigned int blockAddress);
static void showProgress(flashProgress_t progressFn, unsigned int done, unsigned int total);
static void writeWordM29W(flashDevice_t* device, unsigned int address, unsigned int value);
static void writeWordM29W16(flashDevice_t* device, unsigned int address, unsigned int value);
static void writeWordCFI(flashDevice_t* device, unsigned int address, unsigned int value);
static void writeWordCFI16(flashDevice_t* device, unsigned int address, unsigned int value);
#if defined(__st200__)
#if defined(__stm8000__)
static void writeEnable_mb379(void);
static void writeDisable_mb379(void);
static void writeEnable_mb392(void);
static void writeDisable_mb392(void);
#elif defined(__stb5301__)
static void writeEnable_mb390(void);
static void writeDisable_mb390(void);
#elif defined(__stm8010__)
static void writeEnable_mb421(void);
static void writeDisable_mb421(void);
static void writeEnable_mb426(void);
static void writeDisable_mb426(void);
#elif defined(__stx5525__)
static void switchOnVDD_mb428(void);
static void switchOffVDD_mb428(void);
#endif
#else
#if defined(__st40ra__)
static void writeEnable_mb293(void);
static void writeDisable_mb293(void);
static void writeEnable_mb374(void);
static void writeDisable_mb374(void);
#elif defined(__st40gx1__)
static void switchOnVDD_mb317(void);
static void switchOffVDD_mb317(void);
#elif defined(__sti5528__)
static void writeEnable_mb376(void);
static void writeDisable_mb376(void);
static void switchOnVDD_mb376(void);
static void switchOffVDD_mb376(void);
#elif defined(__stm8000__)
static void writeEnable_mb379(void);
static void writeDisable_mb379(void);
static void writeEnable_mb392(void);
static void writeDisable_mb392(void);
static void writeEnable_tmmidr04(void);
static void writeDisable_tmmidr04(void);
static void writeEnable_tmmlr2(void);
static void writeDisable_tmmlr2(void);
#elif defined(__stb7100__) || defined(__stb7109__)
static void writeEnable_mb411(void);
static void writeDisable_mb411(void);
#elif defined(__sti7200__)
static void writeEnable_mb519(void);
static void writeDisable_mb519(void);
#endif
#endif

/*
 * Block layout of the FLASH parts used on our boards
 *
 * These are address and size pairs. Read the tables
 * as 'addresses below this are broken up into blocks
 * of this size'.
 */
static flashBlockInfo_t M58LT256GT_blockInfo[] = {
  {0x1FE0000, 0x20000},
  {0x2000000, 0x08000},
  {0x0000000, 0x00000}
};

static flashBlockInfo_t M58LT128GSB_blockInfo[] = {
  {0x0020000, 0x08000},
  {0x1000000, 0x20000},
  {0x0000000, 0x00000}
};

static flashBlockInfo_t M29W160BT_blockInfo[] = {
  {0x3E0000, 0x20000},
  {0x3F0000, 0x10000},
  {0x3F8000, 0x04000},
  {0x400000, 0x08000},
  {0x000000, 0x00000}
};

static flashBlockInfo_t M29W160BB_blockInfo[] = {
  {0x008000, 0x08000},
  {0x010000, 0x04000},
  {0x020000, 0x10000},
  {0x400000, 0x20000},
  {0x000000, 0x00000}
};

static flashBlockInfo_t M28W320CB_blockInfo[] = {
  {0x7E0000, 0x20000},
  {0x800000, 0x04000},
  {0x000000, 0x00000}
};

static flashBlockInfo_t E28F640J3A_blockInfo[] = {
  {0x1000000, 0x40000},
  {0x0000000, 0x00000}
};

static flashBlockInfo_t E28F640J3A16_blockInfo[] = {
  {0x0800000, 0x20000},
  {0x0000000, 0x00000}
};

static flashBlockInfo_t M58LW064C_blockInfo[] = {
  {0x800000, 0x20000},
  {0x000000, 0x00000}
};

static flashBlockInfo_t M58LW032A_blockInfo[] = {
  {0x800000, 0x20000},
  {0x000000, 0x00000}
};

/* This is for 2 M29DW324DB chips in parallel across the address bus */
static flashBlockInfo_t M29DW324DB_blockInfo[] = {
  {0x020000, 0x04000},
  {0x800000, 0x20000},
  {0x000000, 0x00000}
};

static flashBlockInfo_t M29DW324DB16_blockInfo[] = {
  {0x010000, 0x02000},
  {0x400000, 0x10000},
  {0x000000, 0x00000}
};

static flashBlockInfo_t M29KW064E_blockInfo[] = {
  {0x800000, 0x40000},
  {0x000000, 0x00000}
};

/* Used for M29W640DT and FT parts */
static flashBlockInfo_t M29W640DT_blockInfo[] = {
  {0x07F0000, 0x10000},
  {0x0800000, 0x02000},
  {0x0000000, 0x00000}
};

/* Used for M29W640DB and FB parts */
static flashBlockInfo_t M29W640DB_blockInfo[] = {
  {0x0010000, 0x02000},
  {0x0800000, 0x10000},
  {0x0000000, 0x00000}
};

static flashBlockInfo_t M29W320EB_blockInfo[] = {
  {0x0010000, 0x02000},
  {0x0400000, 0x10000},
  {0x0000000, 0x00000}
};

static flashBlockInfo_t M28W640FSUx16_blockInfo[] = {
  {0x0800000, 0x20000},
  {0x0000000, 0x00000}
};

/*
 * The list of support FLASH parts, and their attributes
 */
static flashDevice_t supportedDevices[] = {
  {
   M58LT256GT,
   "M58LT256GT",
   NULL,
   0x00008870,
   1024 * 1024 * 32,
   0,
   M58LT256GT_blockInfo,

   resetM58LT16,
   blockUnprotectCFI16,
   blockEraseCFI16,
   chipEraseSimple,
   writeWordCFI16
  },
  {
   M58LT256GT_ALT_ID,
   "M58LT256GT_ALT_ID",
   NULL,
   0x0000880D,
   1024 * 1024 * 32,
   0,
   M58LT256GT_blockInfo,

   resetM58LT16,
   blockUnprotectCFI16,
   blockEraseCFI16,
   chipEraseSimple,
   writeWordCFI16
  },
  {
   M58LT128GSB,
   "M58LT128GSB",
   NULL,
   0x000088C7,
   1024 * 1024 * 16,
   0,
   M58LT128GSB_blockInfo,

   resetM58LT16,
   blockUnprotectCFI16,
   blockEraseCFI16,
   chipEraseSimple,
   writeWordCFI16
  },
  {
   M29W160BT,
   "M29W160BT/DT",
   NULL,
   0x22C422C4,
   1024 * 1024 * 4,
   0,
   M29W160BT_blockInfo,

   resetM29W,
   NULL,
   blockEraseM29W,
   chipEraseM29W,
   writeWordM29W
  },
  {
   M29W160BB,
   "M29W160BB/DB",
   NULL,
   0x22492249,
   1024 * 1024 * 4,
   0,
   M29W160BB_blockInfo,

   resetM29W,
   NULL,
   blockEraseM29W,
   chipEraseM29W,
   writeWordM29W
  },
  {
   M29W640DT,
   "M29W640DT",
   NULL,
   0x000022DE,
   1024 * 1024 * 8,
   0,
   M29W640DT_blockInfo,

   resetM29W16,
   NULL,
   blockEraseM29W16,
   chipEraseM29W,
   writeWordM29W16
  },
  {
   M29W640DB,
   "M29W640DB",
   NULL,
   0x000022DF,
   1024 * 1024 * 8,
   0,
   M29W640DB_blockInfo,

   resetM29W16,
   NULL,
   blockEraseM29W16,
   chipEraseM29W,
   writeWordM29W16
  },
  {
   M29W640FT,
   "M29W640FT",
   NULL,
   0x000022ED,
   1024 * 1024 * 8,
   0,
   M29W640DT_blockInfo,

   resetM29W16,
   NULL,
   blockEraseM29W16,
   chipEraseM29W,
   writeWordM29W16
  },
  {
   M29W640FB,
   "M29W640FB",
   NULL,
   0x000022FD,
   1024 * 1024 * 8,
   0,
   M29W640DB_blockInfo,

   resetM29W16,
   NULL,
   blockEraseM29W16,
   chipEraseM29W,
   writeWordM29W16
  },
  {
   M29W320EB,
   "M29W320EB",
   NULL,
   0x00002257,
   1024 * 1024 * 4,
   0,
   M29W320EB_blockInfo,

   resetM29W16,
   NULL,
   blockEraseM29W16,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国欧美国产1区| 国产麻豆视频一区| 国产精品国产三级国产有无不卡| 91精品国产综合久久精品性色| 欧美综合视频在线观看| 在线日韩国产精品| 欧美肥胖老妇做爰| 欧美一区午夜视频在线观看| 欧美一区二区三区不卡| 精品国产亚洲在线| 久久久不卡网国产精品二区| 中文字幕精品一区二区三区精品| 中文字幕乱码日本亚洲一区二区| 中文字幕日韩一区二区| 亚洲精品美腿丝袜| 日韩av在线免费观看不卡| 国产在线精品一区二区三区不卡| 成人午夜激情在线| 日本韩国欧美一区二区三区| 欧美一卡2卡3卡4卡| 久久久亚洲国产美女国产盗摄 | 亚洲成人在线观看视频| 日本欧洲一区二区| 精品少妇一区二区三区在线视频| 久久网站最新地址| 亚洲婷婷国产精品电影人久久| 亚洲一级二级三级| 久久精品国产网站| 成人av手机在线观看| 欧美丝袜丝交足nylons图片| 欧美精品一区二区三区很污很色的| 日本一区二区不卡视频| 午夜激情久久久| 成人午夜电影小说| 欧美一区二区三区在线观看视频| 国产欧美视频一区二区| 丝袜亚洲精品中文字幕一区| 国产成人av一区二区三区在线| 欧美亚洲综合在线| 国产农村妇女精品| 天天综合天天做天天综合| 成人av电影免费观看| 91麻豆精品国产| 亚洲三级免费电影| 国产麻豆视频一区| 日韩一区二区在线观看| 亚洲欧美精品午睡沙发| 国产精品99久久久| 欧美一级片在线看| 一区二区三区中文免费| 丁香婷婷综合网| 精品国产91亚洲一区二区三区婷婷| 亚洲欧美日韩国产成人精品影院| 国产一区二区不卡| 日韩欧美美女一区二区三区| 一区二区三区欧美激情| 北条麻妃一区二区三区| 精品国产电影一区二区| 日韩经典中文字幕一区| 欧美三区在线视频| 一区二区高清在线| 色视频成人在线观看免| 亚洲欧美日韩国产综合| 91免费观看在线| 国产精品网站在线观看| 国产成人免费9x9x人网站视频| 日韩美女视频在线| 亚洲成人综合视频| 欧美三级电影精品| 亚洲高清免费观看| 欧美日本乱大交xxxxx| 亚洲国产综合视频在线观看| 色综合天天综合给合国产| 中文在线资源观看网站视频免费不卡 | 欧美日韩不卡视频| 亚洲午夜视频在线| 欧美日韩一区二区三区视频| 尤物在线观看一区| 欧美日韩国产美女| 免费高清成人在线| 久久中文娱乐网| 国产91精品精华液一区二区三区 | 亚洲欧美一区二区三区孕妇| 成人av免费网站| 自拍av一区二区三区| 色婷婷av一区二区| 午夜精品久久久久久久久久久| 91精品国产色综合久久ai换脸| 蜜桃视频一区二区三区| 久久人人爽爽爽人久久久| 成人午夜免费av| 一区二区三区日韩在线观看| 88在线观看91蜜桃国自产| 麻豆精品在线看| 国产精品私人影院| 欧美中文字幕一区| 麻豆免费看一区二区三区| 国产三级精品三级| 91小视频在线观看| 午夜视频一区二区三区| 日韩亚洲欧美在线观看| 成人亚洲精品久久久久软件| 一区二区三区在线播放| 欧美不卡一区二区三区四区| 成人动漫一区二区三区| 亚洲国产精品久久久久婷婷884 | 97久久精品人人爽人人爽蜜臀| 亚洲欧美视频在线观看视频| 欧美一区二区三区啪啪| av中文字幕一区| 日韩电影在线免费| 亚洲欧美在线高清| 欧美一区二区黄| 91一区二区在线| 久久99精品网久久| 亚洲国产精品久久人人爱| 国产网红主播福利一区二区| 在线电影国产精品| 波多野结衣一区二区三区 | 欧美性生活影院| 国产福利一区二区三区视频在线| 樱桃国产成人精品视频| 国产日韩成人精品| 日韩一二三区视频| 欧美日韩三级在线| av中文字幕亚洲| 国产乱码精品一区二区三区av| 亚洲一区二区三区四区在线 | 精品成人免费观看| 欧美日韩一区二区欧美激情| 成人网男人的天堂| 国产一区视频网站| 另类小说一区二区三区| 香蕉成人啪国产精品视频综合网| 国产精品久久久久久久久晋中| 精品日韩欧美一区二区| 精品视频999| 欧美中文字幕一区二区三区| 成人国产精品免费网站| 国产精品1区2区3区| 蜜臀av亚洲一区中文字幕| 亚洲尤物视频在线| 亚洲小说欧美激情另类| 亚洲人成在线播放网站岛国| 中文字幕一区二区三区四区不卡| 久久精品视频免费| 日本一区二区在线不卡| 国产三级一区二区| 欧美激情一区二区三区全黄| 久久综合狠狠综合久久综合88| 精品国产乱码久久久久久牛牛| 日韩亚洲欧美综合| 久久综合狠狠综合| 国产亚洲婷婷免费| 国产精品乱人伦| 亚洲免费资源在线播放| 一区二区三区中文字幕精品精品| 亚洲男同1069视频| 午夜精品久久久久久久久| 午夜久久福利影院| 韩国av一区二区三区四区| 国产精品亚洲人在线观看| 成人av网在线| 欧美在线观看你懂的| 制服丝袜国产精品| 久久免费电影网| 成人免费一区二区三区在线观看| 亚洲三级久久久| 日韩精品欧美成人高清一区二区| 精品一二线国产| 成人国产精品免费观看动漫| 在线看不卡av| 精品伦理精品一区| 最新欧美精品一区二区三区| 亚洲一区二区中文在线| 免费观看91视频大全| 成人激情文学综合网| 欧美在线视频日韩| 久久久五月婷婷| 亚洲激情男女视频| 精品一区二区三区免费毛片爱| 国v精品久久久网| 欧美日韩精品久久久| 久久精品一区八戒影视| 亚洲已满18点击进入久久| 国产呦精品一区二区三区网站| 91免费国产在线观看| 精品成人免费观看| 亚洲综合图片区| 成人午夜私人影院| 日韩亚洲欧美高清| 一区二区久久久| 国产成人免费xxxxxxxx| 欧美高清视频不卡网| 国产欧美一区二区在线观看| 亚洲va在线va天堂| av成人动漫在线观看| 精品国产伦一区二区三区观看方式 | 久久婷婷一区二区三区| 一个色综合网站|