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

📄 lh28f320bf.h

📁 在sharp 404开发板的串口测试代码
💻 H
字号:
/***********************************************************************
 * $Workfile:   LH28F320BF.h  $
 * $Revision:   1.0  $
 * $Author:   WellsK  $
 * $Date:   Apr 22 2002 13:50:28  $
 *
 * Project:  LH28F320BFE-PBTL80 Driver
 *
 * Description:
 *   This module contains a driver for accessing the Sharp 
 *   LH28F320BFE-PBTL80 2Mbit X 16 flash device.
 *
 *
 * $Log:   //smaicnt2/pvcs/VM/CHIPS/archives/Tools/Flash/LH28F320BF.h-arc  $
 * 
 *    Rev 1.0   Apr 22 2002 13:50:28   WellsK
 * Initial revision.
 * 
 * 
 *  COPYRIGHT (C) 2001  SHARP MICROELECTRONICS OF THE AMERICAS INC.
 *                         CAMAS, WA
 *********************************************************************/
#ifndef		_F320BF_H
#define		_F320BF_H
#include "SMA_types.h"
/**********************
* defines
**********************/
#define MAX_MULTI_WRITE_NUM                16
#define MASK_MULTI_WRITE                   0x1e

/**********************
* DEVICE ID 
**********************/
#define ID_MAKER_CODE                      0x00B0
#define ID_DEVICE_CODE                     0x00B5

/**********************
* address offset
**********************/
#define ID_DEVICE_OFFSET                   1
#define ID_BLOCK_OFFSET                    2
#define ID_PCR_OFFSET                      6
#define MASK_BOOT_BLOCK_ADD                0xFFFFF000
#define MASK_MAIN_BLOCK_ADD		           0xFFFF8000
#define BLOCK_STRUCTURE_BORDER_ADD	       0x00008000
#define COUNTER_MASK_BOOT_BLOCK        	   0x00000FFF
#define COUNTER_MASK_MAIN_BLOCK		       0x00007FFF
#define PART0_START_OFFSET                 0x00000000
#define PART1_START_OFFSET                 0x00080000
#define PART2_START_OFFSET                 0x00100000
#define PART3_START_OFFSET                 0x00180000

/**********************
* bit mask
**********************/
#define BIT_0                              0x0001
#define BIT_1                              0x0002
#define BIT_2                              0x0004
#define BIT_3                              0x0008
#define BIT_4                              0x0010
#define BIT_5                              0x0020
#define BIT_6                              0x0040
#define BIT_7                              0x0080
#define HIGH                               1
#define LOW                                0
#define HIGH_BYTE                          0xff00
#define LOW_BYTE                           0x00ff

/**********************
* flash commands
**********************/
#define CMD_READ_ARRAY          0xFFFF
#define CMD_DATA_WRITE          0x4040
#define CMD_BLOCK_ERASE         0x2020
#define CMD_FULL_CHIP_ERASE     0x3030
#define CMD_SUSPEND             0xB0B0
#define CMD_READ_STATUS         0x7070
#define CMD_CLEAR_STATUS        0x5050
#define CMD_CONFIRM             0xD0D0
#define CMD_RESUME              0xD0D0
#define CMD_READ_ID_CODE        0x9090
#define CMD_BLOCK_LOCK          0x6060
#define CMD_SET_LOCKBIT         0x0101
#define CMD_RESET_LOCKBIT       0xD0D0
#define CMD_SET_LOCKDOWNBIT     0x2F2F
#define CMD_SET_PCR             0x6060
#define CMD_PCR_CONFIRM         0x0404
#define CMD_OTP_WRITE           0xC0C0
#define CMD_MULTI_DATA_WRITE    0xE8E8

/**********************
* CSR flags
**********************/
#define CSR_WSM_STATUS_READY               0x0080
#define CSR_ERASE_SUSPEND                  0x0040
#define CSR_ERASE_ERROR                    0x0020
#define CSR_WRITE_ERROR                    0x0010
#define CSR_LOW_VPP                        0x0008
#define CSR_WRITE_SUSPEND                  0x0004
#define CSR_DEVICE_PROTECT                 0x0002

/**********************
* XSR flags
**********************/
#define XSR_MULTI_WRITE_READY              0x0080

/**********************
* Error codes
**********************/
#define ERR_NO_ERROR                       0
#define ERR_LOW_VPP                        1
#define ERR_BLOCK_LOCKED                   2
#define ERR_COMMAND_SEQ_ERROR              3
#define ERR_WP_LOW                         4
#define ERR_WRITE                          5
#define ERR_ERASE                          6
#define ERR_OPERATION                      7
#define ERR_WRITE_ERASING_BLOCK            8

/**********************
* block structure
**********************/
#define BOOT_BLOCK_SIZE                    0x00001000
#define MAIN_BLOCK_SIZE                    0x00008000
#define BOOT_BLOCK_NUM						8
#define MAIN_BLOCK_NUM						63 // 1MB of 1st partition currently
/**********************
* prototype
**********************/
void read_array(UNS_16 *address);
UNS_16 word_write(volatile UNS_16 *address, UNS_16 data);
UNS_16 block_erase(volatile UNS_16 *address);
UNS_16 all_block_erase(volatile UNS_16 *address);
UNS_16 set_block_lock(volatile UNS_16 *address);
UNS_16 clear_block_lock(volatile UNS_16 *address);
UNS_16 set_block_lockdown(volatile UNS_16 *address);
UNS_16 multi_word_write(volatile UNS_16 *address, UNS_16 *data, int num_of_data);
void multi_word_write_sub(volatile UNS_16 *address, UNS_16 *data, int num_of_data);
void write_suspend_to_read(volatile UNS_16 *address, UNS_16 *result);
void erase_suspend_to_read(volatile UNS_16 *address, UNS_16 *result);
int csr_full_status_check(UNS_16 csr);
void read_id_codes(volatile UNS_16 *base_add, UNS_16 *Maker_code, UNS_16 *Device_code);
int check_id_codes(volatile UNS_16 *base_add);
UNS_16 read_block_info(volatile UNS_16 *block_add);
void set_pcr(UNS_16 *base_add, int pcv);
int read_pcr_info(UNS_16 *base_add, UNS_16 *block_add);
#endif /*_F320BMWB_H*/

⌨️ 快捷键说明

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