Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nasa/Nos3#325 ] Equuleus upgrade #4

Merged
merged 18 commits into from
Oct 10, 2024
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
79 changes: 79 additions & 0 deletions .github/workflows/icbundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Integration Candidate Bundle Generation

# Generate Integration Candidate branch for this repository.

on:
workflow_dispatch:
inputs:
pr_nums:
description: 'The pull request numbers to include (Comma separated)'
required: true
type: string

jobs:
generate-ic-bundle:
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: sudo apt update
run: sudo apt install -y w3m
- name: Checkout IC Branch
uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: main
- name: Rebase IC Branch
run: git config user.name "GitHub Actions"
run: git config user.email "[email protected]"
run: git pull
run: git checkout integration-candidate
run: git rebase main
- name: Merge each PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
prs=$(echo ${{ inputs.pr_nums }} | tr "," "\n")
for pr in $prs
do
src_branch=$(hub pr show -f %H $pr)
pr_title=$(hub pr show -f %t $pr)
commit_msg=$'Merge pull request #'"${pr}"$' from '"${src_branch}"$'\n\n'"${pr_title}"
git fetch origin pull/$pr/head:origin/pull/$pr/head
git merge origin/pull/$pr/head --no-ff -m "$commit_msg"
done
- name: Update Changelog and Version.h files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rev_num=$(git rev-list v1.6.0-rc4.. --count)
changelog_entry=$'# Changelog\\n\\n# Development Build: v1.6.0-rc4+dev'${rev_num}
prs=$(echo ${{ inputs.pr_nums }} | tr "," "\n")
see_entry=$'\-\ See:'
for pr in $prs
do
pr_title=$(hub pr show -f %t $pr)
changelog_entry="${changelog_entry}"$'\\n- '"${pr_title@Q}"
see_entry="${see_entry}"$' <https://github.com/nasa/cFE/pull/'${pr}$'>'
done
changelog_entry="${changelog_entry}\n${see_entry}\n"
sed -ir "s|# Changelog|$changelog_entry|" CHANGELOG.md

buildnumber_entry=$'#define CFE_PSP_IMPL_BUILD_NUMBER '${rev_num}
sed -ir "s|define CFE_PSP_IMPL_BUILD_NUMBER.*|$buildnumber_entry|" fsw/mcp750-vxworks/inc/psp_version.h

buildnumber_entry=$'#define CFE_PSP_IMPL_BUILD_NUMBER '${rev_num}
sed -ir "s|define CFE_PSP_IMPL_BUILD_NUMBER.*|$buildnumber_entry|" fsw/pc-linux/inc/psp_version.h

buildnumber_entry=$'#define CFE_PSP_IMPL_BUILD_NUMBER '${rev_num}
sed -ir "s|define CFE_PSP_IMPL_BUILD_NUMBER.*|$buildnumber_entry|" fsw/pc-rtems/inc/psp_version.h
- name: Commit and Push Updates to IC Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git add CHANGELOG.md
run: git add fsw/mcp750-vxworks/inc/psp_version.h
run: git add fsw/pc-linux/inc/psp_version.h
run: git add fsw/pc-rtems/inc/psp_version.h
run: |
rev_num=$(git rev-list v1.6.0-rc4.. --count)
git commit -m "Updating documentation and version numbers for v1.6.0-rc4+dev${rev_num}"
run: git push -v origin integration-candidate
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## Development Build: v1.6.0-rc4+dev82
- Implement RTEMS Sysmons
- find psp standard module
- See <https://github.com/nasa/PSP/pull/397> and <https://github.com/nasa/PSP/pull/402>

## Development Build: v1.6.0-rc4+dev76
- Create Workflow for IC Bundle Generation
- See <https://github.com/nasa/PSP/pull/391>

## Development Build: v1.6.0-rc4+dev72
- adds generic driver interface and Linux sysmon module
- See <https://github.com/nasa/PSP/pull/386>

## Development Build: v1.6.0-rc4+dev67
- Squash constParameter warning in linux cfe_psp_memory.c
- Remove obsolete _USING_RTEMS_INCLUDES_
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 67
#define CFE_PSP_IMPL_BUILD_NUMBER 82
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4"

/*
Expand Down
2 changes: 2 additions & 0 deletions fsw/mcp750-vxworks/psp_module_list.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ timebase_vxworks
eeprom_direct
ram_direct
port_direct
iodriver
vxworks_sysmon
9 changes: 9 additions & 0 deletions fsw/modules/iodriver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Generic I/O device driver interface module
add_psp_module(iodriver src/iodriver.c)

target_include_directories(iodriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)

if (ENABLE_UNIT_TESTS)
add_subdirectory(ut-stubs)
endif (ENABLE_UNIT_TESTS)
71 changes: 71 additions & 0 deletions fsw/modules/iodriver/inc/iodriver_analog_io.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2015, United States government as represented by the
* administrator of the National Aeronautics Space Administration.
* All rights reserved. This software was created at NASA Glenn
* Research Center pursuant to government contracts.
*/

