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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
**************************************************************************
** STMicroelectronics **
**************************************************************************
** marco.cali@st.com **
**************************************************************************
* *
* FTS API for Flashing the IC *
* *
**************************************************************************
**************************************************************************
*/
#include "ftsSoftware.h"
/* Flash possible status */
#define FLASH_READY 0
#define FLASH_BUSY 1
#define FLASH_UNKNOWN -1
#define FLASH_STATUS_BYTES 1
/* Flash timing parameters */
#define FLASH_RETRY_COUNT 1000
#define FLASH_WAIT_BEFORE_RETRY 50 /* ms */
#define FLASH_WAIT_TIME 200 /* ms */
/* PATHS FW FILES */
/* #define PATH_FILE_FW "fw.memh" */
#ifdef FTM3_CHIP
#define PATH_FILE_FW "st_fts.bin"
#else
#define PATH_FILE_FW "st_fts.ftb" /* new bin file structure */
#endif
#ifndef FTM3_CHIP
#define FLASH_CHUNK (64*1024)
#define DMA_CHUNK 32
#endif
typedef struct {
u8 *data;
u16 fw_ver;
u16 config_id;
u8 externalRelease[EXTERNAL_RELEASE_INFO_SIZE];
int data_size;
#ifndef FTM3_CHIP
u32 sec0_size;
u32 sec1_size;
u32 sec2_size;
u32 sec3_size;
#endif
} Firmware;
#ifdef FTM3_CHIP
int flash_status(void);
int flash_status_ready(void);
int wait_for_flash_ready(void);
int parseBinFile(const char *pathToFile, u8 **data, int *length, int dimension);
/* int parseMemhFile(const char* pathToFile, u8** data, int* length, int dimension); */
#else
int wait_for_flash_ready(u8 type);
int fts_warm_boot(void);
int parseBinFile(const char *pathToFile, Firmware *fw, int keep_cx);
int flash_erase_unlock(void);
int flash_full_erase(void);
int start_flash_dma(void);
int fillFlash(u32 address, u8 *data, int size);
#endif
int flash_unlock(void);
int fillMemory(u32 address, u8 *data, int size);
int getFirmwareVersion(u16 *fw_vers, u16 *config_id);
int readFwFile(const char *path, Firmware *fw, int keep_cx);
int flash_burn(Firmware fw, int force_burn);
int flashProcedure(const char *path, int force, int keep_cx);
|