File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 77#include <kernel_structs.h>
88#include <cmsis_os.h>
99
10- #define NSEC_PER_MSEC (NSEC_PER_USEC * USEC_PER_MSEC)
10+ #define NSEC_PER_MSEC (NSEC_PER_USEC * USEC_PER_MSEC)
11+ #define MAX_VALID_SIGNAL_VAL ((1 << osFeature_Signals) - 1)
1112
1213void * k_thread_other_custom_data_get (struct k_thread * thread_id )
1314{
@@ -22,7 +23,7 @@ int32_t osSignalSet(osThreadId thread_id, int32_t signals)
2223 int sig , key ;
2324
2425 if ((thread_id == NULL ) || (!signals ) ||
25- (signals >= ( 1 << ( osFeature_Signals + 1 )) )) {
26+ (signals & 0x80000000 ) || ( signals > MAX_VALID_SIGNAL_VAL )) {
2627 return 0x80000000 ;
2728 }
2829
@@ -48,7 +49,7 @@ int32_t osSignalClear(osThreadId thread_id, int32_t signals)
4849 int sig , key ;
4950
5051 if (_is_in_isr () || (thread_id == NULL ) || (!signals ) ||
51- (signals >= ( 1 << ( osFeature_Signals + 1 )) )) {
52+ (signals & 0x80000000 ) || ( signals > MAX_VALID_SIGNAL_VAL )) {
5253 return 0x80000000 ;
5354 }
5455
@@ -81,7 +82,7 @@ osEvent osSignalWait(int32_t signals, uint32_t millisec)
8182 }
8283
8384 /* Check if signals is within the permitted range */
84- if (signals >= ( 1 << ( osFeature_Signals + 1 ) )) {
85+ if (( signals & 0x80000000 ) || ( signals > MAX_VALID_SIGNAL_VAL )) {
8586 evt .status = osErrorValue ;
8687 return evt ;
8788 }
You can’t perform that action at this time.
0 commit comments