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

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

?? flashmem.c

?? IXP425的BSP代碼
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/* flashMem.c - Flash memory device driver *//* Copyright 1984-2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01o,15feb01,frf  merged latest contribution, added support for                 28F128J3A, 28F320J3A, 28F640J3A and 29LV040B.01n,23mar00,zl   added support for 29LV160B/T. added sysSectorErase().01m,01feb00,jpd  added support for 28F320. SPR 3129301l,09sep98,jpd  added support for 28F016SV; minor doc fixes.01k,20apr98,jpd  moved back into main source tree from local copy in BSPs.01j,24mar98,jpd  added support for 29LV1024 and 29C040A.01i,04jul97,jpd  added support for 28F008 device, made overlay buffer dynamic.01h,25jun96,map  added documentation, and some clean up.01g,02apr96,tam  cast FLASH_ADRS and FLASH_SIZE to UINT32 to get rid off                 a compiler warning.01f,12feb96,kkk  made 1st param of sysFlashDataPoll() volatile to confirm                 to dzb's change.01e,26jan96,dzb  added volatile to register pointers.           +jpb  changed delay parameters to be globals if not defined.01d,24feb94,dzb  added sysFlashWrite{En,Dis}able(), sysFlashBoardDelay().01c,15feb94,dzb  added SYS_FLASH_DELAY_SHIFT macro.01b,07jan94,dzb  added support for 29F0X0 flash devices.                 cut ties to NVRAM macros.  added support for FLASH_WIDTH.01a,05oct93,dzb  derived from version 1b of mem/iFlashMem.c.*//*DESCRIPTIONThis library contains routines to manipulate flash memory.  Read and writeroutines are included.The macro values FLASH_ADRS, FLASH_SIZE, and FLASH_WIDTH must be defined toindicate the address, size (in bytes), and the data-access width (in bytes) ofthe flash memory.If the flash memory needs to be overlaid, and the section of the memory thatneeds to be overlaid is less than FLASH_SIZE, then, for efficiency, defineFLASH_SIZE_WRITABLE to the size (in bytes) of the overlay section.The routine sysFlashDelay() creates a delay for a specified number ofmicroseconds.  The timing loop can be adjusted on a board-dependent basis bydefining the function sysFlashBoardDelay and values for the following macros,.iPSYS_FLASH_DELAY_SHIFT.iPSYS_FLASH_DELAY_ADJ.iPSYS_FLASH_DELAY_INCR.LPTo use the routine sysFlashBoardDelay(), the macro SYS_FLASH_BOARD_DELAYshould be defined.The macro FLASH_NO_OVERLAY should be defined when calls to sysFlashSet()are expected to erase the flash and reprogram it with only the new data.The macro SYS_FLASH_TYPE should be defined for flash devices that cannot beauto-selected. This macro should be set to a flash device code defined in theheader files, <drv/mem/flash28.h> and <drv/mem/flash29.h>To support flash devices that that need to turn on/off write protect features(special programming voltages or other write-enable features), the macroSYS_FLASH_WRITE, and the routines, sysFlashWriteEnable() andsysFlashFlashWriteDisable() should be defined.INTERNAL:The FLASH_SIZE_WRITABLE concept doesn't work very well.  It just limits theamount of flash that is writable, so why bother.  What it was reallyintended to address was flash that is only block writable, i.e. youcan only write a complete block at a time.  To properly handle blockmemory, you must copy the old block of memory to a buffer, update thepart of the buffer that is to be changed, and then write back thecomplete buffer in a single write operation.The accesses to non-volatile memory, and flash control registers needsto be abstracted.  Macros should be used for all actual i/o operations.*/#include "drv/mem/flashDev.h"#include "drv/mem/flash28.h"#include "drv/mem/flash29.h"/* defines *//* Establish default values for DELAY parameters */#ifndef	SYS_FLASH_DELAY_SHIFT#   define	SYS_FLASH_DELAY_SHIFT 0#endif /*SYS_FLASH_DELAY_SHIFT*/#ifndef	SYS_FLASH_DELAY_ADJ#   define	SYS_FLASH_DELAY_ADJ 0#endif	/* SYS_FLASH_DELAY_ADJ */#ifndef	SYS_FLASH_DELAY_INCR#   define	SYS_FLASH_DELAY_INCR 1#endif	/* SYS_FLASH_DELAY_INCR *//* Names of routines, or null values */#ifdef	SYS_FLASH_WRITE#   define SYS_FLASH_WRITE_ENABLE_RTN()	sysFlashWriteEnable ()#   define SYS_FLASH_WRITE_DISABLE_RTN() sysFlashWriteDisable ()#else#   define SYS_FLASH_WRITE_ENABLE_RTN()#   define SYS_FLASH_WRITE_DISABLE_RTN()#endif	/* SYS_FLASH_WRITE */#ifdef	SYS_FLASH_BOARD_DELAY#   define SYS_FLASH_BOARD_DELAY_RTN()	sysFlashBoardDelay ()#else#   define SYS_FLASH_BOARD_DELAY_RTN()#endif	/* SYS_FLASH_BOARD_DELAY */#ifdef SYS_FLASH_TYPE#   define FLASH_MEM_TYPE		SYS_FLASH_TYPE#else#   define FLASH_MEM_TYPE		0#endif	/* SYS_FLASH_TYPE */#ifdef FLASH_SIZE_WRITEABLE#   define FLASH_MEM_SIZE		FLASH_SIZE_WRITEABLE#else#   define FLASH_MEM_SIZE		FLASH_SIZE#endif	/* FLASH_SIZE_WRITEABLE *//* Operation status bits for Flash 29Fxxx devices */#define Q7(ix)		((ix & 0x80) >> 7)	/* DQ7 bit */#define Q5(ix)		((ix & 0x20) >> 5)	/* DQ5 bit *//* globals */IMPORT	void sysFlashWriteEnable (void);IMPORT	void sysFlashWriteDisable (void);IMPORT	void sysFlashBoardDelay (void);int	flashDelayShift	= SYS_FLASH_DELAY_SHIFT;int	flashDelayAdj	= SYS_FLASH_DELAY_ADJ;int	flashDelayIncr	= SYS_FLASH_DELAY_INCR;static UINT8 flashType = FLASH_MEM_TYPE;/* forward declarations */void	sysFlashDelay (int delayCount);STATUS	sysFlashDataPoll (volatile FLASH_DEF * pFA, FLASH_DEF value);STATUS	sysFlashWrite (FLASH_DEF * pFB, int size, int offset,                       UINT8 flashType, FLASH_DEF value);STATUS sysFlashUnlock ( FLASH_DEF * pFA,  UINT8 flashType);STATUS sysFlashLock(FLASH_DEF * pFA, UINT8 flashType);UINT8	sysFlashTypeGet (void);STATUS sysFlashNextBlock(UINT32 * flash_offset);/******************************************************************************** sysFlashGet - get the contents of flash memory** This routine copies the contents of flash memory into a specified* string.  The string is terminated with an EOS.** RETURNS: OK, or ERROR if access is outside the flash memory range.** SEE ALSO: sysFlashSet()** INTERNAL* If multiple tasks are calling sysFlashSet() and sysFlashGet(),* they should use a semaphore to ensure mutually exclusive access.*/STATUS sysFlashGet    (    char *	string,		/* where to copy flash memory      */    int		strLen,		/* maximum number of bytes to copy */    int		offset		/* byte offset into flash memory   */    )    {    if ((offset < 0) || (strLen < 0) || ((offset + strLen) > (FLASH_ADRS + FLASH_SIZE)))        return (ERROR);    bcopyBytes ((char *) (offset), string, strLen);    string [strLen] = EOS;    return (OK);    }/******************************************************************************** sysFlashDelay - create a delay for a specified number of microseconds** This routine implements a busy wait for a specified number of microseconds.* The timing loop can be adjusted on a board-dependent basis by* defining values for the following macros:* .iP* SYS_FLASH_DELAY_SHIFT* .iP* SYS_FLASH_DELAY_ADJ* .iP* SYS_FLASH_DELAY_INCR* .LP* The values SYS_FLASH_DELAY_SHIFT and SYS_FLASH_DELAY_ADJ* convert microseconds into a board-dependent tick-count.* This routine can call a user-defined hook, sysFlashBoardDelay(),* which creates a delay for a number of board-dependent ticks as* specified by SYS_FLASH_DELAY_INCR.  To use sysFlashBoardDelay(), define* SYS_FLASH_BOARD_DELAY in config.h.** RETURNS: N/A** SEE ALSO: sysFlashErase(), sysFlashWrite()*/void sysFlashDelay    (    int delayCount	/* number of uSec to delay */    )    {    int ix;    delayCount <<= flashDelayShift;	/* board-dependent shift */    delayCount += flashDelayAdj;		/* board-dependent addition */    for (ix = 0; ix < delayCount; ix += flashDelayIncr)        SYS_FLASH_BOARD_DELAY_RTN ();    }/******************************************************************************** sysFlashDataPoll - wait for a flash device operation to complete** This routine polls a specified address on a 29F\f2xxx\f1 flash device* until the device operation at that location completes or times out.** While a flash operation is in progress, a read on the device* returns on Q7 (data bit 7) the complement of the previous value of Q7.  Once* the flash operation has completed, the Q7 bit returns the true data* of the last write. Subsequent reads return the correct data in Q0-7.** The Q5 bit implements a timeout functionality.  When a currently* executing flash operation exceeds specified limits, the Q5 bit is set (to 1).** RETURNS: OK, or ERROR if the timeout (!Q5) occurs before the device operation* completes.** SEE ALSO: sysFlashErase(), sysFlashWrite()*/STATUS sysFlashDataPoll    (    volatile FLASH_DEF * pFA,	/* programmed address to poll */    FLASH_DEF value		/* data programmed to poll address */    )    {    STATUS retVal = OK;    volatile FLASH_POLL_DEF * pTest = (FLASH_POLL_DEF *) pFA;    volatile FLASH_POLL_DEF * pVal  = (FLASH_POLL_DEF *) &value;    int ix;			/* byte counter */    int vBit;			/* programmed value of DQ7 */    for (ix = (FLASH_WIDTH/FLASH_CHIP_WIDTH - 1); (ix >= 0 ) && (retVal == OK);             ix--, pTest++, pVal++)        {        vBit = Q7(*pVal);        while (Q7(*pTest) != vBit)            if (Q5(*pTest) == 1)	/* timeout ? */                break;        if (Q7(*pTest) != vBit)		/* check Q7 & Q5 race */            retVal = ERROR;        }    return (retVal);    }/******************************************************************************** sysFlashErase - erase the contents of a sector** This routine clears the contents of one sector in the flash memory.** Flash 29F\f2xxx\f1 devices are erased by writing the six-byte erase code* into specific address locations, which sets all byte locations to a high* value (0xFF).** RETURNS: OK, or ERROR if the contents of sector cannot be erased.*/STATUS sysFlashErase    (    FLASH_DEF * pFA,		/* Sector start address */    UINT8 flashType		/* type of flash memory on-board */    )    {    STATUS retVal = OK;    switch (flashType)        {	case (FLASH_28F640J3A):	case (FLASH_28F320J3A):	case (FLASH_28F128J3A):	    SYS_FLASH_WRITE_ENABLE_RTN ();		/* raise Vpp */            *pFA = FLASH28_CMD_ERASE_SETUP;		/* setup */            *pFA = FLASH28F008_CMD_ERASE;		/* erase */	    /* Check Write State Machine Status */	    do	      {	      } while ((*pFA & FLASH28F008_STAT_WSMS) != FLASH28F008_STAT_WSMS);	    /* Check Erase Error Status */           if (*pFA & (BIT(5) | BIT(4) | BIT(3) | BIT(1)))		{		*pFA = FLASH28F008_CMD_CLEAR_STATUS;		retVal = ERROR;		}            *pFA = FLASH28_CMD_RESET;	    SYS_FLASH_WRITE_DISABLE_RTN ();		/* lower Vpp */            break;        case (FLASH_29LV160T):        case (FLASH_29LV160B):	case (FLASH_29LV040B):    	    SYS_FLASH_WRITE_ENABLE_RTN ();		/* enable write */            *(FLASH_CAST FLASH29_REG_FIRST_CYCLE)  = FLASH29_CMD_FIRST;            *(FLASH_CAST FLASH29_REG_SECOND_CYCLE) = FLASH29_CMD_SECOND;            *(FLASH_CAST FLASH29_REG_FIRST_CYCLE)  = FLASH29_CMD_CHIP_ERASE;            *(FLASH_CAST FLASH29_REG_FIRST_CYCLE)  = FLASH29_CMD_FOURTH;            *(FLASH_CAST FLASH29_REG_SECOND_CYCLE) = FLASH29_CMD_FIFTH;            *pFA		  		   = FLASH29_CMD_SECTOR;            do {                retVal = sysFlashDataPoll (pFA, (FLASH_DEF) 0xffffffff);                } while ((*pFA != (FLASH_DEF) 0xffffffff) && (retVal == OK));	    SYS_FLASH_WRITE_DISABLE_RTN ();		/* disable write */	    break;        default:            retVal = ERROR;        }    return (retVal);    }/******************************************************************************** sysFlashWrite - write data to flash memory** This routine copies specified data of a specified length, <size>, into a* specified offset, <offset>, in the flash memory.  Data is passed as a string,* <pFB>, if not NULL.  If NULL, data is taken as a repeated sequence of* <value>.* The parameter <flashType> should be set to the flash device code.* The parameter <offset> must be appropriately aligned for the width of* the Flash devices in use.** Flash 28F\f2xxx\f1 devices are programmed by a sequence of operations:* .iP* set up device to write* .iP* perform write* .iP* verify the write* .LP** Flash 29F\f2xxx\f1 devices are programmed by a sequence of operations:* .iP* set up device to write* .iP* perform write* .iP* wait for the write to complete* .LP** RETURNS: OK, or ERROR if the write operation fails.** SEE ALSO: sysFlashSet()*/STATUS sysFlashWrite    (    FLASH_DEF *	pFB,		/* string to be copied; use <value> if NULL */    int		size,		/* size to program in bytes */    int		offset,		/* byte offset into flash memory */    UINT8	flashType,	/* type of flash memory on-board */    FLASH_DEF	value		/* value to program */    )    {    volatile FLASH_DEF * pFA;		/* flash address */    STATUS retVal = OK;    int ix;    int sectorSize = 128;    int twc = 2;	/* time for write completion */    switch (flashType)        {	case (FLASH_28F008):	case (FLASH_28F016):	case (FLASH_28F160):	case (FLASH_28F320):	    SYS_FLASH_WRITE_ENABLE_RTN ();		/* raise Vpp */            for (pFA = FLASH_CAST (offset); (pFA < FLASH_CAST                (size + offset)) && (retVal == OK); pFA++)		{		if (pFB != NULL)		    value = *pFB++;		*pFA = FLASH28_CMD_PROG_SETUP;	/* write setup */		*pFA = value;			/* data to write */		/* Check Write State Machine Status */		do		    {		    *pFA = FLASH28F008_CMD_READ_STATUS;		    }		while ((*pFA & FLASH28F008_STAT_WSMS) != FLASH28F008_STAT_WSMS);		/* Check Byte Write Error Status */		if (*pFA & (BIT(5) | BIT(4) | BIT(3) | BIT(1)))		    {		    *pFA = FLASH28F008_CMD_CLEAR_STATUS;		    retVal = ERROR;		    }		}            *pFA = FLASH28_CMD_RESET;	    SYS_FLASH_WRITE_DISABLE_RTN ();		/* lower Vpp */            break;	case (FLASH_28F320J3A):	    	case (FLASH_28F640J3A):	    	case (FLASH_28F128J3A):	     SYS_FLASH_WRITE_ENABLE_RTN ();		/* raise Vpp */	     for ( pFA = FLASH_CAST (offset);		   (pFA <FLASH_CAST (size + offset)) &&	       (retVal == OK);		   pFA++)	       {	       if (pFB != NULL)		 value = *pFB++;	       *pFA = FLASH28_CMD_PROG_SETUP;	/* write setup */	       *pFA = value;				/* data to write */	       /* Check Write State Machine Status */	       do		 {		 }	       while ((*pFA & FLASH28F008_STAT_WSMS) != FLASH28F008_STAT_WSMS);	       /* Check Byte Write Error Status */	                  if (*pFA & (BIT(5) | BIT(4) | BIT(3) | BIT(1)))		   {		   *pFA = FLASH28F008_CMD_CLEAR_STATUS;		   retVal = ERROR;		    }	       *pFA = FLASH28_CMD_RESET;	       }	     SYS_FLASH_WRITE_DISABLE_RTN ();		/* lower Vpp */	     break;        case (FLASH_28F256):        case (FLASH_28F512):        case (FLASH_28F010):        case (FLASH_28F020):            {	    SYS_FLASH_WRITE_ENABLE_RTN ();		/* raise Vpp */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久亚洲毛片| 中文字幕免费一区| 成人高清视频在线观看| 午夜免费久久看| 国产精品亲子伦对白| 91精品午夜视频| 91视频xxxx| 国产成人免费视频精品含羞草妖精| 天天影视色香欲综合网老头| 亚洲欧美成人一区二区三区| 久久久一区二区| 欧美一级日韩一级| 欧美午夜一区二区三区| 91丨porny丨蝌蚪视频| 国产美女在线精品| 蜜桃免费网站一区二区三区| 亚洲一区二区三区不卡国产欧美| 亚洲欧洲国产日本综合| 久久综合色鬼综合色| 在线看不卡av| 一本到不卡免费一区二区| 岛国精品在线观看| 国产精品18久久久久| 久久精品av麻豆的观看方式| 亚洲高清一区二区三区| 亚洲精品自拍动漫在线| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | av不卡在线播放| 国产大陆a不卡| 国产一区二区三区久久久| 青青青伊人色综合久久| 婷婷成人激情在线网| 亚洲五月六月丁香激情| 亚洲一卡二卡三卡四卡五卡| 亚洲免费观看高清| 亚洲一区影音先锋| 韩国精品在线观看| 久久草av在线| 精品中文字幕一区二区| 极品尤物av久久免费看| 狠狠色丁香久久婷婷综合_中| 日本va欧美va欧美va精品| 免费成人你懂的| 蜜桃视频第一区免费观看| 久久99国产精品久久99| 国产一区二区视频在线| 国产剧情av麻豆香蕉精品| 国产美女精品一区二区三区| 国产精品一区免费视频| 成人在线视频一区二区| 99久久免费精品| 在线观看av一区| 欧美一区二区精品久久911| 欧美白人最猛性xxxxx69交| 久久奇米777| 亚洲特级片在线| 亚洲一区二区三区中文字幕在线| 视频一区二区国产| 精品一区二区三区在线视频| 国产成人丝袜美腿| 91首页免费视频| 欧美裸体一区二区三区| 欧美一级日韩免费不卡| 久久久欧美精品sm网站| 亚洲色大成网站www久久九九| 亚洲一区在线免费观看| 青青青爽久久午夜综合久久午夜| 国产一区二区久久| 91麻豆文化传媒在线观看| 欧美精品乱人伦久久久久久| 精品国一区二区三区| 成人欧美一区二区三区视频网页 | 欧美精品乱码久久久久久按摩| 日韩午夜av电影| 国产精品婷婷午夜在线观看| 一区二区三区四区不卡在线 | 欧美日韩激情一区二区三区| 日韩欧美一区在线| 国产精品麻豆网站| 亚洲大片在线观看| 国产一区二区不卡在线| 一本高清dvd不卡在线观看| 欧美日韩激情一区二区三区| 国产日产欧产精品推荐色| 一区二区三区精品| 美女视频第一区二区三区免费观看网站| 国产一区二区三区香蕉| 欧洲一区在线观看| 久久久久久久久久电影| 亚洲一区二区在线免费看| 国产高清精品在线| 欧美日韩国产乱码电影| 国产精品人人做人人爽人人添| 奇米777欧美一区二区| 99久久久国产精品免费蜜臀| 精品美女一区二区| 亚洲国产中文字幕在线视频综合 | 日韩电影免费在线看| 97久久超碰精品国产| 日韩欧美第一区| 一区二区久久久久久| 成人一区二区视频| 日韩三级av在线播放| 一区二区三区毛片| 成人精品小蝌蚪| 日韩欧美国产麻豆| 亚洲 欧美综合在线网络| 国产91丝袜在线播放0| 日韩欧美专区在线| 亚洲综合清纯丝袜自拍| 日韩欧美在线综合网| 一区二区三区不卡视频在线观看 | 91丝袜国产在线播放| 精品国产3级a| 蜜桃精品视频在线| 欧美日韩高清一区二区| 亚洲综合久久久| 99精品国产视频| 中文字幕一区二区不卡| 国产一区二区精品久久91| 欧美一级免费大片| 日韩电影一二三区| 欧美丰满少妇xxxbbb| 亚洲午夜激情av| 精品视频在线免费| 亚洲一区二区视频在线观看| 91福利资源站| 亚洲已满18点击进入久久| 一本大道久久a久久综合| 一区在线观看视频| 91在线一区二区三区| 国产精品乱码妇女bbbb| 高清免费成人av| 国产欧美日韩视频在线观看| 国产一区二区三区美女| 国产性做久久久久久| 国产成人免费在线观看| 国产精品天美传媒| 成人丝袜高跟foot| 成人欧美一区二区三区黑人麻豆| 成人黄色电影在线 | 国产另类ts人妖一区二区| 精品国产污网站| 国产精品一区二区男女羞羞无遮挡| 精品成人私密视频| 国产精品456| 国产精品久久久久7777按摩 | 精品999在线播放| 国产精品一区二区不卡| 国产精品视频一二三| 9i在线看片成人免费| 亚洲免费av高清| 欧美另类videos死尸| 日韩高清在线不卡| 欧美电影免费观看高清完整版在线 | 色综合久久久久久久久久久| 国产精品影视天天线| 国产免费观看久久| 91亚洲午夜精品久久久久久| 亚洲一区二区免费视频| 日韩一区二区三区免费看| 激情深爱一区二区| 国产精品久久久一本精品 | 精品国产免费视频| 国产成人免费9x9x人网站视频| 亚洲欧洲精品一区二区三区不卡| 欧美亚洲国产一区二区三区 | 国产suv精品一区二区883| 亚洲另类在线一区| 欧美一级在线观看| 成人性色生活片| 天天亚洲美女在线视频| 久久久精品影视| 欧美三级资源在线| 国产高清不卡二三区| 亚洲影院久久精品| 国产亚洲欧美在线| 欧美日韩一区二区欧美激情| 久久9热精品视频| 亚洲日本韩国一区| 日韩精品资源二区在线| 99久久精品免费观看| 久久精品国内一区二区三区| 亚洲欧洲日产国产综合网| 日韩欧美不卡一区| 日本高清不卡一区| 韩国成人福利片在线播放| 亚洲精品免费播放| 2020国产成人综合网| 色一情一伦一子一伦一区| 麻豆精品视频在线观看视频| 亚洲女同女同女同女同女同69| 欧美一级理论片| 91碰在线视频| 国产精品自在欧美一区| 亚洲va欧美va人人爽| 亚洲欧洲精品天堂一级| 亚洲精品在线观看视频| 欧美午夜片在线看| 国产一区二区三区美女|