St and X86 moved to support

This commit is contained in:
karllurman
2018-11-01 11:15:58 +11:00
parent 3fccd05165
commit 62058bfa32
10 changed files with 119 additions and 106 deletions

View File

@@ -3,6 +3,7 @@
SHELL = /bin/bash -o pipefail
# using gcc version 5.4.1 20161213 (Linaro GCC 5.4-2017.01-rc2)
# This is the location of the linaro compiler in the wsbu/toolchain-linaro docker container
BASE = /opt/linaro/bin/arm-linux-gnueabihf
CC = $(BASE)-gcc
@@ -18,11 +19,13 @@ SRC2 = $(wildcard *.cpp)
MINIMIG_SRC = $(wildcard ./support/minimig/*.cpp)
SHARPMZ_SRC = $(wildcard ./support/sharpmz/*.cpp)
ARCHIE_SRC = $(wildcard ./support/archie/*.cpp)
ST_SRC = $(wildcard ./support/st/*.cpp)
X86_SRC = $(wildcard ./support/x86/*.cpp)
VPATH = ./:./support/minimig:./support/sharpmz:./support/archie
VPATH = ./:./support/minimig:./support/sharpmz:./support/archie:./support/st:./support/x86
OBJ = $(SRC:.c=.o) $(SRC2:.cpp=.o) $(MINIMIG_SRC:.cpp=.o) $(SHARPMZ_SRC:.cpp=.o) $(ARCHIE_SRC:.cpp=.o)
DEP = $(SRC:.c=.d) $(SRC2:.cpp=.d) $(MINIMIG_SRC:.cpp=.d) $(SHARPMZ_SRC:.cpp=.d) $(ARCHIE_SRC:.cpp=.d)
OBJ = $(SRC:.c=.o) $(SRC2:.cpp=.o) $(MINIMIG_SRC:.cpp=.o) $(SHARPMZ_SRC:.cpp=.o) $(ARCHIE_SRC:.cpp=.o) $(ST_SRC:.cpp=.o) $(X86_SRC:.cpp=.o)
DEP = $(SRC:.c=.d) $(SRC2:.cpp=.d) $(MINIMIG_SRC:.cpp=.d) $(SHARPMZ_SRC:.cpp=.d) $(ARCHIE_SRC:.cpp=.d) $(ST_SRC:.cpp=.d) $(X86_SRC:.cpp=.d)
CFLAGS = $(DFLAGS) -c -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DVDATE=\"`date +"%y%m%d"`\"
LFLAGS = -lc -lstdc++ -lrt
@@ -37,6 +40,12 @@ clean:
rm -f *.d *.o *.elf *.map *.lst *.bak *.rej *.org *.user *~ $(PRJ)
rm -rf obj .vs DTAR* x64
cleanall:
rm -rf *.d *.o *.elf *.map *.lst *.bak *.rej *.org *.user *~ $(PRJ)
rm -rf obj .vs DTAR* x64
find . -name '*.o' -delete
find . -name '*.d' -delete
%.o: %.c
@$(info $<)
@$(CC) $(CFLAGS) -std=gnu99 -o $@ -c $< 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):\([0-9]\+\):/\1(\2,\ \3):/g'

View File

@@ -34,23 +34,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ifaddrs.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <stdbool.h>
#include "stdio.h"
#include "string.h"
#include "file_io.h"
#include "osd.h"
#include "hardware.h"
#include "menu.h"
#include "user_io.h"
#include "st_tos.h"
#include "debug.h"
#include "support.h"
#include "fpga_io.h"
#include <stdbool.h>
#include "cfg.h"
#include "input.h"
#include "x86.h"
#include "battery.h"
#include "support.h"
/*menu states*/
enum MENU
{

View File

@@ -9,3 +9,10 @@
// Archie support
#include "support/archie/archie.h"
// ST (Atari) support
#include "support/st/st_ikbd.h"
#include "support/st/st_tos.h"
// X86 support
#include "support/x86/x86.h"

View File

@@ -27,10 +27,10 @@ M1 tank platoon/A_385 fixed
#include <stdio.h>
#include <string.h>
#include "user_io.h"
#include "spi.h"
#include "../../user_io.h"
#include "../../spi.h"
#include "st_ikbd.h"
#include "debug.h"
#include "../../debug.h"
#define IKBD_AUTO_MS 20

View File

@@ -2,14 +2,14 @@
#include <stdio.h>
#include <string.h>
#include "hardware.h"
#include "menu.h"
#include "../../hardware.h"
#include "../../menu.h"
#include "st_tos.h"
#include "file_io.h"
#include "debug.h"
#include "user_io.h"
#include "../../file_io.h"
#include "../../debug.h"
#include "../../user_io.h"
#include "st_ikbd.h"
#include "fpga_io.h"
#include "../../fpga_io.h"
#define CONFIG_FILENAME "MIST.CFG"

View File

@@ -1,7 +1,7 @@
#ifndef __ST_TOS_H__
#define __ST_TOS_H__
#include "file_io.h"
#include "../../file_io.h"
// FPGA spi cmommands
#define MIST_INVALID 0x00

View File

@@ -24,18 +24,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <stdbool.h>
#include <fcntl.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <stdbool.h>
#include <fcntl.h>
#include <time.h>
#include "spi.h"
#include "user_io.h"
#include "file_io.h"
#include "fpga_io.h"
#include "../../spi.h"
#include "../../user_io.h"
#include "../../file_io.h"
#include "../../fpga_io.h"
#define ALT_CPU_CPU_FREQ 90000000u
@@ -62,52 +62,52 @@ typedef struct
static x86_config config;
static uint8_t dma_sdio(int status)
{
uint8_t res;
EnableFpga();
spi8(UIO_DMA_SDIO);
res = spi_w((uint16_t)status);
DisableFpga();
return res;
}
static uint32_t dma_get(uint32_t address)
{
EnableFpga();
spi8(UIO_DMA_READ);
spi32w(address);
uint32_t res = spi32w(0);
DisableFpga();
return res;
}
static void dma_set(uint32_t address, uint32_t data)
{
EnableFpga();
spi8(UIO_DMA_WRITE);
spi32w(address);
spi32w(data);
DisableFpga();
}
static void dma_sendbuf(uint32_t address, uint32_t length, uint32_t *data)
{
EnableFpga();
spi8(UIO_DMA_WRITE);
spi32w(address);
while (length--) spi32w(*data++);
DisableFpga();
}
static uint8_t dma_sdio(int status)
{
uint8_t res;
EnableFpga();
spi8(UIO_DMA_SDIO);
res = spi_w((uint16_t)status);
DisableFpga();
return res;
}
static void dma_rcvbuf(uint32_t address, uint32_t length, uint32_t *data)
{
EnableFpga();
spi8(UIO_DMA_READ);
spi32w(address);
while (length--) *data++ = spi32w(0);
DisableFpga();
}
static uint32_t dma_get(uint32_t address)
{
EnableFpga();
spi8(UIO_DMA_READ);
spi32w(address);
uint32_t res = spi32w(0);
DisableFpga();
return res;
}
static void dma_set(uint32_t address, uint32_t data)
{
EnableFpga();
spi8(UIO_DMA_WRITE);
spi32w(address);
spi32w(data);
DisableFpga();
}
static void dma_sendbuf(uint32_t address, uint32_t length, uint32_t *data)
{
EnableFpga();
spi8(UIO_DMA_WRITE);
spi32w(address);
while (length--) spi32w(*data++);
DisableFpga();
}
static void dma_rcvbuf(uint32_t address, uint32_t length, uint32_t *data)
{
EnableFpga();
spi8(UIO_DMA_READ);
spi32w(address);
while (length--) *data++ = spi32w(0);
DisableFpga();
}
static int load_bios(const char* name, uint8_t index)
{
@@ -178,30 +178,30 @@ static __inline fileTYPE *get_image(uint32_t type)
return &fdd_image1;
}
static int img_mount(uint32_t type, char *name)
{
FileClose(get_image(type));
int writable = FileCanWrite(name);
int ret = FileOpenEx(get_image(type), name, writable ? (O_RDWR | O_SYNC) : O_RDONLY);
if (!ret)
{
get_image(type)->size = 0;
printf("Failed to open file %s\n", name);
return 0;
}
printf("Mount %s as %s\n", name, writable ? "read-write" : "read-only");
return 1;
}
static int img_mount(uint32_t type, char *name)
{
FileClose(get_image(type));
static int img_read(uint32_t type, uint32_t lba, void *buf, uint32_t len)
int writable = FileCanWrite(name);
int ret = FileOpenEx(get_image(type), name, writable ? (O_RDWR | O_SYNC) : O_RDONLY);
if (!ret)
{
get_image(type)->size = 0;
printf("Failed to open file %s\n", name);
return 0;
}
printf("Mount %s as %s\n", name, writable ? "read-write" : "read-only");
return 1;
}
static int img_read(uint32_t type, uint32_t lba, void *buf, uint32_t len)
{
if (!FileSeekLBA(get_image(type), lba)) return 0;
return FileReadAdv(get_image(type), buf, len);
}
static int img_write(uint32_t type, uint32_t lba, void *buf, uint32_t len)
static int img_write(uint32_t type, uint32_t lba, void *buf, uint32_t len)
{
if (!FileSeekLBA(get_image(type), lba)) return 0;
return FileWriteAdv(get_image(type), buf, len);
@@ -488,14 +488,14 @@ static int hdd_set(uint32_t num)
return hdd[num].present;
}
static uint8_t bin2bcd(unsigned val)
{
return ((val / 10) << 4) + (val % 10);
static uint8_t bin2bcd(unsigned val)
{
return ((val / 10) << 4) + (val % 10);
}
void x86_init()
{
user_io_8bit_set_status(UIO_STATUS_RESET, UIO_STATUS_RESET);
user_io_8bit_set_status(UIO_STATUS_RESET, UIO_STATUS_RESET);
load_bios("ao486/boot0.rom", 0);
load_bios("ao486/boot1.rom", 1);
@@ -532,7 +532,7 @@ void x86_init()
//-------------------------------------------------------------------------- floppy
fdd_set(config.fdd_name);
//-------------------------------------------------------------------------- hdd
hdd_set(0);
@@ -551,8 +551,8 @@ void x86_init()
unsigned char translate_mode = 1; //LBA
translate_mode = (translate_mode << 6) | (translate_mode << 4) | (translate_mode << 2) | translate_mode;
time_t t = time(NULL);
struct tm tm = *localtime(&t);
time_t t = time(NULL);
struct tm tm = *localtime(&t);
//rtc contents 0-127
uint32_t tmp[128] = {
@@ -650,8 +650,8 @@ void x86_init()
cmos[0x2F] = sum & 0xFF;
for(unsigned int i=0; i<sizeof(cmos)/sizeof(unsigned int); i++) IOWR(RTC_BASE, i, cmos[i]);
user_io_8bit_set_status(0, UIO_STATUS_RESET);
user_io_8bit_set_status(0, UIO_STATUS_RESET);
}
struct sd_param_t

View File

@@ -11,22 +11,19 @@
#include "hardware.h"
#include "osd.h"
#include "user_io.h"
#include "debug.h"
#include "st_ikbd.h"
#include "spi.h"
#include "cfg.h"
#include "st_tos.h"
#include "input.h"
#include "fpga_io.h"
#include "file_io.h"
#include "menu.h"
#include "x86.h"
#include "tzx2wav.h"
#include "DiskImage.h"
#include "support.h"
#include "brightness.h"
#include "sxmlc.h"
#include "tzx2wav.h"
#include "support.h"
static char core_path[1024];