Skip to content

Commit b8a27f3

Browse files
author
Andrew Boie
committed
Revert "misc: Remove generic PRINT macros from synch samples"
This reverts commit f352ca1. Change-Id: Iebefa150449785c00a1b2cc7e3446fba3495cd03 Signed-off-by: Andrew Boie <[email protected]>
1 parent 7f09bef commit b8a27f3

File tree

6 files changed

+30
-19
lines changed

6 files changed

+30
-19
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
CONFIG_COMPILER_OPT="-O0"
22
CONFIG_CPLUSPLUS=y
3-
CONFIG_SYS_LOG=y

samples/cpp_synchronization/microkernel/src/main.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818
* @file C++ Synchronization demo. Uses basic C++ functionality.
1919
*/
2020

21-
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
22-
#include <misc/sys_log.h>
21+
#if defined(CONFIG_STDOUT_CONSOLE)
22+
#include <stdio.h>
23+
#define PRINT printf
24+
#else
25+
#include <misc/printk.h>
26+
#define PRINT printk
27+
#endif
2328

2429
/**
2530
* @class semaphore the basic pure virtual semaphore class
@@ -70,7 +75,7 @@ class task_semaphore: public semaphore {
7075
*/
7176
task_semaphore::task_semaphore(): _sema_internal(__K_SEMAPHORE_DEFAULT)
7277
{
73-
SYS_LOG_INF("Create semaphore %p", this);
78+
PRINT("Create semaphore %p\n", this);
7479
sema = (ksem_t)&_sema_internal;
7580
}
7681

@@ -130,7 +135,7 @@ void hello_loop(const char *taskname,
130135
my_sem.wait();
131136

132137
/* say "hello" */
133-
SYS_LOG_INF("%s: Hello World!", taskname);
138+
PRINT("%s: Hello World!\n", taskname);
134139

135140
/* wait a while, then let other task have a turn */
136141
task_sleep(SLEEPTICKS);
@@ -195,7 +200,7 @@ class nano_semaphore: public semaphore {
195200
*/
196201
nano_semaphore::nano_semaphore()
197202
{
198-
SYS_LOG_INF("Create semaphore %p", this);
203+
PRINT("Create semaphore %p\n", this);
199204
nano_sem_init(&_sema_internal);
200205
}
201206

@@ -258,7 +263,7 @@ void fiber_entry(void)
258263
nano_sem_fiber.wait();
259264

260265
/* say "hello" */
261-
SYS_LOG_INF("Hello World!");
266+
PRINT("%s: Hello World!\n", __FUNCTION__);
262267

263268
/* wait a while, then let task have a turn */
264269
nano_fiber_timer_start(&timer, SLEEPTICKS);
@@ -279,7 +284,7 @@ void main(void)
279284

280285
while (1) {
281286
/* say "hello" */
282-
SYS_LOG_INF("Hello World!");
287+
PRINT("%s: Hello World!\n", __FUNCTION__);
283288

284289
/* wait a while, then let fiber have a turn */
285290
nano_task_timer_start(&timer, SLEEPTICKS);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
CONFIG_STDOUT_CONSOLE=y
2-
CONFIG_SYS_LOG=y

samples/synchronization/microkernel/src/main.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818

1919
#include <zephyr.h>
2020

21-
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
22-
#include <misc/sys_log.h>
23-
21+
#if defined(CONFIG_STDOUT_CONSOLE)
22+
#include <stdio.h>
23+
#define PRINT printf
24+
#else
25+
#include <misc/printk.h>
26+
#define PRINT printk
27+
#endif
2428

2529
/*
2630
* 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)
4751
task_sem_take(mySem, TICKS_UNLIMITED);
4852

4953
/* say "hello" */
50-
SYS_LOG_INF("%s: Hello World from %s!",
51-
taskname, CONFIG_ARCH);
54+
PRINT("%s: Hello World from %s!\n", taskname, CONFIG_ARCH);
5255

5356
/* wait a while, then let other task have a turn */
5457
task_sleep(SLEEPTICKS);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
CONFIG_STDOUT_CONSOLE=y
2-
CONFIG_SYS_LOG=y

samples/synchronization/nanokernel/src/main.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@
1818

1919
#include <zephyr.h>
2020

21-
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
22-
#include <misc/sys_log.h>
21+
#if defined(CONFIG_STDOUT_CONSOLE)
22+
#include <stdio.h>
23+
#define PRINT printf
24+
#else
25+
#include <misc/printk.h>
26+
#define PRINT printk
27+
#endif
28+
2329

2430
/*
2531
* Nanokernel version of hello world demo has a task and a fiber that utilize
@@ -53,7 +59,7 @@ void fiberEntry(void)
5359
nano_fiber_sem_take(&nanoSemFiber, TICKS_UNLIMITED);
5460

5561
/* say "hello" */
56-
SYS_LOG_INF("Hello World!");
62+
PRINT("%s: Hello World!\n", __func__);
5763

5864
/* wait a while, then let task have a turn */
5965
nano_fiber_timer_start(&timer, SLEEPTICKS);
@@ -75,7 +81,7 @@ void main(void)
7581

7682
while (1) {
7783
/* say "hello" */
78-
SYS_LOG_INF("Hello World!");
84+
PRINT("%s: Hello World!\n", __func__);
7985

8086
/* wait a while, then let fiber have a turn */
8187
nano_task_timer_start(&timer, SLEEPTICKS);

0 commit comments

Comments
 (0)