comparison fluid-mnf/flash.h @ 311:9cecc930d78f

fluid-mnf: original source from TI, defenestrated line endings and rearranged directory structure, but no *.[ch] source file content changes yet
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 29 Feb 2020 05:36:07 +0000
parents
children
comparison
equal deleted inserted replaced
310:ae39d76d5b7a 311:9cecc930d78f
1 /******************************************************************************
2 * FLUID (Flash Loader Utility Independent of Device)
3 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com
4 *
5 * Copyright Texas Instruments, 2001.
6 * Mads Meisner-Jensen, mmj@ti.com.
7 *
8 * Flash device database and lookup
9 *
10 * $Id: flash.h 1.11 Wed, 30 Oct 2002 12:09:08 +0100 tsj $
11 *
12 ******************************************************************************/
13
14
15 /******************************************************************************
16 * Prototypes
17 ******************************************************************************/
18
19 struct sector_s {
20 int addr;
21 int size;
22 };
23
24 // We make room for a device of 2047 * 64kB + plus 8 * 8kB sectors (eg. 1Gb)
25 struct memmap_s {
26 struct memmap_s *next;
27 char *name;
28 int size;
29 struct sector_s sectors[2047+7];
30 };
31
32 struct device_s {
33 struct device_s *next;
34 int algorithm_id;
35 int manufacturer_id;
36 int device_id;
37 char *name;
38 int t_erase; // typical time (milli-seconds) for erasing one sector
39 int t_program; // typical time (micro-seconds) for programming one word
40 struct memmap_s *memmap;
41 };
42
43 struct manufact_s {
44 // struct manufact_s *next;
45 int id;
46 char *name;
47 };
48
49 struct algorithm_s {
50 int id;
51 char *name;
52 };
53
54 enum FlashAlgorithms {
55 ALGORITHM_AMD = 1,
56 ALGORITHM_AMDFAST,
57 ALGORITHM_INTEL,
58 ALGORITHM_INTEL_BW,
59 ALGORITHM_MITSUBISHI,
60 ALGORITHM_SST
61 };
62
63 enum FlashManufacturers {
64 MANUFACT_AMD = 0x01,
65 MANUFACT_ATMEL = 0x1F,
66 MANUFACT_FUJITSU = 0x04,
67 MANUFACT_INTEL = 0x89,
68 MANUFACT_MXIC = 0xC2,
69 MANUFACT_MITSUBISHI = 0x1C,
70 MANUFACT_SAMSUNG = 0xEC,
71 MANUFACT_SHARP = 0xB0,
72 MANUFACT_STM = 0x20,
73 MANUFACT_SST = 0xBF,
74 MANUFACT_TOSHIBA = 0x98,
75 MANUFACT_TEST = 0xFF
76 };
77
78
79 /******************************************************************************
80 * Prototypes
81 ******************************************************************************/
82
83 void device_print(struct device_s *device, char format);
84 void devices_list(void);
85 void file_read_devices(char *filename);
86
87 int get_next_line(void);
88 int get_token(void);
89 int get_keyword(void);
90 int get_string(void);
91 int get_number(void);
92
93 int time_compute(struct device_s *device,
94 int sectors, int bytes, int chunks,
95 int *time_erase, int *time_program, int *time_trransfer);
96
97 struct device_s *device_lookup_by_id(int manid, int devid);
98 struct memmap_s *memmap_lookup_by_name(char *name);
99 char *manufacturer_name_lookup_by_id(int id);
100 int manufacturer_id_lookup_by_name(char *name);
101 char *algorithm_name_lookup_by_id(int id);
102 int algorithm_id_lookup_by_name(char *name);