-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff778c5
commit 871ce1e
Showing
4 changed files
with
955 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
############################################################################### | ||
# File: CFS Application Makefile | ||
# | ||
# $Id: Makefile 1.6 2009/07/09 11:41:26EDT rmcgraw Exp $ | ||
# | ||
# $Log: Makefile $ | ||
# Revision 1.6 2009/07/09 11:41:26EDT rmcgraw | ||
# DCR8291:1 Changed CFE_MISSION_INC to CFS_MISSION_INC and added log if needed | ||
# | ||
############################################################################### | ||
# | ||
# Subsystem produced by this makefile. | ||
# | ||
APPTARGET = cfs_lib | ||
|
||
# | ||
# Entry Point for task | ||
# | ||
ENTRY_PT = CFS_LibInit | ||
|
||
# | ||
# Object files required to build subsystem. | ||
# | ||
OBJS = cfs_utils.o | ||
|
||
# | ||
# Source files required to build subsystem; used to generate dependencies. | ||
# As long as there are no assembly files this can be automated. | ||
# | ||
SOURCES = $(OBJS:.o=.c) | ||
|
||
|
||
## | ||
## Specify extra C Flags needed to build this subsystem | ||
## | ||
LOCAL_COPTS = | ||
|
||
|
||
## | ||
## EXEDIR is defined here, just in case it needs to be different for a custom | ||
## build | ||
## | ||
EXEDIR=../exe | ||
|
||
## | ||
## Certain OSs and Application Loaders require the following option for | ||
## Shared libraries. Currently only needed for vxWorks 5.5 and RTEMS. | ||
## For each shared library that this app depends on, you need to have an | ||
## entry like the following: | ||
## -R../tst_lib/tst_lib.elf | ||
## | ||
SHARED_LIB_LINK = | ||
|
||
######################################################################## | ||
# Should not have to change below this line, except for customized | ||
# Mission and cFE directory structures | ||
######################################################################## | ||
|
||
# | ||
# Set build type to CFE_APP. This allows us to | ||
# define different compiler flags for the cFE Core and Apps. | ||
# | ||
BUILD_TYPE = CFE_APP | ||
|
||
## | ||
## Include all necessary cFE make rules | ||
## Any of these can be copied to a local file and | ||
## changed if needed. | ||
## | ||
## | ||
## cfe-config.mak contains PSP and OS selection | ||
## | ||
include ../cfe/cfe-config.mak | ||
## | ||
## debug-opts.mak contains debug switches | ||
## | ||
include ../cfe/debug-opts.mak | ||
## | ||
## compiler-opts.mak contains compiler definitions and switches/defines | ||
## | ||
include $(CFE_PSP_SRC)/$(PSP)/make/compiler-opts.mak | ||
|
||
## | ||
## Setup the include path for this subsystem | ||
## The OS specific includes are in the build-rules.make file | ||
## | ||
## If this subsystem needs include files from another app, add the path here. | ||
## | ||
INCLUDE_PATH = \ | ||
-I$(OSAL_SRC)/inc \ | ||
-I$(CFE_CORE_SRC)/inc \ | ||
-I$(CFE_PSP_SRC)/inc \ | ||
-I$(CFE_PSP_SRC)/$(PSP)/inc \ | ||
-I$(CFS_APP_SRC)/inc \ | ||
-I$(CFS_APP_SRC)/$(APPTARGET)/fsw/src \ | ||
-I$(CFS_MISSION_INC) \ | ||
-I../cfe/inc \ | ||
-I../inc | ||
|
||
## | ||
## Define the VPATH make variable. | ||
## This can be modified to include source from another directory. | ||
## If there is no corresponding app in the cfs-apps directory, then this can be discarded, or | ||
## if the mission chooses to put the src in another directory such as "src", then that can be | ||
## added here as well. | ||
## | ||
VPATH = $(CFS_APP_SRC)/$(APPTARGET)/fsw/src | ||
|
||
## | ||
## Include the common make rules for building a cFE Application | ||
## | ||
include $(CFE_CORE_SRC)/make/app-rules.mak |
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,256 @@ | ||
/************************************************************************* | ||
** File: | ||
** $Id: cfs_utils.h 1.6 2015/03/02 18:30:04EST sstrege Exp $ | ||
** | ||
** Copyright © 2007-2014 United States Government as represented by the | ||
** Administrator of the National Aeronautics and Space Administration. | ||
** All Other Rights Reserved. | ||
** | ||
** This software was created at NASA's Goddard Space Flight Center. | ||
** This software is governed by the NASA Open Source Agreement and may be | ||
** used, distributed and modified only pursuant to the terms of that | ||
** agreement. | ||
** | ||
** Purpose: | ||
** Specification for the CFS shared library functions. | ||
** | ||
** References: | ||
** | ||
** $Log: cfs_utils.h $ | ||
** Revision 1.6 2015/03/02 18:30:04EST sstrege | ||
** Added copyright information | ||
** Revision 1.5 2009/08/31 17:46:42EDT lwalling | ||
** Add function CFS_VerifyString() to CFS Library | ||
** Revision 1.4 2009/05/26 13:31:07EDT lwalling | ||
** Create common packet filter function in global CFS library | ||
** Revision 1.3 2008/10/06 09:52:08EDT rjmcgraw | ||
** DCR4401:1 Removed extraneous tabs and unprintable characters | ||
** Revision 1.2 2008/05/15 09:39:41EDT rjmcgraw | ||
** DCR2179:1 Changed doxygen link OS_SymLookup to OS_SymbolLookup | ||
** Revision 1.1 2008/05/13 13:35:14EDT rjmcgraw | ||
** Initial revision | ||
** Member added to project cfs_lib | ||
** | ||
*************************************************************************/ | ||
#ifndef _cfs_utils_h_ | ||
#define _cfs_utils_h_ | ||
|
||
/************************************************************************ | ||
** Includes | ||
*************************************************************************/ | ||
#include "cfe.h" | ||
|
||
/************************************************************************ | ||
** Type Definitions | ||
*************************************************************************/ | ||
/** | ||
** \brief Symbolic Address Type | ||
*/ | ||
typedef struct | ||
{ | ||
uint32 Offset;/**< \brief Optional offset that is used as the | ||
absolute address if the SymName string is NUL */ | ||
char SymName[OS_MAX_SYM_LEN];/**< \brief Symbol name string */ | ||
} CFS_SymAddr_t; | ||
|
||
/************************************************************************* | ||
** Exported Functions | ||
*************************************************************************/ | ||
/************************************************************************/ | ||
/** \brief Compute CRC from a file | ||
** | ||
** \par Description | ||
** This function will compute the cyclic redundancy check (CRC) | ||
** value of data in a file | ||
** | ||
** \par Assumptions, External Events, and Notes: | ||
** The computation starts from the current location of the | ||
** file pointer to the end of file | ||
** | ||
** \param [in] FileHandle The open file handle of the file to scan | ||
** | ||
** \param [in] CrcPtr Where to store the computed CRC. | ||
** | ||
** \param [in] TypeCRC One of the enumerated CRC types supported | ||
** by the #CFE_ES_CalculateCRC function | ||
** | ||
** \param [out] *CrcPtr The computed CRC. Only updated if the return | ||
** value is #OS_SUCCESS | ||
** | ||
** \returns | ||
** \retstmt Returns #OS_SUCCESS if no error \endcode | ||
** \retstmt The return code from #OS_read if an error occured \endcode | ||
** \endreturns | ||
** | ||
** \sa #CFE_ES_CalculateCRC, #OS_read | ||
** | ||
*************************************************************************/ | ||
int32 CFS_ComputeCRCFromFile(uint32 FileHandle, | ||
uint32 *CrcPtr, | ||
uint32 TypeCRC); | ||
|
||
/************************************************************************/ | ||
/** \brief Check for invalid filename | ||
** | ||
** \par Description | ||
** This function will scan a filename string for invalid characters | ||
** | ||
** \par Assumptions, External Events, and Notes: | ||
** None | ||
** | ||
** \param [in] Filename The file name string to scan | ||
** | ||
** \param [in] Length The string length of Filename | ||
** | ||
** \returns | ||
** \retstmt Returns TRUE if the file name is valid \endcode | ||
** \retstmt Returns FALSE if an invalid character was found \endcode | ||
** \endreturns | ||
** | ||
*************************************************************************/ | ||
boolean CFS_IsValidFilename(char *Filename, | ||
uint32 Length); | ||
|
||
/************************************************************************/ | ||
/** \brief Resolve symbolic address | ||
** | ||
** \par Description | ||
** This routine will resolve a symbol name and optional address | ||
** offset to an absolute address | ||
** | ||
** \par Assumptions, External Events, and Notes: | ||
** If the symbol name is a NUL (empty) string, then the offset | ||
** becomes the absolute address | ||
** | ||
** \param [in] SymAddr A #CFS_SymAddr_t pointer that holds | ||
** the symbol name and optional offset | ||
** | ||
** \param [in] ResolvedAddr A pointer to the location to store | ||
** the resolved address in | ||
** | ||
** \param [out] *ResolvedAddr The fully resolved address. Only valid | ||
** if the return value is TRUE | ||
* | ||
** \returns | ||
** \retstmt Returns TRUE if the resolution was successful \endcode | ||
** \retstmt Returns FALSE if the resolution was not successful \endcode | ||
** \endreturns | ||
** | ||
** \sa #OS_SymbolLookup | ||
** | ||
*************************************************************************/ | ||
boolean CFS_ResolveSymAddr(CFS_SymAddr_t *SymAddr, | ||
uint32 *ResolvedAddr); | ||
|
||
/************************************************************************/ | ||
/** \brief Verify 32 bit alignment | ||
** | ||
** \par Description | ||
** This routine will check an address and data size argument pair | ||
** for correct 32 bit alignment | ||
** | ||
** \par Assumptions, External Events, and Notes: | ||
** None | ||
** | ||
** \param [in] Address The address to check for proper alignment | ||
** | ||
** \param [in] Size The size in bytes to check for proper | ||
** alignment | ||
** | ||
** \returns | ||
** \retstmt Returns TRUE if both Address and Size are 32 bit aligned \endcode | ||
** \retstmt Returns FALSE if either Address or Size is not 32 bit aligned \endcode | ||
** \endreturns | ||
** | ||
** \sa #CFS_Verify16Aligned | ||
** | ||
*************************************************************************/ | ||
boolean CFS_Verify32Aligned(uint32 Address, | ||
uint32 Size); | ||
|
||
/************************************************************************/ | ||
/** \brief Verify 16 bit alignment | ||
** | ||
** \par Description | ||
** This routine will check an address and data size argument pair | ||
** for correct 16 bit alignment | ||
** | ||
** \par Assumptions, External Events, and Notes: | ||
** None | ||
** | ||
** \param [in] Address The address to check for proper alignment | ||
** | ||
** \param [in] Size The size in bytes to check for proper | ||
** alignment | ||
** | ||
** \returns | ||
** \retstmt Returns TRUE if both Address and Size are 16 bit aligned \endcode | ||
** \retstmt Returns FALSE if either Address or Size is not 16 bit aligned \endcode | ||
** \endreturns | ||
** | ||
** \sa #CFS_Verify32Aligned | ||
** | ||
*************************************************************************/ | ||
boolean CFS_Verify16Aligned(uint32 Address, | ||
uint32 Size); | ||
|
||
/************************************************************************/ | ||
/** \brief Determine whether Software Bus message packet is filtered | ||
** | ||
** \par Description | ||
** This routine will apply the CFS filter algorithm to the packet | ||
** to determine whether the packet should be filtered. This same | ||
** algorithm may be used by multiple applications (DS, TO, etc.) | ||
** | ||
** \par Assumptions, External Events, and Notes: | ||
** None | ||
** | ||
** \param [in] MessagePtr Pointer to a Software Bus message packet | ||
** | ||
** \param [in] FilterType Packet sequence count (1) or timestamp (2) | ||
** | ||
** \param [in] Algorithm_N Algorithm parameter N "pass this many" | ||
** \param [in] Algorithm_X Algorithm parameter X "out of this many" | ||
** \param [in] Algorithm_O Algorithm parameter O "at this offset" | ||
** | ||
** \returns | ||
** \retstmt Returns TRUE if the packet should be filtered (not used) \endcode | ||
** \retstmt Returns FALSE if the packet should not be filtered (used) \endcode | ||
** \endreturns | ||
** | ||
** \sa #CFS_IsPacketFiltered | ||
** | ||
*************************************************************************/ | ||
boolean CFS_IsPacketFiltered(CFE_SB_MsgPtr_t MessagePtr, | ||
uint16 FilterType, | ||
uint16 Algorithm_N, | ||
uint16 Algorithm_X, | ||
uint16 Algorithm_O); | ||
|
||
/*******************************************************************/ | ||
/* \brief Verify string data | ||
** | ||
** \par Description | ||
** This common function performs the following evaluations: | ||
** - Is the buffer empty? (if yes, result OK if not required) | ||
** - Does string have a terminator? (if not, result BAD) | ||
** - Does filename have valid chars? (only filenames tested) | ||
** | ||
** \par Assumptions, External Events, and Notes: | ||
** (none) | ||
** | ||
** \param [in] Pointer to buffer containing string | ||
** \param [in] Length (in bytes) of buffer | ||
** \param [in] Is string required or optional? | ||
** \param [in] Is string part of a filename? (limited chars) | ||
** | ||
** \sa #CFS_VerifyString | ||
*/ | ||
boolean CFS_VerifyString(char *Buffer, int32 BufferSize, | ||
boolean StringIsRequired, boolean NeedCharTest); | ||
|
||
#endif /* _cfs_utils_h_ */ | ||
|
||
/************************/ | ||
/* End of File Comment */ | ||
/************************/ |
Oops, something went wrong.