Compare commits

...

191 Commits

Author SHA1 Message Date
Jakob Meier
faf7da2743 Merge branch 'eive/develop' into meier/uioMapper 2022-01-25 18:48:22 +01:00
Jakob Meier
7360878390 class to map uio addresses into user space 2022-01-25 18:30:12 +01:00
00cdbf287e Merge pull request 'Clock utility & Raspberry Pi fix' (#29) from mueller/clock-util into eive/develop
Reviewed-on: #29
2022-01-16 13:48:45 +01:00
c1e0bcee6d added additional conversion function 2022-01-15 13:03:53 +01:00
5214f8a449 bugfix for updated HAL 2022-01-11 14:44:45 +01:00
2506af27ed Merge pull request 'meier/breakDoSendRead' (#28) from meier/breakDoSendRead into eive/develop
Reviewed-on: #28
2021-12-22 11:30:27 +01:00
Jakob Meier
b98c85d33f Merge branch 'eive/develop' into meier/breakDoSendRead 2021-12-19 11:41:53 +01:00
Jakob Meier
eb58a8d954 virtual printset function 2021-12-19 11:33:12 +01:00
e5b568bc2b op divider fixes 2021-12-17 13:46:51 +01:00
a45fb1bb1f go back to deciaml as well 2021-12-15 14:19:15 +01:00
ddcb37a81b more diagnostic output 2021-12-15 14:16:56 +01:00
54e56ec522 LIS3 bugfix 2021-12-15 11:18:47 +01:00
e428568a00 Merge pull request 'FSFW Update' (#26) from mueller/sw-update into eive/develop
Reviewed-on: #26
2021-12-15 10:01:33 +01:00
a9dd1fe1d0 Merge remote-tracking branch 'upstream/development' into mueller/master 2021-12-15 09:49:19 +01:00
Jakob Meier
9a858eb54c introduced protected function to break doSendRead 2021-12-14 19:39:38 +01:00
bda02b464a linux HAL fixes 2021-12-09 13:42:54 +01:00
e4999fe01c fixes for windows 2021-12-08 17:22:53 +01:00
ceb87b5abb added warning latch to avoid spam 2021-11-30 14:53:49 +01:00
d8580074c2 Merge branch 'mueller/update-scripts' into mueller/master 2021-11-24 18:51:08 +01:00
d8823f12f1 Merge remote-tracking branch 'upstream/development' into eive/develop 2021-11-19 13:53:55 +01:00
24e45c57d1 removed testcfg file 2021-11-19 13:49:59 +01:00
48af11f03b Merge pull request 'Bugfix' (#25) from mueller/master into eive/develop
Reviewed-on: #25
2021-11-19 13:46:04 +01:00
5d719d0aeb Merge branch 'eive/develop' into mueller/master 2021-11-19 13:21:40 +01:00
c9e3415f01 Merge remote-tracking branch 'upstream/development' into eive/develop 2021-11-19 13:09:54 +01:00
1f7cc7a558 tests running 2021-11-18 19:54:52 +01:00
0a94f84f5a update cmakelists files 2021-11-18 19:52:27 +01:00
400eafcae7 added first unittests space packets
- Also added helper scripts
2021-11-18 19:51:01 +01:00
190848d00e important fix for getter function 2021-11-18 18:52:50 +01:00
15687f6f6e this should have been in the PR.. 2021-10-18 18:21:15 +02:00
e29606a2d0 Merge remote-tracking branch 'upstream/development' into mueller/master 2021-10-18 18:14:50 +02:00
afafab660a Merge branch 'mueller/tcp-keep-open-pr' into mueller/master 2021-10-18 15:07:36 +02:00
3e51e2e094 Merge branch 'mueller/packet-check-printout' into mueller/master 2021-10-18 13:59:35 +02:00
ce6b763219 Merge branch 'mueller/packet-check-printout' into mueller/master 2021-10-17 22:57:05 +02:00
6e507681eb Merge pull request 'Update FSFW' (#24) from mueller/master into eive/develop
Reviewed-on: #24
2021-10-13 17:09:56 +02:00
eba2f87b36 formatting tweak 2021-10-13 15:49:58 +02:00
0dedd8f2a1 Merge branch 'mueller/cmd-executor' into mueller/master 2021-10-11 20:06:10 +02:00
d693817158 added cmakelists source addition 2021-10-11 20:05:11 +02:00
f3dbf68f7c moved command executor 2021-10-11 20:03:29 +02:00
4130dd9e32 using cmakelists from upstream 2021-10-11 19:38:53 +02:00
2e37bd73e2 deleted timer object 2021-10-11 19:35:35 +02:00
ad68802fe4 Merge branch 'develop' into eive/develop 2021-10-11 19:21:48 +02:00
b985bf5167 Merge pull request 'meier/tcpFix' (#23) from meier/tcpFix into eive/develop
Reviewed-on: #23
2021-10-09 13:28:49 +02:00
Jakob Meier
a578f0390b tcp server also parses TCs when client closes connection 2021-10-08 13:51:32 +02:00
Jakob Meier
8e65833d60 added bind call error string 2021-10-08 13:24:51 +02:00
b6e4b1fc72 Merge pull request 'FSFW Update' (#22) from mueller/fsfw-update into eive/develop
Reviewed-on: #22
2021-10-06 17:50:51 +02:00
db801a0ecc removed unneeded static constexpr 2021-10-05 13:17:34 +02:00
3502ddca7f using pus version enum now 2021-10-05 13:14:26 +02:00
2124f36e36 moved store failure to separate function 2021-10-05 12:50:39 +02:00
91f43d00a2 moved store failure to separate function 2021-10-05 12:47:30 +02:00
a8a1148c65 fixes for PUS A stored 2021-10-05 12:39:57 +02:00
94bd4c7b56 using correct version number now 2021-10-05 01:23:56 +02:00
16fb87e02e Merge pull request 'FSFW Update' (#21) from mueller/unittest-fixes into eive/develop
Reviewed-on: #21
2021-09-29 15:45:39 +02:00
7a3dfc2592 Merge branch 'eive/develop' into mueller/unittest-fixes 2021-09-29 11:35:12 +02:00
3d0ce19981 additional options for c ustom main 2021-09-29 10:58:01 +02:00
04cb8e82f1 improvements and fixes 2021-09-29 10:52:21 +02:00
354e158cc1 format fixes 2021-09-29 09:30:50 +02:00
5ee315f8ca put functions in namespace 2021-09-28 17:42:55 +02:00
69922e77c5 this should work for both OSes 2021-09-28 17:38:35 +02:00
01e380c858 windows fixes 2021-09-28 17:36:27 +02:00
6881c6b66a class id renamed 2021-09-28 16:32:43 +02:00
d4bdf314f7 C++11 adaptions 2021-09-28 16:31:53 +02:00
be8623a4f8 delay configurable 2021-09-28 15:32:58 +02:00
304d7e8e32 space packet parser cleaned up, documentation 2021-09-28 15:30:31 +02:00
f2020b2492 removed obsolete empty ctor 2021-09-28 15:12:23 +02:00
5a045d03a5 wiretapping in runtime config now 2021-09-28 15:10:50 +02:00
c7ce568a30 added function to determine space packet ID
from APID
2021-09-28 14:50:50 +02:00
80ccaede02 refactored space packet parser 2021-09-28 14:14:59 +02:00
5fd7a8c9b7 smaller tweaks 2021-09-28 11:03:17 +02:00
254aac51ec cleaning up 2021-09-28 10:57:21 +02:00
9b7da4d9e6 fixing last bugs 2021-09-27 20:00:01 +02:00
71036bf6b1 something wrong with the socket.. 2021-09-27 18:35:50 +02:00
d6b3167922 tcp keep open implementation done 2021-09-27 18:05:45 +02:00
68fe94d594 PusParser integration 2021-09-27 16:15:51 +02:00
62a6e5da0b added PUS again 2021-09-27 16:11:48 +02:00
45c0074bd7 printout improvements 2021-09-27 15:50:23 +02:00
df0adfb33c added new tcp code 2021-09-27 15:35:09 +02:00
ac2b196883 Merge pull request 'Update Linux GPIO' (#20) from mueller/update-linux-gpio into eive/develop
Reviewed-on: #20
2021-09-27 15:28:19 +02:00
98deac1ef1 Merge branch 'mueller/tm-stack-robustness' into mueller/master 2021-09-27 11:07:02 +02:00
ba6cbde28a Increased TM stack robustness
1. More nullptr check
2. returnvalue for inititalize function which can fail
2021-09-27 11:05:26 +02:00
a84c770dfb type improvements and bugfixes 2021-09-27 10:51:31 +02:00
9546495507 improvements for linux libgpioIF 2021-09-27 10:38:47 +02:00
e227b5dead Merge remote-tracking branch 'origin/eive/develop' into mueller/master 2021-09-27 10:09:31 +02:00
9db5f893d7 Merge pull request 'meier/gpioOpenByLineName' (#19) from meier/gpioOpenByLineName into eive/develop
Reviewed-on: #19
2021-09-27 10:09:13 +02:00
4b3e753e19 Merge branch 'eive/develop' into meier/gpioOpenByLineName 2021-09-27 10:08:04 +02:00
36607c8764 Merge branch 'mueller/added-missing-devicehandlers' into mueller/master 2021-09-26 22:45:58 +02:00
b88e6c0713 Merge branch 'mueller/added-missing-devicehandlers' into mueller/master 2021-09-26 22:39:36 +02:00
6ee2c65187 Merge remote-tracking branch 'upstream/development' into mueller/master 2021-09-26 22:21:22 +02:00
2b6c996364 Merge branch 'mueller/devicehandler-package' into mueller/master 2021-09-25 16:42:49 +02:00
dabb488c9d Merge pull request 'MgmLIS3MDLHandler fix in buildTransitionDeviceCommand' (#18) from meier/fixMgmLIS3MDLHandler into eive/develop
Reviewed-on: #18
2021-09-25 16:37:10 +02:00
Jakob Meier
16b125ef6c Merge branch 'meier/fixMgmLIS3MDLHandler' into meier/gpioOpenByLineName 2021-09-24 15:37:49 +02:00
Jakob Meier
10f8a0fd0e MgmLIS3MDLHandler fix in buildTransitionDeviceCommand 2021-09-24 15:33:55 +02:00
Jakob Meier
48a24d7dba removed gpio type GPIO_REGULAR 2021-09-24 10:21:40 +02:00
e0671a395e indentation 2021-09-23 18:14:40 +02:00
665be0d417 better name for wiretapping define 2021-09-23 18:05:17 +02:00
Jakob Meier
e7df520780 fixed merge conflicts 2021-09-23 17:54:41 +02:00
dd610f0d7e Merge branch 'mueller/master' into eive/develop 2021-09-23 17:34:24 +02:00
0987a160c9 new retval for empty slot list 2021-09-23 17:33:45 +02:00
ceeb0c5388 Merge branch 'eive/develop' of https://egit.irs.uni-stuttgart.de/eive/fsfw into eive/develop 2021-09-23 17:14:31 +02:00
91f7184ebb Merge branch 'mueller/master' into eive/develop 2021-09-23 17:14:25 +02:00
e1a85b47c5 tiny tweaks 2021-09-23 17:13:53 +02:00
a3eb870ba0 Corrected comment 2021-09-23 16:45:37 +02:00
ed2263b5f7 Merge pull request 'Improvements for devices' (#17) from mueller/acs-board-improvements into eive/develop
Reviewed-on: #17
2021-09-23 15:59:20 +02:00
dccc2f0ba7 printout fix SpiComIF 2021-09-23 15:57:50 +02:00
350fbc385c small tweak 2021-09-23 15:22:27 +02:00
c9b343ebcd op divider fixes 2021-09-23 15:20:10 +02:00
81c33d2dc6 added functions to set x,y,z limits 2021-09-23 14:56:20 +02:00
29c74283f1 sanity checks 2021-09-22 18:36:53 +02:00
c51d2df43d printout fix 2021-09-22 16:00:18 +02:00
d3b83f3cf9 API made more consistent 2021-09-22 15:02:34 +02:00
60229da670 Merge pull request 'GPIO Refactoring' (#16) from mueller/gpio-refactoring into eive/develop
Reviewed-on: #16
2021-09-22 14:39:53 +02:00
5c56eda610 fix for raspberry pi code 2021-09-22 12:19:30 +02:00
3d1be94e12 more checks and printouts 2021-09-21 19:27:33 +02:00
8e65d2d3fc refactored GPIO components 2021-09-21 17:31:03 +02:00
8374d495fa Merge remote-tracking branch 'origin/eive/develop' into mueller/master 2021-09-21 16:02:41 +02:00
e02879184b Merge pull request 'added option to open gpio by label instead of gpiochip*' (#15) from meier/gpioOpenByLabel into eive/develop
Reviewed-on: #15
2021-09-21 16:01:28 +02:00
Jakob Meier
70a3749dbe added option to open gpio by label instead of gpiochip* 2021-09-20 18:38:18 +02:00
87b68e84be Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/fsfw into mueller/master 2021-09-20 18:33:03 +02:00
7000ba05c5 Merge pull request 'Update EIVE FSFW' (#14) from mueller/master into eive/develop
Reviewed-on: #14
2021-09-20 18:32:47 +02:00
9948c4f31d Merge branch 'eive/develop' into mueller/master 2021-09-20 18:32:28 +02:00
784a0140f4 tweak op divider divisor 2021-09-20 18:31:52 +02:00
635432d7ba missing return 2021-09-20 18:29:57 +02:00
e8050183f4 better printout 2021-09-17 16:52:31 +02:00
7d44aab98e some tweaks for op divider 2021-09-17 13:07:43 +02:00
4489a61a00 Merge pull request 'Update FSFW' (#13) from mueller/update-fsfw into eive/develop
Reviewed-on: #13
2021-09-17 07:55:57 +02:00
b1a56a71cd Added LIS3MDL to FSFW, per op divider tweak 2021-09-16 18:50:20 +02:00
6d0d04ac23 minor bugfix 2021-09-16 17:33:37 +02:00
8f3edc90ba Merge branch 'eive/develop' into mueller/update-fsfw 2021-09-16 11:43:30 +02:00
7b5334ccec Merge remote-tracking branch 'upstream/development' into eive/develop 2021-09-16 11:40:12 +02:00
a58016859b Merge branch 'develop' into mueller/master 2021-09-16 11:38:56 +02:00
0df8d35802 comment format 2021-09-16 11:36:32 +02:00
823c6ec5fc added RM3100 handler 2021-09-16 11:33:50 +02:00
bc6b29e652 use warning instead of debug 2021-09-15 18:48:09 +02:00
d986ab7720 bugfix for TM packet stored PUS C 2021-09-15 18:37:44 +02:00
bdd7d59d82 reverted some changes 2021-09-15 17:05:52 +02:00
edf33cc10a Merge remote-tracking branch 'upstream/development' into mueller/master 2021-09-15 16:57:42 +02:00
6db5011b14 spi and gyro l3g updates 2021-09-15 16:55:24 +02:00
97494a84df Merge remote-tracking branch 'upstream/development' into mueller/master 2021-09-13 10:59:26 +02:00
40adca5f1d set reply recipient 2021-09-08 17:24:33 +02:00
a8167f5431 added another helper function 2021-09-08 17:02:08 +02:00
41f3d7cf9a better name for function 2021-09-08 16:58:30 +02:00
e6e1936293 Merge remote-tracking branch 'origin/mueller/dhb-periodoc-reply-fix' into mueller/master 2021-09-08 16:21:13 +02:00
15f35f200a Merge remote-tracking branch 'origin/mueller/dhb-bugfixes-improvements' into mueller/master 2021-09-08 16:20:42 +02:00
6b20bb197a Merge branch 'development' into mueller/dhb-bugfixes-improvements 2021-09-08 16:20:04 +02:00
215d01b3ca Merge branch 'mueller/dhb-bugfixes-improvements' into mueller/master 2021-09-08 16:09:03 +02:00
dfe49cc1e5 DHB improvements 2021-09-08 16:08:13 +02:00
73eb11f4f1 bugfixes and improvements 2021-09-08 16:01:46 +02:00
924c150af2 Possible bugfix in DHB
The delayCycles variables needs to be initialized differently
for periodic replies.
It is initialized to the maxDelayCycles value now
2021-09-06 12:05:30 +02:00
469eba3ce2 raised limit 2021-09-06 11:35:14 +02:00
fd2916af11 moved TCP cfg 2021-08-23 09:40:02 +02:00
afd375a7f8 minor fix for canonical read handling 2021-08-22 20:24:50 +02:00
5454169e20 UartComIF: set O_NONBLOCK in canonical mode
When using the non-canonical mode, the file descriptor can be opened
in blocking mode because the VTIME and VMIN termios parameters are
used to configure non-blocking mode. However, in canonical mode, the fd needs to be opened with O_NONBLOCK
2021-08-22 19:48:35 +02:00
7d0377845b printout for unknown command 2021-08-20 15:46:34 +02:00
882da68a2f Merge branch 'mueller/unix-file-guard-fix' into mueller/master 2021-08-19 17:17:03 +02:00
04a1fe7f10 Merge pull request 'Update FSFW' (#12) from mueller/update-fsfw into eive/develop
Reviewed-on: #12
2021-08-18 12:47:31 +02:00
5f79f987ae Merge branch 'eive/develop' into mueller/update-fsfw 2021-08-18 11:27:02 +02:00
1183e5739d using upstream action helper
Will be merged upstream soon
2021-08-18 11:23:45 +02:00
e3697d6d8c fixed printout 2021-08-17 19:50:01 +02:00
406b77ea81 moved SPI wiretapping cfg 2021-08-17 16:34:25 +02:00
8a9eb27458 Merge pull request 'FSFW Update' (#11) from mueller/master into eive/develop
Reviewed-on: #11
2021-08-11 13:13:11 +02:00
1ac372cb89 getter function for UDP port 2021-08-09 18:22:22 +02:00
fb36dc4501 More improvements for TCP/UDP port definition 2021-08-09 18:12:25 +02:00
ba5e2ad8bb Cleaning up TCP and UDP code
Same port number used as before, but some inconsistencies fixed
2021-08-09 16:57:24 +02:00
5a6c81130d Merge remote-tracking branch 'upstream/development' into mueller/master 2021-08-09 16:18:38 +02:00
22e29144b6 Merge remote-tracking branch 'origin/eive/develop' into mueller/master 2021-08-09 11:12:37 +02:00
52bff3985f Merge pull request 'set sequence flags in space packet base' (#9) from meier/spacePacketFlag into eive/develop
Reviewed-on: #9
2021-08-09 11:11:46 +02:00
Jakob.Meier
133820f463 Merge branch 'eive/develop' into meier/spacePacketFlag 2021-08-08 15:32:24 +02:00
Jakob.Meier
8d3fceea8f set sequence flags in space packet base 2021-08-08 15:26:18 +02:00
3704d2b829 bugfix 2021-08-05 18:24:56 +02:00
6073abb12d added some utility to timer module 2021-08-05 18:13:01 +02:00
47bec654a0 Merge pull request 'Update EIVE FSFW' (#8) from mueller/master into eive/develop
Reviewed-on: #8
2021-08-05 16:35:23 +02:00
b2c102b2c1 Service Interface and Bugfix
1. Service Interface looks better now
2. Bugfix in CommandExecutor blocking mode
2021-08-05 16:13:22 +02:00
4202205182 getter function for current state 2021-08-05 16:02:17 +02:00
c8472beb5f added new command executor 2021-08-05 15:42:47 +02:00
1a4a85ceb2 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/fsfw into mueller/master 2021-08-03 18:38:27 +02:00
7922bf76da corrected README 2021-08-03 18:38:18 +02:00
bb88490cc6 Merge remote-tracking branch 'upstream/mueller/restructuring' into mueller/master 2021-08-03 15:55:38 +02:00
296c587e3d additional nullptr check 2021-08-03 15:29:22 +02:00
0ff81294e7 Merge branch 'eive/develop' of https://egit.irs.uni-stuttgart.de/eive/fsfw into eive/develop 2021-08-02 12:49:50 +02:00
b6e243b8b3 var name clarification 2021-08-02 12:49:40 +02:00
3bbcc42d39 Merge pull request 'type missmatch' (#7) from mohr-patch-1 into eive/develop
Reviewed-on: #7
2021-07-26 19:04:06 +02:00
fc4324a2fa type missmatch 2021-07-26 18:35:53 +02:00
54c028f913 naming adaptions 2021-07-26 13:50:45 +02:00
1f6a5e635f naming fixes 2021-07-26 11:46:58 +02:00
c5b4b01362 Merge branch 'mueller/master' into eive/develop 2021-07-24 15:04:01 +02:00
c5420c7b53 bumped subversion 2021-07-24 14:39:43 +02:00
3e422f51bd corrected version number 2021-07-24 13:43:13 +02:00
d1be0f9843 Merge pull request 'Update framework' (#6) from mueller/master into eive/develop
Reviewed-on: #6
2021-07-23 18:26:39 +02:00
Jakob.Meier
b83259592a uart flush function 2021-07-23 18:06:36 +02:00
a7a4e0f219 api consistent now 2021-07-19 19:03:20 +02:00
bdc5f593e2 Merge remote-tracking branch 'upstream/mueller/master' into mueller/master 2021-07-19 18:50:20 +02:00
10f7185e81 added includes 2021-07-19 13:08:40 +02:00
32 changed files with 600 additions and 81 deletions

View File

@@ -16,8 +16,8 @@ enum Levels: uint8_t {
};
enum Direction: uint8_t {
IN = 0,
OUT = 1
DIR_IN = 0,
DIR_OUT = 1
};
enum GpioOperation {
@@ -30,7 +30,7 @@ enum class GpioTypes {
GPIO_REGULAR_BY_CHIP,
GPIO_REGULAR_BY_LABEL,
GPIO_REGULAR_BY_LINE_NAME,
CALLBACK
TYPE_CALLBACK
};
static constexpr gpioId_t NO_GPIO = -1;
@@ -68,7 +68,7 @@ public:
// Can be used to cast GpioBase to a concrete child implementation
gpio::GpioTypes gpioType = gpio::GpioTypes::NONE;
std::string consumer;
gpio::Direction direction = gpio::Direction::IN;
gpio::Direction direction = gpio::Direction::DIR_IN;
gpio::Levels initValue = gpio::Levels::NONE;
};
@@ -92,7 +92,7 @@ class GpiodRegularByChip: public GpiodRegularBase {
public:
GpiodRegularByChip() :
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP,
std::string(), gpio::Direction::IN, gpio::LOW, 0) {
std::string(), gpio::Direction::DIR_IN, gpio::LOW, 0) {
}
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_,
@@ -104,7 +104,7 @@ public:
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_) :
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, consumer_,
gpio::Direction::IN, gpio::LOW, lineNum_),
gpio::Direction::DIR_IN, gpio::LOW, lineNum_),
chipname(chipname_) {
}
@@ -122,7 +122,7 @@ public:
GpiodRegularByLabel(std::string label_, int lineNum_, std::string consumer_) :
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_,
gpio::Direction::IN, gpio::LOW, lineNum_),
gpio::Direction::DIR_IN, gpio::LOW, lineNum_),
label(label_) {
}
@@ -144,7 +144,7 @@ public:
GpiodRegularByLineName(std::string lineName_, std::string consumer_) :
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_,
gpio::Direction::IN, gpio::LOW), lineName(lineName_) {
gpio::Direction::DIR_IN, gpio::LOW), lineName(lineName_) {
}
std::string lineName;
@@ -154,7 +154,7 @@ class GpioCallback: public GpioBase {
public:
GpioCallback(std::string consumer, gpio::Direction direction_, gpio::Levels initValue_,
gpio::gpio_cb_t callback, void* callbackArgs):
GpioBase(gpio::GpioTypes::CALLBACK, consumer, direction_, initValue_),
GpioBase(gpio::GpioTypes::TYPE_CALLBACK, consumer, direction_, initValue_),
callback(callback), callbackArgs(callbackArgs) {}
gpio::gpio_cb_t callback = nullptr;

View File

@@ -9,7 +9,7 @@ GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceC
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
transitionDelayMs(transitionDelayMs), dataset(this) {
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
debugDivider = new PeriodicOperationDivider(10);
#endif
}

View File

@@ -12,7 +12,7 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this), transitionDelay(transitionDelay) {
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
debugDivider = new PeriodicOperationDivider(10);
#endif
// Set to default values right away
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
@@ -283,7 +283,7 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id,
int16_t mgmMeasurementRawZ = packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8
| packet[MGMLIS3MDL::Z_LOWBYTE_IDX] ;
/* Target value in microtesla */
// Target value in microtesla
float mgmX = static_cast<float>(mgmMeasurementRawX) * sensitivityFactor
* MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
float mgmY = static_cast<float>(mgmMeasurementRawY) * sensitivityFactor
@@ -339,7 +339,7 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id,
case MGMLIS3MDL::READ_TEMPERATURE: {
int16_t tempValueRaw = packet[2] << 8 | packet[1];
float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0);
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
if(debugDivider->check()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" <<
@@ -489,7 +489,7 @@ ReturnValue_t MgmLIS3MDLHandler::prepareCtrlRegisterWrite() {
}
void MgmLIS3MDLHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
}
uint32_t MgmLIS3MDLHandler::getTransitionDelayMs(Mode_t from, Mode_t to) {

View File

@@ -12,7 +12,7 @@ MgmRM3100Handler::MgmRM3100Handler(object_id_t objectId,
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
primaryDataset(this), transitionDelay(transitionDelay) {
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
debugDivider = new PeriodicOperationDivider(10);
#endif
}

View File

@@ -4,10 +4,12 @@ endif()
target_sources(${LIB_FSFW_NAME} PRIVATE
UnixFileGuard.cpp
CommandExecutor.cpp
utility.cpp
)
add_subdirectory(gpio)
add_subdirectory(spi)
add_subdirectory(i2c)
add_subdirectory(uart)
add_subdirectory(uart)
add_subdirectory(uio)

View File

@@ -0,0 +1,210 @@
#include "CommandExecutor.h"
#include "fsfw/serviceinterface.h"
#include "fsfw/container/SimpleRingBuffer.h"
#include "fsfw/container/DynamicFIFO.h"
#include <unistd.h>
#include <cstring>
CommandExecutor::CommandExecutor(const size_t maxSize):
readVec(maxSize) {
waiter.events = POLLIN;
}
ReturnValue_t CommandExecutor::load(std::string command, bool blocking, bool printOutput) {
if(state == States::PENDING) {
return COMMAND_PENDING;
}
currentCmd = command;
this->blocking = blocking;
this->printOutput = printOutput;
if(state == States::IDLE) {
state = States::COMMAND_LOADED;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t CommandExecutor::execute() {
if(state == States::IDLE) {
return NO_COMMAND_LOADED_OR_PENDING;
}
else if(state == States::PENDING) {
return COMMAND_PENDING;
}
currentCmdFile = popen(currentCmd.c_str(), "r");
if(currentCmdFile == nullptr) {
lastError = errno;
return HasReturnvaluesIF::RETURN_FAILED;
}
if(blocking) {
return executeBlocking();
}
else {
currentFd = fileno(currentCmdFile);
waiter.fd = currentFd;
}
state = States::PENDING;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t CommandExecutor::close() {
if(state == States::PENDING) {
// Attempt to close process, irrespective of if it is running or not
if(currentCmdFile != nullptr) {
pclose(currentCmdFile);
}
}
return HasReturnvaluesIF::RETURN_OK;
}
void CommandExecutor::printLastError(std::string funcName) const {
if(lastError != 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << funcName << " pclose failed with code " << lastError << ": " <<
strerror(lastError) << std::endl;
#else
sif::printError("%s pclose failed with code %d: %s\n",
funcName, lastError, strerror(lastError));
#endif
}
}
void CommandExecutor::setRingBuffer(SimpleRingBuffer *ringBuffer,
DynamicFIFO<uint16_t>* sizesFifo) {
this->ringBuffer = ringBuffer;
this->sizesFifo = sizesFifo;
}
ReturnValue_t CommandExecutor::check(bool& bytesRead) {
if(blocking) {
return HasReturnvaluesIF::RETURN_OK;
}
switch(state) {
case(States::IDLE):
case(States::COMMAND_LOADED): {
return NO_COMMAND_LOADED_OR_PENDING;
}
case(States::PENDING): {
break;
}
}
int result = poll(&waiter, 1, 0);
switch(result) {
case(0): {
return HasReturnvaluesIF::RETURN_OK;
break;
}
case(1): {
if (waiter.revents & POLLIN) {
ssize_t readBytes = read(currentFd, readVec.data(), readVec.size());
if(readBytes == 0) {
// Should not happen
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "CommandExecutor::check: No bytes read "
"after poll event.." << std::endl;
#else
sif::printWarning("CommandExecutor::check: No bytes read after poll event..\n");
#endif
break;
}
else if(readBytes > 0) {
bytesRead = true;
if(printOutput) {
// It is assumed the command output is line terminated
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << currentCmd << " | " << readVec.data();
#else
sif::printInfo("%s | %s", currentCmd, readVec.data());
#endif
}
if(ringBuffer != nullptr) {
ringBuffer->writeData(reinterpret_cast<const uint8_t*>(
readVec.data()), readBytes);
}
if(sizesFifo != nullptr) {
if(not sizesFifo->full()) {
sizesFifo->insert(readBytes);
}
}
return BYTES_READ;
}
else {
// Should also not happen
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "CommandExecutor::check: Error " << errno << ": " <<
strerror(errno) << std::endl;
#else
sif::printWarning("CommandExecutor::check: Error %d: %s\n", errno, strerror(errno));
#endif
}
}
else if(waiter.revents & POLLERR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "CommandExecuter::check: Poll error" << std::endl;
#else
sif::printWarning("CommandExecuter::check: Poll error\n");
#endif
return COMMAND_ERROR;
}
else if(waiter.revents & POLLHUP) {
int result = pclose(currentCmdFile);
if(result != 0) {
lastError = result;
return HasReturnvaluesIF::RETURN_FAILED;
}
state = States::IDLE;
currentCmdFile = nullptr;
currentFd = 0;
return EXECUTION_FINISHED;
}
break;
}
}
return HasReturnvaluesIF::RETURN_OK;
}
void CommandExecutor::reset() {
CommandExecutor::close();
currentCmdFile = nullptr;
currentFd = 0;
state = States::IDLE;
}
int CommandExecutor::getLastError() const {
return this->lastError;
}
CommandExecutor::States CommandExecutor::getCurrentState() const {
return state;
}
ReturnValue_t CommandExecutor::executeBlocking() {
while(fgets(readVec.data(), readVec.size(), currentCmdFile) != nullptr) {
std::string output(readVec.data());
if(printOutput) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << currentCmd << " | " << output;
#else
sif::printInfo("%s | %s", currentCmd, output);
#endif
}
if(ringBuffer != nullptr) {
ringBuffer->writeData(reinterpret_cast<const uint8_t*>(output.data()), output.size());
}
if(sizesFifo != nullptr) {
if(not sizesFifo->full()) {
sizesFifo->insert(output.size());
}
}
}
int result = pclose(currentCmdFile);
if(result != 0) {
lastError = result;
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@@ -0,0 +1,134 @@
#ifndef FSFW_SRC_FSFW_OSAL_LINUX_COMMANDEXECUTOR_H_
#define FSFW_SRC_FSFW_OSAL_LINUX_COMMANDEXECUTOR_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/FwClassIds.h"
#include <poll.h>
#include <string>
#include <vector>
class SimpleRingBuffer;
template <typename T> class DynamicFIFO;
/**
* @brief Helper class to execute shell commands in blocking and non-blocking mode
* @details
* This class is able to execute processes by using the Linux popen call. It also has the
* capability of writing the read output of a process into a provided ring buffer.
*
* The executor works by first loading the command which should be executed and specifying
* whether it should be executed blocking or non-blocking. After that, execution can be started
* with the execute command. In blocking mode, the execute command will block until the command
* has finished
*/
class CommandExecutor {
public:
enum class States {
IDLE,
COMMAND_LOADED,
PENDING
};
static constexpr uint8_t CLASS_ID = CLASS_ID::LINUX_OSAL;
//! [EXPORT] : [COMMENT] Execution of the current command has finished
static constexpr ReturnValue_t EXECUTION_FINISHED =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 0);
//! [EXPORT] : [COMMENT] Command is pending. This will also be returned if the user tries
//! to load another command but a command is still pending
static constexpr ReturnValue_t COMMAND_PENDING =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 1);
//! [EXPORT] : [COMMENT] Some bytes have been read from the executing process
static constexpr ReturnValue_t BYTES_READ =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 2);
//! [EXPORT] : [COMMENT] Command execution failed
static constexpr ReturnValue_t COMMAND_ERROR =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3);
//! [EXPORT] : [COMMENT]
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 4);
static constexpr ReturnValue_t PCLOSE_CALL_ERROR =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 6);
/**
* Constructor. Is initialized with maximum size of internal buffer to read data from the
* executed process.
* @param maxSize
*/
CommandExecutor(const size_t maxSize);
/**
* Load a new command which should be executed
* @param command
* @param blocking
* @param printOutput
* @return
*/
ReturnValue_t load(std::string command, bool blocking, bool printOutput = true);
/**
* Execute the loaded command.
* @return
* - In blocking mode, it will return RETURN_FAILED if
* the result of the system call was not 0. The error value can be accessed using
* getLastError
* - In non-blocking mode, this call will start
* the execution and then return RETURN_OK
*/
ReturnValue_t execute();
/**
* Only used in non-blocking mode. Checks the currently running command.
* @param bytesRead Will be set to the number of bytes read, if bytes have been read
* @return
* - BYTES_READ if bytes have been read from the executing process. It is recommended to call
* check again after this
* - RETURN_OK execution is pending, but no bytes have been read from the executing process
* - RETURN_FAILED if execution has failed, error value can be accessed using getLastError
* - EXECUTION_FINISHED if the process was executed successfully
* - COMMAND_ERROR internal poll error
*/
ReturnValue_t check(bool& bytesRead);
/**
* Abort the current command. Should normally not be necessary, check can be used to find
* out whether command execution was successful
* @return RETURN_OK
*/
ReturnValue_t close();
States getCurrentState() const;
int getLastError() const;
void printLastError(std::string funcName) const;
/**
* Assign a ring buffer and a FIFO which will be filled by the executor with the output
* read from the started process
* @param ringBuffer
* @param sizesFifo
*/
void setRingBuffer(SimpleRingBuffer* ringBuffer, DynamicFIFO<uint16_t>* sizesFifo);
/**
* Reset the executor. This calls close internally and then reset the state machine so new
* commands can be loaded and executed
*/
void reset();
private:
std::string currentCmd;
bool blocking = true;
FILE* currentCmdFile = nullptr;
int currentFd = 0;
bool printOutput = true;
std::vector<char> readVec;
struct pollfd waiter {};
SimpleRingBuffer* ringBuffer = nullptr;
DynamicFIFO<uint16_t>* sizesFifo = nullptr;
States state = States::IDLE;
int lastError = 0;
ReturnValue_t executeBlocking();
};
#endif /* FSFW_SRC_FSFW_OSAL_LINUX_COMMANDEXECUTOR_H_ */

View File

@@ -75,7 +75,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) {
configureGpioByLineName(gpioConfig.first, *regularGpio);
break;
}
case(gpio::GpioTypes::CALLBACK): {
case(gpio::GpioTypes::TYPE_CALLBACK): {
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioConfig.second);
if(gpioCallback->callback == nullptr) {
return GPIO_INVALID_INSTANCE;
@@ -163,12 +163,12 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, struct gpiod
consumer = regularGpio.consumer;
/* Configure direction and add a description to the GPIO */
switch (direction) {
case(gpio::OUT): {
case(gpio::DIR_OUT): {
result = gpiod_line_request_output(lineHandle, consumer.c_str(),
regularGpio.initValue);
break;
}
case(gpio::IN): {
case(gpio::DIR_IN): {
result = gpiod_line_request_input(lineHandle, consumer.c_str());
break;
}
@@ -330,7 +330,7 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){
}
break;
}
case(gpio::GpioTypes::CALLBACK): {
case(gpio::GpioTypes::TYPE_CALLBACK): {
auto callbackGpio = dynamic_cast<GpioCallback*>(gpioConfig.second);
if(callbackGpio == nullptr) {
return GPIO_TYPE_FAILURE;
@@ -371,13 +371,13 @@ ReturnValue_t LinuxLibgpioIF::checkForConflictsById(gpioId_t gpioIdToCheck,
case(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP):
case(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL):
case(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME): {
if(gpioType == gpio::GpioTypes::NONE or gpioType == gpio::GpioTypes::CALLBACK) {
if(gpioType == gpio::GpioTypes::NONE or gpioType == gpio::GpioTypes::TYPE_CALLBACK) {
eraseDuplicateDifferentType = true;
}
break;
}
case(gpio::GpioTypes::CALLBACK): {
if(gpioType != gpio::GpioTypes::CALLBACK) {
case(gpio::GpioTypes::TYPE_CALLBACK): {
if(gpioType != gpio::GpioTypes::TYPE_CALLBACK) {
eraseDuplicateDifferentType = true;
}
}

View File

@@ -7,7 +7,7 @@
ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
std::string consumer, gpio::Direction direction, int initValue) {
std::string consumer, gpio::Direction direction, gpio::Levels initValue) {
if(cookie == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@@ -20,7 +20,7 @@ namespace gpio {
* @return
*/
ReturnValue_t createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
std::string consumer, gpio::Direction direction, int initValue);
std::string consumer, gpio::Direction direction, gpio::Levels initValue);
}
#endif /* BSP_RPI_GPIO_GPIORPI_H_ */

View File

@@ -0,0 +1,3 @@
target_sources(${LIB_FSFW_NAME} PUBLIC
UioMapper.cpp
)

View File

@@ -0,0 +1,63 @@
#include <fcntl.h>
#include <unistd.h>
#include <filesystem>
#include <fstream>
#include <sstream>
#include "UioMapper.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
UioMapper::UioMapper(std::string uioFile, int mapNum) : uioFile(uioFile), mapNum(mapNum) {}
UioMapper::~UioMapper() {}
ReturnValue_t UioMapper::getMappedAdress(uint32_t** address, Permissions permissions) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
int fd = open(uioFile.c_str(), O_RDWR);
if (fd < 1) {
sif::warning << "PtmeAxiConfig::initialize: Invalid UIO device file" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
size_t size = 0;
result = getMapSize(&size);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
*address = static_cast<uint32_t*>(
mmap(NULL, size, static_cast<int>(permissions), MAP_SHARED, fd, mapNum * getpagesize()));
if (*address == MAP_FAILED) {
sif::warning << "UioMapper::getMappedAdress: Failed to map physical address of uio device "
<< uioFile.c_str() << " and map" << static_cast<int>(mapNum) << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t UioMapper::getMapSize(size_t* size) {
std::stringstream namestream;
namestream << UIO_PATH_PREFIX << uioFile.substr(5, std::string::npos) << MAP_SUBSTR << mapNum
<< SIZE_FILE_PATH;
FILE* fp;
fp = fopen(namestream.str().c_str(), "r");
if (fp == nullptr) {
sif::warning << "UioMapper::getMapSize: Failed to open file " << namestream.str() << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
char hexstring[SIZE_HEX_STRING] = "";
int items = fscanf(fp, "%s", hexstring);
if (items != 1) {
sif::warning << "UioMapper::getMapSize: Failed with error code " << errno
<< " to read size "
"string from file "
<< namestream.str() << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
items = sscanf(hexstring, "%x", size);
if (items != 1) {
sif::warning << "UioMapper::getMapSize: Failed with error code " << errno << "to convert "
<< "size of map" << mapNum << " to integer" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
fclose(fp);
return HasReturnvaluesIF::RETURN_OK;
}

View File

@@ -0,0 +1,58 @@
#ifndef FSFW_HAL_SRC_FSFW_HAL_LINUX_UIO_UIOMAPPER_H_
#define FSFW_HAL_SRC_FSFW_HAL_LINUX_UIO_UIOMAPPER_H_
#include <sys/mman.h>
#include <string>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
/**
* @brief Class to help opening uio device files and mapping the physical addresses into the user
* address space.
*
* @author J. Meier
*/
class UioMapper {
public:
enum class Permissions: int {
READ_ONLY = PROT_READ,
WRITE_ONLY = PROT_WRITE,
READ_WRITE = PROT_READ | PROT_WRITE
};
/**
* @brief Constructor
*
* @param uioFile The device file of the uiO to open
* @param uioMap Number of memory map. Most UIO drivers have only one map which has than 0.
*/
UioMapper(std::string uioFile, int mapNum = 0);
virtual ~UioMapper();
/**
* @brief Maps the physical address into user address space and returns the mapped address
*
* @address The mapped user space address
* @permissions Specifies the read/write permissions of the address region
*/
ReturnValue_t getMappedAdress(uint32_t** address, Permissions permissions);
private:
static constexpr char UIO_PATH_PREFIX[] = "/sys/class/uio/";
static constexpr char MAP_SUBSTR[] = "/maps/map";
static constexpr char SIZE_FILE_PATH[] = "/size";
static constexpr int SIZE_HEX_STRING = 10;
std::string uioFile;
int mapNum = 0;
/**
* @brief Reads the map size from the associated sysfs size file
*
* @param size The read map size
*/
ReturnValue_t getMapSize(size_t* size);
};
#endif /* FSFW_HAL_SRC_FSFW_HAL_LINUX_UIO_UIOMAPPER_H_ */

View File

@@ -18,6 +18,10 @@
// FSFW core defines
#ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
#endif
#ifndef FSFW_CPP_OSTREAM_ENABLED
#define FSFW_CPP_OSTREAM_ENABLED 1
#endif /* FSFW_CPP_OSTREAM_ENABLED */

View File

@@ -5,8 +5,7 @@
#include <cstddef>
/**
* @brief Circular buffer implementation, useful for buffering
* into data streams.
* @brief Circular buffer implementation, useful for buffering into data streams.
* @details
* Note that the deleteData() has to be called to increment the read pointer.
* This class allocated dynamically, so
@@ -20,8 +19,8 @@ public:
* @param size
* @param overwriteOld If the ring buffer is overflowing at a write
* operation, the oldest data will be overwritten.
* @param maxExcessBytes These additional bytes will be allocated in addtion
* to the specified size to accomodate contiguous write operations
* @param maxExcessBytes These additional bytes will be allocated in addition
* to the specified size to accommodate continuous write operations
* with getFreeElement.
*
*/
@@ -32,10 +31,10 @@ public:
* @param buffer
* @param size
* @param overwriteOld
* If the ring buffer is overflowing at a write operartion, the oldest data
* If the ring buffer is overflowing at a write operation, the oldest data
* will be overwritten.
* @param maxExcessBytes
* If the buffer can accomodate additional bytes for contigous write
* If the buffer can accommodate additional bytes for contiguous write
* operations with getFreeElement, this is the maximum allowed additional
* size
*/
@@ -48,7 +47,7 @@ public:
* Write to circular buffer and increment write pointer by amount.
* @param data
* @param amount
* @return -@c RETURN_OK if write operation was successfull
* @return -@c RETURN_OK if write operation was successful
* -@c RETURN_FAILED if
*/
ReturnValue_t writeData(const uint8_t* data, size_t amount);
@@ -108,7 +107,7 @@ public:
* Delete data by incrementing read pointer.
* @param amount
* @param deleteRemaining
* If the amount specified is larger than the remaing size to read and this
* If the amount specified is larger than the remaining size to read and this
* is set to true, the remaining amount will be deleted as well
* @param trueAmount [out]
* If deleteRemaining was set to true, the amount deleted will be assigned

View File

@@ -321,3 +321,7 @@ float LocalPoolDataSetBase::getCollectionInterval() const {
return 0.0;
}
}
void LocalPoolDataSetBase::printSet() {
return;
}

View File

@@ -176,6 +176,11 @@ public:
*/
float getCollectionInterval() const;
/**
* @brief Can be overwritten by a specific implementation of a dataset to print the set.
*/
virtual void printSet();
protected:
sid_t sid;
//! This mutex is used if the data is created by one object only.
@@ -234,7 +239,6 @@ protected:
PeriodicHousekeepingHelper* periodicHelper = nullptr;
LocalDataPoolManager* poolManager = nullptr;
};

View File

@@ -46,11 +46,12 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
HasLocalDataPoolIF* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner);
if(hkOwner == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "LocalPoolVariable: The supplied pool owner did not implement the correct "
"interface HasLocalDataPoolIF!" << std::endl;
sif::error << "LocalPoolVariable: The supplied pool owner 0x" << std::hex <<
poolOwner << std::dec << " did not implement the correct interface " <<
"HasLocalDataPoolIF" << std::endl;
#else
sif::printError( "LocalPoolVariable: The supplied pool owner did not implement the correct "
"interface HasLocalDataPoolIF!\n");
sif::printError( "LocalPoolVariable: The supplied pool owner 0x%08x did not implement the correct "
"interface HasLocalDataPoolIF\n", poolOwner);
#endif
return;
}

View File

@@ -7,7 +7,7 @@
/**
* @brief Base class to implement reconfiguration and failure handling for
* redundant devices by monitoring their modes health states.
* redundant devices by monitoring their modes and health states.
* @details
* Documentation: Dissertation Baetz p.156, 157.
*

View File

@@ -85,9 +85,10 @@ public:
* Called by DHB in the GET_WRITE doGetWrite().
* Get send confirmation that the data in sendMessage() was sent successfully.
* @param cookie
* @return - @c RETURN_OK if data was sent successfull
* - Everything else triggers falure event with
* returnvalue as parameter 1
* @return
* - @c RETURN_OK if data was sent successfully but a reply is expected
* - NO_REPLY_EXPECTED if data was sent successfully and no reply is expected
* - Everything else to indicate failure
*/
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) = 0;

View File

@@ -684,6 +684,11 @@ void DeviceHandlerBase::doGetWrite() {
void DeviceHandlerBase::doSendRead() {
ReturnValue_t result;
result = doSendReadHook();
if (result != RETURN_OK){
return;
}
size_t replyLen = 0;
if(cookieInfo.pendingCommand != deviceCommandMap.end()) {
replyLen = getNextReplyLength(cookieInfo.pendingCommand->first);
@@ -950,6 +955,10 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
}
}
ReturnValue_t DeviceHandlerBase::doSendReadHook() {
return RETURN_OK;
}
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t **switches,
uint8_t *numberOfSwitches) {
return DeviceHandlerBase::NO_SWITCH;

View File

@@ -334,8 +334,7 @@ protected:
* - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
* have been set.
* - @c HasActionsIF::EXECUTION_COMPLETE to generate a finish reply immediately. This can
* be used if no reply is expected. Otherwise, the developer can call #actionHelper.finish
* to finish the command handling.
* be used if no reply is expected
* - Anything else triggers an event with the return code as a parameter as well as a
* step reply failed with the return code
*/
@@ -1095,6 +1094,12 @@ protected:
*/
void commandSwitch(ReturnValue_t onOff);
/**
* @brief This function can be used to insert device specific code during the do-send-read
* step.
*/
virtual ReturnValue_t doSendReadHook();
private:
/**

View File

@@ -120,7 +120,8 @@ public:
static const ReturnValue_t WRONG_MODE_FOR_COMMAND = MAKE_RETURN_CODE(0xA5);
static const ReturnValue_t TIMEOUT = MAKE_RETURN_CODE(0xA6);
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0xA7);
static const ReturnValue_t NO_REPLY_EXPECTED = MAKE_RETURN_CODE(0xA8); //!< Used to indicate that this is a command-only command.
//!< Used to indicate that this is a command-only command.
static const ReturnValue_t NO_REPLY_EXPECTED = MAKE_RETURN_CODE(0xA8);
static const ReturnValue_t NON_OP_TEMPERATURE = MAKE_RETURN_CODE(0xA9);
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xAA);

View File

@@ -1,30 +1,29 @@
target_sources(${LIB_FSFW_NAME}
PRIVATE
Clock.cpp
BinarySemaphore.cpp
CountingSemaphore.cpp
FixedTimeslotTask.cpp
InternalErrorCodes.cpp
MessageQueue.cpp
Mutex.cpp
MutexFactory.cpp
PeriodicPosixTask.cpp
PosixThread.cpp
QueueFactory.cpp
SemaphoreFactory.cpp
TaskFactory.cpp
tcpipHelpers.cpp
unixUtility.cpp
target_sources(${LIB_FSFW_NAME} PRIVATE
Clock.cpp
BinarySemaphore.cpp
CountingSemaphore.cpp
FixedTimeslotTask.cpp
InternalErrorCodes.cpp
MessageQueue.cpp
Mutex.cpp
MutexFactory.cpp
PeriodicPosixTask.cpp
PosixThread.cpp
QueueFactory.cpp
SemaphoreFactory.cpp
TaskFactory.cpp
tcpipHelpers.cpp
unixUtility.cpp
)
find_package(Threads REQUIRED)
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
${CMAKE_THREAD_LIBS_INIT}
rt
${CMAKE_THREAD_LIBS_INIT}
rt
)
target_link_libraries(${LIB_FSFW_NAME} INTERFACE
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_THREAD_LIBS_INIT}
)

View File

@@ -108,8 +108,6 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
timespec timeUnix;
int status = clock_gettime(CLOCK_REALTIME,&timeUnix);

View File

@@ -285,10 +285,10 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
utility::printUnixErrorGeneric(CLASS_NAME, "sendMessageFromMessageQueue", "EBADF");
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "mq_send to: " << sendTo << " sent from "
<< sentFrom << "failed" << std::endl;
sif::warning << "mq_send to " << sendTo << " sent from "
<< sentFrom << " failed" << std::endl;
#else
sif::printWarning("mq_send to: %d sent from %d failed\n", sendTo, sentFrom);
sif::printWarning("mq_send to %d sent from %d failed\n", sendTo, sentFrom);
#endif
return DESTINATION_INVALID;
}

View File

@@ -62,7 +62,8 @@ protected:
struct ChildInfo {
MessageQueueId_t commandQueue;
Mode_t mode;
Submode_t submode;bool healthChanged;
Submode_t submode;
bool healthChanged;
};
Mode_t mode;

View File

@@ -99,6 +99,14 @@ public:
*/
static ReturnValue_t getDateAndTime(TimeOfDay_t *time);
/**
* Convert to time of day struct given the POSIX timeval struct
* @param from
* @param to
* @return
*/
static ReturnValue_t convertTimevalToTimeOfDay(const timeval *from,
TimeOfDay_t *to);
/**
* Converts a time of day struct to POSIX seconds.
* @param time The time of day as input

View File

@@ -42,6 +42,20 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Clock::convertTimevalToTimeOfDay(const timeval* from, TimeOfDay_t* to) {
struct tm* timeInfo;
timeInfo = gmtime(&from->tv_sec);
to->year = timeInfo->tm_year + 1900;
to->month = timeInfo->tm_mon+1;
to->day = timeInfo->tm_mday;
to->hour = timeInfo->tm_hour;
to->minute = timeInfo->tm_min;
to->second = timeInfo->tm_sec;
to->usecond = from->tv_usec;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Clock::checkOrCreateClockMutex() {
if (timeMutex == nullptr) {
MutexFactory *mutexFactory = MutexFactory::instance();

View File

@@ -183,13 +183,16 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
}
if(tmFifo->full()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number "
"of stored packet IDs reached!" << std::endl;
#else
sif::printWarning("TmTcBridge::storeDownlinkData: TM downlink max. number "
"of stored packet IDs reached!\n");
#endif
if(warningLatch) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number "
"of stored packet IDs reached!" << std::endl;
#else
sif::printWarning("TmTcBridge::storeDownlinkData: TM downlink max. number "
"of stored packet IDs reached!\n");
#endif
warningLatch = true;
}
if(overwriteOld) {
tmFifo->retrieve(&storeId);
tmStore->deleteData(storeId);

View File

@@ -75,6 +75,7 @@ public:
virtual uint16_t getIdentifier() override;
virtual MessageQueueId_t getRequestQueue() override;
bool warningLatch = true;
protected:
//! Cached for initialize function.
object_id_t tmStoreId = objects::NO_OBJECT;