File tree Expand file tree Collapse file tree 5 files changed +26
-18
lines changed Expand file tree Collapse file tree 5 files changed +26
-18
lines changed Original file line number Diff line number Diff line change 22
33 @file IntrOS: os_bar.c
44 @author Rajmund Szymanski
5- @date 27.02 .2017
5+ @date 20.03 .2017
66 @brief This file provides set of functions for IntrOS.
77
88 ******************************************************************************
@@ -36,18 +36,19 @@ void bar_wait( bar_t *bar )
3636
3737 assert (bar );
3838
39- bar -> count -- ;
39+ signal = bar -> signal ;
4040
41- if (bar -> count == 0 )
41+ port_sys_lock ();
42+
43+ if (-- bar -> count == 0 )
4244 {
4345 bar -> count = bar -> limit ;
4446 bar -> signal ++ ;
4547 }
46- else
47- {
48- signal = bar -> signal ;
49- while (bar -> signal == signal ) tsk_yield ();
50- }
48+
49+ port_sys_unlock ();
50+
51+ while (bar -> signal == signal ) tsk_yield ();
5152}
5253
5354/* -------------------------------------------------------------------------- */
Original file line number Diff line number Diff line change 22
33 @file IntrOS: os_cnd.c
44 @author Rajmund Szymanski
5- @date 27.02 .2017
5+ @date 20.03 .2017
66 @brief This file provides set of functions for IntrOS.
77
88 ******************************************************************************
@@ -40,7 +40,6 @@ void cnd_wait( cnd_t *cnd, mtx_t *mtx )
4040 mtx_give (mtx );
4141
4242 signal = cnd -> signal ;
43-
4443 while (cnd -> signal == signal ) tsk_yield ();
4544
4645 mtx_wait (mtx );
Original file line number Diff line number Diff line change 22
33 @file IntrOS: os_mtx.c
44 @author Rajmund Szymanski
5- @date 11.01 .2017
5+ @date 20.03 .2017
66 @brief This file provides set of functions for IntrOS.
77
88 ******************************************************************************
@@ -37,13 +37,17 @@ unsigned mtx_take( mtx_t *mtx )
3737 assert (mtx );
3838 assert (mtx -> owner != Current );
3939
40+ port_sys_lock ();
41+
4042 if (mtx -> owner == 0 )
4143 {
4244 mtx -> owner = Current ;
4345
4446 event = E_SUCCESS ;
4547 }
4648
49+ port_sys_unlock ();
50+
4751 return event ;
4852}
4953
@@ -62,13 +66,17 @@ unsigned mtx_give( mtx_t *mtx )
6266
6367 assert (mtx );
6468
69+ port_sys_lock ();
70+
6571 if (mtx -> owner == Current )
6672 {
6773 mtx -> owner = 0 ;
6874
6975 event = E_SUCCESS ;
7076 }
7177
78+ port_sys_unlock ();
79+
7280 return event ;
7381}
7482
Original file line number Diff line number Diff line change 22
33 @file IntrOS: oskernel.h
44 @author Rajmund Szymanski
5- @date 08 .03.2017
5+ @date 20 .03.2017
66 @brief This file defines set of kernel functions for IntrOS.
77
88 ******************************************************************************
@@ -42,6 +42,11 @@ extern sys_t System; // system data
4242
4343/* -------------------------------------------------------------------------- */
4444
45+ #define Counter System.cnt
46+ #define Current System.cur
47+
48+ /* -------------------------------------------------------------------------- */
49+
4550// initiating and running the system timer
4651// the port_sys_init procedure is normally called as a constructor
4752__CONSTRUCTOR
Original file line number Diff line number Diff line change 22
33 @file IntrOS: osport.h
44 @author Rajmund Szymanski
5- @date 24.01 .2017
5+ @date 20.03 .2017
66 @brief IntrOS port definitions for Cortex-Mx uC.
77
88 ******************************************************************************
@@ -44,11 +44,6 @@ extern "C" {
4444
4545/* -------------------------------------------------------------------------- */
4646
47- #define Counter System.cnt
48- #define Current System.cur
49-
50- /* -------------------------------------------------------------------------- */
51-
5247#ifndef CPU_FREQUENCY
5348#error osconfig.h: Undefined CPU_FREQUENCY value!
5449#endif
You can’t perform that action at this time.
0 commit comments