summaryrefslogtreecommitdiffstats
path: root/sw/linux/src
diff options
context:
space:
mode:
authorleleraffa97@hotmail.it <leleraffa97@hotmail.it>2017-08-23 21:18:02 +0200
committerleleraffa97@hotmail.it <leleraffa97@hotmail.it>2017-08-23 21:18:02 +0200
commit3f92d0e29700fc2da45354a4cf3e3afe5c5245c2 (patch)
treecb6def68635ff2b4e4ab30c7e8fdbdf3e730bc05 /sw/linux/src
parentFilesystem struct order (diff)
parentnew programmer interface for linux (diff)
downloadz80uPC-3f92d0e29700fc2da45354a4cf3e3afe5c5245c2.tar.gz
z80uPC-3f92d0e29700fc2da45354a4cf3e3afe5c5245c2.zip
Merge remote-tracking branch 'origin/naopross' into atlas
Diffstat (limited to '')
-rw-r--r--sw/linux/src/makefile.am7
-rw-r--r--sw/linux/src/ui.c90
-rwxr-xr-xsw/linux/src/z80progbin34688 -> 0 bytes
-rw-r--r--sw/programmer/linux/src/main.c (renamed from sw/linux/src/main.c)0
-rw-r--r--sw/programmer/linux/src/serial.c (renamed from sw/linux/src/serial.c)3
-rw-r--r--sw/programmer/linux/src/serial.h (renamed from sw/linux/src/serial.h)6
-rw-r--r--sw/programmer/linux/src/ui.h (renamed from sw/linux/src/ui.h)11
-rw-r--r--sw/programmer/linux/src/z80prog.ui (renamed from sw/linux/src/z80prog.ui)43
8 files changed, 34 insertions, 126 deletions
diff --git a/sw/linux/src/makefile.am b/sw/linux/src/makefile.am
deleted file mode 100644
index 492c3ec..0000000
--- a/sw/linux/src/makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-bin_PROGRAMS = z80prog
-z80prog_SOURCES = main.c ui.c serial.c
-
-z80prog_CFLAGS = -Wall -Werror -g $(gtk3_CFLAGS)
-z80prog_LDADD = $(gtk3_LIBS)
-
-CLEANFILES = *~
diff --git a/sw/linux/src/ui.c b/sw/linux/src/ui.c
deleted file mode 100644
index b33aa04..0000000
--- a/sw/linux/src/ui.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "ui.h"
-
-static bool ui_connected, ui_fileset;
-static GtkTextBuffer *ui_logbuf;
-static GtkBuilder *ui_builder;
-
-void ui_init(int *argc, char **argv[])
-{
- GtkWindow *window;
- GtkTextView *logview;
- GtkFileChooserButton *filechoosebtn;
- GtkButton *connectbtn, *flashbtn;
-
- /* set ui global variables */
- ui_connected = ui_fileset = false;
-
- /* start gtk */
- gtk_init(argc, argv);
-
- /* load glade gtk ui */
- ui_builder = gtk_builder_new();
- gtk_builder_add_from_file(ui_builder, "gbprog.ui", NULL);
-
- /* connect logger buffer (extern variable) */
- ui_logbuf = gtk_text_buffer_new(NULL);
- logview = GTK_TEXT_VIEW(gtk_builder_get_object(ui_builder, "logview"));
-
- gtk_text_view_set_buffer(logview, ui_logbuf);
-
- /* connect objects to function calls */
- // window
- window = GTK_WINDOW(gtk_builder_get_object(ui_builder, "window"));
- g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
-
- // connectbtn
- connectbtn = GTK_BUTTON(gtk_builder_get_object(ui_builder, "flashbtn"));
- g_signal_connect(connectbtn, "clicked",
- G_CALLBACK(ui_connect_clicked), NULL);
-
- // flashbtn
- flashbtn = GTK_BUTTON(gtk_builder_get_object(ui_builder, "flashbtn"));
- g_signal_connect(flashbtn, "clicked", G_CALLBACK(ui_flash_clicked), NULL);
-
- // file chooser
- filechoosebtn = GTK_FILE_CHOOSER_BUTTON(
- gtk_builder_get_object(ui_builder, "filechoosebtn"));
- g_signal_connect(filechoosebtn, "file-set", G_CALLBACK(ui_file_set), NULL);
-
- /* start gtk window */
- gtk_main();
-}
-
-void ui_log(const char *msg, char type)
-{
- GtkTextIter end;
- gchar typech[4] = "[ ] ";
-
- switch (type) {
- case 'm': typech[1] = '@'; break; // message
- case 'w': typech[1] = '#'; break; // warning
- case 'e': typech[1] = '!'; break; // error
- }
-
- gtk_text_buffer_get_end_iter(ui_logbuf, &end);
- gtk_text_buffer_insert(ui_logbuf, &end, typech, 4);
- gtk_text_buffer_get_end_iter(ui_logbuf, &end);
- gtk_text_buffer_insert(ui_logbuf, &end, (const gchar *) msg, strlen(msg));
-}
-
-void ui_file_set(GtkFileChooserButton *btn, gpointer user_data)
-{
- GtkEntry *filepath =
- GTK_ENTRY(gtk_builder_get_object(ui_builder, "filepath"));
-
- gtk_entry_set_text(filepath,
- gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(btn)));
-
- ui_log("File set\n", 'm');
- ui_fileset = true;
-}
-
-void ui_connect_clicked(void)
-{
-
-}
-
-void ui_flash_clicked(void)
-{
-
-}
diff --git a/sw/linux/src/z80prog b/sw/linux/src/z80prog
deleted file mode 100755
index 878683b..0000000
--- a/sw/linux/src/z80prog
+++ /dev/null
Binary files differ
diff --git a/sw/linux/src/main.c b/sw/programmer/linux/src/main.c
index 769992a..769992a 100644
--- a/sw/linux/src/main.c
+++ b/sw/programmer/linux/src/main.c
diff --git a/sw/linux/src/serial.c b/sw/programmer/linux/src/serial.c
index 564676b..e2544be 100644
--- a/sw/linux/src/serial.c
+++ b/sw/programmer/linux/src/serial.c
@@ -1,6 +1,6 @@
#include "serial.h"
-int serial_connect(const char *devpath, long baudrate)
+int serial_open(const char *devpath, unsigned long baudrate)
{
int fd;
struct termios tty;
@@ -40,3 +40,4 @@ int serial_connect(const char *devpath, long baudrate)
return fd;
}
+
diff --git a/sw/linux/src/serial.h b/sw/programmer/linux/src/serial.h
index 6123e42..fe21524 100644
--- a/sw/linux/src/serial.h
+++ b/sw/programmer/linux/src/serial.h
@@ -8,10 +8,6 @@
#include <fcntl.h>
#include <termios.h>
-int serial_connect(const char *devpath, long baudrate);
-void serial_close(int fd);
-
-void serial_program(const char *rompath);
-void serial_read_rom(const char *rom);
+int serial_open(const char *devpath, unsigned long baudrate);
#endif
diff --git a/sw/linux/src/ui.h b/sw/programmer/linux/src/ui.h
index 44314d6..510537a 100644
--- a/sw/linux/src/ui.h
+++ b/sw/programmer/linux/src/ui.h
@@ -1,17 +1,24 @@
#ifndef __Z80PROG_UI_H__
#define __Z80PROG_UI_H_
+#include "flash.h"
+
#include <stdbool.h>
#include <string.h>
#include <gtk/gtk.h>
+#define UI_LOG_ERR "[!] "
+#define UI_LOG_WARN "[#] "
+#define UI_LOG_MSG "[@] "
+
void ui_init(int *argc, char **argv[]);
-void ui_log(const char *msg, char type);
+void ui_log(const char *msg);
+void ui_check_enable_flashbtn(void);
void ui_file_set(GtkFileChooserButton *btn, gpointer user_data);
-
void ui_connect_clicked(void);
+void ui_disconnect_clicked(void);
void ui_flash_clicked(void);
#endif
diff --git a/sw/linux/src/z80prog.ui b/sw/programmer/linux/src/z80prog.ui
index 3735efa..6c652ec 100644
--- a/sw/linux/src/z80prog.ui
+++ b/sw/programmer/linux/src/z80prog.ui
@@ -44,7 +44,8 @@
<object class="GtkEntry" id="devpath">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="placeholder_text" translatable="yes">Enter path</property>
+ <property name="text" translatable="yes">/dev/tty</property>
+ <property name="placeholder_text" translatable="yes">Enter device path</property>
</object>
<packing>
<property name="expand">True</property>
@@ -59,14 +60,14 @@
<property name="width_chars">0</property>
<property name="max_width_chars">7</property>
<property name="overwrite_mode">True</property>
- <property name="placeholder_text" translatable="yes">9600</property>
+ <property name="placeholder_text" translatable="yes">1200</property>
<property name="input_purpose">number</property>
<property name="adjustment">baudrateadjust</property>
<property name="climb_rate">10</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
- <property name="value">9600</property>
+ <property name="value">1200</property>
</object>
<packing>
<property name="expand">False</property>
@@ -104,7 +105,7 @@
<object class="GtkEntry" id="filepath">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="placeholder_text" translatable="yes">Binary Path</property>
+ <property name="placeholder_text" translatable="yes">Enter binary path</property>
</object>
<packing>
<property name="expand">True</property>
@@ -173,21 +174,21 @@
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="logscrolled">
+ <object class="GtkViewport" id="logviewport">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkViewport" id="logviewport">
+ <object class="GtkExpander" id="logexpander">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="expanded">True</property>
+ <property name="label_fill">True</property>
+ <property name="resize_toplevel">True</property>
<child>
- <object class="GtkExpander" id="logexpander">
+ <object class="GtkScrolledWindow" id="logscroller">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="expanded">True</property>
- <property name="label_fill">True</property>
- <property name="resize_toplevel">True</property>
+ <property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="logview">
<property name="visible">True</property>
@@ -198,13 +199,13 @@
<property name="monospace">True</property>
</object>
</child>
- <child type="label">
- <object class="GtkLabel" id="loglabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Logs</property>
- </object>
- </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="loglabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Logs</property>
</object>
</child>
</object>
@@ -213,7 +214,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
</object>