cleanup uploader code
This commit is contained in:
parent
01e41d36dd
commit
553ef0059a
@ -6,13 +6,6 @@
|
|||||||
# / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
|
# / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
|
||||||
# \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
|
# \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
|
||||||
# \__> \/ \/ \/ \/ \/
|
# \__> \/ \/ \/ \/ \/
|
||||||
# ___.
|
|
||||||
# __ __ _____\_ |__
|
|
||||||
# | | \/ ___/| __ \
|
|
||||||
# | | /\___ \ | \_\ \
|
|
||||||
# |____//____ >|___ /
|
|
||||||
# \/ \/
|
|
||||||
#
|
|
||||||
# www.optixx.org
|
# www.optixx.org
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|||||||
@ -42,6 +42,7 @@
|
|||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
#include "huffman-decode.h"
|
#include "huffman-decode.h"
|
||||||
#include "rle.h"
|
#include "rle.h"
|
||||||
|
#include "loader.h"
|
||||||
|
|
||||||
|
|
||||||
extern const char _rom[] PROGMEM;
|
extern const char _rom[] PROGMEM;
|
||||||
@ -380,63 +381,7 @@ void decompress_huffman(void){
|
|||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void decompress_rle(void){
|
|
||||||
rle_decode(&_rom,30180,0x000000);
|
|
||||||
printf("Done\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void boot_startup_rom(){
|
|
||||||
|
|
||||||
uint8_t i = 0;
|
|
||||||
|
|
||||||
printf("Activate AVR bus\n");
|
|
||||||
avr_bus_active();
|
|
||||||
|
|
||||||
printf("IRQ off\n");
|
|
||||||
snes_irq_lo();
|
|
||||||
snes_irq_off();
|
|
||||||
|
|
||||||
snes_lorom();
|
|
||||||
printf("Set Snes lowrom \n");
|
|
||||||
|
|
||||||
/*
|
|
||||||
printf("Set Snes hirom\n");
|
|
||||||
snes_hirom();
|
|
||||||
|
|
||||||
printf("Disable snes WR\n");
|
|
||||||
snes_wr_disable();
|
|
||||||
|
|
||||||
printf("IRQ off\n");
|
|
||||||
snes_irq_lo();
|
|
||||||
snes_irq_off();
|
|
||||||
*/
|
|
||||||
|
|
||||||
decompress_rle();
|
|
||||||
dump_memory(0x10000 - 0x100, 0x10000);
|
|
||||||
//crc_check_bulk_memory(0x00000, 0x10000, 0x8000);
|
|
||||||
|
|
||||||
snes_reset_hi();
|
|
||||||
snes_reset_off();
|
|
||||||
snes_irq_lo();
|
|
||||||
snes_irq_off();
|
|
||||||
printf("IRQ off\n");
|
|
||||||
snes_hirom();
|
|
||||||
snes_wr_disable();
|
|
||||||
printf("Disable snes WR\n");
|
|
||||||
snes_bus_active();
|
|
||||||
printf("Activate Snes bus\n");
|
|
||||||
_delay_ms(100);
|
|
||||||
printf("Reset Snes\n");
|
|
||||||
send_reset();
|
|
||||||
i = 20;
|
|
||||||
printf("Wait");
|
|
||||||
while (--i){
|
|
||||||
_delay_ms(500);
|
|
||||||
printf(".");
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void send_reset(){
|
void send_reset(){
|
||||||
printf("Reset Snes\n");
|
printf("Reset Snes\n");
|
||||||
@ -485,6 +430,58 @@ void usb_connect(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void boot_startup_rom(){
|
||||||
|
|
||||||
|
uint8_t i = 0;
|
||||||
|
|
||||||
|
printf("Activate AVR bus\n");
|
||||||
|
avr_bus_active();
|
||||||
|
|
||||||
|
printf("IRQ off\n");
|
||||||
|
snes_irq_lo();
|
||||||
|
snes_irq_off();
|
||||||
|
|
||||||
|
snes_lorom();
|
||||||
|
printf("Set Snes lowrom \n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
printf("Set Snes hirom\n");
|
||||||
|
snes_hirom();
|
||||||
|
|
||||||
|
printf("Disable snes WR\n");
|
||||||
|
snes_wr_disable();
|
||||||
|
|
||||||
|
printf("IRQ off\n");
|
||||||
|
snes_irq_lo();
|
||||||
|
snes_irq_off();
|
||||||
|
*/
|
||||||
|
|
||||||
|
rle_decode(&_rom, ROM_SIZE, 0x000000);
|
||||||
|
dump_memory(0x10000 - 0x100, 0x10000);
|
||||||
|
|
||||||
|
snes_reset_hi();
|
||||||
|
snes_reset_off();
|
||||||
|
snes_irq_lo();
|
||||||
|
snes_irq_off();
|
||||||
|
printf("IRQ off\n");
|
||||||
|
snes_hirom();
|
||||||
|
snes_wr_disable();
|
||||||
|
printf("Disable snes WR\n");
|
||||||
|
snes_bus_active();
|
||||||
|
printf("Activate Snes bus\n");
|
||||||
|
_delay_ms(100);
|
||||||
|
printf("Reset Snes\n");
|
||||||
|
send_reset();
|
||||||
|
i = 20;
|
||||||
|
printf("Wait");
|
||||||
|
while (--i){
|
||||||
|
_delay_ms(500);
|
||||||
|
printf(".");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|||||||
@ -36,6 +36,7 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
|
|||||||
uint8_t in_byte, in_repeat, last_byte;
|
uint8_t in_byte, in_repeat, last_byte;
|
||||||
uint32_t out_len, out_len_left;
|
uint32_t out_len, out_len_left;
|
||||||
printf("RLE decode len=%li addr=0x%08lx\n",in_len,out_addr);
|
printf("RLE decode len=%li addr=0x%08lx\n",in_len,out_addr);
|
||||||
|
last_byte = 0;
|
||||||
|
|
||||||
out_len_left = out_len;
|
out_len_left = out_len;
|
||||||
sram_bulk_write_start(out_addr);
|
sram_bulk_write_start(out_addr);
|
||||||
@ -56,18 +57,11 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
|
|||||||
out_addr++;\
|
out_addr++;\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/*
|
|
||||||
** Handle first byte separately (since we have to get angry
|
|
||||||
** in case of an orphaned RLE code).
|
|
||||||
*/
|
|
||||||
INBYTE(in_byte);
|
INBYTE(in_byte);
|
||||||
|
|
||||||
if (in_byte == RUNCHAR) {
|
if (in_byte == RUNCHAR) {
|
||||||
INBYTE(in_repeat);
|
INBYTE(in_repeat);
|
||||||
if (in_repeat != 0) {
|
if (in_repeat != 0) {
|
||||||
/* Note Error, not Incomplete (which is at the end
|
|
||||||
** of the string only). This is a programmer error.
|
|
||||||
*/
|
|
||||||
printf("Orphaned RLE code at start\n");
|
printf("Orphaned RLE code at start\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,8 @@
|
|||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SRAM_H__
|
#ifndef __RLE_H__
|
||||||
#define __SRAM_H__
|
#define __RLE_H__
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user