📄 drvserflash_db.h
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2007 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (¨MStar Confidential Information〃) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef DRVSERFLASH_DB_H
#define DRVSERFLASH_DB_H
#include <board.h>
//------------------------------------
//spi brand define for Saturn2
#define BRAND_PMC 0x00
#define BRAND_NEXTFLASH 0x01
#define BRAND_ST 0x02
#define BRAND_SST 0x03
#define BRAND_ATMEL 0x04
//------------------------------------
//------------------------------------
// If CMD_SECTOR_ERASE == CMD_BLOCK_ERASE
// the 4K-byte sector erase is not supported by the flash ic
// CMD_SECTOR_ERASE is not used currently
#if (SERIAL_FLASH_IC == FLASH_IC_SST25VF080B) ||\
(SERIAL_FLASH_IC == FLASH_IC_SST25VF016B)
#define CMD_WRITE_ENABLE 0x06
#define CMD_WRITE_DISABLE 0x04
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0xAD
#define CMD_SECTOR_ERASE 0x20
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#define FAST_CLOCK (50 * MHz)
#define READ_CLOCK (25 * MHz)
#elif (SERIAL_FLASH_IC == FLASH_IC_Pm25LV080) ||\
(SERIAL_FLASH_IC == FLASH_IC_Pm25LV016)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0xD7
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#elif (SERIAL_FLASH_IC == FLASH_IC_ST25P80_A) ||\
(SERIAL_FLASH_IC == FLASH_IC_ST25P16_A)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0xD8
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#elif (SERIAL_FLASH_IC == FLASH_IC_AT26DF081A) ||\
(SERIAL_FLASH_IC == FLASH_IC_AT26DF161)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0x20
#define CMD_BLOCK_ERASE 0x52
#define BLOCK_SIZE 0x8000UL
#elif (SERIAL_FLASH_IC == FLASH_IC_MX25L8005) ||\
(SERIAL_FLASH_IC == FLASH_IC_MX25L1605A)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0x20
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#define FAST_CLOCK (66 * MHz)
#define READ_CLOCK (33 * MHz)
#elif (SERIAL_FLASH_IC == FLASH_IC_NX25P80) ||\
(SERIAL_FLASH_IC == FLASH_IC_NX25P16)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0xD8
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#define FAST_CLOCK (50 * MHz)
#define READ_CLOCK (20 * MHz)
#elif (SERIAL_FLASH_IC == FLASH_IC_W25X80)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0x20
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#elif (SERIAL_FLASH_IC == FLASH_IC_S25FL008A) ||\
(SERIAL_FLASH_IC == FLASH_IC_S25FL016A)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0xD8
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#elif (SERIAL_FLASH_IC == FLASH_IC_EN25B20T) ||\
(SERIAL_FLASH_IC == FLASH_IC_EN25B20B)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0xD8
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#elif (SERIAL_FLASH_IC == FLASH_IC_EN25B10T) ||\
(SERIAL_FLASH_IC == FLASH_IC_EN25B10B)
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0xD8
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x8000UL
#elif (SERIAL_FLASH_IC == FLASH_IC_ESMT_F25L016A)
#define CMD_WRITE_ENABLE 0x06
#define CMD_WRITE_DISABLE 0x04
#define CMD_READ 0x03
#define CMD_PAGE_PROGRAM 0x02
#define CMD_SECTOR_ERASE 0x20
#define CMD_BLOCK_ERASE 0xD8
#define BLOCK_SIZE 0x10000UL
#define FAST_CLOCK (100 * MHz)
#define READ_CLOCK (33 * MHz)
#else
#error "Unsupported Flash type"
#endif
#define CMD_EWSR 0x50 // Enable-Write-Status-Register
#define CMD_WRSR 0x01 // Write-Status-Register
#define CMD_RDSR 0x05 // Read-Status-Register
#if !defined(SPI_FAST_CLOCK) && defined(FAST_CLOCK)
#define SPI_FAST_CLOCK FAST_CLOCK
#endif
#if !defined(SPI_READ_CLOCK) && defined(READ_CLOCK)
#define SPI_READ_CLOCK READ_CLOCK
#endif
#endif /* DRVSERFLASH_DB_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -