The Global module is required to be used by an NDK application. At
minimum, it is used to link in the default flavor of the NDK stack library,
as well as the other core libraries, and generates no code.
However, if the user desires, it may be used to link in libraries,
configure global stack settings, and generate NDK C configuration code.
The user can select which version of "stack.lib" to use via the following
configuration parameters:
stackLibType may be set to the following values. If the configuration
parameter 'IPv6' is set to 'true', then this will result in the
following IPv6 library selections:
If the configuration parameter 'IPv6' is set to 'false', then this will
result in the following IPv4 library selections:
In addition to NDK library selection, the Global module may be used to
change global configuration settings of the stack. This includes settings
for the:
Note that the Global module generates NDK C configuration code in order to
manipulate the settings of the above mentioned items. In order for these
settings to take effect, code generation must be enabled in the Global
module.
If the code generation feature is enabled, then it's important to note that
the C code for several functions will be created, which may cause a
conflict if a program already has defined these functions, and then
later enables code generation. These functions may also be updated
with C API calls that will correspond to the RTSC configuration settings
that were made.
The following list is a list of the C functions that are generated as a
result of using the NDK RTSC configuration's code generating feature:
The NDK RTSC configuration and code generation feature is really intended
to be used with a new NDK program, not with an existing one. For example,
if the user has an already existing NDK program, and they wish to change
one of the configuration settings to that already existing program, then
the NDK RTSC configuration should *not* be used. If the user were to use
the NDK RTSC configuration in this manner, then the resulting program
behavior would become unpredictable, due to having multiple NDK stack
threads running with different configuration settings.
However, one could create a new NDK program that uses the RTSC
configuration in order to easily see the C configuration code needed to
change a particular stack setting. This generated C configuration code
could then be copied from the new NDK program, and then pasted into the
user's existing program to add that setting.
Since the NDK stack thread function (as well as the other functions listed
above) is generated when using this code generation feature, the user will
not be able to directly add custom code into it. In order to allow this,
a set of hook functions are provided. These hook functions may be called
from various places from within the generated code. The user can define
these hook functions as appropriate, and then assign the function names to
the Global modules ndkHookFxn configuration parameters. For each
ndkHookFxn configuration paramter that is defined, a call to that
function will be added into the generated C code, as described by that
ndkHookFxn parameter. Note that for some of these hook calls will be made
with useful parameters in order to pass down information into the user's
code (please refer to the hook descriptions for details on arguments
passed and prototype signature for these hooks).
Note if the user specifies a hook function in the RTSC configuration
script, but does not define this function in their C code, a linker error
will result.
const Global.STACKRUN_FLG_CORE_0 |
 |
const Global.STACKRUN_FLG_CORE_0 = 0x1;
const Global.STACKRUN_FLG_CORE_1 |
 |
const Global.STACKRUN_FLG_CORE_1 = 0x2;
const Global.STACKRUN_FLG_CORE_10 |
 |
const Global.STACKRUN_FLG_CORE_10 = 0x400;
const Global.STACKRUN_FLG_CORE_11 |
 |
const Global.STACKRUN_FLG_CORE_11 = 0x800;
const Global.STACKRUN_FLG_CORE_12 |
 |
const Global.STACKRUN_FLG_CORE_12 = 0x1000;
const Global.STACKRUN_FLG_CORE_13 |
 |
const Global.STACKRUN_FLG_CORE_13 = 0x2000;
const Global.STACKRUN_FLG_CORE_14 |
 |
const Global.STACKRUN_FLG_CORE_14 = 0x4000;
const Global.STACKRUN_FLG_CORE_15 |
 |
const Global.STACKRUN_FLG_CORE_15 = 0x8000;
const Global.STACKRUN_FLG_CORE_16 |
 |
const Global.STACKRUN_FLG_CORE_16 = 0x10000;
const Global.STACKRUN_FLG_CORE_17 |
 |
const Global.STACKRUN_FLG_CORE_17 = 0x20000;
const Global.STACKRUN_FLG_CORE_18 |
 |
