1/******************************************************************************* 2 * 3 * Filename: spi_flash.h 4 * 5 * Definition of flash control routines supporting AT45DB161B 6 * 7 * Revision information: 8 * 9 * 17JAN2005 kb_admin initial creation 10 * 11 * BEGIN_KBDD_BLOCK 12 * No warranty, expressed or implied, is included with this software. It is 13 * provided "AS IS" and no warranty of any kind including statutory or aspects 14 * relating to merchantability or fitness for any purpose is provided. All 15 * intellectual property rights of others is maintained with the respective 16 * owners. This software is not copyrighted and is intended for reference 17 * only. 18 * END_BLOCK 19 * 20 * $FreeBSD$ 21 ******************************************************************************/ 22 23#ifndef _SPI_FLASH_H_ 24#define _SPI_FLASH_H_ 25 26typedef struct { 27 char *tx_cmd; 28 unsigned tx_cmd_size; 29 char *rx_cmd; 30 unsigned rx_cmd_size; 31 char *tx_data; 32 unsigned tx_data_size; 33 char *rx_data; 34 unsigned rx_data_size; 35} spiCommand_t; 36 37void SPI_ReadFlash(unsigned flash_addr, char *dest_addr, unsigned size); 38void SPI_WriteFlash(unsigned flash_addr, char *dest_addr, unsigned size); 39void SPI_InitFlash(void); 40 41void SPI_GetId(unsigned *id); 42 43#ifdef BOOT_BWCT 44#define FLASH_PAGE_SIZE 528 45#else 46#define FLASH_PAGE_SIZE 1056 47#endif 48 49// Flash commands 50 51#define CONTINUOUS_ARRAY_READ 0xE8 52#define CONTINUOUS_ARRAY_READ_HF 0x0B 53#define CONTINUOUS_ARRAY_READ_LF 0x03 54#define STATUS_REGISTER_READ 0xD7 55#define PROGRAM_THROUGH_BUFFER 0x82 56#define MANUFACTURER_ID 0x9F 57 58#endif 59