int main(void) { int32 MemDwellAppId = 5; char MemDwellAppName[10]; /********************************/ /* Set up input file */ /********************************/ UTF_add_input_file(CFS_MD_CMD_PIPE, "md_unit_test3.in"); MD_AppData.CmdPipe = CFS_MD_CMD_PIPE; /********************************/ /* Set up output file */ /********************************/ UTF_set_output_filename("md_unit_test3.out"); #ifdef UTF_USE_STDOUT UTF_put_text("Std output is being used. \n"); #endif /**************************************************/ /* Initialize Unit Test Framework */ /**************************************************/ /* Initialize the CDS */ UTF_put_text("\n***Initialize UTF ***\n"); CFE_ES_CDS_EarlyInit(); UTF_CFE_Init(); /********************************/ /* Initialize simulation time */ /********************************/ UTF_init_sim_time(1000.00); /**************************************************/ /* Add tasks to ES's list of tasks, and */ /* register local task with Executive Services. */ /**************************************************/ UTF_put_text("\n***Add tasks to ES list of tasks ***\n"); UTF_ES_InitTaskRecords(); MemDwellAppId = UTF_ES_GetFreeTaskRecord(); if (MemDwellAppId < 0) { UTF_put_text("\n***Error return from UTF_ES_GetFreeTaskRecord***\n"); exit(0); } strcpy(MemDwellAppName,"MD_APP"); UTF_ES_AddAppRecord(MemDwellAppName, MemDwellAppId); UTF_ES_DumpAppRecords(); /* UTF_put_text("\n***Register local task with ES***\n"); */ /* CFE_ES_RegisterApp(); */ /* Register local task with ES */ /**************************************************/ /* Add "Special" Commands */ /**************************************************/ UTF_add_special_command("SET_MEM_RANGE_FALSE", UTF_SetMemRangeError); UTF_add_special_command("SET_MEM_RANGE_VALID", UTF_SetMemRangeValid); UTF_add_special_command("DISPLAY_TABLE_REGISTRY", UTF_SCRIPT_DisplayTableRegistry); UTF_add_special_command("ADD_SIM_MEMORY", UTF_AddSimulatedMemory); UTF_add_special_command("SET_SB_RETURN_CODE", UTF_SCRIPT_SB_Set_Api_Return_Code); UTF_add_special_command("USE_DEFAULT_SB_RETURN_CODE", UTF_SCRIPT_SB_Use_Default_Api_Return_Code); UTF_add_special_command("SET_TBL_RETURN_CODE", UTF_SCRIPT_TBL_Set_Api_Return_Code); UTF_add_special_command("USE_DEFAULT_TBL_RETURN_CODE", UTF_SCRIPT_TBL_Use_Default_Api_Return_Code); /**************************************************/ /* Start Memory Dwell application */ /**************************************************/ UTF_TBL_set_function_hook(CFE_TBL_REGISTER_HOOK, (void *) &CFE_TBL_Register_FunctionHook); UTF_TBL_set_function_hook(CFE_TBL_GETADDRESS_HOOK, (void *) &CFE_TBL_GetAddress_FunctionHook); /**************************************************/ /* Start Memory Dwell application */ /**************************************************/ UTF_put_text("\n*** Start Memory Dwell Main Task ***\n"); MD_AppMain(); /**************************************************/ /* Here we've reached the end of input file processing */ /**************************************************/ /********************************************************/ /* Simulate pipe read error from Software Bus Services. */ /********************************************************/ UTF_CFE_ES_Set_Api_Return_Code(CFE_ES_RUNLOOP_PROC, TRUE ); ; UTF_ES_InitTaskRecords(); UTF_ES_DumpAppRecords(); ; MemDwellAppId = UTF_ES_GetFreeTaskRecord(); if (MemDwellAppId < 0) { UTF_put_text("\n***Error return from UTF_ES_GetFreeTaskRecord***\n"); exit(0); } ; strcpy(MemDwellAppName,"MD_APP"); ;UTF_ES_AddAppRecord(MemDwellAppName, (uint32)MemDwellAppId); UTF_put_text("\n* * * * * * * * * * * * * * * * * * * * * * \n"); /**************************************************/ /* Test Table Services APIs */ /**************************************************/ UTF_CFE_TBL_DisplayTableRegistryContents(); exit(0); }
int main(void) { int32 MemDwellAppId = 5; char MemDwellAppName[10]; /********************************/ /* Set up input file */ /********************************/ UTF_add_input_file(CFS_MD_CMD_PIPE, "md_unit_test4.in"); MD_AppData.CmdPipe = CFS_MD_CMD_PIPE; /********************************/ /* Set up output file */ /********************************/ UTF_set_output_filename("md_unit_test4.out"); #ifdef UTF_USE_STDOUT UTF_put_text("Std output is being used. \n"); #endif /**************************************************/ /* Initialize Unit Test Framework */ /**************************************************/ /* Initialize the CDS */ UTF_put_text("\n***Initialize UTF ***\n"); CFE_ES_CDS_EarlyInit(); UTF_CFE_Init(); /********************************/ /* Initialize simulation time */ /********************************/ UTF_init_sim_time(1.5); /**************************************************/ /* Add volume to hold loadfiles */ /**************************************************/ #if MD_SIGNATURE_OPTION == 1 UTF_add_volume("/", "ram", FS_BASED, FALSE, FALSE, TRUE, "RAM", "/ram", 0); #else UTF_add_volume("/", "ramnosig", FS_BASED, FALSE, FALSE, TRUE, "RAM", "/ram", 0); #endif /**************************************************/ /* Add tasks to ES's list of tasks, and */ /* register local task with Executive Services. */ /**************************************************/ UTF_put_text("\n***Add tasks to ES list of tasks ***\n"); UTF_ES_InitTaskRecords(); MemDwellAppId = UTF_ES_GetFreeTaskRecord(); if (MemDwellAppId < 0) { UTF_put_text("\n***Error return from UTF_ES_GetFreeTaskRecord***\n"); exit(0); } strcpy(MemDwellAppName,"MD"); UTF_ES_AddAppRecord(MemDwellAppName, MemDwellAppId); UTF_ES_DumpAppRecords(); /**************************************************/ /* Add "Special" Commands */ /**************************************************/ UTF_add_special_command("SET_MEM_RANGE_FALSE", UTF_SetMemRangeError); UTF_add_special_command("SET_MEM_RANGE_VALID", UTF_SetMemRangeValid); UTF_add_special_command("LOAD_TABLE_FROM_GROUND", UTF_SCRIPT_LoadTableFromGround); UTF_add_special_command("DISPLAY_TABLE_REGISTRY", UTF_SCRIPT_DisplayTableRegistry); UTF_add_special_command("ADD_SIM_MEMORY", UTF_AddSimulatedMemory); UTF_add_special_command("SET_SB_RETURN_CODE", UTF_SCRIPT_SB_Set_Api_Return_Code); UTF_add_special_command("USE_DEFAULT_SB_RETURN_CODE", UTF_SCRIPT_SB_Use_Default_Api_Return_Code); UTF_add_special_command("SET_TBL_RETURN_CODE", UTF_SCRIPT_TBL_Set_Api_Return_Code); UTF_add_special_command("USE_DEFAULT_TBL_RETURN_CODE", UTF_SCRIPT_TBL_Use_Default_Api_Return_Code); /**************************************************/ /* Start Memory Dwell application */ /**************************************************/ UTF_put_text("\n*** Start Memory Dwell Main Task ***\n"); MD_AppMain(); /**************************************************/ /* Here we've reached the end of input file processing */ /**************************************************/ /**************************************************/ /* Test Table Services APIs */ /**************************************************/ UTF_CFE_TBL_DisplayTableRegistryContents(); exit(0); }