Hey y'all:
I am doing a lot of NDK work and always start by reading the manuals (SPRU523 SPRU524). We want to be able to assign a static IP to our boards that is stored in non-volatile memory rather than being embedded in the code by xconfig. One can use xconfig to set a static IP, but then it is that value for *all* boards using that code! There is a nice cfgdemo program in the NSP. It has the following lines of code:
//
// ReadConfig()
//
// Read Configuration Info from hCfg Handle
//
static void ReadConfig()
{
CI_SERVICE_DHCPC dhcpc;
CI_IPNET ci_net;
CI_ROUTE RT;
IPN IP;
int i,tmp;
// Get hostname
tmp = CfgGetImmediate( 0, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 1,
31, (UINT8 *)Hostname);
The comment for the function says it will use hCfg in order to communicate with the configuration subsystem. You will notice that the hCfg position in CfgGetImmediate() is a Zero. One would assume from this example that passing Zero will use the default configuration which is presently active. If that is the case, it is NOT documented in SPRU524H. If that is not the case, how does it work if the handle value is really something other than Zero?
Likewise, SPRU524H does not have any list of tags such as CFGTAG_SYSINFO or CFGITEM_DHCP_HOSTNAME. It is a real pain in the rear end to have to go track down a header file in the source tree and then guess what each of those constants does. A solution for putting all of that possibly changing information in SPRU524 is to create a link to a new document (SPRU999 for instance) that gets hyper-linked into SPRU524.
So, the suggestion is to add a whole lot more meat to Appendix G of SPRU524 including a list of ALL possible parameters for the things you can configure. Also, document why you can use Zero for hCfg rather than calling CfgGetDefault() to retrieve the currently active configuration handle. How does it work? Are there pitfalls? Is there some other (perhaps better) way to hold configuration in non-volatile memory and do the configuration at runtime?
Thanks.
Ray