Removed programmer; BOSSA is good enough for now.
authorethereal <ethereal@ethv.net>
Tue, 11 Mar 2014 04:24:14 +0000 (22:24 -0600)
committerethereal <ethereal@ethv.net>
Tue, 11 Mar 2014 04:24:14 +0000 (22:24 -0600)
programmer/.gitignore [deleted file]
programmer/CMakeLists.txt [deleted file]
programmer/Makefile [deleted file]
programmer/src/CMakeLists.txt [deleted file]
programmer/src/main.c [deleted file]

diff --git a/programmer/.gitignore b/programmer/.gitignore
deleted file mode 100644 (file)
index c779f7e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-*~
-*.swp
-
-.vimrc
-.ycm*
-.gdb_history
-.clang_complete
-
-# Executable
-/programmer
-/build/
-core
-
-
diff --git a/programmer/CMakeLists.txt b/programmer/CMakeLists.txt
deleted file mode 100644 (file)
index 9164555..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-cmake_minimum_required(VERSION 2.6)
-
-#set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/)
-
-project(programmer C CXX)
-
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
-
-add_subdirectory(src)
diff --git a/programmer/Makefile b/programmer/Makefile
deleted file mode 100644 (file)
index 0ac7f01..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-.PHONY: all
-all:
-       $(MAKE) -C build
-
-.PHONY: redep
-redep:
-       mkdir -p build/ ; cd build/ ; cmake .. ; cd ..
-
-.PHONY: clean
-clean:
-       $(MAKE) -C build clean
-
-.PHONY: distclean
-distclean:
-       $(MAKE) -C build clean
-       rm -rf build
diff --git a/programmer/src/CMakeLists.txt b/programmer/src/CMakeLists.txt
deleted file mode 100644 (file)
index c75a587..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-add_definitions(-Wextra -Wall -std=gnu99)
-
-aux_source_directory(. dotSources)
-
-add_executable(programmer ${dotSources})
-
-target_link_libraries(programmer m)
diff --git a/programmer/src/main.c b/programmer/src/main.c
deleted file mode 100644 (file)
index 27b8558..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <fcntl.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
-#define FLASH_BASE 0x400000
-#define PAGE_SIZE 0x100
-
-struct {
-    const char *serial_path;
-    int serial_fd;
-} state;
-
-static void pabort(const char *what) {
-    perror(what);
-    abort();
-}
-
-static void serial_init();
-static void serial_close();
-static void serial_send(const void *data, size_t bytes);
-
-static void program_page(uint32_t pageid, const void *data, uint32_t bytes);
-
-int main(int argc, char *argv[]) {
-    state.serial_path = "/dev/ttyAMA0";
-    serial_init();
-
-    int fd = open(argv[1], O_RDONLY);
-    size_t data_size = lseek(fd, 0, SEEK_END);
-    uint8_t *data = malloc(data_size);
-    lseek(fd, 0, SEEK_SET);
-    read(fd, data, data_size);
-    close(fd);
-
-    /*for(size_t i = 0x800; i < data_size; i ++) {
-        char buffer[32];
-        sprintf(buffer, "O%lx,%x#", offset + i, data[i]);
-
-        serial_send(buffer, strlen(buffer));
-    }*/
-
-    for(size_t i = 0; i < data_size; i += PAGE_SIZE) {
-        program_page(i/PAGE_SIZE, data + i, data_size-i);
-    }
-
-    serial_close();
-
-    return 0;
-}
-
-static void serial_init() {
-    state.serial_fd = open(state.serial_path, O_RDWR | O_NDELAY | O_NOCTTY);
-    if(state.serial_fd == -1) pabort("open");
-
-    struct termios options;
-       tcgetattr(state.serial_fd, &options);
-       options.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
-       options.c_iflag = IGNPAR;
-       options.c_oflag = 0;
-       options.c_lflag = 0;
-       tcflush(state.serial_fd, TCIFLUSH);
-       tcsetattr(state.serial_fd, TCSANOW, &options);
-}
-
-static void serial_close() {
-    close(state.serial_fd);
-    state.serial_fd = -1;
-}
-
-static void serial_send(const void *data, size_t bytes) {
-    size_t off = 0;
-    while(off < bytes) {
-        int ret = write(state.serial_fd, (const uint8_t *)data + off, bytes-off);
-        if(ret < 0 && (errno != EAGAIN && errno != EWOULDBLOCK)) {
-            pabort("write");
-        }
-        else if(ret > 0) off += ret;
-    }
-}
-
-static void serial_recv(const void *data, size_t bytes) {
-    
-}
-
-#define FLASH_REG_BASE 0x400e0a00
-#define FLASH_REG_FMR FLASH_REG_BASE + 0x0
-#define FLASH_REG_FCR FLASH_REG_BASE + 0x4
-#define FLASH_REG_FSR FLASH_REG_BASE + 0x8
-#define FLASH_REG_FRR FLASH_REG_BASE + 0xc
-
-static void program_page(uint32_t pageid, const void *data, uint32_t bytes) {
-    // write into latch buffer
-    for(size_t i = 0; i < PAGE_SIZE && i < bytes; i ++) {
-        char buffer[32];
-        sprintf(buffer, "O%lx,%x#", FLASH_BASE + pageid*PAGE_SIZE + i, ((uint8_t *)data)[i]);
-
-        serial_send(buffer, strlen(buffer));
-    }
-
-    // send erase-and-write command
-    char buffer[32];
-    sprintf(buffer, "W%x,%x#", FLASH_REG_FMR, 0x5a000003 | (pageid<<8));
-    serial_send(buffer, strlen(buffer));
-}