⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module.h

📁 SOS操作系统用于无线传感器网络节点的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef _MODULE_H
#define _MODULE_H


//#ifndef _MODULE_
#include <sos.h> ////***NEED TO DO PORTING ZHOU YA JIN
#include <sched.h>
// Ram - I am including the following file here because the configuration
// needs to know what sensor board it is being compiled to
//#include <sensor.h>
#include <sos_error_types.h>
#include <random.h>
//#endif

#include <sos_info.h>
#include <sos_types.h>
#include <sos_module_types.h>
#include <sos_timer.h>
//#include <monitor.h>   ////***NEED TO DO PORTING ZHOU YA JIN
#include <message_types.h>
//#include <codemem.h>   ////***NEED TO DO PORTING ZHOU YA JIN
//#include <systime.h>   ////***NEED TO DO PORTING ZHOU YA JIN
#include <sos_cam.h>
#include <pid.h>
#include <stddef.h>
#include <kertable_conf.h>
#include <fntable_types.h>
#include <sos_error_types.h>
#include "led.h"
#ifdef SOS_SFI
#include <memmap.h>
#endif

#include <module_proc.h>
#include <module_plat.h>

extern PGM_VOID  __code const ker_jumptable[128];

/**
 * Get hardware type
 */
/* 0 */
typedef uint16_t (* ker_hw_type_ker_func_t)( void );
static inline uint16_t KER_hw_type( void )
{
	ker_hw_type_ker_func_t func =
		(ker_hw_type_ker_func_t)get_kertable_entry(0);
	return func( );
}


/**
 * @brief read node id
 * @return node id
 */
/* 1 */
typedef uint16_t (* ker_id_ker_func_t)( void );
static inline uint16_t KER_id( void )
{
	ker_id_ker_func_t func =
		(ker_id_ker_func_t)get_kertable_entry(1);
	return func( );
}


/* 2 */ //by ZHOU YA JIN
/*typedef node_loc_t (* ker_loc_ker_func_t)( void );
static inline node_loc_t ker_loc( void )
{
	ker_loc_ker_func_t func =
		(ker_loc_ker_func_t)get_kertable_entry(2);
	return func( );
}
*/

/* 3 */
typedef int8_t (* ker_timer_release_ker_func_t)(  sos_pid_t pid, uint8_t tid );
static inline int8_t KER_timer_release(  sos_pid_t pid, uint8_t tid )
{
	ker_timer_release_ker_func_t func =
		(ker_timer_release_ker_func_t)get_kertable_entry(3);
	return func( pid, tid );
}


/* 4 */
typedef int8_t (* ker_register_module_ker_func_t)(  mod_header_ptr h );
static inline int8_t KER_register_module(  mod_header_ptr h )
{
	ker_register_module_ker_func_t func =
		(ker_register_module_ker_func_t)get_kertable_entry(4);
	return func( h );
}

/* 5 */
typedef int8_t (* ker_deregister_module_ker_func_t)(  sos_pid_t pid );
static inline int8_t KER_deregister_module(  sos_pid_t pid )
{
	ker_deregister_module_ker_func_t func =
		(ker_deregister_module_ker_func_t)get_kertable_entry(5);
	return func( pid );
}

/* 6 */
typedef sos_module_t *  (* ker_get_module_ker_func_t)(  sos_pid_t pid );
static inline sos_module_t *  KER_get_module(  sos_pid_t pid )
{
	ker_get_module_ker_func_t func =
		(ker_get_module_ker_func_t)get_kertable_entry(6);
	return func( pid );
}




/**
 * @brief start timer
 * @param pid module id
 * @param tid module defined timer id
 * @param type type of timer, this can be STOPWATCH_TIMER_REPEAT or STOPWATCH_TIMER_ONE_SHOT
 * @param interval interval in milliseconds
 * @return zero for success, errno for failure
 * When timeout occurs, a message will be sent to the caller
 * Message format of timeout
 *   dst = caller pid,
 *   src = TIMER_PID
 *   type = MSG_TIMER_TIMEOUT
 *   arg = caller tid
 */
/* 7 */
typedef int8_t (* ker_timer_start_ker_func_t)(  sos_pid_t pid, uint8_t tid, int32_t interval );
static inline int8_t KER_timer_start(  sos_pid_t pid, uint8_t tid, int32_t interval )
{
	ker_timer_start_ker_func_t func =
		(ker_timer_start_ker_func_t)get_kertable_entry(7);
	return func( pid, tid, interval );
}


/* 8 */
typedef int8_t (* ker_timer_restart_ker_func_t)(  sos_pid_t pid, uint8_t tid, int32_t interval );
static inline int8_t KER_timer_restart(  sos_pid_t pid, uint8_t tid, int32_t interval )
{
	ker_timer_restart_ker_func_t func =
		(ker_timer_restart_ker_func_t)get_kertable_entry(8);
	return func( pid, tid, interval );
}


/**
 * @brief stop timer
 * @param pid module id
 * @param tid module defined timer id
 * @return zero for success, errno for failure
 */
/* 9 */
typedef int8_t (* ker_timer_stop_ker_func_t)(  sos_pid_t pid, uint8_t tid );
static inline int8_t KER_timer_stop(  sos_pid_t pid, uint8_t tid )
{
	ker_timer_stop_ker_func_t func =
		(ker_timer_stop_ker_func_t)get_kertable_entry(9);
	return func( pid, tid );
}


