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

📄 lld.h

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 H
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************/
/************************* COMMIT INCORPORATED********************************/                                                                                     
/************************ COPYRIGHT INFORMATION *****************************                                                                                     
 This program contains proprietary information which is a trade secret of            
 COMMIT INCORPORATED and also is protected as an unpublished work under              
 applicable Copyright laws. Recipient is to retain this program in confidence        
 and is not permitted to use or make copies thereof other than as permitted          
 in a written agreement with COMMIT INCORPORATED.                                                                                     
******************************************************************************/                                                                                      
/*****************************************************************************       
Description:bit utility                                                                                      
 Create Date: Apr 20,2005     
 Department: HW. DRIVER
 PROJECT: VENUS
 Author: hw drivers/xuting                                                                 
*****************************************************************************
 History:                                                                            
 Date               Revision By               Comment 
Dec 1,2004 				              draft      
Apr 20,2005							
*****************************************************************************/   


#ifndef __INC_lldh
#define __INC_lldh

/* NOTICE
MirrorBit flash devices requires 4us from the time    
a programming command is issued before the data polling 
bits can be read.  Without the delay, it is likely
that you will read invalid status from the flash.
The invalid status may lead the software to believe
that programming finished early without problems or 
that programming failed.  If your system has more 
than 4us of delay inherently, you don't need any 
additional delay.  Otherwise, change the #undef to 
a #define
WAIT_4us_FOR_DATA_POLLING_BITS_TO_BECOME_ACTIVE
in lld.h.  Make sure your optimization does not          
remove the delay loop.  You must replace DELAY_4us    
with a value which makes sense for your system.       

It is possible to suspend the erase operation 
with such frequency that it is unable to complete 
the erase operation and eventually times-out.                                            
Change the #undef to #define PAUSE_BETWEEN_ERASE_SUSPENDS 
in lld.h if you are using erase suspend and the 
following is true.
Time between suspends is less that 10 milliseconds    
AND total number of suspends per erase can exceed 5000.         
Make sure that your optimization does not remove the  
delay loop.  You must replace DELAY_10ms with a value 
which make sense in your system.

If you are using MirrorBit devices, change the macro
#undef MIRRORBIT_DEVICE to #define MIRRORBIT_DEVICE.

If you will be doing suspends while erasing sectors, change
the macro #undef USING_ERASE_SUSPEND to
#define USING_ERASE_SUSPEND.  Upon completions of the
sector erase, check the first and last location of the sector 
to verify erasure.  In the event that either are not erased, 
re-issue the sector erase command.

For more information, visit our web site at www.spansion.com,
email us at software@spansion.com or go to www.ask.amd.com.
*/
#define WAIT_4us_FOR_DATA_POLLING_BITS_TO_BECOME_ACTIVE
#define PAUSE_BETWEEN_ERASE_SUSPENDS
#undef MIRRORBIT_DEVICE
#define	USING_ERASE_SUSPEND
//#define 	AMD_DRIVER_FLASH_FOR_SW

