This commit is contained in:
pvvx 2017-02-01 14:37:57 +03:00
parent 929dc6d329
commit 0557a41f1a
13 changed files with 99 additions and 69 deletions

View file

@ -21,6 +21,7 @@
#include "spi_api.h"
#include "dma_api.h"
#include "flash_api.h"
#include "flash_eep.h"
#include "gpio_ex_api.h"
#include "gpio_irq_ex_api.h"
#include "i2c_ex_api.h"

View file

@ -7,8 +7,7 @@
* possession or use of this module requires written permission of RealTek.
*******************************************************************************
*/
#ifndef MBED_EXT_FLASH_API_EXT_H
#ifndef MBED_EXT_FLASH_API_EXT_H
#define MBED_EXT_FLASH_API_EXT_H
#include "device.h"
@ -22,8 +21,7 @@ typedef struct flash_s flash_t;
/**
* global data structure
*/
//extern flash_t flash;
extern flash_t flashobj;
extern flash_t flashobj;
extern bool fspic_isinit;
enum {
@ -47,10 +45,11 @@ int flash_burst_write (flash_t * obj, uint32_t address, uint32_t Length, uint8
int flash_burst_read (flash_t * obj, uint32_t address, uint32_t Length, uint8_t * data);
int flash_set_extend_addr (flash_t * obj, uint32_t data);
int flash_get_extend_addr (flash_t * obj);
unsigned int flash_get_size (flash_t *obj);
int flash_otp_read (flash_t *obj, uint32_t address, uint32_t Length, uint8_t * data);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -8,9 +8,14 @@
#ifndef __FLASH_EEP_H_
#define __FLASH_EEP_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <basic_types.h>
#include <FreeRTOS.h>
#include <queue.h>
//-----------------------------------------------------------------------------
#ifndef FLASH_SECTOR_SIZE
#define FLASH_SECTOR_SIZE 4096
@ -19,7 +24,7 @@
#define FLASH_CHIP_SIZE (FLASH_SECTORS * FLASH_SECTOR_SIZE)
#define FMEMORY_SCFG_BANK_SIZE FLASH_SECTOR_SIZE // размер сектора, 4096 bytes
#define FMEMORY_SCFG_BANKS 2 // кол-во секторов для работы 2...
#define FMEMORY_SCFG_BASE_ADDR (FLASH_CHIP_SIZE - (FMEMORY_SCFG_BANKS*FMEMORY_SCFG_BANK_SIZE))
#define FMEMORY_SCFG_BASE_ADDR (FLASH_CHIP_SIZE - (FMEMORY_SCFG_BANKS*FMEMORY_SCFG_BANK_SIZE)) // = 0xFE000
//-----------------------------------------------------------------------------
#define FLASH_EEP_ATTR
//-----------------------------------------------------------------------------
@ -32,11 +37,16 @@ enum eFMEMORY_ERRORS {
};
//-----------------------------------------------------------------------------
// extern QueueHandle_t flash_mutex;
sint16 flash_read_cfg(void *ptr, uint16 id, uint16 maxsize) FLASH_EEP_ATTR; // возврат: размер объекта последнего сохранения, -1 - не найден, -2 - error
bool flash_write_cfg(void *ptr, uint16 id, uint16 size) FLASH_EEP_ATTR;
signed short flash_read_cfg(void *ptr, unsigned short id, unsigned short maxsize) FLASH_EEP_ATTR; // возврат: размер объекта последнего сохранения, -1 - не найден, -2 - error
bool flash_write_cfg(void *ptr, unsigned short id, unsigned short size) FLASH_EEP_ATTR;
//-----------------------------------------------------------------------------
#ifndef USE_FLASH_EEP
#define USE_FLASH_EEP 1
#endif
#ifdef __cplusplus
}
#endif
#endif /* __FLASH_EEP_H_ */

View file

@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_WATCHDOG_API_H
#define MBED_WATCHDOG_API_H
#ifndef MBED_SYS_API_H
#define MBED_SYS_API_H
#include "device.h"
@ -49,4 +49,4 @@ void sys_reset(void);
}
#endif
#endif
#endif // MBED_SYS_API_H