diff --git a/demo/audio_v1_mic_singlechan_template.c b/demo/audio_v1_mic_singlechan_template.c index 59fbaa74..c10275dc 100644 --- a/demo/audio_v1_mic_singlechan_template.c +++ b/demo/audio_v1_mic_singlechan_template.c @@ -120,11 +120,11 @@ volatile bool tx_flag = 0; void usbd_audio_open(uint8_t intf) { tx_flag = 1; - printf("OPEN\r\n"); + USB_LOG_RAW("OPEN\r\n"); } void usbd_audio_close(uint8_t intf) { - printf("CLOSE\r\n"); + USB_LOG_RAW("CLOSE\r\n"); tx_flag = 0; } @@ -148,7 +148,7 @@ void audio_init() usbd_audio_add_interface(&audio_class, &audio_stream_intf); usbd_interface_add_endpoint(&audio_stream_intf, &audio_in_ep); usbd_audio_add_entity(0x02, AUDIO_CONTROL_FEATURE_UNIT); - + usbd_initialize(); } diff --git a/demo/audio_v1_mic_speaker_dualchan_template.c b/demo/audio_v1_mic_speaker_dualchan_template.c index d23a1ea0..8d156842 100644 --- a/demo/audio_v1_mic_speaker_dualchan_template.c +++ b/demo/audio_v1_mic_speaker_dualchan_template.c @@ -171,7 +171,7 @@ uint32_t actual_read_length = 0; void usbd_audio_out_callback(uint8_t ep) { if (usbd_ep_read(ep, out_buffer, AUDIO_OUT_EP_MPS, &actual_read_length) < 0) { - printf("Read DATA Packet failed\r\n"); + USB_LOG_RAW("Read DATA Packet failed\r\n"); usbd_ep_set_stall(ep); return; } @@ -201,7 +201,7 @@ void audio_init() usbd_interface_add_endpoint(&audio_stream_intf2, &audio_out_ep); usbd_audio_add_entity(0x02, AUDIO_CONTROL_FEATURE_UNIT); usbd_audio_add_entity(0x05, AUDIO_CONTROL_FEATURE_UNIT); - + usbd_initialize(); } diff --git a/demo/audio_v2_mic_multichan_template.c b/demo/audio_v2_mic_multichan_template.c index fbece086..fc09d8e2 100644 --- a/demo/audio_v2_mic_multichan_template.c +++ b/demo/audio_v2_mic_multichan_template.c @@ -151,11 +151,11 @@ volatile bool tx_flag = 0; void usbd_audio_open(uint8_t intf) { tx_flag = 1; - printf("OPEN\r\n"); + USB_LOG_RAW("OPEN\r\n"); } void usbd_audio_close(uint8_t intf) { - printf("CLOSE\r\n"); + USB_LOG_RAW("CLOSE\r\n"); tx_flag = 0; } @@ -180,7 +180,7 @@ void audio_init() usbd_interface_add_endpoint(&audio_stream_intf, &audio_in_ep); usbd_audio_add_entity(0x01, AUDIO_CONTROL_CLOCK_SOURCE); usbd_audio_add_entity(0x03, AUDIO_CONTROL_FEATURE_UNIT); - + usbd_initialize(); } diff --git a/demo/audio_v2_mic_speaker_multichan_template.c b/demo/audio_v2_mic_speaker_multichan_template.c index 1bb61cfc..2d55a4cd 100644 --- a/demo/audio_v2_mic_speaker_multichan_template.c +++ b/demo/audio_v2_mic_speaker_multichan_template.c @@ -199,20 +199,20 @@ void usbd_audio_open(uint8_t intf) { if (intf == 1) { rx_flag = 1; - MSG("OPEN1\r\n"); + USB_LOG_RAW("OPEN1\r\n"); } else { tx_flag = 1; - MSG("OPEN2\r\n"); + USB_LOG_RAW("OPEN2\r\n"); } } void usbd_audio_close(uint8_t intf) { if (intf == 1) { rx_flag = 1; - MSG("CLOSE1\r\n"); + USB_LOG_RAW("CLOSE1\r\n"); } else { tx_flag = 0; - MSG("CLOSE2\r\n"); + USB_LOG_RAW("CLOSE2\r\n"); } } @@ -256,7 +256,7 @@ void audio_init() usbd_audio_add_entity(0x05, AUDIO_CONTROL_CLOCK_SOURCE); usbd_audio_add_entity(0x07, AUDIO_CONTROL_FEATURE_UNIT); - + usbd_initialize(); } diff --git a/demo/audio_v2_speaker_multichan_template.c b/demo/audio_v2_speaker_multichan_template.c index 4c831d9a..bd5cfc44 100644 --- a/demo/audio_v2_speaker_multichan_template.c +++ b/demo/audio_v2_speaker_multichan_template.c @@ -151,11 +151,11 @@ volatile bool rx_flag = 0; void usbd_audio_open(uint8_t intf) { rx_flag = 1; - printf("OPEN\r\n"); + USB_LOG_RAW("OPEN\r\n"); } void usbd_audio_close(uint8_t intf) { - printf("CLOSE\r\n"); + USB_LOG_RAW("CLOSE\r\n"); rx_flag = 0; } @@ -180,7 +180,7 @@ void audio_init() usbd_interface_add_endpoint(&audio_stream_intf, &audio_in_ep); usbd_audio_add_entity(0x01, AUDIO_CONTROL_CLOCK_SOURCE); usbd_audio_add_entity(0x03, AUDIO_CONTROL_FEATURE_UNIT); - + usbd_initialize(); } diff --git a/demo/cdc_acm_msc_template.c b/demo/cdc_acm_msc_template.c index 78ec824a..1b7be8f0 100644 --- a/demo/cdc_acm_msc_template.c +++ b/demo/cdc_acm_msc_template.c @@ -113,16 +113,16 @@ void usbd_cdc_acm_out(uint8_t ep) usbd_ep_read(ep, data, 64, &read_byte); for (uint8_t i = 0; i < read_byte; i++) { - printf("%02x ", data[i]); + USB_LOG_RAW("%02x ", data[i]); } - printf("\r\n"); - printf("read len:%d\r\n", read_byte); + USB_LOG_RAW("\r\n"); + USB_LOG_RAW("read len:%d\r\n", read_byte); usbd_ep_read(ep, NULL, 0, NULL); } void usbd_cdc_acm_in(uint8_t ep) { - printf("in\r\n"); + USB_LOG_RAW("in\r\n"); } /*!< endpoint call back */ @@ -148,7 +148,7 @@ void cdc_acm_msc_init(void) usbd_interface_add_endpoint(&cdc_data_intf, &cdc_in_ep); usbd_msc_class_init(MSC_OUT_EP, MSC_IN_EP); - + usbd_initialize(); } diff --git a/demo/cdc_acm_multi_template.c b/demo/cdc_acm_multi_template.c index e89c06d9..eebd90c3 100644 --- a/demo/cdc_acm_multi_template.c +++ b/demo/cdc_acm_multi_template.c @@ -123,16 +123,16 @@ void usbd_cdc_acm_bulk_out(uint8_t ep) usbd_ep_read(ep, data, 64, &read_byte); for (uint8_t i = 0; i < read_byte; i++) { - printf("%02x ", data[i]); + USB_LOG_RAW("%02x ", data[i]); } - printf("\r\n"); - printf("read len:%d\r\n", read_byte); + USB_LOG_RAW("\r\n"); + USB_LOG_RAW("read len:%d\r\n", read_byte); usbd_ep_read(ep, NULL, 0, NULL); } void usbd_cdc_acm_bulk_in(uint8_t ep) { - printf("in\r\n"); + USB_LOG_RAW("in\r\n"); } /*!< endpoint call back */ @@ -196,7 +196,7 @@ usbd_endpoint_t cdc_in_ep4 = { void cdc_acm_multi_init(void) { usbd_desc_register(cdc_descriptor); - + usbd_cdc_add_acm_interface(&cdc_class1, &cdc_cmd_intf1); usbd_cdc_add_acm_interface(&cdc_class1, &cdc_data_intf1); usbd_interface_add_endpoint(&cdc_data_intf1, &cdc_out_ep1); diff --git a/demo/cdc_acm_template.c b/demo/cdc_acm_template.c index d733c8b3..158dd2f0 100644 --- a/demo/cdc_acm_template.c +++ b/demo/cdc_acm_template.c @@ -108,16 +108,16 @@ void usbd_cdc_acm_out(uint8_t ep) usbd_ep_read(ep, data, 64, &read_byte); for (uint8_t i = 0; i < read_byte; i++) { - printf("%02x ", data[i]); + USB_LOG_RAW("%02x ", data[i]); } - printf("\r\n"); - printf("read len:%d\r\n", read_byte); + USB_LOG_RAW("\r\n"); + USB_LOG_RAW("read len:%d\r\n", read_byte); usbd_ep_read(ep, NULL, 0, NULL); } void usbd_cdc_acm_in(uint8_t ep) { - printf("in\r\n"); + USB_LOG_RAW("in\r\n"); } /*!< endpoint call back */ diff --git a/demo/usb_host.c b/demo/usb_host.c index 1406718a..ae073127 100644 --- a/demo/usb_host.c +++ b/demo/usb_host.c @@ -11,11 +11,11 @@ void usbh_cdc_acm_callback(void *arg, int nbytes) if (nbytes > 0) { for (size_t i = 0; i < nbytes; i++) { - printf("0x%02x ", cdc_buffer[i]); + USB_LOG_RAW("0x%02x ", cdc_buffer[i]); } } - printf("nbytes:%d\r\n", nbytes); + USB_LOG_RAW("nbytes:%d\r\n", nbytes); } int cdc_acm_test(void) @@ -25,30 +25,30 @@ int cdc_acm_test(void) struct usbh_cdc_acm *cdc_acm_class = (struct usbh_cdc_acm *)usbh_find_class_instance("/dev/ttyACM0"); if (cdc_acm_class == NULL) { - printf("do not find /dev/ttyACM0\r\n"); + USB_LOG_RAW("do not find /dev/ttyACM0\r\n"); return -1; } memset(cdc_buffer, 0, 512); ret = usbh_ep_bulk_transfer(cdc_acm_class->bulkin, cdc_buffer, 512, 3000); if (ret < 0) { - printf("bulk in error,ret:%d\r\n", ret); + USB_LOG_RAW("bulk in error,ret:%d\r\n", ret); } else { - printf("recv over:%d\r\n", ret); + USB_LOG_RAW("recv over:%d\r\n", ret); for (size_t i = 0; i < ret; i++) { - printf("0x%02x ", cdc_buffer[i]); + USB_LOG_RAW("0x%02x ", cdc_buffer[i]); } } - printf("\r\n"); + USB_LOG_RAW("\r\n"); const uint8_t data1[10] = { 0x02, 0x00, 0x00, 0x00, 0x02, 0x02, 0x08, 0x14 }; memcpy(cdc_buffer, data1, 8); ret = usbh_ep_bulk_transfer(cdc_acm_class->bulkout, cdc_buffer, 8, 3000); if (ret < 0) { - printf("bulk out error,ret:%d\r\n", ret); + USB_LOG_RAW("bulk out error,ret:%d\r\n", ret); } else { - printf("send over:%d\r\n", ret); + USB_LOG_RAW("send over:%d\r\n", ret); } #if 0 @@ -56,15 +56,15 @@ int cdc_acm_test(void) #else ret = usbh_ep_bulk_transfer(cdc_acm_class->bulkin, cdc_buffer, 512, 3000); if (ret < 0) { - printf("bulk in error,ret:%d\r\n", ret); + USB_LOG_RAW("bulk in error,ret:%d\r\n", ret); } else { - printf("recv over:%d\r\n", ret); + USB_LOG_RAW("recv over:%d\r\n", ret); for (size_t i = 0; i < ret; i++) { - printf("0x%02x ", cdc_buffer[i]); + USB_LOG_RAW("0x%02x ", cdc_buffer[i]); } } - printf("\r\n"); + USB_LOG_RAW("\r\n"); return ret; #endif @@ -80,23 +80,23 @@ int msc_test(void) int ret; struct usbh_msc *msc_class = (struct usbh_msc *)usbh_find_class_instance("/dev/sda"); if (msc_class == NULL) { - printf("do not find /dev/sda\r\n"); + USB_LOG_RAW("do not find /dev/sda\r\n"); return -1; } #if 1 /* get the partition table */ ret = usbh_msc_scsi_read10(msc_class, 0, partition_table, 1); if (ret < 0) { - printf("scsi_read10 error,ret:%d\r\n", ret); + USB_LOG_RAW("scsi_read10 error,ret:%d\r\n", ret); return ret; } for (uint32_t i = 0; i < 512; i++) { if (i % 16 == 0) { - printf("\r\n"); + USB_LOG_RAW("\r\n"); } - printf("%02x ", partition_table[i]); + USB_LOG_RAW("%02x ", partition_table[i]); } - printf("\r\n"); + USB_LOG_RAW("\r\n"); #endif #if 0 @@ -105,11 +105,11 @@ int msc_test(void) usb_iofree(msc_buffer); // for (uint32_t i = 0; i < 1024; i++) { // if (i % 16 == 0) { - // printf("\r\n"); + // USB_LOG_RAW("\r\n"); // } - // printf("%02x ", msc_buffer[i]); + // USB_LOG_RAW("%02x ", msc_buffer[i]); // } - // printf("\r\n"); + // USB_LOG_RAW("\r\n"); #endif #if 0 @@ -127,16 +127,16 @@ int msc_test(void) res_sd = f_read(&fnew, ReadBuffer, 512, &fnum); for (uint32_t i = 0; i < fnum; i++) { if (i % 16 == 0) { - printf("\r\n"); + USB_LOG_RAW("\r\n"); } - printf("%02x ", ReadBuffer[i]); + USB_LOG_RAW("%02x ", ReadBuffer[i]); } - printf("\r\n"); + USB_LOG_RAW("\r\n"); f_close(&fnew); /*unmount*/ f_mount(NULL, "2:", 1); } else { - printf("open error:%d\r\n", res_sd); + USB_LOG_RAW("open error:%d\r\n", res_sd); } usb_iofree(ReadBuffer); #endif @@ -151,11 +151,11 @@ void usbh_hid_callback(void *arg, int nbytes) if (nbytes > 0) { for (size_t i = 0; i < nbytes; i++) { - printf("0x%02x ", hid_buffer[i]); + USB_LOG_RAW("0x%02x ", hid_buffer[i]); } } - printf("nbytes:%d\r\n", nbytes); + USB_LOG_RAW("nbytes:%d\r\n", nbytes); } int hid_test(void) @@ -163,20 +163,20 @@ int hid_test(void) int ret; struct usbh_hid *hid_class = (struct usbh_hid *)usbh_find_class_instance("/dev/input0"); if (hid_class == NULL) { - printf("do not find /dev/input0\r\n"); + USB_LOG_RAW("do not find /dev/input0\r\n"); return -1; } #if 1 ret = usbh_ep_intr_async_transfer(hid_class->intin, hid_buffer, 128, usbh_hid_callback, hid_class); if (ret < 0) { - printf("intr asnyc in error,ret:%d\r\n", ret); + USB_LOG_RAW("intr asnyc in error,ret:%d\r\n", ret); } #else ret = usbh_ep_intr_transfer(hid_class->intin, hid_buffer, 128, 1000); if (ret < 0) { return ret; } - printf("recv len:%d\r\n", ret); + USB_LOG_RAW("recv len:%d\r\n", ret); #endif return ret; } \ No newline at end of file diff --git a/demo/video_hs_mjpeg_template.c b/demo/video_hs_mjpeg_template.c index e459acbd..68df3879 100644 --- a/demo/video_hs_mjpeg_template.c +++ b/demo/video_hs_mjpeg_template.c @@ -134,11 +134,11 @@ volatile bool tx_flag = 0; void usbd_video_open(uint8_t intf) { tx_flag = 1; - MSG("OPEN\r\n"); + USB_LOG_RAW("OPEN\r\n"); } void usbd_video_close(uint8_t intf) { - MSG("CLOSE\r\n"); + USB_LOG_RAW("CLOSE\r\n"); tx_flag = 0; }