[ fix ] 0001-stlink-gui-Follow-new-stlink_open-usage, fix from Jim Huang <jserv@0xlab...
[fw/stlink] / gui / stlink-gui.h
1
2 #ifndef __STLINK_GUI_H__
3 #define __STLINK_GUI_H__
4
5 #include <glib-object.h>
6
7 #define STLINK_TYPE_GUI             (stlink_gui_get_type ())
8 #define STLINK_GUI(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), STLINK_TYPE_GUI, STlinkGUI))
9 #define STLINK_IS_GUI(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STLINK_TYPE_GUI))
10 #define STLINK_GUI_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), STLINK_TYPE_GUI, STlinkGUIClass))
11 #define STLINK_IS_GUI_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), STLINK_TYPE_GUI))
12 #define STLINK_GUI_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), STLINK_TYPE_GUI, STlinkGUIlass))
13 #define STLINK_GUI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), STLINK_TYPE_GUI, STlinkGUIPrivate))
14
15 typedef struct _STlinkGUI        STlinkGUI;
16 typedef struct _STlinkGUIClass   STlinkGUIClass;
17 typedef struct _STlinkGUIPrivate STlinkGUIPrivate;
18
19 enum stlink_gui_pages_t {
20         PAGE_DEVMEM,
21         PAGE_FILEMEM
22 };
23
24 enum stlink_gui_dnd_targets_t {
25         TARGET_FILENAME,
26         TARGET_ROOTWIN
27 };
28
29 struct progress_t {
30         GtkProgressBar *bar;
31         guint           timer;
32         gboolean        activity_mode;
33         gdouble         fraction;
34 };
35
36 struct mem_t {
37         guchar *memory;
38         gsize   size;
39         guint32 base;
40 };
41
42 struct _STlinkGUI
43 {
44         GObject parent_instance;
45
46         /*< private >*/
47         GtkWindow      *window;
48         GtkTreeView    *devmem_treeview;
49         GtkTreeView    *filemem_treeview;
50         GtkSpinner     *spinner;
51         GtkStatusbar   *statusbar;
52         GtkInfoBar     *infobar;
53         GtkLabel       *infolabel;
54         GtkNotebook    *notebook;
55         GtkFrame       *device_frame;
56         GtkLabel       *chip_id_label;
57         GtkLabel       *core_id_label;
58         GtkLabel       *flash_size_label;
59         GtkLabel       *ram_size_label;
60         GtkBox         *devmem_box;
61         GtkEntry       *devmem_jmp_entry;
62         GtkBox         *filemem_box;
63         GtkEntry       *filemem_jmp_entry;
64         GtkToolButton  *connect_button;
65         GtkToolButton  *disconnect_button;
66         GtkToolButton  *flash_button;
67         GtkToolButton  *open_button;
68
69         /* flash dialog */
70         GtkDialog  *flash_dialog;
71         GtkButton  *flash_dialog_ok;
72         GtkButton  *flash_dialog_cancel;
73         GtkEntry   *flash_dialog_entry;
74
75         struct progress_t  progress;
76         struct mem_t       flash_mem;
77         struct mem_t       file_mem;
78
79         gchar    *error_message;
80         gchar    *filename;
81         stlink_t *sl;
82 };
83
84 struct _STlinkGUIClass
85 {
86         GObjectClass parent_class;
87
88         /* class members */
89 };
90
91 GType stlink_gui_get_type (void);
92
93 #endif