###############模块的添加##################
1 .添加新模块文件
code\jt
jt文件夹
jt\src\main.c
jt\inc\main.h
2. option.mak中
COMPLIST += jt
CUS_REL_SRC_COMP += jt
3 .make文件中添加
make\jt\jt.mak
# Define source file lists to SRC_LIST
SRC_LIST = jt\src\main.c
# Define include path lists to INC_DIR
INC_DIR = jt\inc
# Define the specified compile options to COMP_DEFS
COMP_DEFS =
# Define the source file search paths to SRC_PATH
SRC_PATH = jt\src
##################### task添加 ##################################
1.app_task_config.h
task_module_map(INDX_JT, MOD_JT)
task_name("JT")
task_queue_name("JT Q")
task_priority(TASK_PRIORITY_MMI + 1)
task_stack_size(4096)
task_create_function(jt_task_create)
task_stack_internalRAM(KAL_FALSE)
task_external_queue_size(50)
task_internal_queue_size(0)
task_boot_mode(NORMAL_M)
2.user_msgid_app.h定义消息范围
#ifdef KAL_MSGID_EXPANSION
#if !defined(__L1_STANDALONE__)
#include "jt_sap.h"
#endif
MSG_ID_NAME(JT)
#else
MSG_ID_RANGE(JT, 1000)
#endif
// #define MSG_ID_RANGE(MSGNAME, MSGRANGE) \
// MSG_ID_##MSGNAME##_CODE_BEGIN, \
// MSG_ID_##MSGNAME##_CODE_TAIL = MSG_ID_##MSGNAME##_CODE_BEGIN + MSGRANGE,
3.interface\jt\jt_sap.h 定义消息
MSG_ID_JT_STARTUP_REQ = MSG_ID_JT_CODE_BEGIN,
4.option.mak把消息定义头文件加入到公共的
COMMINCDIRS += interface\jt
5.main.c的实现
#include "main.h"
#include "syscomp_config.h"
#include "task_config.h"
static void jt_task_main(task_entry_struct * task_entry_ptr);
kal_bool jt_task_create(comptask_handler_struct **handle)
{
static const comptask_handler_struct my_handler_info =
{
jt_task_main,
NULL,
NULL,
NULL,
NULL,
};
*handle = (comptask_handler_struct *)&my_handler_info;
return KAL_TRUE;
}
void jt_main(ilm_struct *ilm_ptr)
{
if (ilm_ptr->msg_id == MSG_ID_JT_STARTUP_REQ)
{
//消息处理
}
}
static void jt_task_main(task_entry_struct * task_entry_ptr)
{
kal_uint32 my_index;
ilm_struct current_ilm;
kal_get_my_task_index(&my_index);
while (1)
{
receive_msg_ext_q(task_info_g[task_entry_ptr->task_indx].task_ext_qid,¤t_ilm);
stack_set_active_module_id( my_index, current_ilm.dest_mod_id );
jt_main((void*)¤t_ilm);
free_ilm(¤t_ilm);
}
}
6.发送消息给自己创建的task
ilm_struct *ilm_ptr = NULL;
ilm_ptr = ilm_ptr = allocate_ilm(MOD_MMI);
ilm_ptr->msg_id = (msg_type) MSG_ID_JT_STARTUP_REQ;
ilm_ptr->local_para_ptr = NULL;//(local_para_struct*) local_data;
ilm_ptr->peer_buff_ptr = NULL;
SEND_ILM(MOD_MMI, MOD_JT, MMI_L4C_SAP, ilm_ptr);
1 .添加新模块文件
code\jt
jt文件夹
jt\src\main.c
jt\inc\main.h
2. option.mak中
COMPLIST += jt
CUS_REL_SRC_COMP += jt
3 .make文件中添加
make\jt\jt.mak
# Define source file lists to SRC_LIST
SRC_LIST = jt\src\main.c
# Define include path lists to INC_DIR
INC_DIR = jt\inc
# Define the specified compile options to COMP_DEFS
COMP_DEFS =
# Define the source file search paths to SRC_PATH
SRC_PATH = jt\src
##################### task添加 ##################################
1.app_task_config.h
task_index(INDX_JT)
task_module_map(INDX_JT, MOD_JT)
task_name("JT")
task_queue_name("JT Q")
task_priority(TASK_PRIORITY_MMI + 1)
task_stack_size(4096)
task_create_function(jt_task_create)
task_stack_internalRAM(KAL_FALSE)
task_external_queue_size(50)
task_internal_queue_size(0)
task_boot_mode(NORMAL_M)
2.user_msgid_app.h定义消息范围
#ifdef KAL_MSGID_EXPANSION
#if !defined(__L1_STANDALONE__)
#include "jt_sap.h"
#endif
MSG_ID_NAME(JT)
#else
MSG_ID_RANGE(JT, 1000)
#endif
// #define MSG_ID_RANGE(MSGNAME, MSGRANGE) \
// MSG_ID_##MSGNAME##_CODE_BEGIN, \
// MSG_ID_##MSGNAME##_CODE_TAIL = MSG_ID_##MSGNAME##_CODE_BEGIN + MSGRANGE,
3.interface\jt\jt_sap.h 定义消息
MSG_ID_JT_STARTUP_REQ = MSG_ID_JT_CODE_BEGIN,
4.option.mak把消息定义头文件加入到公共的
COMMINCDIRS += interface\jt
5.main.c的实现
#include "main.h"
#include "syscomp_config.h"
#include "task_config.h"
static void jt_task_main(task_entry_struct * task_entry_ptr);
kal_bool jt_task_create(comptask_handler_struct **handle)
{
static const comptask_handler_struct my_handler_info =
{
jt_task_main,
NULL,
NULL,
NULL,
NULL,
};
*handle = (comptask_handler_struct *)&my_handler_info;
return KAL_TRUE;
}
void jt_main(ilm_struct *ilm_ptr)
{
if (ilm_ptr->msg_id == MSG_ID_JT_STARTUP_REQ)
{
//消息处理
}
}
static void jt_task_main(task_entry_struct * task_entry_ptr)
{
kal_uint32 my_index;
ilm_struct current_ilm;
kal_get_my_task_index(&my_index);
while (1)
{
receive_msg_ext_q(task_info_g[task_entry_ptr->task_indx].task_ext_qid,¤t_ilm);
stack_set_active_module_id( my_index, current_ilm.dest_mod_id );
jt_main((void*)¤t_ilm);
free_ilm(¤t_ilm);
}
}
6.发送消息给自己创建的task
ilm_struct *ilm_ptr = NULL;
ilm_ptr = ilm_ptr = allocate_ilm(MOD_MMI);
ilm_ptr->msg_id = (msg_type) MSG_ID_JT_STARTUP_REQ;
ilm_ptr->local_para_ptr = NULL;//(local_para_struct*) local_data;
ilm_ptr->peer_buff_ptr = NULL;
SEND_ILM(MOD_MMI, MOD_JT, MMI_L4C_SAP, ilm_ptr);