mirror of
https://github.com/raphnet/gc_n64_usb-v3
synced 2024-12-22 07:18:52 -05:00
Add RX/TX dump facility
This commit is contained in:
parent
07a53bee3a
commit
338c29f06c
@ -24,6 +24,7 @@
|
||||
#include "gcn64txrx.h"
|
||||
|
||||
#undef FORCE_KEYBOARD
|
||||
#undef TRACE_GCN64
|
||||
|
||||
/******** IO port definitions and options **************/
|
||||
#ifndef STK525
|
||||
@ -66,7 +67,16 @@ unsigned char gcn64_transaction(const unsigned char *tx, int tx_len, unsigned ch
|
||||
{
|
||||
int count;
|
||||
unsigned char sreg = SREG;
|
||||
//int i;
|
||||
|
||||
#ifdef TRACE_GCN64
|
||||
int i;
|
||||
|
||||
printf("TX[%d] = { ", tx_len);
|
||||
for (i=0; i<tx_len; i++) {
|
||||
printf("%02x ", tx[i]);
|
||||
}
|
||||
printf("}\r\n");
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_INTS_DURING_COMM
|
||||
cli();
|
||||
@ -74,21 +84,20 @@ unsigned char gcn64_transaction(const unsigned char *tx, int tx_len, unsigned ch
|
||||
gcn64_sendBytes(tx, tx_len);
|
||||
count = gcn64_receiveBytes(rx, rx_max);
|
||||
SREG = sreg;
|
||||
#if 0
|
||||
printf("Count: %d { ", count);
|
||||
for (i=0; i<count; i++) {
|
||||
printf("%02x ", rx[i]);
|
||||
}
|
||||
printf("}\r\n");
|
||||
#endif
|
||||
if (!count)
|
||||
return 0;
|
||||
|
||||
if (count == 0xff) {
|
||||
printf("rx error\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef TRACE_GCN64
|
||||
printf("RX[%d] = { ", count);
|
||||
for (i=0; i<count; i++) {
|
||||
printf("%02x ", rx[i]);
|
||||
}
|
||||
printf("}\r\n");
|
||||
#endif
|
||||
|
||||
/* this delay is required on N64 controllers. Otherwise, after sending
|
||||
* a rumble-on or rumble-off command (probably init too), the following
|
||||
* get status fails. This starts to work at 30us. 60us should be safe. */
|
||||
|
Loading…
Reference in New Issue
Block a user