Call-back Functions for MQX Idle Task and SysTick

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Call-back Functions for MQX Idle Task and SysTick

1,670 Views
Vagni
Contributor IV

I think it could be very usefull for a MQX-based application to have a user call-back function available both for the Idle Task and the SysTick timer interrupt.

With a call-back function (hook function), called during each cycle of the Idle Task, the application could execute some lowest-priority processes (it is common to use the idle hook function to place the microcontroller CPU into a power saving mode or just to calculate the CPU time).

In the same way, a SysTick hook function, called from the MQX tick timer interrupt, could provide a convenient place to implement timer functionalities with SysTick resolution.

What do you think about it?

0 Kudos
Reply
1 Reply

651 Views
MarkP_
Contributor V

Hi Alessandro,
actually both are already implemented into MQX:
1)idletask calculates idle time.
  Found in PSP Generic->kernel->idletask.c.
  Unfortunatelly IDLE_LOOPx variables are not visible to application tasks.
  I created an extra function into PSP to return those (in MQX3.8).
  How MQX team has designed to use IDLE_LOOPx-variables?

2)lwtimer can be used for tick based timer functions.
  Found in PSP Generic->lwtimer.
  In one earlier project I changed tick to 1ms and created lw-timer for that 1 ms. Worked fine.
  Kernel calls lwtimer-"ISR" from PSP Generic->kernel->ti_krnl.c
  at function _time_notify_kernel():
  #if MQX_USE_LWTIMER
   /* If the lwtimer needs servicing, call its ISR function */
   if (kernel_data->LWTIMER_ISR != NULL) {
      (*kernel_data->LWTIMER_ISR)();
   }/* Endif */
  #endif

~Mark

0 Kudos
Reply