39VF160操作编程

贵州家电维修网 http://www.gz112.cn 2008-5-18 1:34:30 来源:贵阳蓝天整理

ABOUT THE SOFTWARE
This application note provides software driver examples for 39VF160,
16 Mbit Multi-Purpose Flash, that can be used in any microprocessor based
system.  Software driver examples used in this document.nbsputilize two programming
languages: (a) high -level "C" for broad platform support and (b) optimized x86
assembly language. In many cases, software driver routines can be inserted
"as is" into the main body of code being developed by the system software
developers. Extensive comments are included in each routine to describe the
function of each routine. The driver in "C" language can be used with many
microprocessors and microcontrollers, while the x86 assembly language provides
an optimized solution for x86 microprocessors.

ABOUT THE 39VF160

Companion product datasheets for the 39VF160 should be reviewed in
conjunction with this application note for a complete understanding of
the device.

Both the C and x86 assembly code in the document.nbspcontain the following routines, 
in this order:

Name                    Function
------------------------------------------------------------------
Check_SST_39VF160       Check manufacturer and device ID
CFI_Query               CFI Query Entry/Exit command sequence
Erase_Entire_Chip       Erase the contents of the entire chip
Erase_One_Sector        Erase a sector of 2048 word
Erase_One_Block         Erase a block of 32K word
Program_One_Word        Alter data in one word
Program_One_Sector      Alter data in 2048 word sector
Program_One_Block       Alter data in 32K word block
Check_Toggle_Ready      End of internal program or erase detection using
                        Toggle bit
Check_Data_Polling      End of internal program or erase detection using
                        Data# polling


"C" LANGUAGE DRIVERS

/***********************************************************************/
/* Copyright Silicon Storage Technology, Inc. (SST), 1994-2001         */
/* Example "C" language Driver of 39VF160 16 Mbit Multi-Purpose Flash  */
/* Nelson Wang, Silicon Storage Technology, Inc.                       */
/*                                                                     */
/* Revision 1.0, Sept. 12, 2001                                          */
/*                                                                     */
/* This file requires these external "timing"  routines:               */
/*                                                                     */
/*      1.)  Delay_150_Nano_Seconds                                    */
/*      2.)  Delay_25_Milli_Seconds                                    */
/*      3.)  Delay_100_Milli_Seconds                                   */
/***********************************************************************/

#define FALSE                   0
#define TRUE                    1

#define SECTOR_SIZE             2048    /* Must be 2048 words for 39VF160 */
#define BLOCK_SIZE              32768   /* Must be 32K words for 39VF160  */

#define SST_ID                  0xBF    /* SST Manufacturer‘s ID code   */
#define SST_39VF160             0x2782  /* SST 39VF160 device code      */

typedef unsigned char           BYTE;
typedef unsigned int            WORD;

/* -------------------------------------------------------------------- */
/*                       EXTERNAL ROUTINES                              */
/* -------------------------------------------------------------------- */

extern void     Delay_150_Nano_Seconds();
extern void     Delay_25_Milli_Seconds();
extern void     Delay_100_Milli_Seconds();


*************************************************************************/
/* PROCEDURE:   Check_SST_39VF160                                       */
/*                                                                      */
/* This procedure decides whether a physical hardware device has a      */
/* SST39VF160 16 Mbit Multi-Purpose Flash installed or not.             */
/*                                                                      */
/* Input:                                                               */
/*          None                                                        */
/*                                                                      */
/* Output:                                                              */
/*          return TRUE:  indicates a SST39VF160                        */
/*          return FALSE: indicates not a SST39VF160                    */
/************************************************************************/

