在MTK中新增TASK與常用函式分析
宣告TASK的ID和MOD型別
在custom_config.h中custom_task_indx_type新增ID
如:
typedef enum {
INDX_CUSTOM1 = RPS_CUSTOM_TASKS_BEGIN,
INDX_CUSTOM2,
#if defined(__MIIPTS_TASK_SUPPORT__)
INDX_MIIPTS,
#endif
#if defined(__ELIVE_SUPPORT__)
INDX_ELIVE,
#if defined(__ELIVE_IPTV_SUPPORT__) ||
defined(__ELIVE_RDO_SUPPORT__)
INDX_ELIVECORE,
#endif
#endif
#if
defined(__MOTION_SENSOR_SUPPORT_MMI_NEW__)
INDX_GSENSOR,
#endif
#if
defined(FLASHLIGHT_LED_SUPPORT)
INDX_FLASHLIGHT,
#endif
#if
defined(BCT3288_SUPPORT)
INDX_BCT3288LED,
#endif
#if defined(__OPEN_PLATFORM_SUPPORT__)
INDX_CUSTOM_OPEN,
#if defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A) &&
!defined(WIN32)
INDX_MQQ,
#endif // #if
defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A) && !defined(WIN32)
#endif
// #if defined(__OPEN_PLATFORM_SUPPORT__)
RPS_CUSTOM_TASKS_END
} custom_task_indx_type;
中的
#if defined(FLASHLIGHT_LED_SUPPORT)
INDX_FLASHLIGHT,
#endif
為
新加ID;
在custom_module_type中新增模組型別
如:
typedef enum {
MOD_CUSTOM1 = MOD_CUSTOM_BEGIN,
MOD_CUSTOM2,
#if defined(__MIIPTS_TASK_SUPPORT__)
MOD_MIIPTS,
#endif
#if defined(__ELIVE_SUPPORT__)
MOD_ELIVE,
#if defined(__ELIVE_IPTV_SUPPORT__) ||
defined(__ELIVE_RDO_SUPPORT__)
MOD_ELIVECORE,
#endif
#endif
#if
defined(__MOTION_SENSOR_SUPPORT_MMI_NEW__)
MOD_SC_GSENSOR,
#endif
#if
defined(FLASHLIGHT_LED_SUPPORT)
MOD_FLASHLIGHT,
#endif
#if
defined(BCT3288_SUPPORT)
MOD_BCT3288LED,
#endif
#if defined(__OPEN_PLATFORM_SUPPORT__)
MOD_CUSTOM_OPEN,
#if defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A) && !defined(WIN32)
MOD_MQQ,
#endif // #if defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A)
&& !defined(WIN32)
#endif // #if
defined(__OPEN_PLATFORM_SUPPORT__)
MOD_CUSTOM_END
} custom_module_type;
中
#if defined(FLASHLIGHT_LED_SUPPORT)
MOD_FLASHLIGHT,
#endif
為
新加MOD的型別;
在custom_config.c中的陣列custom_mod_task_g中把宣告的ID加入:
如:
custom_task_indx_type custom_mod_task_g[ MAX_CUSTOM_MODS ] =
{
INDX_CUSTOM1, /* MOD_CUSTOM1 */
INDX_CUSTOM2, /*
MOD_CUSTOM2 */
#if defined(__MIIPTS_TASK_SUPPORT__)
INDX_MIIPTS, // MOD_MIIPTS
#endif
#if
defined(__ELIVE_SUPPORT__)
INDX_ELIVE,
#if
defined(__ELIVE_IPTV_SUPPORT__) || defined(__ELIVE_RDO_SUPPORT__)
INDX_ELIVECORE,
#endif
#endif
#if
defined(__MOTION_SENSOR_SUPPORT_MMI_NEW__)
INDX_GSENSOR,
#endif
#if
defined(FLASHLIGHT_LED_SUPPORT)
INDX_FLASHLIGHT,
#endif
#if
defined(BCT3288_SUPPORT)
INDX_BCT3288LED,
#endif
#if defined(__OPEN_PLATFORM_SUPPORT__)
INDX_CUSTOM_OPEN, /* MOD_CUSTOM_OPEN */
#if
defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A) && !defined(WIN32)
INDX_MQQ, /* MOD_QQ */
#endif // #if
defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A) && !defined(WIN32)
#endif
// #if defined(__OPEN_PLATFORM_SUPPORT__)
INDX_NIL /* Please end with INDX_NIL element */
};
在
函式custom_comp_config_tbl中新增TASK的實現函式和TASK的資訊宣告
如:
{
/* INDX_CUSTOM1 */
{"CUST1", "CUST1 Q", 210, 1024, 10,
0,
#ifdef CUSTOM1_EXIST
custom1_create, KAL_FALSE
#else
NULL, KAL_FALSE
#endif
},
/* INDX_CUSTOM2 */
{"CUST2", "CUST2 Q", 211, 1024, 10, 0,
#ifdef
CUSTOM2_EXIST
custom2_create, KAL_FALSE
#else
NULL,
KAL_FALSE
#endif
},
#if defined(__MIIPTS_TASK_SUPPORT__)
{"MiiPTS", "MiiPTS Q", 212, 1024*4, 10, 0, miipts_task_create,
KAL_FALSE},
#endif
#if defined(__ELIVE_SUPPORT__)
{"ELIVE", "ELIVE Q", KAL_PRIORITY_CLASS17+2, 1024*3, 80, 0,
Elive_create, KAL_FALSE} ,
#if defined(__ELIVE_IPTV_SUPPORT__) ||
defined(__ELIVE_RDO_SUPPORT__)
{"ELIVECORE", "ELIVECORE Q",
KAL_PRIORITY_CLASS17+4, 1024*3, 20, 10,
EliveCoreTask,
KAL_FALSE} ,
#endif
#endif
#if defined(__MOTION_SENSOR_SUPPORT_MMI_NEW__)
/* INDX_GSENSOR
*/
{"Gsensor", "Gsensor Q", 195, 1024, 20, 10,
SC_gsensor_create, KAL_FALSE},
#endif
#if
defined(FLASHLIGHT_LED_SUPPORT)
/* INDX_FLASHLIGHT */
{"FLHLT", "FLHLT Q", 200, 1024, 10, 0,
SC_flashlight_create,
KAL_FALSE},
#endif
#if defined(BCT3288_SUPPORT)
/*
INDX_BCT3288LED */
{"BCT3288", "BCT3288 Q", 200, 1024, 20, 0,
SC_BCT3288Flashlight_create, KAL_FALSE},
#endif
#if defined(__OPEN_PLATFORM_SUPPORT__)
{ "CUSTOPEN",
"CUSTOPEN Q", 220, 4096, 64, 0, Open_TaskCreate, KAL_FALSE },
#if
defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A) && !defined(WIN32)
{ "MQQ", "MQQ Q", 212, 4096, 100, 10, mqq_create, KAL_FALSE },
#endif // #if defined(OPEN_CUSTOM_PRODUCT_QQ_DOWN_07A) &&
!defined(WIN32)
#endif // #if defined(__OPEN_PLATFORM_SUPPORT__)
}
中的
#if defined(FLASHLIGHT_LED_SUPPORT)
/* INDX_FLASHLIGHT */
{"FLHLT", "FLHLT Q", 200, 1024, 10, 0,
SC_flashlight_create,
KAL_FALSE},
#endif
如果TASK需要與別的TASK互動,要使用訊息,訊息ID在檔案custom_sap.h中定義,
該標頭檔案被包含在檔案stack_msgs.h中,最終合併入msg_type列舉中。
如:
MSG_ID_CUSTOM1_CUSTOM2 = CUSTOM_MSG_CODE_BEGIN,
MSG_ID_CUSTOM2_CUSTOM1,
#if
defined(__MIIPTS_TASK_SUPPORT__)
MSG_ID_MIIPTS_ENCODE_REQ,
MSG_ID_MIIPTS_ENCODE_CNF,
MSG_ID_MIIPTS_DECODE_REQ,
MSG_ID_MIIPTS_DECODE_CNF,
#endif
// __MIIPTS_TASK_SUPPORT__
#ifdef __ELIVE_SUPPORT__
MSG_ID_ELIVE_BASE,
MSG_ID_ELIVE_END
= MSG_ID_ELIVE_BASE + 50,
#endif
#if
defined(__ALLKEY_EINT_FOR_KEYBOARD__)
MSG_ID_ALLKEYBOARD,
#endif
#if
defined(__MOTION_SENSOR_SUPPORT_MMI_NEW__)
MSG_ID_GSENSOR_CHECK_START_REQ,
MSG_ID_GSENSOR_CHECK_STOP_REQ,
MSG_ID_GSENSOR_CHECK_ROTATE_IND,
#endif
#if
defined(FLASHLIGHT_LED_SUPPORT)
MSG_ID_FLASHLIGHT_PLAY_REQ,
MSG_ID_FLASHLIGHT_STOP_REQ,
#endif
#ifdef
__MMI_IMAP__
MSG_ID_IMAP,
#endif
#if
defined(FIVE_CLAM_SUPPORT)
MSG_ID_FIVE_CLAM_SUPPORT,
#endif
#if
defined(FOUR_CLAM_SUPPORT)
MSG_ID_FOUR_CLAM_SUPPORT,
#endif
#if
defined(E73_TWO_CLAM_SUPPORT)
MSG_ID_TWO_CLAM_SUPPORT,
#endif
#if
defined(BCT3288_SUPPORT)
MSG_ID_BCT3288FLASHLIGHT_LEFTKEY_PRESS,
MSG_ID_BCT3288FLASHLIGHT_RIGHTKEY_PRESS,
MSG_ID_BCT3288FLASHLIGHT_UPKEY_PRESS,
MSG_ID_BCT3288FLASHLIGHT_DOWNKEY_PRESS,
MSG_ID_BCT3288FLASHLIGHT_RIGHT_ROTATE,
MSG_ID_BCT3288FLASHLIGHT_LEFT_ROTATE,
MSG_ID_BCT3288FLASHLIGHT_MP3_EFFECT,
MSG_ID_BCT3288FLASHLIGHT_STOP_REQ,
MSG_ID_BCT3288FLASHLIGHT_ROTATE_CNF,
#endif
中
的
#if defined(FLASHLIGHT_LED_SUPPORT)
MSG_ID_FLASHLIGHT_PLAY_REQ,
MSG_ID_FLASHLIGHT_STOP_REQ,
#endif
再
看TASK函式的實現和呼叫:
kal_bool SC_flashlight_create(comptask_handler_struct **handle)
{
static
const comptask_handler_struct custom_handler_info =
{
SC_flashlight_task_main, /*
task entry function */
SC_flashlight_init, /* task initialization
function */
NULL, /* task configuration function */
NULL, /*
task reset handler */
NULL, /* task termination handler */
};
*handle = (comptask_handler_struct *)&custom_handler_info;
return
KAL_TRUE;
}
task的處理函式,主要是獲取TASK的ID函式kal_get_my_task_index和獲取訊息內容函式
receive_msg_ext_q:
void SC_flashlight_task_main(task_entry_struct *
task_entry_ptr)
{
ilm_struct current_ilm;
kal_uint32
my_index;
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);
if(current_ilm.msg_id==MSG_ID_FLASHLIGHT_PLAY_REQ)
{
//ET6204_init();
SC_et6204_play(¤t_ilm);
}
else
if(current_ilm.msg_id==MSG_ID_FLASHLIGHT_STOP_REQ)
{
StopTimer(LED_FLASH_TIMER);
ET6204_ALL_OFF();
Poweroff_ET6204();
}
free_ilm(
¤t_ilm);
}
}
初始化函式,進入該TASK裡需要初始化的全域性變數等:
kal_bool SC_flashlight_init(task_indx_type indx)
{
ET6204_init();
return
KAL_TRUE;
}
訊息處理函式,主要是收到訊息的處理函式,掌握 et6204_light_play_ind的定義與使用:
void SC_et6204_play(ilm_struct *ilm_ptr)
{
kal_uint16
et6204_display[7];
int i;
et6204_light_play_ind *play_data =
(et6204_light_play_ind *)(ilm_ptr->local_para_ptr);
ET6204_POWER_HIGH;
ET6204_ALL_OFF();
if
(get_phnset_led_setting() == 0)
{
ET6204_ALL_OFF();
Poweroff_ET6204();
return;
}
if(play_data->type == 0xf0)
{
et6204_incoming_flag=TRUE;
flash_count
= 0;
et6204_incoming_number[et6204_incoming_length] = 0x30+10;
//jacky added
et6204_incoming_length ++;
mmi_incoming_start_et6204_ind_nubmer();
return;
}
/* else
if(play_data->type == 0x02)
{
et6204_audioplayer_flag =
TRUE;
mmi_audioplayer_start_et6204_ind();
return;
}*/
else
{
g_led_count
= 0;
g_ec6204_type = play_data->type;
g_ec6204_play_num =
play_data->play_num;
mmi_start_et6204();
}
}
訊息傳送,主要是如何填充訊息和傳送函式OslMsgSendExtQueue:
void mmi_et6204_stop_display()
{
MYQUEUE Message;
et6204_light_play_ind
*et6204_play_req;
ET6204_POWER_LOW;
et6204_incoming_flag = FALSE;
et6204_poweron_flag
= FALSE;
et6204_audioplayer_flag = FALSE;
/*----------------------------------------------------------------*/
/*
Code Body */
/*----------------------------------------------------------------*/
Message.oslMsgId
= MSG_ID_FLASHLIGHT_STOP_REQ;
et6204_play_req =
OslConstructDataPtr(sizeof(et6204_light_play_ind));
et6204_play_req->type=
1;
Message.oslDataPtr = (oslParaType*) et6204_play_req;
Message.oslPeerBuffPtr
= NULL;
Message.oslSrcId = MOD_MMI;
Message.oslDestId =
MOD_FLASHLIGHT;
OslMsgSendExtQueue(&Message);
return;
}
void
mmi_et6204_start_display(kal_uint8 type,kal_uint8 play_num)
{
MYQUEUE
Message;
et6204_light_play_ind *et6204_play_req;
//kal_prompt_trace(MOD_BMT,"mmi_et6204_start_display::");
/*----------------------------------------------------------------*/
/*
Code Body */
/*----------------------------------------------------------------*/
StopTimer(LED_FLASH_TIMER);
Message.oslMsgId
= MSG_ID_FLASHLIGHT_PLAY_REQ;
et6204_play_req =
OslConstructDataPtr(sizeof(et6204_light_play_ind));
et6204_play_req->type=
type;
et6204_play_req->play_num= play_num;
Message.oslDataPtr
= (oslParaType*) et6204_play_req;
Message.oslPeerBuffPtr = NULL;
Message.oslSrcId
= MOD_MMI;
Message.oslDestId = MOD_FLASHLIGHT;
OslMsgSendExtQueue(&Message);
return;
}
資料結構:
typedef struct __et6204_light_play_ind
{
LOCAL_PARA_HDR
kal_uint8 type;
kal_uint8 play_num;
}et6204_light_play_ind;
typedef enum
{
ET6204_POWER_ON,
ET6204_INCOMING_IND,
ET6204_POWER_OFF,
ET6204_AUDIOPLAYER,
ET6204_NEW_MESSAGE,
ET6204_END
}ET6204_LIGHT_ID;
相關文章
- Task02:Numpy常用函式函式
- oracle資料庫常用分析函式與聚合函式的用法Oracle資料庫函式
- Oracle常用分析函式Oracle函式
- Oracle分析函式與視窗函式Oracle函式
- matlab常用函式與常用指令大全Matlab函式
- 常用分析函式開窗講解函式
- 工作中,Oracle常用函式Oracle函式
- (4)mysql 中的常用函式MySql函式
- MATLAB中的常用函式Matlab函式
- Python資料分析--Numpy常用函式介紹(5)--Numpy中的相關性函式Python函式
- Python資料分析--Numpy常用函式介紹(7)--Numpy中矩陣和通用函式Python函式矩陣
- 高考數學常用數學思想:函式與方程思想,在數列中的應用函式
- webpack 4.0 Tapable 類中的常用鉤子函式原始碼分析Web函式原始碼
- 分析函式中的KEEP函式
- Sanic add_task()方法/函式函式
- Orace與SQL常用函式對照SQL函式
- Mysql 常用函式(1)- 常用函式彙總MySql函式
- 常用函式函式
- 常用函式--時間函式函式
- 在CPP檔案中自動新增函式註釋的ADDIN (轉)函式
- Python中Pool常用函式有哪些?Python函式
- C++中函式指標與函式物件C++函式指標物件
- Mysql 常用函式(15)- upper 函式MySql函式
- js中在一個函式中引用另一個函式中的函式,可以這麼做JS函式
- Chrome DevTools:在 Profile 效能分析中顯示原生 javascript 函式ChromedevJavaScript函式
- PHP 常用函式PHP函式
- PHP常用函式PHP函式
- js 常用函式JS函式
- MySQL 常用函式MySql函式
- MySQL 常用函式。MySql函式
- 常用函式集合函式
- 常用助手函式函式
- 常用函式整理函式
- jQuery常用函式jQuery函式
- SqlServer常用函式SQLServer函式
- js常用函式JS函式
- ORACLE 常用 函式Oracle函式
- MySQL常用函式MySql函式