Skip to content

Commit a8ae3bc

Browse files
committed
Merge IC:Caelum-rc4+dev11: psp v1.6.0-rc4+dev41
- Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C - See <nasa/cFS#505>
2 parents 4bf1eef + aa25819 commit a8ae3bc

File tree

9 files changed

+184
-24
lines changed

9 files changed

+184
-24
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ This repository contains NASA's Platform Support Package (PSP), which is a frame
77

88
This is a collection of APIs abstracting platform specific functionality to be located in the `psp` subdirectory of a cFS Mission Tree. The Core Flight System is bundled at <https://github.com/nasa/cFS>, which includes build and execution instructions.
99

10-
## Version History
10+
## Changelog
11+
12+
### Development Build: v1.6.0-rc4+dev41
13+
14+
- Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C
15+
- See <https://github.com/nasa/cFS/pull/505>
1116

1217
### Development Build: v1.6.0-rc4+dev38
1318

fsw/inc/cfe_psp.h

+2-20
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,12 @@
3939
#include "common_types.h"
4040
#include "osapi.h"
4141

42+
#include "cfe_psp_error.h"
43+
4244
/*
4345
** Macro Definitions
4446
*/
4547

46-
/*
47-
** Error and return codes
48-
*/
49-
#define CFE_PSP_SUCCESS (0)
50-
#define CFE_PSP_ERROR (-1)
51-
#define CFE_PSP_INVALID_POINTER (-2)
52-
#define CFE_PSP_ERROR_ADDRESS_MISALIGNED (-3)
53-
#define CFE_PSP_ERROR_TIMEOUT (-4)
54-
#define CFE_PSP_INVALID_INT_NUM (-5)
55-
#define CFE_PSP_INVALID_MEM_ADDR (-21)
56-
#define CFE_PSP_INVALID_MEM_TYPE (-22)
57-
#define CFE_PSP_INVALID_MEM_RANGE (-23)
58-
#define CFE_PSP_INVALID_MEM_WORDSIZE (-24)
59-
#define CFE_PSP_INVALID_MEM_SIZE (-25)
60-
#define CFE_PSP_INVALID_MEM_ATTR (-26)
61-
#define CFE_PSP_ERROR_NOT_IMPLEMENTED (-27)
62-
#define CFE_PSP_INVALID_MODULE_NAME (-28)
63-
#define CFE_PSP_INVALID_MODULE_ID (-29)
64-
#define CFE_PSP_NO_EXCEPTION_DATA (-30)
65-
6648
/*
6749
** Definitions for PSP PANIC types
6850
*/

fsw/inc/cfe_psp_error.h

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/************************************************************************
2+
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
3+
*
4+
* Copyright (c) 2020 United States Government as represented by the
5+
* Administrator of the National Aeronautics and Space Administration.
6+
* All Rights Reserved.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
9+
* not use this file except in compliance with the License. You may obtain
10+
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
************************************************************************/
18+
#ifndef CFE_PSP_ERROR_H
19+
#define CFE_PSP_ERROR_H
20+
21+
/**
22+
* \file
23+
* \brief cFE PSP Error header
24+
*/
25+
26+
#include "common_types.h"
27+
28+
/**
29+
* \brief PSP Status type for readability and potentially type safety
30+
*/
31+
typedef int32 CFE_PSP_Status_t;
32+
33+
/**
34+
* \brief PSP Status macro for literal
35+
*/
36+
#define CFE_PSP_STATUS_C(X) ((CFE_PSP_Status_t)(X))
37+
38+
/**
39+
* \brief PSP Status converted to string length limit
40+
*
41+
* Used for sizing CFE_PSP_StatusString_t intended for use in printing CFE_PSP_Status_t values
42+
* Sized for %ld (LONG_MIN) including NULL
43+
*/
44+
#define CFE_PSP_STATUS_STRING_LENGTH 12
45+
46+
/**
47+
* @brief For the @ref CFE_PSP_StatusToString() function, to ensure
48+
* everyone is making an array of the same length.
49+
*/
50+
typedef char CFE_PSP_StatusString_t[CFE_PSP_STATUS_STRING_LENGTH];
51+
52+
/**
53+
* @brief Convert status to a string
54+
*
55+
* @param[in] status Status value to convert
56+
* @param[out] status_string Buffer to store status converted to string
57+
*
58+
* @return Passed in string pointer
59+
*/
60+
char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string);
61+
62+
/*
63+
* Error and return codes
64+
*/
65+
#define CFE_PSP_SUCCESS (CFE_PSP_STATUS_C(0))
66+
#define CFE_PSP_ERROR (CFE_PSP_STATUS_C(-1))
67+
#define CFE_PSP_INVALID_POINTER (CFE_PSP_STATUS_C(-2))
68+
#define CFE_PSP_ERROR_ADDRESS_MISALIGNED (CFE_PSP_STATUS_C(-3))
69+
#define CFE_PSP_ERROR_TIMEOUT (CFE_PSP_STATUS_C(-4))
70+
#define CFE_PSP_INVALID_INT_NUM (CFE_PSP_STATUS_C(-5))
71+
#define CFE_PSP_INVALID_MEM_ADDR (CFE_PSP_STATUS_C(-21))
72+
#define CFE_PSP_INVALID_MEM_TYPE (CFE_PSP_STATUS_C(-22))
73+
#define CFE_PSP_INVALID_MEM_RANGE (CFE_PSP_STATUS_C(-23))
74+
#define CFE_PSP_INVALID_MEM_WORDSIZE (CFE_PSP_STATUS_C(-24))
75+
#define CFE_PSP_INVALID_MEM_SIZE (CFE_PSP_STATUS_C(-25))
76+
#define CFE_PSP_INVALID_MEM_ATTR (CFE_PSP_STATUS_C(-26))
77+
#define CFE_PSP_ERROR_NOT_IMPLEMENTED (CFE_PSP_STATUS_C(-27))
78+
#define CFE_PSP_INVALID_MODULE_NAME (CFE_PSP_STATUS_C(-28))
79+
#define CFE_PSP_INVALID_MODULE_ID (CFE_PSP_STATUS_C(-29))
80+
#define CFE_PSP_NO_EXCEPTION_DATA (CFE_PSP_STATUS_C(-30))
81+
82+
#endif /* CFE_PSP_ERROR_H */

