Files
jens 26291bca3d - initial import
git-svn-id: http://moon:8086/svn/mips@1 a8ebac50-d88d-4704-bea3-6648445a41b3
2014-07-20 15:01:37 +00:00

45 lines
1.2 KiB
C

/************************************************************************/
#ifndef CFIFLASH_H
#define CFIFLASH_H
#include "libsys.h"
#define SR_BIT_DPS 0x00020002
#define SR_BIT_PSS 0x00040004
#define SR_BIT_VPENS 0x00080008
#define SR_BIT_PSLBS 0x00100010
#define SR_BIT_ECLBS 0x00200020
#define SR_BIT_ESS 0x00400040
#define SR_BIT_ISMS 0x00800080
typedef struct _sflash_info_t
{
UINT32 flashsize;
UINT32 blocksize;
UINT32 nblocks;
UINT32 wbuf_size;
UINT32 if_width;
UINT32 num_flash;
} flash_info_t;
typedef struct _sflash_t
{
void *pBase;
flash_info_t info;
} flash_t;
void cfi_init(flash_t *pObj, UINT32 base_addr);
UINT32 cfi_find(flash_t *pObj);
UINT32 cfi_block_erase(flash_t *pObj, UINT32 word_index);
UINT32 cfi_program_single(flash_t *pObj, UINT32 word_index, UINT32 word);
UINT32 cfi_program_multi(flash_t *pObj, UINT32 word_index, UINT32 *pWords, UINT32 num_words);
UINT32 flash_find(flash_t *pObj, UINT32 base_addr);
UINT32 flash_erase(flash_t *pObj, UINT32 offset, UINT32 size);
UINT32 flash_program(flash_t *pObj, UINT32 offset, UINT8 *pData, UINT32 size);
UINT32 flash_verify(flash_t *pObj, UINT32 offset, UINT8 *pData, UINT32 size);
#endif // CFIFLASH_H