mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-12-29 06:21:58 +01:00
cic 64dd support
This commit is contained in:
parent
b055a439a4
commit
beb927aef3
2
build.sh
2
build.sh
@ -5,7 +5,7 @@ set -e
|
|||||||
PACKAGE_FILE_NAME="SC64"
|
PACKAGE_FILE_NAME="SC64"
|
||||||
|
|
||||||
FILES=(
|
FILES=(
|
||||||
"./fw/ftdi-template.xml"
|
"./fw/ft232h_config.xml"
|
||||||
"./fw/project/lcmxo2/impl1/sc64_impl1.bit"
|
"./fw/project/lcmxo2/impl1/sc64_impl1.bit"
|
||||||
"./fw/project/lcmxo2/impl1/sc64_impl1.jed"
|
"./fw/project/lcmxo2/impl1/sc64_impl1.jed"
|
||||||
"./sw/bootloader/build/bootloader.bin"
|
"./sw/bootloader/build/bootloader.bin"
|
||||||
|
@ -34,7 +34,6 @@ static const vi_regs_t vi_config[] = {{
|
|||||||
VI_CR_PIXEL_ADVANCE_0 |
|
VI_CR_PIXEL_ADVANCE_0 |
|
||||||
VI_CR_ANTIALIAS_1 |
|
VI_CR_ANTIALIAS_1 |
|
||||||
VI_CR_ANTIALIAS_0 |
|
VI_CR_ANTIALIAS_0 |
|
||||||
VI_CR_GAMMA_ON |
|
|
||||||
VI_CR_TYPE_32
|
VI_CR_TYPE_32
|
||||||
),
|
),
|
||||||
.H_WIDTH = SCREEN_WIDTH,
|
.H_WIDTH = SCREEN_WIDTH,
|
||||||
@ -55,7 +54,6 @@ static const vi_regs_t vi_config[] = {{
|
|||||||
VI_CR_PIXEL_ADVANCE_0 |
|
VI_CR_PIXEL_ADVANCE_0 |
|
||||||
VI_CR_ANTIALIAS_1 |
|
VI_CR_ANTIALIAS_1 |
|
||||||
VI_CR_ANTIALIAS_0 |
|
VI_CR_ANTIALIAS_0 |
|
||||||
VI_CR_GAMMA_ON |
|
|
||||||
VI_CR_TYPE_32
|
VI_CR_TYPE_32
|
||||||
),
|
),
|
||||||
.H_WIDTH = SCREEN_WIDTH,
|
.H_WIDTH = SCREEN_WIDTH,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "error.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "sc64.h"
|
#include "sc64.h"
|
||||||
@ -8,6 +9,11 @@ void init (void) {
|
|||||||
si_io_write((io32_t *) (&PIFRAM[0x3C]), pifram | 0x08);
|
si_io_write((io32_t *) (&PIFRAM[0x3C]), pifram | 0x08);
|
||||||
|
|
||||||
exception_install();
|
exception_install();
|
||||||
|
|
||||||
|
if (!sc64_check_presence()) {
|
||||||
|
error_display("SC64 hardware not detected");
|
||||||
|
}
|
||||||
|
|
||||||
exception_enable_watchdog();
|
exception_enable_watchdog();
|
||||||
exception_enable_interrupts();
|
exception_enable_interrupts();
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ void sc64_get_info (sc64_info_t *info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sc64_init (void) {
|
void sc64_init (void) {
|
||||||
while (!sc64_check_presence());
|
|
||||||
sc64_change_config(CFG_ID_BOOTLOADER_SWITCH, false);
|
sc64_change_config(CFG_ID_BOOTLOADER_SWITCH, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,27 +5,30 @@ from PIL import Image
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (len(sys.argv) != 3):
|
if __name__ == "__main__":
|
||||||
print(f"Usage: python {sys.argv[0]} input_path output_path")
|
if (len(sys.argv) != 3):
|
||||||
exit(-1)
|
print(f"Usage: python {sys.argv[0]} input_path output_path")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
asset_input = sys.argv[1]
|
asset_input = sys.argv[1]
|
||||||
asset_output = sys.argv[2]
|
asset_output = sys.argv[2]
|
||||||
|
|
||||||
source_asset = None
|
source_asset = None
|
||||||
final_asset = None
|
final_asset = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
source_asset = Image.open(asset_input)
|
source_asset = Image.open(asset_input)
|
||||||
converted_asset = source_asset.convert("RGBA")
|
converted_asset = source_asset.convert("RGBA")
|
||||||
final_asset = open(asset_output, "wb")
|
final_asset = open(asset_output, "wb")
|
||||||
final_asset.write(converted_asset.tobytes())
|
final_asset.write(converted_asset.tobytes())
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(f"Couldn't open file \"{asset_input}\"")
|
print(f"Couldn't open file \"{asset_input}\"")
|
||||||
except Exception as e:
|
sys.exit(2)
|
||||||
print(e)
|
except Exception as e:
|
||||||
finally:
|
print(e)
|
||||||
if (source_asset):
|
sys.exit(3)
|
||||||
source_asset.close()
|
finally:
|
||||||
if (final_asset):
|
if (source_asset):
|
||||||
final_asset.close()
|
source_asset.close()
|
||||||
|
if (final_asset):
|
||||||
|
final_asset.close()
|
||||||
|
@ -12,6 +12,7 @@ typedef enum {
|
|||||||
|
|
||||||
|
|
||||||
static volatile bool cic_enabled = false;
|
static volatile bool cic_enabled = false;
|
||||||
|
static volatile bool cic_detect_enabled;
|
||||||
|
|
||||||
static volatile uint8_t cic_next_rd;
|
static volatile uint8_t cic_next_rd;
|
||||||
static volatile uint8_t cic_next_wr;
|
static volatile uint8_t cic_next_wr;
|
||||||
@ -54,6 +55,12 @@ static void cic_irq_clk_falling (void) {
|
|||||||
|
|
||||||
static void cic_irq_clk_rising (void) {
|
static void cic_irq_clk_rising (void) {
|
||||||
hw_gpio_set(GPIO_ID_N64_CIC_DQ);
|
hw_gpio_set(GPIO_ID_N64_CIC_DQ);
|
||||||
|
if (cic_detect_enabled) {
|
||||||
|
cic_detect_enabled = false;
|
||||||
|
if (!hw_gpio_get(GPIO_ID_N64_CIC_DQ)) {
|
||||||
|
cic_enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t cic_read (void) {
|
static uint8_t cic_read (void) {
|
||||||
@ -67,6 +74,10 @@ static void cic_write (uint8_t bit) {
|
|||||||
task_yield();
|
task_yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cic_start_detect (void) {
|
||||||
|
cic_detect_enabled = cic_dd_mode;
|
||||||
|
}
|
||||||
|
|
||||||
static uint8_t cic_read_nibble (void) {
|
static uint8_t cic_read_nibble (void) {
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
@ -97,17 +108,11 @@ static void cic_encode_round (uint8_t index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void cic_write_id (cic_region_t region) {
|
static void cic_write_id (cic_region_t region) {
|
||||||
uint8_t id = 0x01;
|
cic_start_detect();
|
||||||
|
cic_write(cic_dd_mode ? 1 : 0);
|
||||||
if (cic_dd_mode) {
|
cic_write(region == REGION_PAL ? 1 : 0);
|
||||||
id |= 0x08;
|
cic_write(0);
|
||||||
}
|
cic_write(1);
|
||||||
|
|
||||||
if (region == REGION_PAL) {
|
|
||||||
id |= 0x04;
|
|
||||||
}
|
|
||||||
|
|
||||||
cic_write_nibble(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cic_write_id_failed (void) {
|
static void cic_write_id_failed (void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user