Are the MQX version in macro instead of constant _mqx_version_number

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Are the MQX version in macro instead of constant _mqx_version_number

Jump to solution
847 Views
arnogir
Senior Contributor II

Hi,

I have a generic module to manage the ethernet.

This module should be used on project which running on MQX 4.1 and other on MQX 4.2.

But to close a socket, the way is different according MQX revision:

Shutdown for MQX 4.1

closesocket for MQX 4.2.

Then I like to do a macro to call one or other funtion according the MQX version.

I like this will automatic by reading the linked MQX version.

Unfortally, I only found a constant for the MQX version : _mqx_version_number

Are the the same but in macro? (i.e #define _MQX_VERSION_NUMBER 0x04020001)

this to have a faster code by resolve the problem in pre compile time.

Thank:smileyhappy:

0 Kudos
1 Solution
562 Views
arnogir
Senior Contributor II

Hello

I found the following define which correspond to my need:

MQX_VERSION

Defined in mqx.h

So I made the  following implementation

#if (MQX_VERSION < 420#define DV_Eth_iCloseSocket(socket)           shutdown(socket, FLAG_CLOSE_TX) #else  #define DV_Eth_iCloseSocket(socket)           closesocket(socket)    #endif 

View solution in original post

0 Kudos
3 Replies
562 Views
soledad
NXP Employee
NXP Employee

Hello Arnaud,

There is not a macro, however you can use the _mqx_version_number or the _mqx_version values.

pastedImage_0.png

In addition you can use the _mqx_version, this is a string that indicates the version of MQX RTOS.

pastedImage_1.png

pastedImage_3.png

I hope this helps.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
562 Views
arnogir
Senior Contributor II

Yes I seen that, but this is not macro,

I would like do following:

#if (_mqx_version = "4.2.0")

#define DV_Eth_iCloseSocket(socket)           closesocket(socket)

#elif (_mqx_version = "4.1.0")

#define DV_Eth_iCloseSocket(socket)           shutdown(socket, FLAG_CLOSE_TX)

#endif

But like "mqx_version" is a constant, it value cannot be used in pre compile time!:smileycry:

and then if in the .c code I  do following:

if (_mqx_version = "4.2.0")

{

  closesocket(socket);

}

else if (_mqx_version = "4.1.0")

{

shutdown(socket, FLAG_CLOSE_TX);

}

This not link because according used OS, closesocket or shutdown API is not existing..

0 Kudos
563 Views
arnogir
Senior Contributor II

Hello

I found the following define which correspond to my need:

MQX_VERSION

Defined in mqx.h

So I made the  following implementation

#if (MQX_VERSION < 420#define DV_Eth_iCloseSocket(socket)           shutdown(socket, FLAG_CLOSE_TX) #else  #define DV_Eth_iCloseSocket(socket)           closesocket(socket)    #endif 

0 Kudos