const Global.STACKRUN_FLG_CORE_18 = 0x40000;
const Global.STACKRUN_FLG_CORE_19 |
 |
const Global.STACKRUN_FLG_CORE_19 = 0x80000;
const Global.STACKRUN_FLG_CORE_2 |
 |
const Global.STACKRUN_FLG_CORE_2 = 0x4;
const Global.STACKRUN_FLG_CORE_20 |
 |
const Global.STACKRUN_FLG_CORE_20 = 0x100000;
const Global.STACKRUN_FLG_CORE_21 |
 |
const Global.STACKRUN_FLG_CORE_21 = 0x200000;
const Global.STACKRUN_FLG_CORE_22 |
 |
const Global.STACKRUN_FLG_CORE_22 = 0x400000;
const Global.STACKRUN_FLG_CORE_23 |
 |
const Global.STACKRUN_FLG_CORE_23 = 0x800000;
const Global.STACKRUN_FLG_CORE_24 |
 |
const Global.STACKRUN_FLG_CORE_24 = 0x1000000;
const Global.STACKRUN_FLG_CORE_25 |
 |
const Global.STACKRUN_FLG_CORE_25 = 0x2000000;
const Global.STACKRUN_FLG_CORE_26 |
 |
const Global.STACKRUN_FLG_CORE_26 = 0x4000000;
const Global.STACKRUN_FLG_CORE_27 |
 |
const Global.STACKRUN_FLG_CORE_27 = 0x8000000;
const Global.STACKRUN_FLG_CORE_28 |
 |
const Global.STACKRUN_FLG_CORE_28 = 0x10000000;
const Global.STACKRUN_FLG_CORE_29 |
 |
const Global.STACKRUN_FLG_CORE_29 = 0x20000000;
const Global.STACKRUN_FLG_CORE_3 |
 |
const Global.STACKRUN_FLG_CORE_3 = 0x8;
const Global.STACKRUN_FLG_CORE_30 |
 |
const Global.STACKRUN_FLG_CORE_30 = 0x40000000;
const Global.STACKRUN_FLG_CORE_31 |
 |
const Global.STACKRUN_FLG_CORE_31 = 0x80000000;
const Global.STACKRUN_FLG_CORE_4 |
 |
const Global.STACKRUN_FLG_CORE_4 = 0x10;
const Global.STACKRUN_FLG_CORE_5 |
 |
const Global.STACKRUN_FLG_CORE_5 = 0x20;
const Global.STACKRUN_FLG_CORE_6 |
 |
const Global.STACKRUN_FLG_CORE_6 = 0x40;
const Global.STACKRUN_FLG_CORE_7 |
 |
const Global.STACKRUN_FLG_CORE_7 = 0x80;
const Global.STACKRUN_FLG_CORE_8 |
 |
const Global.STACKRUN_FLG_CORE_8 = 0x100;
const Global.STACKRUN_FLG_CORE_9 |
 |
const Global.STACKRUN_FLG_CORE_9 = 0x200;
const Global.defaultBootTaskStackSize |
 |
const Global.defaultBootTaskStackSize = 2048;
const Global.defaultDebugAbortLevel |
 |
const Global.defaultHighTaskPriLevel |
 |
const Global.defaultHighTaskPriLevel = 7;
const Global.defaultHighTaskStackSize |
 |
const Global.defaultHighTaskStackSize = 5120;
const Global.defaultKernTaskPriLevel |
 |
const Global.defaultKernTaskPriLevel = 9;
const Global.defaultLowTaskPriLevel |
 |
const Global.defaultLowTaskPriLevel = 3;
const Global.defaultLowTaskStackSize |
 |
const Global.defaultLowTaskStackSize = 3072;
const Global.defaultNdkTaskStackSize |
 |
const Global.defaultNdkTaskStackSize = 8192;
const Global.defaultNdkTickPeriod |
 |
const Global.defaultNdkTickPeriod = 100;
const Global.defaultNormTaskPriLevel |
 |
const Global.defaultNormTaskPriLevel = 5;
const Global.defaultNormTaskStackSize |
 |
