cancel
Showing results for 
Search instead for 
Did you mean: 

tx_event_flags_get don't trigger if ULONG *actual_flags_ptr is NULL

ABasi.2
Senior

Hi 

i have a question about tx_event_flags_get function

i was using the function like this: 

 

 

 

tx_event_flags_get(&Flags, 0x01, TX_OR ,NULL, TX_WAIT_FOREVER);

 

 

with a NULL -> ((void *)0) for the actual_flags_ptr parameter and worked fine , i 'm using NULL beacuse i don't need the actual value of the flags

 

after that i'have tried to use like this:

 

 

if(tx_event_flags_get(&Flags,0x08, TX_OR_CLEAR ,NULL, TX_NO_WAIT) == TX_SUCCESS)

 

 

but it seems the combination of NULL and TX_NO_WAIT option is not working, never triggered

 

then if i use an actual variable pointer like this:

 

 

if(tx_event_flags_get(&Flags, MACHINEPARAMSRESET, TX_OR_CLEAR ,&actualFlag, TX_NO_WAIT) == TX_SUCCESS)

 

 

work perfect.

 

why i cannot use NULL if i'm using TX_NO_WAIT ?

there is a problem with the NULL pointer?

i'm also using the qwueue info get like this: 

 

 

 

tx_queue_info_get(&queue, NULL, &queueCnt, NULL, NULL, NULL, NULL);

 

 

and it's working perfectly

 

am i wrong to use the NULL pointer ehere i don't need the value?

 

thank you

2 REPLIES 2
Amel NASRI
ST Employee

Hi @ABasi.2,

May you give more details on the context of your question please? Is it ThreadX related like your other question are printf, fprintf, scanf etc threadSafe in threadX?

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello!

its threadX related,

my question is about the use of NULL instead an actual pointer to a variable to store the flags value

 

in most case i don't need to know the actual value of the flags,  i don't want to use an actual variable so i use the NULL pointer instead a pointer to a variable

 

like in this example : 

 

tx_event_flags_get(&Flags, 0x01, TX_OR ,NULL, TX_WAIT_FOREVER);

 

the firmware wait at this line forever the flag in position 0x01 to be setted 

this works fine 

 

but if i try this instead:

 

if(tx_event_flags_get(&Flags,0x01, TX_OR_CLEAR ,NULL, TX_NO_WAIT) == TX_SUCCESS)
{
// some code
}

 

don't work anymore..

 

the differences are the TX_NO_WAIT and the fact i'm checking in a IF statement and the TX_OR_CLEAR

 

but if i use an actual variable instead the NULL pointer like this:

if(tx_event_flags_get(&Flags,0x01, TX_OR_CLEAR ,&flagsValue, TX_NO_WAIT) == TX_SUCCESS)
{
// some code
}

 

 

this works!

why? i don't need the flags value to be stored in flagsValue variable

 

thank you