Netgear KWGR614 KWGR614 User Manual - Page 7

Define default values for the parameter.

Page 7 highlights

user/dniutil/nvram_realtek.c struct ej_nvram_handler nvram_handlers[] = { . . . {"example_question", nvram_get_example_question, nvram_set_example_question}, {"example_answer", nvram_get_example_answer, nvram_set_example_answer}, { NULL, NULL, NULL }, }; Declare an instance of the parameter for runtime memory use. user/boa/src/dni/board.c exampleParam_t ramExampleParam; //nvram example Define default values for the parameter. user/boa/src/dni/board.c // nvram example exampleParam_t exampleParamDefault[1] = { { "What is the meaning of life, the universe, and everything?", 42 } }; Define the initialization function. user/boa/src/dni/board.c uint32 example_init(void) { /* read cfg from cfgmgr */ if (cfgmgr_read(CFGMGR_TABID_EXAMPLE, \ (void*)&(pRomeCfgParam->exampleParam), \ sizeof(struct exampleParam_t))!=0) { printf("example_init: call cfgmgr_read fail\n"); /* take proper actions */ return NOT_OK; } //printf("example_init\n"); return OK; } /* end example_init */ Add the function to system initialization. user/boa/src/dni/board.c KWGR Open Source Guide (Rev 2.0)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

KWGR Open Source Guide (Rev 2.0)
user/dniutil/nvram_realtek.c
Declare an instance of the parameter for runtime memory use.
user/boa/src/dni/board.c
Define default values for the parameter.
user/boa/src/dni/board.c
Define the initialization function.
user/boa/src/dni/board.c
Add the function to system initialization.
user/boa/src/dni/board.c
// nvram example
exampleParam_t exampleParamDefault[1] =
{
{
"What is the meaning of life, the universe, and everything?",
42
}
};
exampleParam_t
ramExampleParam;
//nvram example
uint32 example_init(void)
{
/* read cfg from cfgmgr */
if (cfgmgr_read(CFGMGR_TABID_EXAMPLE, \
(void*)&(pRomeCfgParam->exampleParam), \
sizeof(struct exampleParam_t))!=0)
{
printf("example_init: call cfgmgr_read fail\n");
/* take proper actions */
return NOT_OK;
}
//printf("example_init\n");
return OK;
} /* end example_init */
struct ej_nvram_handler nvram_handlers[] =
{
. . .
{"example_question", nvram_get_example_question, nvram_set_example_question},
{"example_answer", nvram_get_example_answer, nvram_set_example_answer},
{ NULL, NULL, NULL },
};