fntable_types.h
来自「SOS操作系统用于无线传感器网络节点的源代码」· C头文件 代码 · 共 59 行
H
59 行
#ifndef _FNTABLE_TYPES_H_
#define _FNTABLE_TYPES_H_
/**
* @brief function control block
*
* For provider: ptr points to real implementation
* proto stores function prototype
* pid is module ID
* fid is function ID
*
* For static user: ptr is NULL
* proto stores function prototype
* pid is module ID of provider
* fid is function ID of provider
*
* For dynamic user: ptr is NULL
* proto stores function prototype
* pid is RUNTIME_PID
* fid is RUNTIME_FID
*
* NOTE: when modifying this structure, please keep it even size.
* The purpose is to keep func_cb align in 16 bits.
*/
#define RUNTIME_FID 255
#define RUNTIME_PID NULL_PID
// NOTE: PLEASE MAKE SURE THAT THIS STRUCTURE
// IS WORD ALIGNED.
typedef struct func_cb {
void *ptr; //! function pointer
uint8_t proto[4]; //! function prototype
uint8_t pid; //! function PID
uint8_t fid; //! function ID
} func_cb_t;
/**
* @brief SOS Dynamic Function Call
*/
//#ifndef QUALNET_PLATFORM
//#define SOS_CALL(fnptrptr,type, args...) \
//((type)(sos_read_header_ptr(fnptrptr, 0)))((fnptrptr), ##args)
//#else
//! XXX broken
//#define SOS_CALL(fnptrptr, prototype,...) (*this.*(*(fnptrptr)))(prototype, ##args)
//#endif
#ifdef QUALNET_PLATFORM
typedef int8_t (SOSKernel::*fn_ptr_t)(void);
#else
typedef int8_t (*fn_ptr_t)(void);
#endif
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?