Skip to content

Commit efef921

Browse files
authored
Merge pull request #289 from nasa/integration-candidate
psp Integration candidate: 2021-04-06
2 parents 79b944b + a85e78b commit efef921

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1233
-894
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ set(GENERATED_EXTERNS)
4242
set(GENERATED_KEYVALS)
4343
foreach(PSPMOD ${PSP_TARGET_MODULE_LIST})
4444
add_subdirectory(fsw/modules/${PSPMOD} ${PSPMOD}-${CFE_PSP_TARGETNAME}-impl)
45-
list(APPEND GENERATED_EXTERNS "extern CFE_PSP_ModuleApi_t CFE_PSP_${PSPMOD}_API;\n")
45+
list(APPEND GENERATED_EXTERNS "extern CFE_PSP_ModuleApi_t CFE_PSP_${PSPMOD}_API\;\n")
4646
list(APPEND GENERATED_KEYVALS "{ .Name = \"${PSPMOD}\", .Api = &CFE_PSP_${PSPMOD}_API },\n")
4747
endforeach()
4848

49+
string(CONCAT GENERATED_EXTERNS ${GENERATED_EXTERNS})
50+
string(CONCAT GENERATED_KEYVALS ${GENERATED_KEYVALS})
51+
4952
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/module_list.c.in ${CMAKE_CURRENT_BINARY_DIR}/${CFE_PSP_TARGETNAME}_module_list.c @ONLY)
5053

