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;
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#ifdef RT_USBH_ADK
|
||||
|
||||
#define DBG_TAG "usbhost.adk"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
static struct uclass_driver adk_driver;
|
||||
static const char* _adk_manufacturer = RT_NULL;
|
||||
static const char* _adk_model = RT_NULL;
|
||||
@@ -231,7 +235,7 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
return -RT_EIO;
|
||||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_adk_run\n"));
|
||||
LOG_D("rt_usbh_adk_run");
|
||||
|
||||
dev_desc = &intf->device->dev_desc;
|
||||
if(dev_desc->idVendor == USB_ACCESSORY_VENDOR_ID &&
|
||||
@@ -240,11 +244,11 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
{
|
||||
if(intf->intf_desc->bInterfaceSubClass != 0xFF) return -RT_ERROR;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("found android accessory device\n"));
|
||||
LOG_D("found android accessory device");
|
||||
}
|
||||
else
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("switch device\n"));
|
||||
LOG_D("switch device");
|
||||
|
||||
if((ret = rt_usbh_adk_get_protocol(intf, &protocol)) != RT_EOK)
|
||||
{
|
||||
@@ -271,12 +275,12 @@ static rt_err_t rt_usbh_adk_enable(void* arg)
|
||||
rt_usbh_adk_send_string(intf,
|
||||
ACCESSORY_STRING_SERIAL, _adk_serial);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("manufacturer %s\n", _adk_manufacturer));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("model %s\n", _adk_model));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("description %s\n", _adk_description));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("version %s\n", _adk_version));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("uri %s\n", _adk_uri));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("serial %s\n", _adk_serial));
|
||||
LOG_D("manufacturer %s", _adk_manufacturer);
|
||||
LOG_D("model %s", _adk_model);
|
||||
LOG_D("description %s", _adk_description);
|
||||
LOG_D("version %s", _adk_version);
|
||||
LOG_D("uri %s", _adk_uri);
|
||||
LOG_D("serial %s", _adk_serial);
|
||||
|
||||
if((ret = rt_usbh_adk_start(intf)) != RT_EOK)
|
||||
{
|
||||
@@ -372,7 +376,7 @@ static rt_err_t rt_usbh_adk_disable(void* arg)
|
||||
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_adk_stop\n"));
|
||||
LOG_D("rt_usbh_adk_stop");
|
||||
|
||||
adk = (uadk_t)intf->user_data;
|
||||
if(adk == RT_NULL)
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
#ifdef RT_USBH_HID
|
||||
|
||||
#define DBG_TAG "usbhost.hid"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
static struct uclass_driver hid_driver;
|
||||
static rt_list_t _protocal_list;
|
||||
|
||||
@@ -304,8 +308,7 @@ static rt_err_t rt_usbh_hid_enable(void* arg)
|
||||
|
||||
pro_id = intf->intf_desc->bInterfaceProtocol;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB,
|
||||
("HID device enable, protocal id %d\n", pro_id));
|
||||
LOG_D("HID device enable, protocal id %d", pro_id);
|
||||
|
||||
protocal = rt_usbh_hid_protocal_find(pro_id);
|
||||
if(protocal == RT_NULL)
|
||||
@@ -367,7 +370,7 @@ static rt_err_t rt_usbh_hid_disable(void* arg)
|
||||
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_hid_disable\n"));
|
||||
LOG_D("rt_usbh_hid_disable");
|
||||
|
||||
hid = (struct uhid*)intf->user_data;
|
||||
if(hid != RT_NULL)
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#ifdef RT_USBH_MSTORAGE
|
||||
|
||||
#define DBG_TAG "usbhost.mass"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
extern rt_err_t rt_udisk_run(struct uhintf* intf);
|
||||
extern rt_err_t rt_udisk_stop(struct uhintf* intf);
|
||||
|
||||
@@ -70,7 +74,7 @@ static rt_err_t _pipe_check(struct uhintf* intf, upipe_t pipe)
|
||||
|
||||
stor->pipe_in->status = UPIPE_STATUS_OK;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("clean storage in pipe stall\n"));
|
||||
LOG_D("clean storage in pipe stall");
|
||||
|
||||
/* it should receive csw after clear the stall feature */
|
||||
size = rt_usb_hcd_pipe_xfer(stor->pipe_in->inst->hcd,
|
||||
@@ -200,7 +204,7 @@ rt_err_t rt_usbh_storage_get_max_lun(struct uhintf* intf, rt_uint8_t* max_lun)
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_get_max_lun\n"));
|
||||
LOG_D("rt_usbh_storage_get_max_lun");
|
||||
|
||||
/* get usb device instance from the interface instance */
|
||||
device = intf->device;
|
||||
@@ -250,7 +254,7 @@ rt_err_t rt_usbh_storage_reset(struct uhintf* intf)
|
||||
}
|
||||
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_reset\n"));
|
||||
LOG_D("rt_usbh_storage_reset");
|
||||
|
||||
/* get usb device instance from the interface instance */
|
||||
device = intf->device;
|
||||
@@ -297,7 +301,7 @@ rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer,
|
||||
}
|
||||
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_read10\n"));
|
||||
LOG_D("rt_usbh_storage_read10");
|
||||
|
||||
/* construct the command block wrapper */
|
||||
rt_memset(&cmd, 0, sizeof(struct ustorage_cbw));
|
||||
@@ -343,7 +347,7 @@ rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer,
|
||||
}
|
||||
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_write10\n"));
|
||||
LOG_D("rt_usbh_storage_write10");
|
||||
|
||||
/* construct the command block wrapper */
|
||||
rt_memset(&cmd, 0, sizeof(struct ustorage_cbw));
|
||||
@@ -387,7 +391,7 @@ rt_err_t rt_usbh_storage_request_sense(struct uhintf* intf, rt_uint8_t* buffer)
|
||||
}
|
||||
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_request_sense\n"));
|
||||
LOG_D("rt_usbh_storage_request_sense");
|
||||
|
||||
/* construct the command block wrapper */
|
||||
rt_memset(&cmd, 0, sizeof(struct ustorage_cbw));
|
||||
@@ -423,7 +427,7 @@ rt_err_t rt_usbh_storage_test_unit_ready(struct uhintf* intf)
|
||||
}
|
||||
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_test_unit_ready\n"));
|
||||
LOG_D("rt_usbh_storage_test_unit_ready");
|
||||
|
||||
/* construct the command block wrapper */
|
||||
rt_memset(&cmd, 0, sizeof(struct ustorage_cbw));
|
||||
@@ -459,7 +463,7 @@ rt_err_t rt_usbh_storage_inquiry(struct uhintf* intf, rt_uint8_t* buffer)
|
||||
}
|
||||
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_inquiry\n"));
|
||||
LOG_D("rt_usbh_storage_inquiry");
|
||||
|
||||
/* construct the command block wrapper */
|
||||
rt_memset(&cmd, 0, sizeof(struct ustorage_cbw));
|
||||
@@ -496,7 +500,7 @@ rt_err_t rt_usbh_storage_get_capacity(struct uhintf* intf, rt_uint8_t* buffer)
|
||||
}
|
||||
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_get_capacity\n"));
|
||||
LOG_D("rt_usbh_storage_get_capacity");
|
||||
|
||||
/* construct the command block wrapper */
|
||||
rt_memset(&cmd, 0, sizeof(struct ustorage_cbw));
|
||||
@@ -534,11 +538,11 @@ static rt_err_t rt_usbh_storage_enable(void* arg)
|
||||
return -RT_EIO;
|
||||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("subclass %d, protocal %d\n",
|
||||
LOG_D("subclass %d, protocal %d",
|
||||
intf->intf_desc->bInterfaceSubClass,
|
||||
intf->intf_desc->bInterfaceProtocol));
|
||||
intf->intf_desc->bInterfaceProtocol);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_run\n"));
|
||||
LOG_D("rt_usbh_storage_run");
|
||||
|
||||
/* only support SCSI subclass and bulk only protocal */
|
||||
|
||||
@@ -610,7 +614,7 @@ static rt_err_t rt_usbh_storage_disable(void* arg)
|
||||
RT_ASSERT(intf->user_data != RT_NULL);
|
||||
RT_ASSERT(intf->device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_stop\n"));
|
||||
LOG_D("rt_usbh_storage_stop");
|
||||
|
||||
/* get storage instance from interface instance */
|
||||
stor = (ustor_t)intf->user_data;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "mass.h"
|
||||
|
||||
#define DBG_TAG "usbhost.udisk"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#ifdef RT_USBH_MSTORAGE
|
||||
@@ -281,8 +281,8 @@ rt_err_t rt_udisk_run(struct uhintf* intf)
|
||||
stor->capicity[1] = uswap_32(stor->capicity[1]);
|
||||
stor->capicity[0] += 1;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("capicity %d, block size %d\n",
|
||||
stor->capicity[0], stor->capicity[1]));
|
||||
LOG_D("capicity %d, block size %d",
|
||||
stor->capicity[0], stor->capicity[1]);
|
||||
|
||||
/* get the first sector to read partition table */
|
||||
sector = (rt_uint8_t*) rt_malloc (SECTOR_SIZE);
|
||||
@@ -294,7 +294,7 @@ rt_err_t rt_udisk_run(struct uhintf* intf)
|
||||
|
||||
rt_memset(sector, 0, SECTOR_SIZE);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("read partition table\n"));
|
||||
LOG_D("read partition table");
|
||||
|
||||
/* get the partition table */
|
||||
ret = rt_usbh_storage_read10(intf, sector, 0, 1, USB_TIMEOUT_LONG);
|
||||
@@ -306,7 +306,7 @@ rt_err_t rt_udisk_run(struct uhintf* intf)
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("finished reading partition\n"));
|
||||
LOG_D("finished reading partition");
|
||||
|
||||
for(i=0; i<MAX_PARTITION_COUNT; i++)
|
||||
{
|
||||
@@ -346,11 +346,11 @@ rt_err_t rt_udisk_run(struct uhintf* intf)
|
||||
if (dfs_mount(stor->dev[i].parent.name, UDISK_MOUNTPOINT, "elm",
|
||||
0, 0) == 0)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("udisk part %d mount successfully\n", i));
|
||||
LOG_D("udisk part %d mount successfully", i);
|
||||
}
|
||||
else
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("udisk part %d mount failed\n", i));
|
||||
LOG_D("udisk part %d mount failed", i);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#if defined(RT_USBH_HID) && defined(RT_USBH_HID_KEYBOARD)
|
||||
|
||||
#define DBG_TAG "usbhost.ukbd"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
static struct uprotocal kbd_protocal;
|
||||
|
||||
static rt_err_t rt_usbh_hid_kbd_callback(void* arg)
|
||||
@@ -28,7 +32,7 @@ static rt_err_t rt_usbh_hid_kbd_callback(void* arg)
|
||||
|
||||
if(int1 != 0 || int2 != 0)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("key down 0x%x, 0x%x\n", int1, int2));
|
||||
LOG_D("key down 0x%x, 0x%x", int1, int2);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
@@ -62,7 +66,7 @@ static rt_err_t rt_usbh_hid_kbd_init(void* arg)
|
||||
|
||||
rt_usbh_hid_set_idle(intf, 10, 0);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("start usb keyboard\n"));
|
||||
LOG_D("start usb keyboard");
|
||||
|
||||
kbd_thread = rt_thread_create("kbd0", kbd_task, intf, 1024, 8, 100);
|
||||
rt_thread_startup(kbd_thread);
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
#endif
|
||||
|
||||
#if defined(RT_USBH_HID) && defined(RT_USBH_HID_MOUSE)
|
||||
|
||||
#define DBG_TAG "usbhost.umouse"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
static struct uprotocal mouse_protocal;
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
@@ -42,9 +47,9 @@ static rt_err_t rt_usbh_hid_mouse_callback(void* arg)
|
||||
#endif
|
||||
hid = (struct uhid*)arg;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("hid 0x%x 0x%x\n",
|
||||
LOG_D("hid 0x%x 0x%x",
|
||||
*(rt_uint32_t*)hid->buffer,
|
||||
*(rt_uint32_t*)(&hid->buffer[4])));
|
||||
*(rt_uint32_t*)(&hid->buffer[4]));
|
||||
#ifdef RT_USING_RTGUI
|
||||
if(hid->buffer[1]!=0)
|
||||
{
|
||||
@@ -157,7 +162,7 @@ static rt_err_t rt_usbh_hid_mouse_init(void* arg)
|
||||
mouse_thread = rt_thread_create("mouse0", mouse_task, intf, 1024, 8, 100);
|
||||
rt_thread_startup(mouse_thread);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("start usb mouse\n"));
|
||||
LOG_D("start usb mouse");
|
||||
#ifdef RT_USING_RTGUI
|
||||
RTGUI_EVENT_MOUSE_BUTTON_INIT(&emouse);
|
||||
emouse.wid = RT_NULL;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#define USB_THREAD_STACK_SIZE 4096
|
||||
|
||||
#define DBG_TAG "usbhost.hub"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub)
|
||||
ret = rt_usbh_hub_get_port_status(hub, i + 1, &pstatus);
|
||||
if(ret != RT_EOK) continue;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("port %d status 0x%x\n", i + 1, pstatus));
|
||||
RT_DEBUG_LOG_D("port %d status 0x%x", i + 1, pstatus);
|
||||
|
||||
/* check port status change */
|
||||
if (pstatus & PORT_CCSC)
|
||||
@@ -476,13 +476,13 @@ static void rt_usbh_hub_irq(void* context)
|
||||
|
||||
if(pipe->status != UPIPE_STATUS_OK)
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB,("hub irq error\n"));
|
||||
LOG_D("hub irq error");
|
||||
return;
|
||||
}
|
||||
|
||||
rt_usbh_hub_port_change(hub);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB,("hub int xfer...\n"));
|
||||
LOG_D("hub int xfer...");
|
||||
|
||||
/* parameter check */
|
||||
RT_ASSERT(pipe->inst->hcd != RT_NULL);
|
||||
@@ -512,7 +512,7 @@ static rt_err_t rt_usbh_hub_enable(void *arg)
|
||||
/* paremeter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_hub_run\n"));
|
||||
RT_DEBUG_LOG_D("rt_usbh_hub_run");
|
||||
|
||||
/* get usb device instance */
|
||||
device = intf->device;
|
||||
@@ -613,7 +613,7 @@ static rt_err_t rt_usbh_hub_disable(void* arg)
|
||||
/* paremeter check */
|
||||
RT_ASSERT(intf != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_hub_stop\n"));
|
||||
RT_DEBUG_LOG_D("rt_usbh_hub_stop");
|
||||
hub = (uhub_t)intf->user_data;
|
||||
|
||||
for(i=0; i<hub->num_ports; i++)
|
||||
@@ -662,7 +662,7 @@ static void rt_usbh_hub_thread_entry(void* parameter)
|
||||
if (rt_mq_recv(hcd->usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) < 0)
|
||||
continue;
|
||||
|
||||
//RT_DEBUG_LOG(RT_DEBUG_USB, ("msg type %d\n", msg.type));
|
||||
//RT_DEBUG_LOG_D("msg type %d", msg.type);
|
||||
|
||||
switch (msg.type)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
#include <rtthread.h>
|
||||
#include <drivers/usb_host.h>
|
||||
|
||||
#define DBG_TAG "usbhost.core"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
static struct uinstance dev[USB_MAX_DEVICE];
|
||||
|
||||
/**
|
||||
@@ -105,7 +109,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
rt_usb_hcd_alloc_pipe(device->hcd, &device->pipe_ep0_out, device, &ep0_out_desc);
|
||||
rt_usb_hcd_alloc_pipe(device->hcd, &device->pipe_ep0_in, device, &ep0_in_desc);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("start enumnation\n"));
|
||||
LOG_D("start enumnation");
|
||||
|
||||
/* get device descriptor head */
|
||||
ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_DEVICE, (void*)dev_desc, 8);
|
||||
@@ -138,8 +142,8 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
/* alloc true address ep0 pipe*/
|
||||
rt_usb_hcd_alloc_pipe(device->hcd, &device->pipe_ep0_out, device, &ep0_out_desc);
|
||||
rt_usb_hcd_alloc_pipe(device->hcd, &device->pipe_ep0_in, device, &ep0_in_desc);
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("get device descriptor length %d\n",
|
||||
dev_desc->bLength));
|
||||
LOG_D("get device descriptor length %d",
|
||||
dev_desc->bLength);
|
||||
|
||||
/* get full device descriptor again */
|
||||
ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_DEVICE, (void*)dev_desc, dev_desc->bLength);
|
||||
@@ -149,8 +153,8 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
return ret;
|
||||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("Vendor ID 0x%x\n", dev_desc->idVendor));
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("Product ID 0x%x\n", dev_desc->idProduct));
|
||||
LOG_D("Vendor ID 0x%x", dev_desc->idVendor);
|
||||
LOG_D("Product ID 0x%x", dev_desc->idProduct);
|
||||
|
||||
/* get configuration descriptor head */
|
||||
ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_CONFIGURATION, &cfg_desc, 18);
|
||||
@@ -193,9 +197,9 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("interface class 0x%x, subclass 0x%x\n",
|
||||
LOG_D("interface class 0x%x, subclass 0x%x",
|
||||
intf_desc->bInterfaceClass,
|
||||
intf_desc->bInterfaceSubClass));
|
||||
intf_desc->bInterfaceSubClass);
|
||||
/* alloc pipe*/
|
||||
for(ep_index = 0; ep_index < intf_desc->bNumEndpoints; ep_index++)
|
||||
{
|
||||
@@ -276,7 +280,7 @@ rt_err_t rt_usbh_detach_instance(uinst_t device)
|
||||
|
||||
RT_ASSERT(device->intf[i]->device == device);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("free interface instance %d\n", i));
|
||||
LOG_D("free interface instance %d", i);
|
||||
rt_usbh_class_driver_disable(device->intf[i]->drv, (void*)device->intf[i]);
|
||||
rt_free(device->intf[i]);
|
||||
}
|
||||
@@ -349,7 +353,7 @@ rt_err_t rt_usbh_set_address(uinst_t device)
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_set_address\n"));
|
||||
LOG_D("rt_usb_set_address");
|
||||
|
||||
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD |
|
||||
USB_REQ_TYPE_DEVICE;
|
||||
@@ -499,8 +503,7 @@ rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num,
|
||||
{
|
||||
*intf_desc = (uintf_desc_t)desc;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB,
|
||||
("rt_usb_get_interface_descriptor: %d\n", num));
|
||||
LOG_D("rt_usb_get_interface_descriptor: %d", num);
|
||||
return RT_EOK;
|
||||
}
|
||||
}
|
||||
@@ -547,8 +550,7 @@ rt_err_t rt_usbh_get_endpoint_descriptor(uintf_desc_t intf_desc, int num,
|
||||
{
|
||||
*ep_desc = (uep_desc_t)desc;
|
||||
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB,
|
||||
("rt_usb_get_endpoint_descriptor: %d\n", num));
|
||||
LOG_D("rt_usb_get_endpoint_descriptor: %d", num);
|
||||
return RT_EOK;
|
||||
}
|
||||
else count++;
|
||||
@@ -568,7 +570,7 @@ int rt_usb_hcd_pipe_xfer(uhcd_t hcd, upipe_t pipe, void* buffer, int nbytes, int
|
||||
rt_uint8_t * pbuffer = (rt_uint8_t *)buffer;
|
||||
do
|
||||
{
|
||||
RT_DEBUG_LOG(RT_DEBUG_USB,("pipe transform remain size,: %d\n", remain_size));
|
||||
LOG_D("pipe transform remain size,: %d", remain_size);
|
||||
send_size = (remain_size > pipe->ep.wMaxPacketSize) ? pipe->ep.wMaxPacketSize : remain_size;
|
||||
if(hcd->ops->pipe_xfer(pipe, USBH_PID_DATA, pbuffer, send_size, timeout) == send_size)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user