2727#include "os-posix.h"
2828#include "bsp-impl.h"
2929
30- #include <posix-mac-time.h>
31- #include <posix-mac-semaphore2-debug.h>
32- #include <posix-mac-stubs.h>
33- #include <posix-mac-pthread.h>
34-
35- #include <assert.h>
3630#include <sched.h>
3731
32+ #include <posix-macos-time.h>
33+ #include <posix-macos-semaphore2-debug.h>
34+ #include <posix-macos-stubs.h>
35+ #include <posix-macos-pthread.h>
36+
3837/*
3938 * Defines
4039 */
@@ -95,7 +94,7 @@ typedef struct
9594
9695typedef struct
9796{
98- mac_sem2_t id ;
97+ sem_t id ;
9998}OS_impl_countsem_internal_record_t ;
10099
101100/* Mutexes */
@@ -108,7 +107,7 @@ typedef struct
108107typedef struct
109108{
110109 bool is_async ;
111- mac_sem2_t data_sem ;
110+ sem_t data_sem ;
112111 int out_fd ;
113112}OS_impl_console_internal_record_t ;
114113
@@ -1821,7 +1820,7 @@ int32 OS_CountSemCreate_Impl (uint32 sem_id, uint32 sem_initial_value, uint32 op
18211820 return OS_INVALID_SEM_VALUE ;
18221821 }
18231822
1824- if (mac_sem2_debug_init (& OS_impl_count_sem_table [sem_id ].id , 0 , sem_initial_value ) < 0 )
1823+ if (sem_init (& OS_impl_count_sem_table [sem_id ].id , 0 , sem_initial_value ) < 0 )
18251824 {
18261825 return OS_SEM_FAILURE ;
18271826 }
@@ -1841,7 +1840,7 @@ int32 OS_CountSemCreate_Impl (uint32 sem_id, uint32 sem_initial_value, uint32 op
18411840 *-----------------------------------------------------------------*/
18421841int32 OS_CountSemDelete_Impl (uint32 sem_id )
18431842{
1844- if (mac_sem2_debug_destroy (& OS_impl_count_sem_table [sem_id ].id ) < 0 )
1843+ if (sem_destroy (& OS_impl_count_sem_table [sem_id ].id ) < 0 )
18451844 {
18461845 return OS_SEM_FAILURE ;
18471846 }
@@ -1861,7 +1860,7 @@ int32 OS_CountSemDelete_Impl (uint32 sem_id)
18611860 *-----------------------------------------------------------------*/
18621861int32 OS_CountSemGive_Impl ( uint32 sem_id )
18631862{
1864- if (mac_sem2_debug_post (& OS_impl_count_sem_table [sem_id ].id ) < 0 )
1863+ if (sem_post (& OS_impl_count_sem_table [sem_id ].id ) < 0 )
18651864 {
18661865 return OS_SEM_FAILURE ;
18671866 }
@@ -1881,7 +1880,7 @@ int32 OS_CountSemGive_Impl ( uint32 sem_id )
18811880 *-----------------------------------------------------------------*/
18821881int32 OS_CountSemTake_Impl ( uint32 sem_id )
18831882{
1884- if (mac_sem2_debug_wait (& OS_impl_count_sem_table [sem_id ].id ) < 0 )
1883+ if (sem_wait (& OS_impl_count_sem_table [sem_id ].id ) < 0 )
18851884 {
18861885 return OS_SEM_FAILURE ;
18871886 }
@@ -1908,7 +1907,7 @@ int32 OS_CountSemTimedWait_Impl ( uint32 sem_id, uint32 msecs )
19081907 */
19091908 OS_CompAbsDelayTime (msecs , & ts );
19101909
1911- if (mac_sem2_debug_timedwait (& OS_impl_count_sem_table [sem_id ].id , & ts ) == 0 )
1910+ if (sem_timedwait (& OS_impl_count_sem_table [sem_id ].id , & ts ) == 0 )
19121911 {
19131912 result = OS_SUCCESS ;
19141913 }
@@ -1938,7 +1937,7 @@ int32 OS_CountSemGetInfo_Impl (uint32 sem_id, OS_count_sem_prop_t *count_prop)
19381937{
19391938 int sval ;
19401939
1941- if (mac_sem2_debug_getvalue (& OS_impl_count_sem_table [sem_id ].id , & sval ) < 0 )
1940+ if (sem_getvalue (& OS_impl_count_sem_table [sem_id ].id , & sval ) < 0 )
19421941 {
19431942 return OS_SEM_FAILURE ;
19441943 }
@@ -2414,7 +2413,7 @@ void OS_ConsoleWakeup_Impl(uint32 local_id)
24142413 if (local -> is_async )
24152414 {
24162415 /* post the sem for the utility task to run */
2417- mac_sem2_debug_post (& local -> data_sem );
2416+ sem_post (& local -> data_sem );
24182417 }
24192418 else
24202419 {
@@ -2441,7 +2440,7 @@ static void* OS_ConsoleTask_Entry(void* arg)
24412440 while (true)
24422441 {
24432442 OS_ConsoleOutput_Impl (local_arg .value );
2444- mac_sem2_debug_wait (& local -> data_sem );
2443+ sem_wait (& local -> data_sem );
24452444 }
24462445 return NULL ;
24472446} /* end OS_ConsoleTask_Entry */
@@ -2469,7 +2468,7 @@ int32 OS_ConsoleCreate_Impl(uint32 local_id)
24692468
24702469 if (local -> is_async )
24712470 {
2472- if (mac_sem2_debug_init (& OS_impl_console_table [local_id ].data_sem , 0 , 0 ) < 0 )
2471+ if (sem_init (& OS_impl_console_table [local_id ].data_sem , 0 , 0 ) < 0 )
24732472 {
24742473 return_code = OS_SEM_FAILURE ;
24752474 }
@@ -2481,7 +2480,7 @@ int32 OS_ConsoleCreate_Impl(uint32 local_id)
24812480
24822481 if (return_code != OS_SUCCESS )
24832482 {
2484- mac_sem2_debug_destroy (& OS_impl_console_table [local_id ].data_sem );
2483+ sem_destroy (& OS_impl_console_table [local_id ].data_sem );
24852484 }
24862485 }
24872486 }
0 commit comments