mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 14:28:20 +08:00
[include][dbg]update: no longer use RT_DEBUG_LOG in rtdebug.h (#7750)
This commit is contained in:
@@ -20,6 +20,10 @@
|
||||
|
||||
#ifdef RT_USB_DEVICE_CDC
|
||||
|
||||
#define DBG_TAG "usbdevice_cdc"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#define VCOM_INTF_STR_INDEX 5
|
||||
#ifdef RT_VCOM_TX_TIMEOUT
|
||||
#define VCOM_TX_TIMEOUT RT_VCOM_TX_TIMEOUT
|
||||
@@ -287,7 +291,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
|
||||
@@ -325,7 +329,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 */
|
||||
@@ -362,7 +366,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;
|
||||
}
|
||||
@@ -383,7 +387,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;
|
||||
@@ -398,7 +402,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);
|
||||
|
||||
@@ -418,7 +422,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);
|
||||
@@ -464,7 +468,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:
|
||||
@@ -490,7 +494,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);
|
||||
|
||||
@@ -524,7 +528,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);
|
||||
|
||||
@@ -765,7 +769,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)
|
||||
{
|
||||
@@ -917,7 +921,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
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#include "hid.h"
|
||||
|
||||
#ifdef RT_USB_DEVICE_HID
|
||||
|
||||
#define DBG_TAG "usbdevice.hid"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#define HID_INTF_STR_INDEX 7
|
||||
struct hid_s
|
||||
{
|
||||
@@ -431,7 +436,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)
|
||||
{
|
||||
@@ -525,7 +530,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);
|
||||
//
|
||||
@@ -557,7 +562,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)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#ifdef RT_USB_DEVICE_MSTORAGE
|
||||
#define MSTRORAGE_INTF_STR_INDEX 11
|
||||
|
||||
#define DBG_TAG "usbdevice.mstorage"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
enum STAT
|
||||
{
|
||||
STAT_CBW,
|
||||
@@ -202,7 +206,7 @@ static void _send_status(ufunction_t func)
|
||||
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_send_status\n"));
|
||||
LOG_D("_send_status");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
data->ep_in->request.buffer = (rt_uint8_t*)&data->csw_response;
|
||||
@@ -219,7 +223,7 @@ static rt_ssize_t _test_unit_ready(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_test_unit_ready\n"));
|
||||
LOG_D("_test_unit_ready");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
data->csw_response.status = 0;
|
||||
@@ -234,7 +238,7 @@ static rt_ssize_t _allow_removal(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_allow_removal\n"));
|
||||
LOG_D("_allow_removal");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
data->csw_response.status = 0;
|
||||
@@ -260,7 +264,7 @@ static rt_ssize_t _inquiry_cmd(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
RT_ASSERT(cbw != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_inquiry_cmd\n"));
|
||||
LOG_D("_inquiry_cmd");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
buf = data->ep_in->buffer;
|
||||
@@ -299,7 +303,7 @@ static rt_ssize_t _request_sense(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
RT_ASSERT(cbw != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_request_sense\n"));
|
||||
LOG_D("_request_sense");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
buf = (struct request_sense_data *)data->ep_in->buffer;
|
||||
@@ -342,7 +346,7 @@ static rt_ssize_t _mode_sense_6(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
RT_ASSERT(cbw != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_mode_sense_6\n"));
|
||||
LOG_D("_mode_sense_6");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
buf = data->ep_in->buffer;
|
||||
@@ -379,7 +383,7 @@ static rt_ssize_t _read_capacities(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
RT_ASSERT(cbw != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_read_capacities\n"));
|
||||
LOG_D("_read_capacities");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
buf = data->ep_in->buffer;
|
||||
@@ -425,7 +429,7 @@ static rt_ssize_t _read_capacity(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
RT_ASSERT(cbw != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_read_capacity\n"));
|
||||
LOG_D("_read_capacity");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
buf = data->ep_in->buffer;
|
||||
@@ -515,8 +519,8 @@ static rt_ssize_t _write_10(ufunction_t func, ustorage_cbw_t cbw)
|
||||
data->csw_response.data_reside = cbw->xfer_len;
|
||||
data->size = data->count * data->geometry.bytes_per_sector;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_write_10 count 0x%x block 0x%x 0x%x\n",
|
||||
data->count, data->block, data->geometry.sector_count));
|
||||
LOG_D("_write_10 count 0x%x block 0x%x 0x%x",
|
||||
data->count, data->block, data->geometry.sector_count);
|
||||
|
||||
data->csw_response.data_reside = data->cb_data_size;
|
||||
|
||||
@@ -543,7 +547,7 @@ static rt_ssize_t _verify_10(ufunction_t func, ustorage_cbw_t cbw)
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_verify_10\n"));
|
||||
LOG_D("_verify_10");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
data->csw_response.status = 0;
|
||||
@@ -559,7 +563,7 @@ static rt_ssize_t _start_stop(ufunction_t func,
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_start_stop\n"));
|
||||
LOG_D("_start_stop");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
data->csw_response.status = 0;
|
||||
@@ -574,7 +578,7 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_in_handler\n"));
|
||||
LOG_D("_ep_in_handler");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
|
||||
@@ -588,7 +592,7 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)
|
||||
}
|
||||
else
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("return to cbw status\n"));
|
||||
LOG_D("return to cbw status");
|
||||
data->ep_out->request.buffer = data->ep_out->buffer;
|
||||
data->ep_out->request.size = SIZEOF_CBW;
|
||||
data->ep_out->request.req_type = UIO_REQUEST_READ_FULL;
|
||||
@@ -606,8 +610,8 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size)
|
||||
data->csw_response.data_reside -= data->ep_in->request.size;
|
||||
if(data->csw_response.data_reside != 0)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("data_reside %d, request %d\n",
|
||||
data->csw_response.data_reside, data->ep_in->request.size));
|
||||
LOG_D("data_reside %d, request %d",
|
||||
data->csw_response.data_reside, data->ep_in->request.size);
|
||||
if(data->processing->dir == DIR_OUT)
|
||||
{
|
||||
rt_usbd_ep_set_stall(func->device, data->ep_out);
|
||||
@@ -657,13 +661,13 @@ static void cbw_dump(struct ustorage_cbw* cbw)
|
||||
{
|
||||
RT_ASSERT(cbw != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("signature 0x%x\n", cbw->signature));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("tag 0x%x\n", cbw->tag));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("xfer_len 0x%x\n", cbw->xfer_len));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("dflags 0x%x\n", cbw->dflags));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("lun 0x%x\n", cbw->lun));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("cb_len 0x%x\n", cbw->cb_len));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("cb[0] 0x%x\n", cbw->cb[0]));
|
||||
LOG_D("signature 0x%x", cbw->signature);
|
||||
LOG_D("tag 0x%x", cbw->tag);
|
||||
LOG_D("xfer_len 0x%x", cbw->xfer_len);
|
||||
LOG_D("dflags 0x%x", cbw->dflags);
|
||||
LOG_D("lun 0x%x", cbw->lun);
|
||||
LOG_D("cb_len 0x%x", cbw->cb_len);
|
||||
LOG_D("cb[0] 0x%x", cbw->cb[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -827,7 +831,7 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_out_handler %d\n", size));
|
||||
LOG_D("_ep_out_handler %d", size);
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
cbw = (struct ustorage_cbw*)data->ep_out->buffer;
|
||||
@@ -844,7 +848,7 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
|
||||
data->csw_response.data_reside = cbw->xfer_len;
|
||||
data->csw_response.status = 0;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("ep_out reside %d\n", data->csw_response.data_reside));
|
||||
LOG_D("ep_out reside %d", data->csw_response.data_reside);
|
||||
|
||||
cmd = _find_cbw_command(cbw->cb[0]);
|
||||
if(cmd == RT_NULL)
|
||||
@@ -869,8 +873,8 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size)
|
||||
}
|
||||
else if(data->status == STAT_RECEIVE)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("\nwrite size %d block 0x%x oount 0x%x\n",
|
||||
size, data->block, data->size));
|
||||
LOG_D("write size %d block 0x%x oount 0x%x",
|
||||
size, data->block, data->size);
|
||||
|
||||
data->size -= size;
|
||||
data->csw_response.data_reside -= size;
|
||||
@@ -928,13 +932,13 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup)
|
||||
RT_ASSERT(func->device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("mstorage_interface_handler\n"));
|
||||
LOG_D("mstorage_interface_handler");
|
||||
|
||||
switch(setup->bRequest)
|
||||
{
|
||||
case USBREQ_GET_MAX_LUN:
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_GET_MAX_LUN\n"));
|
||||
LOG_D("USBREQ_GET_MAX_LUN");
|
||||
|
||||
if(setup->wValue || setup->wLength != 1)
|
||||
{
|
||||
@@ -947,7 +951,7 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup)
|
||||
break;
|
||||
case USBREQ_MASS_STORAGE_RESET:
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_MASS_STORAGE_RESET\n"));
|
||||
LOG_D("USBREQ_MASS_STORAGE_RESET");
|
||||
|
||||
if(setup->wValue || setup->wLength != 0)
|
||||
{
|
||||
@@ -977,7 +981,7 @@ static rt_err_t _function_enable(ufunction_t func)
|
||||
{
|
||||
struct mstorage *data;
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("Mass storage function enabled\n"));
|
||||
LOG_D("Mass storage function enabled");
|
||||
data = (struct mstorage*)func->user_data;
|
||||
|
||||
data->disk = rt_device_find(RT_USB_MSTORAGE_DISK_NAME);
|
||||
@@ -1039,7 +1043,7 @@ static rt_err_t _function_disable(ufunction_t func)
|
||||
struct mstorage *data;
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("Mass storage function disabled\n"));
|
||||
LOG_D("Mass storage function disabled");
|
||||
|
||||
data = (struct mstorage*)func->user_data;
|
||||
if(data->ep_in->buffer != RT_NULL)
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include "drivers/usb_common.h"
|
||||
#include "drivers/usb_device.h"
|
||||
|
||||
#define DBG_TAG "usbdevice.core"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
static rt_list_t device_list;
|
||||
|
||||
static rt_ssize_t rt_usbd_ep_write(udevice_t device, uep_t ep, void *buffer, rt_size_t size);
|
||||
@@ -40,7 +44,7 @@ static rt_err_t _get_device_descriptor(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_device_descriptor\n"));
|
||||
LOG_D("_get_device_descriptor");
|
||||
|
||||
/* device descriptor wLength should less than USB_DESC_LENGTH_DEVICE*/
|
||||
size = (setup->wLength > USB_DESC_LENGTH_DEVICE) ?
|
||||
@@ -69,7 +73,7 @@ static rt_err_t _get_config_descriptor(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_config_descriptor\n"));
|
||||
LOG_D("_get_config_descriptor");
|
||||
|
||||
cfg_desc = &device->curr_cfg->cfg_desc;
|
||||
size = (setup->wLength > cfg_desc->wTotalLength) ?
|
||||
@@ -99,7 +103,7 @@ static rt_err_t _get_string_descriptor(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_string_descriptor\n"));
|
||||
LOG_D("_get_string_descriptor");
|
||||
|
||||
str_desc.type = USB_DESC_TYPE_STRING;
|
||||
index = setup->wValue & 0xFF;
|
||||
@@ -152,7 +156,7 @@ static rt_err_t _get_string_descriptor(struct udevice* device, ureq_t setup)
|
||||
|
||||
static rt_err_t _get_qualifier_descriptor(struct udevice* device, ureq_t setup)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_qualifier_descriptor\n"));
|
||||
LOG_D("_get_qualifier_descriptor");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
@@ -249,7 +253,7 @@ static rt_err_t _get_interface(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_interface\n"));
|
||||
LOG_D("_get_interface");
|
||||
|
||||
if (device->state != USB_STATE_CONFIGURED)
|
||||
{
|
||||
@@ -292,7 +296,7 @@ static rt_err_t _set_interface(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_set_interface\n"));
|
||||
LOG_D("_set_interface");
|
||||
|
||||
if (device->state != USB_STATE_CONFIGURED)
|
||||
{
|
||||
@@ -341,7 +345,7 @@ static rt_err_t _get_config(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
RT_ASSERT(device->curr_cfg != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_config\n"));
|
||||
LOG_D("_get_config");
|
||||
|
||||
if (device->state == USB_STATE_CONFIGURED)
|
||||
{
|
||||
@@ -378,7 +382,7 @@ static rt_err_t _set_config(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_set_config\n"));
|
||||
LOG_D("_set_config");
|
||||
|
||||
if (setup->wValue > device->dev_desc.bNumConfigurations)
|
||||
{
|
||||
@@ -388,7 +392,7 @@ static rt_err_t _set_config(struct udevice* device, ureq_t setup)
|
||||
|
||||
if (setup->wValue == 0)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("address state\n"));
|
||||
LOG_D("address state");
|
||||
device->state = USB_STATE_ADDRESS;
|
||||
|
||||
goto _exit;
|
||||
@@ -448,7 +452,7 @@ static rt_err_t _set_address(struct udevice* device, ureq_t setup)
|
||||
/* issue status stage */
|
||||
dcd_ep0_send_status(device->dcd);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_set_address\n"));
|
||||
LOG_D("_set_address");
|
||||
|
||||
device->state = USB_STATE_ADDRESS;
|
||||
|
||||
@@ -474,7 +478,7 @@ static rt_err_t _request_interface(struct udevice* device, ureq_t setup)
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(setup != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("_request_interface\n"));
|
||||
LOG_D("_request_interface");
|
||||
|
||||
intf = rt_usbd_find_interface(device, setup->wIndex & 0xFF, &func);
|
||||
if (intf != RT_NULL)
|
||||
@@ -593,7 +597,7 @@ static rt_err_t _standard_request(struct udevice* device, ureq_t setup)
|
||||
{
|
||||
req = (uio_request_t)rt_list_entry(node, struct uio_request, list);
|
||||
rt_usbd_io_request(device, ep, req);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("fired a request\n"));
|
||||
LOG_D("fired a request");
|
||||
}
|
||||
|
||||
rt_list_init(&ep->request_list);
|
||||
@@ -739,14 +743,14 @@ static rt_err_t _vendor_request(udevice_t device, ureq_t setup)
|
||||
}
|
||||
static rt_err_t _dump_setup_packet(ureq_t setup)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("[\n"));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, (" setup_request : 0x%x\n",
|
||||
setup->request_type));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, (" value : 0x%x\n", setup->wValue));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, (" length : 0x%x\n", setup->wLength));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, (" index : 0x%x\n", setup->wIndex));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, (" request : 0x%x\n", setup->bRequest));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("]\n"));
|
||||
LOG_D("[");
|
||||
LOG_D(" setup_request : 0x%x",
|
||||
setup->request_type);
|
||||
LOG_D(" value : 0x%x", setup->wValue);
|
||||
LOG_D(" length : 0x%x", setup->wLength);
|
||||
LOG_D(" index : 0x%x", setup->wIndex);
|
||||
LOG_D(" request : 0x%x", setup->bRequest);
|
||||
LOG_D("]");
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -1010,7 +1014,7 @@ udevice_t rt_usbd_device_new(void)
|
||||
{
|
||||
udevice_t udevice;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_device_new\n"));
|
||||
LOG_D("rt_usbd_device_new");
|
||||
|
||||
/* allocate memory for the object */
|
||||
udevice = (udevice_t)rt_malloc(sizeof(struct udevice));
|
||||
@@ -1146,7 +1150,7 @@ uconfig_t rt_usbd_config_new(void)
|
||||
{
|
||||
uconfig_t cfg;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_config_new\n"));
|
||||
LOG_D("rt_usbd_config_new");
|
||||
|
||||
/* allocate memory for the object */
|
||||
cfg = (uconfig_t)rt_malloc(sizeof(struct uconfig));
|
||||
@@ -1182,7 +1186,7 @@ uintf_t rt_usbd_interface_new(udevice_t device, uintf_handler_t handler)
|
||||
{
|
||||
uintf_t intf;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_interface_new\n"));
|
||||
LOG_D("rt_usbd_interface_new");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
@@ -1217,7 +1221,7 @@ ualtsetting_t rt_usbd_altsetting_new(rt_size_t desc_size)
|
||||
{
|
||||
ualtsetting_t setting;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_altsetting_new\n"));
|
||||
LOG_D("rt_usbd_altsetting_new");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(desc_size > 0);
|
||||
@@ -1281,7 +1285,7 @@ ufunction_t rt_usbd_function_new(udevice_t device, udev_desc_t dev_desc,
|
||||
{
|
||||
ufunction_t func;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_function_new\n"));
|
||||
LOG_D("rt_usbd_function_new");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
@@ -1317,7 +1321,7 @@ uep_t rt_usbd_endpoint_new(uep_desc_t ep_desc, udep_handler_t handler)
|
||||
{
|
||||
uep_t ep;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_endpoint_new\n"));
|
||||
LOG_D("rt_usbd_endpoint_new");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(ep_desc != RT_NULL);
|
||||
@@ -1377,7 +1381,7 @@ uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value)
|
||||
struct rt_list_node* node;
|
||||
uconfig_t cfg = RT_NULL;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_find_config\n"));
|
||||
LOG_D("rt_usbd_find_config");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
@@ -1411,7 +1415,7 @@ uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t *
|
||||
ufunction_t func;
|
||||
uintf_t intf;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_find_interface\n"));
|
||||
LOG_D("rt_usbd_find_interface");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
@@ -1451,7 +1455,7 @@ ualtsetting_t rt_usbd_find_altsetting(uintf_t intf, rt_uint8_t value)
|
||||
struct rt_list_node *i;
|
||||
ualtsetting_t setting;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_find_altsetting\n"));
|
||||
LOG_D("rt_usbd_find_altsetting");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
@@ -1534,7 +1538,7 @@ rt_err_t rt_usbd_device_add_config(udevice_t device, uconfig_t cfg)
|
||||
ualtsetting_t altsetting;
|
||||
uep_t ep;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_device_add_config\n"));
|
||||
LOG_D("rt_usbd_device_add_config");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
@@ -1592,7 +1596,7 @@ rt_err_t rt_usbd_device_add_config(udevice_t device, uconfig_t cfg)
|
||||
*/
|
||||
rt_err_t rt_usbd_config_add_function(uconfig_t cfg, ufunction_t func)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_config_add_function\n"));
|
||||
LOG_D("rt_usbd_config_add_function");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
@@ -1615,7 +1619,7 @@ rt_err_t rt_usbd_config_add_function(uconfig_t cfg, ufunction_t func)
|
||||
rt_err_t rt_usbd_function_add_interface(ufunction_t func, uintf_t intf)
|
||||
{
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_function_add_interface\n"));
|
||||
LOG_D("rt_usbd_function_add_interface");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(func != RT_NULL);
|
||||
@@ -1637,7 +1641,7 @@ rt_err_t rt_usbd_function_add_interface(ufunction_t func, uintf_t intf)
|
||||
*/
|
||||
rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_interface_add_altsetting\n"));
|
||||
LOG_D("rt_usbd_interface_add_altsetting");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
@@ -1661,7 +1665,7 @@ rt_err_t rt_usbd_interface_add_altsetting(uintf_t intf, ualtsetting_t setting)
|
||||
*/
|
||||
rt_err_t rt_usbd_altsetting_add_endpoint(ualtsetting_t setting, uep_t ep)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_altsetting_add_endpoint\n"));
|
||||
LOG_D("rt_usbd_altsetting_add_endpoint");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(setting != RT_NULL);
|
||||
@@ -1694,7 +1698,7 @@ rt_err_t rt_usbd_set_altsetting(uintf_t intf, rt_uint8_t value)
|
||||
{
|
||||
ualtsetting_t setting;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_set_altsetting\n"));
|
||||
LOG_D("rt_usbd_set_altsetting");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
@@ -1720,7 +1724,7 @@ rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value)
|
||||
{
|
||||
uconfig_t cfg;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_set_config\n"));
|
||||
LOG_D("rt_usbd_set_config");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
@@ -1774,7 +1778,7 @@ rt_size_t rt_usbd_io_request(udevice_t device, uep_t ep, uio_request_t req)
|
||||
else
|
||||
{
|
||||
rt_list_insert_before(&ep->request_list, &req->list);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("suspend a request\n"));
|
||||
LOG_D("suspend a request");
|
||||
}
|
||||
|
||||
return size;
|
||||
@@ -1794,11 +1798,11 @@ rt_err_t rt_usbd_set_feature(udevice_t device, rt_uint16_t value, rt_uint16_t in
|
||||
|
||||
if (value == USB_FEATURE_DEV_REMOTE_WAKEUP)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("set feature remote wakeup\n"));
|
||||
LOG_D("set feature remote wakeup");
|
||||
}
|
||||
else if (value == USB_FEATURE_ENDPOINT_HALT)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("set feature stall\n"));
|
||||
LOG_D("set feature stall");
|
||||
dcd_ep_set_stall(device->dcd, (rt_uint32_t)(index & 0xFF));
|
||||
}
|
||||
|
||||
@@ -1819,11 +1823,11 @@ rt_err_t rt_usbd_clear_feature(udevice_t device, rt_uint16_t value, rt_uint16_t
|
||||
|
||||
if (value == USB_FEATURE_DEV_REMOTE_WAKEUP)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("clear feature remote wakeup\n"));
|
||||
LOG_D("clear feature remote wakeup");
|
||||
}
|
||||
else if (value == USB_FEATURE_ENDPOINT_HALT)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("clear feature stall\n"));
|
||||
LOG_D("clear feature stall");
|
||||
dcd_ep_clear_stall(device->dcd, (rt_uint32_t)(index & 0xFF));
|
||||
}
|
||||
|
||||
@@ -1897,7 +1901,7 @@ static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep)
|
||||
ep->id = &device->dcd->ep_pool[i];
|
||||
device->dcd->ep_pool[i].status = ID_ASSIGNED;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("assigned %d\n", device->dcd->ep_pool[i].addr));
|
||||
LOG_D("assigned %d", device->dcd->ep_pool[i].addr);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
@@ -2170,7 +2174,7 @@ static void rt_usbd_thread_entry(void* parameter)
|
||||
continue;
|
||||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("message type %d\n", msg.type));
|
||||
LOG_D("message type %d", msg.type);
|
||||
|
||||
switch (msg.type)
|
||||
{
|
||||
@@ -2189,7 +2193,7 @@ static void rt_usbd_thread_entry(void* parameter)
|
||||
_ep0_out_notify(device, &msg.content.ep_msg);
|
||||
break;
|
||||
case USB_MSG_RESET:
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("reset %d\n", device->state));
|
||||
LOG_D("reset %d", device->state);
|
||||
if (device->state == USB_STATE_ADDRESS || device->state == USB_STATE_CONFIGURED)
|
||||
_stop_notify(device);
|
||||
device->state = USB_STATE_NOTATTACHED;
|
||||
|
||||
Reference in New Issue
Block a user