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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#ifndef GUI_H
#define GUI_H
#include <stdint.h>
#include <glib-object.h>
#define STLINK_TYPE_GUI (stlink_gui_get_type())
#define STLINK_GUI(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), STLINK_TYPE_GUI, STlinkGUI))
#define STLINK_IS_GUI(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), STLINK_TYPE_GUI))
#define STLINK_GUI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), STLINK_TYPE_GUI, STlinkGUIClass))
#define STLINK_IS_GUI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), STLINK_TYPE_GUI))
#define STLINK_GUI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), STLINK_TYPE_GUI, STlinkGUIlass))
#define STLINK_GUI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), STLINK_TYPE_GUI, STlinkGUIPrivate))
typedef struct _STlinkGUI STlinkGUI;
typedef struct _STlinkGUIClass STlinkGUIClass;
typedef struct _STlinkGUIPrivate STlinkGUIPrivate;
enum stlink_gui_pages_t {
PAGE_DEVMEM,
PAGE_FILEMEM
};
enum stlink_gui_dnd_targets_t {
TARGET_FILENAME,
TARGET_ROOTWIN
};
struct progress_t {
GtkProgressBar *bar;
guint timer;
gboolean activity_mode;
gdouble fraction;
};
struct mem_t {
guchar *memory;
gsize size;
guint32 base;
};
struct _STlinkGUI {
GObject parent_instance;
/* < private > */
GtkWindow *window;
GtkTreeView *devmem_treeview;
GtkTreeView *filemem_treeview;
GtkSpinner *spinner;
GtkStatusbar *statusbar;
GtkInfoBar *infobar;
GtkLabel *infolabel;
GtkNotebook *notebook;
GtkFrame *device_frame;
GtkLabel *chip_id_label;
GtkLabel *core_id_label;
GtkLabel *flash_size_label;
GtkLabel *ram_size_label;
GtkBox *devmem_box;
GtkEntry *devmem_jmp_entry;
GtkBox *filemem_box;
GtkEntry *filemem_jmp_entry;
GtkToolButton *connect_button;
GtkToolButton *disconnect_button;
GtkToolButton *flash_button;
GtkToolButton *export_button;
GtkToolButton *open_button;
/* flash dialog */
GtkDialog *flash_dialog;
GtkButton *flash_dialog_ok;
GtkButton *flash_dialog_cancel;
GtkEntry *flash_dialog_entry;
struct progress_t progress;
struct mem_t flash_mem;
struct mem_t file_mem;
gchar *error_message;
gchar *filename;
stlink_t *sl;
};
struct _STlinkGUIClass {
GObjectClass parent_class;
/* class members */
};
GType stlink_gui_get_type(void);
int32_t export_to_file(const char*filename, const struct mem_t flash_mem);
#endif // GUI_H
|