/**
* \file
*
* I/O adapter for analog (ADC/DAC) devices
*/

#ifndef CFE_PSP_IODRIVER_ANALOG_IO_H
#define CFE_PSP_IODRIVER_ANALOG_IO_H

/* Include all base definitions */
#include "iodriver_base.h"

/**
* Standardized width of ADC/DAC codes.
*
* This should reflect the highest-precision ADC that the system is expected to use. ADC inputs
* that are less precise than this will be bit-expanded in software such that all processing
* in the upper layers receives consistent data no matter what the actual hardware implements.
* This permits easier swapping between different phsyical hardware types, including those with
* potentially less ADC/DAC precision, while presenting similar values to application code.
*/
#define CFE_PSP_IODRIVER_ADC_BITWIDTH 24

/**
* Type abstraction for expressing analog ADC codes.
*
* This type is an integer type of at least CFE_PSP_IODRIVER_ADC_BITWIDTH in length. It is used
* as a parameter for the Read/Write opcodes on ADC/DAC channels. Normalized (fixed-width) ADC
* codes are used at this layer rather than floating point due to the fact that floats involve a
* lot of extra overhead and some CPUs do not have FP units at all.
*
* If desired on CPUs that are capable of good-performance floating point operations, another
* module/CFS application can convert the ADC codes to real-word floats. This would be done
* outside the I/O driver layer.
*/
typedef int32 CFE_PSP_IODriver_AdcCode_t;

/**
* Complete API container for analog read/write commands.
* This allows reading/writing multiple channels at once with a single entry into the API.
* As each entry into the API needs to acquire a mutex for serialization, this can be much
* more efficient to read channels through this means rather than single channel read/write.
* Set NumChannels to 1 to perform single channel read/write
*/
typedef struct
{
uint16 NumChannels; /**< Number of channels in the i/o structure (length of "samples" array) */
CFE_PSP_IODriver_AdcCode_t *Samples; /**< Array for ADC/DAC samples */
} CFE_PSP_IODriver_AnalogRdWr_t;

/**
* Opcodes specific to analog io (ADC/DAC) devices
*/
enum
{
CFE_PSP_IODriver_ANALOG_IO_NOOP = CFE_PSP_IODriver_ANALOG_IO_CLASS_BASE,

CFE_PSP_IODriver_ANALOG_IO_READ_CHANNELS, /**< CFE_PSP_IODriver_AnalogRdWr_t argument */
CFE_PSP_IODriver_ANALOG_IO_WRITE_CHANNELS, /**< CFE_PSP_IODriver_AnalogRdWr_t argument */

CFE_PSP_IODriver_ANALOG_IO_MAX
};

#endif /* CFE_PSP_IODRIVER_ANALOG_IO_H */
172 changes: 172 additions & 0 deletions fsw/modules/iodriver/inc/iodriver_base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* Copyright (c) 2015, United States government as represented by the
* administrator of the National Aeronautics Space Administration.
* All rights reserved. This software was created at NASA Glenn
* Research Center pursuant to government contracts.
*/

/**
* \file
*
* Generic abstraction API for on-board devices
*
* The design of this interface is similar to the POSIX "ioctl()" in concept -
* A single interface function, with 3 basic arguments:
* - A device/target identifier
* - A command "opcode"
* - A generic argument containing the I/O parameter for that opcode
*
* Note that the last argument may in fact be a structure for opcodes that
* require multiple parameters.
*
* This type of interface makes it fairly simple to swap one hardware device
* for another, as long as they both implement a common set of opcodes, while
* also being extendable/customizable by adding additional opcodes to expose
* device-specific functionality, as long as those extension opcodes do not
* interfere or overlap with the common set.
*/

#ifndef IODRIVER_BASE_H
#define IODRIVER_BASE_H

#include <common_types.h>

/**
* Physical channel location descriptor.
*
* See the CFE_PSP_IODriver_LOOKUP_SUBCHANNEL opcode to determine channel number to set in here,
* as each board may have their own unique channel naming conventions. The integer value that
* goes in this structure may or may not correlate to the physical device labeling.
*/
typedef struct
{
uint32 PspModuleId; /**< Device selection */
uint16 SubsystemId; /**< Instance or subsystem number */
uint16 SubchannelId; /**< Subchannel number - optional, set to 0 for devices that do not have multiple channels */
} CFE_PSP_IODriver_Location_t;

/**
* Wrapper for constant arguments, to avoid a compiler warning
* about arguments differing in const-ness. Use the inline functions to
* pass in an immediate/constant value.
*/
typedef union
{
void * Vptr;
const void *ConstVptr;
const char *ConstStr;
uint32 U32;
} CFE_PSP_IODriver_Arg_t;

