Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions fsw/generic-qnx/inc/cfe_psp_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ typedef pthread_t CFE_PSP_Exception_SysTaskId_t;
*/
typedef struct
{
struct timespec event_time;
siginfo_t si;
int32 ValidAddrs;
struct timespec event_time;
siginfo_t si;
int32 ValidAddrs;

/*
** This is a variably-filled array based on the number of entries
Expand All @@ -134,7 +134,7 @@ typedef struct
/*
** This define sets the default core affinity for the core cFE tasks.
*/
#if defined (OS_CORE_AFFINITY)
#if defined(OS_CORE_AFFINITY)
#define CFE_PSP_DEFAULT_CORE_AFFINITY OS_CORE_AFFINITY
#else
#define CFE_PSP_DEFAULT_CORE_AFFINITY (0)
Expand Down
16 changes: 8 additions & 8 deletions fsw/generic-qnx/inc/cfe_psp_cpuset.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
* operating system (struct _thread_runmask) to set the runmask and inherit mask.
*
* Applications should not directly access fields within this structure,
* as the pointer configuration may change based on the number of processors in
* as the pointer configuration may change based on the number of processors in
* the running system.
*/
typedef struct
{
int32 size; /**< The size of the QNX run/inherit mask */
uint32 *runmask; /**< The QNX run mask pointer */
uint32 *inherit_mask; /**< The QNX inherit mask pointer */
uint32 mask_data[8]; /**< The QNX run mask and inherit mask storage (supports maximum of 128 processors) */
int32 size; /**< The size of the QNX run/inherit mask */
uint32 *runmask; /**< The QNX run mask pointer */
uint32 *inherit_mask; /**< The QNX inherit mask pointer */
uint32 mask_data[8]; /**< The QNX run mask and inherit mask storage (supports maximum of 128 processors) */
} CFE_PSP_cpuset_t;

/*-------------------------------------------------------------------------------------*/
Expand All @@ -58,11 +58,11 @@ static inline void CFE_PSP_CpusetZero(CFE_PSP_cpuset_t *cpuset)
memset(cpuset, 0x0, sizeof(CFE_PSP_cpuset_t));

/* Set size of run mask and inherit mask */
cpuset->size = mask_size;
cpuset->size = mask_size;

/* Set run mask and inherit mask pointers */
cpuset->runmask = &cpuset->mask_data[0];
cpuset->inherit_mask = &cpuset->mask_data[mask_size];
cpuset->runmask = &cpuset->mask_data[0];
cpuset->inherit_mask = &cpuset->mask_data[mask_size];

/* Verify that cpuset has enought storage for cpus in system */
if (((sizeof(uint32) * 3) + (sizeof(uint32) * mask_size * 2)) > sizeof(CFE_PSP_cpuset_t))
Expand Down
12 changes: 6 additions & 6 deletions fsw/generic-qnx/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#define CFE_PSP_IMPL_BUILD_NUMBER 0
#define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0"
#define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */
#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */
#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */

/*
* Version Macros, see \ref cfsversions for definitions.
*/
#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */
#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */
#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/
#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */
#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */
#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/

/**
* @brief Last official release.
Expand Down Expand Up @@ -68,9 +68,9 @@

/**
* @brief Max Version String length.
*
*
* Maximum length that a tblCRCTool version string can be.
*
*
*/
#define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256

Expand Down
9 changes: 6 additions & 3 deletions fsw/generic-qnx/src/cfe_psp_exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt)
CFE_PSP_Exception_LogData_t *Buffer;
int32 NumAddrs;

/*
/*
* Note that the time between CFE_PSP_Exception_GetNextContextBuffer()
* and CFE_PSP_Exception_WriteComplete() is sensitive in that it is
* accessing a global.
Expand All @@ -97,7 +97,7 @@ void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt)
*/
clock_gettime(CLOCK_MONOTONIC, &Buffer->context_info.event_time);
memcpy(&Buffer->context_info.si, si, sizeof(Buffer->context_info.si));

