making some changes to dictionary call for print options.
This commit is contained in:
parent
a24d728cea
commit
2f8823053e
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef _logic_h
|
||||
#define _logic_h
|
||||
|
||||
#define NILL 0x00
|
||||
#define LO 0x00
|
||||
#define HI 0xFF
|
||||
|
||||
|
|
@ -12,4 +11,7 @@
|
|||
#define TRUE 0x00
|
||||
//false is anything besides TRUE
|
||||
|
||||
//used to indicate when intentionally passing zero because option not used
|
||||
#define NILL 0x00
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,7 +15,19 @@
|
|||
* debug print of call and return values
|
||||
*/
|
||||
|
||||
//default call dictionary without print option
|
||||
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)
|
||||
{
|
||||
return dictionary_call_print_option( ~TRUE, transfer, dictionary, opcode, addr, miscdata, endpoint, buffer, length);
|
||||
}
|
||||
|
||||
//debug call dictionary without print option
|
||||
int dictionary_call_debug( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode, uint16_t addr, uint8_t miscdata, uint8_t endpoint, uint8_t *buffer, uint16_t length)
|
||||
{
|
||||
return dictionary_call_print_option( TRUE, transfer, dictionary, opcode, addr, miscdata, endpoint, buffer, length);
|
||||
}
|
||||
|
||||
int dictionary_call_print_option( int print_debug; 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;
|
||||
|
|
@ -133,6 +145,7 @@ int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode,
|
|||
|
||||
xfr_cnt = usb_transfer( transfer );
|
||||
|
||||
if (print_debug == TRUE) {
|
||||
//print transfer details if small xfr
|
||||
if (xfr_cnt <= 8) {
|
||||
printf(" xf: %d er: %d rv:",xfr_cnt, rbuf[0]);
|
||||
|
|
@ -141,14 +154,18 @@ int dictionary_call( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode,
|
|||
printf(" %x,", rbuf[i]);
|
||||
}
|
||||
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)
|
||||
} else {
|
||||
//just print xfr cnt
|
||||
//printf(" xf: %d\n",xfr_cnt);
|
||||
printf(" xf: %d\n",xfr_cnt);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (xfr_cnt <= 8) {
|
||||
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)
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
error:
|
||||
printf("dictionary call went to error\n");
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@
|
|||
#include "shared_dictionaries.h"
|
||||
|
||||
|
||||
//dictionary call with debug prints
|
||||
int dictionary_call_debug( USBtransfer *transfer, uint8_t dictionary, uint8_t opcode, uint16_t addr, uint8_t miscdata, uint8_t endpoint, uint8_t *buffer, uint16_t length);
|
||||
|
||||
//dictionary call without printing output
|
||||
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);
|
||||
|
||||
int dictionary_call_print_option( int print_debug, USBtransfer *transfer, uint8_t dictionary, uint8_t opcode, uint16_t addr, uint8_t miscdata, uint8_t endpoint, uint8_t *buffer, uint16_t length);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue