📄 l4drv.c
字号:
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* store the set time clock callback function */
set_clocktime_callback_func = FuncRspPtr;
ilm_ptr = allocate_ilm(MOD_MMI);
ilm_ptr->msg_id = (U16) MSG_ID_MMI_EQ_SET_RTC_TIME_REQ;
local_data = (mmi_eq_set_rtc_time_req_struct*)
construct_local_para(sizeof(mmi_eq_set_rtc_time_req_struct), TD_CTRL);
local_data->set_type = RTC_SETTING_TYPE_DATETIME;
local_data->rtc_type = RTC_TIME_CLOCK_IND;
local_data->info.alarm_format = 0;
local_data->info.alarm_index = 0;
local_data->info.type = 0;
local_data->info.text[0] = '\0';
local_data->info.recurr = 0;
local_data->info.data_time.rtc_year = datetime.rtc_year;
local_data->info.data_time.rtc_wday = datetime.rtc_wday;
local_data->info.data_time.rtc_mon = datetime.rtc_mon;
local_data->info.data_time.rtc_day = datetime.rtc_day;
local_data->info.data_time.rtc_hour = datetime.rtc_hour;
local_data->info.data_time.rtc_min = datetime.rtc_min;
local_data->info.data_time.rtc_sec = datetime.rtc_sec;
ilm_ptr->local_para_ptr = (local_para_struct*) local_data;
ilm_ptr->peer_buff_ptr = NULL;
SEND_ILM(MOD_MMI, MOD_L4C, MMI_L4C_SAP, ilm_ptr);
}
/*****************************************************************************
* FUNCTION
* L4SetClockRSP
* DESCRIPTION
* This function is to get to the result of clock set response.
* PARAMETERS
* buf [?]
* a(?) [IN] Buf
* RETURNS
* void
*****************************************************************************/
void L4SetClockRSP(void *buf)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (set_clocktime_callback_func != NULL)
{
set_clocktime_callback_func(buf);
}
}
/*****************************************************************************
* FUNCTION
* L4GetClockTime
* DESCRIPTION
* This function is to request to get the clock.
* PARAMETERS
* FuncRspPtr [IN]
* a(?) [IN] Void
* RETURNS
* void
*****************************************************************************/
void L4GetClockTime(oslTaskFuncPtr FuncRspPtr)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
ilm_struct *ilm_ptr = NULL;
mmi_eq_get_rtc_time_req_struct *local_data;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* store the get time clock callback function */
get_clocktime_callback_func = FuncRspPtr;
ilm_ptr = allocate_ilm(MOD_MMI);
local_data = (mmi_eq_get_rtc_time_req_struct*)
construct_local_para(sizeof(mmi_eq_get_rtc_time_req_struct), TD_CTRL);
local_data->rtc_type = RTC_TIME_CLOCK_IND;
ilm_ptr->msg_id = (U16) MSG_ID_MMI_EQ_GET_RTC_TIME_REQ;
ilm_ptr->local_para_ptr = (local_para_struct*) local_data;
ilm_ptr->peer_buff_ptr = NULL;
SEND_ILM(MOD_MMI, MOD_L4C, MMI_L4C_SAP, ilm_ptr);
}
/*****************************************************************************
* FUNCTION
* L4GetClockTimeRSP
* DESCRIPTION
* This function is to receive the clock response.
* PARAMETERS
* buf [?]
* a(?) [IN] Buf
* RETURNS
* void
*****************************************************************************/
void L4GetClockTimeRSP(void *buf)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (get_clocktime_callback_func != NULL)
{
get_clocktime_callback_func(buf);
}
}
/*****************************************************************************
* FUNCTION
* L4InitTimer
* DESCRIPTION
* This function is to init the timer while task create.
* PARAMETERS
* void
* a(?) [IN] Void
* RETURNS
* void
*****************************************************************************/
void L4InitTimer(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
TIMERTABLE *p;
TIMERTABLE *pp;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Try to free TIMERTABLE list exclude g_timer_table */
p = g_timer_table.next;
pp = NULL;
do
{
if (p != NULL)
{
pp = p->next;
OslMfree(p);
}
p = pp;
} while (p != NULL);
/* reset g_timer_talbe */
memset(&g_timer_table, 0, sizeof(TIMERTABLE));
g_timer_table_size = SIMULTANEOUS_TIMER_NUM;
g_timer_table_used = 0;
/* Initiate the clock time callback function. */
get_clocktime_callback_func = NULL;
set_clocktime_callback_func = NULL;
/* Initate the no alignment stack timer */
stack_init_timer(&base_timer1, "MMI_Base_Timer1", MOD_MMI);
/* Create a no alignment timer schedule */
event_scheduler1_ptr = new_evshed(
&base_timer1,
L4StartBaseTimer,
L4StopBaseTimer,
0,
kal_evshed_get_mem,
kal_evshed_free_mem,
0);
/* Initate the alignment stack timer */
stack_init_timer(&base_timer2, "MMI_Base_Timer2", MOD_MMI);
/* Create an alignment timer schedule */
event_scheduler2_ptr = new_evshed(
&base_timer2,
L4StartBaseTimer,
L4StopBaseTimer,
0,
kal_evshed_get_mem,
kal_evshed_free_mem,
254);
#ifdef __MMI_FRM_TIMER_UNIT_TEST__
mmi_frm_ut_timer();
#endif /* __MMI_FRM_TIMER_UNIT_TEST__ */
}
/*****************************************************************************
* FUNCTION
* L4StopBaseTimer
* DESCRIPTION
* This function is to assign the stop timer base.
* PARAMETERS
* base_timer_ptr [?]
* a(?) [IN] Base_timer_ptr
* RETURNS
* void
*****************************************************************************/
void L4StopBaseTimer(void *base_timer_ptr)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
stack_stop_timer((stack_timer_struct*) base_timer_ptr);
}
/*****************************************************************************
* FUNCTION
* L4StartBaseTimer
* DESCRIPTION
* This function is to assign the start timer base.
* PARAMETERS
* base_timer_ptr [?]
* time_out [IN]
* a(?) [IN] Base_timer_ptr
* b(?) [IN] Time_out
* RETURNS
* void
*****************************************************************************/
void L4StartBaseTimer(void *base_timer_ptr, unsigned int time_out)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
stack_start_timer((stack_timer_struct*) base_timer_ptr, 0, time_out);
}
/*****************************************************************************
* FUNCTION
* L4CallBackTimer
* DESCRIPTION
* This function is to execute the timer expire.
* PARAMETERS
* p [?]
* a(?) [IN] P
* RETURNS
* void
*****************************************************************************/
void L4CallBackTimer(void *p)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 nTimerId = (U32) p;
TIMERTABLE *pTable = &g_timer_table;
U32 i = 0;
oslTimerFuncPtr pTimerExpiry = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_ASSERT(nTimerId < MAX_TIMERS);
/* find the nTimerId in TIMERTABLE list */
do
{
/* MSB(Most Significant Bit) of timer_id[i] is align_timer_mask */
if ((pTable->timer_id[i] & (~NO_ALIGNMENT_TIMER_MASK)) == (U16) nTimerId)
{
/* find out nTimerId */
if (pTable->callback_func[i] != NULL)
{
pTimerExpiry = pTable->callback_func[i];
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_L4DRV_CBTIMER_HDLR, nTimerId, pTimerExpiry));
g_timer_table_used--;
pTable->event_id[i] = 0;
pTable->timer_id[i] = 0;
pTable->callback_func[i] = NULL;
/*
* we process g_timer_table_used, event_id and timer_id ... first
* because the user may call stoptimer() in the timer_expiry_func
*/
pTimerExpiry(p);
}
break;
}
i++;
if (i >= SIMULTANEOUS_TIMER_NUM)
{
pTable = pTable->next;
i = 0;
}
} while (pTable != NULL);
/* can't find nTimerId, do nothing */
mmi_frm_fetch_msg_from_extQ_to_circularQ();
/*
* Because we modify MMI process protocol events and key events mechanism,
* we don't need to process key events here.
*/
}
/*****************************************************************************
* FUNCTION
* L4TimerUsePreciseTick
* DESCRIPTION
* Typically we round timer period to multiple of 100ms. However, some timers need to be
* more accurate.
* PARAMETERS
* nTimerId [IN] Timer ID
* RETURNS
* void
*****************************************************************************/
MMI_BOOL L4TimerUsePreciseTick(unsigned short nTimerId)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -