27
27
#include "os-posix.h"
28
28
#include "bsp-impl.h"
29
29
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>
36
30
#include <sched.h>
37
31
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
+
38
37
/*
39
38
* Defines
40
39
*/
@@ -95,7 +94,7 @@ typedef struct
95
94
96
95
typedef struct
97
96
{
98
- mac_sem2_t id ;
97
+ sem_t id ;
99
98
}OS_impl_countsem_internal_record_t ;
100
99
101
100
/* Mutexes */
@@ -108,7 +107,7 @@ typedef struct
108
107
typedef struct
109
108
{
110
109
bool is_async ;
111
- mac_sem2_t data_sem ;
110
+ sem_t data_sem ;
112
111
int out_fd ;
113
112
}OS_impl_console_internal_record_t ;
114
113
@@ -1821,7 +1820,7 @@ int32 OS_CountSemCreate_Impl (uint32 sem_id, uint32 sem_initial_value, uint32 op
1821
1820
return OS_INVALID_SEM_VALUE ;
1822
1821
}
1823
1822
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 )
1825
1824
{
1826
1825
return OS_SEM_FAILURE ;
1827
1826
}
@@ -1841,7 +1840,7 @@ int32 OS_CountSemCreate_Impl (uint32 sem_id, uint32 sem_initial_value, uint32 op
1841
1840
*-----------------------------------------------------------------*/
1842
1841
int32 OS_CountSemDelete_Impl (uint32 sem_id )
1843
1842
{
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 )
1845
1844
{
1846
1845
return OS_SEM_FAILURE ;
1847
1846
}
@@ -1861,7 +1860,7 @@ int32 OS_CountSemDelete_Impl (uint32 sem_id)
1861
1860
*-----------------------------------------------------------------*/
1862
1861
int32 OS_CountSemGive_Impl ( uint32 sem_id )
1863
1862
{
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 )
1865
1864
{
1866
1865
return OS_SEM_FAILURE ;
1867
1866
}
@@ -1881,7 +1880,7 @@ int32 OS_CountSemGive_Impl ( uint32 sem_id )
1881
1880
*-----------------------------------------------------------------*/
1882
1881
int32 OS_CountSemTake_Impl ( uint32 sem_id )
1883
1882
{
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 )
1885
1884
{
1886
1885
return OS_SEM_FAILURE ;
1887
1886
}
@@ -1908,7 +1907,7 @@ int32 OS_CountSemTimedWait_Impl ( uint32 sem_id, uint32 msecs )
1908
1907
*/
1909
1908
OS_CompAbsDelayTime (msecs , & ts );
1910
1909
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 )
1912
1911
{
1913
1912
result = OS_SUCCESS ;
1914
1913
}
@@ -1938,7 +1937,7 @@ int32 OS_CountSemGetInfo_Impl (uint32 sem_id, OS_count_sem_prop_t *count_prop)
1938
1937
{
1939
1938
int sval ;
1940
1939
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 )
1942
1941
{
1943
1942
return OS_SEM_FAILURE ;
1944
1943
}
@@ -2414,7 +2413,7 @@ void OS_ConsoleWakeup_Impl(uint32 local_id)
2414
2413
if (local -> is_async )
2415
2414
{
2416
2415
/* post the sem for the utility task to run */
2417
- mac_sem2_debug_post (& local -> data_sem );
2416
+ sem_post (& local -> data_sem );
2418
2417
}
2419
2418
else
2420
2419
{
@@ -2441,7 +2440,7 @@ static void* OS_ConsoleTask_Entry(void* arg)
2441
2440
while (true)
2442
2441
{
2443
2442
OS_ConsoleOutput_Impl (local_arg .value );
2444
- mac_sem2_debug_wait (& local -> data_sem );
2443
+ sem_wait (& local -> data_sem );
2445
2444
}
2446
2445
return NULL ;
2447
2446
} /* end OS_ConsoleTask_Entry */
@@ -2469,7 +2468,7 @@ int32 OS_ConsoleCreate_Impl(uint32 local_id)
2469
2468
2470
2469
if (local -> is_async )
2471
2470
{
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 )
2473
2472
{
2474
2473
return_code = OS_SEM_FAILURE ;
2475
2474
}
@@ -2481,7 +2480,7 @@ int32 OS_ConsoleCreate_Impl(uint32 local_id)
2481
2480
2482
2481
if (return_code != OS_SUCCESS )
2483
2482
{
2484
- mac_sem2_debug_destroy (& OS_impl_console_table [local_id ].data_sem );
2483
+ sem_destroy (& OS_impl_console_table [local_id ].data_sem );
2485
2484
}
2486
2485
}
2487
2486
}
0 commit comments