1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2025-01-30 23:00:11 -05:00

More use of printf_P

This commit is contained in:
Raphael Assenat 2015-10-28 00:16:32 -04:00
parent 831487efe2
commit d444b9479f
2 changed files with 9 additions and 11 deletions

View File

@ -30,7 +30,7 @@ uint16_t hiddata_get_report(struct usb_request *rq, const uint8_t **dat)
*dat = cmdbuf; *dat = cmdbuf;
state = STATE_IDLE; state = STATE_IDLE;
#ifdef DEBUG #ifdef DEBUG
printf("hiddata idle, sent %d bytes\r\n", cmdbuf_len); printf_P(PSTR("hiddata idle, sent %d bytes\r\n"), cmdbuf_len);
#endif #endif
return cmdbuf_len; return cmdbuf_len;
} }
@ -42,11 +42,11 @@ uint8_t hiddata_set_report(const struct usb_request *rq, const uint8_t *dat, uin
{ {
#ifdef DEBUG #ifdef DEBUG
int i; int i;
printf("Set data %d\n", len); printf_P(PSTR("Set data %d\n"), len);
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
printf("0x%02x ", dat[i]); printf_P(PSTR("0x%02x "), dat[i]);
} }
printf("\r\n"); printf_P(PSTR("\r\n"));
#endif #endif
state = STATE_NEW_COMMAND; state = STATE_NEW_COMMAND;

12
usb.c
View File

@ -289,7 +289,7 @@ static void handleSetupPacket(struct usb_request *rq)
default: default:
// printf("Unhandled descriptor 0x%02x\n", rq->wValue>>8); // printf_P(PSTR("Unhandled descriptor 0x%02x\n"), rq->wValue>>8);
unhandled = 1; unhandled = 1;
} }
break; break;
@ -332,8 +332,6 @@ static void handleSetupPacket(struct usb_request *rq)
// rqlen = g_params->hid_params[rq->wIndex].reportdesc_len; // rqlen = g_params->hid_params[rq->wIndex].reportdesc_len;
}; };
// TODO : Without the delays those two printf add, it
// does not work. A handshake is missing.
// printf_P(PSTR("t: %02x, rq: 0x%02x, val: %04x, l: %d\r\n"), rq->bmRequestType, rq->bRequest, rq->wValue, rq->wLength); // printf_P(PSTR("t: %02x, rq: 0x%02x, val: %04x, l: %d\r\n"), rq->bmRequestType, rq->bRequest, rq->wValue, rq->wLength);
while(1) while(1)
@ -480,9 +478,9 @@ static void handleDataPacket(const struct usb_request *rq, uint8_t *dat, uint16_
printf_P(PSTR("Unhandled control write [%d] : "), len); printf_P(PSTR("Unhandled control write [%d] : "), len);
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
printf("%02X ", dat[i]); printf_P(PSTR("%02X "), dat[i]);
} }
printf("\r\n"); printf_P(PSTR("\r\n"));
} }
// Device interrupt // Device interrupt
@ -559,7 +557,7 @@ ISR(USB_COM_vect)
len = readEP2buf(g_ep0_buf); len = readEP2buf(g_ep0_buf);
UEINTX &= ~(1<<RXOUTI); UEINTX &= ~(1<<RXOUTI);
if (control_write_in_progress) { if (control_write_in_progress) {
// printf("chunk: %d\r\n", len); // printf_P(PSTR("chunk: %d\r\n"), len);
if (control_write_len + len < CONTROL_WRITE_BUFSIZE) { if (control_write_len + len < CONTROL_WRITE_BUFSIZE) {
memcpy(control_write_buf + control_write_len, g_ep0_buf, len); memcpy(control_write_buf + control_write_len, g_ep0_buf, len);
control_write_len += len; control_write_len += len;
@ -570,7 +568,7 @@ ISR(USB_COM_vect)
if (i & (1<<NAKINI)) { if (i & (1<<NAKINI)) {
UEINTX &= ~(1<<NAKINI); UEINTX &= ~(1<<NAKINI);
if (control_write_in_progress) { if (control_write_in_progress) {
// printf("end. total: %d\n", control_write_len); // printf_P(PSTR("end. total: %d\n"), control_write_len);
handleDataPacket(&control_write_rq, control_write_buf, control_write_len); handleDataPacket(&control_write_rq, control_write_buf, control_write_len);
control_write_in_progress = 0; control_write_in_progress = 0;
} }