Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[include][dbg]update: no longer use RT_DEBUG_LOG in rtdebug.h #7750

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions components/drivers/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
*/

#include <rtthread.h>

#define DBG_TAG "kernel.device"
#ifdef RT_DEBUG_DEVICE
#define DBG_LVL DBG_LOG
#else
#define DBG_LVL DBG_WARNING
#endif /* defined (RT_DEBUG_DEVICE) */
#include <rtdbg.h>

#ifdef RT_USING_POSIX_DEVIO
#include <rtdevice.h> /* for wqueue_init */
#endif /* RT_USING_POSIX_DEVIO */
Expand Down Expand Up @@ -178,8 +187,8 @@ rt_err_t rt_device_init(rt_device_t dev)
result = device_init(dev);
if (result != RT_EOK)
{
RT_DEBUG_LOG(RT_DEBUG_DEVICE, ("To initialize device:%s failed. The error code is %d\n",
dev->parent.name, result));
LOG_E("To initialize device:%s failed. The error code is %d",
dev->parent.name, result);
}
else
{
Expand Down Expand Up @@ -216,8 +225,8 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
result = device_init(dev);
if (result != RT_EOK)
{
RT_DEBUG_LOG(RT_DEBUG_DEVICE, ("To initialize device:%s failed. The error code is %d\n",
dev->parent.name, result));
LOG_E("To initialize device:%s failed. The error code is %d",
dev->parent.name, result);

return result;
}
Expand Down
30 changes: 19 additions & 11 deletions components/drivers/usb/usbdevice/class/cdc_vcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@

#ifdef RT_USB_DEVICE_CDC

#define DBG_TAG "usbdevice_cdc"
#if RT_DEBUG_USB
#define DBG_LVL DBG_LOG
#else
#define DBG_LVL DBG_WARNING
#endif /* defined (RT_DEBUG_USB) */
#include <rtdbg.h>

#define VCOM_INTF_STR_INDEX 5
#ifdef RT_VCOM_TX_TIMEOUT
#define VCOM_TX_TIMEOUT RT_VCOM_TX_TIMEOUT
Expand Down Expand Up @@ -287,7 +295,7 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)

