Revert "misc: Remove generic PRINT macros from synch samples"

This reverts commit f352ca1e05.

Change-Id: Iebefa150449785c00a1b2cc7e3446fba3495cd03
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-08-23 13:14:16 -07:00
parent 7f09bef9da
commit b8a27f30fe
6 changed files with 30 additions and 19 deletions

View file

@ -1,3 +1,2 @@
CONFIG_COMPILER_OPT="-O0"
CONFIG_CPLUSPLUS=y
CONFIG_SYS_LOG=y

View file

@ -18,8 +18,13 @@
* @file C++ Synchronization demo. Uses basic C++ functionality.
*/
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
#include <misc/sys_log.h>
#if defined(CONFIG_STDOUT_CONSOLE)
#include <stdio.h>
#define PRINT printf
#else
#include <misc/printk.h>
#define PRINT printk
#endif
/**
* @class semaphore the basic pure virtual semaphore class
@ -70,7 +75,7 @@ public:
*/
task_semaphore::task_semaphore(): _sema_internal(__K_SEMAPHORE_DEFAULT)
{
SYS_LOG_INF("Create semaphore %p", this);
PRINT("Create semaphore %p\n", this);
sema = (ksem_t)&_sema_internal;
}
@ -130,7 +135,7 @@ void hello_loop(const char *taskname,
my_sem.wait();
/* say "hello" */
SYS_LOG_INF("%s: Hello World!", taskname);
PRINT("%s: Hello World!\n", taskname);
/* wait a while, then let other task have a turn */
task_sleep(SLEEPTICKS);
@ -195,7 +200,7 @@ public:
*/
nano_semaphore::nano_semaphore()
{
SYS_LOG_INF("Create semaphore %p", this);
PRINT("Create semaphore %p\n", this);
nano_sem_init(&_sema_internal);
}
@ -258,7 +263,7 @@ void fiber_entry(void)
nano_sem_fiber.wait();
/* say "hello" */
SYS_LOG_INF("Hello World!");
PRINT("%s: Hello World!\n", __FUNCTION__);
/* wait a while, then let task have a turn */
nano_fiber_timer_start(&timer, SLEEPTICKS);
@ -279,7 +284,7 @@ void main(void)
while (1) {
/* say "hello" */
SYS_LOG_INF("Hello World!");
PRINT("%s: Hello World!\n", __FUNCTION__);
/* wait a while, then let fiber have a turn */
nano_task_timer_start(&timer, SLEEPTICKS);

View file

@ -1,2 +1 @@
CONFIG_STDOUT_CONSOLE=y
CONFIG_SYS_LOG=y

View file

@ -18,9 +18,13 @@
#include <zephyr.h>
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
#include <misc/sys_log.h>
#if defined(CONFIG_STDOUT_CONSOLE)
#include <stdio.h>
#define PRINT printf
#else
#include <misc/printk.h>
#define PRINT printk
#endif
/*
* Microkernel version of hello world demo has two tasks that utilize
@ -47,8 +51,7 @@ void helloLoop(const char *taskname, ksem_t mySem, ksem_t otherSem)
task_sem_take(mySem, TICKS_UNLIMITED);
/* say "hello" */
SYS_LOG_INF("%s: Hello World from %s!",
taskname, CONFIG_ARCH);
PRINT("%s: Hello World from %s!\n", taskname, CONFIG_ARCH);
/* wait a while, then let other task have a turn */
task_sleep(SLEEPTICKS);

View file

@ -1,2 +1 @@
CONFIG_STDOUT_CONSOLE=y
CONFIG_SYS_LOG=y

View file

@ -18,8 +18,14 @@
#include <zephyr.h>
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
#include <misc/sys_log.h>
#if defined(CONFIG_STDOUT_CONSOLE)
#include <stdio.h>
#define PRINT printf
#else
#include <misc/printk.h>
#define PRINT printk
#endif
/*
* Nanokernel version of hello world demo has a task and a fiber that utilize
@ -53,7 +59,7 @@ void fiberEntry(void)
nano_fiber_sem_take(&nanoSemFiber, TICKS_UNLIMITED);
/* say "hello" */
SYS_LOG_INF("Hello World!");
PRINT("%s: Hello World!\n", __func__);
/* wait a while, then let task have a turn */
nano_fiber_timer_start(&timer, SLEEPTICKS);
@ -75,7 +81,7 @@ void main(void)
while (1) {
/* say "hello" */
SYS_LOG_INF("Hello World!");
PRINT("%s: Hello World!\n", __func__);
/* wait a while, then let fiber have a turn */
nano_task_timer_start(&timer, SLEEPTICKS);