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