Calling VDK_PendSemaphore from ISR

I have an application which is having atleast 3 tasks and use a common semaphore. 

In one case, the semaphore is posted from ISR to a thread and I understand I have to use C_ISR_PostSemaphore.

Is it possible to use VDK_PendSemaphore in the ISR ??

  • 0
    •  Analog Employees 
    on Jul 30, 2020 10:39 AM 5 months ago


    In a VDK application, user code can execute at different levels – startup, thread level, kernel level, and interrupt level but it is not safe to use all VDK APIs at all levels.Some VDK API's are restricted as to when they can be used, anything from Thread Level, Kernel Level, ISR Level and Startup.

    Please note that it is not safe to use PendSemaphore() API at ISR level.

    We recommend to refer the Chapter 5 "VDK API Reference" in the below linked VDK Users Guide for details of the API restrictions.There is a section in this chapter called "VDK API Validity" which details the validity of calling each VDK API at each of the levels.Please check your ISR to ensure you are not calling any of the restricted VDK API.

    Also note that Interrupt Service Routines (ISRs) must use a different interface, as described in section "Assembly Macros and C/C++ ISR APIs" on page no 5-235 of the above linked VDK Users Guide.The Assembly Macros and C/C++ ISR APIs section clarifies the Assembly and C/C++
    macros and VDK APIs (callable from C/C++ ISRs)that can be called from ISRs.

    Best Regards,

    Santha kumari.K

  • is there a function which gives the status whether a semaphore is in use or not at interrupt level?

Reply Children
  • +1
    •  Analog Employees 
    on Aug 4, 2020 4:18 AM 5 months ago in reply to raviengineer


    You can use VDK state history window to know the thread status.This is available only for DSP executables with VDK support.During execution of a VDK-enabled program, if Full Instrumentation has been specified for the project, thread and event data collect in a history buffer. When you halt a running program, the history buffer data is plotted to the VDK State History window.

    Otherthan that ,the VDK Status window is available when a DSP executable is built with VDK support enabled. When you halt execution of a VDK program, VisualDSP++ reads data for threads, semaphores, events, event bits, device flags, memory pools, and messages and displays the state and status data in this window. If an error is detected from which VDK cannot recover, the VDK Status Window also displays the cause of a kernel panic.Besides history and processor load information, an instrumented build collects statistics for relevant VDK components, such as when a thread was created, last run, the number of times run, and so on. This data is displayed in the Status window and is updated at halt.

    Please refer the topics available in below VisualDSP++ help path for more information.
    Help > Contents > Graphical Environment > VDK > Overview

    Please refer the below chapter in VDK user's guide.
    Help > Contents > Manuals > Software Tool Manuals > VDK manual >VDK (Kernel) User’s Guide > VDK (Kernel) User’s Guide > 4 VDK Data Types > Data Type Descriptions > ThreadStatus

    Also refer the below linked ezone threads.

    Santha kumari.K