/* 10 */
typedef void (* dummy10_ker_func_t)( void );
static inline void dummy10( void )
{
	dummy10_ker_func_t func =
		(dummy10_ker_func_t)get_kertable_entry(10);
	func( );
}

/* 11 */
typedef void (* dummy11_ker_func_t)( void );
static inline void dummy11( void )
{
	dummy11_ker_func_t func =
		(dummy11_ker_func_t)get_kertable_entry(11);
	func( );
}



/**
 * @brief read systime in 32 bits
 */
/* 12 */
/*
typedef uint32_t (* ker_systime32_ker_func_t)( void );
static inline uint32_t ker_systime32( void )
{
	ker_systime32_ker_func_t func =
		(ker_systime32_ker_func_t)get_kertable_entry(12);
	return func( );
}
*/

/**
 * @brief read systime lower 16 bits
 */
/* 13 */
/*
typedef uint16_t (* ker_systime16L_ker_func_t)( void );
static inline uint16_t ker_systime16L( void )
{
	ker_systime16L_ker_func_t func =
		(ker_systime16L_ker_func_t)get_kertable_entry(13);
	return func( );
}

*/
/**
 * @brief read systime higher 16 bits
 */
/* 14 */
/*
typedef uint16_t (* ker_systime16H_ker_func_t)( void );
static inline uint16_t ker_systime16H( void )
{
	ker_systime16H_ker_func_t func =
		(ker_systime16H_ker_func_t)get_kertable_entry(14);
	return func( );
}

*/
/**
 * @brief send asynchronized message
 * @param e message
 * @return zero for success, errno for failure
 */
/* 15 */
typedef int8_t (* post_ker_func_t)(  Message *  m );
static inline int8_t KER_post(  Message *  m )
{
	post_ker_func_t func =
		(post_ker_func_t)get_kertable_entry(15);
	return func( m );
}



/* 16 */
typedef int8_t (* post_short_ker_func_t)(  sos_pid_t did, sos_pid_t sid, uint8_t type, uint8_t byte, uint16_t word, uint16_t flag );
static inline int8_t KER_post_short(  sos_pid_t did, sos_pid_t sid, uint8_t type, uint8_t byte, uint16_t word, uint16_t flag )
{
	post_short_ker_func_t func =
		(post_short_ker_func_t)get_kertable_entry(16);
	return func( did, sid, type, byte, word, flag );
}



/* 17 */
typedef int8_t (* post_long_ker_func_t)(  sos_pid_t did, sos_pid_t sid, uint8_t type, uint8_t arg, void *  larg, uint16_t flag );
static inline int8_t KER_post_long(  sos_pid_t did, sos_pid_t sid, uint8_t type, uint8_t arg, void *  larg, uint16_t flag )
{
	post_long_ker_func_t func =
		(post_long_ker_func_t)get_kertable_entry(17);
	return func( did, sid, type, arg, larg, flag );
}



/* 18 */
typedef int8_t (* post_link_ker_func_t)(  sos_pid_t did, sos_pid_t sid, uint8_t type, uint8_t arg, void *  larg, uint16_t flag, uint16_t daddr );
static inline int8_t KER_post_link(  sos_pid_t did, sos_pid_t sid, uint8_t type, uint8_t arg, void *  larg, uint16_t flag, uint16_t daddr )
{
	post_link_ker_func_t func =
		(post_link_ker_func_t)get_kertable_entry(18);
	return func( did, sid, type, arg, larg, flag, daddr );
}



/**
 * ker_msg_take_data
 */
/* 19 */
typedef uint8_t *  (* ker_msg_take_data_ker_func_t)(  sos_pid_t pid, Message *  msg );
static inline uint8_t *  KER_msg_take_data(  sos_pid_t pid, Message *  msg )
{
	ker_msg_take_data_ker_func_t func =
		(ker_msg_take_data_ker_func_t)get_kertable_entry(19);
	return func( pid, msg );
}


/**
 * @brief change message filter rules
 * @param sid  module id
 * @param rules the rule
 */

/* 20 */
typedef int8_t (* ker_msg_change_rules_ker_func_t)(  sos_pid_t sid, uint8_t rules );
static inline int8_t KER_msg_change_rules(  sos_pid_t sid, uint8_t rules )
{
	ker_msg_change_rules_ker_func_t func =
		(ker_msg_change_rules_ker_func_t)get_kertable_entry(20);
	return func( sid, rules );
}


/**
 * @brief monitoring interface
 */
/* 21 */
/*
typedef int8_t (* ker_register_monitor_ker_func_t)(  sos_pid_t pid, uint8_t type, monitor_cb *  cb );
static inline int8_t ker_register_monitor(  sos_pid_t pid, uint8_t type, monitor_cb *  cb )
{
	ker_register_monitor_ker_func_t func =
		(ker_register_monitor_ker_func_t)get_kertable_entry(21);
	return func( pid, type, cb );
}

*/

/* 22 */
/*
typedef int8_t (* ker_deregister_monitor_ker_func_t)(  monitor_cb *  cb );
static inline int8_t ker_deregister_monitor(  monitor_cb *  cb )
{
	ker_deregister_monitor_ker_func_t func =
		(ker_deregister_monitor_ker_func_t)get_kertable_entry(22);
	return func( cb );
}
*/

/**
 * @brief subscribe to function pointer
 * @param sos_pid_t sub_pid Module requesting function. (User) * @param sos_pid_t pub_pid Module implementing the requested function. (Provider)
 * @param uint8_t table_index the index to the function record, starting zero
 * @return Handler to the function pointer
 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -