RT-Thread RTOS
An open source embedded real-time operating system
Basic Definitions

Macros

#define RT_VERSION_MAJOR   5
 
#define RT_VERSION_MINOR   2
 
#define RT_VERSION_PATCH   0
 
#define RT_IS_ALIGN(addr, align)   ((!(addr & (align - 1))) && (addr != RT_NULL))
 
#define RT_ALIGN(size, align)   (((size) + (align) - 1) & ~((align) - 1))
 
#define RT_ALIGN_DOWN(size, align)   ((size) & ~((align) - 1))
 

Detailed Description

Basic data type in RT-Thread RTOS.

These are the basic definitions which used in RT-Thread RTOS. In general, RT-Thread kernel uses its own definition of the basic data types, such as rt_uint32_t, rt_uint8_t, etc., which does not depend on the compiler or architecture.

Macro Definition Documentation

◆ RT_VERSION_MAJOR

#define RT_VERSION_MAJOR   5

Major version number (X.x.x)

◆ RT_VERSION_MINOR

#define RT_VERSION_MINOR   2

Minor version number (x.X.x)

◆ RT_VERSION_PATCH

#define RT_VERSION_PATCH   0

Patch version number (x.x.X)

◆ RT_IS_ALIGN

#define RT_IS_ALIGN (   addr,
  align 
)    ((!(addr & (align - 1))) && (addr != RT_NULL))

Return true(1) or false(0). RT_IS_ALIGN(128, 4) is judging whether 128 aligns with 4. The result is 1, which means 128 aligns with 4.

Note
If the address is NULL, false(0) will be returned

◆ RT_ALIGN

#define RT_ALIGN (   size,
  align 
)    (((size) + (align) - 1) & ~((align) - 1))

Return the most contiguous size aligned at specified width. RT_ALIGN(13, 4) would return 16.

◆ RT_ALIGN_DOWN

#define RT_ALIGN_DOWN (   size,
  align 
)    ((size) & ~((align) - 1))

Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4) would return 12.