Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

macro for detecting OS presence

Hi,

I am writing a driver for my 1-wire (onewire) master RTL, and I would like to write the driver so that it would with or without the OS. But the ISR implementation depends on the availability of flags and semaphores.

Is there a macro I could check to switch between two ISR implementations, something like:

# ifdef UCOSII
  // ISR implementation using flags and semaphores# else
  // ISR implementation using global volatile variables and polling# endif

Regards,

Iztok Jeras

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you use Nios IDE 9.0sp2 you can simply use:

    # ifdef UCOS_II ...

    I don't know the same define applies to other tools versions, too.

    Cris
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I opened the source of the OpenCores eth_ocm components and it seems there is a macro named UCOS_II, I will try it and see.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I compiled the uCOS-II hello world and tested for the presence of UCOS_II, and I was not able to find it. So it seems there is no such macro in version 9.1sp2 of the Nios II EDS. I implemented the code differently.

    Iztok Jeras