5154
add_library(psp-${CFE_PSP_TARGETNAME} STATIC
@@ -60,7 +63,7 @@ target_link_libraries(psp-${CFE_PSP_TARGETNAME} PRIVATE
6063
psp_module_api
6164
)
6265

63-
target_include_directories(psp-${CFE_PSP_TARGETNAME} INTERFACE
66+
target_include_directories(psp-${CFE_PSP_TARGETNAME} INTERFACE
6467
fsw/inc
6568
)
6669

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ This is a collection of APIs abstracting platform specific functionality to be l
99

1010
## Version History
1111

12+
13+
### Development Build: v1.5.0-rc1+dev112
14+
15+
- Cleans up stale code from the previous methods of generating 1Hz. Adds a new PSP module that instantiates an OSAL abstract timebase for use with cFE services. This single module is used across all psp implementations (mcp750, pc-linux, pc-rtems). Results in 1Hz timing tick on MCP750 will be more accurate. No changes to Linux or RTEMS
16+
- Fixes segfaults when `CFE_PSP_Port` routines are invoked on Linux.
17+
- Converts `cfe_psp_ram.c` and `cfe_psp_port.c` into modular components and removes from the "shared" directory. The existing implementations become the corresponding "direct" module, and are enabled based on the psp module selection. Adds a "notimpl" variant where all the functions return `CFE_PSP_ERR_NOT_IMPLEMENTED`. This is used on Linux
18+
or any other system where direct access is not possible. Renames the existing `eeprom_stub` module to be `eeprom_notimpl` for consistency and to avoid confusion with the unit test stubs.
19+
- Implements two PSP modules to provide `CFE_PSP_GetTime` and `CFE_PSP_GetTimeBase`, one for POSIX-compliant RTOS using `clock_gettime()` and the other specifically for PowerPC processors on VxWorks that have the `vxTimeBaseGet()` routine. Clarifies and documents the difference and use cases for `CFE_PSP_GetTime` and `CFE_PSP_GetTimeBase`. No impact to behavior.
20+
- Adds a coverage test for the VxWorks PSP timebase module and provides an example of how this can be implemented for other modules.
21+
- See <https://github.com/nasa/PSP/pull/289> and <https://github.com/nasa/cFS/pull/238>
22+
1223
### Development Build: v1.5.0-rc1+dev101
1324

1425
- Removes unnecessary global config structure `Target_PspConfigData` and associated elements infavor of the new version API.

fsw/inc/cfe_psp.h

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@
146146
#define CFE_PSP_RST_SUBTYPE_MAX 10
147147
/** \} */
148148

149+
/**
150+
* \brief The name of the software/RTOS timebase for general system timers.
151+
*
152+
* This name may be referred to by CFE TIME and/or SCH when setting up its own timers.
153+
*/
154+
#define CFE_PSP_SOFT_TIMEBASE_NAME "cFS-Master"
155+
149156
/*
150157
** Type Definitions
151158
*/
@@ -166,10 +173,26 @@ extern void CFE_PSP_Main(void);
166173
** The flight software (i.e. cFE ) should not call this routine.
167174
*/
168175

176+
/**
177+
* \brief Sample/Read a monotonic platform clock with normalization
178+
*
179+
* Outputs an OS_time_t value indicating the time elapsed since an epoch. The
180+
* epoch is not defined, but typically represents the system boot time. The
181+
* value increases continously over time and cannot be reset by software.
182+
*
183+
* This is similar to the CFE_PSP_Get_Timebase(), but additionally it normalizes
184+
* the output value to an OS_time_t, thereby providing consistent units to
185+
* the calling application. Any OSAL-provided routine accepts OS_time_t inputs
186+
* may be used to convert this value into other standardized time units.
187+
*
188+
* \note This should refer to the same time domain as CFE_PSP_Get_Timebase(),
189+
* the primary difference being the format and units of the output value.
190+
*
191+
* \sa CFE_PSP_Get_Timebase()
192+
*
193+
* \param[out] LocalTime Value of PSP tick counter as OS_time_t
194+
*/
169195
extern void CFE_PSP_GetTime(OS_time_t *LocalTime);
170-
/* This call gets the local time from the hardware on the Vxworks system
171-
* on the mcp750s
172-
* on the other os/hardware setup, it will get the time the normal way */
173196

174197
extern void CFE_PSP_Restart(uint32 resetType);
175198
/*
@@ -229,10 +252,31 @@ extern uint32 CFE_PSP_GetTimerLow32Rollover(void);
229252
** CFE_PSP_TIMER_LOW32_ROLLOVER will be 0.
230253
*/
231254

255+
/**
256+
* \brief Sample/Read a monotonic platform clock without normalization
257+
*
258+
* This is defined as a free-running, monotonically-increasing tick counter. The
259+
* epoch is not defined, but typically is the system boot time, and the value increases
260+
* indefinitely as the system runs. The tick period/rate is also not defined.
261+
*
262+
* Rollover events - where the range of representable values is exceeded - are
263+
* theoretically possible, but would take many years of continuous uptime to occur
264+
* (typically hundreds of years, if not thousands). System designers should ensure
265+
* that the actual tick rate and resulting timebase range is sufficiently large to
266+
* ensure that rollover is not a concern.
267+
*
268+
* \note This is a "raw" value from the underlying platform with minimal/no conversions
269+
* or normalization applied. Neither the epoch nor the resolution of this tick
270+
* counter is specified, and it may vary from platform to platform. Use the
271+
* CFE_PSP_GetTime() function to sample the timebase and also convert the units
272+
* into a normalized/more consistent form.
273+
*
274+
* \sa CFE_PSP_GetTime()
275+
*
276+
* \param[out] Tbu Buffer to hold the upper 32 bits of a 64-bit tick counter
277+
* \param[out] Tbl Buffer to hold the lower 32 bits of a 64-bit tick counter
278+
*/
232279
extern void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl);
233-
/*
234-
** CFE_PSP_Get_Timebase
235-
*/
236280

237281
extern uint32 CFE_PSP_Get_Dec(void);
238282
/*

fsw/mcp750-vxworks/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
1414
src/cfe_psp_ssr.c
1515
src/cfe_psp_start.c
1616
src/cfe_psp_support.c
17-
src/cfe_psp_timer.c
1817
src/cfe_psp_watchdog.c
1918
)
2019
target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE

fsw/mcp750-vxworks/inc/cfe_psp_config.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@
3737
#include "taskLib.h"
3838
#include "arch/ppc/esfPpc.h"
3939

40+
/**
41+
* \brief Period of the VxWorks timebase, in nanoseconds
42+
*
43+
* This is expressed as a ratio in case it is not a whole number.
44+
*
45+
* Multiplying the timebase register by 60 should yield a result
46+
* in nanoseconds, and then further dividing by the OSAL OS_time_t tick
47+
* resolution will convert to an OS_time_t compatible value.
48+
*
49+
* On the MCP750 - the PPC timebase runs at 60ns period or ~16.67 MHz.
50+
*
51+
* Note this is distinct from the VxWorks system timer tick which runs,
52+
* confusingly, at 60Hz or a ~16.67ms period.
53+
*/
54+
#define CFE_PSP_VX_TIMEBASE_PERIOD_NUMERATOR 60
55+
#define CFE_PSP_VX_TIMEBASE_PERIOD_DENOMINATOR 1
56+
4057
/*
4158
** This define sets the number of memory ranges that are defined in the memory range defintion
4259
** table.
@@ -51,6 +68,16 @@
5168
*/
5269
#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4
5370

71+
/*
72+
* The tick period that will be configured in the RTOS for the simulated
73+
* time base, in microseconds. This in turn is used to drive the 1hz clock
74+
* and other functions.
75+
*
76+
* On the MCP750 the sysClockRate runs at 60Hz so this is the same period
77+
* that the cFE software timebase will be configured at.
78+
*/
79+
#define CFE_PSP_SOFT_TIMEBASE_PERIOD 16666
80+
5481
/*
5582
** Typedef for the layout of the vxWorks boot record structure
5683
**

fsw/mcp750-vxworks/inc/psp_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/*
3030
* Development Build Macro Definitions
3131
*/
32-
#define CFE_PSP_IMPL_BUILD_NUMBER 101
32+
#define CFE_PSP_IMPL_BUILD_NUMBER 112
3333
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1"
3434

3535
/*
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# This is a list of modules that is included as a fixed/base set
1+
# This is a list of modules that is included as a fixed/base set
22
# when this PSP is selected. They must exist under fsw/modules
33

4+
soft_timebase
5+
timebase_vxworks
46
eeprom_direct
7+
ram_direct
8+
port_direct

fsw/mcp750-vxworks/src/cfe_psp_start.c

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
#include "cfe_psp.h"
6161
#include "cfe_psp_memory.h"
62+
#include "cfe_psp_module.h"
6263

6364
/*
6465
** External Declarations
@@ -74,7 +75,6 @@ IMPORT void sysPciWrite32(UINT32, UINT32);
7475

7576
#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain)
7677
#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile)
77-
#define CFE_PSP_1HZ_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->System1HzISR)
7878

7979
/******************************************************************************
8080
** Function: OS_Application_Startup()
@@ -146,6 +146,11 @@ void OS_Application_Startup(void)
146146
*/
147147
CFE_PSP_SetupReservedMemoryMap();
148148

149+
/*
150+
** Initialize the statically linked modules (if any)
151+
*/
152+
CFE_PSP_ModuleInit();
153+
149154
/*
150155
** Determine Reset type by reading the hardware reset register.
151156
*/
@@ -232,30 +237,3 @@ void OS_Application_Startup(void)
232237
*/
233238
CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE);
234239
}
235-
236-
/******************************************************************************
237-
** Function: OS_Application_Run()
238-
**
239-
** Purpose:
240-
** Idle Loop entry point from OSAL BSP.
241-
**
242-
** Arguments:
243-
** (none)
244-
**
245-
** Return:
246-
** (none)
247-
*/
248-
void OS_Application_Run(void)
249-
{
250-
int TicksPerSecond;
251-
252-
/*
253-
** Main loop for default task and simulated 1hz
254-
*/
255-
for (;;)
256-
{
257-
TicksPerSecond = sysClkRateGet();
258-
(void)taskDelay(TicksPerSecond);
259-
CFE_PSP_1HZ_FUNCTION();
260-
}
261-
}

0 commit comments

Comments
 (0)