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.

RTOS/TDA2E: Doubt regarding calling NC_NetStop

Part Number: TDA2E


Tool/software: TI-RTOS

Hi,

We are using XGCONF tool to configure the ndk to give network functionality to our application that is running on tda2xx.

I have one doubt regarding calling NC_NetStop.

There is function ti_ndk_config_Global_stackThread in generated .c file.In that NC_NetStart is called 

and at exit 

exit:
NC_SystemClose();

NC_SystemClose is called.I have doubts:

1.Will NC_SystemClose shuts down the network stack or we have to call NC_NetStop in netCloseHook function in order to close the network stack gracefully.

2.If we have to call manually NC_NetStop then what is the functionality of NC_SystemClose.

3.If we don't call NC_NetStop in netCloseHook will it lead to undefined behaviour in the long run i.e a15 core getting reset or hanged when we run the application for close to a week.

Regards

Mayank

  • Another doubt related to above:

    In one of e2e post it is mentioned like that:
    NC_NetStop() simply sets a global flag to true. This flag is checked in the network scheduler - which runs in task - in a while loop. The flag won't be checked until the net scheduler task runs again. Since you are calling BIOS_exit, this never happens - the net scheduler will never run again.

    So does the above means we should run the netscheduler task again to effect change of NC_NetStop.Does the below function has anything to do with BIOS_start/BIOS_exit:

    xdc_runtime_System_flush();

    Regards
    Mayank
  • Hi Mayank,

    Mayank Agarwal said:

    1.Will NC_SystemClose shuts down the network stack or we have to call NC_NetStop in netCloseHook function in order to close the network stack gracefully.

    To shutdown the network stack you need only call NC_NetStop() from your application.  NC_SystemClose() & the netCloseHook functions are called as part of the shutdown process.

    Mayank Agarwal said:

    2.If we have to call manually NC_NetStop then what is the functionality of NC_SystemClose.

    NC_SystemClose() just performs some additional stack clean up.  You should not be calling this directly as it is part of the shutdown procedure.

    Mayank Agarwal said:

    3.If we don't call NC_NetStop in netCloseHook will it lead to undefined behaviour in the long run i.e a15 core getting reset or hanged when we run the application for close to a week.

    NC_NetStop() should be called from your application to shutdown the stack; it should not be in the netCloseHook.  The netCloseHook is to allow you to add functions which will be executed when the stack is shutdown.

    Regards,

    -- Emmanuel

  • Hi Mayank,

    Mayank Agarwal said:
    Another doubt related to above:
    So does the above means we should run the netscheduler task again to effect change of NC_NetStop.Does the below function has anything to do with BIOS_start/BIOS_exit:

    xdc_runtime_System_flush();

    BIOS_exit() terminates the kernel & all scheduling activities.  The processor will then be halted on a break point or spin forever (depending on what you configured in the *.cfg file).  Once this function is called all OS objects (tasks, swis, hwis, etc) are irrelevant because the kernel is no longer operating.  To get the kernel going again you would need to reset your processors & restart your application.

    NC_NetStop() API sets a flag which will inform the stack that it needs to shut itself down.  This means that the network task needs to run again so that it can shutdown & clean up after itself.  If you call NS_NetStop() & BIOS_exit() immediately after, the network task will likely not run & not clean up; this is irrelevant however because BIOS_exit() will terminate the kernel.

    xdc_runtime_System_flush() just ensures all System content is flushed out (possibly to a console window).

    Hope this helps,

    -- Emmanuel