1    /*
     2     * Copyright (c) 2012-2019, Texas Instruments Incorporated
     3     * All rights reserved.
     4     *
     5     * Redistribution and use in source and binary forms, with or without
     6     * modification, are permitted provided that the following conditions
     7     * are met:
     8     *
     9     * *  Redistributions of source code must retain the above copyright
    10     *    notice, this list of conditions and the following disclaimer.
    11     *
    12     * *  Redistributions in binary form must reproduce the above copyright
    13     *    notice, this list of conditions and the following disclaimer in the
    14     *    documentation and/or other materials provided with the distribution.
    15     *
    16     * *  Neither the name of Texas Instruments Incorporated nor the names of
    17     *    its contributors may be used to endorse or promote products derived
    18     *    from this software without specific prior written permission.
    19     *
    20     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    21     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    22     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    23     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    24     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    25     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    26     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    27     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    28     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    29     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    30     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    31     * */
    32    /*
    33     *  ======== Global.xdc ========
    34     *  Global module definition file and initial values.
    35     */
    36    
    37    /*!
    38     *  ======== Global ========
    39     *  High level NDK stack configuration and settings.
    40     *
    41     *  The Global module is required to be used by an NDK application.  At
    42     *  minimum, it is used to link in the default flavor of the NDK stack library,
    43     *  as well as the other core libraries, and generates no code.
    44     *
    45     *  However, if the user desires, it may be used to link in libraries,
    46     *  configure global stack settings, and generate NDK C configuration code.
    47     *
    48     *  The following libraries are linked in by default via the Global Module:
    49     *  @p(blist)
    50     *      - stack.lib
    51     *      - console.lib
    52     *      - hdlc.lib
    53     *      - miniPrintf.lib
    54     *      - netctrl.lib
    55     *      - nettool.lib
    56     *      - os.lib
    57     *      - servers.lib
    58     *  @p
    59     *  
    60     *  The user can select which version of "stack.lib" to use via the following
    61     *  configuration parameters:
    62     *  
    63     *  @p(code)
    64     *      config stackLibProtocol stackLibType
    65     *      config IPv6
    66     *  @p
    67     *  
    68     *  stackLibType may be set to the following values. If the configuration
    69     *  parameter 'IPv6' is set to 'true', then this will result in the
    70     *  following IPv6 library selections:
    71     *  
    72     *  @p(blist)
    73     *  - Global.MIN                : stk6.lib
    74     *  - Global.NONE               : stack.lib (default)
    75     *  - Global.NAT                : stk6_nat.lib
    76     *  - Global.NAT_PPP            : stk6_nat_ppp.lib
    77     *  - Global.NAT_PPP_PPPOE      : stk6_nat_ppp_pppoe.lib
    78     *  - Global.PPP                : stk6_ppp.lib
    79     *  - Global.PPP_PPPOE          : stk6_ppp_pppoe.lib
    80     *  @p
    81     *  
    82     *  If the configuration parameter 'IPv6' is set to 'false', then this will
    83     *  result in the following IPv4 library selections:
    84     *  
    85     *  @p(blist)
    86     *  - Global.MIN                : stk.lib
    87     *  - Global.NONE               : stk_ppp_pppoe.lib (default)
    88     *  - Global.NAT                : stk_nat.lib
    89     *  - Global.NAT_PPP            : stk_nat_ppp.lib
    90     *  - Global.NAT_PPP_PPPOE      : stk_nat_ppp_pppoe.lib
    91     *  - Global.PPP                : stk_ppp.lib
    92     *  - Global.PPP_PPPOE          : stk_ppp_pppoe.lib
    93     *  @p
    94     *  
    95     *  In addition to NDK library selection, the Global module may be used to
    96     *  change global configuration settings of the stack.  This includes settings
    97     *  for the:
    98     *  @p(blist)
    99     *       - NDK OSAL
   100     *       - Debug settings
   101     *       - Default stack task priority levels and stack sizes
   102     *       - Priority level and operating mode of the NDK scheduler thread.
   103     *       - Calling user defined hook functions
   104     *       - Enabling or disabling code generation.
   105     *  @p
   106     *  
   107     *  Note that the Global module generates NDK C configuration code in order to
   108     *  manipulate the settings of the above mentioned items.  In order for these
   109     *  settings to take effect, code generation must be enabled in the Global
   110     *  module.
   111     *
   112     *  If the code generation feature is enabled, then it's important to note that
   113     *  the C code for several functions will be created, which may cause a
   114     *  conflict if a program already has defined these functions, and then
   115     *  later enables code generation.  These functions may also be updated
   116     *  with C API calls that will correspond to the RTSC configuration settings
   117     *  that were made.
   118     *  
   119     *  The following list is a list of the C functions that are generated as a
   120     *  result of using the NDK RTSC configuration's code generating feature:
   121     *  @p(blist)
   122     *  - ti_ndk_config_Global_stackThread(): The NDK stack thread function.
   123     *  - NetworkOpen(): function that is called automatically by NC_NetStart().
   124     *  - NetworkClose(): function that is called automatically by NC_NetStart().
   125     *  - NetworkIPAddr(): function that is called automatically by NC_NetStart().
   126     *  - ti_ndk_config_Global_serviceReport(): Service report callback function.
   127     *  @p
   128     *  
   129     *  The NDK RTSC configuration and code generation feature is really intended
   130     *  to be used with a new NDK program, not with an existing one.  For example,
   131     *  if the user has an already existing NDK program, and they wish to change
   132     *  one of the configuration settings to that already existing program, then
   133     *  the NDK RTSC configuration should *not* be used.  If the user were to use
   134     *  the NDK RTSC configuration in this manner, then the resulting program
   135     *  behavior would become unpredictable, due to having multiple NDK stack
   136     *  threads running with different configuration settings.
   137     *  
   138     *  However, one could create a new NDK program that uses the RTSC
   139     *  configuration in order to easily see the C configuration code needed to
   140     *  change a particular stack setting.  This generated C configuration code
   141     *  could then be copied from the new NDK program, and then pasted into the
   142     *  user's existing program to add that setting.
   143     *  
   144     *  User Defined Hook Functions
   145     *
   146     *  Since the NDK stack thread function (as well as the other functions listed
   147     *  above) is generated when using this code generation feature, the user will
   148     *  not be able to directly add custom code into it.  In order to allow this,
   149     *  a set of hook functions are provided.  These hook functions may be called
   150     *  from various places from within the generated code.  The user can define
   151     *  these hook functions as appropriate, and then assign the function names to
   152     *  the Global modules ndkHookFxn configuration parameters.  For each
   153     *  ndkHookFxn configuration paramter that is defined, a call to that
   154     *  function will be added into the generated C code, as described by that
   155     *  ndkHookFxn parameter.  Note that for some of these hook calls will be made
   156     *  with useful parameters in order to pass down information into the user's
   157     *  code (please refer to the hook descriptions for details on arguments
   158     *  passed and prototype signature for these hooks).
   159     *  
   160     *  Note if the user specifies a hook function in the RTSC configuration
   161     *  script, but does not define this function in their C code, a linker error
   162     *  will result.
   163     */  
   164    
   165    @Template("./Global.xdt")
   166    
   167    metaonly module Global {
   168    
   169        /*!
   170         *  ======== NetEventSchedPri ========
   171         *  This defines the legal values for the priority setting for the Network
   172         *  event scheduler task.
   173         */
   174        enum NetEventSchedPri {
   175            NC_PRIORITY_LOW,  /*! Low Priority */
   176            NC_PRIORITY_HIGH  /*! High Priority */
   177        }
   178    
   179        /*!
   180         *  ======== NetEventSchedOp ========
   181         *  This defines the legal values for the operating mode setting for the
   182         *  Network event scheduler task.
   183         */
   184        enum NetEventSchedOp {
   185            NC_OPMODE_POLLING,  /*! Polling Mode */
   186            NC_OPMODE_INTERRUPT /*! Interrupt Mode */
   187        }
   188    
   189        /*!
   190         *  ======== DebugLevel ========
   191         *  This defines the legal values for the severity level of debug messages
   192         *  and debug aborts in the stack.
   193         */
   194        enum DebugLevel {
   195            DBG_INFO = 1,  /*! Information Messages (DBG_INFO)*/
   196            DBG_WARN,  /*! Warning Messages (DBG_WARN)*/
   197            DBG_ERROR, /*! Error Messages (DBG_ERROR)*/
   198            DBG_NONE   /*! No Messages (DBG_NONE)*/
   199        }
   200    
   201        /*!
   202         *  ======== StackLibProtocol ======== 
   203         *  Defines the set of legal stack library types.
   204         */
   205        enum StackLibProtocol {
   206            NONE,
   207            NAT,
   208            NAT_PPP,
   209            NAT_PPP_PPPOE,
   210            PPP,
   211            PPP_PPPOE,
   212            MIN
   213        };
   214    
   215        /*! This data structure is used to add a user account */
   216        struct Account {
   217            String username;
   218            String password;
   219        };
   220    
   221        /*! Array that holds all of the user accounts to be created. */
   222        config Account userAccounts[length] = [];
   223    
   224        /*! Function signature for user defined NDK hook functions */
   225        typedef Void (*ndkHookFxn)();
   226    
   227        /*!
   228         *  ======== StackRunModeFlags ========
   229         *  This defines the legal values for the flags that can be used for setting
   230         *  multiCoreStackRun, which determines the processors for which the stack
   231         *  should run on when multiple cores are present.
   232         */
   233    
   234        /*! Type used to specify bits in mode */
   235        typedef Bits32 StackRunModeFlags;
   236    
   237        const StackRunModeFlags STACKRUN_FLG_CORE_0       = 0x1;
   238        const StackRunModeFlags STACKRUN_FLG_CORE_1       = 0x2;
   239        const StackRunModeFlags STACKRUN_FLG_CORE_2       = 0x4;
   240        const StackRunModeFlags STACKRUN_FLG_CORE_3       = 0x8;
   241        const StackRunModeFlags STACKRUN_FLG_CORE_4       = 0x10;
   242        const StackRunModeFlags STACKRUN_FLG_CORE_5       = 0x20;
   243        const StackRunModeFlags STACKRUN_FLG_CORE_6       = 0x40;
   244        const StackRunModeFlags STACKRUN_FLG_CORE_7       = 0x80;
   245        const StackRunModeFlags STACKRUN_FLG_CORE_8       = 0x100;
   246        const StackRunModeFlags STACKRUN_FLG_CORE_9       = 0x200;
   247        const StackRunModeFlags STACKRUN_FLG_CORE_10      = 0x400;
   248        const StackRunModeFlags STACKRUN_FLG_CORE_11      = 0x800;
   249        const StackRunModeFlags STACKRUN_FLG_CORE_12      = 0x1000;
   250        const StackRunModeFlags STACKRUN_FLG_CORE_13      = 0x2000;
   251        const StackRunModeFlags STACKRUN_FLG_CORE_14      = 0x4000;
   252        const StackRunModeFlags STACKRUN_FLG_CORE_15      = 0x8000;
   253        const StackRunModeFlags STACKRUN_FLG_CORE_16      = 0x10000;
   254        const StackRunModeFlags STACKRUN_FLG_CORE_17      = 0x20000;
   255        const StackRunModeFlags STACKRUN_FLG_CORE_18      = 0x40000;
   256        const StackRunModeFlags STACKRUN_FLG_CORE_19      = 0x80000;
   257        const StackRunModeFlags STACKRUN_FLG_CORE_20      = 0x100000;
   258        const StackRunModeFlags STACKRUN_FLG_CORE_21      = 0x200000;
   259        const StackRunModeFlags STACKRUN_FLG_CORE_22      = 0x400000;
   260        const StackRunModeFlags STACKRUN_FLG_CORE_23      = 0x800000;
   261        const StackRunModeFlags STACKRUN_FLG_CORE_24      = 0x1000000;
   262        const StackRunModeFlags STACKRUN_FLG_CORE_25      = 0x2000000;
   263        const StackRunModeFlags STACKRUN_FLG_CORE_26      = 0x4000000;
   264        const StackRunModeFlags STACKRUN_FLG_CORE_27      = 0x8000000;
   265        const StackRunModeFlags STACKRUN_FLG_CORE_28      = 0x10000000;
   266        const StackRunModeFlags STACKRUN_FLG_CORE_29      = 0x20000000;
   267        const StackRunModeFlags STACKRUN_FLG_CORE_30      = 0x40000000;
   268        const StackRunModeFlags STACKRUN_FLG_CORE_31      = 0x80000000;
   269    
   270        /*!
   271         * Default values
   272         *  @_nodoc
   273         */
   274        const DebugLevel defaultDebugPrintLevel = DBG_INFO;
   275        const DebugLevel defaultDebugAbortLevel = DBG_ERROR;
   276        const Int defaultLowTaskPriLevel  = 3;
   277        const Int defaultNormTaskPriLevel = 5;
   278        const Int defaultHighTaskPriLevel = 7;
   279        const Int defaultKernTaskPriLevel = 9;
   280        const Int defaultLowTaskStackSize  = 3072;
   281        const Int defaultNormTaskStackSize = 4096;
   282        const Int defaultHighTaskStackSize = 5120;
   283        const Int defaultBootTaskStackSize = 2048;
   284        const Int defaultNdkTaskStackSize  = 8192;
   285        const Int defaultNdkTickPeriod     = 100;
   286    
   287    
   288        /*!
   289         *  Set of flags which used to specify which cores the NDK stack should run
   290         *  on for multi-core processors.  Default is to run the stack on core 0.
   291         *
   292         *  This configuration parameter is only valid for C6000 multi-core
   293         *  processors.
   294         *  
   295         *  The following flag values may be set either individually, or by OR-ing
   296         *  flags together, in order to run the stack on other cores
   297         *  (or combination of cores):
   298         *
   299         *  Currently supports up to 32 cores.
   300         *
   301         * @p(blist)
   302         *    - STACKRUN_FLG_CORE_0 - specifies that the stack should run on core 0
   303         *  
   304         *    - STACKRUN_FLG_CORE_1 - specifies that the stack should run on core 1
   305         *  
   306         *    - STACKRUN_FLG_CORE_2 - specifies that the stack should run on core 2
   307         *  
   308         *    - STACKRUN_FLG_CORE_3 - specifies that the stack should run on core 3
   309         *  
   310         *    - STACKRUN_FLG_CORE_4 - specifies that the stack should run on core 4
   311         *  
   312         *    - STACKRUN_FLG_CORE_5 - specifies that the stack should run on core 5
   313         *  
   314         * @p
   315         */
   316        config StackRunModeFlags multiCoreStackRunMode = STACKRUN_FLG_CORE_0;
   317    
   318        /*!
   319         *  When true, the IPv6 version of the NDK libraries will be used, otherwise
   320         *  the IPv4 versions will be linked.
   321         *
   322         *  Default is IPv6.
   323         */
   324        config Bool IPv6 = true;
   325    
   326        /*!
   327         *  Variable used for choosing the NDK library to be linked into a program.
   328         *  Default stack library is PPP_PPPOE
   329         *
   330         *  NONE:          Links in support for NAT, PPP, and PPPoE (default).
   331         *  NAT:           Links in support for NAT.
   332         *  NAT_PPP:       Links in support for NAT and PPP.
   333         *  NAT_PPP_PPPOE: Links in support for NAT, PPP, and PPPoE.
   334         *  PPP:           Links in support for PPP.
   335         *  PPP_PPPOE:     Links in support for PPP and PPPoE.
   336         *  MIN:           Minimal stack library.  Does not link any support NAT, PPP or PPPoE.
   337         */
   338        config StackLibProtocol stackLibType = NONE;
   339    
   340        /*!
   341         *  Variable to cause the semaphore version of the NDK libraries to be linked into a program.
   342         * 
   343         *  true: link libraries which use Semaphore for kernel mode. 
   344         *  false: (Default) link libraries which use Task priority for kernel mode. 
   345         */
   346        config Bool useSemLibs = false;
   347    
   348        /*!
   349         *  Sets the severity level of system debug messages that are recorded to
   350         *  the debug log.
   351         */
   352        config DebugLevel debugPrintLevel = defaultDebugPrintLevel;
   353    
   354        /*!
   355         *  Sets the severity level of system debug messages that that result in a
   356         *  system shutdown.
   357         */
   358        config DebugLevel debugAbortLevel = defaultDebugAbortLevel;
   359    
   360        /*! Sets the priority value for low priority NDK tasks */
   361        config Int lowTaskPriLevel  = defaultLowTaskPriLevel;
   362    
   363        /*! Sets the priority value for normal priority NDK tasks */
   364        config Int normTaskPriLevel = defaultNormTaskPriLevel;
   365    
   366        /*! Sets the priority value for high priority NDK tasks */
   367        config Int highTaskPriLevel = defaultHighTaskPriLevel;
   368    
   369        /*! Sets the priority value for kernel priority NDK tasks */
   370        config Int kernTaskPriLevel = defaultKernTaskPriLevel;
   371    
   372        /*! Sets the default stack size for low priority NDK tasks */
   373        config Int lowTaskStackSize = defaultLowTaskStackSize;
   374    
   375        /*! Sets the default stack size for normal priority NDK tasks */
   376        config Int normTaskStackSize = defaultNormTaskStackSize;
   377    
   378        /*! Sets the default stack size for high priority NDK tasks */
   379        config Int highTaskStackSize = defaultHighTaskStackSize;
   380    
   381        /*! Sets the default stack size for the NDK boot task (NS_Boot) */
   382        config Int bootTaskStackSize = defaultBootTaskStackSize;
   383    
   384        /*!
   385         *  Enables the NDK stack thread and C stack configuration code to be
   386         *  generated automatically for the application. When false, no C code is
   387         *  generated, but NDK libraries are still linked into the application
   388         *  automatically.
   389         */
   390        config Bool enableCodeGeneration = true;
   391    
   392        /*!
   393         *  Automatically open/close file descriptor session
   394         *  
   395         *  When true, calls to fdOpenSession and fdCloseSession will be made
   396         *  automatically for dynamically created Tasks.  This allows standard BSD
   397         *  sockets code fit more easily into an NDK application.
   398         *  
   399         *  Note that this is only supported for dynamically created tasks that are
   400         *  created from within Task context (i.e. from within an already running
   401         *  Task function).  Tasks created from the configuration or dynamically
   402         *  in main or a Hwi or Swi thread will not have support for this feature.  
   403         *
   404         *  Disabled by default.
   405         */
   406        config Bool autoOpenCloseFD = false;
   407    
   408        /*!
   409         *  Determines the size of the socket file descriptor table
   410         *
   411         *  Set this variable to adjust the number of sockets that the file
   412         *  descriptor table (ti_ndk_socket_fdtable[]) can hold.
   413         */
   414        config Int maxSockFileDesc = 10;
   415    
   416        /*!
   417         *  Allows user to define their own implementation of the NDK stack thread
   418         *
   419         *  If set, the user is responsible for defining the NDK stack
   420         *  thread, which has no return value and has two parameters of type
   421         *  uintptr_t.
   422         *
   423         *  For example (C code):
   424         *
   425         *      void MYMODULE_stackThreadUser(uintptr_t arg0, uintptr_t arg1);
   426         *
   427         *  And in the configuration file:
   428         *
   429         *      Global.stackThreadUser = '&MYMODULE_stackThreadUser';
   430         *
   431         *  The user is also responsible for creating the SYS/BIOS Clock
   432         *  instance for the NDK 100ms heartbeat, calling appropriate NC_* APIs,
   433         *  and adding the appropriate C run time configuration code that matches
   434         *  the settings of the BIOS config file in the function. (e.g. if
   435         *  configuring the Ip module, the stack thread must call NC_SystemOpen(),
   436         *  'ti_ndk_config_ip_init(hCfg)', etc.).
   437         */
   438        config ndkHookFxn stackThreadUser = null;
   439    
   440        /*! Priority of the generated NDK task 'ti_ndk_config_Global_stackThread' */
   441        config Int ndkThreadPri = defaultNormTaskPriLevel;
   442    
   443        /*! Stack size of the generated NDK task 'ti_ndk_config_Global_stackThread' */
   444        config Int ndkThreadStackSize = defaultNdkTaskStackSize;
   445    
   446        /*!
   447         *  Tick period in Clock ticks for the NDK heartbeat
   448         *
   449         *  Default value set to 100 ticks to match the default tick rate of
   450         *  1 tick = 1 millisecond.  Note that if the a custom Timer is configured
   451         *  to drive the Clock module with a period other than 1 millisecond
   452         *  per tick, then you must adjust the ndkTickPeriod accordingly.
   453        */
   454        config Int ndkTickPeriod = defaultNdkTickPeriod;
   455    
   456        /*! The priority level at which the NDK net scheduler task runs. */
   457        config NetEventSchedPri netSchedulerPri = NC_PRIORITY_LOW;
   458    
   459        /*! The manner at which the NDK net scheduler task runs. */
   460        config NetEventSchedOp netSchedulerOpMode = NC_OPMODE_INTERRUPT;
   461    
   462        /*! The name for authorization realm 1 */
   463        config String realm1Name = null;
   464    
   465        /*! The name for authorization realm 2 */
   466        config String realm2Name = null;
   467    
   468        /*! The name for authorization realm 3 */
   469        config String realm3Name = null;
   470    
   471        /*! The name for authorization realm 4 */
   472        config String realm4Name = null;
   473    
   474        /*!
   475         *  Packet Buffer Manager (PBM) number of frames
   476         *
   477         *  Used to set the size of PBM 'pBufMem[]'.
   478         */
   479        config Int pktNumFrameBufs = 192;
   480    
   481        /*!
   482         *  Packet Buffer Manager (PBM) size frame buffer
   483         *
   484         *  Used to set the size of PBM 'pHdrMem[]'.
   485         */
   486        config Int pktSizeFrameBuf = 1536;
   487    
   488        /*!
   489         *  Packet Buffer Manager (PBM) buffer data section
   490         *
   491         *  Section to place PBM buffers 'pBufMem' and 'pHdrMem'.
   492         */
   493        config String pbmDataSection = ".far:NDK_PACKETMEM";
   494    
   495        /*!
   496         *  Memory Manager page size
   497         *
   498         *  Used to set the size of OSAL's 'pitBuffer[]'.
   499         */
   500        config Int memRawPageSize = 3072;
   501    
   502        /*!
   503         *  Memory Manager page count
   504         *
   505         *  Used to set the size of OSAL's 'pit[]' and 'pitBuffer[]'.
   506         */
   507        config Int memRawPageCount = 16;
   508    
   509        /*!
   510         *  Memory Manager buffer data section
   511         *
   512         *  Section to place NDK memory manager buffers 'pit[]', 'pitBuffer[]' and
   513         *   'Id2Size[]'.
   514         */
   515        config String memDataSection = ".far:NDK_MMBUFFER";
   516    
   517        /*!
   518         *  User defined hook function to run in the NDK stack thread
   519         *  ti_ndk_config_Global_stackThread().  This function will run at
   520         *  the very beginning of the stack thread, before the call to
   521         *  NC_SystemOpen() is made.  It will not be passed any arguments.
   522         *
   523         *  For example, if your configuration sets 'stackBeginHook' to a function
   524         *  called "myBeginFxn":
   525         *
   526         *      var Global = xdc.useModule('ti.ndk.config.Global');
   527         *      Global.stackBeginHook = '&myBeginFxn';
   528         *
   529         *  Then a call to "myBeginFxn" will be generated as follows:
   530         *
   531         *      myBeginFxn();
   532         *
   533         */
   534        config ndkHookFxn stackBeginHook = null;
   535    
   536        /*!
   537         *  User defined hook function to run in the NDK stack thread
   538         *  ti_ndk_config_Global_stackThread().  This function will run immediately
   539         *  after the function call to create a new configuration, CfgNew(), and
   540         *  will be passed the handle to that configuration.
   541         *
   542         *  For example, if your configuration sets 'stackInitHook' to a function
   543         *  called "myInitFxn":
   544         *
   545         *      var Global = xdc.useModule('ti.ndk.config.Global');
   546         *      Global.stackInitHook = '&myInitFxn';
   547         *
   548         *  Then a call to "myInitFxn" will be generated as follows:
   549         *
   550         *      myInitFxn(hCfg);
   551         *
   552         *  Therefore, if you wish to use the configuration handle in "myInitFxn",
   553         *  then you should define it so that it can accept the handle passed to it:
   554         *  
   555         *      Void myInitFxn(void *hCfg)
   556         *      {  
   557         *          ...
   558         *      }  
   559         */
   560        config ndkHookFxn stackInitHook = null;
   561    
   562        /*!
   563         *  User defined hook function to run in the NDK stack thread
   564         *  ti_ndk_config_Global_stackThread().  This function will run immediately
   565         *  after the return from NC_NetStart() and within the while() loop which contains
   566         *  the NC_NetStart() call.  It will be passed a handle to the configuration
   567         *  as well as the valued returned from NC_NetStart.
   568         *
   569         *  For example, if your configuration sets 'stackRebootHook' to a function
   570         *  called "myRebootFxn":
   571         *
   572         *      var Global = xdc.useModule('ti.ndk.config.Global');
   573         *      Global.stackRebootHook = '&myRebootFxn';
   574         *
   575         *  Then a call to "myRebootFxn" will be generated after the call to
   576         *  NC_NetStart(), but within the do/while loop, which allows this hook to
   577         *  run for the case of the NDK stack thread rebooting.  The generated code
   578         *  will look similar to the following:
   579         *
   580         *      do
   581         *      {
   582         *           rc = NC_NetStart(hCfg, ti_ndk_config_Global_NetworkOpen,
   583         *                   ti_ndk_config_Global_NetworkClose,
   584         *                   ti_ndk_config_Global_NetworkIPAddr);
   585         *
   586         *           myRebootFxn(hCfg, rc);
   587         *
   588         *      } while( rc > 0 );
   589         *
   590         *
   591         *  Therefore, if you wish to use the configuration handle and return code
   592         *  in "myRebootFxn", then you should define it so that it has such
   593         *  parameters:
   594         *
   595         *      Void myRebootFxn(void *hCfg, int rc)
   596         *      {
   597         *          ...
   598         *      }
   599         */
   600        config ndkHookFxn stackRebootHook = null;
   601    
   602        /*!
   603         *  User defined hook function to run in the NDK stack thread
   604         *  ti_ndk_config_Global_stackThread().  This function will run immediately
   605         *  after exiting from the while() loop which contains the call to
   606         *  NC_NetStart(), but before the subsequent calls to CfgFree( hCfg ) and
   607         *  NC_SystemClose().  It will be passed a handle to the configuration as
   608         *  well as the valued returned from NC_NetStart.
   609         *
   610         *  For example, if your configuration sets 'stackDeleteHook' to a function
   611         *  called "myDeleteFxn":
   612         *
   613         *      var Global = xdc.useModule('ti.ndk.config.Global');
   614         *      Global.stackDeleteHook = '&myDeleteFxn';
   615         *
   616         *  Then a call to "myDeleteFxn" will be generated after the call to
   617         *  NC_NetStart(), similar to the following:
   618         *
   619         *      do
   620         *      {
   621         *           rc = NC_NetStart(hCfg, ti_ndk_config_Global_NetworkOpen, 
   622         *                   ti_ndk_config_Global_NetworkClose, 
   623         *                   ti_ndk_config_Global_NetworkIPAddr);
   624         *      } while( rc > 0 );
   625         *
   626         *      myDeleteFxn(hCfg, rc);
   627         *
   628         *  Therefore, if you wish to use the configuration handle in "myDeleteFxn",
   629         *  then you should define it so that it can accept the handle passed to it:
   630         *  
   631         *      Void myDeleteFxn(void *hCfg, int rc)
   632         *      {  
   633         *          ...
   634         *      }  
   635         */
   636        config ndkHookFxn stackDeleteHook = null;
   637    
   638        /*!
   639         *  User defined hook function to run in the NDK status report callback
   640         *  funtion, ti_ndk_config_Global_serviceReport().  This function will run
   641         *  at the beginning of the service report function and will be passed the
   642         *  the same arguments passed to ti_ndk_config_Global_serviceReport(),
   643         *  Item, Status, Report and h.
   644         *
   645         *  For example, if your configuration sets 'serviceReportHook' to a function
   646         *  called "myReportFxn":
   647         *
   648         *      var Global = xdc.useModule('ti.ndk.config.Global');
   649         *      Global.serviceReportHook = '&myReportFxn';
   650         *
   651         *  Then a call to "myReportFxn" will be generated as follows:
   652         *
   653         *      myReportFxn(Item, Status, Report, h);
   654         *
   655         *  Therefore, if you wish to use the configuration handle in "myReportFxn",
   656         *  then you should define it so that it can accept the handle passed to it:
   657         *  
   658         *      Void myReportFxn(uint Item, uint Status, uint Report, void *h)
   659         *      {  
   660         *          ...
   661         *      }  
   662         */
   663        config ndkHookFxn serviceReportHook = null;
   664    
   665        /*!
   666         *  User defined hook function to run inside the NDK Network Start callback
   667         *  function, NetworkOpen().  The Network Start callback function is called
   668         *  when the stack is ready to begin the creation of application supplied
   669         *  network tasks.  This hook function will run immediately, upon entering
   670         *  the NetworkOpen() function.  Note that this function is called during
   671         *  the early stages of the stack startup, and must return in order for the
   672         *  stack to resume operations.  It will not be passed any arguments.
   673         *
   674         *  For example, if your configuration sets 'networkOpenHook' to a function
   675         *  called "myNetOpenFxn":
   676         *
   677         *      var Global = xdc.useModule('ti.ndk.config.Global');
   678         *      Global.networkOpenHook = '&myNetOpenFxn';
   679         *
   680         *  Then a call to "myNetOpenFxn" will be generated as follows:
   681         *
   682         *      myNetOpenFxn();
   683         *
   684         */
   685        config ndkHookFxn networkOpenHook = null;
   686    
   687        /*!
   688         *  User defined hook function to run in the NDK Network Stop callback
   689         *  function, NetworkClose().  The Network Close callback function is
   690         *  called when the stack is about to shut down.  This hook function will
   691         *  run immediately, upon entering the NetworkClose() function. It will not
   692         *  be passed any arguments.
   693         *
   694         *  For example, if your configuration sets 'networkCloseHook' to a function
   695         *  called "myNetCloseFxn":
   696         *
   697         *      var Global = xdc.useModule('ti.ndk.config.Global');
   698         *      Global.networkCloseHook = '&myNetCloseFxn';
   699         *
   700         *  Then a call to "myNetCloseFxn" will be generated as follows:
   701         *
   702         *      myNetCloseFxn();
   703         *
   704         */
   705        config ndkHookFxn networkCloseHook = null;
   706    
   707        /*!
   708         *  User defined hook function to run in the NDK Network IP address
   709         *  callback function, NetworkIPAddr().  The Network IP address callback
   710         *  function is called when an IP address is added or removed from the
   711         *  system.  This hook function will run immediately, upon entering the
   712         *  NetworkIPAddr() function and is passed the same arguments passed to
   713         *  NetworkIPAddr(), IPAddr, IfIdx, fAdd.
   714         *
   715         *  For example, if your configuration sets 'networkIPAddrHook' to a
   716         *  function called "myIPAddrHook":
   717         *
   718         *      var Global = xdc.useModule('ti.ndk.config.Global');
   719         *      Global.networkIPAddrHook = '&myIPAddrHook';
   720         *
   721         *  Then a call to "myIPAddrHook" will be generated as follows:
   722         *
   723         *      myIPAddrHook(hCfg);
   724         *
   725         *  Therefore, if you wish to use the configuration handle in "myIPAddrHook",
   726         *  then you should define it so that it can accept the arguments passed to
   727         *  it:
   728         *  
   729         *      Void myIPAddrHook(IPN IPAddr, uint IfIdx, uint fAdd)
   730         *      {  
   731         *          ...
   732         *      }  
   733         */
   734        config ndkHookFxn networkIPAddrHook = null;
   735    
   736        /*!
   737         *  ======== addUserAccount ========
   738         *  addUserAccount is used in a config file to add a new user account into
   739         *  the set of user accounts (and corresponding passwords) that will be
   740         *  added into the NDK configuration.
   741         *
   742         *  A user account is created by making a struct Account, setting that
   743         *  structs username and password for the account to be added, and then
   744         *  calling this function to add it. For example:
   745         *  
   746         *  
   747         *       Account acct1;
   748         *       acct1.username = "user1";  
   749         *       acct1.password = "user1pass";  
   750         *  
   751         *       addUserAccount(acct1);
   752         *
   753         *  @param(account) structure of type Account
   754         */
   755        metaonly Void addUserAccount(Account account);
   756    }
   757