5#define SFCX_CONFIG 0x00
6#define SFCX_STATUS 0x04
7#define SFCX_COMMAND 0x08
8#define SFCX_ADDRESS 0x0C
10#define SFCX_LOGICAL 0x14
11#define SFCX_PHYSICAL 0x18
12#define SFCX_DPHYSADDR 0x1C
13#define SFCX_MPHYSADDR 0x20
14#define SFCX_PHISON 0xFC
17#define PAGE_BUF_TO_REG 0x00
18#define REG_TO_PAGE_BUF 0x01
19#define LOG_PAGE_TO_BUF 0x02
20#define PHY_PAGE_TO_BUF 0x03
21#define WRITE_PAGE_TO_PHY 0x04
22#define BLOCK_ERASE 0x05
23#define DMA_LOG_TO_RAM 0x06
24#define DMA_PHY_TO_RAM 0x07
25#define DMA_RAM_TO_PHY 0x08
26#define UNLOCK_CMD_0 0x55
27#define UNLOCK_CMD_1 0xAA
30#define CONFIG_DBG_MUX_SEL 0x7C000000u
31#define CONFIG_DIS_EXT_ER 0x2000000u
32#define CONFIG_CSR_DLY 0x1FE0000u
33#define CONFIG_ULT_DLY 0x1F800u
34#define CONFIG_BYPASS 0x400u
35#define CONFIG_DMA_LEN 0x3C0u
36#define CONFIG_FLSH_SIZE 0x30u
37#define CONFIG_WP_EN 0x8u
38#define CONFIG_INT_EN 0x4u
39#define CONFIG_ECC_DIS 0x2u
40#define CONFIG_SW_RST 0x1u
43#define STATUS_ILL_LOG 0x800u
44#define STATUS_PIN_WP_N 0x400u
45#define STATUS_PIN_BY_N 0x200u
46#define STATUS_INT_CP 0x100u
47#define STATUS_ADDR_ER 0x80u
48#define STATUS_BB_ER 0x40u
49#define STATUS_RNP_ER 0x20u
50#define STATUS_ECC_ER 0x1Cu
51#define STATUS_WR_ER 0x2u
52#define STATUS_BUSY 0x1u
53#define STATUS_ERROR (STATUS_ILL_LOG|STATUS_ADDR_ER|STATUS_BB_ER|STATUS_RNP_ER|STATUS_ECC_ER|STATUS_WR_ER)
56#define PAGE_VALID 0x4000000u
57#define PAGE_PID 0x3FFFE00u
61#define MAX_PAGE_SZ 0x210
62#define MAX_BLOCK_SZ 0x42000
64#define META_TYPE_0 0x00
65#define META_TYPE_1 0x01
66#define META_TYPE_2 0x02
68#define CONFIG_BLOCKS 0x04
74#define RAW_NAND_64 0x4200000
76#define SFCX_INITIALIZED 1
81#define SFCX_SUCCESS(status) ((status&STATUS_ERROR)==0)
unsigned long sfcx_readreg(int addr)
int sfcx_is_pageerased(unsigned char *data)
int sfcx_read_page(unsigned char *data, int address, int raw)
void sfcx_set_pagevalid(unsigned char *data)
int sfcx_write_page(unsigned char *data, int address)
void sfcx_set_pageinvalid(unsigned char *data)
int sfcx_rawaddress_to_block(int address)
int sfcx_block_to_rawaddress(int block)
int sfcx_get_blocknumber(unsigned char *data)
int sfcx_address_to_block(int address)
int sfcx_get_blockversion(unsigned char *data)
void sfcx_set_blockversion(unsigned char *data, int ver)
int sfcx_read_block(unsigned char *data, int address, int raw)
int rawflash_writeImage(int len, int f)
int sfcx_is_pagezeroed(unsigned char *data)
void sfcx_calcecc(unsigned int *data)
int sfcx_read_metadata_type(void)
void sfcx_writereg(int addr, unsigned long data)
int sfcx_is_pagevalid(unsigned char *data)
int try_rawflash(char *filename)
unsigned int sfcx_init(void)
int sfcx_erase_block(int address)
int sfcx_block_to_address(int block)
int sfcx_write_block(unsigned char *data, int address)
void sfcx_set_blocknumber(unsigned char *data, int num)