This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Could you give an example on using "Notify_E_ALREADYEXISTS"?

Hi,

I read the following below the dot line on Notify_registerEvent(). I do not understand how to use  Notify_E_ALREADYEXISTS. " Notify_E_ALREADYEXISTS " is an enum? I cannot see that enum definition yet.

the varible returned by Notify_registerEvent may equal " Notify_E_ALREADYEXISTS "?

Could you give me a simple example on using " Notify_E_ALREADYEXISTS "?

 

Thanks.

 

 

 

 

 

.......................

The Notify_registerEvent() function (like most other Notify APIs) uses a

ti.sdo.utils.MultiProc ID and line ID to target a specific interrupt line

to/from a specific processor on a device.

Int status;

armProcId = MultiProc_getId("ARM");

Ipc_start();

/* Register cbFxn with Notify. It will be called when ARM

* sends event number EVENTID to line #0 on this processor.

* The argument 0x1010 is passed to the callback function. */

status =Notify_registerEvent(armProcId, 0, EVENTID,

(Notify_FnNotifyCbck)cbFxn, 0x1010);

if (status < 0) {

System_abort("Notify_registerEvent failed\n");

}

The line ID number is typically 0 (zero), but is provided for use on systems

that have multiple interrupt lines between processors.

When using Notify_registerEvent(), multiple callbacks may be registered

with a single event. If you plan to register only one callback function for

an event on this processor, you can call Notify_registerEventSingle()

instead of Notify_registerEvent(). Better performance is provided with

Notify_registerEventSingle(), and a Notify_E_ALREADYEXISTS status

is returned if you try to register a second callback for the same event.

  • Hi,

    The previous post should be:

    /////////////////////////

    I read the following below the dot line on Notify_registerEvent(). I do not understand how to use  Notify_E_ALREADYEXISTS. "

    The varible returned by Notify_registerEventSingle may equal " Notify_E_ALREADYEXISTS "?

    Could you give me a simple example on using " Notify_E_ALREADYEXISTS "?

    Please see the second Notify_registerEventSingle function call, like this:

    status1 =Notify_registerEventSingle(armProcId, 0, EVENTID, (Notify_FnNotifyCbck)cbFxn1, 0x1010);

    status1 will be " Notify_E_ALREADYEXISTS "?

    ///////////////////////

     

    Int status;

    armProcId = MultiProc_getId("ARM");

    Ipc_start();

    /* Register cbFxn with Notify. It will be called when ARM

    * sends event number EVENTID to line #0 on this processor.

    * The argument 0x1010 is passed to the callback function. */

    status =Notify_registerEventSingle(armProcId, 0, EVENTID, (Notify_FnNotifyCbck)cbFxn, 0x1010);

    status1 =Notify_registerEventSingle(armProcId, 0, EVENTID, (Notify_FnNotifyCbck)cbFxn1, 0x1010);

    if (status < 0) {System_abort("Notify_registerEvent failed\n");}


     

    Thanks.

  • Hi,

    If you look at Notify.h, you can see :

    /*!
     *  @def    Notify_E_ALREADYEXISTS
     *  @brief  The specified entity already exists.
     */
    #define Notify_E_ALREADYEXISTS          -4

    It is an error code which can be return by Notify_registerEventSingle(). It is just a negative number.

    Since its value is < 0, this error is handle by "if (status < 0)"

    If you want to "use" it, you can do :

    status = Notify_registerEventSingle(armProcId, 0, EVENTID, (Notify_FnNotifyCbck)cbFxn, 0x1010); // first call to registerEventSingle to register cbFxn

    if (status < 0) {

       System_abort("Notify_registerEvent failed\n");

    }

    status = Notify_registerEventSingle(armProcId, 0, EVENTID, (Notify_FnNotifyCbck)cbFxn2, 0x1010); // second call to registerEventSingle to register cbFxn2

    if (status == Notify_E_ALREADYEXISTS) { // must be true because we already register an event

       printf("status == Notify_E_ALREADYEXISTS");

    }

    But you may handle with error like any other error with "if (status < 0)"


  • I wonder whether the definition " Notify_E_ALREADYEXISTS " is for dynamically call Notify_registerEventSingle()? Statically there should be only one return status value of Notify_registerEventSingle() is valid. Am I right?

     

    Thanks.

  • When Notify_registerEventSingle() returns Notify_E_ALREADYEXISTS, there is an error.

    If Notify_registerEventSingle() worked, the value is >=0

    If there is a problem, the return value is < 0. Then, if you want to know which error occured, you can read this value, and find what it means in Notify.h

    For exemple, if the return value is -4, this is a Notify_E_ALREADYEXISTS error (because you already registered an event with Notify_registerEventSingle )

    I never tried to configure registerEvent statically (you mean, in the .cfg ?), so I can't say anything about that.