Where is the PRIO ?

Discussions and support about ChibiOS/RT, the free embedded RTOS.
alexblack
Posts: 267
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 30 times
Contact:

Where is the PRIO ?

Postby alexblack » Fri May 28, 2021 3:40 pm

Hi.
Some time ago I used SystemView from SEGGER and made some code for it to support the ChibiOS.
Now this code do not compile because I used the member "prio" from struct "ch_thread". But now there is no it.
The code for SystemView was:

Code: Select all

/**
 * @brief   Context switch hook.
 * @details This hook is invoked just before switching between threads.
 */
#if SYSVIEW_ENABLE == 1
#if SYSVIEW_CFG_HIDE_IDLE == TRUE
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
  /* Context switch code here.*/                                            \
  if (otp->prio != IDLEPRIO)                                                \
  {                                                                         \
    SEGGER_SYSVIEW_OnTaskStopExec();                                        \
  }                                                                         \
  if (ntp->prio == IDLEPRIO)                                                \
  {                                                                         \
    SEGGER_SYSVIEW_OnIdle();                                                \
  } else                                                                    \
  {                                                                         \
    SEGGER_SYSVIEW_OnTaskStartExec((unsigned)ntp);                          \
  }                                                                         \
}
#else
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
  /* Context switch code here.*/                                            \
  SEGGER_SYSVIEW_OnTaskStopExec();                                          \
  SEGGER_SYSVIEW_OnTaskStartExec((unsigned)ntp);                            \
}
#endif

In this hook we decied what kind of the CONTEXT switch was heppen and call the desired functions from SystemView for that.
and else

Code: Select all

 /* Scanning registry.*/
  syssts_t sts = chSysGetStatusAndLockX();
  ctp = ch.rlist.newer;
  chSysRestoreStatusX(sts);
  do {
    /* Exclude IDLE THREAD from list */
    #if SYSVIEW_CFG_HIDE_IDLE == TRUE
    if (ctp->prio != IDLEPRIO)
    #endif
    {

In this code we produce the list of all threads exclude idle thread.

Please help. How can I implement this code in new version of the ChibiOS? In older versions it work very well and was very helpfull.

User avatar
Giovanni
Site Admin
Posts: 13629
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 888 times
Been thanked: 769 times
Contact:

Re: Where is the PRIO ?

Postby Giovanni » Fri May 28, 2021 3:44 pm

Hi,

Just replace the expression "->prio" with "->hdr.pqueue.prio".

Giovanni

alexblack
Posts: 267
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 30 times
Contact:

Re: Where is the PRIO ?

Postby alexblack » Fri May 28, 2021 3:48 pm

Thank you. I will try.


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 3 guests