mirror of
https://gitee.com/moluo-tech/AT-Command
synced 2025-06-17 16:07:52 +00:00
59 lines
2.0 KiB
C
59 lines
2.0 KiB
C
![]() |
/******************************************************************************
|
|||
|
* @brief ͨ<EFBFBD>ú궨<EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* Copyright (c) 2018~2020, <morro_luo@163.com>
|
|||
|
*
|
|||
|
* SPDX-License-Identifier: Apache-2.0
|
|||
|
*
|
|||
|
* Change Logs:
|
|||
|
* Date Author Notes
|
|||
|
* 2018-02-01 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) ))
|
|||
|
|
|||
|
|
|||
|
#if defined(__CC_ARM) || defined(__GNUC__) /* ARM,GCC*/
|
|||
|
#define SECTION(x) __attribute__((section(x)))
|
|||
|
#define UNUSED __attribute__((unused))
|
|||
|
#define USED __attribute__((used))
|
|||
|
#define ALIGN(n) __attribute__((aligned(n)))
|
|||
|
#define WEAK __attribute__((weak))
|
|||
|
#elif defined (__ICCARM__) /*IAR */
|
|||
|
#define SECTION(x) @ x
|
|||
|
#define UNUSED
|
|||
|
#define USED __root
|
|||
|
#define WEAK __weak
|
|||
|
#else
|
|||
|
#error "Current tool chain haven't supported yet!"
|
|||
|
#endif
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD>Ԫ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD> ---------------------------------------------------------------*/
|
|||
|
#define ARRAY_COUNT(Array) (sizeof(Array) / sizeof(Array[0]))
|
|||
|
|
|||
|
#ifdef __cplusplus
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
#endif
|