예제 #1
0
void printf_u16(u16 dat,u8 c)
{
    putchar(' ');
    get_hex_data(((u8 *)(&dat))[0] >> 4);
    get_hex_data(((u8 *)(&dat))[0] & 0xf);

    get_hex_data(((u8 *)(&dat))[1] >> 4);
    get_hex_data(((u8 *)(&dat))[1] & 0xf);
    putchar(c);
	//putchar('\n');
}
예제 #2
0
/*
void printf_u32(u32 dat)
{
    putchar(' ');
    get_hex_data(((u8 *)(&dat))[0] >> 4);
    get_hex_data(((u8 *)(&dat))[0] & 0xf);

    get_hex_data(((u8 *)(&dat))[1] >> 4);
    get_hex_data(((u8 *)(&dat))[1] & 0xf);

    get_hex_data(((u8 *)(&dat))[2] >> 4);
    get_hex_data(((u8 *)(&dat))[2] & 0xf);

    get_hex_data(((u8 *)(&dat))[3] >> 4);
    get_hex_data(((u8 *)(&dat))[3] & 0xf);
    putchar(' ');
}
*/
void printf_u8(u8 dat)
{
    putchar(' ');
    get_hex_data(dat >> 4);
    get_hex_data(dat & 0xf);
    putchar(' ');
	//putchar('\n');
}
예제 #3
0
void __maybe_unused
xhci_dbg_log_event(struct dbg_data *d, struct urb *urb, char *event,
		unsigned extra)
{
	unsigned long flags;
	int ep_addr;
	char tbuf[TIME_BUF_LEN];
	char dbuf[HEX_DUMP_LEN];

	if (!d->log_events)
		return;

	if (!urb) {
		write_lock_irqsave(&d->ctrl_lck, flags);
		scnprintf(d->ctrl_buf[d->ctrl_idx], DBG_MSG_LEN,
			"%s: %s : %d", get_timestamp(tbuf), event, extra);
		dbg_inc(&d->ctrl_idx);
		write_unlock_irqrestore(&d->ctrl_lck, flags);
		return;
	}

	ep_addr = urb->ep->desc.bEndpointAddress;
	if (!check_log_mask(d, ep_addr, urb))
		return;

	if ((ep_addr & 0x0f) == 0x0) {
		/*submit event*/
		if (!xhci_str_to_event(event)) {
			write_lock_irqsave(&d->ctrl_lck, flags);
			scnprintf(d->ctrl_buf[d->ctrl_idx],
				DBG_MSG_LEN, "%s: [%s : %p]:[%s] "
				  "%02x %02x %04x %04x %04x  %u %d %s",
				  get_timestamp(tbuf), event, urb,
				  usb_urb_dir_in(urb) ? "in" : "out",
				  urb->setup_packet[0], urb->setup_packet[1],
				  (urb->setup_packet[3] << 8) |
				  urb->setup_packet[2],
				  (urb->setup_packet[5] << 8) |
				  urb->setup_packet[4],
				  (urb->setup_packet[7] << 8) |
				  urb->setup_packet[6],
				  urb->transfer_buffer_length, extra,
				  d->log_payload ? get_hex_data(dbuf, urb,
				  xhci_str_to_event(event), extra, 16) : "");

			dbg_inc(&d->ctrl_idx);
			write_unlock_irqrestore(&d->ctrl_lck, flags);
		} else {
			write_lock_irqsave(&d->ctrl_lck, flags);
			scnprintf(d->ctrl_buf[d->ctrl_idx],
				DBG_MSG_LEN, "%s: [%s : %p]:[%s] %u %d %s",
				  get_timestamp(tbuf), event, urb,
				  usb_urb_dir_in(urb) ? "in" : "out",
				  urb->actual_length, extra,
				  d->log_payload ? get_hex_data(dbuf, urb,
				xhci_str_to_event(event), extra, 16) : "");

			dbg_inc(&d->ctrl_idx);
			write_unlock_irqrestore(&d->ctrl_lck, flags);
		}
	} else {
		write_lock_irqsave(&d->data_lck, flags);
		scnprintf(d->data_buf[d->data_idx], DBG_MSG_LEN,
			  "%s: [%s : %p]:ep%d[%s]  %u %d %s",
			  get_timestamp(tbuf), event, urb, ep_addr & 0x0f,
			  usb_urb_dir_in(urb) ? "in" : "out",
			  xhci_str_to_event(event) ? urb->actual_length :
			  urb->transfer_buffer_length, extra,
			  d->log_payload ? get_hex_data(dbuf, urb,
				  xhci_str_to_event(event), extra, 32) : "");

		dbg_inc(&d->data_idx);
		write_unlock_irqrestore(&d->data_lck, flags);
	}
}