diff --git a/StateOS/kernel/inc/oseventqueue.h b/StateOS/kernel/inc/oseventqueue.h index 785a2f66..ea2e90f7 100644 --- a/StateOS/kernel/inc/oseventqueue.h +++ b/StateOS/kernel/inc/oseventqueue.h @@ -2,7 +2,7 @@ @file StateOS: oseventqueue.h @author Rajmund Szymanski - @date 17.11.2018 + @date 19.11.2018 @brief This file contains definitions for StateOS. ****************************************************************************** @@ -109,10 +109,10 @@ struct __evq * ******************************************************************************/ -#define OS_EVQ( evq, limit ) \ - unsigned evq##__buf[limit]; \ - evq_t evq##__evq = _EVQ_INIT( limit, evq##__buf ); \ - evq_id evq = & evq##__evq +#define OS_EVQ( evq, limit ) \ + struct { evq_t evq; unsigned buf[limit]; } evq##__wrk = \ + { _EVQ_INIT( limit, evq##__wrk.buf ), { 0 } }; \ + evq_id evq = & evq##__wrk.evq /****************************************************************************** * @@ -126,10 +126,10 @@ struct __evq * ******************************************************************************/ -#define static_EVQ( evq, limit ) \ - static unsigned evq##__buf[limit]; \ - static evq_t evq##__evq = _EVQ_INIT( limit, evq##__buf ); \ - static evq_id evq = & evq##__evq +#define static_EVQ( evq, limit ) \ + static struct { evq_t evq; unsigned buf[limit]; } evq##__wrk = \ + { _EVQ_INIT( limit, evq##__wrk.buf ), { 0 } }; \ + static evq_id evq = & evq##__wrk.evq /****************************************************************************** * diff --git a/StateOS/kernel/inc/osjobqueue.h b/StateOS/kernel/inc/osjobqueue.h index cb0e451a..bf86e4ac 100644 --- a/StateOS/kernel/inc/osjobqueue.h +++ b/StateOS/kernel/inc/osjobqueue.h @@ -2,7 +2,7 @@ @file StateOS: osjobqueue.h @author Rajmund Szymanski - @date 17.11.2018 + @date 19.11.2018 @brief This file contains definitions for StateOS. ****************************************************************************** @@ -110,10 +110,10 @@ struct __job * ******************************************************************************/ -#define OS_JOB( job, limit ) \ - fun_t *job##__buf[limit]; \ - job_t job##__job = _JOB_INIT( limit, job##__buf ); \ - job_id job = & job##__job +#define OS_JOB( job, limit ) \ + struct { job_t job; fun_t *buf[limit]; } job##__wrk = \ + { _JOB_INIT( limit, job##__wrk.buf ), { 0 } }; \ + job_id job = & job##__wrk.job /****************************************************************************** * @@ -127,10 +127,10 @@ struct __job * ******************************************************************************/ -#define static_JOB( job, limit ) \ - static fun_t *job##__buf[limit]; \ - static job_t job##__job = _JOB_INIT( limit, job##__buf ); \ - static job_id job = & job##__job +#define static_JOB( job, limit ) \ + static struct { job_t job; fun_t *buf[limit]; } job##__wrk = \ + { _JOB_INIT( limit, job##__wrk.buf ), { 0 } }; \ + static job_id job = & job##__wrk.job /****************************************************************************** * diff --git a/StateOS/kernel/inc/osmailboxqueue.h b/StateOS/kernel/inc/osmailboxqueue.h index 3c565a1d..a2466311 100644 --- a/StateOS/kernel/inc/osmailboxqueue.h +++ b/StateOS/kernel/inc/osmailboxqueue.h @@ -2,7 +2,7 @@ @file StateOS: osmailboxqueue.h @author Rajmund Szymanski - @date 17.11.2018 + @date 19.11.2018 @brief This file contains definitions for StateOS. ****************************************************************************** @@ -113,10 +113,10 @@ struct __box * ******************************************************************************/ -#define OS_BOX( box, limit, size ) \ - char box##__buf[limit*size]; \ - box_t box##__box = _BOX_INIT( limit, size, box##__buf ); \ - box_id box = & box##__box +#define OS_BOX( box, limit, size ) \ + struct { box_t box; char buf[limit * size]; } box##__wrk = \ + { _BOX_INIT( limit, size, box##__wrk.buf ), { 0 } }; \ + box_id box = & box##__wrk.box /****************************************************************************** * @@ -131,10 +131,10 @@ struct __box * ******************************************************************************/ -#define static_BOX( box, limit, size ) \ - static char box##__buf[limit*size]; \ - static box_t box##__box = _BOX_INIT( limit, size, box##__buf ); \ - static box_id box = & box##__box +#define static_BOX( box, limit, size ) \ + static struct { box_t box; char buf[limit * size]; } box##__wrk = \ + { _BOX_INIT( limit, size, box##__wrk.buf ), { 0 } }; \ + static box_id box = & box##__wrk.box /****************************************************************************** * diff --git a/StateOS/kernel/inc/osmemorypool.h b/StateOS/kernel/inc/osmemorypool.h index 1a0d546e..d8991235 100644 --- a/StateOS/kernel/inc/osmemorypool.h +++ b/StateOS/kernel/inc/osmemorypool.h @@ -2,7 +2,7 @@ @file StateOS: osmemorypool.h @author Rajmund Szymanski - @date 17.11.2018 + @date 19.11.2018 @brief This file contains definitions for StateOS. ****************************************************************************** @@ -115,10 +115,10 @@ struct __mem * ******************************************************************************/ -#define OS_MEM( mem, limit, size ) \ - que_t mem##__buf[limit * (1 + MEM_SIZE(size))]; \ - mem_t mem##__mem = _MEM_INIT( limit, MEM_SIZE(size), mem##__buf ); \ - mem_id mem = & mem##__mem +#define OS_MEM( mem, limit, size ) \ + struct { mem_t mem; que_t buf[limit * (1 + MEM_SIZE(size))]; } mem##__wrk = \ + { _MEM_INIT( limit, MEM_SIZE(size), mem##__wrk.buf ), { { 0 } } }; \ + mem_id mem = & mem##__wrk.mem /****************************************************************************** * @@ -133,10 +133,10 @@ struct __mem * ******************************************************************************/ -#define static_MEM( mem, limit, size ) \ - static que_t mem##__buf[limit * (1 + MEM_SIZE(size))]; \ - static mem_t mem##__mem = _MEM_INIT( limit, MEM_SIZE(size), mem##__buf ); \ - static mem_id mem = & mem##__mem +#define static_MEM( mem, limit, size ) \ + static struct { mem_t mem; que_t buf[limit * (1 + MEM_SIZE(size))]; } mem##__wrk = \ + { _MEM_INIT( limit, MEM_SIZE(size), mem##__wrk.buf ), { { 0 } } }; \ + static mem_id mem = & mem##__wrk.mem /****************************************************************************** * diff --git a/StateOS/kernel/inc/osmessagebuffer.h b/StateOS/kernel/inc/osmessagebuffer.h index 290dcdd5..6029ac96 100644 --- a/StateOS/kernel/inc/osmessagebuffer.h +++ b/StateOS/kernel/inc/osmessagebuffer.h @@ -2,7 +2,7 @@ @file StateOS: osmessagebuffer.h @author Rajmund Szymanski - @date 17.11.2018 + @date 19.11.2018 @brief This file contains definitions for StateOS. ****************************************************************************** @@ -122,10 +122,10 @@ struct __msg * ******************************************************************************/ -#define OS_MSG( msg, limit, ... ) \ - char msg##__buf[_VA_MSG(limit, __VA_ARGS__)]; \ - msg_t msg##__msg = _MSG_INIT( _VA_MSG(limit, __VA_ARGS__), msg##__buf ); \ - msg_id msg = & msg##__msg +#define OS_MSG( msg, limit, ... ) \ + struct { msg_t msg; char buf[_VA_MSG(limit, __VA_ARGS__)]; } msg##__wrk = \ + { _MSG_INIT( _VA_MSG(limit, __VA_ARGS__), msg##__wrk.buf ), { 0 } }; \ + msg_id msg = & msg##__wrk.msg /****************************************************************************** * @@ -140,10 +140,10 @@ struct __msg * ******************************************************************************/ -#define static_MSG( msg, limit, ... ) \ - static char msg##__buf[_VA_MSG(limit, __VA_ARGS__)]; \ - static msg_t msg##__msg = _MSG_INIT( _VA_MSG(limit, __VA_ARGS__), msg##__buf ); \ - static msg_id msg = & msg##__msg +#define static_MSG( msg, limit, ... ) \ + static struct { msg_t msg; char buf[_VA_MSG(limit, __VA_ARGS__)]; } msg##__wrk = \ + { _MSG_INIT( _VA_MSG(limit, __VA_ARGS__), msg##__wrk.buf ), { 0 } }; \ + static msg_id msg = & msg##__wrk.msg /****************************************************************************** * diff --git a/StateOS/kernel/inc/osstreambuffer.h b/StateOS/kernel/inc/osstreambuffer.h index f8341549..bcbfc73f 100644 --- a/StateOS/kernel/inc/osstreambuffer.h +++ b/StateOS/kernel/inc/osstreambuffer.h @@ -2,7 +2,7 @@ @file StateOS: osstreambuffer.h @author Rajmund Szymanski - @date 17.11.2018 + @date 19.11.2018 @brief This file contains definitions for StateOS. ****************************************************************************** @@ -122,10 +122,10 @@ struct __stm * ******************************************************************************/ -#define OS_STM( stm, limit, ... ) \ - char stm##__buf[_VA_STM(limit, __VA_ARGS__)]; \ - stm_t stm##__stm = _STM_INIT( _VA_STM(limit, __VA_ARGS__), stm##__buf ); \ - stm_id stm = & stm##__stm +#define OS_STM( stm, limit, ... ) \ + struct { stm_t stm; char buf[_VA_STM(limit, __VA_ARGS__)]; } stm##__wrk = \ + { _STM_INIT( _VA_STM(limit, __VA_ARGS__), stm##__wrk.buf ), { 0 } }; \ + stm_id stm = & stm##__wrk.stm /****************************************************************************** * @@ -140,10 +140,10 @@ struct __stm * ******************************************************************************/ -#define static_STM( stm, limit, ... ) \ - static char stm##__buf[_VA_STM(limit, __VA_ARGS__)]; \ - static stm_t stm##__stm = _STM_INIT( _VA_STM(limit, __VA_ARGS__), stm##__buf ); \ - static stm_id stm = & stm##__stm +#define static_STM( stm, limit, ... ) \ + static struct { stm_t stm; char buf[_VA_STM(limit, __VA_ARGS__)]; } stm##__wrk = \ + { _STM_INIT( _VA_STM(limit, __VA_ARGS__), stm##__wrk.buf ), { 0 } }; \ + static stm_id stm = & stm##__wrk.stm /****************************************************************************** * diff --git a/StateOS/kernel/inc/ostask.h b/StateOS/kernel/inc/ostask.h index 4d42797b..51eb96bb 100644 --- a/StateOS/kernel/inc/ostask.h +++ b/StateOS/kernel/inc/ostask.h @@ -2,7 +2,7 @@ @file StateOS: ostask.h @author Rajmund Szymanski - @date 17.11.2018 + @date 19.11.2018 @brief This file contains definitions for StateOS. ****************************************************************************** @@ -275,10 +275,10 @@ struct __tsk * ******************************************************************************/ -#define OS_WRK( tsk, prio, state, size ) \ - stk_t tsk##__stk[STK_SIZE( size )]; \ - tsk_t tsk##__tsk = _TSK_INIT( prio, state, tsk##__stk, size ); \ - tsk_id tsk = & tsk##__tsk +#define OS_WRK( tsk, prio, state, size ) \ + struct { tsk_t tsk; stk_t buf[STK_SIZE( size )]; } tsk##__wrk = \ + { _TSK_INIT( prio, state, tsk##__wrk.buf, size ), { 0 } }; \ + tsk_id tsk = & tsk##__wrk.tsk /****************************************************************************** * @@ -390,10 +390,10 @@ struct __tsk * ******************************************************************************/ -#define static_WRK( tsk, prio, state, size ) \ - static stk_t tsk##__stk[STK_SIZE( size )]; \ - static tsk_t tsk##__tsk = _TSK_INIT( prio, state, tsk##__stk, size ); \ - static tsk_id tsk = & tsk##__tsk +#define static_WRK( tsk, prio, state, size ) \ + static struct { tsk_t tsk; stk_t buf[STK_SIZE( size )]; } tsk##__wrk = \ + { _TSK_INIT( prio, state, tsk##__wrk.buf, size ), { 0 } }; \ + static tsk_id tsk = & tsk##__wrk.tsk /****************************************************************************** *