/* Collect QNX backtrace info */
NumAddrs = CFE_PSP_Backtrace(Buffer->context_info.Addrs, ctxt, CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE);
Buffer->context_info.ValidAddrs = NumAddrs;
Expand Down Expand Up @@ -302,7 +302,10 @@ int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer
default:
ComputedReason = "Unknown SIGFPE";
}
(void)snprintf(ReasonBuf, ReasonSize, "%s at ip 0x%lx", ComputedReason,
(void)snprintf(ReasonBuf,
ReasonSize,
"%s at ip 0x%lx",
ComputedReason,
(unsigned long)Buffer->context_info.si.si_addr);
}
else if (Buffer->context_info.si.si_signo == SIGINT)
Expand Down
82 changes: 44 additions & 38 deletions fsw/generic-qnx/src/cfe_psp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include "cfe_psp_config.h"
#include "cfe_psp_memory.h"

#define CFE_PSP_KEY_FILE_NAME_LENGTH 40
#define CFE_PSP_KEY_FILE_NAME_LENGTH 40

char CdsKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH];
char ResetKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH];
Expand All @@ -76,7 +76,7 @@ char ReservedKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH];

/*
* Define the PSP-supported capacities to be the maximum allowed,
*/
*/
#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize)
#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize)
#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize)
Expand All @@ -96,7 +96,6 @@ void CFE_PSP_InitVolatileDiskMem(void);
void CFE_PSP_InitUserReservedArea(void);
void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId);


/*
** External Declarations
*/
Expand Down Expand Up @@ -153,7 +152,8 @@ void CFE_PSP_InitCDS(void)
/*
** attach to the segment to get a pointer to it:
*/
CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = mmap(NULL,CFE_PSP_CDS_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, CDSShmId, 0);
CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr =
mmap(NULL, CFE_PSP_CDS_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, CDSShmId, 0);
if (CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == MAP_FAILED)
{
perror("CFE_PSP - Cannot mmap to CDS Shared memory Segment");
Expand All @@ -176,20 +176,20 @@ void CFE_PSP_InitCDS(void)
*/
void CFE_PSP_DeleteCDS(void)
{
int ReturnCode = 0;
int ReturnCode = 0;

/* Unmapped and unlink shared memory segment */
/* Unmapped and unlink shared memory segment */
ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr, CFE_PSP_CDS_SIZE);
if (ReturnCode == 0)
{
ReturnCode = shm_unlink(CFE_PSP_CDS_KEY_FILE);
if(ReturnCode == 0)
if (ReturnCode == 0)
{
OS_printf("User CDS Area Shared memory segment removed\n");
OS_printf("User CDS Area Shared memory segment removed\n");
}
else
{
OS_printf("Error Removing User CDS Area Shared memory Segment.\n");
OS_printf("Error Removing User CDS Area Shared memory Segment.\n");
}
}
else
Expand Down Expand Up @@ -240,7 +240,7 @@ int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32
{
if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE))
{
CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr;
CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr;
CopyPtr += CDSOffset;
memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes);

Expand Down Expand Up @@ -275,7 +275,7 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt
{
if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE))
{
CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr;
CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr;
CopyPtr += CDSOffset;
memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes);

