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