-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'github-nasa/main' into techdev-iodriver
- Loading branch information
Showing
22 changed files
with
786 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2023 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. You may obtain | ||
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
************************************************************************/ | ||
|
||
/** | ||
* \file | ||
* | ||
* Internal header for vxworks_sysmon.c | ||
*/ | ||
|
||
#ifndef VXWORKS_SYSMON_H_ | ||
#define VXWORKS_SYSMON_H_ | ||
|
||
/******************************************************************** | ||
* Local Defines | ||
********************************************************************/ | ||
#ifdef OS_MAXIMUM_PROCESSORS | ||
#define VXWORKS_SYSMON_MAX_CPUS OS_MAXIMUM_PROCESSORS | ||
#else | ||
#define VXWORKS_SYSMON_MAX_CPUS 1 | ||
#endif | ||
|
||
#define VXWORKS_SYSMON_AGGREGATE_SUBSYS 0 | ||
#define VXWORKS_SYSMON_CPULOAD_SUBSYS 1 | ||
#define VXWORKS_SYSMON_AGGR_CPULOAD_SUBCH 0 | ||
#define VXWORKS_SYSMON_SAMPLE_DELAY 1000 | ||
#define VXWORKS_SYSMON_TASK_PRIORITY 100 | ||
#define VXWORKS_SYSMON_STACK_SIZE 4096 | ||
#define VXWORKS_AUX_CLOCK_INTERRUPT_FREQ 100 /* Frequency to collect data (interrupts per second) */ | ||
#define VXWORKS_SYSMON_MAX_SCALE 100 | ||
#define VXWORKS_SYSMON_TASK_NAME "VXWORKS SYSMON" | ||
#define VXWORKS_SYSMON_MAX_SPY_TASKS 100 /* Max number of tasks to spy on */ | ||
|
||
#ifdef DEBUG_BUILD | ||
#define VXWORKS_SYSMON_DEBUG(...) OS_printf(__VA_ARGS__) | ||
#else | ||
#define VXWORKS_SYSMON_DEBUG(...) | ||
#endif | ||
|
||
/******************************************************************** | ||
* Local Type Definitions | ||
********************************************************************/ | ||
typedef struct vxworks_sysmon_va_arg | ||
{ | ||
char *name; | ||
char *placeholder; /* empty */ | ||
int total_idle_percent; | ||
int total_idle_ticks; | ||
int idle_percent_since_last_report; | ||
int idle_ticks_since_last_report; | ||
|
||
} vxworks_sysmon_va_arg_t; | ||
|
||
typedef struct vxworks_sysmon_cpuload_core | ||
{ | ||
CFE_PSP_IODriver_AdcCode_t avg_load; | ||
|
||
vxworks_sysmon_va_arg_t idle_state; | ||
} vxworks_sysmon_cpuload_core_t; | ||
|
||
typedef struct vxworks_sysmon_cpuload_state | ||
{ | ||
volatile bool is_running; | ||
volatile bool should_run; | ||
|
||
osal_id_t task_id; | ||
|
||
uint8_t num_cpus; | ||
|
||
vxworks_sysmon_cpuload_core_t per_core[VXWORKS_SYSMON_MAX_CPUS]; | ||
|
||
} vxworks_sysmon_cpuload_state_t; | ||
|
||
typedef struct vxworks_sysmon_state | ||
{ | ||
uint32_t local_module_id; | ||
vxworks_sysmon_cpuload_state_t cpu_load; | ||
} vxworks_sysmon_state_t; | ||
|
||
/******************************************************************** | ||
* Local Function Prototypes | ||
********************************************************************/ | ||
int vxworks_sysmon_update_stat(const char *fmt, ...); | ||
void vxworks_sysmon_Task(void); | ||
|
||
int32_t vxworks_sysmon_Start(vxworks_sysmon_cpuload_state_t *state); | ||
int32_t vxworks_sysmon_Stop(vxworks_sysmon_cpuload_state_t *state); | ||
|
||
int32_t vxworks_sysmon_aggregate_dispatch(uint32_t CommandCode, uint16_t Subchannel, CFE_PSP_IODriver_Arg_t Arg); | ||
int32_t vxworks_sysmon_calc_aggregate_cpu(vxworks_sysmon_cpuload_state_t *state, CFE_PSP_IODriver_AdcCode_t *Val); | ||
|
||
/* Function that starts up vxworks_sysmon driver. */ | ||
int32_t vxworks_sysmon_DevCmd(uint32_t CommandCode, uint16_t SubsystemId, uint16_t SubchannelId, | ||
CFE_PSP_IODriver_Arg_t Arg); | ||
|
||
#endif /* VXWORKS_SYSMON_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
###################################################################### | ||
# | ||
# CMAKE build recipe for white-box coverage tests of VxWorks timebase module | ||
# | ||
add_definitions(-D_CFE_PSP_MODULE_) | ||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/inc") | ||
include_directories("${CFEPSP_SOURCE_DIR}/fsw/modules/iodriver/inc") | ||
include_directories("${CFEPSP_SOURCE_DIR}/fsw/modules/vxworks_sysmon") | ||
|
||
add_psp_covtest(vxworks_sysmon src/coveragetest-vxworks_sysmon.c | ||
${CFEPSP_SOURCE_DIR}/fsw/modules/vxworks_sysmon/vxworks_sysmon.c | ||
) |
63 changes: 63 additions & 0 deletions
63
unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: | ||
* Draco | ||
* | ||
* Copyright (c) 2023 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. You may obtain | ||
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
**********************************************************************/ | ||
|
||
/* | ||
* | ||
* Copyright (c) 2023, United States government as represented by the | ||
* administrator of the National Aeronautics Space Administration. | ||
* All rights reserved. This software was created at NASA Goddard | ||
* Space Flight Center pursuant to government contracts. | ||
* | ||
* This is governed by the NASA Open Source Agreement and may be used, | ||
* distributed and modified only according to the terms of that agreement. | ||
* | ||
*/ | ||
|
||
/** | ||
* \file | ||
* \ingroup vxworks | ||
* \author anh.d.van@nasa.gov | ||
* | ||
*/ | ||
|
||
#ifndef COVERAGETEST_VXWORKS_SYSMON_H | ||
#define COVERAGETEST_VXWORKS_SYSMON_H | ||
|
||
#include "utassert.h" | ||
#include "uttest.h" | ||
#include "utstubs.h" | ||
|
||
#include "iodriver_analog_io.h" | ||
#include "iodriver_base.h" | ||
#include "iodriver_impl.h" | ||
#include "vxworks_sysmon.h" | ||
|
||
void UT_TaskDelay_Hook(void *UserObj); | ||
|
||
void Test_Init_Nominal(void); | ||
void Test_Entry_Nominal(void); | ||
void Test_Aggregate_Nominal(void); | ||
void Test_Aggregate_Error(void); | ||
void Test_Dispatch_Nominal(void); | ||
void Test_Dispatch_Error(void); | ||
void Test_UpdateStat_Nominal(void); | ||
void Test_Task_Nominal(void); | ||
void Test_Task_Error(void); | ||
|
||
#endif |
Oops, something went wrong.