fixing some typo bugs to permit compiling. Updating test.c to perform

some dual port board tests.
This commit is contained in:
Paul Molloy 2017-02-10 08:51:12 -06:00
parent d1aacecd6c
commit 56ea22f750
4 changed files with 39 additions and 11 deletions

View File

@ -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 ) read_funcptr decode_rdfunc_num(uint8_t dict, uint8_t func_num )
{ {
if ( dict == NES ) { if ( dict == DICT_NES ) {
switch( func_num ) { switch( func_num ) {
case NES_CPU_RD: return nes_cpu_rd; case NES_CPU_RD: return nes_cpu_rd;
case NES_PPU_RD: return nes_ppu_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 ) write_funcptr decode_wrfunc_num(uint8_t dict, uint8_t func_num )
{ {
if ( dict == NES ) { if ( dict == DICT_NES ) {
switch( func_num ) { switch( func_num ) {
case DISCRETE_EXP0_PRGROM_WR: case DISCRETE_EXP0_PRGROM_WR:
return 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: default:
return (void*)~SUCCESS; return (void*)~SUCCESS;
} }
}
} else { } else {
//dictionary not supported //dictionary not supported
return (void*)~SUCCESS; return (void*)~SUCCESS;

View File

@ -201,12 +201,6 @@ int main(int argc, char *argv[])
transfer->handle = open_usb_device( context, libusb_log ); transfer->handle = open_usb_device( context, libusb_log );
check( transfer->handle != NULL, "Unable to open INL retro-prog usb device handle."); 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 //create board object/struct
cartridge *cart = malloc( sizeof(cartridge)); cartridge *cart = malloc( sizeof(cartridge));
check_mem(cart); check_mem(cart);
@ -214,6 +208,11 @@ int main(int argc, char *argv[])
//set all cart elements to UNKNOWN and allocate memory object within //set all cart elements to UNKNOWN and allocate memory object within
init_cart_elements(cart); 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 // -x flag turns off all autodection
if (!x_flag) { if (!x_flag) {

View File

@ -1,8 +1,36 @@
#include "test.h" #include "test.h"
int test_function( USBtransfer *transfer ) int test_function( cartridge *cart, USBtransfer *transfer )
{ {
debug("testing"); 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, dictionary_call_debug( transfer, DICT_IO, IO_RESET, 0, 0, USB_IN,
NULL, 1); NULL, 1);
dictionary_call_debug( transfer, DICT_IO, NES_INIT, 0, 0, USB_IN, dictionary_call_debug( transfer, DICT_IO, NES_INIT, 0, 0, USB_IN,
@ -88,6 +116,7 @@ int test_function( USBtransfer *transfer )
NULL, 8); NULL, 8);
dictionary_call_debug( transfer, DICT_BUFFER, GET_SEC_ELEMENTS, 0, 3, USB_IN, dictionary_call_debug( transfer, DICT_BUFFER, GET_SEC_ELEMENTS, 0, 3, USB_IN,
NULL, 8); NULL, 8);
*/
/*debug("\nraw bank status"); /*debug("\nraw bank status");
dictionary_call_debug( transfer, DICT_BUFFER, RAW_BANK_STATUS, 0, 0, USB_IN, dictionary_call_debug( transfer, DICT_BUFFER, RAW_BANK_STATUS, 0, 0, USB_IN,
NULL, 2); NULL, 2);

View File

@ -22,12 +22,13 @@
#include "shared_dictionaries.h" #include "shared_dictionaries.h"
#include "dictionary.h" #include "dictionary.h"
#include "buffer.h" #include "buffer.h"
#include "cartridge.h"
//uncomment to DEBUG this file alone //uncomment to DEBUG this file alone
#define DEBUG #define DEBUG
//"make debug" to get DEBUG msgs on entire program //"make debug" to get DEBUG msgs on entire program
#include "dbg.h" #include "dbg.h"
int test_function( USBtransfer *transfer ); int test_function( cartridge *cart, USBtransfer *transfer );
#endif #endif