const Global.defaultNormTaskStackSize = 4096;
enum Global.DebugLevel |
 |
This defines the legal values for the severity level of debug messages
and debug aborts in the stack
values of type Global.DebugLevel
const Global.DBG_INFO;
// Information Messages (DBG_INFO)
const Global.DBG_WARN;
// Warning Messages (DBG_WARN)
const Global.DBG_ERROR;
// Error Messages (DBG_ERROR)
const Global.DBG_NONE;
// No Messages (DBG_NONE)
enum Global.NetEventSchedOp |
 |
This defines the legal values for the operating mode setting for the
Network event scheduler task
values of type Global.NetEventSchedOp
const Global.NC_OPMODE_POLLING;
// Polling Mode
const Global.NC_OPMODE_INTERRUPT;
// Interrupt Mode
enum Global.NetEventSchedPri |
 |
This defines the legal values for the priority setting for the Network
event scheduler task
values of type Global.NetEventSchedPri
const Global.NC_PRIORITY_LOW;
// Low Priority
const Global.NC_PRIORITY_HIGH;
// High Priority
enum Global.StackLibProtocol |
 |
Defines the set of legal stack library types
values of type Global.StackLibProtocol
const Global.NONE;
const Global.NAT;
const Global.NAT_PPP;
const Global.NAT_PPP_PPPOE;
const Global.PPP;
const Global.PPP_PPPOE;
const Global.MIN;
struct Global.Account |
 |
This data structure is used to add a user account
var obj = new Global.Account;
obj.username = String ...
obj.password = String ...
config Global.IPv6 // module-wide |
 |
When true, the IPv6 version of the NDK libraries will be used, otherwise
the IPv4 versions will be linked
DETAILS
Default is IPv6.
config Global.autoOpenCloseFD // module-wide |
 |
Automatically open/close file descriptor session
Global.autoOpenCloseFD = Bool false;
DETAILS
When true, calls to fdOpenSession and fdCloseSession will be made
automatically for dynamically created Tasks. This allows standard BSD
sockets code fit more easily into an NDK application.
Note that this is only supported for dynamically created tasks that are
created from within Task context (i.e. from within an already running
Task function). Tasks created from the configuration or dynamically
in main or a Hwi or Swi thread will not have support for this feature.
Disabled by default.
config Global.bootTaskStackSize // module-wide |
 |
Sets the default stack size for the NDK boot task (NS_Boot)
config Global.debugAbortLevel // module-wide |
 |
Sets the severity level of system debug messages that that result in a
system shutdown
config Global.debugPrintLevel // module-wide |
 |
Sets the severity level of system debug messages that are recorded to
the debug log
config Global.enableCodeGeneration // module-wide |
 |
Enables the NDK stack thread and C stack configuration code to be
generated automatically for the application. When false, no C code is
generated, but NDK libraries are still linked into the application
automatically
Global.enableCodeGeneration = Bool true;
config Global.highTaskPriLevel // module-wide |
 |
Sets the priority value for high priority NDK tasks
config Global.highTaskStackSize // module-wide |
 |
Sets the default stack size for high priority NDK tasks
config Global.kernTaskPriLevel // module-wide |
 |
Sets the priority value for kernel priority NDK tasks
config Global.lowTaskPriLevel // module-wide |
 |
Sets the priority value for low priority NDK tasks
config Global.lowTaskStackSize // module-wide |
 |
Sets the default stack size for low priority NDK tasks
config Global.maxSockFileDesc // module-wide |
 |
Determines the size of the socket file descriptor table
Global.maxSockFileDesc = Int 10;
DETAILS
Set this variable to adjust the number of sockets that the file
descriptor table (ti_ndk_socket_fdtable[]) can hold.
config Global.memDataSection // module-wide |
 |
Memory Manager buffer data section
Global.memDataSection = String ".far:NDK_MMBUFFER";
DETAILS
Section to place NDK memory manager buffers 'pit[]', 'pitBuffer[]' and
'Id2Size[]'.
config Global.memRawPageCount // module-wide |
 |
