misc: Remove generic PRINT macros from usb samples
Remove generic PRINT macros from usb samples and replace with SYS_LOG module. Jira: ZEP-240 Change-Id: Id90c657b05c3b3b9e326f3c1e08d8e8fb113714c Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
This commit is contained in:
parent
107f38acf6
commit
d01ad5b591
4 changed files with 16 additions and 25 deletions
|
@ -10,3 +10,4 @@ CONFIG_SYS_LOG_USB_LEVEL=0
|
|||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_UART_LINE_CTRL=y
|
||||
CONFIG_SYS_LOG=y
|
||||
|
|
|
@ -28,13 +28,9 @@
|
|||
#include <uart.h>
|
||||
#include <zephyr.h>
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
|
||||
|
||||
static const char *banner1 = "Send characters to the UART device\r\n";
|
||||
static const char *banner2 = "Characters read:\r\n";
|
||||
|
@ -90,35 +86,35 @@ void main(void)
|
|||
|
||||
dev = device_get_binding(CONFIG_CDC_ACM_PORT_NAME);
|
||||
if (!dev) {
|
||||
PRINT("CDC ACM device not found\n");
|
||||
SYS_LOG_INF("CDC ACM device not found");
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT("Wait for DTR\n");
|
||||
SYS_LOG_INF("Wait for DTR");
|
||||
while (1) {
|
||||
uart_line_ctrl_get(dev, LINE_CTRL_DTR, &dtr);
|
||||
if (dtr)
|
||||
break;
|
||||
}
|
||||
PRINT("DTR set, start test\n");
|
||||
SYS_LOG_INF("DTR set, start test");
|
||||
|
||||
/* They are optional, we use them to test the interrupt endpoint */
|
||||
ret = uart_line_ctrl_set(dev, LINE_CTRL_DCD, 1);
|
||||
if (ret)
|
||||
PRINT("Failed to set DCD, ret code %d\n", ret);
|
||||
SYS_LOG_INF("Failed to set DCD, ret code %d", ret);
|
||||
|
||||
ret = uart_line_ctrl_set(dev, LINE_CTRL_DSR, 1);
|
||||
if (ret)
|
||||
PRINT("Failed to set DSR, ret code %d\n", ret);
|
||||
SYS_LOG_INF("Failed to set DSR, ret code %d", ret);
|
||||
|
||||
/* Wait 1 sec for the host to do all settings */
|
||||
sys_thread_busy_wait(1000000);
|
||||
|
||||
ret = uart_line_ctrl_get(dev, LINE_CTRL_BAUD_RATE, &baudrate);
|
||||
if (ret)
|
||||
PRINT("Failed to get baudrate, ret code %d\n", ret);
|
||||
SYS_LOG_INF("Failed to get baudrate, ret code %d", ret);
|
||||
else
|
||||
PRINT("Baudrate detected: %d\n", baudrate);
|
||||
SYS_LOG_INF("Baudrate detected: %d", baudrate);
|
||||
|
||||
uart_irq_callback_set(dev, interrupt_handler);
|
||||
write_data(dev, banner1, strlen(banner1));
|
||||
|
|
|
@ -4,8 +4,7 @@ CONFIG_ARC_INIT=n
|
|||
CONFIG_USB=y
|
||||
CONFIG_USB_DW=y
|
||||
CONFIG_USB_DEVICE_STACK=y
|
||||
#Un comment to enable logging
|
||||
#CONFIG_SYS_LOG=y
|
||||
CONFIG_SYS_LOG=y
|
||||
CONFIG_SYS_LOG_USB_DFU_LEVEL=0
|
||||
CONFIG_SYS_LOG_USB_DW_LEVEL=0
|
||||
CONFIG_SYS_LOG_USB_LEVEL=0
|
||||
|
|
|
@ -27,13 +27,8 @@
|
|||
#include <zephyr.h>
|
||||
#include "usb_dfu.h"
|
||||
|
||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||
#include <stdio.h>
|
||||
#define PRINT printf
|
||||
#else
|
||||
#include <misc/printk.h>
|
||||
#define PRINT printk
|
||||
#endif
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||
#include <misc/sys_log.h>
|
||||
|
||||
#ifdef CONFIG_SOC_QUARK_SE
|
||||
#define DFU_FLASH_DEVICE "QUARK_FLASH"
|
||||
|
@ -49,11 +44,11 @@ void main(void)
|
|||
{
|
||||
struct device *dev = NULL;
|
||||
|
||||
PRINT("DFU Test Application\n");
|
||||
SYS_LOG_INF("DFU Test Application");
|
||||
|
||||
dev = device_get_binding(DFU_FLASH_DEVICE);
|
||||
if (!dev) {
|
||||
printf("Flash device not found\n");
|
||||
SYS_LOG_ERR("Flash device not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue