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 7
7
#include <kernel_structs.h>
8
8
#include <cmsis_os.h>
9
9
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)
11
12
12
13
void * k_thread_other_custom_data_get (struct k_thread * thread_id )
13
14
{
@@ -22,7 +23,7 @@ int32_t osSignalSet(osThreadId thread_id, int32_t signals)
22
23
int sig , key ;
23
24
24
25
if ((thread_id == NULL ) || (!signals ) ||
25
- (signals >= ( 1 << ( osFeature_Signals + 1 )) )) {
26
+ (signals & 0x80000000 ) || ( signals > MAX_VALID_SIGNAL_VAL )) {
26
27
return 0x80000000 ;
27
28
}
28
29
@@ -48,7 +49,7 @@ int32_t osSignalClear(osThreadId thread_id, int32_t signals)
48
49
int sig , key ;
49
50
50
51
if (_is_in_isr () || (thread_id == NULL ) || (!signals ) ||
51
- (signals >= ( 1 << ( osFeature_Signals + 1 )) )) {
52
+ (signals & 0x80000000 ) || ( signals > MAX_VALID_SIGNAL_VAL )) {
52
53
return 0x80000000 ;
53
54
}
54
55
@@ -81,7 +82,7 @@ osEvent osSignalWait(int32_t signals, uint32_t millisec)
81
82
}
82
83
83
84
/* Check if signals is within the permitted range */
84
- if (signals >= ( 1 << ( osFeature_Signals + 1 ) )) {
85
+ if (( signals & 0x80000000 ) || ( signals > MAX_VALID_SIGNAL_VAL )) {
85
86
evt .status = osErrorValue ;
86
87
return evt ;
87
88
}
You can’t perform that action at this time.
0 commit comments