void UTF_SCRIPT_LoadTableFromGround(int argc, char *argv[]) { char Table_Name[30], File_Name[50]; /* UTF_put_text("Entered UTF_SCRIPT_LoadTableFromGround\n"); */ if (argc != 3) { UTF_error("Error: Read %d args w/script cmd LOAD_TABLE_FROM_GROUND. Expected 2.\n", argc - 1); UTF_exit(); } strcpy(Table_Name, argv[1]); strcpy(File_Name, argv[2]); UTF_put_text("Table_Name is %s\n", Table_Name); UTF_put_text("File_Name is %s\n", File_Name); UTF_TBL_LoadTableFromGround(Table_Name, File_Name); return; }
void not_working(void) { /* I never got this to work with the 'open' function call, */ /* & so used fopen instead. See Create_input_File0 */ int to; int8 values[4] = {5,10,15,20}; to = open("/ram/tt_table_initial_values.dat", O_WRONLY | O_CREAT, 0644); if (to < 0) { UTF_error("Error opening file /tt_table_initial_values.dat to write\n"); UTF_exit(); } write(to, values, 4); close(to); }
void UTF_SCRIPT_EVS_Set_Api_Return_Code(int argc,char *argv[]) { int32 Index; int32 Code; /* Check for correct number of arguments */ if (argc != 3) { UTF_error("UTF Error: Read %d args w/script cmd UTF_SCRIPT_EVS_Set_Api_Return_Code. Expected 2.\n", argc -1 ); UTF_exit(); } /* Extract argument values */ Index = UTF_arg2dbl(argv[1]); Code = UTF_arg2uint(argv[2]); /* Call function to set API return code */ UTF_CFE_EVS_Set_Api_Return_Code(Index, Code); return; }
void UTF_SCRIPT_SB_Use_Default_Api_Return_Code(int argc,char *argv[]) { int32 Index; /* Check for correct number of arguments */ if (argc != 2) { UTF_error("UTF Error: Read %d args w/script cmd UTF_SCRIPT_SB_Set_Api_Return_Code. Expected 1.\n", argc -1 ); UTF_exit(); } /* Extract argument values */ Index = UTF_arg2dbl(argv[1]); /* Call function to set API return code */ UTF_CFE_SB_Set_Api_Return_Code(Index, UTF_CFE_USE_DEFAULT_RETURN_CODE); return; }
void UTF_SCRIPT_LoadTableFromGround(int argc,char *argv[]) { int debug = 1; int32 status; char Table_Name[30], File_Name[50]; if (argc != 3) { UTF_error("Error: Read %d args w/script cmd LOAD_TABLE_FROM_GROUND. Expected 2.\n", argc -1 ); UTF_exit(); } strcpy(Table_Name,argv[1]); strcpy(File_Name,argv[2]); if (debug) UTF_put_text("UTF_SCRIPT_LoadTableFromGround called for Table_Name = '%s', File_Name = '%s'\n", Table_Name, File_Name); status = UTF_TBL_LoadTableFromGround(Table_Name, File_Name); if (debug) UTF_put_text("UTF_TBL_LoadTableFromGround returned %d", status); return; }
/****************************************************************************** ** Name: CFE_SB_RcvMsg ** ** Purpose: Simulates the API used to receive a message from the software bus. ** ** Assumptions, External Events, and Notes: ** None ** ** Routines Called: ** UTF_get_buffer ** UTF_get_data ** UTF_put_packet ** ** Date Written: ** 07/25/2005 ** ** Input Arguments: ** PipeId ** BufPtr ** timeOut - CFE_SB_PEND, CFE_SB_POLL or millisecond timeout ** ** Output Arguments: ** None ** ** Return Values: ** Status ** ******************************************************************************/ int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut) { boolean status; static void *temp = NULL; /* Grab a buffer from the buffer_table the first time CFE_SB_RcvMsg */ /* is called. This buffer is reused for the remaining calls. */ if (temp == NULL) { temp = (void *)UTF_get_buffer(); if (temp == NULL) UTF_error("UTF_get_buffer returned null\n"); } /* Assign the caller's pointer to point to our allocated buffer */ *BufPtr = temp; status = UTF_get_data(PipeId, *BufPtr, UTF_BUFFER_SIZE, UTF_AS_WORD); if (status == TRUE) /* Message was received */ { /* UTF_put_packet, in utf_sb.c, displays packet */ UTF_put_packet (UTF_SOURCE_RECEIVE, (CCSDS_PriHdr_t *)*BufPtr); /* Handle Preset & Special Return Codes */ if ((cfe_sb_api_return_value[CFE_SB_RCVMSG_PROC] != UTF_CFE_USE_DEFAULT_RETURN_CODE) && (cfe_sb_api_return_value[CFE_SB_RCVMSG_PROC] != UTF_CFE_SB_RCVMSG_EXIT_RETURN_CODE)) { return cfe_sb_api_return_value[CFE_SB_RCVMSG_PROC]; } return(CFE_SUCCESS); } else /* no data available */ { /* Arrive here when empty pipe is indicated in test script*/ /* Handle Preset & Special Return Codes */ if ((cfe_sb_api_return_value[CFE_SB_RCVMSG_PROC] != UTF_CFE_USE_DEFAULT_RETURN_CODE) && (cfe_sb_api_return_value[CFE_SB_RCVMSG_PROC] != UTF_CFE_SB_RCVMSG_EXIT_RETURN_CODE)) { return cfe_sb_api_return_value[CFE_SB_RCVMSG_PROC]; } /* Handle default behavior for empty pipe indication */ switch (TimeOut) { case CFE_SB_PEND_FOREVER: /* Handle Special Return Code */ /* This code must be explicitly set by the caller. * This will exit the test process */ if (cfe_sb_api_return_value[CFE_SB_RCVMSG_PROC] == UTF_CFE_SB_RCVMSG_EXIT_RETURN_CODE) { UTF_exit(); } return CFE_SB_NO_MESSAGE; break; case CFE_SB_POLL: return CFE_SB_NO_MESSAGE; break; default: return CFE_SB_TIME_OUT; break; } } } /* end CFE_SB_RcvMsg */
void CFE_PSP_Panic(int32 ErrorCode) { UTF_put_text("CFE_PSP_Panic Called with error code = 0x%08X. Exiting.\n",(unsigned int)ErrorCode); UTF_put_text("The cFE could not start.\n"); UTF_exit(); }