include/usb/usb_device: Add USB_* log macros

Add USB_DBG, USB_WRN, USB_ERR, USB_INF macros
in usb_device header file and remove them
from usb device drivers.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
This commit is contained in:
Yannis Damigos 2018-09-23 12:39:28 +03:00 committed by Anas Nashif
commit 452c3d6a87
6 changed files with 9 additions and 35 deletions

View file

@ -17,7 +17,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <misc/byteorder.h> #include <misc/byteorder.h>
#include <usb/usb_dc.h>
#include <usb/usb_device.h> #include <usb/usb_device.h>
#include "usb_dw_registers.h" #include "usb_dw_registers.h"
#include <soc.h> #include <soc.h>
@ -29,12 +28,6 @@
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(usb_dc_dw); LOG_MODULE_REGISTER(usb_dc_dw);
#define USB_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \
__func__, ##__VA_ARGS__)
#define USB_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define USB_WRN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define USB_INF(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
/* convert from endpoint address to hardware endpoint index */ /* convert from endpoint address to hardware endpoint index */
#define USB_DW_EP_ADDR2IDX(ep) ((ep) & ~USB_EP_DIR_MASK) #define USB_DW_EP_ADDR2IDX(ep) ((ep) & ~USB_EP_DIR_MASK)
/* get direction from endpoint address */ /* get direction from endpoint address */

View file

@ -11,7 +11,7 @@
#include <stdio.h> #include <stdio.h>
#include <kernel.h> #include <kernel.h>
#include <misc/byteorder.h> #include <misc/byteorder.h>
#include <usb/usb_dc.h> #include <usb/usb_device.h>
#include <board.h> #include <board.h>
#include <device.h> #include <device.h>
@ -19,12 +19,6 @@
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(usb_dc_kinetis); LOG_MODULE_REGISTER(usb_dc_kinetis);
#define USB_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \
__func__, ##__VA_ARGS__)
#define USB_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define USB_WRN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define USB_INF(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
#define NUM_OF_EP_MAX CONFIG_USBD_KINETIS_NUM_BIDIR_EP #define NUM_OF_EP_MAX CONFIG_USBD_KINETIS_NUM_BIDIR_EP
#define BD_OWN_MASK (1 << 5) #define BD_OWN_MASK (1 << 5)

View file

@ -16,7 +16,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <kernel.h> #include <kernel.h>
#include <usb/usb_dc.h>
#include <usb/usb_device.h> #include <usb/usb_device.h>
#include <clock_control.h> #include <clock_control.h>
#include <nrf_power.h> #include <nrf_power.h>
@ -33,12 +32,6 @@
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(usb_dc_nrf5); LOG_MODULE_REGISTER(usb_dc_nrf5);
#define USB_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \
__func__, ##__VA_ARGS__)
#define USB_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define USB_WRN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define USB_INF(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
#define MAX_EP_BUF_SZ 64UL #define MAX_EP_BUF_SZ 64UL
#define MAX_ISO_EP_BUF_SZ 1024UL #define MAX_ISO_EP_BUF_SZ 1024UL

View file

@ -8,13 +8,7 @@
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(usb_dc_sam0); LOG_MODULE_REGISTER(usb_dc_sam0);
#define USB_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \ #include <usb/usb_device.h>
__func__, ##__VA_ARGS__)
#define USB_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define USB_WRN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define USB_INF(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
#include <drivers/usb/usb_dc.h>
#include <soc.h> #include <soc.h>
#include <string.h> #include <string.h>

View file

@ -46,7 +46,6 @@
#include <soc.h> #include <soc.h>
#include <string.h> #include <string.h>
#include <usb/usb_dc.h>
#include <usb/usb_device.h> #include <usb/usb_device.h>
#include <clock_control/stm32_clock_control.h> #include <clock_control/stm32_clock_control.h>
#include <misc/util.h> #include <misc/util.h>
@ -56,12 +55,6 @@
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(usb_dc_stm32); LOG_MODULE_REGISTER(usb_dc_stm32);
#define USB_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \
__func__, ##__VA_ARGS__)
#define USB_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define USB_WRN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define USB_INF(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
#if defined(CONFIG_USB_BASE_ADDRESS) && defined(CONFIG_USB_HS_BASE_ADDRES) #if defined(CONFIG_USB_BASE_ADDRESS) && defined(CONFIG_USB_HS_BASE_ADDRES)
#error "Only one interface should be enabled at a time, OTG FS or OTG HS" #error "Only one interface should be enabled at a time, OTG FS or OTG HS"
#endif #endif

View file

@ -38,11 +38,18 @@
#include <drivers/usb/usb_dc.h> #include <drivers/usb/usb_dc.h>
#include <usb/usbstruct.h> #include <usb/usbstruct.h>
#include <logging/log.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define USB_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \
__func__, ##__VA_ARGS__)
#define USB_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define USB_WRN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define USB_INF(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
/* /*
* These macros should be used to place the USB descriptors * These macros should be used to place the USB descriptors
* in predetermined order in the RAM. * in predetermined order in the RAM.