Revert "sys_log: replace old debug macros at DMA sample"

This reverts commit 9a8ff013ab.

Change-Id: I1542d1275922671e89975479ec98e37d4b496eb3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-08-23 13:26:26 -07:00
commit 2599c6075e
2 changed files with 21 additions and 19 deletions

View file

@ -1,4 +1,2 @@
CONFIG_DMA=y CONFIG_DMA=y
CONFIG_DMA_QMSI=y CONFIG_DMA_QMSI=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_DMA_LEVEL=4

View file

@ -21,8 +21,13 @@
#include <device.h> #include <device.h>
#include <dma.h> #include <dma.h>
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_DMA_LEVEL #if defined(CONFIG_STDOUT_CONSOLE)
#include <misc/sys_log.h> #include <stdio.h>
#define DBG printf
#else
#include <misc/printk.h>
#define DBG printk
#endif
#include <string.h> #include <string.h>
@ -61,7 +66,7 @@ static void test_transfer(struct device *dev, void *data)
static void test_error(struct device *dev, void *data) static void test_error(struct device *dev, void *data)
{ {
SYS_LOG_ERR("DMA could not proceed, an error occurred"); DBG("DMA could not proceed, an error occurred\n");
} }
void main(void) void main(void)
@ -73,13 +78,12 @@ void main(void)
struct dma_channel_config dma_chan_cfg = {0}; struct dma_channel_config dma_chan_cfg = {0};
struct dma_transfer_config dma_trans = {0}; struct dma_transfer_config dma_trans = {0};
SYS_LOG_DBG("DMA memory to memory transfer started on %s", DBG("DMA memory to memory transfer started on %s\n", DMA_DEVICE_NAME);
DMA_DEVICE_NAME); DBG("Preparing DMA Controller\n");
SYS_LOG_DBG("Preparing DMA Controller");
dma = device_get_binding(DMA_DEVICE_NAME); dma = device_get_binding(DMA_DEVICE_NAME);
if (!dma) { if (!dma) {
SYS_LOG_ERR("Cannot get dma controller"); DBG("Cannot get dma controller\n");
return; return;
} }
@ -95,22 +99,22 @@ void main(void)
dma_chan_cfg.callback_data = (void *)&chan_id; dma_chan_cfg.callback_data = (void *)&chan_id;
if (dma_channel_config(dma, chan_id, &dma_chan_cfg)) { if (dma_channel_config(dma, chan_id, &dma_chan_cfg)) {
SYS_LOG_ERR("configuration"); DBG("Error: configuration\n");
return; return;
} }
SYS_LOG_DBG("Starting the transfer and waiting for 1 second"); DBG("Starting the transfer and waiting for 1 second\n");
dma_trans.block_size = strlen(tx_data); dma_trans.block_size = strlen(tx_data);
dma_trans.source_address = (uint32_t *)tx_data; dma_trans.source_address = (uint32_t *)tx_data;
dma_trans.destination_address = (uint32_t *)rx_data[transfer_count]; dma_trans.destination_address = (uint32_t *)rx_data[transfer_count];
if (dma_transfer_config(dma, chan_id, &dma_trans)) { if (dma_transfer_config(dma, chan_id, &dma_trans)) {
SYS_LOG_ERR("transfer"); DBG("ERROR: transfer\n");
return; return;
} }
if (dma_transfer_start(dma, chan_id)) { if (dma_transfer_start(dma, chan_id)) {
SYS_LOG_ERR("transfer"); DBG("ERROR: transfer\n");
return; return;
} }
@ -120,18 +124,18 @@ void main(void)
if (transfer_count < TRANSFER_LOOPS) { if (transfer_count < TRANSFER_LOOPS) {
transfer_count = TRANSFER_LOOPS; transfer_count = TRANSFER_LOOPS;
SYS_LOG_ERR("unfinished transfer"); DBG("ERROR: unfinished transfer\n");
if (dma_transfer_stop(dma, chan_id)) { if (dma_transfer_stop(dma, chan_id)) {
SYS_LOG_ERR("transfer stop"); DBG("ERROR: transfer stop\n");
} }
} }
SYS_LOG_DBG("Each RX buffer should contain the full TX buffer string."); DBG("Each RX buffer should contain the full TX buffer string.\n");
SYS_LOG_DBG("TX data: %s", tx_data); DBG("TX data: %s\n", tx_data);
for (int i = 0; i < TRANSFER_LOOPS; i++) { for (int i = 0; i < TRANSFER_LOOPS; i++) {
SYS_LOG_DBG("RX data Loop %d: %s", i, rx_data[i]); DBG("RX data Loop %d: %s\n", i, rx_data[i]);
} }
SYS_LOG_INF("Finished: DMA"); DBG("Finished: DMA\n");
} }