int Check_SST_39VF160()
{
        WORD far *Temp;
        WORD SST_id1;
        WORD far *Temp1;
        WORD SST_id2;
        int  ReturnStatus;

        /*  Issue the Software Product ID code to 39VF160   */

        Temp1 = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp1= 0xAAAA;                 /* write data 0xAAAA to the address */
        Temp1 = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh  */
        *Temp1= 0x5555;                 /* write data 0x5555 to the address */
        Temp1 = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp1= 0x9090;                 /* write data 0x9090 to the address */

        Delay_150_Nano_Seconds();

        /* Read the product ID from 39VF160 */

        Temp  = (WORD far *)0xC0000000; /* set up address to be C000:0000h */
        SST_id1  =  *Temp;              /* get first ID word               */
        SST_id1  =  SST_id1 & 0xFF      /* mask of higher byte             */
        Temp1 = (WORD far *)0xC0000001;/* set up address to be C000:0001h  */
        SST_id2  =  *Temp1;             /* get second ID word              */

        /* Determine whether there is a SST39VF160 installed or not */

        if ((SST_id1 == SST_ID) && (SST_id2 ==SST_39VF160))
                ReturnStatus = TRUE;
        else
                ReturnStatus = FALSE;

        /* Issue the Soffware Product ID Exit code thus returning the 39VF160 */
        /* to the read operating mode                                         */

        Temp1  = (WORD far *)0xC0005555; /* set up address to be C000:5555h   */
        *Temp1 = 0xAAAA;                 /* write data 0xAAAA to the address  */
        Temp1  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh   */
        *Temp1 = 0x5555;                 /* write data 0x5555 to the address  */
        Temp1  = (WORD far *)0xC0005555; /* set up address to be C000:5555h   */
        *Temp1 = 0xF0F0;                 /* write data 0xF0F0 to the address  */

        Delay_150_Nano_Seconds();

        return(ReturnStatus);
}

*************************************************************************/
/* PROCEDURE:   CFI_Query                                               */
/*                                                                      */
/* This procedure should be used to query for CFI information           */
/*                                                                      */
/* Input:                                                               */
/*          None                                                        */
/*                                                                      */
/* Output:                                                              */
/*          None                                                        */
/************************************************************************/

int CFI_Query()
{
        WORD far *Temp1;

        /*  Issue the Software Product ID code to 39VF160   */

        Temp1 = (WORD far *)0xC0005555; /* set up address to be C000:5555h    */
        *Temp1= 0xAAAA;                 /* write data 0xAAAA to the address   */
        Temp1 = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh    */
        *Temp1= 0x5555;                 /* write data 0x5555 to the address   */
        Temp1 = (WORD far *)0xC0005555; /* set up address to be C000:5555h    */
        *Temp1= 0x9898;                 /* write data 0x9898 to the address   */

        Delay_150_Nano_Seconds();

        /* --------------------------------- */
        /*  Perform all CFI operations here  */
        /*  NOTE:  no sample code provided   */
        /* --------------------------------- */


        /* Issue the CFI Exit code thus returning the 39VF160  */
        /* to the read operating mode                          */

        Temp1  = (WORD far *)0xC0005555; /* set up address to be C000:5555h    */
        *Temp1 = 0xAAAA;                 /* write data 0xAAAA to the address   */
        Temp1  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh    */
        *Temp1 = 0x5555;                 /* write data 0x5555 to the address   */
        Temp1  = (WORD far *)0xC0005555; /* set up address to be C000:5555h    */
        *Temp1 = 0xF0F0;                 /* write data 0xF0F0 to the address   */

        Delay_150_Nano_Seconds();
}


*************************************************************************/
/* PROCEDURE:   Erase_Entire_Chip                                       */
/*                                                                      */
/* This procedure can be used to erase the entire chip.                 */
/*                                                                      */
/* Input:                                                               */
/*      NONE                                                            */
/*                                                                      */
/* Output:                                                              */
/*      NONE                                                            */
/************************************************************************/

int Erase_Entire_Chip
{
        WORD far *Temp;

        /*  Issue the Chip Erase command to 39VF160  */

        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0xAAAA;                 /* write data 0xAAAA to the address */
        Temp  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh  */
        *Temp = 0x5555;                 /* write data 0x5555 to the address */
        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0x8080;                 /* write data 0x8080 to the address */
        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0xAAAA;                 /* write data 0xAAAA to the address */
        Temp  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh  */
        *Temp = 0x5555;                 /* write data 0x5555 to the address */
        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0x1010;                 /* write data 0x1010 to the address */
        Delay_100_Milli_Seconds();      /* Delay Tsce time                  */
}

