Skip to content

Commit

Permalink
started implementing psp freertos functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiaPT committed Jul 5, 2024
1 parent f592144 commit fcd5f3d
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fsw/freertos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include_directories(inc)

add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT
src/cfe_psp_timer.c
src/cfe_psp_support.c
)
12 changes: 12 additions & 0 deletions fsw/freertos/inc/cfe_psp_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _cfe_psp_config_
#define _cfe_psp_config_


// FreeRTOS headers
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/queue.h"


#endif
64 changes: 64 additions & 0 deletions fsw/freertos/inc/psp_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-2019 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 freertos/inc/psp_version.h
* @brief Purpose:
* @details Provide version identifiers for the cFE Platform Support Packages (PSP).
* See @ref cfsversions for version and build number and description
*/
#ifndef _psp_version_
#define _psp_version_

/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 1
#define CFE_PSP_IMPL_BUILD_BASELINE "v0.0.1-rc1"

/*
* Version Macro Definitions
*/
#define CFE_PSP_IMPL_MAJOR_VERSION 10/*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */
#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */
#define CFE_PSP_IMPL_REVISION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision number. */
#define CFE_PSP_IMPL_MISSION_REV 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased development version. */

/*
* Tools to construct version string
*/
#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */
#define CFE_PSP_IMPL_STR(x) \
CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */

/*! @brief Development Build Version Number.
* @details Baseline git tag + Number of commits since baseline. @n
* See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER)

/*! @brief Development Build Version String.
* @details Reports the current development build's baseline, number, and name. Also includes a note about the latest
* official version. @n See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_PSP_IMPL_VERSION_STRING \
" PSP DEVELOPMENT BUILD " CFE_PSP_IMPL_VERSION /* Codename for current development */ \
", Last Official Release: psp v0.0.0" /* For full support please use this version */

#endif /* _psp_version_ */
16 changes: 16 additions & 0 deletions fsw/freertos/src/cfe_psp_memory.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "common_types.h"
#include "osapi.h"

// TODO: set blocksize of cds memory in reserved memory map
init32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS)
{
int32 return_code;

if (SizeOfCDS == NULL)
{
return OS_ERROR;
}

/* set blocksize of cds memory in reserved memory map */
return OS_SUCCESS;
}
71 changes: 71 additions & 0 deletions fsw/freertos/src/cfe_psp_support.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 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.
************************************************************************/

#include "target_config.h"

#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.CpuId)
#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.CpuName)
#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.SpacecraftId)


// TODO: Fully implement after specifying the structure of the reserved memory map
void CFE_PSP_Restart(uint32 resetType)
{
if (resetType == CFE_PSP_RST_TYPE_POWERON)
{
/* set bootptr of reserved memory map */
/* flush caches */
/* reboot clear */
}
else
{
/* set bootptr of reserved memory map */
/* flush caches */
/* reboot normal */
}
}

// TODO
void CFE_PSP_Panic(int32 errorCode)
{
/* exit with a failure code */
}


// TODO
void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size)
{
/* flush cache of size at address */
}


uint32 CFE_PSP_GetProcessorId(void)
{
return CFE_PSP_CPU_ID;
}

uint32 CFE_PSP_GetSpacecraftId(void)
{
return CFE_PSP_SPACECRAFT_ID;
}

const char *CFE_PSP_GetProcessorName(void)
{
return CFE_PSP_CPU_NAME;
}

11 changes: 11 additions & 0 deletions fsw/freertos/src/cfe_psp_timer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#define CFE_PSP_TIMER_TICKS_PER_SECOND ((int32) configTICK_RATE_HZ)

uint32 CFE_PSP_GetTimerTicksPerSecond(void)
{
return CFE_PSP_TIMER_TICKS_PER_SECOND;
}

uint32 CFE_PSP_GetTimerLow32Rollover(void)
{
return 0;
}

0 comments on commit fcd5f3d

Please sign in to comment.