From 56ea22f750c4b6d6e10c15f6ecb13b8744b71e86 Mon Sep 17 00:00:00 2001 From: Paul Molloy Date: Fri, 10 Feb 2017 08:51:12 -0600 Subject: [PATCH] fixing some typo bugs to permit compiling. Updating test.c to perform some dual port board tests. --- firmware/source/operation.c | 5 ++--- host/source/inlprog.c | 11 +++++------ host/source/test.c | 31 ++++++++++++++++++++++++++++++- host/source/test.h | 3 ++- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/firmware/source/operation.c b/firmware/source/operation.c index 788b91a..a7f7cb0 100644 --- a/firmware/source/operation.c +++ b/firmware/source/operation.c @@ -47,7 +47,7 @@ uint8_t * operation_usb_call( setup_packet *spacket, uint8_t *rv, uint8_t *rlen) read_funcptr decode_rdfunc_num(uint8_t dict, uint8_t func_num ) { - if ( dict == NES ) { + if ( dict == DICT_NES ) { switch( func_num ) { case NES_CPU_RD: return nes_cpu_rd; case NES_PPU_RD: return nes_ppu_rd; @@ -63,7 +63,7 @@ read_funcptr decode_rdfunc_num(uint8_t dict, uint8_t func_num ) write_funcptr decode_wrfunc_num(uint8_t dict, uint8_t func_num ) { - if ( dict == NES ) { + if ( dict == DICT_NES ) { switch( func_num ) { case DISCRETE_EXP0_PRGROM_WR: return discrete_exp0_prgrom_wr; @@ -74,7 +74,6 @@ write_funcptr decode_wrfunc_num(uint8_t dict, uint8_t func_num ) default: return (void*)~SUCCESS; } - } } else { //dictionary not supported return (void*)~SUCCESS; diff --git a/host/source/inlprog.c b/host/source/inlprog.c index 72a4a33..ced0535 100644 --- a/host/source/inlprog.c +++ b/host/source/inlprog.c @@ -201,12 +201,6 @@ int main(int argc, char *argv[]) transfer->handle = open_usb_device( context, libusb_log ); check( transfer->handle != NULL, "Unable to open INL retro-prog usb device handle."); - //TEST flag for development use to provide means to only call test.c functions - if (T_flag) { - test_function( transfer ); - goto close; - } - //create board object/struct cartridge *cart = malloc( sizeof(cartridge)); check_mem(cart); @@ -214,6 +208,11 @@ int main(int argc, char *argv[]) //set all cart elements to UNKNOWN and allocate memory object within init_cart_elements(cart); + //TEST flag for development use to provide means to only call test.c functions + if (T_flag) { + test_function( cart, transfer ); + goto close; + } // -x flag turns off all autodection if (!x_flag) { diff --git a/host/source/test.c b/host/source/test.c index d3a81fd..f4235d0 100644 --- a/host/source/test.c +++ b/host/source/test.c @@ -1,8 +1,36 @@ #include "test.h" -int test_function( USBtransfer *transfer ) +int test_function( cartridge *cart, USBtransfer *transfer ) { debug("testing"); + detect_console( cart, transfer ); + dictionary_call( transfer, DICT_IO, IO_RESET, 0, 0, USB_IN, + NULL, 1); + dictionary_call( transfer, DICT_IO, NES_INIT, 0, 0, USB_IN, + NULL, 1); + debug("io reset and nes init'd"); + + //spansion/cypress A18-11 are don't care, that translates to A19-12 for byte mode I think + //$AAA / AA + dictionary_call( transfer, DICT_NES, NES_CPU_WR, 0x8AAA, 0xAA, + USB_IN, NULL, 1); + //$555 / 55 + dictionary_call( transfer, DICT_NES, NES_CPU_WR, 0x8555, 0x55, + USB_IN, NULL, 1); + //$AAA / 90 manf ID + dictionary_call( transfer, DICT_NES, NES_CPU_WR, 0x8AAA, 0x90, + USB_IN, NULL, 1); + + dictionary_call_debug( transfer, DICT_NES, NES_CPU_RD, 0x8000, 0, + USB_IN, NULL, 2); + dictionary_call_debug( transfer, DICT_NES, NES_CPU_RD, 0x8002, 0, + USB_IN, NULL, 2); + dictionary_call_debug( transfer, DICT_NES, NES_CPU_RD, 0x8000, 0, + USB_IN, NULL, 2); + dictionary_call_debug( transfer, DICT_NES, NES_CPU_RD, 0x8002, 0, + USB_IN, NULL, 2); + +/* dictionary_call_debug( transfer, DICT_IO, IO_RESET, 0, 0, USB_IN, NULL, 1); dictionary_call_debug( transfer, DICT_IO, NES_INIT, 0, 0, USB_IN, @@ -88,6 +116,7 @@ int test_function( USBtransfer *transfer ) NULL, 8); dictionary_call_debug( transfer, DICT_BUFFER, GET_SEC_ELEMENTS, 0, 3, USB_IN, NULL, 8); + */ /*debug("\nraw bank status"); dictionary_call_debug( transfer, DICT_BUFFER, RAW_BANK_STATUS, 0, 0, USB_IN, NULL, 2); diff --git a/host/source/test.h b/host/source/test.h index 39d2d86..dc49283 100644 --- a/host/source/test.h +++ b/host/source/test.h @@ -22,12 +22,13 @@ #include "shared_dictionaries.h" #include "dictionary.h" #include "buffer.h" +#include "cartridge.h" //uncomment to DEBUG this file alone #define DEBUG //"make debug" to get DEBUG msgs on entire program #include "dbg.h" -int test_function( USBtransfer *transfer ); +int test_function( cartridge *cart, USBtransfer *transfer ); #endif