Memory Manager page count
Global.memRawPageCount = Int 16;
DETAILS
Used to set the size of OSAL's 'pit[]' and 'pitBuffer[]'.
config Global.memRawPageSize // module-wide |
 |
Memory Manager page size
Global.memRawPageSize = Int 3072;
DETAILS
Used to set the size of OSAL's 'pitBuffer[]'.
config Global.multiCoreStackRunMode // module-wide |
 |
Set of flags which used to specify which cores the NDK stack should run
on for multi-core processors. Default is to run the stack on core 0
DETAILS
This configuration parameter is only valid for C6000 multi-core
processors.
The following flag values may be set either individually, or by OR-ing
flags together, in order to run the stack on other cores
(or combination of cores):
Currently supports up to 32 cores.
- STACKRUN_FLG_CORE_0 - specifies that the stack should run on core 0
- STACKRUN_FLG_CORE_1 - specifies that the stack should run on core 1
- STACKRUN_FLG_CORE_2 - specifies that the stack should run on core 2
- STACKRUN_FLG_CORE_3 - specifies that the stack should run on core 3
- STACKRUN_FLG_CORE_4 - specifies that the stack should run on core 4
- STACKRUN_FLG_CORE_5 - specifies that the stack should run on core 5
config Global.ndkThreadPri // module-wide |
 |
Priority of the generated NDK task 'ti_ndk_config_Global_stackThread'
config Global.ndkThreadStackSize // module-wide |
 |
Stack size of the generated NDK task 'ti_ndk_config_Global_stackThread'
config Global.ndkTickPeriod // module-wide |
 |
Tick period in Clock ticks for the NDK heartbeat
DETAILS
Default value set to 100 ticks to match the default tick rate of
1 tick = 1 millisecond. Note that if the a custom Timer is configured
to drive the Clock module with a period other than 1 millisecond
per tick, then you must adjust the ndkTickPeriod accordingly.
config Global.netSchedulerOpMode // module-wide |
 |
The manner at which the NDK net scheduler task runs
config Global.netSchedulerPri // module-wide |
 |
The priority level at which the NDK net scheduler task runs
config Global.networkCloseHook // module-wide |
 |
User defined hook function to run in the NDK Network Stop callback
function, NetworkClose(). The Network Close callback function is
called when the stack is about to shut down. This hook function will
run immediately, upon entering the NetworkClose() function. It will not
be passed any arguments
Global.networkCloseHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'networkCloseHook' to a function
called "myNetCloseFxn":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.networkCloseHook = '&myNetCloseFxn';
Then a call to "myNetCloseFxn" will be generated as follows:
myNetCloseFxn();
config Global.networkIPAddrHook // module-wide |
 |
User defined hook function to run in the NDK Network IP address
callback function, NetworkIPAddr(). The Network IP address callback
function is called when an IP address is added or removed from the
system. This hook function will run immediately, upon entering the
NetworkIPAddr() function and is passed the same arguments passed to
NetworkIPAddr(), IPAddr, IfIdx, fAdd
Global.networkIPAddrHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'networkIPAddrHook' to a
function called "myIPAddrHook":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.networkIPAddrHook = '&myIPAddrHook';
Then a call to "myIPAddrHook" will be generated as follows:
myIPAddrHook(hCfg);
Therefore, if you wish to use the configuration handle in "myIPAddrHook",
then you should define it so that it can accept the arguments passed to
it:
Void myIPAddrHook(IPN IPAddr, uint IfIdx, uint fAdd)
{
...
}
config Global.networkOpenHook // module-wide |
 |
User defined hook function to run inside the NDK Network Start callback
function, NetworkOpen(). The Network Start callback function is called
when the stack is ready to begin the creation of application supplied
network tasks. This hook function will run immediately, upon entering
the NetworkOpen() function. Note that this function is called during
the early stages of the stack startup, and must return in order for the
stack to resume operations. It will not be passed any arguments
Global.networkOpenHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'networkOpenHook' to a function
called "myNetOpenFxn":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.networkOpenHook = '&myNetOpenFxn';
Then a call to "myNetOpenFxn" will be generated as follows:
myNetOpenFxn();
config Global.normTaskPriLevel // module-wide |
 |
