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/TM4C129XNCZAD: NDK Hook form

Part Number: TM4C129XNCZAD

Tool/software: TI-RTOS

Where are the NDK hooks described?

The NDK user Guide says you can use XGCONF to have functions called in response to certain events. The guide claims "Hook functions must be defined using the following format: Void functionName(Void)"

but a few example projects define the IP address hook as void netIPAddrHook(unsigned int IPAddr, unsigned int IfIdx, unsigned int fAdd);

My understanding of the User Guide makes me expect an error because this hook takes arguments. The code works; the function compiles and the arguments are passed.

Where are these hook functions declared? What resource would inform a developer that the first argument of the IP address hook is the IP address? Or do I define this somehow?

  • Hi Peter,

    Does the content in the NDK's cdoc (i.e. C:/ti/tirtos_tivac_2_16_01_14/products/ndk_2_25_00_09/docs/cdoc/index.html) answer your questions? You can find it via the Documentation Overview.

    Then drill down to the Global module.

  • Todd,

    This looks to be a great resource for most of what I need. However in this instance, the html guide says the IP hook "is passed the same arguments passed to NetworkIPAddr(), IPAddr, IfIdx, fAdd"

    Would you happen to know where to find the definition or description of NetworkIPAddr() and it's arguments?

  • I have pieced together everything except IfIdx. It comes from the "Item" variable passed to this function:

    /*-------------------------------------------------------------------------- */
    /* SPIpNet() - CFGTAG_IPNET Service Provider */
    /*-------------------------------------------------------------------------- */
    static int SPIpNet(HANDLE hCfg, uint Tag, uint Item, uint Op, HANDLE hCfgEntry);

    Which further back is the item field of a struct_cfgentry.

    The ultimate goal is understanding. How to move from not knowing the hooks to mastering them. I don't think I need "IfIdx", but I would like to know that for sure.

  • IfIdx is the interface index. So if you only have one Ethernet, the IfIdx is 1.

    It's discussed in the NDK API Reference

    uint IfIdx;
    This is the physical device Index (1 to n) on which the service is to be executed. For example, when
    launching a DHCP server service, the physical interface is that connected to the home network. For
    more generic services (like Telnet), the service can be launched by a pre-defined IP address (or
    INADDR_ANY as a wildcard). When launching by IP address only, this field is left NULL. If the field is
    valid, the CIS_FLG_IFIDXVALID flag should be set in Mode.