COMMON - Common Utilities#
General purpose utilities and cross-compiler support.
This SDK supports the following compilers/IDEs:
Simplicity Studio
IAR Embedded Workbench
Keil uVision IDE
Plain armgcc
Certain compiler features such as alignment is implemented differently in the tools. Therefore, macros such as SL_ALIGN are provided to enable compiler independent code.
Note
RAM code macros are implemented in RAMFUNC. Cross-compiler RAM code support needs extended documentation and it is therefore implemented as a separate module.
Functions#
Count trailing number of zeros.
Reverse the bits.
Reverse the bits.
Reverse the bits.
Convert logarithm of 2 to division factor.
Count the number of bits that are set to 1 in a 32-bit bitfield.
Macros#
Macros to concatenate.
sl concat paster 2.
sl concat paster 3.
sl concat paster 4.
Round n up to closest interval of i.
Round n down to closest interval of i.
Stringify X.
Macros for giving the compiler hints about the likelihood of a branch.
A macro for getting the minimum value.
A macro for getting the maximum value.
A GCC style macro for handling packed structures.
A macro for handling packed structures.
A macro for handling packed structures.
GCC style macro for aligning a variable.
A macro for aligning a variable.
A macro for defining a weak symbol.
A macro for handling non-returning functions.
A macro for placing a variable in a section.
A macro for notifying the compiler of an intended switch case fallthrough.
A macro for notifying the compiler to ignore type limit check.
A MACRO to notify the compiler, limit END.
Function Documentation#
SL_CTZ#
uint32_t SL_CTZ (uint32_t value)
Count trailing number of zeros.
[in] | value | Data value to check for number of trailing zero bits. |
Use CLZ instruction if available.
Returns
A number of trailing zeros in value.
298
of file platform/common/inc/sl_common.h
SL_RBIT#
uint32_t SL_RBIT (uint32_t value)
Reverse the bits.
[in] | value | Data value to reverse. |
Use the RBIT instruction if available, else process.
Returns
A reversed value.
330
of file platform/common/inc/sl_common.h
SL_RBIT16#
uint16_t SL_RBIT16 (uint16_t value)
Reverse the bits.
[in] | value | 16-bit data value to reverse. |
Use the RBIT instruction if available, else process.
Returns
A 16-bit reversed value.
360
of file platform/common/inc/sl_common.h
SL_RBIT8#
uint8_t SL_RBIT8 (uint8_t value)
Reverse the bits.
[in] | value | 8-bit data value to reverse. |
Use the RBIT instruction if available, else process.
Returns
A 8-bit reversed value.
375
of file platform/common/inc/sl_common.h
SL_Log2ToDiv#
uint32_t SL_Log2ToDiv (uint32_t log2)
Convert logarithm of 2 to division factor.
[in] | log2 | Logarithm of 2. |
Returns
Dividend.
390
of file platform/common/inc/sl_common.h
SL_POPCOUNT32#
uint32_t SL_POPCOUNT32 (uint32_t bitfield)
Count the number of bits that are set to 1 in a 32-bit bitfield.
[in] | bitfield | 32-bit bitfield. |
Returns
The number of bits that are set to 1 in the bitfield.
406
of file platform/common/inc/sl_common.h
Macro Definition Documentation#
_CONCAT_2#
#define _CONCAT_2Value:
(first, second)
Macros to concatenate.
76
of file platform/common/inc/sl_common.h
SL_CONCAT_PASTER_2#
#define SL_CONCAT_PASTER_2Value:
(first, second)
sl concat paster 2.
77
of file platform/common/inc/sl_common.h
_CONCAT_3#
#define _CONCAT_3Value:
(first, second, third)
78
of file platform/common/inc/sl_common.h
SL_CONCAT_PASTER_3#
#define SL_CONCAT_PASTER_3Value:
(first, second, third)
sl concat paster 3.
79
of file platform/common/inc/sl_common.h
_CONCAT_4#
#define _CONCAT_4Value:
(first, second, third, fourth)
80
of file platform/common/inc/sl_common.h
SL_CONCAT_PASTER_4#
#define SL_CONCAT_PASTER_4Value:
(first, second, third, fourth)
sl concat paster 4.
81
of file platform/common/inc/sl_common.h
SL_CEILING#
#define SL_CEILINGValue:
(n, i)
Round n up to closest interval of i.
84
of file platform/common/inc/sl_common.h
SL_FLOOR#
#define SL_FLOORValue:
(n, i)
Round n down to closest interval of i.
87
of file platform/common/inc/sl_common.h
STRINGIZE#
#define STRINGIZEValue:
(X)
Stringify X.
90
of file platform/common/inc/sl_common.h
SL_BRANCH_LIKELY#
#define SL_BRANCH_LIKELYValue:
(x)
Macros for giving the compiler hints about the likelihood of a branch.
162
of file platform/common/inc/sl_common.h
SL_BRANCH_UNLIKELY#
#define SL_BRANCH_UNLIKELYValue:
(x)
163
of file platform/common/inc/sl_common.h
SL_MIN#
#define SL_MINValue:
(a, b)
A macro for getting the minimum value.
No side-effects, a and b are evaluated one time only.
166
of file platform/common/inc/sl_common.h
SL_MAX#
#define SL_MAXValue:
(a, b)
A macro for getting the maximum value.
No side-effects, a and b are evaluated one time only.
169
of file platform/common/inc/sl_common.h
SL_ATTRIBUTE_PACKED#
#define SL_ATTRIBUTE_PACKEDValue:
__attribute__ ((packed))
A GCC style macro for handling packed structures.
172
of file platform/common/inc/sl_common.h
SL_PACK_START#
#define SL_PACK_START
A macro for handling packed structures.
Use this macro before the structure definition.
X denotes the maximum alignment of structure members. X is not supported with GCC. GCC always uses 1 byte maximum alignment.
179
of file platform/common/inc/sl_common.h
SL_PACK_END#
#define SL_PACK_END
A macro for handling packed structures.
Use this macro after the structure definition.
With GCC, add SL_ATTRIBUTE_PACKED after the closing curly braces of the structure definition.
186
of file platform/common/inc/sl_common.h
SL_ATTRIBUTE_ALIGN#
#define SL_ATTRIBUTE_ALIGNValue:
(X)
GCC style macro for aligning a variable.
189
of file platform/common/inc/sl_common.h
SL_ALIGN#
#define SL_ALIGN
A macro for aligning a variable.
Use this macro before the variable definition.
X denotes the storage alignment value in bytes.
To be GCC-compatible, use SL_ATTRIBUTE_ALIGN(X) before the semicolon on normal variables. Use SL_ATTRIBUTE_ALIGN(X) before the opening curly brace on structure variables.
197
of file platform/common/inc/sl_common.h
SL_WEAK#
#define SL_WEAKValue:
__attribute__ ((weak))
A macro for defining a weak symbol.
200
of file platform/common/inc/sl_common.h
SL_NORETURN#
#define SL_NORETURNValue:
__attribute__ ((noreturn))
A macro for handling non-returning functions.
203
of file platform/common/inc/sl_common.h
SL_ATTRIBUTE_SECTION#
#define SL_ATTRIBUTE_SECTIONValue:
(X)
A macro for placing a variable in a section.
Use this macro after the variable definition, before the equal sign or a semicolon.
X denotes the section to place the variable in.
209
of file platform/common/inc/sl_common.h
SL_FALLTHROUGH#
#define SL_FALLTHROUGH
A macro for notifying the compiler of an intended switch case fallthrough.
216
of file platform/common/inc/sl_common.h
SL_IGNORE_TYPE_LIMIT_BEGIN#
#define SL_IGNORE_TYPE_LIMIT_BEGIN
A macro for notifying the compiler to ignore type limit check.
227
of file platform/common/inc/sl_common.h
SL_IGNORE_TYPE_LIMIT_END#
#define SL_IGNORE_TYPE_LIMIT_END
A MACRO to notify the compiler, limit END.
228
of file platform/common/inc/sl_common.h