Sets the priority value for normal priority NDK tasks
config Global.normTaskStackSize // module-wide |
 |
Sets the default stack size for normal priority NDK tasks
config Global.pbmDataSection // module-wide |
 |
Packet Buffer Manager (PBM) buffer data section
Global.pbmDataSection = String ".far:NDK_PACKETMEM";
DETAILS
Section to place PBM buffers 'pBufMem' and 'pHdrMem'.
config Global.pktNumFrameBufs // module-wide |
 |
Packet Buffer Manager (PBM) number of frames
Global.pktNumFrameBufs = Int 192;
DETAILS
Used to set the size of PBM 'pBufMem[]'.
config Global.pktSizeFrameBuf // module-wide |
 |
Packet Buffer Manager (PBM) size frame buffer
Global.pktSizeFrameBuf = Int 1536;
DETAILS
Used to set the size of PBM 'pHdrMem[]'.
config Global.realm1Name // module-wide |
 |
The name for authorization realm 1
Global.realm1Name = String null;
config Global.realm2Name // module-wide |
 |
The name for authorization realm 2
Global.realm2Name = String null;
config Global.realm3Name // module-wide |
 |
The name for authorization realm 3
Global.realm3Name = String null;
config Global.realm4Name // module-wide |
 |
The name for authorization realm 4
Global.realm4Name = String null;
config Global.serviceReportHook // module-wide |
 |
User defined hook function to run in the NDK status report callback
funtion, ti_ndk_config_Global_serviceReport(). This function will run
at the beginning of the service report function and will be passed the
the same arguments passed to ti_ndk_config_Global_serviceReport(),
Item, Status, Report and h
Global.serviceReportHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'serviceReportHook' to a function
called "myReportFxn":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.serviceReportHook = '&myReportFxn';
Then a call to "myReportFxn" will be generated as follows:
myReportFxn(Item, Status, Report, h);
Therefore, if you wish to use the configuration handle in "myReportFxn",
then you should define it so that it can accept the handle passed to it:
Void myReportFxn(uint Item, uint Status, uint Report, void *h)
{
...
}
config Global.stackBeginHook // module-wide |
 |
User defined hook function to run in the NDK stack thread
ti_ndk_config_Global_stackThread(). This function will run at
the very beginning of the stack thread, before the call to
NC_SystemOpen() is made. It will not be passed any arguments
Global.stackBeginHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'stackBeginHook' to a function
called "myBeginFxn":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.stackBeginHook = '&myBeginFxn';
Then a call to "myBeginFxn" will be generated as follows:
myBeginFxn();
config Global.stackDeleteHook // module-wide |
 |
User defined hook function to run in the NDK stack thread
ti_ndk_config_Global_stackThread(). This function will run immediately
after exiting from the while() loop which contains the call to
NC_NetStart(), but before the subsequent calls to CfgFree(hCfg) and
NC_SystemClose(). It will be passed a handle to the configuration as
well as the valued returned from NC_NetStart
Global.stackDeleteHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'stackDeleteHook' to a function
called "myDeleteFxn":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.stackDeleteHook = '&myDeleteFxn';
Then a call to "myDeleteFxn" will be generated after the call to
NC_NetStart(), similar to the following:
do
{
rc = NC_NetStart(hCfg, ti_ndk_config_Global_NetworkOpen,
ti_ndk_config_Global_NetworkClose,
ti_ndk_config_Global_NetworkIPAddr);
} while(rc > 0);
myDeleteFxn(hCfg, rc);
Therefore, if you wish to use the configuration handle in "myDeleteFxn",
then you should define it so that it can accept the handle passed to it:
Void myDeleteFxn(void *hCfg, int rc)
{
...
}
config Global.stackInitHook // module-wide |
 |
