MTKPlatformTimerMessage Processing Mechanism is the content to be introduced in this article, mainly to understand and learnMTKMediumTimerFor more information, see the implementation of the specific content.
Send timer messages
(1). Steps
StartTimer-> L4StartTimer
(2). Two types of Timer
MTKThere are two types of Timer
A. NO_ALIGNMENT
Non-queue type, that is, the timer that requires immediate execution. When the time is reached, the timer is automatically reset.
B. ALIGNMENT
Queue type, that is, the timer with a certain latency tolerance can be operated through the queue. y
The basic execution process is: Execution timer --> timeout? --> Save timerid and eventid -- timerstop | noevent? ----> END;
- |YN|
-
- ||
-
- ----------------------------------------------------------
C. In addition to touch screen and handwriting, the timer in other cases is generally queue-type.
(3). Functions of L4StartTimer
Determine the ID of the timer to be sent, and pass it to different queue structures (event_sheduler1/event_sheduler2) based on the queue type );
(4). TimerExpiry
This is the callback function passed to L4StartTimer as a parameter. Because MTK is encapsulated, the internal callback trigger process is specific.
I cannot know, but according to the speculation, it should be at the scheduled time, send the message in the form of interruption (MSG_ID_TIMER_EXPIRY), and write it to the MMI loop queue.
This function may be called in L4CallBackTimer. The functions of L4CallBackTimer are as follows:
A. Reset the currentTimerInformation Structure (mmi_frm_timer_type );
B. Execute the timer-to-point execution function (TimerExpiry );
C. Write the Timer message to the MMI cyclic queue.
StopTimer corresponding to StartTimer
(1). Call the L4StopTimer operation.
(2) Purpose: Find the position of the specified timer ID in the queue, and then delete the specified timer node from the queue using evshed_cancel_event.
Processing of timer messages
(1). Steps
...-> Create MMITask-> set the MMITask entry function-> call EvshedMMITimerHandler
(2). evshed_timer_handler ()-> process specific timer events
Simple AnalysisMTK TimerMessage events are a lot of errors due to simple analysis. If you forget to forgive me, you will not be right.
MTK timer message processorSystem
I. Basic Concepts and Neclus kernel timer Initialization
Expires: specifies the time when the timer expires. This time is expressed as the number of clock tick times since the system starts ). When the expires value of a timer is smaller than or equal to the jiffies variable, we will say that the timer has timed out or expired. After a timer is initialized, The expires field is usually set to the current value of the current expires variable plus a time interval value, which is counted by the number of times the clock is ticking.
- typedefstructtimertable
- {/*storethetimer_id.MSB(MostSignificantBit)isalign_timer_mask*/
- U16timer_id[SIMULTANEOUS_TIMER_NUM];
- /*storetheevent_idthatreturnsfromevshed_set_event()*/
- eventidevent_id[SIMULTANEOUS_TIMER_NUM];
- /*storethetimer_expiry_func*/
- oslTimerFuncPtrcallback_func[SIMULTANEOUS_TIMER_NUM];
- /*pointtothenextTIMERTABLEdata*/
- structtimertable*next;
- }TIMERTABLE;
- typedeflcd_dll_node*eventid;
- structlcd_dll_node{
- void*data;
- lcd_dll_node*prev;
- lcd_dll_node*next;
- };
1) timer_id: a maximum of 12 timer IDs.
2) two-way linked list element event_id: used to separate multipleTimerThe scheduling action is connected to a two-way cyclic queue.
3) function pointer callback_func: points to an executable function. When the timer expires, the kernel executes the function specified by the function to generate the expires message.
- //L4initthetimer
- /*****************************************************************************
- *FUNCTION
- *L4InitTimer
- *DESCRIPTION
- *Thisfunctionistoinitthetimerwhiletaskcreate.
- *
- *PARAMETERS
- *aINvoid
- *RETURNS
- *VOID.
- *GLOBALSAFFECTED
- *external_global
- *****************************************************************************/
- voidL4InitTimer(void)
- {
- /*----------------------------------------------------------------*/
- /*LocalVariables*/
- /*----------------------------------------------------------------*/
- TIMERTABLE*p;
- TIMERTABLE*pp;
- /*----------------------------------------------------------------*/
- /*CodeBody*/
- /*----------------------------------------------------------------*/
- /*TrytofreeTIMERTABLElistexcludeg_timer_table*/
- p=g_timer_table.next;
- pp=NULL;
- do
- {
- if(p!=NULL)
- {
- ppp=p->next;
- OslMfree(p);
- }
- p=pp;
- }while(p!=NULL);
- /*resetg_timer_talbe*/
- memset(&g_timer_table,0,sizeof(TIMERTABLE));
- g_timer_table_size=SIMULTANEOUS_TIMER_NUM;
- g_timer_table_used=0;
- /*Initiatetheclocktimecallbackfunction.*/
- get_clocktime_callback_func=NULL;
- set_clocktime_callback_func=NULL;
- /*Initatethenoalignmentstacktimer*/
- stack_init_timer(&base_timer1,"MMI_Base_Timer1",MOD_MMI);
- /*Createanoalignmenttimerschedule*/
- event_scheduler1_ptr=new_evshed(&base_timer1,
- L4StartBaseTimer,L4StopBaseTimer,
- 0,kal_evshed_get_mem,kal_evshed_free_mem,0);
- /*Initatethealignmentstacktimer*/
- stack_init_timer(&base_timer2,"MMI_Base_Timer2",MOD_MMI);
- /*Createanalignmenttimerschedule*/
- event_scheduler2_ptr=new_evshed(&base_timer2,
- L4StartBaseTimer,L4StopBaseTimer,
- 0,kal_evshed_get_mem,kal_evshed_free_mem,255);
- }
- typedefstructstack_timer_struct_t{
- module_typedest_mod_id;
- kal_timeridkal_timer_id;
- kal_uint16timer_indx;
- stack_timer_status_typetimer_status;
- kal_uint8invalid_time_out_count;
- }stack_timer_struct;
- /*************************************************************************
- *ExportedFunctionPrototypes
- *************************************************************************/
- /*
- *Important:
- *Currentimplementationmax_delay_ticks_disibledevent="text-indent:24pt;line-height:150%"align="left">
Summary:
MTKPlatformTimerThe content of the message processing mechanism has been introduced. I hope this article will help you!