Forum Discussion

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

Interrupt processing with uC-OS II

Hai to all niosforum readres

My question is how to write the interrupt service routine ( example for the PIO BUTTONS ) with uC OS II ???????????????

The NIOSII development Kit, has a example for processing interrupts with the NIOSII API.

But how It works with uC-OCII?????

thanks for advices http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif

3 Replies

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

    hi,

    see the count_binary example for simple PIO.Also,if u want to do it with MicroC/OS-II,u read the simple_socket_server example throughly,everything is given in it.It is slightly difficult,but u have to do it.

    all the best

    bye

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

    Also, make sure that you have the correct version of the Nios II kit. The free evaluation version, which you can download from the Altera website, does not contain the MicroC/OS-II component.

    Many users have been frustrated by not knowing this was the case, so I thought that I&#39;d bring it up if it were your problem.

    -c

    --- Quote Start ---

    originally posted by maki@Jun 7 2006, 05:49 AM

    hai to all niosforum readres

    my question is how to write the interrupt service routine ( example for the pio buttons ) with uc os ii ???????????????

    the niosii development kit, has a example for processing interrupts with the niosii api.

    but how it works with uc-ocii?????

    thanks for advices http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/sad.gif

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=15992)

    --- quote end ---

    --- Quote End ---

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

    It depends on you hwo you design it.

    I wrote a own interrupt function for a CAN device.

    I used MicroC/OS-2 Event Flags to communicate between interrupt function and the normal program flow.

    Interrupt Registration absolute normal

    alt_irq_register(CAN_1_IRQ,

    NULL,

    local_my_avalon_can_advanced_isr);

    ISR:

    extern "C" // wegen ISR ...... // i use C++

    {

    static void local_my_avalon_can_advanced_isr

    (

    void * context, // Dummies - ignore

    alt_u32 id // Dummies - ignore

    )

    {

    ..... // do something

    OSFlagPost(CAN_local_CAN_Event, // event flag group

    proc_os_can_flags, // flags according to the result of do something

    OS_FLAG_SET,

    &proc_u8_error);

    }

    Function that waits for CAN Stuff:

    void class_can_system::my_avalon_can_handler

    (

    void

    )

    {

    ... /// do some init stuff

    for(;;)

    {

    proc_os_can_flags = OSFlagPend(CAN_local_CAN_Event,

    L_CAN_ALL_EVENT,

    OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME,

    L_WAIT_FOR_EVER,

    &proc_u8_error);

    switch(proc_u8_error)

    {

    case OS_NO_ERR:

    // do normal flag handling

    break;

    case OS_ERR_PEND_ISR:

    ..... and other errors - do some error handling

    }

    }

    }

    regards

    Karsten