From f9503e7070946c4a960edc5b2e0b0cbde553950a Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Mon, 13 Nov 2017 13:15:19 +0100 Subject: [PATCH 1/4] Added typedef rb2_proxy_t --- core/include/rb2/proxy.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/include/rb2/proxy.h b/core/include/rb2/proxy.h index df8a21e..e5c3e7e 100755 --- a/core/include/rb2/proxy.h +++ b/core/include/rb2/proxy.h @@ -15,6 +15,8 @@ struct _rb2_proxy; typedef struct _rb2_proxy RB2_PROXY; +typedef struct _rb2_proxy rb2_proxy_t; + #define RB2_PROXY(ptr) ((RB2_PROXY*)(ptr)) From e44da28cfeee234df595bcd148297a0e2b719e12 Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Mon, 13 Nov 2017 13:15:37 +0100 Subject: [PATCH 2/4] Fixed usart module --- core/src/usart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/usart.c b/core/src/usart.c index af4bcb2..2a6bcb3 100644 --- a/core/src/usart.c +++ b/core/src/usart.c @@ -83,12 +83,13 @@ int usart_tx (uint8_t usart,char *b,int size){ for (n=0;n= 0){ - break; + return ESUCCESS; }; wait_ms(1); }; }; + return -EFAIL; }; -#endif \ No newline at end of file +#endif From 6291c813eceed3bcb3b7c44a556c06a48cbb146f Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Mon, 13 Nov 2017 13:15:54 +0100 Subject: [PATCH 3/4] fixed assert macro --- core/include/sys/assert.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/include/sys/assert.h b/core/include/sys/assert.h index a391217..bbb50d5 100644 --- a/core/include/sys/assert.h +++ b/core/include/sys/assert.h @@ -25,9 +25,8 @@ int32_t _assert_current_error(void); #define noassert(f) _noassert( (f), getPC() ) #else - #define assert2(f,p) (f) - #define assert(f) (f) + #define assert(f) { int r = (f); if (r<0) { return r; }; } #define noassert(f) (f) #define _assert_read() (0) From dc52340562ea0bc892309f27a6aa51525a297968 Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Tue, 21 Nov 2017 12:06:59 +0100 Subject: [PATCH 4/4] Add optional use of threading for runtime module (-DRUNTIME_USES_THREADING) --- core/include/sys/runtime.h | 10 ++++++---- core/src/runtime.c | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/core/include/sys/runtime.h b/core/include/sys/runtime.h index cae9fe2..807044b 100755 --- a/core/include/sys/runtime.h +++ b/core/include/sys/runtime.h @@ -9,8 +9,6 @@ #include - - #define ASSERT_BUFFER_LEN 8 #define RTA_USER0 0x01 @@ -101,9 +99,13 @@ struct rt_ram { uint32_t unix_timeoffset; unix_time_changing_t unix_time_changing; - + +#if !defined(RUNTIME_USES_THREADING) SYSTIMER *timer; - +#else + thread_t *rtThread; +#endif + systick_t secs_last; systick_t secs_current, secs_gone; diff --git a/core/src/runtime.c b/core/src/runtime.c index 35239c3..e1d87c7 100755 --- a/core/src/runtime.c +++ b/core/src/runtime.c @@ -11,17 +11,23 @@ * * @{ */ - - volatile struct rt_ram rt_ram; +volatile struct rt_ram rt_ram; /*! \brief Signal Thread. * */ void runtime_signal(void) { +#if !defined(RUNTIME_USES_THREADING) timer_start( rt_ram.timer, 1L ); +#else + thread_wake( rt_ram.rtThread ); +#endif }; + + + /*! \brief Runtime-Thread. * * Ermittelt Betriebsstunden des Geräts @@ -44,6 +50,23 @@ void runtime_cycle(void) rt_ram.secs_last = rt_ram.secs_current; }; + + +#if defined(RUNTIME_USES_THREADING) + +void runtime_thread(void* arg){ + + while (1){ + wait_ms( 10000l ); + runtime_cycle(); + }; + +}; + +#endif + + + /*! \brief Startet Runtime-Thread. * */ @@ -62,8 +85,16 @@ void runtime_start(int16_t bank) rt_ram.secs_last = systick_secs(); rt_ram.bank = bank; +#if !defined(RUNTIME_USES_THREADING) + rt_ram.timer = timer_create_ex( TIMERID_SYS_RUNTIME, 10000000L, runtime_cycle, TF_REPEAT); timer_start( rt_ram.timer, 0 ); + +#else + + thread_alloc( runtime_thread, NULL, 256 ); + +#endif };