/*************************************************************** ** ** Broadcom Corp. Confidential ** Copyright 2007 Broadcom Corp. All Rights Reserved. ** ** THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED ** SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM. ** YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT ** SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. ** ** File: fstore.h ** Description: Flash storage ** Created: Wed Mar 21 13:31:21 PDT 2007 - Jeffrey P. Fisher ** ****************************************************************/ #ifndef __FSTORE_H__ #define __FSTORE_H__ #include "bapp_types.h" /* * Data types Flash memory map determined internaly based on * strapping options and data type enum. */ typedef enum fstore_data_type_t { eFS_BOOT_PATCH, /* Boot code patch */ eFS_INIT_PATCH, /* Initialization code patch */ eFS_APP_DATA, /* Application data */ eFS_MAX_DATA_TYPE, /* Max number of data types */ }fstore_data_type_t; /* * control structure, enables fstore API to multiple flash devices */ typedef struct fstore_t { unsigned int read_base; /* Read base address of device (read/write base to support BSPI on 3543 */ unsigned int write_base; /* Write base address of device */ unsigned int offset[eFS_MAX_DATA_TYPE]; /* offset from base */ unsigned int sector_size; /* Sector size in bytes */ unsigned int block_size; /* Block size in bytes */ unsigned int max_size; /* Block size in bytes */ bresult (*read)(void *p_fs, unsigned int offset, unsigned char *data, unsigned int size); bresult (*erase)(void *p_fs, unsigned int offset, unsigned int size); bresult (*program)(void *p_fs, unsigned int offset,void *buffer, unsigned int size); }fstore_t; #ifdef __cplusplus extern "C" { #endif /* Summary: Detect the flash type and initialze the fstore structure. */ bresult fstore_init(fstore_t *p_fs); /* Summary: Update flash at the specified offset. Length is in bytes */ bresult fstore_update(fstore_t *p_fs, fstore_data_type_t type, void *data, unsigned int length); /* Summary: Get the stored data for type. Returns b_ok on success. */ bresult fstore_get(fstore_t *p_fs, fstore_data_type_t type, void **data, unsigned int *length); /* Summary: Perform a test to validate the fstore module. */ #ifdef BCM_FSTORE_TEST bresult fstore_test(fstore_t *p_fs,int reserved); #endif #ifdef __cplusplus } #endif #endif /* __FSTORE_H__ */