User defined hook function to run in the NDK stack thread
ti_ndk_config_Global_stackThread(). This function will run immediately
after the function call to create a new configuration, CfgNew(), and
will be passed the handle to that configuration
Global.stackInitHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'stackInitHook' to a function
called "myInitFxn":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.stackInitHook = '&myInitFxn';
Then a call to "myInitFxn" will be generated as follows:
myInitFxn(hCfg);
Therefore, if you wish to use the configuration handle in "myInitFxn",
then you should define it so that it can accept the handle passed to it:
Void myInitFxn(void *hCfg)
{
...
}
config Global.stackLibType // module-wide |
 |
Variable used for choosing the NDK library to be linked into a program.
Default stack library is PPP_PPPOE
DETAILS
NONE: Links in support for NAT, PPP, and PPPoE (default).
NAT: Links in support for NAT.
NAT_PPP: Links in support for NAT and PPP.
NAT_PPP_PPPOE: Links in support for NAT, PPP, and PPPoE.
PPP: Links in support for PPP.
PPP_PPPOE: Links in support for PPP and PPPoE.
MIN: Minimal stack library. Does not link any support NAT, PPP or PPPoE.
config Global.stackRebootHook // module-wide |
 |
User defined hook function to run in the NDK stack thread
ti_ndk_config_Global_stackThread(). This function will run immediately
after the return from NC_NetStart() and within the while() loop which contains
the NC_NetStart() call. It will be passed a handle to the configuration
as well as the valued returned from NC_NetStart
Global.stackRebootHook = Void(*)() null;
DETAILS
For example, if your configuration sets 'stackRebootHook' to a function
called "myRebootFxn":
var Global = xdc.useModule('ti.ndk.config.Global');
Global.stackRebootHook = '&myRebootFxn';
Then a call to "myRebootFxn" will be generated after the call to
NC_NetStart(), but within the do/while loop, which allows this hook to
run for the case of the NDK stack thread rebooting. The generated code
will look similar to the following:
do
{
rc = NC_NetStart(hCfg, ti_ndk_config_Global_NetworkOpen,
ti_ndk_config_Global_NetworkClose,
ti_ndk_config_Global_NetworkIPAddr);
myRebootFxn(hCfg, rc);
} while(rc > 0);
Therefore, if you wish to use the configuration handle and return code
in "myRebootFxn", then you should define it so that it has such
parameters:
Void myRebootFxn(void *hCfg, int rc)
{
...
}
config Global.stackThreadUser // module-wide |
 |
Allows user to define their own implementation of the NDK stack thread
Global.stackThreadUser = Void(*)() null;
DETAILS
If set, the user is responsible for defining the NDK stack
thread, which has no return value and has two parameters of type
uintptr_t.
For example (C code):
void MYMODULE_stackThreadUser(uintptr_t arg0, uintptr_t arg1);
And in the configuration file:
Global.stackThreadUser = '&MYMODULE_stackThreadUser';
The user is also responsible for creating the SYS/BIOS Clock
instance for the NDK 100ms heartbeat, calling appropriate NC_* APIs,
and adding the appropriate C run time configuration code that matches
the settings of the BIOS config file in the function. (e.g. if
configuring the Ip module, the stack thread must call NC_SystemOpen(),
'ti_ndk_config_ip_init(hCfg)', etc.).
config Global.useSemLibs // module-wide |
 |
Variable to cause the semaphore version of the NDK libraries to be linked into a program
Global.useSemLibs = Bool false;
DETAILS
true: link libraries which use Semaphore for kernel mode.
false: (Default) link libraries which use Task priority for kernel mode.
config Global.userAccounts // module-wide |
 |
Array that holds all of the user accounts to be created
Global.addUserAccount() // module-wide |
 |
addUserAccount is used in a config file to add a new user account into
the set of user accounts (and corresponding passwords) that will be
added into the NDK configuration
ARGUMENTS
account
structure of type Account
DETAILS
A user account is created by making a struct Account, setting that
structs username and password for the account to be added, and then
calling this function to add it. For example:
Account acct1;
acct1.username = "user1";
acct1.password = "user1pass";
addUserAccount(acct1);