static inline CFE_PSP_IODriver_Arg_t CFE_PSP_IODriver_VPARG(void *x)
{
CFE_PSP_IODriver_Arg_t a;
a.Vptr = x;
return a;
}
static inline CFE_PSP_IODriver_Arg_t CFE_PSP_IODriver_CONST_VPARG(const void *x)
{
CFE_PSP_IODriver_Arg_t a;
a.ConstVptr = x;
return a;
}
static inline CFE_PSP_IODriver_Arg_t CFE_PSP_IODriver_CONST_STR(const char *x)
{
CFE_PSP_IODriver_Arg_t a;
a.ConstStr = x;
return a;
}
static inline CFE_PSP_IODriver_Arg_t CFE_PSP_IODriver_U32ARG(uint32 x)
{
CFE_PSP_IODriver_Arg_t a;
a.U32 = x;
return a;
}

/**
* Standardized concept of directionality for any device
*
* Some code may use these enumeration values as a bitmask -
* use care when updating to ensure that the values may be used as bitmasks.
* Specific hardware drivers may or may not implement all modes depending on capabilities.
*/
typedef enum
{
CFE_PSP_IODriver_Direction_DISABLED = 0, /**< Disabled (inactive, tri-state if possible) */
CFE_PSP_IODriver_Direction_INPUT_ONLY = 0x01, /**< Device/channel is configured for input */
CFE_PSP_IODriver_Direction_OUTPUT_ONLY = 0x02, /**< Device/channel is configured for output */
CFE_PSP_IODriver_Direction_INPUT_OUTPUT = 0x03 /**< Input/Output (some HW supports this) */
} CFE_PSP_IODriver_Direction_t;

/**
* Some common values for the device command codes
* These are some VERY basic ops that many devices may support in some way.
* Any opcode that is not implemented should return CFE_PSP_ERROR_NOT_IMPLEMENTED
*
* Negative return values indicate an error of some type, while return values >= 0 indicate success
*/
enum
{
CFE_PSP_IODriver_NOOP = 0, /**< Reserved, do nothing */

/* Start/stop opcodes */
CFE_PSP_IODriver_SET_RUNNING = 1, /**< uint32 argument, 0=stop 1=start device */
CFE_PSP_IODriver_GET_RUNNING = 2, /**< no argument, returns positive nonzero (true) if running and zero (false) if
stopped, negative on error */

/* Configuration opcodes */
CFE_PSP_IODriver_SET_CONFIGURATION = 3, /**< const string argument (device-dependent content) */
CFE_PSP_IODriver_GET_CONFIGURATION = 4, /**< void * argument (device-dependent content) */

/* Sub-channel configuration/mapping opcodes */
CFE_PSP_IODriver_LOOKUP_SUBSYSTEM = 5, /**< const char * argument, looks up ChannelName and returns positive value
for subsystem ID, negative value for error */
CFE_PSP_IODriver_LOOKUP_SUBCHANNEL = 6, /**< const char * argument, looks up ChannelName and returns positive value
for subchannel ID, negative value for error */
CFE_PSP_IODriver_SET_DIRECTION = 7, /**< U32 (CFE_PSP_IODriver_Direction_t) argument as input */
CFE_PSP_IODriver_QUERY_DIRECTION = 8, /**< U32 (CFE_PSP_IODriver_Direction_t) argument as output */

/*
* Placeholders for opcodes that could be implemented across a class of devices.
* For instance, all ADC/DAC devices should implement a common set of read/write opcodes
* so that devices can be interchanged without affecting higher-level software
*/
CFE_PSP_IODriver_ANALOG_IO_CLASS_BASE = 0x00010000, /**< Opcodes for typical adc/dac devices */
CFE_PSP_IODriver_DISCRETE_IO_CLASS_BASE = 0x00020000, /**< Opcodes for discrete IO (digital logic) devices */
CFE_PSP_IODriver_PACKET_IO_CLASS_BASE = 0x00030000, /**< Opcodes for packet/datagram-oriented devices */
CFE_PSP_IODriver_MEMORY_IO_CLASS_BASE = 0x00040000, /**< Opcodes for memory/register oriented devices */
CFE_PSP_IODriver_STREAM_IO_CLASS_BASE = 0x00050000, /**< Opcodes for data stream oriented devices */

/**
* Placeholder for extended opcodes that may be very specific to a single device/device type.
* This allows the same API call (CFE_PSP_DeviceCommandFunc_t) but
*/
CFE_PSP_IODriver_EXTENDED_BASE = 0x7FFF0000

};

/* ------------------------------------------------------------- */
/**
* @brief Find an IO device module ID by name
*
* @param DriverName the device name to find
* @param PspModuleId location to store the module ID, if found
*
* @retval #CFE_PSP_SUCCESS if found, or error code if not found
*/
int32 CFE_PSP_IODriver_FindByName(const char *DriverName, uint32 *PspModuleId);

/* ------------------------------------------------------------- */
/**
* @brief Issue a request to an IO device module
*
* @param Location Aggregate location identifier
* @param CommandCode Request identifier
* @param Arg Request Argument
*
* @retval #CFE_PSP_SUCCESS if successful, or error code if not successful
*/
int32 CFE_PSP_IODriver_Command(const CFE_PSP_IODriver_Location_t *Location, uint32 CommandCode,
CFE_PSP_IODriver_Arg_t Arg);

#endif /* IODRIVER_BASE_H */
Loading
Loading