Expand Down Expand Up @@ -311,10 +311,10 @@ int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumByt
*/
void CFE_PSP_InitResetArea(void)
{
size_t total_size;
size_t reset_offset;
size_t align_mask;
cpuaddr block_addr;
size_t total_size;
size_t reset_offset;
size_t align_mask;
cpuaddr block_addr;
CFE_PSP_QnxReservedAreaFixedLayout_t *FixedBlocksPtr;

/*
Expand All @@ -323,12 +323,12 @@ void CFE_PSP_InitResetArea(void)
* reside in this shared memory segment so it will be preserved on a processor
* reset.
*/
align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */
total_size = sizeof(CFE_PSP_QnxReservedAreaFixedLayout_t);
total_size = (total_size + align_mask) & ~align_mask;
reset_offset = total_size;
total_size += CFE_PSP_RESET_AREA_SIZE;
total_size = (total_size + align_mask) & ~align_mask;
align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */
total_size = sizeof(CFE_PSP_QnxReservedAreaFixedLayout_t);
total_size = (total_size + align_mask) & ~align_mask;
reset_offset = total_size;
total_size += CFE_PSP_RESET_AREA_SIZE;
total_size = (total_size + align_mask) & ~align_mask;

/*
** connect to (and possibly create) the segment:
Expand All @@ -343,15 +343,15 @@ void CFE_PSP_InitResetArea(void)
** attach to the segment to get a pointer to it:
*/
ftruncate(ResetAreaShmId, total_size);
block_addr = (cpuaddr)mmap(NULL,total_size, (PROT_READ | PROT_WRITE), MAP_SHARED, ResetAreaShmId, 0);
block_addr = (cpuaddr)mmap(NULL, total_size, (PROT_READ | PROT_WRITE), MAP_SHARED, ResetAreaShmId, 0);
if (block_addr == (cpuaddr)(-1))
{
perror("CFE_PSP - Cannot mmap to Reset Area Shared memory Segment");
CFE_PSP_Panic(CFE_PSP_ERROR);
}

FixedBlocksPtr = (CFE_PSP_QnxReservedAreaFixedLayout_t *)block_addr;
block_addr += reset_offset;
FixedBlocksPtr = (CFE_PSP_QnxReservedAreaFixedLayout_t *)block_addr;
block_addr += reset_offset;

CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord;
CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage;
Expand All @@ -373,21 +373,21 @@ void CFE_PSP_InitResetArea(void)
*/
void CFE_PSP_DeleteResetArea(void)
{
int ReturnCode = 0;
int ReturnCode = 0;

/* Unmapped and unlink shared memory segment */
ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr, CFE_PSP_RESET_AREA_SIZE);

if (ReturnCode == 0)
{
ReturnCode = shm_unlink(CFE_PSP_RESET_KEY_FILE);
if(ReturnCode == 0)
if (ReturnCode == 0)
{
OS_printf("User Reset Area Shared memory segment removed\n");
OS_printf("User Reset Area Shared memory segment removed\n");
}
else
{
OS_printf("Error Removing User Reset Area Shared memory Segment.\n");
OS_printf("Error Removing User Reset Area Shared memory Segment.\n");
}
}
else
Expand Down Expand Up @@ -437,9 +437,14 @@ void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId)
** Construct the key file name:
** The name will consist of "/<cpuName.CpuId>.key_file_name"
*/
snprintf(CdsKeyFileName, sizeof(CdsKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_CDS_KEY_FILE_NAME_EXT);
snprintf(ResetKeyFileName, sizeof(ResetKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESET_KEY_FILE_NAME_EXT);
snprintf(ReservedKeyFileName, sizeof(ReservedKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESERVED_KEY_FILE_NAME_EXT);
snprintf(CdsKeyFileName, sizeof(CdsKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_CDS_KEY_FILE_NAME_EXT);
snprintf(ResetKeyFileName, sizeof(ResetKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESET_KEY_FILE_NAME_EXT);
snprintf(ReservedKeyFileName,
sizeof(ReservedKeyFileName),
"/%s.%d.%s",
CpuName,
CpuId,
CFE_PSP_RESERVED_KEY_FILE_NAME_EXT);
}

/******************************************************************************
Expand Down Expand Up @@ -469,8 +474,8 @@ void CFE_PSP_InitUserReservedArea(void)
** attach to the segment to get a pointer to it:
*/
ftruncate(UserShmId, CFE_PSP_USER_RESERVED_SIZE);
CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = mmap(NULL, CFE_PSP_USER_RESERVED_SIZE,
(PROT_READ | PROT_WRITE), MAP_SHARED, UserShmId, 0);
CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr =
mmap(NULL, CFE_PSP_USER_RESERVED_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, UserShmId, 0);
if (CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == (void *)(-1))
{
perror("CFE_PSP - Cannot mmap to User Reserved Area Shared memory Segment");
Expand All @@ -493,21 +498,21 @@ void CFE_PSP_InitUserReservedArea(void)
*/
void CFE_PSP_DeleteUserReservedArea(void)
{
int ReturnCode = 0;
int ReturnCode = 0;

/* Unmapped and unlink shared memory segment */
ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, CFE_PSP_USER_RESERVED_SIZE);

if (ReturnCode == 0)
{
ReturnCode = shm_unlink(CFE_PSP_RESERVED_KEY_FILE);
if(ReturnCode == 0)
if (ReturnCode == 0)
{
OS_printf("User Reserved Area Shared memory segment removed\n");
OS_printf("User Reserved Area Shared memory segment removed\n");
}
else
{
OS_printf("Error Removing User Reserved Area Shared memory Segment.\n");
OS_printf("Error Removing User Reserved Area Shared memory Segment.\n");
}
}
else
Expand Down Expand Up @@ -661,7 +666,8 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType)
memset(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, 0, CFE_PSP_USER_RESERVED_SIZE);

memset(CFE_PSP_ReservedMemoryMap.BootPtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.BootPtr));
memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0,
memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr,
0,
sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr));

/*
Expand Down
Loading
Loading