28
Real-Time Embedded Real-Time Embedded Multithreading, Usin Multithreading, Usin g ThreadX and ARM g ThreadX and ARM ~Chapter9~ ~Chapter9~ 學學 學學 : : 學學學 學學學 學學學學 學學學學 : : 學學學 學學學

Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

  • View
    278

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Real-Time EmbeddedReal-Time EmbeddedMultithreading, Using ThreaMultithreading, Using Threa

dX and ARMdX and ARM~Chapter9~~Chapter9~

學生 學生 : : 曾楓喬曾楓喬指導教授 指導教授 : : 張軒彬張軒彬

Page 2: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

OUTLINEOUTLINE IntroductionIntroduction Internal System Clock ServicesInternal System Clock Services Summary of Application Timer ServicesSummary of Application Timer Services Application Timer Control BlockApplication Timer Control Block Creating an Application TimerCreating an Application Timer Activating an Application TimerActivating an Application Timer Deactivating an Application TimerDeactivating an Application Timer Changing an Application TimerChanging an Application Timer Deleting an Application TimerDeleting an Application Timer Retrieving Application Timer InformationRetrieving Application Timer Information Sample System Using Timers to Measure Thread PerformanceSample System Using Timers to Measure Thread Performance Application Timer InternalsApplication Timer Internals

Page 3: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

IntroductionIntroduction

Timer kindsTimer kindsone-shot timerone-shot timer

periodic timerperiodic timer

Each timer interrupt is called a timer-tick.Each timer interrupt is called a timer-tick. To avoid using timers that expire every timer-tick.To avoid using timers that expire every timer-tick.

Page 4: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Internal System Clock ServicesInternal System Clock Services

ThreadX provides a single continuously increThreadX provides a single continuously incrementing 32-bit tick counter.menting 32-bit tick counter.

ThreadX sets the internal system clock to zero ThreadX sets the internal system clock to zero during application initialization ,and each timeduring application initialization ,and each timer-tick increases the clock by one.r-tick increases the clock by one.

Two servicesTwo servicestx_time_gettx_time_gettx_time_settx_time_set

Page 5: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Internal System Clock Services(conInternal System Clock Services(cont.)t.)

tx_time_gettx_time_getRetrieving the current tiRetrieving the current time from the internal systme from the internal system clock. em clock.

Page 6: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Internal System Clock Services(conInternal System Clock Services(cont.)t.)

tx_time_gettx_time_get

Page 7: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Internal System Clock Services(conInternal System Clock Services(cont.)t.)

tx_time_settx_time_setSetting the current time oSetting the current time of the internal system clocf the internal system clock to some specified value.k to some specified value.

Page 8: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Summary of Application Timer Summary of Application Timer ServicesServices

Page 9: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Application Timer Control BlockApplication Timer Control Block

The characteristics of each application timer arThe characteristics of each application timer are found in its Application Timer Control Block.e found in its Application Timer Control Block.

ThreadX prohibits an application from modifyiThreadX prohibits an application from modifying the Application Timer Control Block.ng the Application Timer Control Block.

Page 10: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Application Timer Control Block(coApplication Timer Control Block(cont.)nt.)

Page 11: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Application Timer Control Block(coApplication Timer Control Block(cont.)nt.)

Page 12: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Creating an Application TimerCreating an Application Timer

tx_timer_createtx_timer_create The range of values for tThe range of values for t

he initial number of timhe initial number of timer-ticks is from 1 to 0xFer-ticks is from 1 to 0xFFFFFFFFFFFFFFF

For subsequent time tiFor subsequent time timer-ticks ,the range of vmer-ticks ,the range of values is from 0 to 0xFFFalues is from 0 to 0xFFFFFFFF FFFFF

Page 13: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Activating an Application TimerActivating an Application Timer

tx_timer_activatetx_timer_activate

Page 14: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Activating an Application Timer(conActivating an Application Timer(cont.)t.)

Page 15: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Deactivating an Application TimerDeactivating an Application Timer

tx_timer_deactivatetx_timer_deactivate

Page 16: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Changing an Application TimerChanging an Application Timer

tx_timer_changetx_timer_change Changing the initial number of timer-ticks and Changing the initial number of timer-ticks and

the number of timer-ticks for all timer expiratithe number of timer-ticks for all timer expirations after the first.ons after the first.

Page 17: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Deleting an Application TimerDeleting an Application Timer

tx_timer_deletetx_timer_delete

Page 18: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Deleting an Application Timer(cont.)Deleting an Application Timer(cont.)

Page 19: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Retrieving Application Timer Retrieving Application Timer InformationInformation

tx_timer_info_gettx_timer_info_get

Page 20: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Sample System Using Timers to Sample System Using Timers to Measure Thread PerformanceMeasure Thread Performance

Page 21: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Sample System Using Timers to MeaSample System Using Timers to Measure Thread Performance(cont.)sure Thread Performance(cont.)

Page 22: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Sample System Using Timers to MeaSample System Using Timers to Measure Thread Performance(cont.)sure Thread Performance(cont.)

Page 23: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Sample System Using Timers to MeaSample System Using Timers to Measure Thread Performance(cont.)sure Thread Performance(cont.)

Page 24: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Sample System Using Timers to MeaSample System Using Timers to Measure Thread Performance(cont.)sure Thread Performance(cont.)

Page 25: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Sample System Using Timers to MeaSample System Using Timers to Measure Thread Performance(cont.)sure Thread Performance(cont.)

Page 26: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Sample System Using Timers to MeaSample System Using Timers to Measure Thread Performance(cont.)sure Thread Performance(cont.)

Page 27: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

Application Timer InternalsApplication Timer Internals

Page 28: Real-Time Embedded Multithreading, Using ThreadX and ARM ~Chapter9~ 學生 : 曾楓喬 指導教授 : 張軒彬

THE ENDTHE END