*************************************************************************/
/* PROCEDURE:   Erase_One_Sector                                        */
/*                                                                      */
/* This procedure can be used to erase a total of 2048 words.           */
/*                                                                      */
/* Input:                                                               */
/*      Dst     DESTINATION address which the erase operation starts    */
/*                                                                      */
/* Output:                                                              */
/*      NONE                                                            */
/************************************************************************/

int Erase_One_Sector (WORD far *Dst)
{
        WORD far *Temp;

        /*  Issue the Sector Erase command to 39VF160  */

        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0xAAAA;                 /* write data 0xAAAA to the address */
        Temp  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh  */
        *Temp = 0x5555;                 /* write data 0x5555 to the address */
        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0x8080;                 /* write data 0x8080 to the address */
        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0xAAAA;                 /* write data 0xAAAA to the address */
        Temp  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh  */
        *Temp = 0x5555;                 /* write data 0x5555 to the address */

        Temp  = Dst                     /* set up starting address to be erased */
        *Temp = 0x3030;                 /* write data 0x3030 to the address */
        Delay_25_Milli_Seconds();       /* Delay time = Tse                 */
}


*************************************************************************/
/* PROCEDURE:   Erase_One_Block                                         */
/*                                                                      */
/* This procedure can be used to erase a total of 32K words.            */
/*                                                                      */
/* Input:                                                               */
/*      Dst     DESTINATION address which the erase operation starts    */
/*                                                                      */
/* Output:                                                              */
/*      NONE                                                            */
/************************************************************************/

int Erase_One_Block (WORD far *Dst)
{
        WORD far *Temp;

        /*  Issue the Sector Erase command to 39VF160  */

        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0xAAAA;                 /* write data 0xAAAA to the address */
        Temp  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh  */
        *Temp = 0x5555;                 /* write data 0x5555 to the address */
        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0x8080;                 /* write data 0x8080 to the address */
        Temp  = (WORD far *)0xC0005555; /* set up address to be C000:5555h  */
        *Temp = 0xAAAA;                 /* write data 0xAAAA to the address */
        Temp  = (WORD far *)0xC0002AAA; /* set up address to be C000:2AAAh  */
        *Temp = 0x5555;                 /* write data 0x5555 to the address */

        Temp  = Dst                     /* set up starting address to be erased */
        *Temp = 0x5050;                 /* write data 0x5050 to the address */
        Delay_25_Milli_Seconds();       /* Delay time = Tbe                 */
}

/************************************************************************/
/* PROCEDURE:   Program_One_Word                                        */
/*                                                                      */
/* This procedure can be used to program ONE word of date to the        */
/* 39VF160.                                                             */
/*                                                                      */
/* NOTE:  It is VERY important the sector containing the word to be     */
/*        programmed was ERASED first.                                  */
/*                                                                      */
/* Input:                                                               */
/*   &am

】 【返回上一页】 【打 印】 【  
更多关于“39VF160操作编程”的学院文章
学院评论:(评论内容只代表网友观点,与本站立场无关!)

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码

版权及免责声明:


1 .贵州家电维修网所有内容的版权均属于作者或页面内声明的版权人。未经贵州家电维修网的许可,任何其他个人或组织均不得以任何形式将贵州家电维修网的各项资源转载、复制、编辑或发布使用于其他任何场合。

2 .已经本网授权使用作品的,应在授权范围内使用,并注明 “ 来源:贵州家电维修网” 。

3 .本网注明“ 来源:XXX (非贵州家电维修网)” 的作品,均转载自其他媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。

4 .因作品内容、版权和其他问题需要同本网联系的,请 30日内进行。

报修热线0851-85164808  
蓝天电器:是贵州家电维修网指定家电维修单位。蓝天电器技术人员均经过专业培训,对家电维修知识有着坚实的基础,并取得了维修家用电器的资格证书。多年来我部在各社区和单位的维修中赢得了社会各界的广泛认可。源于顾客的厚爱,蓝天电器本着“技术取胜 服务社会”的宗旨,对产品的维修质量有保证,服务有跟踪。为便捷顾客,蓝天电器提供上门服务,让顾客更省心、放心。
服务项目:各种彩电、功放、影碟、录象机等家庭影院。冰柜、空调、冷库、电冰箱等制冷设备。电脑、音箱、软件、显示器等电脑相关。风扇、电饭煲、洗衣机、微波炉、电热水器等家用电器。