e2studio FSPの機能を使用したISRの使用方法

お世話になります。TNと申します。

ご教授お願いします。

 

 

【問い合わせ内容】

RAマイコン、RTOS、e2studioを使用し、AGTタイマー割り込み(void i_agt_int_user(void))からタスクのサスペンドを解除

したいのですが、以下のコードでは解除されません。

コード生成(タスクやハードの設定)はFSP configrationの機能を使用し、 i_agt_int_user(void)はintrrupts configrationで設定しています。

設定方法に問題があるのか、APIの使用方法に問題があるのかわかりません。

割り込みからのサスペンド解除を行う設定と、方法をお教え願いないでしょうか

よろしくお願いします。

 

 

extern TaskHandle_t new_thread0;

// タスク処理

void new_thread0_entry(void *pvParameters)
{
   FSP_PARAMETER_NOT_USED (pvParameters);

  volatile int debug;

  R_AGT_Open(&g_timer0_ctrl, &g_timer0_cfg);
  R_AGT_Start(&g_timer0_ctrl);

  /* TODO: add your own code here */
  while (1)
  {
    vTaskSuspend(NULL);
    debug=0;

  }
}

 

// 割り込み処理

void i_agt_int_user(void)
{
  BaseType_t ret = pdFALSE;

  ret = xTaskResumeFromISR(new_thread0);

  portYIELD_FROM_ISR(pdTRUE);
}

Parents
  • TNさん、こんにちは。NoMaYです。

    ちなみに、ヘッダファイルに以下の記載がありましたので、このAPIは充分に注意して使う必要があるようです。

    /**
     * task. h
     * <pre>
     * void xTaskResumeFromISR( TaskHandle_t xTaskToResume );
     * </pre>
     *
     * INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be
     * available.  See the configuration section for more information.
     *
     * An implementation of vTaskResume() that can be called from within an ISR.
     *
     * A task that has been suspended by one or more calls to vTaskSuspend ()
     * will be made available for running again by a single call to
     * xTaskResumeFromISR ().
     *
     * xTaskResumeFromISR() should not be used to synchronise a task with an
     * interrupt if there is a chance that the interrupt could arrive prior to the
     * task being suspended - as this can lead to interrupts being missed. Use of a
     * semaphore as a synchronisation mechanism would avoid this eventuality.
     *
     * @param xTaskToResume Handle to the task being readied.
     *
     * @return pdTRUE if resuming the task should result in a context switch,
     * otherwise pdFALSE. This is used by the ISR to determine if a context switch
     * may be required following the ISR.
     *
     * \defgroup vTaskResumeFromISR vTaskResumeFromISR
     * \ingroup TaskCtrl
     */
    BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;

     

Reply
  • TNさん、こんにちは。NoMaYです。

    ちなみに、ヘッダファイルに以下の記載がありましたので、このAPIは充分に注意して使う必要があるようです。

    /**
     * task. h
     * <pre>
     * void xTaskResumeFromISR( TaskHandle_t xTaskToResume );
     * </pre>
     *
     * INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be
     * available.  See the configuration section for more information.
     *
     * An implementation of vTaskResume() that can be called from within an ISR.
     *
     * A task that has been suspended by one or more calls to vTaskSuspend ()
     * will be made available for running again by a single call to
     * xTaskResumeFromISR ().
     *
     * xTaskResumeFromISR() should not be used to synchronise a task with an
     * interrupt if there is a chance that the interrupt could arrive prior to the
     * task being suspended - as this can lead to interrupts being missed. Use of a
     * semaphore as a synchronisation mechanism would avoid this eventuality.
     *
     * @param xTaskToResume Handle to the task being readied.
     *
     * @return pdTRUE if resuming the task should result in a context switch,
     * otherwise pdFALSE. This is used by the ISR to determine if a context switch
     * may be required following the ISR.
     *
     * \defgroup vTaskResumeFromISR vTaskResumeFromISR
     * \ingroup TaskCtrl
     */
    BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;

     

Children
No Data