mirror of
https://github.com/jscrane/r65emu.git
synced 2025-03-20 09:29:38 +00:00
port to esp32
This commit is contained in:
parent
69f7837ac3
commit
42bd04d46f
@ -3,6 +3,8 @@
|
||||
#include "checkpoint.h"
|
||||
#include "hardware.h"
|
||||
|
||||
#ifdef notdef
|
||||
|
||||
static char buf[32];
|
||||
static char chkpt[] = { "CHKPOINT" };
|
||||
static int cpid = 0;
|
||||
@ -27,3 +29,4 @@ void restore(sdtape &tape, const char *dir, const char *filename) {
|
||||
cpid = (n == 1)? 0: cpid+1;
|
||||
tape.start(dir);
|
||||
}
|
||||
#endif
|
||||
|
24
hardware.cpp
24
hardware.cpp
@ -1,6 +1,6 @@
|
||||
#include <UTFT.h>
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <UTFT.h>
|
||||
#include <SpiRAM.h>
|
||||
|
||||
#include "ps2drv.h"
|
||||
@ -12,26 +12,36 @@
|
||||
|
||||
Memory memory;
|
||||
PS2Driver ps2;
|
||||
|
||||
#if defined(SPIRAM_CS)
|
||||
spiram sram(SPIRAM_SIZE);
|
||||
#endif
|
||||
|
||||
UTFT utft(TFT_MODEL, TFT_RS, TFT_WR, TFT_CS, TFT_RST);
|
||||
static CPU *_cpu;
|
||||
|
||||
bool hardware_reset() {
|
||||
bool success = true;
|
||||
|
||||
#if defined(SPIRAM_CS)
|
||||
extern SPIClass SPIRAM_DEV;
|
||||
SPIRAM_DEV.begin();
|
||||
SPIRAM_DEV.setModule(SPIRAM_SPI);
|
||||
SPIRAM_DEV.setClockDivider(1);
|
||||
SPIRAM_DEV.setDataMode(SPI_MODE0);
|
||||
#endif
|
||||
|
||||
bool sd = SD.begin(SD_CS, 2, SD_SPI);
|
||||
#if defined(SD_CS)
|
||||
success = SD.begin(SD_CS, 2, SD_SPI);
|
||||
pinMode(SPI_CS, OUTPUT); // without this, the SPI-RAM isn't seen
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(TFT_BACKLIGHT)
|
||||
digitalWrite(TFT_BACKLIGHT, HIGH);
|
||||
#endif
|
||||
|
||||
_cpu->reset();
|
||||
return sd;
|
||||
return success;
|
||||
}
|
||||
|
||||
void hardware_init(CPU &cpu) {
|
||||
@ -42,10 +52,16 @@ void hardware_init(CPU &cpu) {
|
||||
#if defined(TFT_BACKLIGHT)
|
||||
pinMode(TFT_BACKLIGHT, OUTPUT);
|
||||
#endif
|
||||
|
||||
#if defined(SD_CS)
|
||||
pinMode(SD_CS, OUTPUT);
|
||||
digitalWrite(SD_CS, HIGH);
|
||||
#endif
|
||||
|
||||
#if defined(SPIRAM_CS)
|
||||
pinMode(SPIRAM_CS, OUTPUT);
|
||||
digitalWrite(SPIRAM_CS, HIGH);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hardware_checkpoint(Stream &s) {
|
||||
|
35
hardware.h
35
hardware.h
@ -6,35 +6,22 @@
|
||||
#define __HARDWARE_H__
|
||||
|
||||
// TFT display...
|
||||
// NOTE: edit memorysaver.h to select the correct chip for your display!
|
||||
// Daniel Rebollo's boosterpack
|
||||
#define TFT_BACKLIGHT PD_6
|
||||
#define TFT_MODEL SSD1289
|
||||
// TFT01_2.4: http://www.elecfreaks.com/store/24-tft-lcd-tft0124-p-110.html
|
||||
// #undef TFT_BACKLIGHT
|
||||
// #define TFT_MODEL S6D1121_8
|
||||
#define TFT_RS PC_6
|
||||
#define TFT_WR PC_5
|
||||
#define TFT_CS PC_7
|
||||
#define TFT_RST PC_4
|
||||
#undef TFT_BACKLIGHT
|
||||
#define TFT_MODEL ILI9325C
|
||||
#define TFT_RS 32
|
||||
#define TFT_WR 33
|
||||
#define TFT_CS 25
|
||||
#define TFT_RST 26
|
||||
|
||||
// PS/2 keyboard
|
||||
#define KBD_DATA PE_4
|
||||
#define KBD_IRQ PE_5
|
||||
#define KBD_DATA 14
|
||||
#define KBD_IRQ 12
|
||||
|
||||
// SPI-RAM
|
||||
#define SPIRAM_CS PE_0
|
||||
//#define SPIRAM_CS PF_3
|
||||
#define SPIRAM_SPI 1
|
||||
#define SPIRAM_DEV SPI_for_SD
|
||||
#define SPIRAM_SIZE 65536
|
||||
#undef SPIRAM_CS
|
||||
|
||||
// "tape" storage...
|
||||
#define SD_CS PF_3
|
||||
//#define SD_CS PE_0
|
||||
#define SD_SPI 1
|
||||
|
||||
#define SPI_CS PF_3
|
||||
#undef SD_CS
|
||||
|
||||
bool hardware_reset();
|
||||
void hardware_init(class CPU &);
|
||||
@ -44,7 +31,7 @@ void hardware_restore(class Stream &);
|
||||
#ifdef __PS2DRV_H__
|
||||
extern class PS2Driver ps2;
|
||||
#endif
|
||||
#ifdef __SPIRAM_H__
|
||||
#if defined(__SPIRAM_H__) && defined(SPIRAM_CS)
|
||||
extern class spiram sram;
|
||||
#endif
|
||||
#ifdef UTFT_h
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "spiram.h"
|
||||
#include "hardware.h"
|
||||
|
||||
#if defined(SPIRAM_CS)
|
||||
|
||||
extern SPIClass SPIRAM_DEV;
|
||||
|
||||
SpiRAM spiRam(SPIRAM_DEV, SPIRAM_CS);
|
||||
@ -35,4 +37,4 @@ void spiram::restore(Stream &s)
|
||||
spiRam.write_stream(i * 256, buf, sizeof(buf));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifdef notdef
|
||||
|
||||
#include <Energia.h>
|
||||
#include <stdint.h>
|
||||
#include <inc/hw_ints.h>
|
||||
@ -25,3 +27,4 @@ void timer_create(unsigned freq, Timed *client) {
|
||||
ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
|
||||
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet() / freq);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user