fsw/mcp750-vxworks/inc/psp_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/*
2828
* Development Build Macro Definitions
2929
*/
30-
#define CFE_PSP_IMPL_BUILD_NUMBER 38
30+
#define CFE_PSP_IMPL_BUILD_NUMBER 41
3131
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4"
3232

3333
/*

fsw/pc-linux/inc/psp_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/*
2828
* Development Build Macro Definitions
2929
*/
30-
#define CFE_PSP_IMPL_BUILD_NUMBER 38
30+
#define CFE_PSP_IMPL_BUILD_NUMBER 41
3131
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4"
3232

3333
/*

fsw/pc-rtems/inc/psp_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/*
2828
* Development Build Macro Definitions
2929
*/
30-
#define CFE_PSP_IMPL_BUILD_NUMBER 38
30+
#define CFE_PSP_IMPL_BUILD_NUMBER 41
3131
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4"
3232

3333
/*

fsw/shared/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
# Build the shared implementation as a library
1515
add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT
16+
src/cfe_psp_error.c
1617
src/cfe_psp_exceptionstorage.c
1718
src/cfe_psp_memrange.c
1819
src/cfe_psp_memutils.c

fsw/shared/src/cfe_psp_error.c

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/************************************************************************
2+
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
3+
*
4+
* Copyright (c) 2020 United States Government as represented by the
5+
* Administrator of the National Aeronautics and Space Administration.
6+
* All Rights Reserved.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
9+
* not use this file except in compliance with the License. You may obtain
10+
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
************************************************************************/
18+
19+
/**
20+
* \file
21+
*
22+
* Implements error APIs
23+
*/
24+
#include <stdio.h>
25+
26+
#include "cfe_psp_error.h"
27+
28+
/*----------------------------------------------------------------
29+
*
30+
* Function: CFE_PSP_StatusToString
31+
*
32+
* Purpose: Implemented per public PSP API
33+
* See description in API and header file for detail
34+
*
35+
*-----------------------------------------------------------------*/
36+
char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string)
37+
{
38+
char *string = NULL;
39+
40+
if (status_string != NULL)
41+
{
42+
snprintf(*status_string, sizeof(*status_string), "%ld", (long)status);
43+
string = *status_string;
44+
}
45+
return string;
46+
}

ut-stubs/cfe_psp_error_stubs.c

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/************************************************************************
2+
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
3+
*
4+
* Copyright (c) 2020 United States Government as represented by the
5+
* Administrator of the National Aeronautics and Space Administration.
6+
* All Rights Reserved.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
9+
* not use this file except in compliance with the License. You may obtain
10+
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
************************************************************************/
18+
#define CFE_PSP_ERROR_H
19+
20+
/**
21+
* @file
22+
*
23+
* Auto-Generated stub implementations for functions defined in cfe_psp_error header
24+
*/
25+
26+
#include "cfe_psp_error.h"
27+
#include "utgenstub.h"
28+
29+
/*
30+
* ----------------------------------------------------
31+
* Generated stub function for CFE_PSP_StatusToString()
32+
* ----------------------------------------------------
33+
*/
34+
char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string)
35+
{
36+
UT_GenStub_SetupReturnBuffer(CFE_PSP_StatusToString, char *);
37+
38+
UT_GenStub_AddParam(CFE_PSP_StatusToString, CFE_PSP_Status_t, status);
39+
UT_GenStub_AddParam(CFE_PSP_StatusToString, CFE_PSP_StatusString_t *, status_string);
40+
41+
UT_GenStub_Execute(CFE_PSP_StatusToString, Basic, NULL);
42+
43+
return UT_GenStub_GetReturnValue(CFE_PSP_StatusToString, char *);
44+
}

0 commit comments

Comments
 (0)