payload buffers working with some early testing.
Had a good lesson on what static means... :/ everything working now as previously designed speed testing on windows10 PC yeilded ~21KBps when transferring 128-512KB payloads and 128Byte transfer size. Going to bump to 256 and see how that does after 128KB speed tests on linux machine. created host test.c/.h file for general testing of new features. that way I can start working on erase/write.h files and just use test.c as scratch code space for tinkering and still call with -t flag on command line. modified dictionary calls to include pointers to data and lengths.
This commit is contained in:
parent
cb0941e86c
commit
3326c2fb34
|
|
@ -1,12 +1,5 @@
|
|||
#include "buffer.h"
|
||||
|
||||
//max raw buffer size is only limited based on buffer struct
|
||||
//raw buffer memory to which smaller buffers will be created from
|
||||
//set pointers and lengths to prevent buffer conflicts
|
||||
static uint8_t raw_buffer[NUM_RAW_BANKS * RAW_BANK_SIZE]; //8 banks of 32bytes each 256Bytes total
|
||||
|
||||
//buffer status stores allocation status of each raw buffer 32Byte bank
|
||||
static uint8_t raw_bank_status[NUM_RAW_BANKS];
|
||||
|
||||
//min define of two buffers
|
||||
static buffer buff0;
|
||||
|
|
@ -22,6 +15,15 @@ static buffer buff6;
|
|||
static buffer buff7;
|
||||
#endif
|
||||
|
||||
//max raw buffer size is only limited based on buffer struct
|
||||
//raw buffer memory to which smaller buffers will be created from
|
||||
//set pointers and lengths to prevent buffer conflicts
|
||||
static uint8_t raw_buffer[NUM_RAW_BANKS * RAW_BANK_SIZE]; //8 banks of 32bytes each 256Bytes total
|
||||
|
||||
//buffer status stores allocation status of each raw buffer 32Byte bank
|
||||
static uint8_t raw_bank_status[NUM_RAW_BANKS];
|
||||
|
||||
|
||||
|
||||
/* Desc:Bridge between usb.c and buffer.c functions
|
||||
* usb.c calls this function providing setup packet info
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ uint8_t allocate_buffer( buffer *buff, uint8_t new_id, uint8_t base_bank, uint8_
|
|||
|
||||
//used to communicate to usbFunctionWrite which buffer object
|
||||
//it should be filling
|
||||
static buffer *cur_usb_load_buff;
|
||||
buffer *cur_usb_load_buff;
|
||||
//used to determine number of bytes left to finish current
|
||||
//OUT transfer utilized by usbFunctionWrite
|
||||
static uint16_t incoming_bytes_remain;
|
||||
uint16_t incoming_bytes_remain;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* provide opcode from the dictionary (wValueLSB)
|
||||
* provide 16bit addr used for usb transfer index (optional, can also send 8bits applied to wIndexLSB)
|
||||
* provide miscdata optional to be used for wValueMSB
|
||||
* provide data buffer pointer and length
|
||||
*
|
||||
* makes call to usb_transfer after determining:
|
||||
* endpoint direction
|
||||
|
|
@ -14,7 +15,7 @@
|
|||
* debug print of call and return values
|
||||
*/
|
||||
|
||||
int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode, uint16_t addr, uint8_t miscdata)
|
||||
int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode, uint16_t addr, uint8_t miscdata, uint8_t endpoint, uint8_t *buffer, uint16_t length)
|
||||
{
|
||||
transfer->request = dictionary;
|
||||
transfer->wValueMSB = miscdata;
|
||||
|
|
@ -23,7 +24,7 @@ int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode,
|
|||
transfer->wIndexLSB = addr;
|
||||
|
||||
//default IN for now reading back error codes from short commands
|
||||
transfer->endpoint = USB_IN;
|
||||
transfer->endpoint = endpoint;
|
||||
//default length of zero
|
||||
transfer->wLength = 0;
|
||||
|
||||
|
|
@ -126,7 +127,11 @@ int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode,
|
|||
break;
|
||||
case BUFF_OPCODE_BUFN_RV_MIN ... BUFF_OPCODE_BUFN_RV_MAX:
|
||||
debug("BUFF_OPCODE_RV");
|
||||
//TODO
|
||||
break;
|
||||
case BUFF_OPCODE_PAYLOAD_MIN ... BUFF_OPCODE_PAYLOAD_MAX:
|
||||
debug("BUFF_OPCODE_PAYLOAD");
|
||||
transfer->data = (unsigned char *)buffer;
|
||||
transfer->wLength = length;
|
||||
break;
|
||||
default: //snes opcode min/max definition error
|
||||
sentinel("bad BUFFER opcode min/max err:%d",ERR_BAD_BUFF_OP_MINMAX);
|
||||
|
|
@ -142,6 +147,9 @@ int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode,
|
|||
int xfr_cnt;
|
||||
|
||||
xfr_cnt = usb_transfer( transfer );
|
||||
|
||||
//print transfer details if small xfr
|
||||
if (xfr_cnt <= 8) {
|
||||
printf(" xf: %d er: %d rv:",xfr_cnt, rbuf[0]);
|
||||
int i ;
|
||||
for (i=1; i<xfr_cnt; i++){
|
||||
|
|
@ -149,7 +157,11 @@ int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode,
|
|||
}
|
||||
printf("\n");
|
||||
check(rbuf[0] == SUCCESS, "retro programmer had error: %d, dict:%d, opcode:%d/%x, addr:%x, data:%x",rbuf[0], dictionary, opcode, opcode, addr, miscdata)
|
||||
//send command
|
||||
} else {
|
||||
//just print xfr cnt
|
||||
printf(" xf: %d\n",xfr_cnt);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,6 @@
|
|||
//"make debug" to get DEBUG msgs on entire program
|
||||
#include "dbg.h"
|
||||
|
||||
int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode, uint16_t addr, uint8_t miscdata);
|
||||
int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode, uint16_t addr, uint8_t miscdata, uint8_t endpoint, uint8_t *buffer, uint16_t length);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,75 +4,6 @@ int erase_nes( USBtransfer *transfer )
|
|||
{
|
||||
|
||||
debug("erasing");
|
||||
//dict opcode addr data
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
debug("reset");
|
||||
dictionary_call( transfer, BUFFER, RAW_BUFFER_RESET, 0, 0);
|
||||
debug("read status");
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 4, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 8, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 14, 0);
|
||||
|
||||
debug("allocate");
|
||||
dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER0, 0x1000, 4);
|
||||
dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER1, 0x2104, 4);
|
||||
dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER2, 0x3508, 4);
|
||||
dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER3, 0x4A0C, 4);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 2, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 3, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 4, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 5, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 6, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 8, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 9, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 10, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 11, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 12, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 13, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 14, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 15, 0);
|
||||
|
||||
//dict opcode addr data
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
//debug("reset");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BUFFER_RESET, 0, 0);
|
||||
//debug("read status");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
//debug("allocate 0");
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER0, 0x1A00, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER1, 0x2A01, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER2, 0x3A02, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER3, 0x4A03, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER4, 0x5A04, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER5, 0x6A05, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER6, 0x7A06, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x8A07, 1);
|
||||
//debug("read status");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 2, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 3, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 4, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 5, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 6, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x8A07, 1);
|
||||
//debug("reset");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BUFFER_RESET, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x8A07, 1);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x5A05, 1);
|
||||
|
||||
|
||||
//dictionary_call( transfer, IO, IO_RESET, 0, 0);
|
||||
|
|
@ -127,13 +58,6 @@ int erase_nes( USBtransfer *transfer )
|
|||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
|
||||
//program byte
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0xAA);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x2AAA, 0x55);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0xA0);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x8000, 0x00);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "usb_operations.h"
|
||||
#include "write_operations.h"
|
||||
#include "erase.h"
|
||||
#include "test.h"
|
||||
#include "shared_dictionaries.h"
|
||||
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ int main(int argc, char *argv[])
|
|||
int f_flag = 0; //LED OFF
|
||||
int e_flag = 0; //ERASE
|
||||
int m_flag = 0; //MIRROR
|
||||
int t_flag = 0; //TEST
|
||||
char *w_value = NULL; //WRITE FILE
|
||||
char *d_value = NULL; //DUMP FILE
|
||||
char *s_value = NULL; //SAVE FILE
|
||||
|
|
@ -39,13 +41,14 @@ int main(int argc, char *argv[])
|
|||
//getopt returns args till done then returns -1
|
||||
//string of possible args : denotes 1 required additional arg
|
||||
//:: denotes optional additional arg follows
|
||||
while( (rv = getopt( argc, argv, "ofemw:d:s:i:b:")) != -1) {
|
||||
while( (rv = getopt( argc, argv, "ofemtw:d:s:i:b:")) != -1) {
|
||||
|
||||
switch(rv) {
|
||||
case 'o': o_flag = 1; break;
|
||||
case 'f': f_flag = 1; break;
|
||||
case 'e': e_flag = 1; break;
|
||||
case 'm': m_flag = 1; break;
|
||||
case 't': t_flag = 1; break;
|
||||
case 'w': w_value = optarg; break;
|
||||
case 'd': d_value = optarg; break;
|
||||
case 's': s_value = optarg; break;
|
||||
|
|
@ -74,7 +77,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
}
|
||||
debug("flags= o:%d f:%d e:%d m:%d", o_flag, f_flag, e_flag, m_flag);
|
||||
debug("flags= o:%d f:%d e:%d m:%d t:%d", o_flag, f_flag, e_flag, m_flag, t_flag);
|
||||
debug("args= w:%s d:%s s:%s i:%s b:%s", w_value, d_value, s_value, i_value, b_value);
|
||||
for( index = optind; index < argc; index++) {
|
||||
log_err("Non-option arguement: %s \n", argv[index]);
|
||||
|
|
@ -104,6 +107,7 @@ int main(int argc, char *argv[])
|
|||
int i;
|
||||
|
||||
if (e_flag) erase_nes( transfer );
|
||||
if (t_flag) test_function( transfer );
|
||||
|
||||
//handle simple LED ON/OFF within main for now
|
||||
if (o_flag | f_flag) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
#include "test.h"
|
||||
|
||||
int test_function( USBtransfer *transfer )
|
||||
{
|
||||
|
||||
debug("testing");
|
||||
//dict opcode addr/index miscdata endpoint *buffer length
|
||||
debug("reset butters");
|
||||
dictionary_call( transfer, BUFFER, RAW_BUFFER_RESET, 0, 0, USB_IN, NULL, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0, USB_IN, NULL, 0);
|
||||
debug("allocate buff0 128B"); //id:basebank num32B banks
|
||||
dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER0, 0x1000, 4, USB_IN, NULL, 0);
|
||||
debug("allocate buff1 128B"); //id:basebank num32B banks
|
||||
dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER1, 0x2004, 4, USB_IN, NULL, 0);
|
||||
debug("status"); //id:basebank num32B banks
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0, USB_IN, NULL, 0);
|
||||
dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 4, 0, USB_IN, NULL, 0);
|
||||
|
||||
uint8_t load_in[128];
|
||||
uint8_t load_out[128];
|
||||
int i = 0;
|
||||
|
||||
load_in[0] = 0xEE;
|
||||
//print load
|
||||
printf("load_in data:");
|
||||
for (i=0; i<128; i++) {
|
||||
printf(" %x",load_in[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
debug("read payload0 uninitialized");
|
||||
dictionary_call( transfer, BUFFER, BUFF_PAYLOAD0, 0, 0, USB_IN, load_in, 128);
|
||||
|
||||
//print load
|
||||
printf("load_in data:");
|
||||
for (i=0; i<128; i++) {
|
||||
printf(" %x",load_in[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
//fill load with 0-127
|
||||
for (i=0; i<128; i++) {
|
||||
load_out[i] = i;
|
||||
}
|
||||
|
||||
//print contents before sending
|
||||
printf("load_out with data:");
|
||||
for (i=0; i<128; i++) {
|
||||
printf(" %x",load_out[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
debug("send payload0");
|
||||
dictionary_call( transfer, BUFFER, BUFF_PAYLOAD0, 0, 0, USB_OUT, load_out, 128);
|
||||
|
||||
debug("read payload0");
|
||||
dictionary_call( transfer, BUFFER, BUFF_PAYLOAD0, 0, 0, USB_IN, load_in, 128);
|
||||
|
||||
//print load
|
||||
printf("load_in data:");
|
||||
for (i=0; i<128; i++) {
|
||||
printf(" %x",load_in[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
clock_t tstart, tstop;
|
||||
tstart = clock();
|
||||
for ( i = (1024 * 4); i>0; i--) {
|
||||
dictionary_call( transfer, BUFFER, BUFF_PAYLOAD0, 0, 0, USB_OUT, load_out, 128);
|
||||
}
|
||||
tstop = clock();
|
||||
float timediff = ( (float)(tstop-tstart) / CLOCKS_PER_SEC);
|
||||
printf("total time: %fsec, speed: %fKBps", timediff, (512/timediff));
|
||||
//128byte transfers currently clocking in around 21KBps
|
||||
|
||||
|
||||
// dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER2, 0x3508, 4);
|
||||
// dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER3, 0x4A0C, 4);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 2, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 3, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 4, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 5, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 6, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 8, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 9, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 10, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 11, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 12, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 13, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 14, 0);
|
||||
// dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 15, 0);
|
||||
|
||||
//dict opcode addr data
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
//debug("reset");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BUFFER_RESET, 0, 0);
|
||||
//debug("read status");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
//debug("allocate 0");
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER0, 0x1A00, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER1, 0x2A01, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER2, 0x3A02, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER3, 0x4A03, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER4, 0x5A04, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER5, 0x6A05, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER6, 0x7A06, 1);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x8A07, 1);
|
||||
//debug("read status");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 1, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 2, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 3, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 4, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 5, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 6, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x8A07, 1);
|
||||
//debug("reset");
|
||||
//dictionary_call( transfer, BUFFER, RAW_BUFFER_RESET, 0, 0);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x8A07, 1);
|
||||
//dictionary_call( transfer, BUFFER, RAW_BANK_STATUS, 7, 0);
|
||||
//dictionary_call( transfer, BUFFER, ALLOCATE_BUFFER7, 0x5A05, 1);
|
||||
|
||||
|
||||
//dictionary_call( transfer, IO, IO_RESET, 0, 0);
|
||||
//dictionary_call( transfer, IO, NES_INIT, 0, 0);
|
||||
//dictionary_call( transfer, IO, EXP0_PULLUP_TEST, 0, 0);
|
||||
//dictionary_call( transfer, PINPORT, AUX_RD, 0, 0);
|
||||
//dictionary_call( transfer, PINPORT, AUX_RD, 0, 0);
|
||||
//dictionary_call( transfer, PINPORT, AUX_RD, 0, 0);
|
||||
//dictionary_call( transfer, PINPORT, AUX_RD, 0, 0);
|
||||
//dictionary_call( transfer, PINPORT, AUX_RD, 0, 0);
|
||||
//dictionary_call( transfer, PINPORT, AUX_RD, 0, 0);
|
||||
//dictionary_call( transfer, PINPORT, AUX_RD, 0, 0);
|
||||
|
||||
////software mode
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0xAA);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x2AAA, 0x55);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0x90);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8001, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8001, 0);
|
||||
////exit software
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x8000, 0xF0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8001, 0);
|
||||
|
||||
//erase
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0xAA);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x2AAA, 0x55);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0x80);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0xAA);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x2AAA, 0x55);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0x10);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
|
||||
//program byte
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0xAA);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x2AAA, 0x55);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x5555, 0xA0);
|
||||
// dictionary_call( transfer, NES, DISCRETE_EXP0_PRGROM_WR, 0x8000, 0x00);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
// dictionary_call( transfer, NES, NES_CPU_RD, 0x8000, 0);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef _test_h
|
||||
#define _test_h
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <libusb.h>
|
||||
#include <time.h>
|
||||
|
||||
//include prior to other file includes
|
||||
//that way DEBUG can be turned on/off for this file alone
|
||||
//uncomment to DEBUG this file alone
|
||||
#define DEBUG
|
||||
//"make debug" to get DEBUG msgs on entire program
|
||||
#include "dbg.h"
|
||||
|
||||
#include "usb_operations.h"
|
||||
#include "shared_errors.h"
|
||||
#include "shared_dictionaries.h"
|
||||
#include "dictionary.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 );
|
||||
|
||||
#endif
|
||||
|
|
@ -253,6 +253,7 @@ int usb_transfer( USBtransfer *transfer )
|
|||
wIndex = wIndex << 8;
|
||||
wIndex |= transfer->wIndexLSB;
|
||||
|
||||
debug("reqtype h: %x \n", ( LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | transfer->endpoint));
|
||||
debug("request h: %x d: %d", transfer->request, transfer->request);
|
||||
debug("wValueMSB h: %x d: %d", transfer->wValueMSB, transfer->wValueMSB);
|
||||
debug("wValueLSB h: %x d: %d", transfer->wValueLSB, transfer->wValueLSB);
|
||||
|
|
|
|||
Loading…
Reference in New Issue