data = (struct vcom*)func->user_data;
request_size = data->ep_in->request.size;
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_in_handler %d\n", request_size));
LOG_D("_ep_in_handler %d", request_size);
if ((request_size != 0) && ((request_size % EP_MAXPACKET(data->ep_in)) == 0))
{
/* don't have data right now. Send a zero-length-packet to
Expand Down Expand Up @@ -325,7 +333,7 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)

RT_ASSERT(func != RT_NULL);

RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_out_handler %d\n", size));
LOG_D("_ep_out_handler %d", size);

data = (struct vcom*)func->user_data;
/* ensure serial is active */
Expand Down Expand Up @@ -362,7 +370,7 @@ static rt_err_t _ep_cmd_handler(ufunction_t func, rt_size_t size)
{
RT_ASSERT(func != RT_NULL);

RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_cmd_handler\n"));
LOG_D("_ep_cmd_handler");

return RT_EOK;
}
Expand All @@ -383,7 +391,7 @@ static rt_err_t _cdc_get_line_coding(udevice_t device, ureq_t setup)
RT_ASSERT(device != RT_NULL);
RT_ASSERT(setup != RT_NULL);

RT_DEBUG_LOG(RT_DEBUG_USB, ("_cdc_get_line_coding\n"));
LOG_D("_cdc_get_line_coding");

data.dwDTERate = 115200;
data.bCharFormat = 0;
Expand All @@ -398,7 +406,7 @@ static rt_err_t _cdc_get_line_coding(udevice_t device, ureq_t setup)

static rt_err_t _cdc_set_line_coding_callback(udevice_t device, rt_size_t size)
{
RT_DEBUG_LOG(RT_DEBUG_USB, ("_cdc_set_line_coding_callback\n"));
LOG_D("_cdc_set_line_coding_callback");

dcd_ep0_send_status(device->dcd);

Expand All @@ -418,7 +426,7 @@ static rt_err_t _cdc_set_line_coding(udevice_t device, ureq_t setup)
RT_ASSERT(device != RT_NULL);
RT_ASSERT(setup != RT_NULL);

RT_DEBUG_LOG(RT_DEBUG_USB, ("_cdc_set_line_coding\n"));
LOG_D("_cdc_set_line_coding");

rt_usbd_ep0_read(device, (void*)&line_coding, sizeof(struct ucdc_line_coding),
_cdc_set_line_coding_callback);
Expand Down Expand Up @@ -464,7 +472,7 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup)
break;
case CDC_SET_CONTROL_LINE_STATE:
data->connected = (setup->wValue & 0x01) > 0?RT_TRUE:RT_FALSE;
RT_DEBUG_LOG(RT_DEBUG_USB, ("vcom state:%d \n", data->connected));
LOG_D("vcom state:%d ", data->connected);
dcd_ep0_send_status(func->device->dcd);
break;
case CDC_SEND_BREAK:
Expand All @@ -490,7 +498,7 @@ static rt_err_t _function_enable(ufunction_t func)

RT_ASSERT(func != RT_NULL);

RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc function enable\n"));
LOG_D("cdc function enable");

_vcom_reset_state(func);

Expand Down Expand Up @@ -524,7 +532,7 @@ static rt_err_t _function_disable(ufunction_t func)

RT_ASSERT(func != RT_NULL);

RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc function disable\n"));
LOG_D("cdc function disable");

_vcom_reset_state(func);

Expand Down Expand Up @@ -765,7 +773,7 @@ static rt_ssize_t _vcom_tx(struct rt_serial_device *serial, rt_uint8_t *buf, rt_
RT_ASSERT(serial != RT_NULL);
RT_ASSERT(buf != RT_NULL);

RT_DEBUG_LOG(RT_DEBUG_USB, ("%s\n",__func__));
LOG_D("%s",__func__);

if (data->connected)
{
Expand Down Expand Up @@ -917,7 +925,7 @@ static void vcom_tx_thread_entry(void* parameter)

if (rt_completion_wait(&data->wait, VCOM_TX_TIMEOUT) != RT_EOK)
{
RT_DEBUG_LOG(RT_DEBUG_USB, ("vcom tx timeout\n"));
LOG_D("vcom tx timeout");
}
if(data->serial.parent.open_flag &
#ifdef RT_USING_SERIAL_V1
Expand Down
15 changes: 12 additions & 3 deletions components/drivers/usb/usbdevice/class/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
#include "hid.h"

#ifdef RT_USB_DEVICE_HID

#define DBG_TAG "usbdevice.hid"
#if RT_DEBUG_USB
#define DBG_LVL DBG_LOG
#else
#define DBG_LVL DBG_WARNING
#endif /* defined (RT_DEBUG_USB) */
#include <rtdbg.h>

#define HID_INTF_STR_INDEX 7
struct hid_s
{
Expand Down Expand Up @@ -431,7 +440,7 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)

static rt_err_t _hid_set_report_callback(udevice_t device, rt_size_t size)
{
RT_DEBUG_LOG(RT_DEBUG_USB, ("_hid_set_report_callback\n"));
LOG_D("_hid_set_report_callback");

if(size != 0)
{
Expand Down Expand Up @@ -525,7 +534,7 @@ static rt_err_t _function_enable(ufunction_t func)
RT_ASSERT(func->device != RT_NULL);
data = (struct hid_s *) func->user_data;

RT_DEBUG_LOG(RT_DEBUG_USB, ("hid function enable\n"));
LOG_D("hid function enable");
//
// _vcom_reset_state(func);
//
Expand Down Expand Up @@ -557,7 +566,7 @@ static rt_err_t _function_disable(ufunction_t func)
RT_ASSERT(func->device != RT_NULL);
data = (struct hid_s *) func->user_data;

RT_DEBUG_LOG(RT_DEBUG_USB, ("hid function disable\n"));
LOG_D("hid function disable");

if(data->ep_out->buffer != RT_NULL)
{
Expand Down
Loading