usb: logs: Rename USB_WRN to LOG_WRN
Since logger is now suitable for our logs use it directly. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
f22060cdbe
commit
93bd26343e
9 changed files with 44 additions and 46 deletions
|
@ -436,7 +436,7 @@ static int usb_dw_tx(u8_t ep, const u8_t *const data,
|
|||
|
||||
/* Check if transfer len is too big */
|
||||
if (data_len > max_xfer_size) {
|
||||
USB_WRN("USB IN EP%d len too big (%d->%d)", ep_idx,
|
||||
LOG_WRN("USB IN EP%d len too big (%d->%d)", ep_idx,
|
||||
data_len, max_xfer_size);
|
||||
data_len = max_xfer_size;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ static int usb_dw_tx(u8_t ep, const u8_t *const data,
|
|||
pkt_cnt = (data_len + ep_mps - 1) / ep_mps;
|
||||
|
||||
if (pkt_cnt > max_pkt_cnt) {
|
||||
USB_WRN("USB IN EP%d pkt count too big (%d->%d)",
|
||||
LOG_WRN("USB IN EP%d pkt count too big (%d->%d)",
|
||||
ep_idx, pkt_cnt, pkt_cnt);
|
||||
pkt_cnt = max_pkt_cnt;
|
||||
data_len = pkt_cnt * ep_mps;
|
||||
|
@ -814,19 +814,19 @@ int usb_dc_ep_check_cap(const struct usb_dc_ep_cfg_data * const cfg)
|
|||
}
|
||||
|
||||
if (cfg->ep_mps > DW_USB_MAX_PACKET_SIZE) {
|
||||
USB_WRN("unsupported packet size");
|
||||
LOG_WRN("unsupported packet size");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((USB_DW_EP_ADDR2DIR(cfg->ep_addr) == USB_EP_DIR_OUT) &&
|
||||
(ep_idx >= DW_USB_OUT_EP_NUM)) {
|
||||
USB_WRN("OUT endpoint address out of range");
|
||||
LOG_WRN("OUT endpoint address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((USB_DW_EP_ADDR2DIR(cfg->ep_addr) == USB_EP_DIR_IN) &&
|
||||
(ep_idx >= DW_USB_IN_EP_NUM)) {
|
||||
USB_WRN("IN endpoint address out of range");
|
||||
LOG_WRN("IN endpoint address out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ int usb_dc_reset(void)
|
|||
int usb_dc_attach(void)
|
||||
{
|
||||
if (dev_data.attached) {
|
||||
USB_WRN("already attached");
|
||||
LOG_WRN("already attached");
|
||||
}
|
||||
|
||||
kinetis_usb_init();
|
||||
|
@ -311,7 +311,7 @@ int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data * const cfg)
|
|||
|
||||
if (ep_idx && (dev_data.ep_ctrl[ep_idx].status.in_enabled ||
|
||||
dev_data.ep_ctrl[ep_idx].status.out_enabled)) {
|
||||
USB_WRN("endpoint already configured");
|
||||
LOG_WRN("endpoint already configured");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -472,10 +472,10 @@ int usb_dc_ep_is_stalled(const u8_t ep, u8_t *const stalled)
|
|||
|
||||
u8_t bd_idx = get_bdt_idx(ep,
|
||||
dev_data.ep_ctrl[ep_idx].status.in_odd);
|
||||
USB_WRN("active bd ctrl: %x", bdt[bd_idx].set.bd_ctrl);
|
||||
LOG_WRN("active bd ctrl: %x", bdt[bd_idx].set.bd_ctrl);
|
||||
bd_idx = get_bdt_idx(ep,
|
||||
~dev_data.ep_ctrl[ep_idx].status.in_odd);
|
||||
USB_WRN("next bd ctrl: %x", bdt[bd_idx].set.bd_ctrl);
|
||||
LOG_WRN("next bd ctrl: %x", bdt[bd_idx].set.bd_ctrl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ int usb_dc_ep_enable(const u8_t ep)
|
|||
|
||||
if (ep_idx && (dev_data.ep_ctrl[ep_idx].status.in_enabled ||
|
||||
dev_data.ep_ctrl[ep_idx].status.out_enabled)) {
|
||||
USB_WRN("endpoint 0x%x already enabled", ep);
|
||||
LOG_WRN("endpoint 0x%x already enabled", ep);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,7 @@ int usb_dc_ep_write(const u8_t ep, const u8_t *const data,
|
|||
}
|
||||
|
||||
if (dev_data.ep_ctrl[ep_idx].status.in_stalled) {
|
||||
USB_WRN("endpoint is stalled");
|
||||
LOG_WRN("endpoint is stalled");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ int usb_dc_ep_read_wait(u8_t ep, u8_t *data, u32_t max_data_len,
|
|||
}
|
||||
|
||||
if (dev_data.ep_ctrl[ep_idx].status.out_stalled) {
|
||||
USB_WRN("endpoint is stalled");
|
||||
LOG_WRN("endpoint is stalled");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ int usb_dc_ep_read_wait(u8_t ep, u8_t *data, u32_t max_data_len,
|
|||
}
|
||||
|
||||
if (data_len > max_data_len) {
|
||||
USB_WRN("Not enough room to copy all the data!");
|
||||
LOG_WRN("Not enough room to copy all the data!");
|
||||
data_len = max_data_len;
|
||||
}
|
||||
|
||||
|
@ -710,7 +710,7 @@ int usb_dc_ep_read_continue(u8_t ep)
|
|||
|
||||
if (bdt[bd_idx].get.own) {
|
||||
/* May occur when usb_transfer initializes the OUT transfer */
|
||||
USB_WRN("Current buffer is claimed by the controller");
|
||||
LOG_WRN("Current buffer is claimed by the controller");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define USB_WRN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
|
||||
|
||||
/*
|
||||
* These macros should be used to place the USB descriptors
|
||||
* in predetermined order in the RAM.
|
||||
|
|
|
@ -195,7 +195,7 @@ static int hid_custom_handle_req(struct usb_setup_packet *setup,
|
|||
* already tell it the right descriptor size.
|
||||
* So truncated wLength if it doesn't match. */
|
||||
if (*len != hid_device.report_size) {
|
||||
USB_WRN("len %d doesn't match "
|
||||
LOG_WRN("len %d doesn't match "
|
||||
"Report Descriptor size", *len);
|
||||
*len = min(*len, hid_device.report_size);
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ static int mass_storage_class_handle_req(struct usb_setup_packet *pSetup,
|
|||
break;
|
||||
|
||||
default:
|
||||
USB_WRN("Unknown request 0x%x, value 0x%x",
|
||||
LOG_WRN("Unknown request 0x%x, value 0x%x",
|
||||
pSetup->bRequest, pSetup->wValue);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -256,10 +256,10 @@ static void testUnitReady(void)
|
|||
{
|
||||
if (cbw.DataLength != 0) {
|
||||
if ((cbw.Flags & 0x80) != 0) {
|
||||
USB_WRN("Stall IN endpoint");
|
||||
LOG_WRN("Stall IN endpoint");
|
||||
usb_ep_set_stall(mass_ep_data[MSD_IN_EP_IDX].ep_addr);
|
||||
} else {
|
||||
USB_WRN("Stall OUT endpoint");
|
||||
LOG_WRN("Stall OUT endpoint");
|
||||
usb_ep_set_stall(mass_ep_data[MSD_OUT_EP_IDX].ep_addr);
|
||||
}
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ static bool infoTransfer(void)
|
|||
length = n * BLOCK_SIZE;
|
||||
|
||||
if (!cbw.DataLength) { /* host requests no data*/
|
||||
USB_WRN("Zero length in CBW");
|
||||
LOG_WRN("Zero length in CBW");
|
||||
csw.Status = CSW_FAILED;
|
||||
sendCSW();
|
||||
return false;
|
||||
|
@ -443,10 +443,10 @@ static bool infoTransfer(void)
|
|||
|
||||
if (cbw.DataLength != length) {
|
||||
if ((cbw.Flags & 0x80) != 0) {
|
||||
USB_WRN("Stall IN endpoint");
|
||||
LOG_WRN("Stall IN endpoint");
|
||||
usb_ep_set_stall(mass_ep_data[MSD_IN_EP_IDX].ep_addr);
|
||||
} else {
|
||||
USB_WRN("Stall OUT endpoint");
|
||||
LOG_WRN("Stall OUT endpoint");
|
||||
usb_ep_set_stall(mass_ep_data[MSD_OUT_EP_IDX].ep_addr);
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ static void CBWDecode(u8_t *buf, u16_t size)
|
|||
csw.DataResidue = cbw.DataLength;
|
||||
|
||||
if ((cbw.CBLength < 1) || (cbw.CBLength > 16) || (cbw.LUN != 0)) {
|
||||
USB_WRN("cbw.CBLength %d", cbw.CBLength);
|
||||
LOG_WRN("cbw.CBLength %d", cbw.CBLength);
|
||||
fail();
|
||||
} else {
|
||||
switch (cbw.CB[0]) {
|
||||
|
@ -519,7 +519,7 @@ static void CBWDecode(u8_t *buf, u16_t size)
|
|||
} else {
|
||||
usb_ep_set_stall(
|
||||
mass_ep_data[MSD_OUT_EP_IDX].ep_addr);
|
||||
USB_WRN("Stall OUT endpoint");
|
||||
LOG_WRN("Stall OUT endpoint");
|
||||
csw.Status = CSW_ERROR;
|
||||
sendCSW();
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ static void CBWDecode(u8_t *buf, u16_t size)
|
|||
} else {
|
||||
usb_ep_set_stall(
|
||||
mass_ep_data[MSD_IN_EP_IDX].ep_addr);
|
||||
USB_WRN("Stall IN endpoint");
|
||||
LOG_WRN("Stall IN endpoint");
|
||||
csw.Status = CSW_ERROR;
|
||||
sendCSW();
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ static void CBWDecode(u8_t *buf, u16_t size)
|
|||
} else {
|
||||
usb_ep_set_stall(
|
||||
mass_ep_data[MSD_IN_EP_IDX].ep_addr);
|
||||
USB_WRN("Stall IN endpoint");
|
||||
LOG_WRN("Stall IN endpoint");
|
||||
csw.Status = CSW_ERROR;
|
||||
sendCSW();
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ static void CBWDecode(u8_t *buf, u16_t size)
|
|||
sendCSW();
|
||||
break;
|
||||
default:
|
||||
USB_WRN(">> default CB[0] %x", cbw.CB[0]);
|
||||
LOG_WRN(">> default CB[0] %x", cbw.CB[0]);
|
||||
fail();
|
||||
break;
|
||||
} /*switch(cbw.CB[0])*/
|
||||
|
@ -582,7 +582,7 @@ static void memoryVerify(u8_t *buf, u16_t size)
|
|||
size = memory_size - addr;
|
||||
stage = ERROR;
|
||||
usb_ep_set_stall(mass_ep_data[MSD_OUT_EP_IDX].ep_addr);
|
||||
USB_WRN("Stall OUT endpoint");
|
||||
LOG_WRN("Stall OUT endpoint");
|
||||
}
|
||||
|
||||
/* beginning of a new block -> load a whole block in RAM */
|
||||
|
@ -620,7 +620,7 @@ static void memoryWrite(u8_t *buf, u16_t size)
|
|||
size = memory_size - addr;
|
||||
stage = ERROR;
|
||||
usb_ep_set_stall(mass_ep_data[MSD_OUT_EP_IDX].ep_addr);
|
||||
USB_WRN("Stall OUT endpoint");
|
||||
LOG_WRN("Stall OUT endpoint");
|
||||
}
|
||||
|
||||
/* we fill an array in RAM of 1 block before writing it in memory */
|
||||
|
@ -689,7 +689,7 @@ static void mass_storage_bulk_out(u8_t ep,
|
|||
|
||||
/*an error has occurred: stall endpoint and send CSW*/
|
||||
default:
|
||||
USB_WRN("Stall OUT endpoint, stage: %d", stage);
|
||||
LOG_WRN("Stall OUT endpoint, stage: %d", stage);
|
||||
usb_ep_set_stall(ep);
|
||||
csw.Status = CSW_ERROR;
|
||||
sendCSW();
|
||||
|
@ -766,7 +766,7 @@ static void mass_storage_bulk_in(u8_t ep,
|
|||
|
||||
/*an error has occurred*/
|
||||
default:
|
||||
USB_WRN("Stall IN endpoint, stage: %d", stage);
|
||||
LOG_WRN("Stall IN endpoint, stage: %d", stage);
|
||||
usb_ep_set_stall(mass_ep_data[MSD_IN_EP_IDX].ep_addr);
|
||||
sendCSW();
|
||||
break;
|
||||
|
|
|
@ -206,7 +206,7 @@ static int ecm_class_handler(struct usb_setup_packet *setup, s32_t *len,
|
|||
}
|
||||
|
||||
if (setup->bmRequestType != USB_CDC_ECM_REQ_TYPE) {
|
||||
USB_WRN("Unhandled req_type 0x%x", setup->bmRequestType);
|
||||
LOG_WRN("Unhandled req_type 0x%x", setup->bmRequestType);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ static void rndis_bulk_out(u8_t ep, enum usb_dc_ep_cb_status_code ep_status)
|
|||
LOG_DBG("EP 0x%x status %d len %u", ep, ep_status, len);
|
||||
|
||||
if (len > CONFIG_RNDIS_BULK_EP_MPS) {
|
||||
USB_WRN("Limit read len %u to MPS %u", len,
|
||||
LOG_WRN("Limit read len %u to MPS %u", len,
|
||||
CONFIG_RNDIS_BULK_EP_MPS);
|
||||
len = CONFIG_RNDIS_BULK_EP_MPS;
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ static void rndis_bulk_out(u8_t ep, enum usb_dc_ep_cb_status_code ep_status)
|
|||
|
||||
/* Handle skip bytes */
|
||||
if (rndis.skip_bytes) {
|
||||
USB_WRN("Skip %u bytes out of remaining %d bytes",
|
||||
LOG_WRN("Skip %u bytes out of remaining %d bytes",
|
||||
len, rndis.skip_bytes);
|
||||
|
||||
rndis.skip_bytes -= len;
|
||||
|
@ -489,7 +489,7 @@ static void rndis_notify(struct k_work *work)
|
|||
|
||||
/* Decrement notify_count here */
|
||||
if (atomic_dec(&rndis.notify_count) != 1) {
|
||||
USB_WRN("Queue next notification, count %u",
|
||||
LOG_WRN("Queue next notification, count %u",
|
||||
atomic_get(&rndis.notify_count));
|
||||
|
||||
k_delayed_work_submit(¬ify_work, K_NO_WAIT);
|
||||
|
@ -517,7 +517,7 @@ static void rndis_queue_rsp(struct net_buf *rsp)
|
|||
net_buf_unref(buf);
|
||||
}
|
||||
#endif
|
||||
USB_WRN("Transmit response queue is not empty");
|
||||
LOG_WRN("Transmit response queue is not empty");
|
||||
}
|
||||
|
||||
LOG_DBG("Queued response pkt %p", rsp);
|
||||
|
@ -534,7 +534,7 @@ static void rndis_notify_rsp(void)
|
|||
|
||||
/* Keep track of number of notifies */
|
||||
if (atomic_inc(&rndis.notify_count) != 0) {
|
||||
USB_WRN("Unhandled notify: count %u",
|
||||
LOG_WRN("Unhandled notify: count %u",
|
||||
atomic_get(&rndis.notify_count));
|
||||
|
||||
return;
|
||||
|
@ -728,7 +728,7 @@ static int rndis_query_handle(u8_t *data, u32_t len)
|
|||
net_buf_add_le32(buf, drv_version);
|
||||
break;
|
||||
default:
|
||||
USB_WRN("Unhandled query for Object ID 0x%x", object_id);
|
||||
LOG_WRN("Unhandled query for Object ID 0x%x", object_id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,7 @@ static int handle_encapsulated_cmd(u8_t *data, u32_t len)
|
|||
net_hexdump("CMD >", data, len);
|
||||
|
||||
if (len != msg->len) {
|
||||
USB_WRN("Total len is different then command len %u %u",
|
||||
LOG_WRN("Total len is different then command len %u %u",
|
||||
len, msg->len);
|
||||
/* TODO: need actions? */
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ static int rndis_class_handler(struct usb_setup_packet *setup, s32_t *len,
|
|||
handle_encapsulated_rsp(data, len);
|
||||
} else {
|
||||
*len = 0; /* FIXME! */
|
||||
USB_WRN("Unknown USB packet req 0x%x type 0x%x",
|
||||
LOG_WRN("Unknown USB packet req 0x%x type 0x%x",
|
||||
setup->bRequest, setup->bmRequestType);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ int try_write(u8_t ep, u8_t *data, u16_t len)
|
|||
* error from the controller, try only several times.
|
||||
*/
|
||||
if (tries--) {
|
||||
USB_WRN("Error: EAGAIN. Another try");
|
||||
LOG_WRN("Error: EAGAIN. Another try");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ int try_write(u8_t ep, u8_t *data, u16_t len)
|
|||
break;
|
||||
/* TODO: Handle other error codes */
|
||||
default:
|
||||
USB_WRN("Error writing to ep 0x%x ret %d", ep, ret);
|
||||
LOG_WRN("Error writing to ep 0x%x ret %d", ep, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ int try_write(u8_t ep, u8_t *data, u16_t len)
|
|||
#endif
|
||||
|
||||
if (len) {
|
||||
USB_WRN("Remaining bytes %d wrote %d", len, wrote);
|
||||
LOG_WRN("Remaining bytes %d wrote %d", len, wrote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ static int dfu_class_handle_req(struct usb_setup_packet *pSetup,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
USB_WRN("DFU UNKNOWN STATE: %d", pSetup->bRequest);
|
||||
LOG_WRN("DFU UNKNOWN STATE: %d", pSetup->bRequest);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ static int dfu_custom_handle_req(struct usb_setup_packet *pSetup,
|
|||
FLASH_AREA_IMAGE_1_SIZE;
|
||||
break;
|
||||
default:
|
||||
USB_WRN("Invalid DFU alternate setting");
|
||||
LOG_WRN("Invalid DFU alternate setting");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
dfu_data.alt_setting = pSetup->wValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue