⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flash.h

📁 flash驱动程序,Nor flash类型
💻 H
字号:
/* ############################################################################ (c) Copyright Virata Limited 1998## Virata Limited Confidential and Proprietary## The following software source code ("Software") is strictly confidential and# is proprietary to Virata Limited ("Virata").  It may only be read, used,# copied, adapted, modified or otherwise dealt with by you if you have# entered into a confidentiality agreement with Virata and then subject to the# terms of that confidentiality agreement and any other applicable agreement# between you and Virata.  If you are in any doubt as to whether you are# entitled to access, read, use, copy, adapt, modify or otherwise deal with# the Software or whether you are entitled to disclose the Software to any# other person you should contact Virata.  If you have not entered into a# confidentiality agreement with Virata granting access to this Software you# should forthwith return all media, copies and printed listings containing# the Software to Virata.## Virata reserves the right to take legal action against you should you breach# the above provisions.## If you are unsure, or to report violations, please contact# support@virata.com# ##########################################################################*//*********************************************************************** *                                                                     * *    ATMOS Flash Filing System header                                 * *                                                                     * *    FLASH.H                                                          * *                                                                     * ***********************************************************************/#ifndef	FLASH_H#define	FLASH_H/*** CtodocOption:    AllInternal*/#include <errno.h>#include <config.h>#include <flash_types.h>/*-------------------------------------------------------------------------*//*                                                                         *//* Type definitions                                                        *//*                                                                         *//*-------------------------------------------------------------------------*//*   FLASH_START_OFFSET defines the size of the area at the start of the   first flash chip which the boot image won't overwrite.   It defaults to the start of the second flash chip, but can be overridden*/#ifdef HYDROGEN    #define STRIDE             4              /* Addr increment for flash bytes */    #define FLASH_SIZE         (512*1024)                /* Size of flash chip  */    #define FLASH_OFFSET       HYDROGEN_FLASH_OFFSET     /* From hardware file. */    #define NUM_FLASH_DEVICES  HYDROGEN_NUM_FLASH_CHIPS  /* From hardware file. */    #ifndef FLASH_START_OFFSET        #define FLASH_START_OFFSET (8*1024)                  /* standard H2 offset  */    #endif    #define FLASH0      0x2f800000    #define FLASH0WRITE 0x3f800000      /* Allows CS before WR */    #if (NUM_FLASH_DEVICES == 2)        #define FLASH1      (FLASH0 + FLASH_OFFSET)        #define FLASH1WRITE (FLASH1WRITE + FLASH_OFFSET)    #endif #else   /* Not HYDROGEN */     #define STRIDE             1              /* Addr increment for flash bytes */    #define FLASH_SIZE         (512*1024)                /* Size of flash chip  */    #ifdef  ATMOICSLOW8        #define FLASH0             ATMOICSLOW8        #define FLASH1             (ATMOICSLOW8 + (1 << 24))    #endif    #if defined(FLASH4)        #define NUM_FLASH_DEVICES   5    #elif defined(FLASH3)        #define NUM_FLASH_DEVICES   4    #elif defined(FLASH2)        #define NUM_FLASH_DEVICES   3    #elif defined (FLASH1)        #define NUM_FLASH_DEVICES   2    #elif defined (FLASH0)        #define NUM_FLASH_DEVICES   1    #else        #define NUM_FLASH_DEVICES   0    #endif    #ifndef FLASH_START_OFFSET  /* If not defined, file area starts in 2nd chip */        #if (NUM_FLASH_DEVICES < 2)            #error "FLASH_START_OFFSET not set (system only has one flash chip)."        #else            #ifdef  FLASH0_SIZE                #define FLASH_START_OFFSET (FLASH0_SIZE)            #else                #define FLASH_START_OFFSET (FLASH_SIZE)            #endif        #endif    #endif#endif  /* Not HYDROGEN *//*** Set write addresses for flash chips if not already defined.** (Some hardware may require different write timings)*/#ifdef FLASH0    #ifndef FLASH0WRITE        #define FLASH0WRITE FLASH0    #endif        #ifndef FLASH0_16	#define FLASH0_16    0    #endif#endif #ifdef FLASH1    #ifndef FLASH1WRITE        #define FLASH1WRITE FLASH1    #endif    #ifndef FLASH1_16	#define FLASH1_16    0    #endif#endif #ifdef FLASH2    #ifndef FLASH2WRITE        #define FLASH2WRITE FLASH2    #endif        #ifndef FLASH2_16	#define FLASH2_16    0    #endif    #endif #ifdef FLASH3    #ifndef FLASH3WRITE        #define FLASH3WRITE FLASH3    #endif        #ifndef FLASH3_16	#define FLASH3_16    0    #endif    #endif #ifdef FLASH4    #ifndef FLASH4WRITE        #define FLASH4WRITE FLASH4    #endif        #ifndef FLASH4_16	#define FLASH4_16    0    #endif    #endif /*** Many systems just define "FLASH_SIZE" so propagate this as the size of ** each chip as required.*/#ifndef FLASH0_SIZE    #ifdef  FLASH0        #define FLASH0_SIZE FLASH_SIZE    #else        #define FLASH0_SIZE 0UL    #endif#endif#ifndef FLASH1_SIZE    #ifdef  FLASH1        #define FLASH1_SIZE FLASH_SIZE    #else        #define FLASH1_SIZE 0UL    #endif#endif#ifndef FLASH2_SIZE    #ifdef  FLASH2        #define FLASH2_SIZE FLASH_SIZE    #else        #define FLASH2_SIZE 0UL    #endif#endif#ifndef FLASH3_SIZE    #ifdef  FLASH3        #define FLASH3_SIZE FLASH_SIZE    #else        #define FLASH3_SIZE 0UL    #endif#endif#ifndef FLASH4_SIZE    #ifdef  FLASH4        #define FLASH4_SIZE FLASH_SIZE    #else        #define FLASH4_SIZE 0UL    #endif#endif/* In all systems */#define TOTAL_FLASH_SIZE   (FLASH0_SIZE + FLASH1_SIZE + FLASH2_SIZE + FLASH3_SIZE + FLASH4_SIZE)/*** Some systems have paged FLASH memory, others can access FLASH memory directly.*/#define FLASH_NOPAGE    0xff#if defined (FLASH0_PAGE) || defined (FLASH1_PAGE) || defined (FLASH2_PAGE) || defined (FLASH3_PAGE) || defined (FLASH4_PAGE)#define PAGED_FLASH     1#endif#ifndef FLASH0_PAGE    #define FLASH0_PAGE FLASH_NOPAGE#endif#ifndef FLASH1_PAGE    #define FLASH1_PAGE FLASH_NOPAGE#endif#ifndef FLASH2_PAGE    #define FLASH2_PAGE FLASH_NOPAGE#endif#ifndef FLASH3_PAGE    #define FLASH3_PAGE FLASH_NOPAGE#endif#ifndef FLASH4_PAGE    #define FLASH4_PAGE FLASH_NOPAGE#endif/*** Trace level testing macros*/#ifdef  BOOT_ROM#define TRACE1(_x...)       printf(_x)#define TRACE2(_x...)#define TRACE3(_x...)#define TRACE4(_x...)#else#define MAX_TRACE_LEVEL     4#define TRACE1(_x...)       if (flashfsTraceLevel < 1) ; else printf(_x)#define TRACE2(_x...)       if (flashfsTraceLevel < 2) ; else printf(_x)#define TRACE3(_x...)       if (flashfsTraceLevel < 3) ; else printf(_x)#define TRACE4(_x...)       if (flashfsTraceLevel < 4) ; else printf(_x)#endif/*-------------------------------------------------------------------------*//*                                                                         *//* Exported data                                                           *//*                                                                         *//*-------------------------------------------------------------------------*/extern U32 flashStartOffset;extern U32 flashfsSize;extern U32 flashfsTraceLevel;/*-------------------------------------------------------------------------*//*                                                                         *//* External function interface                                             *//*                                                                         *//*-------------------------------------------------------------------------*/#ifdef __cplusplusextern "C" {#endif /* __cplusplus */int  check_flash_chips_writable (void);BITS flash_checksum (U32 start, U32 len);void flash_config (void);void flash_display_chip_info (U32 device);void flash_erase (U32 start, U32 len);void flash_initialise (BOOL allocateAllowed);void flash_deinitialise (void);BITS flash_raw_read_word (U32 addr);void flash_read_data (U32 s, BYTE *d, U32 n);int  flash_ready_for_update (void);int  flash_sector_bounds (U32 address, U32 *start, U32 *end);U32  flash_total_size (U32 numberChips);int  flash_write_data (BYTE *s, U32 d, U32 n);int  program_sector (void);#ifdef __cplusplus}#endif /* __cplusplus */#endif/* flash.h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -