mirror of
https://gitee.com/moluo-tech/CodeBrick.git
synced 2025-01-16 04:32:51 +08:00
51 lines
1.7 KiB
C
51 lines
1.7 KiB
C
/*******************************************************************************
|
||
* @brief ͨ<>ú궨<C3BA><EAB6A8>
|
||
*
|
||
* Change Logs:
|
||
* Date Author Notes
|
||
* 2018-03-18 Morro Initial version.
|
||
*******************************************************************************/
|
||
|
||
#ifndef _COM_DEF_H_
|
||
#define _COM_DEF_H_
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD> -----------------------------------------------------------*/
|
||
#define ANONY_CONN(type, var, line) type var##line
|
||
#define ANONY_DEF(type,prefix,line) ANONY_CONN(type, prefix, line)
|
||
#define ANONY_TYPE(type,prefix) ANONY_DEF(type,prefix, __LINE__)
|
||
|
||
/**
|
||
* container_of - cast a member of a structure out to the containing structure
|
||
* @ptr: the pointer to the member.
|
||
* @type: the type of the container struct this is embedded in.
|
||
* @member: the name of the member within the struct.
|
||
*
|
||
*/
|
||
#define container_of(ptr, type, member) ( \
|
||
(type *)( (char *)(ptr) - offsetof(type,member) ))
|
||
|
||
|
||
#ifdef __CC_ARM /* ARM Compiler */
|
||
#define SECTION(x) __attribute__((section(x)))
|
||
#define UNUSED __attribute__((unused))
|
||
#define RESERVE
|
||
#elif defined (__ICCARM__) /* for IAR Compiler */
|
||
#define SECTION(x) @ x
|
||
#define UNUSED
|
||
#define RESERVE __root
|
||
#elif defined (__GNUC__) /* GNU GCC Compiler */
|
||
#define SECTION(x) __attribute__((section(x)))
|
||
#define UNUSED __attribute__((unused))
|
||
#define RESERVE
|
||
#endif
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif
|