#ifdef __cplusplus
 extern "C" {
#endif /* __cplusplus */

#define Uint8		unsigned char
#define Uint16		unsigned short
#define uint16		unsigned short
#define Uint32		unsigned int
#define uint32		unsigned int
#define H_EBUF_SIZE  128 
/* LLD System Specific Typedefs */
typedef unsigned char  BYTE;   /* 8 bits wide */
typedef unsigned short WORD;   /* 16 bits wide */
typedef unsigned long  DWORD;  /* 32 bits wide */


/* LLD Internal Data Types */
typedef DWORD PARAM;     /* MUST be at least 32 bits wide */
typedef volatile unsigned short * ADDRESS;   /* Used for system level addressing */
typedef DWORD FLASHDATA; /* MUST be at least 32 bits wide */
typedef unsigned long BYTECOUNT;  /* used for multi-byte operations */


/* boolean macros */
#ifndef TRUE
 #define TRUE  (1)
#endif
#ifndef FALSE
 #define FALSE (0)
#endif


/* LLD Function Remapping */
#define MY_SPRINTF sprintf


/* LLD Return Values */
#define LLD_OK      (0)   /* good status */
#define LLD_ERROR   (-1)  /* bad status */


/* LLD Error Codes */
#define LLD_E_NO_ERROR                (0x00000000)
#define LLD_E_FLASH_INTERNAL_TIMEOUT  (0x00000001)
#define LLD_E_WRITE_BUFFER_LOAD_ERROR (0x00000020)
#define LLD_E_INVALID_PARAMETER       (0x00000040)
#define LLD_E_VERIFY_ERROR            (0x00000080)
#define LLD_E_INTERNAL_ERROR          (0x00000100)
#define LLD_E_HAL_ERROR               (0x00000200)

/* Data Bus Configurations */
#define A_MINUS_1        (0x0100)
#define MULTI_DEVICE_CFG (0x0200)

#define DEVICE_TYPE_MASK (0x000F)
#define X8_DEVICE        (0x0001)
#define X16_DEVICE       (0x0002)
#define X8X16_DEVICE     (0x0004)
#define X16X32_DEVICE    (0x0008)

#define DATA_WIDTH_MASK  (0x00F0)
#define X8_DATA          (0x0010)
#define X16_DATA         (0x0020)
#define X32_DATA         (0x0040)
#define X64_DATA         (0x0080) /* RFU */

/* device/bus width configurations */
#define X8_AS_X8      (X8_DEVICE     | X8_DATA)
#define X8X16_AS_X8   (X8X16_DEVICE  | X8_DATA |    A_MINUS_1)

#define X8_AS_X16     (X8_DEVICE     | X16_DATA | MULTI_DEVICE_CFG)
#define X16_AS_X16    (X16_DEVICE    | X16_DATA)
#define X8X16_AS_X16  (X8X16_DEVICE  | X16_DATA)
#define X16X32_AS_X16 (X16X32_DEVICE | X16_DATA | A_MINUS_1)

#define X8_AS_X32     (X8_DEVICE     | X32_DATA | MULTI_DEVICE_CFG)
#define X16_AS_X32    (X16_DEVICE    | X32_DATA | MULTI_DEVICE_CFG)
#define X8X16_AS_X32  (X8X16_DEVICE  | X32_DATA | MULTI_DEVICE_CFG)
#define X16X32_AS_X32 (X16X32_DEVICE | X32_DATA) 


/* data masks */
#define	DQ0_BIT_MASK	(0x01)		/* select DQ0 */
#define	DQ1_BIT_MASK	(0x02)		/* select DQ1 */
#define	DQ2_BIT_MASK	(0x04)		/* select DQ2 */
#define	DQ5_BIT_MASK	(0x20)		/* select DQ5 */
#define	DQ6_BIT_MASK	(0x40)		/* select DQ6 */
#define	DQ7_BIT_MASK	(0x80)		/* select DQ7 */


/* polling routine options */
#define LLD_P_POLL_PGM         (0x0001)
#define LLD_P_POLL_WRT_BUF_PGM (0x0002)
#define LLD_P_POLL_SEC_ERS     (0x0003)
#define LLD_P_POLL_CHIP_ERS    (0x0004)
#define LLD_P_POLL_RESUME      (0x0005)
#define DELAY_10ms				100
#define DELAY_4us				4
typedef enum {
 dev_status_unknown = 0,
 dev_not_busy,
 dev_busy,
 dev_exceeded_time_limits,
 dev_suspend,
 dev_write_buffer_abort
} DEVSTATUS;


/* public function prototypes */

/* Operation Functions */
extern int lld_WrtBufPgmOp
 (
 ADDRESS   base_addr,     /* device base address is system */
 DWORD   offset,        /* address offset from base address */
 PARAM     data_cfg,      /* data config (data width, # of devices) */
 BYTECOUNT len_in_bytes,  /* number of bytes on which to operate */
 BYTE      *source_buf,   /* buffer containing data to program */
 PARAM     *err_code_ptr, /* variable in which to store error code */
 char      *err_buf       /* buffer to store textual error info */
 );


extern int lld_PgmOp
 (
 ADDRESS   base_addr,     /* device base address is system */
 DWORD   offset,        /* address offset from base address */
 PARAM     data_cfg,      /* data config (data width, # of devices) */
 FLASHDATA write_data,    /* variable containing data to program */
 PARAM     *err_code_ptr, /* variable in which to store error code */
 char      *err_buf       /* buffer to store textual error info */
 );


extern int lld_SecErsOp
 (
 ADDRESS  base_addr,    /* device base address is system */
 DWORD  offset,       /* address offset from base address */
 PARAM    data_cfg,     /* data config (data width, # of devices) */
 PARAM*   err_code_ptr, /* variable in which to store error code */
 char*    err_buf       /* buffer to store textual error info */
 );


extern int lld_ChipErsOp
 (
 ADDRESS  base_addr,    /* device base address is system */
 DWORD  offset,       /* address offset from base address */
 PARAM    data_cfg,     /* data config (data width, # of devices) */
 PARAM*   err_code_ptr, /* variable in which to store error code */
 char*    err_buf       /* buffer to store textual error info */
 );


/* Command Functions */
extern int lld_ResetCmd
 (
 ADDRESS  base_addr,    /* device base address is system */
 DWORD  offset,       /* address offset from base address */
 PARAM    data_cfg,     /* data width of flash device in bytes */
 PARAM*   err_code_ptr, /* variable in which to store error code */
 char*    err_buf       /* buffer to store textual error info */
 );

⌨️ 快捷键说明

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