From d0801b36b47d8f3da610597160fde92059fd7e62 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 7 Aug 2017 19:27:05 +0200 Subject: implementation for avr programmer the programmer will receive the binary in blocks of defined size by a program under sw/programmer/linux (moved from sw/linux). --- sw/linux/config.h | 26 ------ sw/linux/configure.ac | 23 ----- sw/linux/makefile.am | 2 - sw/linux/reading_links.txt | 4 - sw/linux/src/main.c | 13 --- sw/linux/src/makefile.am | 7 -- sw/linux/src/serial.c | 42 --------- sw/linux/src/serial.h | 17 ---- sw/linux/src/ui.c | 90 ------------------ sw/linux/src/ui.h | 17 ---- sw/linux/src/z80prog | Bin 34688 -> 0 bytes sw/linux/src/z80prog.ui | 222 --------------------------------------------- 12 files changed, 463 deletions(-) delete mode 100644 sw/linux/config.h delete mode 100644 sw/linux/configure.ac delete mode 100644 sw/linux/makefile.am delete mode 100644 sw/linux/reading_links.txt delete mode 100644 sw/linux/src/main.c delete mode 100644 sw/linux/src/makefile.am delete mode 100644 sw/linux/src/serial.c delete mode 100644 sw/linux/src/serial.h delete mode 100644 sw/linux/src/ui.c delete mode 100644 sw/linux/src/ui.h delete mode 100755 sw/linux/src/z80prog delete mode 100644 sw/linux/src/z80prog.ui (limited to 'sw/linux') diff --git a/sw/linux/config.h b/sw/linux/config.h deleted file mode 100644 index d319f43..0000000 --- a/sw/linux/config.h +++ /dev/null @@ -1,26 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Name of package */ -#define PACKAGE "z80prog" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "naopross@tharcway.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "z80prog" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "z80prog 0.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "z80prog" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "0.1" - -/* Version number of package */ -#define VERSION "0.1" diff --git a/sw/linux/configure.ac b/sw/linux/configure.ac deleted file mode 100644 index a5c4b3b..0000000 --- a/sw/linux/configure.ac +++ /dev/null @@ -1,23 +0,0 @@ -AC_CONFIG_SRCDIR([src]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_AUX_DIR([build-aux]) - -AC_INIT([z80prog], [0.1], [naopross@tharcway.org]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign]) - -AC_PROG_CC - -#### -# Check for required packages / libraries -# -LIBGTK_REQUIRED=2.91 - -PKG_CHECK_MODULES(gtk3, [gtk+-3.0 >= $LIBGTK_REQUIRED]) - -AC_CONFIG_FILES([ - makefile - src/makefile -]) - -AC_OUTPUT diff --git a/sw/linux/makefile.am b/sw/linux/makefile.am deleted file mode 100644 index 4d27cea..0000000 --- a/sw/linux/makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -SUBDIRS = src -CLEANFILES = *~ diff --git a/sw/linux/reading_links.txt b/sw/linux/reading_links.txt deleted file mode 100644 index 83c62f4..0000000 --- a/sw/linux/reading_links.txt +++ /dev/null @@ -1,4 +0,0 @@ -https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5 -https://developer.gnome.org/gio/unstable/GApplication.html -https://git.gnome.org/browse/gnome-hello/tree/src/app.c - diff --git a/sw/linux/src/main.c b/sw/linux/src/main.c deleted file mode 100644 index 769992a..0000000 --- a/sw/linux/src/main.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "config.h" -#include "ui.h" - -#include -#include -#include - -int main(int argc, char *argv[]) -{ - ui_init(&argc, &argv); - return 0; -} - 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/serial.c b/sw/linux/src/serial.c deleted file mode 100644 index 564676b..0000000 --- a/sw/linux/src/serial.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "serial.h" - -int serial_connect(const char *devpath, long baudrate) -{ - int fd; - struct termios tty; - // struct termios tty_old; - - // open device - if ((fd = open(devpath, O_RDWR | O_NOCTTY)) < 0) { - return -1; - } - - // set parameters - if (tcgetattr(fd, &tty) != 0) { - return -1; - } - - // TODO: update UI or add support for custom baudrate - // cfsetospeed(&tty, - // cfsetispeed(&tty, - - tty.c_cflag &= ~PARENB; // no parity - tty.c_cflag &= ~CSTOPB; // no stop bit - tty.c_cflag |= CS8; // 8 bit data - tty.c_cflag &= ~CRTSCTS; // no flow control - - tty.c_lflag = 0; // no signaling chars, no echo, no canonical processing - tty.c_oflag = 0; // no remapping, no delays - tty.c_cc[VMIN] = 0; // no block read - tty.c_cc[VTIME] = .5; // .5 seconds read timeout - - tty.c_cflag |= CREAD | CLOCAL; // turn on read and ignore ctrl lines - tty.c_iflag &= ~(IXON | IXOFF | IXANY); // turn off s/w flow ctrl - tty.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // make raw - tty.c_oflag &= ~OPOST; // make raw - - tcflush(fd , TCIFLUSH); - // if (tcsetaddr( - - return fd; -} diff --git a/sw/linux/src/serial.h b/sw/linux/src/serial.h deleted file mode 100644 index 6123e42..0000000 --- a/sw/linux/src/serial.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __Z80PROG_SERIAL_H__ -#define __Z80PROG_SERIAL_H__ - -#include -#include -#include -#include -#include -#include - -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); - -#endif 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/ui.h b/sw/linux/src/ui.h deleted file mode 100644 index 44314d6..0000000 --- a/sw/linux/src/ui.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __Z80PROG_UI_H__ -#define __Z80PROG_UI_H_ - -#include -#include - -#include - -void ui_init(int *argc, char **argv[]); -void ui_log(const char *msg, char type); - -void ui_file_set(GtkFileChooserButton *btn, gpointer user_data); - -void ui_connect_clicked(void); -void ui_flash_clicked(void); - -#endif diff --git a/sw/linux/src/z80prog b/sw/linux/src/z80prog deleted file mode 100755 index 878683b..0000000 Binary files a/sw/linux/src/z80prog and /dev/null differ diff --git a/sw/linux/src/z80prog.ui b/sw/linux/src/z80prog.ui deleted file mode 100644 index 3735efa..0000000 --- a/sw/linux/src/z80prog.ui +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - 1000000 - 9600 - 1 - 10 - - - - *.bin - *.gb - *.gba - *.gbc - *.hex - - - - 450 - 250 - True - False - Z80 ROM Programmer - 450 - 200 - - - True - False - 10 - 10 - 10 - 10 - vertical - 10 - - - True - False - 10 - - - True - True - Enter path - - - True - True - 0 - - - - - True - True - 0 - 7 - True - 9600 - number - baudrateadjust - 10 - True - True - if-valid - 9600 - - - False - True - 1 - - - - - gtk-connect - True - True - True - True - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - 10 - - - True - True - Binary Path - - - True - True - 0 - - - - - True - False - gbbinfilter - - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - 10 - - - True - False - True - start - - - True - True - 0 - - - - - Flash - True - False - True - True - - - False - True - 1 - - - - - False - True - 2 - - - - - True - True - in - - - True - False - - - True - True - True - True - True - - - True - True - True - True - False - True - - - - - True - False - Logs - - - - - - - - - True - True - 4 - - - - - - -- cgit v1.2.1