Compare commits
923 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 221d7b408a | |||
| f413ed6f7d | |||
| 05bd1cc8c6 | |||
| 2f51f58c7e | |||
| 182b90ee6d | |||
|
|
606da48861 | ||
| b8a4384c91 | |||
| 6faea8a33b | |||
| e0e0554fea | |||
| b8bd211d8e | |||
| 54fb646ea1 | |||
| dae901a45e | |||
| 27f9c0223c | |||
|
|
f8942cd6c6 | ||
| 81915f1772 | |||
|
|
033bdb93ad | ||
|
|
57b815c8ee | ||
| 23e2c5ffc8 | |||
| 66ece6544e | |||
| 7f71ee82ec | |||
| 9e03f9babe | |||
| be122038ed | |||
| 84367f8424 | |||
| e1112f1903 | |||
| 684d9b8059 | |||
| 4a5ad4fb4d | |||
| b279434ef0 | |||
| daa3b0084a | |||
| 65961695de | |||
| 1c17aac544 | |||
| 165e6e829e | |||
| 0d1ff8585c | |||
| d4dcd8c03f | |||
| 8e8fe3d0c9 | |||
| 8c2c402821 | |||
| a2bc72a798 | |||
| 8e6d8a6fa8 | |||
| ff35986a16 | |||
| 1684c28e0f | |||
| 54640147c1 | |||
| 042acc1a23 | |||
| ba68c80d6b | |||
| 6b88c525b2 | |||
|
|
c88ed9616d | ||
|
|
f88674ed59 | ||
|
|
dfd817d27b | ||
|
|
e61dfc0401 | ||
|
|
e082f3973a | ||
| da78e57dd3 | |||
| dfaaae5512 | |||
| 55618e381c | |||
| 3a6c7e3183 | |||
| 00bd6e260a | |||
| 486fa9cae2 | |||
| 39f4ef6ccb | |||
| cca0d5735e | |||
| 9010f58636 | |||
| 33ff05c558 | |||
| e01f2a8947 | |||
|
|
3593f5ab8c | ||
| 9eb990b3a2 | |||
| 2419e9fcc6 | |||
| 5bf4e50849 | |||
| 3edf7572b6 | |||
| 768bb14842 | |||
| e56532367f | |||
| 0b215bf7e0 | |||
| 9f60c82725 | |||
| 7ae2d7117e | |||
| 10e2600415 | |||
| a067014116 | |||
| c83020d2c1 | |||
| fd85ab3122 | |||
| 2551e673d8 | |||
| 4ad3339331 | |||
|
|
b822ee77bc | ||
| d5b22ca636 | |||
| f5c1263dd3 | |||
| ee53485d4e | |||
| 940115b588 | |||
| 9c625a5743 | |||
| e58c375cb9 | |||
| d27a57ab28 | |||
| bf9f40aad3 | |||
| 9387fdce1c | |||
| 398277ca08 | |||
| 6c988ecf50 | |||
| 3f35dbfad8 | |||
| b9e8346e82 | |||
| 7a97471ed9 | |||
| 27ee6bfffc | |||
| f5c525699e | |||
| 7427d93c1d | |||
| 63ec6d3eae | |||
| 56a57fadc8 | |||
| 0f9690f6c2 | |||
| 7c1dcb5f11 | |||
| 8394f6226a | |||
| 9c7a203930 | |||
|
|
7d01aa463b | ||
|
|
b10bf2c68d | ||
| 23ba1a997d | |||
| 8498a84354 | |||
| c37e7022d1 | |||
| 15bab6ae33 | |||
| 5bd613fb57 | |||
| 6a8c9e14e9 | |||
| 54e3b99708 | |||
| 52e420b0be | |||
|
|
4704e6deb8 | ||
| 29efde6cbb | |||
|
|
62531a710f | ||
| 57280167a2 | |||
| bcac56a65c | |||
| 4ea8ff9876 | |||
| 090979e5a9 | |||
| 334ba6d4bf | |||
| 3400c538b3 | |||
| 91e0e9f233 | |||
| b722b15b26 | |||
| 6ddd2e4759 | |||
| 208f417d17 | |||
| 3a6dcdc78e | |||
|
|
583ab285d8 | ||
|
|
88a9f8f8de | ||
| e95647c572 | |||
|
|
7adff2c9a8 | ||
| 0f42790aa1 | |||
| 587e9451ea | |||
|
|
685b9cd1fb | ||
|
|
e3f36ddcfb | ||
|
|
b1973f77f7 | ||
|
|
1e40013210 | ||
| f1249392cf | |||
|
|
3c17ba5cc7 | ||
|
|
c9e5fbc361 | ||
| f9721eb1ae | |||
| d9badee18f | |||
| 50cf01376f | |||
| e59a98f11c | |||
| 00042af77c | |||
|
|
ac49f3f72b | ||
| 4d154b7cee | |||
|
|
07e68bd05b | ||
|
|
a65072b743 | ||
|
|
3035aea885 | ||
| 20f091d54e | |||
| 60d43246d4 | |||
| 7005314d4b | |||
| 0108a913e6 | |||
| a3092e57e4 | |||
|
|
cfce44ca3a | ||
| fb6b5b9e46 | |||
| 00eeeade3f | |||
| acfd6bfd5e | |||
| 1fa0e3f9c2 | |||
| 90da51ed5a | |||
|
|
328a3b2d02 | ||
|
|
92eb403e35 | ||
| c3e20d6a11 | |||
|
|
4823496b58 | ||
| 0c086f9f15 | |||
| 632b8c7355 | |||
| 470f0c05bf | |||
| 826cb13c3e | |||
|
|
191f3c3deb | ||
|
|
21593a4696 | ||
|
|
e222be0534 | ||
|
|
83d99a6662 | ||
|
|
68d56c4cd3 | ||
|
|
27e3e446e9 | ||
|
|
3c4033f83c | ||
|
|
814f6caa43 | ||
|
|
bb8ccd2842 | ||
|
|
abeb4cdbb1 | ||
|
|
b4d1046928 | ||
|
|
19c97546b6 | ||
|
|
e67bcd4e26 | ||
| 6543264691 | |||
| c42b3f56c3 | |||
| a56b80ec55 | |||
|
|
18d018b7d7 | ||
| 6781b6debe | |||
| e1d506926f | |||
| ec01edc535 | |||
| b8011717f7 | |||
| 5aa800af6e | |||
| 4000c35299 | |||
| 39471d8261 | |||
| 2cdd192eeb | |||
| 339b8e8ecc | |||
| 9456dc1a00 | |||
| 3250a9f489 | |||
| a77d5f3669 | |||
| 9bf3e46e3c | |||
| e142408bb8 | |||
| 6440567585 | |||
| 344390da14 | |||
| f47101c388 | |||
| fea0b2bfe9 | |||
| 7d5b4325e2 | |||
| 988a5e6b31 | |||
| 0067cac94d | |||
| 89bbf98b4a | |||
| dd822f9c44 | |||
| d6e256a5d2 | |||
| 3bd5db2352 | |||
| 866450f1ae | |||
| 9d80e73925 | |||
| 0374262176 | |||
| 9cdc67ad6c | |||
| 9d5345c5de | |||
|
|
d91ceb6fa7 | ||
|
|
4edbbf223c | ||
| 4050521e5a | |||
|
|
bae1ea7c97 | ||
|
|
1651926efa | ||
|
|
c1726f897b | ||
|
|
ab4b397918 | ||
|
|
6043a827ed | ||
|
|
6be7cb4d0c | ||
| e56c538518 | |||
| 239e1f9f9f | |||
| 3bd4c57b85 | |||
| b1e716788a | |||
| 0a315f203b | |||
| 8ee3e18327 | |||
| 0b9b24ca08 | |||
| 9231f47641 | |||
| ef48c8c6ad | |||
| 3207d25bd3 | |||
| c6f7281bc4 | |||
| 521b47d9fc | |||
| 26d66d2a36 | |||
| a9c93db790 | |||
| b4505e5305 | |||
| e8cd2207cf | |||
| 5c535784e9 | |||
| bf73a2e442 | |||
| 9998b54f89 | |||
| 604424c7ed | |||
| 71ada855c7 | |||
| 49bbfb7b7d | |||
|
|
90b65d4d8a | ||
|
|
8ad2114d4b | ||
|
|
03707f2d6a | ||
|
|
102385a707 | ||
|
|
38a1b496e7 | ||
|
|
93e84fde29 | ||
| 7a57043df8 | |||
|
|
a07468f7b7 | ||
| 512d339803 | |||
|
|
a56224c339 | ||
| 34a4904738 | |||
| 745526ce8a | |||
| b1667770fe | |||
| ded92fdf7a | |||
| 7f4f241841 | |||
| b3ca5ac6f2 | |||
| c35c94f22b | |||
| c9787f8e47 | |||
| 4913ffa6d4 | |||
| 262837bf0b | |||
| 68eb7c9271 | |||
| c88371b37a | |||
| 328b9d95af | |||
| 1eb6017a9d | |||
| 79fac2adcb | |||
| f948905aa2 | |||
| 947134bfd1 | |||
| 32236f9864 | |||
| eb23dc1b0f | |||
| 5bd4f56bc6 | |||
| dc6a2ffe56 | |||
| a74ce78c6f | |||
| df3b729baa | |||
| a50f852b9d | |||
| cf92707ee3 | |||
| 77d8f2fc54 | |||
| f49e5fbd5f | |||
| 2f153fe23c | |||
| 4a20306a83 | |||
| 29b795252e | |||
| bb2f5bbb03 | |||
| bd7958f6c5 | |||
| 890d28fb7f | |||
| 0724215b6a | |||
| 3ab6494c28 | |||
| 50e17bc160 | |||
| c1e04b286e | |||
| 2fe645375c | |||
| d4bb5e3f18 | |||
| c9fe3294ac | |||
| 5cc7331e90 | |||
| 76adea6bd5 | |||
| 0ed4691113 | |||
| c32ca422fc | |||
| a85800d86c | |||
| d5a09dc280 | |||
| fab259a2b5 | |||
| 1d6f999ab6 | |||
| 77c45c0de9 | |||
| 975b3cd294 | |||
|
|
870dd717e4 | ||
| 7138d29041 | |||
| c657264832 | |||
| ce6c9d4613 | |||
| a9cd072acd | |||
|
|
643584e1c5 | ||
| 3a274e7a9b | |||
|
|
5a210e19e1 | ||
| 384122f811 | |||
| 71c5aa4df0 | |||
| 9438ba8dcc | |||
| e6d8d24cd5 | |||
| 41ad4099e3 | |||
|
|
abfc120633 | ||
| 0d03f66e9d | |||
| 2207d06058 | |||
| 969251d9fa | |||
| 37ae508af5 | |||
|
|
952dfde5b7 | ||
| 858fd07c4a | |||
| 3b9959b8b3 | |||
| 70ab486081 | |||
| 2fa8de4103 | |||
| 1aa8befe50 | |||
| 9b0906c068 | |||
| 806280ee4a | |||
| a706f6d9bd | |||
| e73dc2f191 | |||
|
|
3421c6fcbf | ||
|
|
e1ddd19e31 | ||
|
|
a9824b71b7 | ||
| d0807ed262 | |||
| 2323fd0506 | |||
| 9d48438fae | |||
| 64ac41d1fe | |||
| d8ec051e13 | |||
| 1f5553b571 | |||
| 372dca87ad | |||
| 2e0d747a0d | |||
| 7201fdf152 | |||
| 1bed87bc20 | |||
| 470e834b80 | |||
| 17615a5a2d | |||
| 1f7ff062c1 | |||
|
|
f6a0fcbe0b | ||
| 09db06e8b2 | |||
| 24ee4cb7f5 | |||
| 7a28cba71b | |||
| 20f4baa84f | |||
|
|
7e0510115a | ||
|
|
b59abb55fe | ||
|
|
8b8a1554a5 | ||
|
|
3bbc7820c8 | ||
|
|
1aca0b4499 | ||
|
|
ac51ad7a4f | ||
|
|
29e7ac210a | ||
|
|
3833b7a875 | ||
|
|
e26ffb6afd | ||
|
|
8d160572c7 | ||
|
|
2ea75d2a05 | ||
|
|
14dec1d700 | ||
|
|
fa8cdb3241 | ||
|
|
8cddbf86d9 | ||
|
|
76f840f137 | ||
|
|
1331c9e7e9 | ||
| cdddc76a59 | |||
| 27c011413a | |||
| 940c770b44 | |||
| db82350d53 | |||
|
|
8a104c4af2 | ||
|
|
c31ae5073b | ||
|
|
72cc081098 | ||
|
|
38ad9f0da2 | ||
|
|
d12027126c | ||
| 433b218227 | |||
| 433947824a | |||
| 861d92f3c2 | |||
|
|
1b38d34951 | ||
|
|
421866b739 | ||
|
|
337a485fc1 | ||
|
|
bed70c6fb5 | ||
|
|
36d33711a7 | ||
| 636c1fdf26 | |||
|
|
e3841d180e | ||
|
|
8694a20c63 | ||
|
|
428d2562ac | ||
|
|
72c0503ac1 | ||
|
|
654e75fec8 | ||
|
|
3163995d06 | ||
|
|
2dd8fb4f45 | ||
| 79859090f8 | |||
| ffa8a37b04 | |||
| e442a8c968 | |||
|
|
2ed0bdf132 | ||
| 6346da658a | |||
|
|
4dee8658fd | ||
| 50154c944a | |||
| 1bd1e25629 | |||
| 64ab445f4e | |||
| 481756b014 | |||
| a3b6c7e8c8 | |||
| 5a0563a7e8 | |||
| 9e6ad8807a | |||
| 5ae6a61ec0 | |||
| 774ffa8359 | |||
|
|
5067519b8a | ||
|
|
58074f9bfd | ||
|
|
717f2e21a0 | ||
|
|
74f52632f6 | ||
| 9983acf98b | |||
| 1f6dbd181c | |||
| 5fadb8f86d | |||
| 985ef0f6bc | |||
|
|
86581d81c9 | ||
|
|
9c42b861f4 | ||
| af32941352 | |||
|
|
f9581f3100 | ||
|
|
1895d7c3db | ||
|
|
e64a3fb645 | ||
| 54e5fef8fd | |||
| 52d8ae5ffb | |||
| 11704ea908 | |||
|
|
99c450933e | ||
|
|
b691a1e75d | ||
|
|
58c40695ae | ||
|
|
fac6996a15 | ||
|
|
ed8399ef9a | ||
| 7cc0fc640f | |||
| 5c1c0dc515 | |||
|
|
a7ab2bb93a | ||
| a2b9484db3 | |||
| 77f6ac57e9 | |||
|
|
8c649b3e70 | ||
| d287aa80c1 | |||
| 8d284b3d2a | |||
| 667bbc918f | |||
| ac3790b659 | |||
|
|
1affc1e1d3 | ||
|
|
077913400f | ||
|
|
b84bdcc0fc | ||
|
|
5ea129d252 | ||
|
|
eb0e9c2a41 | ||
|
|
8b97528afb | ||
|
|
007126feff | ||
|
|
0b7e8fa38b | ||
| 25b53d55ce | |||
| 5b412bf072 | |||
| 0f89282dae | |||
| 14ba11738b | |||
| fa89da4438 | |||
| be75332be7 | |||
| 1886c69e0b | |||
|
|
23d9f56308 | ||
| 1be7208f47 | |||
| 395fbb7704 | |||
|
|
b4479d6a7d | ||
|
|
34897aceae | ||
|
|
542aa994b7 | ||
|
|
345ccf5392 | ||
|
|
ec7568337c | ||
|
|
c2dbebe56b | ||
|
|
cb6db97fc1 | ||
|
|
15b2f9a13e | ||
|
|
283921cba1 | ||
|
|
dc0f435dbd | ||
|
|
63965e2f68 | ||
|
|
67ac4060d7 | ||
| 4a01ff3537 | |||
| c1be4a1e83 | |||
| 9ec653075d | |||
| a2d5f872ad | |||
|
|
8891cda1d4 | ||
|
|
9e9a19ebb0 | ||
| 0f3e9de2b0 | |||
|
|
f75e7b2002 | ||
|
|
08b369f667 | ||
|
|
6f85968f3c | ||
|
|
709661ff67 | ||
| c7cd4afa01 | |||
|
|
3e2f4e7a10 | ||
|
|
9191d1ec33 | ||
|
|
556a3986c1 | ||
|
|
b71ac25a77 | ||
|
|
ca8e3f685a | ||
|
|
017e02e513 | ||
| 46dcc18ddb | |||
| 9ddea586ea | |||
| f8d5546a03 | |||
| b7cd192185 | |||
| 9f681275b4 | |||
| dac3068437 | |||
| c56fc09da7 | |||
| 0237a22ae9 | |||
| ccb3a23602 | |||
| 30cf0c7aad | |||
| dcdf0c9843 | |||
| 7c673d6e7f | |||
| 667a893d01 | |||
| 01e9ef64c9 | |||
| 5e42618dfd | |||
| 1bef032260 | |||
| 221012f790 | |||
| 8d10dcbe18 | |||
| c51d9b437e | |||
| c85a7d6b9c | |||
| 8a6b4a14bd | |||
| 2e0606ff0c | |||
| f3f96e02a2 | |||
| 7d6022ab09 | |||
| 10f2a7a7b7 | |||
| 271d133053 | |||
| 65ed862c9b | |||
| 1f981e7a60 | |||
| 823decde5c | |||
| 2b609a413d | |||
|
|
5da2a45881 | ||
|
|
c5c7a895a4 | ||
|
|
18f7d3e3c9 | ||
| bea4b7629b | |||
|
|
1463bcae52 | ||
| a2a6bf1b45 | |||
| 448ca372a9 | |||
| 350e494930 | |||
| 47733a5648 | |||
|
|
7f70673625 | ||
|
|
7ae02d43a7 | ||
| 82b72e66ee | |||
|
|
3ca18a42ad | ||
|
|
55d31d0dc2 | ||
| 0499fd03da | |||
| 8e23be665b | |||
| 825682c36d | |||
| f61d0e83f0 | |||
| e4286d18d4 | |||
| ababb5c062 | |||
| 74fa4835e2 | |||
| cf04b83cdf | |||
| c1fe5325ed | |||
| 5b6f091859 | |||
| d903df55ce | |||
| 6a00fd3099 | |||
| 4db5944514 | |||
| 699ffd75df | |||
| 14dcd9eb5f | |||
| e5d0dac65e | |||
| 8acb0c3c02 | |||
| 55a274a6e3 | |||
| 90bd6b1fc1 | |||
| 2fd4687108 | |||
| 3af5b8560d | |||
| a5f9d0c0d5 | |||
| 7fd5b6b39e | |||
| 71bf98794d | |||
| 3e5ef61d5f | |||
| 3a606fdfc4 | |||
| 04d791824d | |||
|
|
5b26564058 | ||
| 8dd58ed4fe | |||
| c0dde1a005 | |||
|
|
773627dc3d | ||
|
|
f0885fcb2e | ||
|
|
9fd4c477f0 | ||
| b305924e11 | |||
|
|
11537f9988 | ||
| 863295cd31 | |||
| 5348f059b0 | |||
| 0e43969b63 | |||
| ebb575d490 | |||
| b1a91da844 | |||
|
|
d6164971df | ||
| 397e1433fd | |||
|
|
0e68dbd86c | ||
| 31c84d47fe | |||
| 8fc144b595 | |||
| 8693075061 | |||
| b128455217 | |||
| 99c975d0cd | |||
| d5205b59c1 | |||
| 26fbd81d39 | |||
| 0ccf062d51 | |||
| aa71159a9a | |||
| e56a30df06 | |||
|
|
c035a26051 | ||
| 7b7bd76703 | |||
|
|
d54e2276d6 | ||
| ee878d9fe9 | |||
| 0b50d9aedf | |||
| 4131084973 | |||
| b81ff7f8f5 | |||
| 1284d10257 | |||
| af9a9b837a | |||
| 9a16544836 | |||
| dbcf4f5d69 | |||
| f9050ab185 | |||
| d6e22e7d4d | |||
| e1ae1c021a | |||
| da45326150 | |||
| 28040f85cc | |||
| 652cfa0986 | |||
| 3a76ee366d | |||
| 09c602a830 | |||
| 1d8c4be47a | |||
|
|
e2c26efe4a | ||
|
|
c4ba578285 | ||
|
|
804afa5d96 | ||
|
|
26162f8e78 | ||
|
|
38903f647b | ||
|
|
cd92f4a611 | ||
| 8f1d521007 | |||
| cf9ff87560 | |||
| cbb7fdfa99 | |||
| 487b6fd5ca | |||
|
|
ddd8ff2180 | ||
| 87d00dbcee | |||
| 5cb6ab8416 | |||
| 4b5f22f013 | |||
| 48a8a52b1c | |||
| 8dcd2f0c95 | |||
| 2cb562cdee | |||
| 00bafd98fe | |||
| 536c0cb0fe | |||
| 0f57fc33c8 | |||
| 2aa76766af | |||
| 00711c148a | |||
| d0cba24a37 | |||
| adb0147ea9 | |||
| 086d076262 | |||
| 260082c425 | |||
| ad052462c1 | |||
| b8b6cd8872 | |||
| 799e90f617 | |||
| 8afc6dea11 | |||
| 8af3a91b5a | |||
| bdd5a7dd21 | |||
| 2630d7fae7 | |||
| df5b0a19de | |||
| c7d0a9551e | |||
| 26fa568d72 | |||
| 39acc24535 | |||
| d29b86a0bd | |||
| 8e6a2a1f02 | |||
| 43fe7e0aa0 | |||
| ca79f370b0 | |||
| 10f5933c1e | |||
| 3354f2a696 | |||
| c67a7ef1d8 | |||
| 63ec5d6338 | |||
| a66a76609f | |||
| 9f389fb920 | |||
| 9dff2e1479 | |||
| 299136f1a5 | |||
| 2c65849bc6 | |||
| 0343372910 | |||
| 366c475b05 | |||
| 46e3956bca | |||
| 6409c596f7 | |||
| 5779f511cf | |||
| 63c7903f9b | |||
| 87495fd3af | |||
| 38c60f37da | |||
| baba8b5cf0 | |||
| a4cd99ec90 | |||
| e837532b22 | |||
| f7c6f16777 | |||
| 3b3b2ed8c3 | |||
| 52d0182a52 | |||
| 405b9e7074 | |||
| 24c7a4e7e3 | |||
| 30a57ad5a4 | |||
| d78c746552 | |||
| 773b745c76 | |||
| 45409fc2d6 | |||
| f97d5df75f | |||
| 49b8232f12 | |||
| ac3812f268 | |||
| ed6ee02861 | |||
| 94979e3561 | |||
| 74e4415d58 | |||
| 08bc44ce8b | |||
| aeb289b758 | |||
| 56108aed66 | |||
| 225dcf27ba | |||
| 146035de5a | |||
| cc602ddada | |||
|
|
e13db2e6b6 | ||
|
|
0f79864446 | ||
|
|
01dd2eb92e | ||
|
|
89b68940be | ||
| c8150dff17 | |||
| d8e1e4561d | |||
| c1ca43113b | |||
| 26afe1d94a | |||
| 90622eb25a | |||
| e4e765300d | |||
| 922c33df57 | |||
| 23894f9749 | |||
| 1716034926 | |||
| acc1849fbb | |||
| d1a25bfa65 | |||
| dc0c8c704c | |||
| bb58281fba | |||
| 5b9811a950 | |||
| e9849bfedd | |||
| 6ecd4ec2f3 | |||
|
|
333c46bdf8 | ||
| 23782dc2fa | |||
|
|
95b49ca49d | ||
| a45d4592c3 | |||
| 9a84abf77f | |||
| 5789e2a3b5 | |||
| 92528c7350 | |||
|
|
3acb61959a | ||
| ef75d92415 | |||
| e821a9700a | |||
| d1afdfe578 | |||
| 24ecfe84ae | |||
| 42d225bb6c | |||
| 7c828427e9 | |||
| 8ddd7b02dc | |||
| 963e40120f | |||
| faee071edc | |||
| a6777067da | |||
| c1b22af695 | |||
| 7fc3285272 | |||
| 19d4349c05 | |||
| 99a24a9a35 | |||
| 2b061a2b1c | |||
|
|
124abf0213 | ||
| 2f72b4e42a | |||
| e98b985d66 | |||
| 9efcd90cc0 | |||
| aa248b7997 | |||
| 921e82f6d1 | |||
| aa43bd7d75 | |||
|
|
be6056aadb | ||
| a298fff602 | |||
|
|
5204afca9e | ||
|
|
1722f14a60 | ||
| 3a65f1d39f | |||
| 567199f460 | |||
| cfbacd4d80 | |||
| 95c06d5a09 | |||
| dc8879b1af | |||
| 1962b30e5f | |||
| cb330bcf29 | |||
| 268cd33677 | |||
| 0ae55e0783 | |||
| be43dbd293 | |||
| 45b78a0100 | |||
| fc22f7d86f | |||
| 0622b78dde | |||
| cf355a0451 | |||
| 337aa39ecc | |||
| 24b58e50d1 | |||
| 11c2efa733 | |||
| 0efaa13a9f | |||
|
|
ae08d14626 | ||
| 681ad25847 | |||
| 53f6a0d3a6 | |||
|
|
4fdcb5d7cd | ||
| f3bc2958f9 | |||
| d714f84df8 | |||
| bda8550ef9 | |||
| d604f8d3d1 | |||
| e92af98f34 | |||
| 3b915f4c97 | |||
| 03510e5de9 | |||
| 1d714ff85e | |||
| b3f2a05385 | |||
| ec27521c35 | |||
| cd7bc466ae | |||
|
|
12dbc5569e | ||
|
|
8f124de79c | ||
| 9fd0009c7b | |||
| 74dbfae225 | |||
| 6871cc597a | |||
|
|
ce1124472a | ||
| 6e22c3e017 | |||
| f5f8df61ae | |||
| 4a74a3ac37 | |||
| 444389a41c | |||
| f4ef0cb7ab | |||
| f56c8ba1c0 | |||
|
|
66f38daf56 | ||
|
|
0580784d16 | ||
|
|
74dc04daeb | ||
|
|
dc3dfa1292 | ||
| 891ba6881b | |||
| 02a837c964 | |||
| 8cdb877df6 | |||
| 22d7af4b78 | |||
| 0fecfab2f0 | |||
| e05c52be85 | |||
| ea56a5d536 | |||
| 106228c2ee | |||
| 365fa0adc4 | |||
| 51dbc95750 | |||
| a3eb6b2093 | |||
| 5045eeb867 | |||
| f50b9de4a5 | |||
| 1c0ea5cbb1 | |||
| 5a4d287f67 | |||
| e186bff4e4 | |||
| 2fb54f7de9 | |||
| f0e282c6e1 | |||
| 05088ce02c | |||
|
|
f64356d75e | ||
| 7f327c3900 | |||
| 8104ac0df8 | |||
| 1cfb9250fa | |||
|
|
0315a2a3d5 | ||
| 0c13c32e82 | |||
|
|
2700d4d28c | ||
| 3a88a43505 | |||
| b52aca643f | |||
| fcf2e363d8 | |||
|
|
acca10cc34 | ||
|
|
c431deede0 | ||
| 15c7493584 | |||
| addddb4342 | |||
| 9790b395e6 | |||
| 3cc3786505 | |||
| 59c4ed74e0 | |||
| f8f0032d1e | |||
|
|
ba51ca58f3 | ||
|
|
9de28fdfc9 | ||
|
|
aeecf33763 | ||
| d6d60249c1 | |||
| 9edd6fc3be | |||
| 009234612a | |||
| 528b3c8610 | |||
| fe0a4844aa | |||
| 4b4cfc09c5 | |||
|
|
340ca0618c | ||
| 0b1b74e879 | |||
|
|
72533f1d14 | ||
| 298a87d349 | |||
|
|
926e1e336a | ||
| 503d5923c4 | |||
| 8c3d25f62d | |||
| d8acf94a02 | |||
| 940d4965bc | |||
| df971d4ec5 | |||
| b4447b6d8c | |||
| 208aeb6640 | |||
| bc1d236a85 | |||
| 34d3479e81 | |||
| dba620baf2 | |||
| c9da184b7f | |||
| ff86c8af73 | |||
| 983ce045a9 | |||
| 4fbfbe8bb8 | |||
| 12be969ca2 | |||
| 93fa82c413 | |||
| 6c8336bcfe | |||
| af6f24d668 | |||
| acaf87095a | |||
| afb7a2008f | |||
| 6361fcb6bb | |||
| 55727accf5 | |||
| 59bcf6cec2 | |||
|
|
6cd4f6cfe3 | ||
| 664f8e84b9 | |||
| 190590e1b5 | |||
| 125593be21 | |||
|
|
4f3a680a07 | ||
|
|
f4b67945cc | ||
| fc769be789 | |||
| b846a936b4 | |||
| 1e6ea91438 | |||
| 1a4f907925 | |||
| c0b91a4879 | |||
| dd61af5bb3 | |||
| d511903872 | |||
|
|
50ca738d5c | ||
|
|
3d39ddf85c | ||
|
|
14cd3e9eea | ||
|
|
03a601d450 | ||
|
|
bd9dbc5fc8 | ||
| 3824daa865 | |||
| 6625d562e9 | |||
| 0abc854567 | |||
| 2a5cc62af7 | |||
|
|
6506baa7b6 | ||
| 292bfaad16 | |||
| f7ac382498 | |||
| 96c9069a69 | |||
| 5018b24cfc | |||
| 261fc8b58f | |||
| 590d5e11e1 | |||
| a2079ffb8c | |||
|
|
dc73036c7a | ||
|
|
f0dc1279c4 | ||
|
|
01a02f896f | ||
| 7eb57d4027 | |||
| 9878b8defc | |||
| 5b99199b6c | |||
| eee7ab98cb | |||
| 4093b2cff2 | |||
| 3f509ce472 | |||
| cffd6af1e1 | |||
| 2a5f824161 | |||
| be6ae6b7ae | |||
| 10507904e8 | |||
| e82ca9e749 | |||
| 84ce7d22bf | |||
| 7ff133687e | |||
| 0ff837baa1 | |||
| 474054f4d8 | |||
| 4645b8d35b | |||
| 4b4b75085c | |||
| 9b2ab66c0a | |||
|
|
0cd814db76 | ||
|
|
8c1a5bd9ad | ||
|
|
f6d43cdf46 | ||
| bbc8a3eeef | |||
| 07f531a044 | |||
| 733a89a97a | |||
| 0e3b67383d | |||
|
|
c4616e3633 |
8
.clang-format
Normal file
8
.clang-format
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
ColumnLimit: 100
|
||||||
|
ReflowComments: true
|
||||||
|
---
|
||||||
17
.gitignore
vendored
17
.gitignore
vendored
@@ -1,19 +1,18 @@
|
|||||||
/build*
|
/build*
|
||||||
|
|
||||||
Debug
|
# Eclipse
|
||||||
Debug*
|
|
||||||
Release
|
|
||||||
Release*
|
|
||||||
|
|
||||||
.settings
|
.settings
|
||||||
.metadata
|
.metadata
|
||||||
.project
|
.project
|
||||||
.cproject
|
.cproject
|
||||||
__pycache__
|
|
||||||
|
|
||||||
.idea
|
|
||||||
|
|
||||||
!misc/eclipse/**/.cproject
|
!misc/eclipse/**/.cproject
|
||||||
!misc/eclipse/**/.project
|
!misc/eclipse/**/.project
|
||||||
|
|
||||||
|
#vscode
|
||||||
|
/.vscode
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__
|
||||||
|
.idea
|
||||||
|
|
||||||
generators/*.db
|
generators/*.db
|
||||||
|
|||||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -15,7 +15,7 @@
|
|||||||
url = https://github.com/rmspacefish/lwgps.git
|
url = https://github.com/rmspacefish/lwgps.git
|
||||||
[submodule "generators/fsfwgen"]
|
[submodule "generators/fsfwgen"]
|
||||||
path = generators/fsfwgen
|
path = generators/fsfwgen
|
||||||
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-generators.git
|
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git
|
||||||
[submodule "thirdparty/arcsec_star_tracker"]
|
[submodule "thirdparty/arcsec_star_tracker"]
|
||||||
path = thirdparty/arcsec_star_tracker
|
path = thirdparty/arcsec_star_tracker
|
||||||
url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git
|
url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git
|
||||||
|
|||||||
342
CMakeLists.txt
342
CMakeLists.txt
@@ -13,19 +13,24 @@ cmake_minimum_required(VERSION 3.13)
|
|||||||
|
|
||||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
|
||||||
option(Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(ADD_ETL_LIB "Add ETL library" ON)
|
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
|
||||||
option(ADD_JSON_LIB "Add JSON librara" ON)
|
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
|
||||||
|
|
||||||
|
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
|
||||||
|
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)
|
||||||
|
|
||||||
if(NOT FSFW_OSAL)
|
if(NOT FSFW_OSAL)
|
||||||
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP)
|
||||||
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
option(LINUX_CROSS_COMPILE ON)
|
option(LINUX_CROSS_COMPILE ON)
|
||||||
|
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF)
|
||||||
|
elseif(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Perform steps like loading toolchain files where applicable.
|
# Perform steps like loading toolchain files where applicable.
|
||||||
@@ -33,7 +38,7 @@ include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
|
|||||||
pre_project_config()
|
pre_project_config()
|
||||||
|
|
||||||
# Project Name
|
# Project Name
|
||||||
project(eive_obsw ASM C CXX)
|
project(eive-obsw ASM C CXX)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Pre-Sources preparation
|
# Pre-Sources preparation
|
||||||
@@ -44,33 +49,42 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
# Set names and variables
|
# Set names and variables
|
||||||
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
|
set(OBSW_NAME ${CMAKE_PROJECT_NAME})
|
||||||
|
set(WATCHDOG_NAME eive-watchdog)
|
||||||
|
set(SIMPLE_OBSW_NAME eive-simple)
|
||||||
|
set(UNITTEST_NAME eive-unittest)
|
||||||
set(LIB_FSFW_NAME fsfw)
|
set(LIB_FSFW_NAME fsfw)
|
||||||
|
set(LIB_EIVE_MISSION eive-mission)
|
||||||
set(LIB_ETL_NAME etl)
|
set(LIB_ETL_NAME etl)
|
||||||
set(LIB_CSP_NAME libcsp)
|
set(LIB_CSP_NAME libcsp)
|
||||||
set(LIB_LWGPS_NAME lwgps)
|
set(LIB_LWGPS_NAME lwgps)
|
||||||
set(LIB_ARCSEC wire)
|
set(LIB_ARCSEC wire)
|
||||||
set(THIRD_PARTY_FOLDER thirdparty)
|
set(THIRD_PARTY_FOLDER thirdparty)
|
||||||
set(LIB_CXX_FS -lstdc++fs)
|
set(LIB_CXX_FS -lstdc++fs)
|
||||||
|
set(LIB_CATCH2 Catch2)
|
||||||
|
set(LIB_GPS gps)
|
||||||
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
# Set path names
|
# Set path names
|
||||||
set(FSFW_PATH fsfw)
|
set(FSFW_PATH fsfw)
|
||||||
set(MISSION_PATH mission)
|
|
||||||
set(TEST_PATH test/testtasks)
|
set(TEST_PATH test/testtasks)
|
||||||
|
set(UNITTEST_PATH unittest)
|
||||||
set(LINUX_PATH linux)
|
set(LINUX_PATH linux)
|
||||||
set(COMMON_PATH common)
|
set(COMMON_PATH common)
|
||||||
|
set(WATCHDOG_PATH watchdog)
|
||||||
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
||||||
|
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
|
||||||
|
|
||||||
set(FSFW_HAL_LIB_PATH fsfw_hal)
|
set(LIB_EIVE_MISSION_PATH mission)
|
||||||
set(CSP_LIB_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
||||||
set(ETL_LIB_PATH ${THIRD_PARTY_FOLDER}/etl)
|
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
|
||||||
set(LWGPS_LIB_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
|
||||||
set(ARCSEC_LIB_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
|
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
||||||
|
set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
|
||||||
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
|
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
|
||||||
|
|
||||||
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
||||||
set(ADD_LINUX_FILES False)
|
set(EIVE_ADD_LINUX_FILES False)
|
||||||
|
|
||||||
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
||||||
# display information about compiler etc.
|
# display information about compiler etc.
|
||||||
@@ -79,147 +93,87 @@ pre_source_hw_os_config()
|
|||||||
|
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
|
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
|
||||||
OR TGT_BSP MATCHES "arm/beagleboneblack"
|
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse"
|
||||||
)
|
)
|
||||||
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
||||||
if(NOT Q7S_SIMPLE_MODE)
|
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
||||||
set(ADD_LINUX_FILES TRUE)
|
set(EIVE_ADD_LINUX_FILES TRUE)
|
||||||
set(ADD_CSP_LIB TRUE)
|
set(ADD_CSP_LIB TRUE)
|
||||||
set(FSFW_HAL_ADD_LINUX ON)
|
set(FSFW_HAL_ADD_LINUX ON)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${TGT_BSP} MATCHES "arm/raspberrypi")
|
if(TGT_BSP MATCHES "arm/raspberrypi" )
|
||||||
add_definitions(-DRASPBERRY_PI)
|
# Used by configure file
|
||||||
|
set(RASPBERRY_PI ON)
|
||||||
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${TGT_BSP} MATCHES "arm/beagleboneblack")
|
if(TGT_BSP MATCHES "arm/egse")
|
||||||
add_definitions(-DBEAGLEBONEBLACK)
|
# Used by configure file
|
||||||
|
set(EGSE ON)
|
||||||
|
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${TGT_BSP} MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
add_definitions(-DXIPHOS_Q7S)
|
# Used by configure file
|
||||||
|
set(BEAGLEBONEBLACK ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
# Used by configure file
|
||||||
|
set(XIPHOS_Q7S ON)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# Required by FSFW library
|
# Required by FSFW library
|
||||||
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Configuration files
|
# Configuration files
|
||||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
||||||
if(${TGT_BSP} MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
||||||
elseif(${TGT_BSP} MATCHES "arm/raspberrypi")
|
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
|
||||||
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
|
||||||
|
|
||||||
# Set common config path for FSFW
|
# Set common config path for FSFW
|
||||||
set(FSFW_ADDITIONAL_INC_PATHS
|
set(FSFW_ADDITIONAL_INC_PATHS
|
||||||
"${COMMON_PATH}/config"
|
"${COMMON_PATH}/config"
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
# Set for lwgps library
|
|
||||||
set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config")
|
# Check whether the user has already installed Catch2 first
|
||||||
|
find_package(Catch2 3)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Executable and Sources
|
# Executable and Sources
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Add executable
|
#global compiler options need to be set before adding executables
|
||||||
add_executable(${TARGET_NAME})
|
|
||||||
|
|
||||||
if(ADD_CSP_LIB)
|
|
||||||
add_subdirectory(${CSP_LIB_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ADD_ETL_LIB)
|
|
||||||
add_subdirectory(${ETL_LIB_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ADD_LINUX_FILES)
|
|
||||||
add_subdirectory(${LINUX_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ADD_JSON_LIB)
|
|
||||||
add_subdirectory(${LIB_JSON_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(${BSP_PATH})
|
|
||||||
add_subdirectory(${COMMON_PATH})
|
|
||||||
|
|
||||||
if(NOT Q7S_SIMPLE_MODE)
|
|
||||||
add_subdirectory(${LWGPS_LIB_PATH})
|
|
||||||
add_subdirectory(${FSFW_PATH})
|
|
||||||
add_subdirectory(${MISSION_PATH})
|
|
||||||
add_subdirectory(${TEST_PATH})
|
|
||||||
add_subdirectory(${ARCSEC_LIB_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Post-Sources preparation
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux)
|
|
||||||
|
|
||||||
if(NOT Q7S_SIMPLE_MODE)
|
|
||||||
# Add libraries for all sources.
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
||||||
${LIB_FSFW_NAME}
|
|
||||||
${LIB_OS_NAME}
|
|
||||||
${LIB_LWGPS_NAME}
|
|
||||||
${LIB_ARCSEC}
|
|
||||||
${LIB_CXX_FS}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ADD_ETL_LIB)
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
||||||
${LIB_ETL_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ADD_CSP_LIB)
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
||||||
${LIB_CSP_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ADD_JSON_LIB)
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
||||||
${LIB_JSON_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add include paths for all sources.
|
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${FSFW_CONFIG_PATH}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${ARCSEC_LIB_PATH}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(WARNING_FLAGS
|
add_compile_options(
|
||||||
-Wall
|
"-Wall"
|
||||||
-Wextra
|
"-Wextra"
|
||||||
-Wimplicit-fallthrough=1
|
"-Wimplicit-fallthrough=1"
|
||||||
-Wno-unused-parameter
|
"-Wno-unused-parameter"
|
||||||
-Wno-psabi
|
"-Wno-psabi"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Remove unused sections.
|
# Remove unused sections.
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
add_compile_options(
|
||||||
"-ffunction-sections"
|
"-ffunction-sections"
|
||||||
"-fdata-sections"
|
"-fdata-sections"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Removed unused sections.
|
# Removed unused sections.
|
||||||
target_link_options(${TARGET_NAME} PRIVATE
|
add_link_options(
|
||||||
"-Wl,--gc-sections"
|
"-Wl,--gc-sections"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -227,15 +181,162 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||||||
set(COMPILER_FLAGS "/permissive-")
|
set(COMPILER_FLAGS "/permissive-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Not installed, so use FetchContent to download and provide Catch2
|
||||||
|
if(NOT Catch2_FOUND)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
Catch2
|
||||||
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
|
GIT_TAG v3.0.0-preview4
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(Catch2)
|
||||||
|
#fixes regression -preview4, to be confirmed in later releases
|
||||||
|
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
||||||
|
set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true")
|
||||||
|
set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
add_library(${LIB_EIVE_MISSION})
|
||||||
|
|
||||||
|
|
||||||
|
# Add main executable
|
||||||
|
add_executable(${OBSW_NAME})
|
||||||
|
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
|
||||||
|
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME}-$ENV{USERNAME})
|
||||||
|
else()
|
||||||
|
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
||||||
|
endif()
|
||||||
|
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
||||||
|
|
||||||
|
#watchdog
|
||||||
|
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
|
||||||
|
add_subdirectory(${WATCHDOG_PATH})
|
||||||
|
target_link_libraries(${WATCHDOG_NAME} PUBLIC
|
||||||
|
${LIB_CXX_FS}
|
||||||
|
)
|
||||||
|
target_include_directories(${WATCHDOG_NAME} PUBLIC
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
#unittests
|
||||||
|
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(EIVE_ADD_ETL_LIB)
|
||||||
|
add_subdirectory(${LIB_ETL_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIVE_ADD_JSON_LIB)
|
||||||
|
add_subdirectory(${LIB_JSON_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(EIVE_ADD_LINUX_FILES)
|
||||||
|
add_subdirectory(${LIB_ARCSEC_PATH})
|
||||||
|
add_subdirectory(${LINUX_PATH})
|
||||||
|
endif()
|
||||||
|
add_subdirectory(${BSP_PATH})
|
||||||
|
if(ADD_CSP_LIB)
|
||||||
|
add_subdirectory(${LIB_CSP_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
add_subdirectory(${COMMON_PATH})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
add_subdirectory(${LIB_LWGPS_PATH})
|
||||||
|
add_subdirectory(${FSFW_PATH})
|
||||||
|
add_subdirectory(${LIB_EIVE_MISSION_PATH})
|
||||||
|
add_subdirectory(${TEST_PATH})
|
||||||
|
|
||||||
|
|
||||||
|
add_subdirectory(${UNITTEST_PATH})
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Post-Sources preparation
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Add libraries
|
||||||
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${LIB_FSFW_NAME}
|
||||||
|
${LIB_LWGPS_NAME}
|
||||||
|
${LIB_OS_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${OBSW_NAME} PRIVATE
|
||||||
|
${LIB_EIVE_MISSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${LIB_ARCSEC}
|
||||||
|
${LIB_GPS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${UNITTEST_NAME} PRIVATE
|
||||||
|
Catch2
|
||||||
|
${LIB_EIVE_MISSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/egse")
|
||||||
|
target_link_libraries(${OBSW_NAME} PRIVATE
|
||||||
|
${LIB_ARCSEC}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ADD_CSP_LIB)
|
||||||
|
target_link_libraries(${OBSW_NAME} PRIVATE
|
||||||
|
${LIB_CSP_NAME}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(EIVE_ADD_ETL_LIB)
|
||||||
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${LIB_ETL_NAME}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIVE_ADD_JSON_LIB)
|
||||||
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${LIB_JSON_NAME}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${LIB_CXX_FS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add include paths for all sources.
|
||||||
|
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${FSFW_CONFIG_PATH}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${LIB_ARCSEC_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse")
|
||||||
|
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${ARCSEC_LIB_PATH}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
if(CMAKE_VERBOSE)
|
||||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Compile options for all sources.
|
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
|
||||||
${WARNING_FLAGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${CMAKE_CROSSCOMPILING})
|
if(${CMAKE_CROSSCOMPILING})
|
||||||
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
||||||
@@ -249,11 +350,15 @@ if(NOT CMAKE_SIZE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(EIVE_BUILD_WATCHDOG)
|
||||||
|
set(TARGET_STRING "OBSW Watchdog")
|
||||||
|
else()
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
||||||
else()
|
else()
|
||||||
set(TARGET_STRING "Target BSP: Hosted")
|
set(TARGET_STRING "Target BSP: Hosted")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
string(CONCAT POST_BUILD_COMMENT
|
string(CONCAT POST_BUILD_COMMENT
|
||||||
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||||
@@ -263,11 +368,12 @@ string(CONCAT POST_BUILD_COMMENT
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${TARGET_NAME}
|
TARGET ${OBSW_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
COMMAND ${CMAKE_SIZE} ${OBSW_BIN_NAME}${FILE_SUFFIX}
|
||||||
COMMENT ${POST_BUILD_COMMENT}
|
COMMENT ${POST_BUILD_COMMENT}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
||||||
set_build_type()
|
set_build_type()
|
||||||
|
|||||||
12
Justfile
Normal file
12
Justfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
python_script := './cmake/scripts/cmake-build-cfg.py'
|
||||||
|
|
||||||
|
default: q7s-debug-make
|
||||||
|
|
||||||
|
q7s-debug-make:
|
||||||
|
{{python_script}} -o linux -g make -b debug -t "arm/q7s" -l build-Debug-Q7S
|
||||||
|
|
||||||
|
q7s-release-make:
|
||||||
|
{{python_script}} -o linux -g make -b release -t "arm/q7s" -l build-Release-Q7S
|
||||||
|
|
||||||
|
q7s-debug-ninja:
|
||||||
|
{{python_script}} -o linux -g ninja -b debug -t "arm/q7s" -l build-Debug-Q7S
|
||||||
202
LICENSE
Normal file
202
LICENSE
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
13
NOTICE
Normal file
13
NOTICE
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Copyright 2021 Institute of Space Systems (IRS), University of Stuttgart
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
20
automation/Dockerfile
Normal file
20
automation/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
FROM ubuntu:focal
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get --yes upgrade
|
||||||
|
#tzdata is a dependency, won't install otherwise
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl git gcc g++ lcov valgrind libgps-dev
|
||||||
|
|
||||||
|
# Q7S root filesystem, required for cross-compilation.
|
||||||
|
RUN mkdir -p /usr/rootfs; \
|
||||||
|
curl https://buggy.irs.uni-stuttgart.de/eive/tools/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \
|
||||||
|
| tar -xz -C /usr/rootfs
|
||||||
|
|
||||||
|
# Cross compiler
|
||||||
|
RUN mkdir -p /usr/tools; \
|
||||||
|
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
|
||||||
|
| tar -xz -C /usr/tools
|
||||||
|
|
||||||
|
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
||||||
|
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
||||||
37
automation/Jenkinsfile
vendored
Normal file
37
automation/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
pipeline {
|
||||||
|
environment {
|
||||||
|
BUILDDIR_Q7 = 'build_q7'
|
||||||
|
BUILDDIR_LINUX = 'build_linux'
|
||||||
|
}
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'eive-obsw-ci:d2'
|
||||||
|
args '--sysctl fs.mqueue.msg_max=100'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Clean') {
|
||||||
|
steps {
|
||||||
|
sh 'rm -rf $BUILDDIR_Q7'
|
||||||
|
sh 'rm -rf $BUILDDIR_LINUX'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build Q7S') {
|
||||||
|
steps {
|
||||||
|
dir(BUILDDIR_Q7) {
|
||||||
|
sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug ..'
|
||||||
|
sh 'cmake --build . -j'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Unittests') {
|
||||||
|
steps {
|
||||||
|
dir(BUILDDIR_LINUX) {
|
||||||
|
sh 'cmake ..'
|
||||||
|
sh 'cmake --build . -t eive-unittest -j'
|
||||||
|
sh './eive-unittest'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
bsp_egse/CMakeLists.txt
Normal file
7
bsp_egse/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
|
InitMission.cpp
|
||||||
|
main.cpp
|
||||||
|
ObjectFactory.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(boardconfig)
|
||||||
192
bsp_egse/InitMission.cpp
Normal file
192
bsp_egse/InitMission.cpp
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
#include "InitMission.h"
|
||||||
|
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
|
ServiceInterfaceStream sif::error("ERROR");
|
||||||
|
|
||||||
|
ObjectManagerIF* objectManager = nullptr;
|
||||||
|
|
||||||
|
void initmission::initMission() {
|
||||||
|
sif::info << "Make sure the systemd service ser2net on the egse has been stopped "
|
||||||
|
<< "(alias stop-ser2net)" << std::endl;
|
||||||
|
sif::info << "Make sure the power lines of the star tracker have been enabled "
|
||||||
|
<< "(alias enable-startracker)" << std::endl;
|
||||||
|
sif::info << "Building global objects.." << std::endl;
|
||||||
|
/* Instantiate global object manager and also create all objects */
|
||||||
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
|
sif::info << "Initializing all objects.." << std::endl;
|
||||||
|
ObjectManager::instance()->initialize();
|
||||||
|
|
||||||
|
/* This function creates and starts all tasks */
|
||||||
|
initTasks();
|
||||||
|
}
|
||||||
|
|
||||||
|
void initmission::initTasks() {
|
||||||
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
if (factory == nullptr) {
|
||||||
|
/* Should never happen ! */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||||
|
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
||||||
|
#else
|
||||||
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* TMTC Distribution */
|
||||||
|
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
|
||||||
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
|
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
||||||
|
}
|
||||||
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PUS Services */
|
||||||
|
std::vector<PeriodicTaskIF*> pusTasks;
|
||||||
|
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||||
|
|
||||||
|
std::vector<PeriodicTaskIF*> pstTasks;
|
||||||
|
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
||||||
|
"STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
|
result = pst::pstUart(pst);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
|
}
|
||||||
|
pstTasks.push_back(pst);
|
||||||
|
|
||||||
|
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
||||||
|
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = strHelperTask->addComponent(objects::STR_HELPER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
||||||
|
}
|
||||||
|
pstTasks.push_back(strHelperTask);
|
||||||
|
|
||||||
|
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||||
|
for (const auto& task : taskVector) {
|
||||||
|
if (task != nullptr) {
|
||||||
|
task->startTask();
|
||||||
|
} else {
|
||||||
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
|
tmtcDistributor->startTask();
|
||||||
|
tmtcBridgeTask->startTask();
|
||||||
|
tmtcPollingTask->startTask();
|
||||||
|
|
||||||
|
taskStarter(pstTasks, "PST Tasks");
|
||||||
|
taskStarter(pusTasks, "PUS Tasks");
|
||||||
|
|
||||||
|
sif::info << "Tasks started.." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusVerification);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
|
}
|
||||||
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusEvents);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
|
}
|
||||||
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusHighPrio);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
|
}
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
|
}
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
|
}
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusMedPrio);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
|
}
|
||||||
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusLowPrio);
|
||||||
|
}
|
||||||
21
bsp_egse/InitMission.h
Normal file
21
bsp_egse/InitMission.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef BSP_LINUX_INITMISSION_H_
|
||||||
|
#define BSP_LINUX_INITMISSION_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
|
class PeriodicTaskIF;
|
||||||
|
class TaskFactory;
|
||||||
|
|
||||||
|
namespace initmission {
|
||||||
|
void initMission();
|
||||||
|
void initTasks();
|
||||||
|
|
||||||
|
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
|
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
|
}; // namespace initmission
|
||||||
|
|
||||||
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
49
bsp_egse/ObjectFactory.cpp
Normal file
49
bsp_egse/ObjectFactory.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
|
#include <devConf.h>
|
||||||
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
|
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||||
|
#include <mission/devices/GPSHyperionHandler.h>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "busConf.h"
|
||||||
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
|
#include "linux/devices/startracker/StarTrackerHandler.h"
|
||||||
|
#include "mission/core/GenericFactory.h"
|
||||||
|
#include "mission/utility/TmFunnel.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "tmtc/apid.h"
|
||||||
|
#include "tmtc/pusIds.h"
|
||||||
|
|
||||||
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
|
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
||||||
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
|
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
||||||
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::produce(void* args) {
|
||||||
|
Factory::setStaticFrameworkObjectIds();
|
||||||
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
|
UartCookie* starTrackerCookie =
|
||||||
|
new UartCookie(objects::STAR_TRACKER, egse::STAR_TRACKER_UART, UartModes::NON_CANONICAL,
|
||||||
|
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||||
|
new UartComIF(objects::UART_COM_IF);
|
||||||
|
starTrackerCookie->setNoFixedSizeReply();
|
||||||
|
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
||||||
|
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(
|
||||||
|
objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper);
|
||||||
|
starTrackerHandler->setStartUpImmediately();
|
||||||
|
}
|
||||||
8
bsp_egse/ObjectFactory.h
Normal file
8
bsp_egse/ObjectFactory.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
namespace ObjectFactory {
|
||||||
|
void produce(void* args);
|
||||||
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
7
bsp_egse/boardconfig/CMakeLists.txt
Normal file
7
bsp_egse/boardconfig/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
print.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
8
bsp_egse/boardconfig/busConf.h
Normal file
8
bsp_egse/boardconfig/busConf.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef BSP_EGSE_BOARDCONFIG_BUSCONF_H_
|
||||||
|
#define BSP_EGSE_BOARDCONFIG_BUSCONF_H_
|
||||||
|
|
||||||
|
namespace egse {
|
||||||
|
static constexpr char STAR_TRACKER_UART[] = "/dev/serial0";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */
|
||||||
38
bsp_egse/boardconfig/etl_profile.h
Normal file
38
bsp_egse/boardconfig/etl_profile.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
///\file
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
The MIT License(MIT)
|
||||||
|
|
||||||
|
Embedded Template Library.
|
||||||
|
https://github.com/ETLCPP/etl
|
||||||
|
https://www.etlcpp.com
|
||||||
|
|
||||||
|
Copyright(c) 2019 jwellbelove
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files(the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions :
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef __ETL_PROFILE_H__
|
||||||
|
#define __ETL_PROFILE_H__
|
||||||
|
|
||||||
|
#define ETL_CHECK_PUSH_POP
|
||||||
|
|
||||||
|
#define ETL_CPP11_SUPPORTED 1
|
||||||
|
#define ETL_NO_NULLPTR_SUPPORT 0
|
||||||
|
|
||||||
|
#endif
|
||||||
15
bsp_egse/boardconfig/gcov.h
Normal file
15
bsp_egse/boardconfig/gcov.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef LINUX_GCOV_H_
|
||||||
|
#define LINUX_GCOV_H_
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
|
#ifdef GCOV
|
||||||
|
extern "C" void __gcov_flush();
|
||||||
|
#else
|
||||||
|
void __gcov_flush() {
|
||||||
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LINUX_GCOV_H_ */
|
||||||
10
bsp_egse/boardconfig/print.c
Normal file
10
bsp_egse/boardconfig/print.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <bsp_egse/boardconfig/print.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void printChar(const char* character, bool errStream) {
|
||||||
|
if (errStream) {
|
||||||
|
putc(*character, stderr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
putc(*character, stdout);
|
||||||
|
}
|
||||||
8
bsp_egse/boardconfig/print.h
Normal file
8
bsp_egse/boardconfig/print.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef HOSTED_BOARDCONFIG_PRINT_H_
|
||||||
|
#define HOSTED_BOARDCONFIG_PRINT_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
void printChar(const char* character, bool errStream);
|
||||||
|
|
||||||
|
#endif /* HOSTED_BOARDCONFIG_PRINT_H_ */
|
||||||
6
bsp_egse/boardconfig/rpiConfig.h.in
Normal file
6
bsp_egse/boardconfig/rpiConfig.h.in
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
|
||||||
|
#define BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */
|
||||||
28
bsp_egse/main.cpp
Normal file
28
bsp_egse/main.cpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "InitMission.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "OBSWVersion.h"
|
||||||
|
#include "fsfw/FSFWVersion.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is the main program entry point for the egse (raspberry pi 4)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int main(void) {
|
||||||
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
|
std::cout << "-- Compiled for EGSE from Arcsec"
|
||||||
|
<< " --" << std::endl;
|
||||||
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
|
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION
|
||||||
|
<< "--" << std::endl;
|
||||||
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
|
initmission::initMission();
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
/* Suspend main thread by sleeping it. */
|
||||||
|
TaskFactory::delayTask(5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
@@ -6,5 +6,3 @@ target_sources(${TARGET_NAME} PUBLIC
|
|||||||
|
|
||||||
add_subdirectory(fsfwconfig)
|
add_subdirectory(fsfwconfig)
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#include <OBSWConfig.h>
|
#include <OBSWConfig.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
|
||||||
#include <mission/utility/InitMission.h>
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
@@ -55,8 +54,7 @@ void initmission::initTasks() {
|
|||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
ReturnValue_t result = tmTcDistributor->addComponent(
|
ReturnValue_t result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
@@ -70,15 +68,15 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UDP bridge */
|
/* UDP bridge */
|
||||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
sif::error << "Add component UDP Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
@@ -142,8 +140,8 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
tmTcDistributor->startTask();
|
tmTcDistributor->startTask();
|
||||||
udpBridgeTask->startTask();
|
tmtcBridgeTask->startTask();
|
||||||
udpPollingTask->startTask();
|
tmtcPollingTask->startTask();
|
||||||
|
|
||||||
pusVerification->startTask();
|
pusVerification->startTask();
|
||||||
pusEvents->startTask();
|
pusEvents->startTask();
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
namespace initmission {
|
namespace initmission {
|
||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include <OBSWConfig.h>
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
|
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||||
|
#include <mission/core/GenericFactory.h>
|
||||||
|
#include <mission/utility/TmFunnel.h>
|
||||||
#include <objects/systemObjectList.h>
|
#include <objects/systemObjectList.h>
|
||||||
#include <tmtc/apid.h>
|
#include <tmtc/apid.h>
|
||||||
#include <tmtc/pusIds.h>
|
#include <tmtc/pusIds.h>
|
||||||
|
|
||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
#include "OBSWConfig.h"
|
||||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
|
||||||
|
|
||||||
#include <mission/core/GenericFactory.h>
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||||
#include <mission/utility/TmFunnel.h>
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||||
#include <fsfw/osal/common/UdpTcPollingTask.h>
|
#else
|
||||||
#include <fsfw/osal/common/UdpTmTcBridge.h>
|
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
||||||
|
#include "fsfw/osal/common/TcpTmTcServer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||||
|
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
#include <test/testtasks/TestTask.h>
|
#include <test/testtasks/TestTask.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -28,7 +31,7 @@ void Factory::setStaticFrameworkObjectIds(){
|
|||||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
|
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
||||||
// No storage object for now.
|
// No storage object for now.
|
||||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
@@ -40,7 +43,5 @@ void ObjectFactory::produce(void* args){
|
|||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
new TestTask(objects::TEST_TASK);
|
||||||
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,3 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,25 @@
|
|||||||
#include "ArduinoComIF.h"
|
#include "ArduinoComIF.h"
|
||||||
#include "ArduinoCookie.h"
|
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/DleEncoder.h>
|
|
||||||
#include <fsfw/globalfunctions/CRC.h>
|
#include <fsfw/globalfunctions/CRC.h>
|
||||||
|
#include <fsfw/globalfunctions/DleEncoder.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
|
#include "ArduinoCookie.h"
|
||||||
|
|
||||||
// This only works on Linux
|
// This only works on Linux
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
#include <termios.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
#include <windows.h>
|
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF, const char *serialDevice)
|
||||||
const char *serialDevice):
|
: rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES * 10, true), SystemObject(setObjectId) {
|
||||||
rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true),
|
|
||||||
SystemObject(setObjectId) {
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
initialized = false;
|
initialized = false;
|
||||||
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
||||||
@@ -66,7 +65,6 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
|||||||
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
||||||
std::string comPort;
|
std::string comPort;
|
||||||
while (hCom == INVALID_HANDLE_VALUE) {
|
while (hCom == INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
std::getline(std::cin, comPort);
|
std::getline(std::cin, comPort);
|
||||||
if (comPort[0] == 'c') {
|
if (comPort[0] == 'c') {
|
||||||
break;
|
break;
|
||||||
@@ -80,37 +78,29 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
|||||||
0, // Non Overlapped I/O
|
0, // Non Overlapped I/O
|
||||||
NULL); // Null for Comm Devices
|
NULL); // Null for Comm Devices
|
||||||
|
|
||||||
if (hCom == INVALID_HANDLE_VALUE)
|
if (hCom == INVALID_HANDLE_VALUE) {
|
||||||
{
|
|
||||||
if (GetLastError() == 2) {
|
if (GetLastError() == 2) {
|
||||||
sif::error << "COM Port does not found!" << std::endl;
|
sif::error << "COM Port does not found!" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TCHAR err[128];
|
TCHAR err[128];
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
|
||||||
GetLastError(),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, sizeof(err), NULL);
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
err, sizeof(err), NULL);
|
|
||||||
// Handle the error.
|
// Handle the error.
|
||||||
sif::info << "CreateFileA Error code: " << GetLastError()
|
sif::info << "CreateFileA Error code: " << GetLastError() << std::endl;
|
||||||
<< std::endl;
|
|
||||||
sif::error << err << std::flush;
|
sif::error << err << std::flush;
|
||||||
}
|
}
|
||||||
sif::info << "Please enter a valid COM port: " << std::flush;
|
sif::info << "Please enter a valid COM port: " << std::flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
serialParams.DCBlength = sizeof(serialParams);
|
serialParams.DCBlength = sizeof(serialParams);
|
||||||
if (baudRate == 9600) {
|
if (baudRate == 9600) {
|
||||||
serialParams.BaudRate = CBR_9600;
|
serialParams.BaudRate = CBR_9600;
|
||||||
}
|
}
|
||||||
if (baudRate == 115200) {
|
if (baudRate == 115200) {
|
||||||
serialParams.BaudRate = CBR_115200;
|
serialParams.BaudRate = CBR_115200;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
serialParams.BaudRate = baudRate;
|
serialParams.BaudRate = baudRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,29 +133,22 @@ ReturnValue_t ArduinoComIF::initializeInterface(CookieIF * cookie) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data,
|
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) {
|
||||||
size_t len) {
|
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
||||||
if (arduinoCookie == nullptr) {
|
if (arduinoCookie == nullptr) {
|
||||||
return INVALID_COOKIE_TYPE;
|
return INVALID_COOKIE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
|
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
|
||||||
len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) {
|
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
||||||
|
|
||||||
|
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie,
|
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
||||||
size_t requestLen) {
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|
||||||
uint8_t **buffer, size_t *size) {
|
|
||||||
|
|
||||||
handleSerialPortRx();
|
handleSerialPortRx();
|
||||||
|
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
||||||
@@ -178,8 +161,8 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
|
||||||
uint8_t address, const uint8_t *data, size_t dataLen) {
|
size_t dataLen) {
|
||||||
if (dataLen > UINT16_MAX) {
|
if (dataLen > UINT16_MAX) {
|
||||||
return TOO_MUCH_DATA;
|
return TOO_MUCH_DATA;
|
||||||
}
|
}
|
||||||
@@ -193,16 +176,15 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
size_t remainingLen = sizeof(sendBuffer) - 1;
|
size_t remainingLen = sizeof(sendBuffer) - 1;
|
||||||
size_t encodedLen = 0;
|
size_t encodedLen = 0;
|
||||||
|
|
||||||
ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
|
ReturnValue_t result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
|
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen, &encodedLen, false);
|
||||||
&encodedLen, false);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -215,8 +197,8 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
temporaryBuffer[0] = dataLen >> 8; // we checked dataLen above
|
temporaryBuffer[0] = dataLen >> 8; // we checked dataLen above
|
||||||
temporaryBuffer[1] = dataLen;
|
temporaryBuffer[1] = dataLen;
|
||||||
|
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -224,8 +206,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
// encoding the actual data
|
// encoding the actual data
|
||||||
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
|
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
|
||||||
&encodedLen, false);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -241,8 +222,8 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
temporaryBuffer[0] = crc >> 8;
|
temporaryBuffer[0] = crc >> 8;
|
||||||
temporaryBuffer[1] = crc;
|
temporaryBuffer[1] = crc;
|
||||||
|
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -279,8 +260,7 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint8_t dataFromSerial[availableSpace];
|
uint8_t dataFromSerial[availableSpace];
|
||||||
|
|
||||||
ssize_t bytesRead = read(serialPort, dataFromSerial,
|
ssize_t bytesRead = read(serialPort, dataFromSerial, sizeof(dataFromSerial));
|
||||||
sizeof(dataFromSerial));
|
|
||||||
|
|
||||||
if (bytesRead < 0) {
|
if (bytesRead < 0) {
|
||||||
return;
|
return;
|
||||||
@@ -292,13 +272,12 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint32_t dataLenReceivedSoFar = 0;
|
uint32_t dataLenReceivedSoFar = 0;
|
||||||
|
|
||||||
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
|
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true, &dataLenReceivedSoFar);
|
||||||
&dataLenReceivedSoFar);
|
|
||||||
|
|
||||||
// look for STX
|
// look for STX
|
||||||
size_t firstSTXinRawData = 0;
|
size_t firstSTXinRawData = 0;
|
||||||
while ((firstSTXinRawData < dataLenReceivedSoFar)
|
while ((firstSTXinRawData < dataLenReceivedSoFar) &&
|
||||||
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
(dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
||||||
firstSTXinRawData++;
|
firstSTXinRawData++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,10 +292,9 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
size_t readSize = 0;
|
size_t readSize = 0;
|
||||||
|
|
||||||
ReturnValue_t result = DleEncoder::decode(
|
ReturnValue_t result = DleEncoder::decode(dataReceivedSoFar + firstSTXinRawData,
|
||||||
dataReceivedSoFar + firstSTXinRawData,
|
dataLenReceivedSoFar - firstSTXinRawData, &readSize,
|
||||||
dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
|
packet, sizeof(packet), &packetLen);
|
||||||
sizeof(packet), &packetLen);
|
|
||||||
|
|
||||||
size_t toDelete = firstSTXinRawData;
|
size_t toDelete = firstSTXinRawData;
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
@@ -333,9 +311,7 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoComIF::setBaudrate(uint32_t baudRate) {
|
void ArduinoComIF::setBaudrate(uint32_t baudRate) { this->baudRate = baudRate; }
|
||||||
this->baudRate = baudRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
||||||
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
||||||
@@ -368,8 +344,7 @@ void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
|||||||
}
|
}
|
||||||
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
||||||
cookie.receivedDataLen = packetLen - 6;
|
cookie.receivedDataLen = packetLen - 6;
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#include <fsfw/container/FixedMap.h>
|
#include <fsfw/container/FixedMap.h>
|
||||||
#include <fsfw/container/SimpleRingBuffer.h>
|
#include <fsfw/container/SimpleRingBuffer.h>
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -17,8 +17,7 @@
|
|||||||
// Forward declaration, so users don't peek
|
// Forward declaration, so users don't peek
|
||||||
class ArduinoCookie;
|
class ArduinoCookie;
|
||||||
|
|
||||||
class ArduinoComIF: public SystemObject,
|
class ArduinoComIF : public SystemObject, public DeviceCommunicationIF {
|
||||||
public DeviceCommunicationIF {
|
|
||||||
public:
|
public:
|
||||||
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
||||||
static const uint8_t MAX_PACKET_SIZE = 64;
|
static const uint8_t MAX_PACKET_SIZE = 64;
|
||||||
@@ -34,13 +33,12 @@ public:
|
|||||||
|
|
||||||
/** DeviceCommunicationIF overrides */
|
/** DeviceCommunicationIF overrides */
|
||||||
virtual ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
virtual ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
||||||
virtual ReturnValue_t sendMessage(CookieIF *cookie,
|
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
||||||
const uint8_t * sendData, size_t sendLen) override;
|
size_t sendLen) override;
|
||||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||||
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
|
||||||
size_t requestLen) override;
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
||||||
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie,
|
size_t *size) override;
|
||||||
uint8_t **buffer, size_t *size) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
@@ -59,8 +57,7 @@ private:
|
|||||||
|
|
||||||
SimpleRingBuffer rxBuffer;
|
SimpleRingBuffer rxBuffer;
|
||||||
|
|
||||||
ReturnValue_t sendMessage(uint8_t command, uint8_t address,
|
ReturnValue_t sendMessage(uint8_t command, uint8_t address, const uint8_t *data, size_t dataLen);
|
||||||
const uint8_t *data, size_t dataLen);
|
|
||||||
void handleSerialPortRx();
|
void handleSerialPortRx();
|
||||||
|
|
||||||
void handlePacket(uint8_t *packet, size_t packetLen);
|
void handlePacket(uint8_t *packet, size_t packetLen);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
||||||
|
|
||||||
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
|
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize)
|
||||||
const size_t maxReplySize) :
|
: protocol(protocol),
|
||||||
protocol(protocol), command(protocol), address(address),
|
command(protocol),
|
||||||
maxReplySize(maxReplySize), replyBuffer(maxReplySize) {
|
address(address),
|
||||||
}
|
maxReplySize(maxReplySize),
|
||||||
|
replyBuffer(maxReplySize) {}
|
||||||
|
|||||||
@@ -2,18 +2,14 @@
|
|||||||
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class ArduinoCookie : public CookieIF {
|
class ArduinoCookie : public CookieIF {
|
||||||
public:
|
public:
|
||||||
enum Protocol_t: uint8_t {
|
enum Protocol_t : uint8_t { INVALID, SPI, I2C };
|
||||||
INVALID,
|
|
||||||
SPI,
|
|
||||||
I2C
|
|
||||||
};
|
|
||||||
|
|
||||||
ArduinoCookie(Protocol_t protocol, uint8_t address,
|
ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize);
|
||||||
const size_t maxReplySize);
|
|
||||||
|
|
||||||
Protocol_t protocol;
|
Protocol_t protocol;
|
||||||
uint8_t command;
|
uint8_t command;
|
||||||
@@ -21,7 +17,6 @@ public:
|
|||||||
std::vector<uint8_t> replyBuffer;
|
std::vector<uint8_t> replyBuffer;
|
||||||
size_t receivedDataLen = 0;
|
size_t receivedDataLen = 0;
|
||||||
size_t maxReplySize;
|
size_t maxReplySize;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
ipc/MissionMessageTypes.cpp
|
ipc/MissionMessageTypes.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# If a special translation file for object IDs exists, compile it.
|
# If a special translation file for object IDs exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
objects/translateObjects.cpp
|
||||||
|
)
|
||||||
|
target_sources(${UNITTEST_NAME} PRIVATE
|
||||||
objects/translateObjects.cpp
|
objects/translateObjects.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If a special translation file for events exists, compile it.
|
# If a special translation file for events exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
events/translateEvents.cpp
|
||||||
|
)
|
||||||
|
target_sources(${UNITTEST_NAME} PRIVATE
|
||||||
events/translateEvents.cpp
|
events/translateEvents.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -14,6 +14,12 @@
|
|||||||
debugging. */
|
debugging. */
|
||||||
#define OBSW_VEBOSE_LEVEL 1
|
#define OBSW_VEBOSE_LEVEL 1
|
||||||
|
|
||||||
|
#define OBSW_USE_CCSDS_IP_CORE 0
|
||||||
|
// Set to 1 if all telemetry should be sent to the PTME IP Core
|
||||||
|
#define OBSW_TM_TO_PTME 0
|
||||||
|
// Set to 1 if telecommands are received via the PDEC IP Core
|
||||||
|
#define OBSW_TC_FROM_PDEC 0
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include "objects/systemObjectList.h"
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
|
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
|
||||||
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
|
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
|
||||||
|
|
||||||
#include <linux/gpio/GpioIF.h>
|
|
||||||
|
|
||||||
namespace gpioIds {
|
namespace gpioIds {
|
||||||
enum gpioId_t {
|
enum gpioId_t {
|
||||||
HEATER_0,
|
HEATER_0,
|
||||||
@@ -27,33 +25,33 @@ namespace gpioIds {
|
|||||||
TEST_ID_0,
|
TEST_ID_0,
|
||||||
TEST_ID_1,
|
TEST_ID_1,
|
||||||
|
|
||||||
RTD_IC3,
|
RTD_IC_3,
|
||||||
RTD_IC4,
|
RTD_IC_4,
|
||||||
RTD_IC5,
|
RTD_IC_5,
|
||||||
RTD_IC6,
|
RTD_IC_6,
|
||||||
RTD_IC7,
|
RTD_IC_7,
|
||||||
RTD_IC8,
|
RTD_IC_8,
|
||||||
RTD_IC9,
|
RTD_IC_9,
|
||||||
RTD_IC10,
|
RTD_IC_10,
|
||||||
RTD_IC11,
|
RTD_IC_11,
|
||||||
RTD_IC12,
|
RTD_IC_12,
|
||||||
RTD_IC13,
|
RTD_IC_13,
|
||||||
RTD_IC14,
|
RTD_IC_14,
|
||||||
RTD_IC15,
|
RTD_IC_15,
|
||||||
RTD_IC16,
|
RTD_IC_16,
|
||||||
RTD_IC17,
|
RTD_IC_17,
|
||||||
RTD_IC18,
|
RTD_IC_18,
|
||||||
|
|
||||||
SPI_MUX_BIT_1,
|
SPI_MUX_BIT_1,
|
||||||
SPI_MUX_BIT_2,
|
SPI_MUX_BIT_2,
|
||||||
SPI_MUX_BIT_3,
|
SPI_MUX_BIT_3,
|
||||||
SPI_MUX_BIT_4,
|
SPI_MUX_BIT_4,
|
||||||
SPI_MUX_BIT_5,
|
SPI_MUX_BIT_5,
|
||||||
SPI_MUX_BIT_6
|
SPI_MUX_BIT_6,
|
||||||
|
|
||||||
|
CS_RAD_SENSOR,
|
||||||
|
ENABLE_RADFET
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace pcduSwitches {
|
namespace pcduSwitches {
|
||||||
/* Switches are uint8_t datatype and go from 0 to 255 */
|
/* Switches are uint8_t datatype and go from 0 to 255 */
|
||||||
enum switcherList {
|
enum SwitcherList {
|
||||||
Q7S,
|
Q7S,
|
||||||
PAYLOAD_PCDU_CH1,
|
PAYLOAD_PCDU_CH1,
|
||||||
RW,
|
RW,
|
||||||
@@ -22,7 +22,7 @@ namespace pcduSwitches {
|
|||||||
SUS_NOMINAL,
|
SUS_NOMINAL,
|
||||||
SOLAR_CELL_EXP,
|
SOLAR_CELL_EXP,
|
||||||
PLOC,
|
PLOC,
|
||||||
ACS_BORAD_SIDE_A,
|
ACS_BOARD_SIDE_A,
|
||||||
NUMBER_OF_SWITCHES
|
NUMBER_OF_SWITCHES
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,7 +52,6 @@ namespace pcduSwitches {
|
|||||||
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
||||||
static const uint8_t INIT_STATE_PLOC = OFF;
|
static const uint8_t INIT_STATE_PLOC = OFF;
|
||||||
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
||||||
}
|
} // namespace pcduSwitches
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||||
|
|
||||||
#include <common/config/commonSubsystemIds.h>
|
#include <common/config/commonSubsystemIds.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,9 +10,7 @@
|
|||||||
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
||||||
*/
|
*/
|
||||||
namespace SUBSYSTEM_ID {
|
namespace SUBSYSTEM_ID {
|
||||||
enum: uint8_t {
|
enum : uint8_t { SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END };
|
||||||
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
|
|
||||||
|
|
||||||
INCLUDES += $(CURRENTPATH)
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MissionMessageTypes.h"
|
#include "MissionMessageTypes.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/CommandMessage.h>
|
#include <fsfw/ipc/CommandMessage.h>
|
||||||
|
|
||||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||||
@@ -7,5 +8,3 @@ void messagetypes::clearMissionMessage(CommandMessage* message) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ enum MESSAGE_TYPE {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void clearMissionMessage(CommandMessage* message);
|
void clearMissionMessage(CommandMessage* message);
|
||||||
}
|
} // namespace messagetypes
|
||||||
|
|
||||||
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <commonObjects.h>
|
#include <commonObjects.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
// The objects will be instantiated in the ID order
|
// The objects will be instantiated in the ID order
|
||||||
namespace objects {
|
namespace objects {
|
||||||
enum sourceObjects : uint32_t {
|
enum sourceObjects : uint32_t {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
|
|
||||||
#include "commonClassIds.h"
|
|
||||||
#include <fsfw/returnvalues/FwClassIds.h>
|
#include <fsfw/returnvalues/FwClassIds.h>
|
||||||
|
|
||||||
|
#include "commonClassIds.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source IDs starts at 73 for now
|
* Source IDs starts at 73 for now
|
||||||
* Framework IDs for ReturnValues run from 0 to 56
|
* Framework IDs for ReturnValues run from 0 to 56
|
||||||
@@ -15,5 +16,4 @@ enum {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
||||||
|
|||||||
@@ -15,5 +15,4 @@ namespace apid {
|
|||||||
static const uint16_t EIVE_OBSW = 0x65;
|
static const uint16_t EIVE_OBSW = 0x65;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "InitMission.h"
|
|
||||||
|
|
||||||
#include <OBSWVersion.h>
|
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "InitMission.h"
|
||||||
|
#include "OBSWVersion.h"
|
||||||
|
#include "fsfw/FSFWVersion.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static const char* COMPILE_PRINTOUT = "Windows";
|
static const char* COMPILE_PRINTOUT = "Windows";
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
@@ -16,12 +16,12 @@ static const char* COMPILE_PRINTOUT = "unknown OS";
|
|||||||
* Linux and Windows.
|
* Linux and Windows.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
||||||
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
<< SW_SUBVERSION << "." << SW_REVISION << " -- " << std::endl;
|
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "."
|
||||||
|
<< FSFW_REVISION << "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
@@ -31,5 +31,3 @@ int main(void)
|
|||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
#include <mission/utility/InitMission.h>
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
ServiceInterfaceStream sif::warning("WARNING");
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
@@ -36,6 +36,7 @@ void initmission::initMission() {
|
|||||||
|
|
||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
@@ -49,8 +50,7 @@ void initmission::initTasks() {
|
|||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
ReturnValue_t result = tmTcDistributor->addComponent(
|
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
@@ -64,35 +64,84 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UDP bridge */
|
/* UDP bridge */
|
||||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
|
std::vector<PeriodicTaskIF*> pusTasks;
|
||||||
|
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||||
|
|
||||||
|
std::vector<PeriodicTaskIF*> pstTasks;
|
||||||
|
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||||
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
|
std::vector<PeriodicTaskIF*> testTasks;
|
||||||
|
createTestTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||||
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
|
||||||
|
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||||
|
for (const auto& task : taskVector) {
|
||||||
|
if (task != nullptr) {
|
||||||
|
task->startTask();
|
||||||
|
} else {
|
||||||
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
|
tmTcDistributor->startTask();
|
||||||
|
tmtcBridgeTask->startTask();
|
||||||
|
tmtcPollingTask->startTask();
|
||||||
|
|
||||||
|
taskStarter(pusTasks, "PUS Tasks");
|
||||||
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
|
taskStarter(testTasks, "Test Tasks");
|
||||||
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
taskStarter(pstTasks, "PST Tasks");
|
||||||
|
|
||||||
|
#if OBSW_ADD_TEST_PST == 1
|
||||||
|
if (startTestPst) {
|
||||||
|
pstTestTask->startTask();
|
||||||
|
}
|
||||||
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
|
sif::info << "Tasks started.." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
taskVec.push_back(pusVerification);
|
||||||
|
|
||||||
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusEvents);
|
||||||
|
|
||||||
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@@ -102,8 +151,9 @@ void initmission::initTasks() {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
|
taskVec.push_back(pusHighPrio);
|
||||||
|
|
||||||
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@@ -121,8 +171,9 @@ void initmission::initTasks() {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
}
|
}
|
||||||
|
taskVec.push_back(pusMedPrio);
|
||||||
|
|
||||||
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@@ -130,28 +181,37 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("INT_ERR_RPRT",
|
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
|
||||||
objects::INTERNAL_ERROR_REPORTER);
|
}
|
||||||
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_PST == 1
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50,
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
result = pst::pstTest(pstTestTask);
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
|
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
||||||
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
|
}
|
||||||
|
taskVec.push_back(spiPst);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
|
||||||
|
|
||||||
PeriodicTaskIF* testTask = factory->createPeriodicTask(
|
void initmission::createTestTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
#if RPI_ADD_SPI_TEST == 1
|
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
@@ -163,30 +223,23 @@ void initmission::initTasks() {
|
|||||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||||
#if RPI_ADD_UART_TEST == 1
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::UART_TEST);
|
result = testTask->addComponent(objects::UART_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||||
|
taskVec.push_back(testTask);
|
||||||
|
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
bool startTestPst = true;
|
||||||
tmTcDistributor->startTask();
|
static_cast<void>(startTestPst);
|
||||||
udpBridgeTask->startTask();
|
|
||||||
udpPollingTask->startTask();
|
|
||||||
|
|
||||||
pusVerification->startTask();
|
|
||||||
pusEvents->startTask();
|
|
||||||
pusHighPrio->startTask();
|
|
||||||
pusMedPrio->startTask();
|
|
||||||
pusLowPrio->startTask();
|
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
|
||||||
testTask->startTask();
|
|
||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_PST == 1
|
#if OBSW_ADD_TEST_PST == 1
|
||||||
pstTestTask->startTask();
|
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
"TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
||||||
sif::info << "Tasks started.." << std::endl;
|
result = pst::pstTest(pstTestTask);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
||||||
|
startTestPst = false;
|
||||||
|
}
|
||||||
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,23 @@
|
|||||||
#ifndef BSP_LINUX_INITMISSION_H_
|
#ifndef BSP_LINUX_INITMISSION_H_
|
||||||
#define BSP_LINUX_INITMISSION_H_
|
#define BSP_LINUX_INITMISSION_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
|
class PeriodicTaskIF;
|
||||||
|
class TaskFactory;
|
||||||
|
|
||||||
namespace initmission {
|
namespace initmission {
|
||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
};
|
|
||||||
|
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
|
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
|
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
|||||||
@@ -1,42 +1,45 @@
|
|||||||
#include <fsfw/hal/linux/uart/UartComIF.h>
|
|
||||||
#include <fsfw/hal/linux/uart/UartCookie.h>
|
|
||||||
#include <mission/devices/GPSHyperionHandler.h>
|
|
||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include "OBSWConfig.h"
|
||||||
|
#include "devConf.h"
|
||||||
#include "devices/addresses.h"
|
#include "devices/addresses.h"
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "OBSWConfig.h"
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
#include "tmtc/apid.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "tmtc/pusIds.h"
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
#include "spiConf.h"
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
#include "linux/boardtest/LibgpiodTest.h"
|
#include "linux/boardtest/LibgpiodTest.h"
|
||||||
#include "linux/boardtest/SpiTestClass.h"
|
#include "linux/boardtest/SpiTestClass.h"
|
||||||
#include "linux/boardtest/UartTestClass.h"
|
#include "linux/boardtest/UartTestClass.h"
|
||||||
|
|
||||||
#include "mission/core/GenericFactory.h"
|
#include "mission/core/GenericFactory.h"
|
||||||
|
#include "mission/devices/GPSHyperionHandler.h"
|
||||||
|
#include "mission/devices/GyroADIS1650XHandler.h"
|
||||||
#include "mission/utility/TmFunnel.h"
|
#include "mission/utility/TmFunnel.h"
|
||||||
#include "mission/devices/MGMHandlerLIS3MDL.h"
|
#include "objects/systemObjectList.h"
|
||||||
#include "mission/devices/MGMHandlerRM3100.h"
|
#include "tmtc/apid.h"
|
||||||
#include "mission/devices/GyroADIS16507Handler.h"
|
#include "tmtc/pusIds.h"
|
||||||
|
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
/* UDP server includes */
|
/* UDP server includes */
|
||||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
||||||
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
||||||
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
||||||
|
#else
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h"
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h"
|
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||||
#include "fsfw/hal/linux/rpi/GpioRPi.h"
|
|
||||||
#include "fsfw/hal/common/gpio/GpioCookie.h"
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
#include "fsfw/hal/linux/spi/SpiCookie.h"
|
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
||||||
#include "fsfw/hal/linux/spi/SpiComIF.h"
|
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
@@ -45,7 +48,7 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
|
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
||||||
// No storage object for now.
|
// No storage object for now.
|
||||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
@@ -53,23 +56,132 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::produce(void* args) {
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
|
||||||
|
|
||||||
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
||||||
GpioCookie* gpioCookie = nullptr;
|
GpioCookie* gpioCookie = nullptr;
|
||||||
static_cast<void>(gpioCookie);
|
static_cast<void>(gpioCookie);
|
||||||
#if RPI_ADD_SPI_TEST == 1
|
|
||||||
|
new SpiComIF(objects::SPI_COM_IF, gpioIF);
|
||||||
|
|
||||||
|
std::string spiDev;
|
||||||
|
SpiCookie* spiCookie = nullptr;
|
||||||
|
static_cast<void>(spiCookie);
|
||||||
|
|
||||||
|
#if OBSW_ADD_ACS_BOARD == 1
|
||||||
|
if (gpioCookie == nullptr) {
|
||||||
|
gpioCookie = new GpioCookie();
|
||||||
|
}
|
||||||
|
// TODO: Missing pin for Gyro 2
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3",
|
||||||
|
gpio::Direction::OUT, 1);
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
||||||
|
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, "MGM_2_LIS3",
|
||||||
|
gpio::Direction::OUT, 1);
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
||||||
|
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
||||||
|
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G",
|
||||||
|
gpio::Direction::OUT, 1);
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
||||||
|
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
||||||
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, "GYRO_3_L3G",
|
||||||
|
gpio::Direction::OUT, 1);
|
||||||
|
gpioIF->addGpios(gpioCookie);
|
||||||
|
|
||||||
|
spiDev = "/dev/spidev0.1";
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
||||||
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
|
auto mgmLis3Handler =
|
||||||
|
new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||||
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
|
auto mgmRm3100Handler =
|
||||||
|
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
||||||
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
|
mgmLis3Handler =
|
||||||
|
new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
||||||
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
|
mgmRm3100Handler =
|
||||||
|
new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
|
auto adisHandler =
|
||||||
|
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
|
adisHandler->setStartUpImmediately();
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
|
auto gyroL3gHandler =
|
||||||
|
new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||||
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
||||||
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
|
adisHandler =
|
||||||
|
new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
|
adisHandler->setStartUpImmediately();
|
||||||
|
|
||||||
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
|
gyroL3gHandler =
|
||||||
|
new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||||
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
|
|
||||||
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
|
createTestTasks();
|
||||||
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::createTestTasks() {
|
||||||
|
new TestTask(objects::TEST_TASK);
|
||||||
|
|
||||||
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
new SpiTestClass(objects::SPI_TEST, gpioIF);
|
new SpiTestClass(objects::SPI_TEST, gpioIF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if RPI_ADD_UART_TEST == 1
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
new UartTestClass(objects::UART_TEST);
|
new UartTestClass(objects::UART_TEST);
|
||||||
#else
|
#else
|
||||||
new UartComIF(objects::UART_COM_IF);
|
new UartComIF(objects::UART_COM_IF);
|
||||||
@@ -89,53 +201,6 @@ void ObjectFactory::produce(void* args){
|
|||||||
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback);
|
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback);
|
||||||
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
|
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
|
||||||
|
|
||||||
new SpiComIF(objects::SPI_COM_IF, gpioIF);
|
|
||||||
|
|
||||||
std::string spiDev;
|
|
||||||
SpiCookie* spiCookie = nullptr;
|
|
||||||
static_cast<void>(spiCookie);
|
|
||||||
|
|
||||||
#if RPI_TEST_ACS_BOARD == 1
|
|
||||||
if(gpioCookie == nullptr) {
|
|
||||||
gpioCookie = new GpioCookie();
|
|
||||||
}
|
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
|
|
||||||
"MGM_0_LIS3", gpio::Direction::OUT, 1);
|
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
|
||||||
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
|
|
||||||
"MGM_2_LIS3", gpio::Direction::OUT, 1);
|
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
|
||||||
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
|
||||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
|
|
||||||
"GYRO_1_L3G", gpio::Direction::OUT, 1);
|
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN,
|
|
||||||
"GYRO_2_L3G", gpio::Direction::OUT, 1);
|
|
||||||
gpioIF->addGpios(gpioCookie);
|
|
||||||
|
|
||||||
spiDev = "/dev/spidev0.0";
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
|
||||||
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
|
|
||||||
objects::SPI_COM_IF, spiCookie);
|
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
|
||||||
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER,
|
|
||||||
objects::SPI_COM_IF, spiCookie);
|
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
|
||||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
|
||||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie);
|
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
|
||||||
|
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
|
||||||
|
|
||||||
#if RPI_TEST_ADIS16507 == 1
|
#if RPI_TEST_ADIS16507 == 1
|
||||||
if (gpioCookie == nullptr) {
|
if (gpioCookie == nullptr) {
|
||||||
gpioCookie = new GpioCookie();
|
gpioCookie = new GpioCookie();
|
||||||
@@ -144,22 +209,22 @@ void ObjectFactory::produce(void* args){
|
|||||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||||
gpioIF->addGpios(gpioCookie);
|
gpioIF->addGpios(gpioCookie);
|
||||||
|
|
||||||
spiDev = "/dev/spidev0.0";
|
spiDev = "/dev/spidev0.1";
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED,
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
||||||
nullptr, nullptr);
|
spi::DEFAULT_ADIS16507_SPEED, nullptr, nullptr);
|
||||||
auto adisGyroHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
auto adisGyroHandler =
|
||||||
|
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
adisGyroHandler->setStartUpImmediately();
|
adisGyroHandler->setStartUpImmediately();
|
||||||
#endif /* RPI_TEST_ADIS16507 == 1 */
|
#endif /* RPI_TEST_ADIS16507 == 1 */
|
||||||
|
|
||||||
#if RPI_TEST_GPS_HANDLER == 1
|
#if RPI_TEST_GPS_HANDLER == 1
|
||||||
UartCookie* uartCookie = new UartCookie(objects::GPS0_HANDLER, "/dev/serial0",
|
UartCookie* uartCookie =
|
||||||
UartModes::CANONICAL, 9600, 1024);
|
new UartCookie(objects::GPS0_HANDLER, "/dev/serial0", UartModes::CANONICAL, 9600, 1024);
|
||||||
uartCookie->setToFlushInput(true);
|
uartCookie->setToFlushInput(true);
|
||||||
uartCookie->setReadCycles(6);
|
uartCookie->setReadCycles(6);
|
||||||
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
|
GPSHyperionHandler* gpsHandler =
|
||||||
objects::UART_COM_IF, uartCookie);
|
new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookie, false);
|
||||||
gpsHandler->setStartUpImmediately();
|
gpsHandler->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
};
|
|
||||||
|
void createTestTasks();
|
||||||
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <bsp_q7s/boardconfig/print.h>
|
#include <bsp_linux_board/boardconfig/print.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void printChar(const char* character, bool errStream) {
|
void printChar(const char* character, bool errStream) {
|
||||||
@@ -8,7 +8,3 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,20 +15,18 @@
|
|||||||
#define RPI_TEST_ACS_BOARD 0
|
#define RPI_TEST_ACS_BOARD 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RPI_ADD_UART_TEST 1
|
#define RPI_ADD_UART_TEST 0
|
||||||
#if RPI_ADD_UART_TEST == 1
|
|
||||||
#define RPI_TEST_GPS_DEVICE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Adapt these values accordingly */
|
/* Adapt these values accordingly */
|
||||||
namespace gpio {
|
namespace gpio {
|
||||||
static constexpr uint8_t MGM_0_BCM_PIN = 0;
|
static constexpr uint8_t MGM_0_BCM_PIN = 17;
|
||||||
static constexpr uint8_t MGM_1_BCM_PIN = 1;
|
static constexpr uint8_t MGM_1_BCM_PIN = 27;
|
||||||
static constexpr uint8_t MGM_2_BCM_PIN = 17;
|
static constexpr uint8_t MGM_2_BCM_PIN = 22;
|
||||||
static constexpr uint8_t MGM_3_BCM_PIN = 27;
|
static constexpr uint8_t MGM_3_BCM_PIN = 23;
|
||||||
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
|
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
|
||||||
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
|
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
|
||||||
static constexpr uint8_t GYRO_2_BCM_PIN = 4;
|
static constexpr uint8_t GYRO_2_BCM_PIN = 13;
|
||||||
|
static constexpr uint8_t GYRO_3_BCM_PIN = 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */
|
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "InitMission.h"
|
#include <iostream>
|
||||||
#include "OBSWVersion.h"
|
|
||||||
|
|
||||||
|
#include "InitMission.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "OBSWVersion.h"
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#ifdef RASPBERRY_PI
|
#ifdef RASPBERRY_PI
|
||||||
static const char* const BOARD_NAME = "Raspberry Pi";
|
static const char* const BOARD_NAME = "Raspberry Pi";
|
||||||
#elif defined(BEAGLEBONEBLACK)
|
#elif defined(BEAGLEBONEBLACK)
|
||||||
@@ -18,13 +18,12 @@ static const char* const BOARD_NAME = "Unknown Board";
|
|||||||
* @brief This is the main program and entry point for the Raspberry Pi.
|
* @brief This is the main program and entry point for the Raspberry Pi.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
|
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION
|
||||||
FSFW_REVISION << "--" << std::endl;
|
<< "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
@@ -34,5 +33,3 @@ int main(void)
|
|||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,25 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
#simple mode
|
||||||
|
add_executable(${SIMPLE_OBSW_NAME} EXCLUDE_FROM_ALL)
|
||||||
|
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||||
|
target_sources(${SIMPLE_OBSW_NAME} PUBLIC
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
#I think this is unintentional? (produces linker errors for stuff in /linux)
|
||||||
|
target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC
|
||||||
|
${LIB_FSFW_NAME}
|
||||||
|
)
|
||||||
|
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||||
|
add_subdirectory(simple)
|
||||||
|
|
||||||
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(boardtest)
|
add_subdirectory(boardtest)
|
||||||
|
|
||||||
if(Q7S_SIMPLE_MODE)
|
|
||||||
add_subdirectory(simple)
|
|
||||||
else()
|
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
add_subdirectory(comIF)
|
add_subdirectory(comIF)
|
||||||
add_subdirectory(gpio)
|
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(memory)
|
add_subdirectory(memory)
|
||||||
add_subdirectory(spiCallbacks)
|
add_subdirectory(callbacks)
|
||||||
endif()
|
add_subdirectory(devices)
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
FROM ubuntu:latest
|
|
||||||
# FROM alpine:latest
|
|
||||||
|
|
||||||
ENV TZ=Europe/Berlin
|
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y curl cmake g++
|
|
||||||
|
|
||||||
# Q7S root filesystem, required for cross-compilation. Use IPv6 for curl
|
|
||||||
RUN mkdir -p /usr/rootfs; \
|
|
||||||
curl -6 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/dnfMy9kGpgynN6J/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \
|
|
||||||
| tar xvz -C /usr/rootfs
|
|
||||||
# Q7S C++ cross-compiler. Use IPv6 for curl
|
|
||||||
RUN mkdir -p /usr/tools; \
|
|
||||||
curl -6 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/RMsbHydJc6PSqcz/download/gcc-arm-linux-gnueabi.tar.gz \
|
|
||||||
| tar xvz -C /usr/tools
|
|
||||||
|
|
||||||
# RUN apk add cmake make g++
|
|
||||||
|
|
||||||
# Required for cmake build
|
|
||||||
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
|
||||||
ENV PATH=$PATH:"/usr/tools/gcc-arm-linux-gnueabi/bin"
|
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
rm -rf build-q7s; \
|
|
||||||
mkdir build-q7s; \
|
|
||||||
cd build-q7s; \
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux -DTGT_BSP="arm/q7s" ..;
|
|
||||||
|
|
||||||
ENTRYPOINT ["cmake", "--build", "build-q7s"]
|
|
||||||
CMD ["-j"]
|
|
||||||
# CMD ["bash"]
|
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
||||||
|
print.c
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|||||||
100
bsp_q7s/boardconfig/busConf.h
Normal file
100
bsp_q7s/boardconfig/busConf.h
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#ifndef BSP_Q7S_BOARDCONFIG_BUSCONF_H_
|
||||||
|
#define BSP_Q7S_BOARDCONFIG_BUSCONF_H_
|
||||||
|
|
||||||
|
namespace q7s {
|
||||||
|
|
||||||
|
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi-main";
|
||||||
|
static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
|
||||||
|
|
||||||
|
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
|
||||||
|
|
||||||
|
static constexpr char UART_GNSS_DEV[] = "/dev/ul-gps";
|
||||||
|
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc";
|
||||||
|
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
|
||||||
|
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";
|
||||||
|
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str";
|
||||||
|
|
||||||
|
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
||||||
|
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
||||||
|
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
||||||
|
static constexpr char UIO_PTME[] = "/dev/uio1";
|
||||||
|
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
||||||
|
|
||||||
|
namespace uiomapids {
|
||||||
|
static const int PTME_VC0 = 0;
|
||||||
|
static const int PTME_VC1 = 1;
|
||||||
|
static const int PTME_VC2 = 2;
|
||||||
|
static const int PTME_VC3 = 3;
|
||||||
|
static const int PTME_CONFIG = 4;
|
||||||
|
} // namespace uiomapids
|
||||||
|
|
||||||
|
namespace gpioNames {
|
||||||
|
|
||||||
|
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
|
||||||
|
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
|
||||||
|
static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select";
|
||||||
|
static constexpr char GYRO_3_L3G_CS[] = "gyro_3_l3g_chip_select";
|
||||||
|
static constexpr char MGM_0_CS[] = "mgm_0_lis3_chip_select";
|
||||||
|
static constexpr char MGM_1_CS[] = "mgm_1_rm3100_chip_select";
|
||||||
|
static constexpr char MGM_2_CS[] = "mgm_2_lis3_chip_select";
|
||||||
|
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
|
||||||
|
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
|
||||||
|
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
|
||||||
|
static constexpr char GNSS_0_ENABLE[] = "enable_gnss_0";
|
||||||
|
static constexpr char GNSS_1_ENABLE[] = "enable_gnss_1";
|
||||||
|
static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
|
||||||
|
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
|
||||||
|
static constexpr char GNSS_SELECT[] = "gnss_mux_select";
|
||||||
|
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
|
||||||
|
|
||||||
|
static constexpr char HEATER_0[] = "heater0";
|
||||||
|
static constexpr char HEATER_1[] = "heater1";
|
||||||
|
static constexpr char HEATER_2[] = "heater2";
|
||||||
|
static constexpr char HEATER_3[] = "heater3";
|
||||||
|
static constexpr char HEATER_4[] = "heater4";
|
||||||
|
static constexpr char HEATER_5[] = "heater5";
|
||||||
|
static constexpr char HEATER_6[] = "heater6";
|
||||||
|
static constexpr char HEATER_7[] = "heater7";
|
||||||
|
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
|
||||||
|
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
|
||||||
|
static constexpr char SPI_MUX_BIT_0_PIN[] = "spi_mux_bit_0";
|
||||||
|
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1";
|
||||||
|
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2";
|
||||||
|
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3";
|
||||||
|
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4";
|
||||||
|
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5";
|
||||||
|
static constexpr char EN_RW_CS[] = "en_rw_cs";
|
||||||
|
static constexpr char EN_RW_1[] = "enable_rw_1";
|
||||||
|
static constexpr char EN_RW_2[] = "enable_rw_2";
|
||||||
|
static constexpr char EN_RW_3[] = "enable_rw_3";
|
||||||
|
static constexpr char EN_RW_4[] = "enable_rw_4";
|
||||||
|
|
||||||
|
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
||||||
|
static constexpr char ENABLE_RADFET[] = "enable_radfet";
|
||||||
|
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
||||||
|
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
||||||
|
static constexpr char PAPB_BUSY_SIGNAL_VC1[] = "papb_busy_signal_vc1";
|
||||||
|
static constexpr char PAPB_EMPTY_SIGNAL_VC1[] = "papb_empty_signal_vc1";
|
||||||
|
static constexpr char PAPB_BUSY_SIGNAL_VC2[] = "papb_busy_signal_vc2";
|
||||||
|
static constexpr char PAPB_EMPTY_SIGNAL_VC2[] = "papb_empty_signal_vc2";
|
||||||
|
static constexpr char PAPB_BUSY_SIGNAL_VC3[] = "papb_busy_signal_vc3";
|
||||||
|
static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3";
|
||||||
|
static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872";
|
||||||
|
static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872";
|
||||||
|
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";
|
||||||
|
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
|
||||||
|
static constexpr char PDEC_RESET[] = "pdec_reset";
|
||||||
|
|
||||||
|
static constexpr char PL_PCDU_ENABLE_VBAT0[] = "enable_plpcdu_vbat0";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_VBAT1[] = "enable_plpcdu_vbat1";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_DRO[] = "enable_plpcdu_dro";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_X8[] = "enable_plpcdu_x8";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_TX[] = "enable_plpcdu_tx";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_HPA[] = "enable_plpcdu_hpa";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_MPA[] = "enable_plpcdu_mpa";
|
||||||
|
static constexpr char PL_PCDU_ADC_CS[] = "plpcdu_adc_chip_select";
|
||||||
|
|
||||||
|
} // namespace gpioNames
|
||||||
|
} // namespace q7s
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
||||||
@@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,3 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,16 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#cmakedefine01 Q7S_SIMPLE_MODE
|
/*******************************************************************/
|
||||||
|
/** All of the following flags should be enabled for mission code */
|
||||||
|
/*******************************************************************/
|
||||||
|
|
||||||
|
//! Timers can mess up the code when debugging
|
||||||
|
//! All of this should be enabled for mission code!
|
||||||
|
|
||||||
|
/*******************************************************************/
|
||||||
|
/** Other flags */
|
||||||
|
/*******************************************************************/
|
||||||
|
|
||||||
#define Q7S_SD_NONE 0
|
#define Q7S_SD_NONE 0
|
||||||
#define Q7S_SD_COLD_REDUNDANT 1
|
#define Q7S_SD_COLD_REDUNDANT 1
|
||||||
@@ -15,16 +24,8 @@
|
|||||||
// Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them
|
// Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them
|
||||||
#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT
|
#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT
|
||||||
|
|
||||||
#define Q7S_ADD_RTD_DEVICES 0
|
// Probably better if this is disabled for mission code. Convenient for development
|
||||||
|
#define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1
|
||||||
/* Only one of those 2 should be enabled! */
|
|
||||||
/* Add code for ACS board */
|
|
||||||
#define OBSW_ADD_ACS_BOARD 0
|
|
||||||
#if OBSW_ADD_ACS_BOARD == 0
|
|
||||||
#define Q7S_ADD_SPI_TEST 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Q7S_ADD_SYRLINKS_HANDLER 1
|
|
||||||
|
|
||||||
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
|
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
FileSystemTest.cpp
|
FileSystemTest.cpp
|
||||||
Q7STestTask.cpp
|
Q7STestTask.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(EIVE_BUILD_Q7S_SIMPLE_MODE)
|
||||||
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
||||||
|
FileSystemTest.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
#include "FileSystemTest.h"
|
#include "FileSystemTest.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
|
|
||||||
#include <iostream>
|
enum SdCard { SDC0, SDC1 };
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
FileSystemTest::FileSystemTest() {
|
FileSystemTest::FileSystemTest() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -17,5 +20,4 @@ FileSystemTest::FileSystemTest() {
|
|||||||
// stopwatch.stop(true);
|
// stopwatch.stop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemTest::~FileSystemTest() {
|
FileSystemTest::~FileSystemTest() {}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
#ifndef BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
#ifndef BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
||||||
#define BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
#define BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
||||||
|
|
||||||
enum SdCard {
|
|
||||||
SDC0,
|
|
||||||
SDC1
|
|
||||||
};
|
|
||||||
|
|
||||||
class FileSystemTest {
|
class FileSystemTest {
|
||||||
public:
|
public:
|
||||||
FileSystemTest();
|
FileSystemTest();
|
||||||
virtual ~FileSystemTest();
|
virtual ~FileSystemTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
||||||
|
|||||||
@@ -1,34 +1,52 @@
|
|||||||
|
#include "Q7STestTask.h"
|
||||||
|
|
||||||
|
#include <bsp_q7s/core/CoreController.h>
|
||||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include "Q7STestTask.h"
|
#include <gps.h>
|
||||||
|
#include <libgpsmm.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ctime>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "bsp_q7s/memory/scratchApi.h"
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
#include "test/DummyParameter.h"
|
#include "test/DummyParameter.h"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
||||||
|
doTestSdCard = false;
|
||||||
|
doTestScratchApi = false;
|
||||||
|
doTestGps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Q7STestTask::performOneShotAction() {
|
ReturnValue_t Q7STestTask::performOneShotAction() {
|
||||||
//testSdCard();
|
if (doTestSdCard) {
|
||||||
//testScratchApi();
|
testSdCard();
|
||||||
|
}
|
||||||
|
if (doTestScratchApi) {
|
||||||
|
testScratchApi();
|
||||||
|
}
|
||||||
// testJsonLibDirect();
|
// testJsonLibDirect();
|
||||||
// testDummyParams();
|
// testDummyParams();
|
||||||
FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
|
// testProtHandler();
|
||||||
|
FsOpCodes opCode = FsOpCodes::APPEND_TO_FILE;
|
||||||
testFileSystemHandlerDirect(opCode);
|
testFileSystemHandlerDirect(opCode);
|
||||||
return TestTask::performOneShotAction();
|
return TestTask::performOneShotAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Q7STestTask::performPeriodicAction() {
|
||||||
|
if (doTestGps) {
|
||||||
|
testGpsDaemon();
|
||||||
|
}
|
||||||
|
return TestTask::performPeriodicAction();
|
||||||
|
}
|
||||||
|
|
||||||
void Q7STestTask::testSdCard() {
|
void Q7STestTask::testSdCard() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
Stopwatch stopwatch;
|
Stopwatch stopwatch;
|
||||||
@@ -45,8 +63,7 @@ void Q7STestTask::testSdCard() {
|
|||||||
while (iss >> word) {
|
while (iss >> word) {
|
||||||
if (word == "on") {
|
if (word == "on") {
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
||||||
}
|
} else if (word == "off") {
|
||||||
else if(word == "off") {
|
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,7 +133,6 @@ void Q7STestTask::testDummyParams() {
|
|||||||
|
|
||||||
ReturnValue_t result = param.readJsonFile();
|
ReturnValue_t result = param.readJsonFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
||||||
@@ -125,15 +141,120 @@ void Q7STestTask::testDummyParams() {
|
|||||||
param.writeJsonFile();
|
param.writeJsonFile();
|
||||||
param.print();
|
param.print();
|
||||||
|
|
||||||
int test = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1);
|
int test = 0;
|
||||||
std::string test2 = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2);
|
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
|
<< " does not exist" << std::endl;
|
||||||
|
}
|
||||||
|
std::string test2;
|
||||||
|
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
|
<< " does not exist" << std::endl;
|
||||||
|
}
|
||||||
sif::info << "Test value (3 expected): " << test << std::endl;
|
sif::info << "Test value (3 expected): " << test << std::endl;
|
||||||
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Q7STestTask::initialize() {
|
||||||
|
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
|
if (coreController == nullptr) {
|
||||||
|
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
return TestTask::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Q7STestTask::testProtHandler() {
|
||||||
|
bool opPerformed = false;
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
// If any chips are unlocked, lock them here
|
||||||
|
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
||||||
|
opPerformed, true);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unlock own copy
|
||||||
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
||||||
|
opPerformed, true);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
|
}
|
||||||
|
if (not opPerformed) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
|
}
|
||||||
|
int retval = std::system("print-chip-prot-status.sh");
|
||||||
|
if (retval != 0) {
|
||||||
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
|
}
|
||||||
|
|
||||||
|
// lock own copy
|
||||||
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
|
opPerformed, true);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
|
}
|
||||||
|
if (not opPerformed) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
|
}
|
||||||
|
retval = std::system("print-chip-prot-status.sh");
|
||||||
|
if (retval != 0) {
|
||||||
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
|
}
|
||||||
|
|
||||||
|
// unlock specific copy
|
||||||
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
||||||
|
opPerformed, true);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
|
}
|
||||||
|
if (not opPerformed) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
|
}
|
||||||
|
retval = std::system("print-chip-prot-status.sh");
|
||||||
|
if (retval != 0) {
|
||||||
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
|
}
|
||||||
|
|
||||||
|
// lock specific copy
|
||||||
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
||||||
|
opPerformed, true);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
|
}
|
||||||
|
if (not opPerformed) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
|
}
|
||||||
|
retval = std::system("print-chip-prot-status.sh");
|
||||||
|
if (retval != 0) {
|
||||||
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Q7STestTask::testGpsDaemon() {
|
||||||
|
gpsmm gpsmm(GPSD_SHARED_MEMORY, 0);
|
||||||
|
gps_data_t* gps;
|
||||||
|
gps = gpsmm.read();
|
||||||
|
if (gps == nullptr) {
|
||||||
|
sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl;
|
||||||
|
}
|
||||||
|
sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl;
|
||||||
|
time_t timeRaw = gps->fix.time.tv_sec;
|
||||||
|
std::tm* time = gmtime(&timeRaw);
|
||||||
|
sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl;
|
||||||
|
sif::info << "Visible satellites: " << gps->satellites_visible << std::endl;
|
||||||
|
sif::info << "Satellites used: " << gps->satellites_used << std::endl;
|
||||||
|
sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl;
|
||||||
|
sif::info << "Latitude: " << gps->fix.latitude << std::endl;
|
||||||
|
sif::info << "Longitude: " << gps->fix.longitude << std::endl;
|
||||||
|
sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
|
||||||
|
sif::info << "Speed(m/s): " << gps->fix.speed << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
||||||
auto fsHandler = ObjectManager::instance()->
|
auto fsHandler = ObjectManager::instance()->get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
||||||
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
|
||||||
if (fsHandler == nullptr) {
|
if (fsHandler == nullptr) {
|
||||||
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@@ -144,7 +265,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
// Lambda for common code
|
// Lambda for common code
|
||||||
auto createNonEmptyTmpDir = [&]() {
|
auto createNonEmptyTmpDir = [&]() {
|
||||||
if (not std::filesystem::exists("/tmp/test")) {
|
if (not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp/test", &cfg);
|
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -162,14 +283,13 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
switch (opCode) {
|
switch (opCode) {
|
||||||
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
fsHandler->createFile("/tmp", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (FsOpCodes::REMOVE_TMP_FILE): {
|
case (FsOpCodes::REMOVE_TMP_FILE): {
|
||||||
@@ -179,13 +299,12 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
if (not std::filesystem::exists("/tmp/test.txt")) {
|
if (not std::filesystem::exists("/tmp/test.txt")) {
|
||||||
// Creating sample file
|
// Creating sample file
|
||||||
sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl;
|
sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl;
|
||||||
fsHandler->createFile("/tmp", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
}
|
}
|
||||||
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "File removed successfully" << std::endl;
|
sif::info << "File removed successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "File removal failed!" << std::endl;
|
sif::warning << "File removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -195,11 +314,10 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
ReturnValue_t result = fsHandler->createDirectory("/tmp/test", &cfg);
|
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory created successfully" << std::endl;
|
sif::info << "Directory created successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory creation failed!" << std::endl;
|
sif::warning << "Directory creation failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -208,17 +326,15 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
if (not std::filesystem::exists("/tmp/test")) {
|
if (not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp/test", &cfg);
|
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Delete any leftover files to regular dir removal works
|
// Delete any leftover files to regular dir removal works
|
||||||
std::remove("/tmp/test/*");
|
std::remove("/tmp/test/*");
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed successfully" << std::endl;
|
sif::info << "Directory removed successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory removal failed!" << std::endl;
|
sif::warning << "Directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -228,11 +344,10 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/test", true, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed recursively successfully" << std::endl;
|
sif::info << "Directory removed recursively successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Recursive directory removal failed!" << std::endl;
|
sif::warning << "Recursive directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -242,13 +357,41 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (FsOpCodes::RENAME_FILE): {
|
||||||
|
// No mount prefix, cause file is created in tmp
|
||||||
|
cfg.useMountPrefix = false;
|
||||||
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
|
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
|
}
|
||||||
|
sif::info << "Creating empty file /tmp/test.txt and rename to /tmp/test2.txt" << std::endl;
|
||||||
|
// Do not delete file, user can check existence in shell
|
||||||
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
|
fsHandler->renameFile("/tmp/", "test.txt", "test2.txt", &cfg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (FsOpCodes::APPEND_TO_FILE): {
|
||||||
|
// No mount prefix, cause file is created in tmp
|
||||||
|
cfg.useMountPrefix = false;
|
||||||
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
|
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
|
}
|
||||||
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
|
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
|
}
|
||||||
|
sif::info << "Creating empty file /tmp/test.txt and adding content" << std::endl;
|
||||||
|
std::string content = "Hello World\n";
|
||||||
|
// Do not delete file, user can check existence in shell
|
||||||
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
|
fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast<const uint8_t*>(content.data()),
|
||||||
|
content.size(), 0, &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,24 @@
|
|||||||
|
|
||||||
#include "test/testtasks/TestTask.h"
|
#include "test/testtasks/TestTask.h"
|
||||||
|
|
||||||
|
class CoreController;
|
||||||
|
|
||||||
class Q7STestTask : public TestTask {
|
class Q7STestTask : public TestTask {
|
||||||
public:
|
public:
|
||||||
Q7STestTask(object_id_t objectId);
|
Q7STestTask(object_id_t objectId);
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool doTestSdCard = false;
|
||||||
|
bool doTestScratchApi = false;
|
||||||
|
bool doTestGps = false;
|
||||||
|
|
||||||
|
CoreController* coreController = nullptr;
|
||||||
ReturnValue_t performOneShotAction() override;
|
ReturnValue_t performOneShotAction() override;
|
||||||
|
ReturnValue_t performPeriodicAction() override;
|
||||||
|
|
||||||
|
void testGpsDaemon();
|
||||||
|
|
||||||
void testSdCard();
|
void testSdCard();
|
||||||
void fileTests();
|
void fileTests();
|
||||||
@@ -15,6 +28,7 @@ private:
|
|||||||
void testScratchApi();
|
void testScratchApi();
|
||||||
void testJsonLibDirect();
|
void testJsonLibDirect();
|
||||||
void testDummyParams();
|
void testDummyParams();
|
||||||
|
void testProtHandler();
|
||||||
|
|
||||||
enum FsOpCodes {
|
enum FsOpCodes {
|
||||||
CREATE_EMPTY_FILE_IN_TMP,
|
CREATE_EMPTY_FILE_IN_TMP,
|
||||||
@@ -23,9 +37,10 @@ private:
|
|||||||
REMOVE_EMPTY_DIR_IN_TMP,
|
REMOVE_EMPTY_DIR_IN_TMP,
|
||||||
ATTEMPT_DIR_REMOVAL_NON_EMPTY,
|
ATTEMPT_DIR_REMOVAL_NON_EMPTY,
|
||||||
REMOVE_FILLED_DIR_IN_TMP,
|
REMOVE_FILLED_DIR_IN_TMP,
|
||||||
|
RENAME_FILE,
|
||||||
|
APPEND_TO_FILE,
|
||||||
};
|
};
|
||||||
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
||||||
|
|||||||
6
bsp_q7s/callbacks/CMakeLists.txt
Normal file
6
bsp_q7s/callbacks/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
rwSpiCallback.cpp
|
||||||
|
gnssCallback.cpp
|
||||||
|
pcduSwitchCb.cpp
|
||||||
|
gpioCallbacks.cpp
|
||||||
|
)
|
||||||
25
bsp_q7s/callbacks/gnssCallback.cpp
Normal file
25
bsp_q7s/callbacks/gnssCallback.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include "gnssCallback.h"
|
||||||
|
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
|
ReturnValue_t gps::triggerGpioResetPin(void* args) {
|
||||||
|
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
|
||||||
|
if (args == nullptr) {
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
if (resetArgs->gpioComIF == nullptr) {
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
gpioId_t gpioId;
|
||||||
|
if (resetArgs->gnss1) {
|
||||||
|
gpioId = gpioIds::GNSS_1_NRESET;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
gpioId = gpioIds::GNSS_0_NRESET;
|
||||||
|
}
|
||||||
|
resetArgs->gpioComIF->pullLow(gpioId);
|
||||||
|
TaskFactory::delayTask(resetArgs->waitPeriodMs);
|
||||||
|
resetArgs->gpioComIF->pullHigh(gpioId);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
19
bsp_q7s/callbacks/gnssCallback.h
Normal file
19
bsp_q7s/callbacks/gnssCallback.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
|
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
|
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
|
||||||
|
struct ResetArgs {
|
||||||
|
bool gnss1 = false;
|
||||||
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
|
uint32_t waitPeriodMs = 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace gps {
|
||||||
|
|
||||||
|
ReturnValue_t triggerGpioResetPin(void* args);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_ */
|
||||||
487
bsp_q7s/callbacks/gpioCallbacks.cpp
Normal file
487
bsp_q7s/callbacks/gpioCallbacks.cpp
Normal file
@@ -0,0 +1,487 @@
|
|||||||
|
#include "gpioCallbacks.h"
|
||||||
|
|
||||||
|
#include <devices/gpioIds.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
|
#include "busConf.h"
|
||||||
|
|
||||||
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
|
GpioIF* gpioComInterface;
|
||||||
|
|
||||||
|
void initSpiCsDecoder(GpioIF* gpioComIF) {
|
||||||
|
using namespace gpio;
|
||||||
|
ReturnValue_t result;
|
||||||
|
|
||||||
|
if (gpioComIF == nullptr) {
|
||||||
|
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpioComInterface = gpioComIF;
|
||||||
|
|
||||||
|
GpioCookie* spiMuxGpios = new GpioCookie;
|
||||||
|
|
||||||
|
GpiodRegularByLineName* spiMuxBit = nullptr;
|
||||||
|
/** Setting mux bit 1 to low will disable IC21 on the interface board */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
|
||||||
|
Direction::OUT, Levels::HIGH);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit);
|
||||||
|
/** Setting mux bit 2 to low disables IC1 on the TCS board */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2",
|
||||||
|
Direction::OUT, Levels::HIGH);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
||||||
|
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
||||||
|
|
||||||
|
/** The following gpios can take arbitrary initial values */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
|
||||||
|
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(
|
||||||
|
q7s::gpioNames::EN_RW_CS, "EN_RW_CS", Direction::OUT, Levels::HIGH);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
||||||
|
|
||||||
|
result = gpioComInterface->addGpios(spiMuxGpios);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
||||||
|
void* args) {
|
||||||
|
using namespace gpio;
|
||||||
|
if (gpioComInterface == nullptr) {
|
||||||
|
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
||||||
|
<< "to specify gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reading is not supported by the callback function */
|
||||||
|
if (gpioOp == gpio::GpioOperation::READ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == Levels::HIGH) {
|
||||||
|
switch (gpioId) {
|
||||||
|
case (gpioIds::RTD_IC_3): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_4): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_5): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_6): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_7): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_8): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_9): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_10): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_11): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_12): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_13): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_14): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_15): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_16): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_17): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_18): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_0): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_1): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_2): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_3): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_4): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_5): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_6): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_7): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_8): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_9): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_10): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_11): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW1): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW2): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW3): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW4): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
|
}
|
||||||
|
} else if (value == Levels::LOW) {
|
||||||
|
switch (gpioId) {
|
||||||
|
case (gpioIds::RTD_IC_3): {
|
||||||
|
selectY7();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_4): {
|
||||||
|
selectY6();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_5): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_6): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_7): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_8): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_9): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_10): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_11): {
|
||||||
|
selectY7();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_12): {
|
||||||
|
selectY6();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_13): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_14): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_15): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_16): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_17): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_18): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_0): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_1): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_2): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_3): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_4): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_5): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_6): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_7): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_8): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_9): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_10): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_11): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW1): {
|
||||||
|
selectY0();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW2): {
|
||||||
|
selectY1();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW3): {
|
||||||
|
selectY2();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW4): {
|
||||||
|
selectY3();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderTcsIc1() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderTcsIc2() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderInterfaceBoardIc1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderInterfaceBoardIc2() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderTcsIc1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderTcsIc2() {
|
||||||
|
// DO NOT CHANGE THE ORDER HERE
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderInterfaceBoardIc1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderInterfaceBoardIc2() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
|
||||||
|
|
||||||
|
void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); }
|
||||||
|
|
||||||
|
void selectY0() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY2() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY3() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY4() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY5() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY6() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY7() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableAllDecoder() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace gpioCallbacks
|
||||||
73
bsp_q7s/callbacks/gpioCallbacks.h
Normal file
73
bsp_q7s/callbacks/gpioCallbacks.h
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
|
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
|
|
||||||
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||||
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||||
|
|
||||||
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
|
||||||
|
* the TCS Board and the interface board.
|
||||||
|
*/
|
||||||
|
void initSpiCsDecoder(GpioIF* gpioComIF);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function implements the decoding to multiply gpios by using the decoder
|
||||||
|
* chips SN74LVC138APWR on the TCS board and the interface board.
|
||||||
|
*/
|
||||||
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
||||||
|
void* args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the TCS board which is named to IC1 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderTcsIc1();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the TCS board which is named to IC2 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderTcsIc2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the inteface board board which is named to IC21 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderInterfaceBoardIc1();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the inteface board board which is named to IC22 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderInterfaceBoardIc2();
|
||||||
|
|
||||||
|
void disableDecoderTcsIc1();
|
||||||
|
void disableDecoderTcsIc2();
|
||||||
|
void disableDecoderInterfaceBoardIc1();
|
||||||
|
void disableDecoderInterfaceBoardIc2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the reaction wheel chip select decoder (IC3).
|
||||||
|
*/
|
||||||
|
void enableRwDecoder();
|
||||||
|
void disableRwDecoder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function disables all decoder.
|
||||||
|
*/
|
||||||
|
void disableAllDecoder();
|
||||||
|
|
||||||
|
/** The following functions enable the appropriate channel of the currently enabled decoder */
|
||||||
|
void selectY0();
|
||||||
|
void selectY1();
|
||||||
|
void selectY2();
|
||||||
|
void selectY3();
|
||||||
|
void selectY4();
|
||||||
|
void selectY5();
|
||||||
|
void selectY6();
|
||||||
|
void selectY7();
|
||||||
|
} // namespace gpioCallbacks
|
||||||
|
|
||||||
|
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
|
||||||
32
bsp_q7s/callbacks/pcduSwitchCb.cpp
Normal file
32
bsp_q7s/callbacks/pcduSwitchCb.cpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#include "pcduSwitchCb.h"
|
||||||
|
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
|
|
||||||
|
void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args) {
|
||||||
|
LinuxLibgpioIF* gpioComIF = reinterpret_cast<LinuxLibgpioIF*>(args);
|
||||||
|
if (gpioComIF == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pdu == GOMSPACE::Pdu::PDU1) {
|
||||||
|
PDU1::SwitchChannels typedChannel = static_cast<PDU1::SwitchChannels>(channel);
|
||||||
|
if (typedChannel == PDU1::SwitchChannels::ACS_A_SIDE) {
|
||||||
|
if (state) {
|
||||||
|
gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET);
|
||||||
|
} else {
|
||||||
|
gpioComIF->pullLow(gpioIds::GNSS_0_NRESET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (pdu == GOMSPACE::Pdu::PDU2) {
|
||||||
|
PDU2::SwitchChannels typedChannel = static_cast<PDU2::SwitchChannels>(channel);
|
||||||
|
if (typedChannel == PDU2::SwitchChannels::ACS_B_SIDE) {
|
||||||
|
if (state) {
|
||||||
|
gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET);
|
||||||
|
} else {
|
||||||
|
gpioComIF->pullLow(gpioIds::GNSS_1_NRESET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
bsp_q7s/callbacks/pcduSwitchCb.h
Normal file
14
bsp_q7s/callbacks/pcduSwitchCb.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
|
||||||
|
#define BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||||
|
|
||||||
|
namespace pcdu {
|
||||||
|
|
||||||
|
void switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_ */
|
||||||
232
bsp_q7s/callbacks/rwSpiCallback.cpp
Normal file
232
bsp_q7s/callbacks/rwSpiCallback.cpp
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
#include "rwSpiCallback.h"
|
||||||
|
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
#include "mission/devices/RwHandler.h"
|
||||||
|
|
||||||
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
|
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
||||||
|
size_t sendLen, void* args) {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
|
||||||
|
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
||||||
|
if (handler == nullptr) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t writeBuffer[2];
|
||||||
|
uint8_t writeSize = 0;
|
||||||
|
|
||||||
|
gpioId_t gpioId = cookie->getChipSelectPin();
|
||||||
|
GpioIF* gpioIF = comIf->getGpioInterface();
|
||||||
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||||
|
uint32_t timeoutMs = 0;
|
||||||
|
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs);
|
||||||
|
if (mutex == nullptr or gpioIF == nullptr) {
|
||||||
|
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fileDescriptor = 0;
|
||||||
|
std::string device = cookie->getSpiDevice();
|
||||||
|
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
|
||||||
|
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
|
||||||
|
return SpiComIF::OPENING_FILE_FAILED;
|
||||||
|
}
|
||||||
|
spi::SpiModes spiMode = spi::SpiModes::MODE_0;
|
||||||
|
uint32_t spiSpeed = 0;
|
||||||
|
cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
|
||||||
|
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
||||||
|
|
||||||
|
result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sending frame start sign */
|
||||||
|
writeBuffer[0] = 0x7E;
|
||||||
|
writeSize = 1;
|
||||||
|
|
||||||
|
// Pull SPI CS low. For now, no support for active high given
|
||||||
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
|
if (gpioIF->pullLow(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
return RwHandler::SPI_WRITE_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Encoding and sending command */
|
||||||
|
size_t idx = 0;
|
||||||
|
while (idx < sendLen) {
|
||||||
|
switch (*(sendData + idx)) {
|
||||||
|
case 0x7E:
|
||||||
|
writeBuffer[0] = 0x7D;
|
||||||
|
writeBuffer[1] = 0x5E;
|
||||||
|
writeSize = 2;
|
||||||
|
break;
|
||||||
|
case 0x7D:
|
||||||
|
writeBuffer[0] = 0x7D;
|
||||||
|
writeBuffer[1] = 0x5D;
|
||||||
|
writeSize = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
writeBuffer[0] = *(sendData + idx);
|
||||||
|
writeSize = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
return RwHandler::SPI_WRITE_FAILURE;
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sending frame end sign */
|
||||||
|
writeBuffer[0] = 0x7E;
|
||||||
|
writeSize = 1;
|
||||||
|
|
||||||
|
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
return RwHandler::SPI_WRITE_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* rxBuf = nullptr;
|
||||||
|
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t replyBufferSize = cookie->getMaxBufferSize();
|
||||||
|
|
||||||
|
/** There must be a delay of at least 20 ms after sending the command */
|
||||||
|
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The reaction wheel responds with empty frames while preparing the reply data.
|
||||||
|
* However, receiving more than 5 empty frames will be interpreted as an error.
|
||||||
|
*/
|
||||||
|
uint8_t byteRead = 0;
|
||||||
|
for (int idx = 0; idx < 10; idx++) {
|
||||||
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
return RwHandler::SPI_READ_FAILURE;
|
||||||
|
}
|
||||||
|
if (idx == 0) {
|
||||||
|
if (byteRead != FLAG_BYTE) {
|
||||||
|
sif::error << "Invalid data, expected start marker" << std::endl;
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
return RwHandler::NO_START_MARKER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (byteRead != FLAG_BYTE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idx == 9) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Empty frame timeout" << std::endl;
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
return RwHandler::NO_REPLY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if FSFW_HAL_SPI_WIRETAPPING == 1
|
||||||
|
sif::info << "RW start marker detected" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
size_t decodedFrameLen = 0;
|
||||||
|
while (decodedFrameLen < replyBufferSize) {
|
||||||
|
/** First byte already read in */
|
||||||
|
if (decodedFrameLen != 0) {
|
||||||
|
byteRead = 0;
|
||||||
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (byteRead == FLAG_BYTE) {
|
||||||
|
/** Reached end of frame */
|
||||||
|
break;
|
||||||
|
} else if (byteRead == 0x7D) {
|
||||||
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (byteRead == 0x5E) {
|
||||||
|
*(rxBuf + decodedFrameLen) = 0x7E;
|
||||||
|
decodedFrameLen++;
|
||||||
|
continue;
|
||||||
|
} else if (byteRead == 0x5D) {
|
||||||
|
*(rxBuf + decodedFrameLen) = 0x7D;
|
||||||
|
decodedFrameLen++;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
result = RwHandler::INVALID_SUBSTITUTE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*(rxBuf + decodedFrameLen) = byteRead;
|
||||||
|
decodedFrameLen++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There might be the unlikely case that each byte in a get-telemetry reply has been
|
||||||
|
* replaced by its substitute. Than the next byte must correspond to the end sign 0x7E.
|
||||||
|
* Otherwise there might be something wrong.
|
||||||
|
*/
|
||||||
|
if (decodedFrameLen == replyBufferSize) {
|
||||||
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Failed to read last byte" << std::endl;
|
||||||
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (byteRead != 0x7E) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Missing end sign 0x7E" << std::endl;
|
||||||
|
decodedFrameLen--;
|
||||||
|
result = RwHandler::MISSING_END_SIGN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
cookie->setTransferSize(decodedFrameLen);
|
||||||
|
|
||||||
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
||||||
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
|
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace rwSpiCallback
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
|
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||||
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||||
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <fsfw/hal/linux/spi/SpiComIF.h>
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
#include <fsfw/hal/common/gpio/GpioCookie.h>
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
|
||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
|
//! This is the end and start marker of the frame datalinklayer
|
||||||
|
static constexpr uint8_t FLAG_BYTE = 0x7E;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
|
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
|
||||||
* receive the replies.
|
* receive the replies.
|
||||||
@@ -40,5 +42,5 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
*/
|
*/
|
||||||
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
||||||
|
|
||||||
}
|
} // namespace rwSpiCallback
|
||||||
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
CoreController.cpp
|
CoreController.cpp
|
||||||
obsw.cpp
|
obsw.cpp
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
||||||
|
InitMission.cpp
|
||||||
|
)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,49 +1,225 @@
|
|||||||
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
|
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||||
|
|
||||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include <libxiphos.h>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
|
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||||
|
|
||||||
|
class Timer;
|
||||||
|
class SdCardManager;
|
||||||
|
|
||||||
|
namespace xsc {
|
||||||
|
|
||||||
|
enum Chip : int { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
||||||
|
enum Copy : int { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
||||||
|
|
||||||
|
} // namespace xsc
|
||||||
|
|
||||||
|
struct RebootFile {
|
||||||
|
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
|
||||||
|
|
||||||
|
bool enabled = true;
|
||||||
|
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
|
||||||
|
uint32_t img00Cnt = 0;
|
||||||
|
uint32_t img01Cnt = 0;
|
||||||
|
uint32_t img10Cnt = 0;
|
||||||
|
uint32_t img11Cnt = 0;
|
||||||
|
bool img00Lock = false;
|
||||||
|
bool img01Lock = false;
|
||||||
|
bool img10Lock = false;
|
||||||
|
bool img11Lock = false;
|
||||||
|
uint32_t* relevantBootCnt = &img00Cnt;
|
||||||
|
bool bootFlag = false;
|
||||||
|
xsc::Chip lastChip = xsc::Chip::CHIP_0;
|
||||||
|
xsc::Copy lastCopy = xsc::Copy::COPY_0;
|
||||||
|
xsc::Chip mechanismNextChip = xsc::Chip::NO_CHIP;
|
||||||
|
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
|
||||||
|
};
|
||||||
|
|
||||||
class CoreController : public ExtendedControllerBase {
|
class CoreController : public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
|
static xsc::Chip CURRENT_CHIP;
|
||||||
|
static xsc::Copy CURRENT_COPY;
|
||||||
|
|
||||||
|
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||||
|
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||||
|
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||||
|
static constexpr char CONF_FOLDER[] = "conf";
|
||||||
|
static constexpr char VERSION_FILE_NAME[] = "version.txt";
|
||||||
|
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
|
||||||
|
const std::string VERSION_FILE =
|
||||||
|
"/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
|
||||||
|
const std::string REBOOT_FILE =
|
||||||
|
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
||||||
|
|
||||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||||
|
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
||||||
|
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
|
||||||
|
static constexpr ActionId_t SWITCH_IMG_LOCK = 7;
|
||||||
|
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8;
|
||||||
|
|
||||||
|
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||||
|
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||||
|
|
||||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||||
|
//! [EXPORT] : [COMMENT] Software reboot occured. Can also be a systemd reboot.
|
||||||
|
//! P1: Current Chip, P2: Current Copy
|
||||||
|
static constexpr Event REBOOT_SW = event::makeEvent(SUBSYSTEM_ID, 1, severity::MEDIUM);
|
||||||
|
//! [EXPORT] : [COMMENT] The reboot mechanism was triggered.
|
||||||
|
//! P1: First 16 bits: Last Chip, Last 16 bits: Last Copy,
|
||||||
|
//! P2: Each byte is the respective reboot count for the slots
|
||||||
|
static constexpr Event REBOOT_MECHANISM_TRIGGERED =
|
||||||
|
event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
|
||||||
|
//! Trying to find a way how to determine that the reboot came from ProASIC3 or PCDU..
|
||||||
|
static constexpr Event REBOOT_HW = event::makeEvent(SUBSYSTEM_ID, 3, severity::MEDIUM);
|
||||||
|
|
||||||
CoreController(object_id_t objectId);
|
CoreController(object_id_t objectId);
|
||||||
|
virtual ~CoreController();
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
ReturnValue_t executeAction(ActionId_t actionId,
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override;
|
const uint8_t* data, size_t size) override;
|
||||||
|
|
||||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||||
void performControlOperation() override;
|
void performControlOperation() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a file containing the chip lock/unlock states inside /tmp/chip_prot_status.txt
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static ReturnValue_t generateChipStateFile();
|
||||||
static ReturnValue_t incrementAllocationFailureCount();
|
static ReturnValue_t incrementAllocationFailureCount();
|
||||||
|
static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy);
|
||||||
|
|
||||||
|
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the target chip and copy are write protected and protect set them to a target
|
||||||
|
* state where applicable.
|
||||||
|
* @param targetChip
|
||||||
|
* @param targetCopy
|
||||||
|
* @param protect Target state
|
||||||
|
* @param protOperationPerformed [out] Can be used to determine whether any operation
|
||||||
|
* was performed
|
||||||
|
* @param updateProtFile Specify whether the protection info file is updated
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ReturnValue_t setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||||
|
bool& protOperationPerformed, bool updateProtFile = true);
|
||||||
|
|
||||||
|
bool sdInitFinished() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Designated value for rechecking FIFO open
|
||||||
|
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||||
|
int watchdogFifoFd = 0;
|
||||||
|
|
||||||
|
// States for SD state machine, which is used in non-blocking mode
|
||||||
|
enum class SdStates {
|
||||||
|
NONE,
|
||||||
|
START,
|
||||||
|
GET_INFO,
|
||||||
|
SET_STATE_SELF,
|
||||||
|
MOUNT_SELF,
|
||||||
|
// Determine operations for other SD card, depending on redundancy configuration
|
||||||
|
DETERMINE_OTHER,
|
||||||
|
SET_STATE_OTHER,
|
||||||
|
// Mount or unmount other
|
||||||
|
MOUNT_UNMOUNT_OTHER,
|
||||||
|
// Skip period because the shell command used to generate the info file sometimes is
|
||||||
|
// missing the last performed operation if executed too early
|
||||||
|
SKIP_CYCLE_BEFORE_INFO_UPDATE,
|
||||||
|
UPDATE_INFO,
|
||||||
|
// SD initialization done
|
||||||
|
IDLE,
|
||||||
|
// Used if SD switches or mount commands are issued via telecommand
|
||||||
|
SET_STATE_FROM_COMMAND,
|
||||||
|
};
|
||||||
|
static constexpr bool BLOCKING_SD_INIT = false;
|
||||||
|
|
||||||
|
SdCardManager* sdcMan = nullptr;
|
||||||
|
|
||||||
|
struct SdInfo {
|
||||||
|
sd::SdCard pref = sd::SdCard::NONE;
|
||||||
|
sd::SdState prefState = sd::SdState::OFF;
|
||||||
|
sd::SdCard other = sd::SdCard::NONE;
|
||||||
|
sd::SdState otherState = sd::SdState::OFF;
|
||||||
|
std::string prefChar = "0";
|
||||||
|
std::string otherChar = "1";
|
||||||
|
SdStates state = SdStates::START;
|
||||||
|
// Used to track whether a command was executed
|
||||||
|
bool commandExecuted = true;
|
||||||
|
bool initFinished = false;
|
||||||
|
SdCardManager::SdStatePair currentState;
|
||||||
|
uint16_t cycleCount = 0;
|
||||||
|
// These two flags are related to external commanding
|
||||||
|
bool commandIssued = false;
|
||||||
|
bool commandFinished = false;
|
||||||
|
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
||||||
|
sd::SdCard commandedCard = sd::SdCard::NONE;
|
||||||
|
sd::SdState commandedState = sd::SdState::OFF;
|
||||||
|
} sdInfo;
|
||||||
|
RebootFile rebootFile = {};
|
||||||
|
bool doPerformMountedSdCardOps = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index 0: Chip 0 Copy 0
|
||||||
|
* Index 1: Chip 0 Copy 1
|
||||||
|
* Index 2: Chip 1 Copy 0
|
||||||
|
* Index 3: Chip 1 Copy 1
|
||||||
|
*/
|
||||||
|
std::array<bool, 4> protArray;
|
||||||
|
PeriodicOperationDivider opDivider;
|
||||||
|
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
|
||||||
uint32_t *msToReachTheMode);
|
void performMountedSdCardOperations();
|
||||||
|
ReturnValue_t initVersionFile();
|
||||||
|
ReturnValue_t initBootCopy();
|
||||||
|
ReturnValue_t initWatchdogFifo();
|
||||||
|
ReturnValue_t initSdCardBlocking();
|
||||||
|
void initPrint();
|
||||||
|
|
||||||
ReturnValue_t sdCardInit();
|
ReturnValue_t sdStateMachine();
|
||||||
ReturnValue_t sdCardSetup(SdCardManager& sdcMan, SdCardManager::SdStatusPair& statusPair,
|
void updateSdInfoOther();
|
||||||
sd::SdCard sdCard, sd::SdStatus status, std::string sdString);
|
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
||||||
ReturnValue_t sdCardColdRedundantInit(SdCardManager* sdcMan,
|
bool printOutput = true);
|
||||||
SdCardManager::SdStatusPair& statusPair);
|
ReturnValue_t sdColdRedundantBlockingInit();
|
||||||
|
|
||||||
ReturnValue_t versionFileInit();
|
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||||
|
void determinePreferredSdCard();
|
||||||
|
void executeNextExternalSdCommand();
|
||||||
|
void checkExternalSdCommandStatus();
|
||||||
|
void performRebootFileHandling(bool recreateFile);
|
||||||
|
|
||||||
|
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
|
const uint8_t* data, size_t size);
|
||||||
|
ReturnValue_t actionPerformReboot(const uint8_t* data, size_t size);
|
||||||
|
|
||||||
|
void performWatchdogControlOperation();
|
||||||
|
|
||||||
|
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||||
|
int handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||||
|
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
||||||
|
bool allChips, bool allCopies, uint8_t arrIdx);
|
||||||
|
void determineAndExecuteReboot(RebootFile& rf, bool& needsReboot, xsc::Chip& tgtChip,
|
||||||
|
xsc::Copy& tgtCopy);
|
||||||
|
void resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||||
|
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||||
|
bool parseRebootFile(std::string path, RebootFile& file);
|
||||||
|
void rewriteRebootFile(RebootFile file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||||
|
|||||||
@@ -1,28 +1,27 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
#include "mission/utility/InitMission.h"
|
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
|
||||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
|
||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||||
|
#include "fsfw/platform.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "mission/utility/InitMission.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
/* This is configured for linux without CR */
|
/* This is configured for linux without CR */
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
ServiceInterfaceStream sif::warning("WARNING");
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
ServiceInterfaceStream sif::error("ERROR", false, false, true);
|
ServiceInterfaceStream sif::error("ERROR");
|
||||||
#else
|
#else
|
||||||
ServiceInterfaceStream sif::debug("DEBUG", true);
|
ServiceInterfaceStream sif::debug("DEBUG", true);
|
||||||
ServiceInterfaceStream sif::info("INFO", true);
|
ServiceInterfaceStream sif::info("INFO", true);
|
||||||
@@ -33,7 +32,6 @@ ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
|||||||
ObjectManagerIF* objectManager = nullptr;
|
ObjectManagerIF* objectManager = nullptr;
|
||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
|
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
/* Instantiate global object manager and also create all objects */
|
/* Instantiate global object manager and also create all objects */
|
||||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
@@ -57,13 +55,14 @@ void initmission::initTasks() {
|
|||||||
void (*missedDeadlineFunc)(void) = nullptr;
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
||||||
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
@@ -81,20 +80,51 @@ void initmission::initTasks() {
|
|||||||
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UDP bridge */
|
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
||||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
// TMTC bridge
|
||||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UDP_BRIDGE", objects::UDP_BRIDGE);
|
initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UDP_POLLING", objects::UDP_POLLING_TASK);
|
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||||
|
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
||||||
|
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
|
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Minimal distance between two received TCs amounts to 0.6 seconds
|
||||||
|
// If a command has not been read before the next one arrives, the old command will be
|
||||||
|
// overwritten by the PDEC.
|
||||||
|
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
||||||
|
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||||
|
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
||||||
|
}
|
||||||
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
|
||||||
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
|
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
|
||||||
|
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||||
|
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
|
||||||
|
}
|
||||||
|
#endif /* OBSW_ADD_ACS_HANDLERS */
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||||
// because it is a non-essential background task
|
// because it is a non-essential background task
|
||||||
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
||||||
@@ -104,7 +134,18 @@ void initmission::initTasks() {
|
|||||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_CCSDS_BRIDGE == 1
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
|
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
||||||
|
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = strHelperTask->addComponent(objects::STR_HELPER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
||||||
|
}
|
||||||
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
|
#endif /* BOARD_TE0720 */
|
||||||
|
|
||||||
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||||
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
||||||
@@ -117,15 +158,17 @@ void initmission::initTasks() {
|
|||||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||||
std::vector<PeriodicTaskIF*> pstTasks;
|
std::vector<PeriodicTaskIF*> pstTasks;
|
||||||
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||||
|
|
||||||
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
std::vector<PeriodicTaskIF*> testTasks;
|
std::vector<PeriodicTaskIF*> testTasks;
|
||||||
createTestTasks(*factory, missedDeadlineFunc, testTasks);
|
createTestTasks(*factory, missedDeadlineFunc, testTasks);
|
||||||
|
#endif
|
||||||
|
|
||||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||||
for (const auto& task : taskVector) {
|
for (const auto& task : taskVector) {
|
||||||
if (task != nullptr) {
|
if (task != nullptr) {
|
||||||
task->startTask();
|
task->startTask();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,9 +176,20 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
tmTcDistributor->startTask();
|
tmTcDistributor->startTask();
|
||||||
udpBridgeTask->startTask();
|
|
||||||
udpPollingTask->startTask();
|
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
||||||
|
tmtcBridgeTask->startTask();
|
||||||
|
tmtcPollingTask->startTask();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||||
|
ccsdsHandlerTask->startTask();
|
||||||
|
pdecHandlerTask->startTask();
|
||||||
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
coreController->startTask();
|
coreController->startTask();
|
||||||
|
#endif
|
||||||
|
|
||||||
taskStarter(pstTasks, "PST task vector");
|
taskStarter(pstTasks, "PST task vector");
|
||||||
taskStarter(pusTasks, "PUS task vector");
|
taskStarter(pusTasks, "PUS task vector");
|
||||||
@@ -143,50 +197,67 @@ void initmission::initTasks() {
|
|||||||
taskStarter(testTasks, "Test task vector");
|
taskStarter(testTasks, "Test task vector");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TEST_CCSDS_BRIDGE == 1
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
ptmeTestTask->startTask();
|
ptmeTestTask->startTask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
fsTask->startTask();
|
fsTask->startTask();
|
||||||
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
|
strHelperTask > startTask();
|
||||||
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
|
acsCtrl->startTask();
|
||||||
|
#endif
|
||||||
|
|
||||||
sif::info << "Tasks started.." << std::endl;
|
sif::info << "Tasks started.." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
/* Polling Sequence Table Default */
|
/* Polling Sequence Table Default */
|
||||||
#if Q7S_ADD_SPI_TEST == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
taskVec.push_back(spiPst);
|
taskVec.push_back(spiPst);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstUart(uartPst);
|
result = pst::pstUart(uartPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(uartPst);
|
taskVec.push_back(uartPst);
|
||||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstGpio(gpioPst);
|
result = pst::pstGpio(gpioPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(gpioPst);
|
taskVec.push_back(gpioPst);
|
||||||
|
|
||||||
|
#if OBSW_ADD_I2C_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||||
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstI2c(i2cPst);
|
result = pst::pstI2c(i2cPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
|
taskVec.push_back(i2cPst);
|
||||||
|
#endif
|
||||||
|
|
||||||
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
||||||
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||||
@@ -194,11 +265,10 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(i2cPst);
|
taskVec.push_back(gomSpacePstTask);
|
||||||
#else /* BOARD_TE7020 == 0 */
|
#else /* BOARD_TE7020 == 0 */
|
||||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc);
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
||||||
@@ -208,7 +278,8 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
@@ -276,27 +347,47 @@ void initmission::createPusTasks(TaskFactory &factory,
|
|||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void initmission::createTestTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
|
#if OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
static_cast<void>(result); // supress warning in case it is not used
|
||||||
|
|
||||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
||||||
|
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if Q7S_ADD_SPI_TEST == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1
|
#if OBSW_ADD_I2C_TEST_CODE == 1
|
||||||
|
result = testTask->addComponent(objects::I2C_TEST);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
|
result = testTask->addComponent(objects::UART_TEST);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
||||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||||
}
|
}
|
||||||
#endif /* BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1 */
|
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
|
||||||
taskVec.push_back(testTask);
|
taskVec.push_back(testTask);
|
||||||
|
|
||||||
|
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#ifndef BSP_Q7S_INITMISSION_H_
|
#ifndef BSP_Q7S_INITMISSION_H_
|
||||||
#define BSP_Q7S_INITMISSION_H_
|
#define BSP_Q7S_INITMISSION_H_
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
|
||||||
@@ -17,6 +18,6 @@ void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadl
|
|||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_Q7S_INITMISSION_H_ */
|
#endif /* BSP_Q7S_INITMISSION_H_ */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,25 +2,32 @@
|
|||||||
#define BSP_Q7S_OBJECTFACTORY_H_
|
#define BSP_Q7S_OBJECTFACTORY_H_
|
||||||
|
|
||||||
class LinuxLibgpioIF;
|
class LinuxLibgpioIF;
|
||||||
|
class UartComIF;
|
||||||
|
class SpiComIF;
|
||||||
|
class I2cComIF;
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
|
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
|
|
||||||
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF);
|
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
||||||
|
SpiComIF** spiComIF, I2cComIF** i2cComIF);
|
||||||
|
|
||||||
|
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
||||||
void createTmpComponents();
|
void createTmpComponents();
|
||||||
void createPcduComponents();
|
void createPcduComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||||
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF);
|
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
||||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF);
|
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF);
|
||||||
void createHeaterComponents();
|
void createHeaterComponents();
|
||||||
void createSolarArrayDeploymentComponents();
|
void createSolarArrayDeploymentComponents();
|
||||||
void createSyrlinksComponents();
|
void createSyrlinksComponents();
|
||||||
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createTestComponents();
|
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#include "ParameterHandler.h"
|
#include "ParameterHandler.h"
|
||||||
|
|
||||||
ParameterHandler::ParameterHandler(std::string mountPrefix): mountPrefix(mountPrefix) {
|
ParameterHandler::ParameterHandler(std::string mountPrefix) : mountPrefix(mountPrefix) {}
|
||||||
}
|
|
||||||
|
|
||||||
void ParameterHandler::setMountPrefix(std::string prefix) {
|
void ParameterHandler::setMountPrefix(std::string prefix) { mountPrefix = prefix; }
|
||||||
mountPrefix = prefix;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ParameterHandler {
|
class ParameterHandler {
|
||||||
public:
|
public:
|
||||||
ParameterHandler(std::string mountPrefix);
|
ParameterHandler(std::string mountPrefix);
|
||||||
@@ -13,10 +11,10 @@ public:
|
|||||||
void setMountPrefix(std::string prefix);
|
void setMountPrefix(std::string prefix);
|
||||||
|
|
||||||
void setUpDummyParameter();
|
void setUpDummyParameter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mountPrefix;
|
std::string mountPrefix;
|
||||||
DummyParameter dummyParam;
|
DummyParameter dummyParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
#include "obsw.h"
|
#include "obsw.h"
|
||||||
#include "OBSWVersion.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "InitMission.h"
|
|
||||||
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "InitMission.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "OBSWVersion.h"
|
||||||
|
#include "fsfw/FSFWVersion.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "watchdogConf.h"
|
||||||
|
|
||||||
|
static int OBSW_ALREADY_RUNNING = -2;
|
||||||
|
|
||||||
int obsw::obsw() {
|
int obsw::obsw() {
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
@@ -15,11 +19,21 @@ int obsw::obsw() {
|
|||||||
#else
|
#else
|
||||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
<< FSFW_VERSION << "." << FSFW_SUBVERSION << "." << FSFW_REVISION << "--" << std::endl;
|
||||||
FSFW_REVISION << "--" << std::endl;
|
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
|
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
||||||
|
// Check special file here. This file is created or deleted by the eive-watchdog application
|
||||||
|
// or systemd service!
|
||||||
|
if (std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
||||||
|
sif::warning << "File " << watchdog::RUNNING_FILE_NAME
|
||||||
|
<< " exists so the software might "
|
||||||
|
"already be running. Check if obsw systemd service has been stopped."
|
||||||
|
<< std::endl;
|
||||||
|
return OBSW_ALREADY_RUNNING;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
5
bsp_q7s/devices/CMakeLists.txt
Normal file
5
bsp_q7s/devices/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
PlocSupervisorHandler.cpp
|
||||||
|
PlocUpdater.cpp
|
||||||
|
PlocMemoryDumper.cpp
|
||||||
|
)
|
||||||
194
bsp_q7s/devices/PlocMemoryDumper.cpp
Normal file
194
bsp_q7s/devices/PlocMemoryDumper.cpp
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
#include "PlocMemoryDumper.h"
|
||||||
|
|
||||||
|
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
|
|
||||||
|
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId)
|
||||||
|
: SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||||
|
auto mqArgs = MqArgs(this->getObjectId());
|
||||||
|
commandQueue = QueueFactory::instance()->createMessageQueue(
|
||||||
|
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlocMemoryDumper::~PlocMemoryDumper() {}
|
||||||
|
|
||||||
|
ReturnValue_t PlocMemoryDumper::initialize() {
|
||||||
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = commandActionHelper.initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = actionHelper.initialize(commandQueue);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
||||||
|
readCommandQueue();
|
||||||
|
doStateMachine();
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
|
const uint8_t* data, size_t size) {
|
||||||
|
if (state != State::IDLE) {
|
||||||
|
return IS_BUSY;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (actionId) {
|
||||||
|
case DUMP_MRAM: {
|
||||||
|
size_t deserializeSize = sizeof(mram.startAddress) + sizeof(mram.endAddress);
|
||||||
|
SerializeAdapter::deSerialize(&mram.startAddress, &data, &deserializeSize,
|
||||||
|
SerializeIF::Endianness::BIG);
|
||||||
|
SerializeAdapter::deSerialize(&mram.endAddress, &data, &deserializeSize,
|
||||||
|
SerializeIF::Endianness::BIG);
|
||||||
|
if (mram.endAddress > MAX_MRAM_ADDRESS) {
|
||||||
|
return MRAM_ADDRESS_TOO_HIGH;
|
||||||
|
}
|
||||||
|
if (mram.endAddress <= mram.startAddress) {
|
||||||
|
return MRAM_INVALID_ADDRESS_COMBINATION;
|
||||||
|
}
|
||||||
|
state = State::COMMAND_FIRST_MRAM_DUMP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
sif::warning << "PlocMemoryDumper::executeAction: Received command with invalid action id"
|
||||||
|
<< std::endl;
|
||||||
|
return INVALID_ACTION_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXECUTION_FINISHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
|
|
||||||
|
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() { return commandQueue; }
|
||||||
|
|
||||||
|
void PlocMemoryDumper::readCommandQueue() {
|
||||||
|
CommandMessage message;
|
||||||
|
ReturnValue_t result;
|
||||||
|
|
||||||
|
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
|
||||||
|
result = commandQueue->receiveMessage(&message)) {
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result = actionHelper.handleActionMessage(&message);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = commandActionHelper.handleReply(&message);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sif::debug << "PlocMemoryDumper::readCommandQueue: Received message with invalid format"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMemoryDumper::doStateMachine() {
|
||||||
|
switch (state) {
|
||||||
|
case State::IDLE:
|
||||||
|
break;
|
||||||
|
case State::COMMAND_FIRST_MRAM_DUMP:
|
||||||
|
commandNextMramDump(PLOC_SPV::FIRST_MRAM_DUMP);
|
||||||
|
break;
|
||||||
|
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
|
||||||
|
commandNextMramDump(PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
|
||||||
|
break;
|
||||||
|
case State::EXECUTING_MRAM_DUMP:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocMemoryDumper::doStateMachine: Invalid state" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
|
||||||
|
|
||||||
|
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||||
|
ReturnValue_t returnCode) {}
|
||||||
|
|
||||||
|
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}
|
||||||
|
|
||||||
|
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
|
switch (pendingCommand) {
|
||||||
|
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
||||||
|
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||||
|
if (mram.endAddress == mram.startAddress) {
|
||||||
|
triggerEvent(MRAM_DUMP_FINISHED);
|
||||||
|
state = State::IDLE;
|
||||||
|
} else {
|
||||||
|
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocMemoryDumper::completionSuccessfulReceived: Invalid pending command"
|
||||||
|
<< std::endl;
|
||||||
|
state = State::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
|
switch (pendingCommand) {
|
||||||
|
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
||||||
|
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||||
|
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocMemoryDumper::completionFailedReceived: Invalid pending command "
|
||||||
|
<< std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
state = State::IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
|
uint32_t tempStartAddress = 0;
|
||||||
|
uint32_t tempEndAddress = 0;
|
||||||
|
|
||||||
|
if (mram.endAddress - mram.startAddress > MAX_MRAM_DUMP_SIZE) {
|
||||||
|
tempStartAddress = mram.startAddress;
|
||||||
|
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
|
||||||
|
mram.startAddress += MAX_MRAM_DUMP_SIZE;
|
||||||
|
mram.lastStartAddress = tempStartAddress;
|
||||||
|
} else {
|
||||||
|
tempStartAddress = mram.startAddress;
|
||||||
|
tempEndAddress = mram.endAddress;
|
||||||
|
mram.startAddress = mram.endAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryParams params(tempStartAddress, tempEndAddress);
|
||||||
|
|
||||||
|
result =
|
||||||
|
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, dumpCommand, ¶ms);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
|
||||||
|
<< "with start address " << tempStartAddress << " and end address "
|
||||||
|
<< tempEndAddress << std::endl;
|
||||||
|
triggerEvent(SEND_MRAM_DUMP_FAILED, result, tempStartAddress);
|
||||||
|
state = State::IDLE;
|
||||||
|
pendingCommand = NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state = State::EXECUTING_MRAM_DUMP;
|
||||||
|
pendingCommand = dumpCommand;
|
||||||
|
return;
|
||||||
|
}
|
||||||
114
bsp_q7s/devices/PlocMemoryDumper.h
Normal file
114
bsp_q7s/devices/PlocMemoryDumper.h
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
#ifndef MISSION_DEVICES_PLOCMEMORYDUMPER_H_
|
||||||
|
#define MISSION_DEVICES_PLOCMEMORYDUMPER_H_
|
||||||
|
|
||||||
|
#include <bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
||||||
|
#include <bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
#include "fsfw/action/ActionHelper.h"
|
||||||
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Because the buffer of the linux tty driver is limited to 2 x 65535 bytes, this class is
|
||||||
|
* created to perform large dumps of PLOC memories.
|
||||||
|
*
|
||||||
|
* @details Currently the PLOC supervisor only implements the functionality to dump the MRAM.
|
||||||
|
*
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
class PlocMemoryDumper : public SystemObject,
|
||||||
|
public HasActionsIF,
|
||||||
|
public ExecutableObjectIF,
|
||||||
|
public HasReturnvaluesIF,
|
||||||
|
public CommandsActionsIF {
|
||||||
|
public:
|
||||||
|
static const ActionId_t NONE = 0;
|
||||||
|
static const ActionId_t DUMP_MRAM = 1;
|
||||||
|
|
||||||
|
PlocMemoryDumper(object_id_t objectId);
|
||||||
|
virtual ~PlocMemoryDumper();
|
||||||
|
|
||||||
|
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
|
const uint8_t* data, size_t size);
|
||||||
|
MessageQueueId_t getCommandQueue() const;
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
MessageQueueIF* getCommandQueuePtr() override;
|
||||||
|
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||||
|
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
|
||||||
|
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
|
||||||
|
void completionSuccessfulReceived(ActionId_t actionId) override;
|
||||||
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint32_t QUEUE_SIZE = 10;
|
||||||
|
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] The capacity of the MRAM amounts to 512 kB. Thus the maximum address must
|
||||||
|
//! not be higher than 0x7d000.
|
||||||
|
static const ReturnValue_t MRAM_ADDRESS_TOO_HIGH = MAKE_RETURN_CODE(0xA0);
|
||||||
|
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
|
||||||
|
static const ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MEMORY_DUMPER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] Failed to send mram dump command to supervisor handler
|
||||||
|
//! P1: Return value of commandAction function
|
||||||
|
//! P2: Start address of MRAM to dump with this command
|
||||||
|
static const Event SEND_MRAM_DUMP_FAILED = MAKE_EVENT(0, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Received completion failure report form PLOC supervisor handler
|
||||||
|
//! P1: MRAM start address of failing dump command
|
||||||
|
static const Event MRAM_DUMP_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] MRAM dump finished successfully
|
||||||
|
static const Event MRAM_DUMP_FINISHED = MAKE_EVENT(2, severity::LOW);
|
||||||
|
|
||||||
|
// Maximum size of mram dump which can be retrieved with one command
|
||||||
|
static const uint32_t MAX_MRAM_DUMP_SIZE = 100000;
|
||||||
|
static const uint32_t MAX_MRAM_ADDRESS = 0x7d000;
|
||||||
|
|
||||||
|
MessageQueueIF* commandQueue = nullptr;
|
||||||
|
|
||||||
|
CommandActionHelper commandActionHelper;
|
||||||
|
|
||||||
|
ActionHelper actionHelper;
|
||||||
|
|
||||||
|
enum class State : uint8_t {
|
||||||
|
IDLE,
|
||||||
|
COMMAND_FIRST_MRAM_DUMP,
|
||||||
|
COMMAND_CONSECUTIVE_MRAM_DUMP,
|
||||||
|
EXECUTING_MRAM_DUMP
|
||||||
|
};
|
||||||
|
|
||||||
|
State state = State::IDLE;
|
||||||
|
|
||||||
|
ActionId_t pendingCommand = NONE;
|
||||||
|
|
||||||
|
typedef struct MemoryInfo {
|
||||||
|
// Stores the start address of the next memory range to dump
|
||||||
|
uint32_t startAddress;
|
||||||
|
uint32_t endAddress;
|
||||||
|
// Stores the start address of the last sent dump command
|
||||||
|
uint32_t lastStartAddress;
|
||||||
|
} MemoryInfo_t;
|
||||||
|
|
||||||
|
MemoryInfo_t mram = {0, 0, 0};
|
||||||
|
|
||||||
|
void readCommandQueue();
|
||||||
|
void doStateMachine();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sends the next mram dump command to the PLOC supervisor handler.
|
||||||
|
*/
|
||||||
|
void commandNextMramDump(ActionId_t dumpCommand);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MISSION_DEVICES_PLOCMEMORYDUMPER_H_ */
|
||||||
1511
bsp_q7s/devices/PlocSupervisorHandler.cpp
Normal file
1511
bsp_q7s/devices/PlocSupervisorHandler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
345
bsp_q7s/devices/PlocSupervisorHandler.h
Normal file
345
bsp_q7s/devices/PlocSupervisorHandler.h
Normal file
@@ -0,0 +1,345 @@
|
|||||||
|
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||||
|
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||||
|
|
||||||
|
#include <bsp_q7s/memory/SdCardManager.h>
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
|
|
||||||
|
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||||
|
* Thales.
|
||||||
|
*
|
||||||
|
* @details The PLOC uses the space packet protocol for communication. To each command the PLOC
|
||||||
|
* answers with at least one acknowledgment and one execution report.
|
||||||
|
* Flight manual:
|
||||||
|
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/PLOC_Commands
|
||||||
|
* ILH ICD: https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/
|
||||||
|
* Arbeitsdaten/08_Used%20Components/PLOC&fileid=940960
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||||
|
public:
|
||||||
|
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie);
|
||||||
|
virtual ~PlocSupervisorHandler();
|
||||||
|
|
||||||
|
virtual ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void doStartUp() override;
|
||||||
|
void doShutDown() override;
|
||||||
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||||
|
size_t commandDataLen) override;
|
||||||
|
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||||
|
size_t* foundLen) override;
|
||||||
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
|
LocalDataPoolManager& poolManager) override;
|
||||||
|
ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
|
uint8_t expectedReplies = 1, bool useAlternateId = false,
|
||||||
|
DeviceCommandId_t alternateReplyID = 0) override;
|
||||||
|
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
|
||||||
|
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
|
||||||
|
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC supervisor
|
||||||
|
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
|
||||||
|
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC supervisor
|
||||||
|
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
|
||||||
|
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC supervisor
|
||||||
|
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
|
||||||
|
//! [EXPORT] : [COMMENT] Failed to read current system time
|
||||||
|
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
||||||
|
//! [EXPORT] : [COMMENT] Invalid communication interface specified
|
||||||
|
static const ReturnValue_t INVALID_UART_COM_IF = MAKE_RETURN_CODE(0xA5);
|
||||||
|
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0
|
||||||
|
//! for PS, 1 for PL and 2 for INT
|
||||||
|
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
|
||||||
|
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid
|
||||||
|
//! timeouts must be in the range between 1000 and 360000 ms.
|
||||||
|
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA7);
|
||||||
|
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
||||||
|
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA8);
|
||||||
|
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be
|
||||||
|
//! larger than 21.
|
||||||
|
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA9);
|
||||||
|
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1
|
||||||
|
//! and 2.
|
||||||
|
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xAA);
|
||||||
|
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
||||||
|
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAB);
|
||||||
|
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe
|
||||||
|
//! commands are invalid (e.g. start address bigger than stop address)
|
||||||
|
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAC);
|
||||||
|
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with
|
||||||
|
//! other apid.
|
||||||
|
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAD);
|
||||||
|
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
||||||
|
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAE);
|
||||||
|
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have
|
||||||
|
//! been created with the reception of the first dump packet.
|
||||||
|
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAF);
|
||||||
|
|
||||||
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] PLOC supervisor crc failure in telemetry packet
|
||||||
|
static const Event SUPV_MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] PLOC supervisor received acknowledgment failure report
|
||||||
|
static const Event SUPV_ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] PLOC received execution failure report
|
||||||
|
static const Event SUPV_EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] PLOC supervisor reply has invalid crc
|
||||||
|
static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW);
|
||||||
|
|
||||||
|
static const uint16_t APID_MASK = 0x7FF;
|
||||||
|
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||||
|
|
||||||
|
uint8_t commandBuffer[PLOC_SPV::MAX_COMMAND_SIZE];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||||
|
* because the PLOC sends as reply to each command at least one acknowledgment and execution
|
||||||
|
* report.
|
||||||
|
*/
|
||||||
|
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
|
||||||
|
|
||||||
|
UartComIF* uartComIf = nullptr;
|
||||||
|
|
||||||
|
PLOC_SPV::HkSet hkset;
|
||||||
|
PLOC_SPV::BootStatusReport bootStatusReport;
|
||||||
|
PLOC_SPV::LatchupStatusReport latchupStatusReport;
|
||||||
|
|
||||||
|
/** Number of expected replies following the MRAM dump command */
|
||||||
|
uint32_t expectedMramDumpPackets = 0;
|
||||||
|
uint32_t receivedMramDumpPackets = 0;
|
||||||
|
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
|
||||||
|
bool packetInBuffer = false;
|
||||||
|
/** Points to the next free position in the space packet buffer */
|
||||||
|
uint16_t bufferTop = 0;
|
||||||
|
|
||||||
|
/** This buffer is used to concatenate space packets received in two different read steps */
|
||||||
|
uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
|
SdCardManager* sdcMan = nullptr;
|
||||||
|
#endif /* BOARD_TE0720 == 0 */
|
||||||
|
|
||||||
|
/** Path to PLOC specific files on SD card */
|
||||||
|
std::string plocFilePath = "ploc";
|
||||||
|
std::string activeMramFile;
|
||||||
|
|
||||||
|
/** Setting this variable to true will enable direct downlink of MRAM packets */
|
||||||
|
bool downlinkMramDump = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function checks the crc of the received PLOC reply.
|
||||||
|
*
|
||||||
|
* @param start Pointer to the first byte of the reply.
|
||||||
|
* @param foundLen Pointer to the length of the whole packet.
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE.
|
||||||
|
*/
|
||||||
|
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles the acknowledgment report.
|
||||||
|
*
|
||||||
|
* @param data Pointer to the data holding the acknowledgment report.
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise an error code.
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleAckReport(const uint8_t* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles the data of a execution report.
|
||||||
|
*
|
||||||
|
* @param data Pointer to the received data packet.
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise an error code.
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleExecutionReport(const uint8_t* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles the housekeeping report. This means verifying the CRC of the
|
||||||
|
* reply and filling the appropriate dataset.
|
||||||
|
*
|
||||||
|
* @param data Pointer to the data buffer holding the housekeeping read report.
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise an error code.
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleHkReport(const uint8_t* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function calls the function to check the CRC of the received boot status report
|
||||||
|
* and fills the associated dataset with the boot status information.
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleBootStatusReport(const uint8_t* data);
|
||||||
|
|
||||||
|
ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Depending on the current active command, this function sets the reply id of the
|
||||||
|
* next reply after a successful acknowledgment report has been received. This is
|
||||||
|
* required by the function getNextReplyLength() to identify the length of the next
|
||||||
|
* reply to read.
|
||||||
|
*/
|
||||||
|
void setNextReplyId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles action message replies in case the telemetry has been
|
||||||
|
* requested by another object.
|
||||||
|
*
|
||||||
|
* @param data Pointer to the telemetry data.
|
||||||
|
* @param dataSize Size of telemetry in bytes.
|
||||||
|
* @param replyId Id of the reply. This will be added to the ActionMessage.
|
||||||
|
*/
|
||||||
|
void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function prepares a space packet which does not transport any data in the
|
||||||
|
* packet data field apart from the crc.
|
||||||
|
*/
|
||||||
|
void prepareEmptyCmd(uint16_t apid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function initializes the space packet to select the boot image of the MPSoC.
|
||||||
|
*/
|
||||||
|
void prepareSelBootImageCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
void prepareDisableHk();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function fills the commandBuffer with the data to update the time of the
|
||||||
|
* PLOC supervisor.
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareSetTimeRefCmd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function fills the commandBuffer with the data to change the boot timeout
|
||||||
|
* value in the PLOC supervisor.
|
||||||
|
*/
|
||||||
|
void prepareSetBootTimeoutCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
void prepareRestartTriesCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function fills the command buffer with the packet to enable or disable the
|
||||||
|
* watchdogs on the PLOC.
|
||||||
|
*/
|
||||||
|
void prepareWatchdogsEnableCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function fills the command buffer with the packet to set the watchdog timer
|
||||||
|
* of one of the three watchdogs (PS, PL, INT).
|
||||||
|
*/
|
||||||
|
ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
|
||||||
|
DeviceCommandId_t deviceCommand);
|
||||||
|
ReturnValue_t prepareAutoCalibrateAlertCmd(const uint8_t* commandData);
|
||||||
|
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
|
||||||
|
ReturnValue_t prepareSetAlertIrqFilterCmd(const uint8_t* commandData);
|
||||||
|
ReturnValue_t prepareSetAdcSweetPeriodCmd(const uint8_t* commandData);
|
||||||
|
void prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
|
||||||
|
void prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
|
||||||
|
void prepareSetAdcThresholdCmd(const uint8_t* commandData);
|
||||||
|
void prepareEnableNvmsCmd(const uint8_t* commandData);
|
||||||
|
void prepareSelectNvmCmd(const uint8_t* commandData);
|
||||||
|
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
|
||||||
|
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
|
||||||
|
ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
|
||||||
|
void preparePrintCpuStatsCmd(const uint8_t* commandData);
|
||||||
|
void prepareSetDbgVerbosityCmd(const uint8_t* commandData);
|
||||||
|
void prepareSetGpioCmd(const uint8_t* commandData);
|
||||||
|
void prepareReadGpioCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copies the content of a space packet to the command buffer.
|
||||||
|
*/
|
||||||
|
void packetToOutBuffer(uint8_t* packetData, size_t fullSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief In case an acknowledgment failure reply has been received this function disables
|
||||||
|
* all previously enabled commands and resets the exepected replies variable of an
|
||||||
|
* active command.
|
||||||
|
*/
|
||||||
|
void disableAllReplies();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sends a failure report if the active action was commanded by an other
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* @param replyId The id of the reply which signals a failure.
|
||||||
|
* @param status A status byte which gives information about the failure type.
|
||||||
|
*/
|
||||||
|
void sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function disables the execution report reply. Within this function also the
|
||||||
|
* the variable expectedReplies of an active command will be set to 0.
|
||||||
|
*/
|
||||||
|
void disableExeReportReply();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function is called in scanForReply and fills the spacePacketBuffer with the read
|
||||||
|
* data until a full packet has been received.
|
||||||
|
*/
|
||||||
|
ReturnValue_t parseMramPackets(const uint8_t* packet, size_t remainingSize, size_t* foundlen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function generates the Service 8 packets for the MRAM dump data.
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleMramDumpPacket(DeviceCommandId_t id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief With this function the number of expected replies following an MRAM dump command
|
||||||
|
* will be increased. This is necessary to release the command in case not all replies
|
||||||
|
* have been received.
|
||||||
|
*/
|
||||||
|
void increaseExpectedMramReplies(DeviceCommandId_t id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function checks if the packet written to the space packet buffer is really a
|
||||||
|
* MRAM dump packet.
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkMramPacketApid();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writes the data of the MRAM dump to a file. The file will be created when receiving
|
||||||
|
* the first packet.
|
||||||
|
*/
|
||||||
|
ReturnValue_t handleMramDumpFile(DeviceCommandId_t id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Extracts the length field of a spacePacket referenced by the spacePacket pointer.
|
||||||
|
*
|
||||||
|
* @param spacePacket Pointer to the buffer holding the space packet.
|
||||||
|
*
|
||||||
|
* @return The value stored in the length field of the data field.
|
||||||
|
*/
|
||||||
|
uint16_t readSpacePacketLength(uint8_t* spacePacket);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Extracts the sequence flags from a space packet referenced by the spacePacket
|
||||||
|
* pointer.
|
||||||
|
*
|
||||||
|
* @param spacePacket Pointer to the buffer holding the space packet.
|
||||||
|
*
|
||||||
|
* @return uint8_t where the two least significant bits hold the sequence flags.
|
||||||
|
*/
|
||||||
|
uint8_t readSequenceFlags(uint8_t* spacePacket);
|
||||||
|
|
||||||
|
ReturnValue_t createMramDumpFile();
|
||||||
|
ReturnValue_t getTimeStampString(std::string& timeStamp);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */
|
||||||
395
bsp_q7s/devices/PlocUpdater.cpp
Normal file
395
bsp_q7s/devices/PlocUpdater.cpp
Normal file
@@ -0,0 +1,395 @@
|
|||||||
|
#include "PlocUpdater.h"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
|
|
||||||
|
PlocUpdater::PlocUpdater(object_id_t objectId)
|
||||||
|
: SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||||
|
auto mqArgs = MqArgs(this->getObjectId());
|
||||||
|
commandQueue = QueueFactory::instance()->createMessageQueue(
|
||||||
|
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlocUpdater::~PlocUpdater() {}
|
||||||
|
|
||||||
|
ReturnValue_t PlocUpdater::initialize() {
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
|
sdcMan = SdCardManager::instance();
|
||||||
|
#endif
|
||||||
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = commandActionHelper.initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = actionHelper.initialize(commandQueue);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocUpdater::performOperation(uint8_t operationCode) {
|
||||||
|
readCommandQueue();
|
||||||
|
doStateMachine();
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
|
const uint8_t* data, size_t size) {
|
||||||
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
|
|
||||||
|
if (state != State::IDLE) {
|
||||||
|
return IS_BUSY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size > MAX_PLOC_UPDATE_PATH) {
|
||||||
|
return NAME_TOO_LONG;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (actionId) {
|
||||||
|
case UPDATE_A_UBOOT:
|
||||||
|
image = Image::A;
|
||||||
|
partition = Partition::UBOOT;
|
||||||
|
break;
|
||||||
|
case UPDATE_A_BITSTREAM:
|
||||||
|
image = Image::A;
|
||||||
|
partition = Partition::BITSTREAM;
|
||||||
|
break;
|
||||||
|
case UPDATE_A_LINUX:
|
||||||
|
image = Image::A;
|
||||||
|
partition = Partition::LINUX_OS;
|
||||||
|
break;
|
||||||
|
case UPDATE_A_APP_SW:
|
||||||
|
image = Image::A;
|
||||||
|
partition = Partition::APP_SW;
|
||||||
|
break;
|
||||||
|
case UPDATE_B_UBOOT:
|
||||||
|
image = Image::B;
|
||||||
|
partition = Partition::UBOOT;
|
||||||
|
break;
|
||||||
|
case UPDATE_B_BITSTREAM:
|
||||||
|
image = Image::B;
|
||||||
|
partition = Partition::BITSTREAM;
|
||||||
|
break;
|
||||||
|
case UPDATE_B_LINUX:
|
||||||
|
image = Image::B;
|
||||||
|
partition = Partition::LINUX_OS;
|
||||||
|
break;
|
||||||
|
case UPDATE_B_APP_SW:
|
||||||
|
image = Image::B;
|
||||||
|
partition = Partition::APP_SW;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return INVALID_ACTION_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = getImageLocation(data, size);
|
||||||
|
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = State::UPDATE_AVAILABLE;
|
||||||
|
|
||||||
|
return EXECUTION_FINISHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageQueueId_t PlocUpdater::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
|
|
||||||
|
MessageQueueIF* PlocUpdater::getCommandQueuePtr() { return commandQueue; }
|
||||||
|
|
||||||
|
void PlocUpdater::readCommandQueue() {
|
||||||
|
CommandMessage message;
|
||||||
|
ReturnValue_t result;
|
||||||
|
|
||||||
|
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
|
||||||
|
result = commandQueue->receiveMessage(&message)) {
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result = actionHelper.handleActionMessage(&message);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = commandActionHelper.handleReply(&message);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sif::debug << "PlocUpdater::readCommandQueue: Received message with invalid format"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::doStateMachine() {
|
||||||
|
switch (state) {
|
||||||
|
case State::IDLE:
|
||||||
|
break;
|
||||||
|
case State::UPDATE_AVAILABLE:
|
||||||
|
commandUpdateAvailable();
|
||||||
|
break;
|
||||||
|
case State::UPDATE_TRANSFER:
|
||||||
|
commandUpdatePacket();
|
||||||
|
break;
|
||||||
|
case State::UPDATE_VERIFY:
|
||||||
|
commandUpdateVerify();
|
||||||
|
break;
|
||||||
|
case State::COMMAND_EXECUTING:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocUpdater::doStateMachine: Invalid state" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocUpdater::checkNameLength(size_t size) {
|
||||||
|
if (size > MAX_PLOC_UPDATE_PATH) {
|
||||||
|
return NAME_TOO_LONG;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
||||||
|
ReturnValue_t result = checkNameLength(size);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
|
// Check if file is stored on SD card and if associated SD card is mounted
|
||||||
|
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) ==
|
||||||
|
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||||
|
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||||
|
sif::warning << "PlocUpdater::getImageLocation: SD card 0 not mounted" << std::endl;
|
||||||
|
return SD_NOT_MOUNTED;
|
||||||
|
}
|
||||||
|
} else if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) ==
|
||||||
|
std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
||||||
|
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||||
|
sif::warning << "PlocUpdater::getImageLocation: SD card 1 not mounted" << std::endl;
|
||||||
|
return SD_NOT_MOUNTED;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// update image not stored on SD card
|
||||||
|
}
|
||||||
|
#endif /* BOARD_TE0720 == 0 */
|
||||||
|
|
||||||
|
updateFile = std::string(reinterpret_cast<const char*>(data), size);
|
||||||
|
|
||||||
|
// Check if file exists
|
||||||
|
if (not std::filesystem::exists(updateFile)) {
|
||||||
|
return FILE_NOT_EXISTS;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
|
||||||
|
|
||||||
|
void PlocUpdater::stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) {}
|
||||||
|
|
||||||
|
void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}
|
||||||
|
|
||||||
|
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
|
switch (pendingCommand) {
|
||||||
|
case (PLOC_SPV::UPDATE_AVAILABLE):
|
||||||
|
state = State::UPDATE_TRANSFER;
|
||||||
|
break;
|
||||||
|
case (PLOC_SPV::UPDATE_IMAGE_DATA):
|
||||||
|
if (remainingPackets == 0) {
|
||||||
|
packetsSent = 0; // Reset packets sent variable for next update sequence
|
||||||
|
state = State::UPDATE_VERIFY;
|
||||||
|
} else {
|
||||||
|
state = State::UPDATE_TRANSFER;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case (PLOC_SPV::UPDATE_VERIFY):
|
||||||
|
triggerEvent(UPDATE_FINISHED);
|
||||||
|
state = State::IDLE;
|
||||||
|
pendingCommand = PLOC_SPV::NONE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocUpdater::completionSuccessfulReceived: Invalid pending command"
|
||||||
|
<< std::endl;
|
||||||
|
state = State::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
|
switch (pendingCommand) {
|
||||||
|
case (PLOC_SPV::UPDATE_AVAILABLE): {
|
||||||
|
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PLOC_SPV::UPDATE_IMAGE_DATA): {
|
||||||
|
triggerEvent(UPDATE_TRANSFER_FAILED, packetsSent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PLOC_SPV::UPDATE_VERIFY): {
|
||||||
|
triggerEvent(UPDATE_VERIFY_FAILED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command " << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
state = State::IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::commandUpdateAvailable() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
|
if (not std::filesystem::exists(updateFile)) {
|
||||||
|
triggerEvent(UPDATE_FILE_NOT_EXISTS, static_cast<uint8_t>(state));
|
||||||
|
state = State::IDLE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ifstream file(updateFile, std::ifstream::binary);
|
||||||
|
file.seekg(0, file.end);
|
||||||
|
imageSize = static_cast<size_t>(file.tellg());
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
numOfUpdatePackets = imageSize / MAX_SP_DATA;
|
||||||
|
if (imageSize % MAX_SP_DATA) {
|
||||||
|
numOfUpdatePackets++;
|
||||||
|
}
|
||||||
|
|
||||||
|
remainingPackets = numOfUpdatePackets;
|
||||||
|
packetsSent = 0;
|
||||||
|
|
||||||
|
calcImageCrc();
|
||||||
|
|
||||||
|
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
||||||
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
|
numOfUpdatePackets);
|
||||||
|
|
||||||
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
|
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(),
|
||||||
|
packet.getFullSize());
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
|
<< " packet to supervisor handler" << std::endl;
|
||||||
|
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_AVAILABLE);
|
||||||
|
state = State::IDLE;
|
||||||
|
pendingCommand = PLOC_SPV::NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pendingCommand = PLOC_SPV::UPDATE_AVAILABLE;
|
||||||
|
state = State::COMMAND_EXECUTING;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::commandUpdatePacket() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
uint16_t payloadLength = 0;
|
||||||
|
|
||||||
|
if (not std::filesystem::exists(updateFile)) {
|
||||||
|
triggerEvent(UPDATE_FILE_NOT_EXISTS, static_cast<uint8_t>(state), packetsSent);
|
||||||
|
state = State::IDLE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ifstream file(updateFile, std::ifstream::binary);
|
||||||
|
file.seekg(packetsSent * MAX_SP_DATA, file.beg);
|
||||||
|
|
||||||
|
if (remainingPackets == 1) {
|
||||||
|
payloadLength = imageSize - static_cast<uint16_t>(file.tellg());
|
||||||
|
} else {
|
||||||
|
payloadLength = MAX_SP_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLOC_SPV::UpdatePacket packet(payloadLength);
|
||||||
|
file.read(reinterpret_cast<char*>(packet.getDataFieldPointer()), payloadLength);
|
||||||
|
file.close();
|
||||||
|
// sequence count of first packet is 1
|
||||||
|
packet.setPacketSequenceCount((packetsSent + 1) & PLOC_SPV::SEQUENCE_COUNT_MASK);
|
||||||
|
if (numOfUpdatePackets > 1) {
|
||||||
|
adjustSequenceFlags(packet);
|
||||||
|
}
|
||||||
|
packet.makeCrc();
|
||||||
|
|
||||||
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
|
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(),
|
||||||
|
packet.getFullSize());
|
||||||
|
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
||||||
|
<< " packet to supervisor handler" << std::endl;
|
||||||
|
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_IMAGE_DATA);
|
||||||
|
state = State::IDLE;
|
||||||
|
pendingCommand = PLOC_SPV::NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
remainingPackets--;
|
||||||
|
packetsSent++;
|
||||||
|
|
||||||
|
pendingCommand = PLOC_SPV::UPDATE_IMAGE_DATA;
|
||||||
|
state = State::COMMAND_EXECUTING;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::commandUpdateVerify() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
|
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
||||||
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
|
numOfUpdatePackets);
|
||||||
|
|
||||||
|
result =
|
||||||
|
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, PLOC_SPV::UPDATE_VERIFY,
|
||||||
|
packet.getWholeData(), packet.getFullSize());
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
|
<< " packet to supervisor handler" << std::endl;
|
||||||
|
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_VERIFY);
|
||||||
|
state = State::IDLE;
|
||||||
|
pendingCommand = PLOC_SPV::NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state = State::COMMAND_EXECUTING;
|
||||||
|
pendingCommand = PLOC_SPV::UPDATE_VERIFY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::calcImageCrc() {
|
||||||
|
std::ifstream file(updateFile, std::ifstream::binary);
|
||||||
|
file.seekg(0, file.end);
|
||||||
|
uint32_t count;
|
||||||
|
uint32_t bit;
|
||||||
|
uint32_t remainder = INITIAL_REMAINDER_32;
|
||||||
|
char input;
|
||||||
|
for (count = 0; count < imageSize; count++) {
|
||||||
|
file.seekg(count, file.beg);
|
||||||
|
file.read(&input, 1);
|
||||||
|
remainder ^= (input << 16);
|
||||||
|
for (bit = 8; bit > 0; --bit) {
|
||||||
|
if (remainder & TOPBIT_32) {
|
||||||
|
remainder = (remainder << 1) ^ POLYNOMIAL_32;
|
||||||
|
} else {
|
||||||
|
remainder = (remainder << 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
||||||
|
if (packetsSent == 0) {
|
||||||
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
||||||
|
} else if (remainingPackets == 1) {
|
||||||
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
||||||
|
} else {
|
||||||
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
||||||
|
}
|
||||||
|
}
|
||||||
171
bsp_q7s/devices/PlocUpdater.h
Normal file
171
bsp_q7s/devices/PlocUpdater.h
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
#ifndef MISSION_DEVICES_PLOCUPDATER_H_
|
||||||
|
#define MISSION_DEVICES_PLOCUPDATER_H_
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
#include "fsfw/action/ActionHelper.h"
|
||||||
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief An object of this class can be used to perform the software updates of the PLOC. The
|
||||||
|
* software update will be read from one of the SD cards, split into multiple space
|
||||||
|
* packets and sent to the PlocSupervisorHandler.
|
||||||
|
*
|
||||||
|
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition
|
||||||
|
* A and Partition B)
|
||||||
|
*
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
class PlocUpdater : public SystemObject,
|
||||||
|
public HasActionsIF,
|
||||||
|
public ExecutableObjectIF,
|
||||||
|
public HasReturnvaluesIF,
|
||||||
|
public CommandsActionsIF {
|
||||||
|
public:
|
||||||
|
static const ActionId_t UPDATE_A_UBOOT = 0;
|
||||||
|
static const ActionId_t UPDATE_A_BITSTREAM = 1;
|
||||||
|
static const ActionId_t UPDATE_A_LINUX = 2;
|
||||||
|
static const ActionId_t UPDATE_A_APP_SW = 3;
|
||||||
|
static const ActionId_t UPDATE_B_UBOOT = 4;
|
||||||
|
static const ActionId_t UPDATE_B_BITSTREAM = 5;
|
||||||
|
static const ActionId_t UPDATE_B_LINUX = 6;
|
||||||
|
static const ActionId_t UPDATE_B_APP_SW = 7;
|
||||||
|
|
||||||
|
PlocUpdater(object_id_t objectId);
|
||||||
|
virtual ~PlocUpdater();
|
||||||
|
|
||||||
|
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
|
const uint8_t* data, size_t size);
|
||||||
|
MessageQueueId_t getCommandQueue() const;
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
MessageQueueIF* getCommandQueuePtr() override;
|
||||||
|
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||||
|
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
|
||||||
|
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
|
||||||
|
void completionSuccessfulReceived(ActionId_t actionId) override;
|
||||||
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_UPDATER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] Updater is already performing an update
|
||||||
|
static const ReturnValue_t UPDATER_BUSY = MAKE_RETURN_CODE(0xA0);
|
||||||
|
//! [EXPORT] : [COMMENT] Received update command with invalid path string (too long).
|
||||||
|
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA1);
|
||||||
|
//! [EXPORT] : [COMMENT] Received command to initiate update but SD card with update image not
|
||||||
|
//! mounted.
|
||||||
|
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA2);
|
||||||
|
//! [EXPORT] : [COMMENT] Update file received with update command does not exist.
|
||||||
|
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA3);
|
||||||
|
|
||||||
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_UPDATER;
|
||||||
|
|
||||||
|
//! [EXPORT] : [COMMENT] Try to read update file but the file does not exist.
|
||||||
|
//! P1: Indicates in which state the file read fails
|
||||||
|
//! P2: During the update transfer the second parameter gives information about the number of
|
||||||
|
//! already sent packets
|
||||||
|
static const Event UPDATE_FILE_NOT_EXISTS = MAKE_EVENT(0, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Failed to send command to supervisor handler
|
||||||
|
//! P1: Return value of CommandActionHelper::commandAction
|
||||||
|
//! P2: Action ID of command to send
|
||||||
|
static const Event ACTION_COMMANDING_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Supervisor handler replied action message indicating a command execution
|
||||||
|
//! failure of the update available command
|
||||||
|
static const Event UPDATE_AVAILABLE_FAILED = MAKE_EVENT(2, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Supervisor handler failed to transfer an update space packet.
|
||||||
|
//! P1: Parameter holds the number of update packets already sent (inclusive the failed packet)
|
||||||
|
static const Event UPDATE_TRANSFER_FAILED = MAKE_EVENT(3, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Supervisor failed to execute the update verify command.
|
||||||
|
static const Event UPDATE_VERIFY_FAILED = MAKE_EVENT(4, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] MPSoC update successful completed
|
||||||
|
static const Event UPDATE_FINISHED = MAKE_EVENT(5, severity::INFO);
|
||||||
|
|
||||||
|
static const uint32_t QUEUE_SIZE = config::PLOC_UPDATER_QUEUE_SIZE;
|
||||||
|
static const size_t MAX_PLOC_UPDATE_PATH = 50;
|
||||||
|
static const size_t SD_PREFIX_LENGTH = 8;
|
||||||
|
// Maximum size of update payload data per space packet (max size of space packet is 1024 bytes)
|
||||||
|
static const size_t MAX_SP_DATA = 1016;
|
||||||
|
|
||||||
|
static const uint32_t TOPBIT_32 = (1 << 31);
|
||||||
|
static const uint32_t POLYNOMIAL_32 = 0x04C11DB7;
|
||||||
|
static const uint32_t INITIAL_REMAINDER_32 = 0xFFFFFFFF;
|
||||||
|
static const uint32_t FINAL_XOR_VALUE_32 = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
MessageQueueIF* commandQueue = nullptr;
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
|
SdCardManager* sdcMan = nullptr;
|
||||||
|
#endif
|
||||||
|
CommandActionHelper commandActionHelper;
|
||||||
|
|
||||||
|
ActionHelper actionHelper;
|
||||||
|
|
||||||
|
enum class State : uint8_t {
|
||||||
|
IDLE,
|
||||||
|
UPDATE_AVAILABLE,
|
||||||
|
UPDATE_TRANSFER,
|
||||||
|
UPDATE_VERIFY,
|
||||||
|
COMMAND_EXECUTING
|
||||||
|
};
|
||||||
|
|
||||||
|
State state = State::IDLE;
|
||||||
|
|
||||||
|
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
||||||
|
|
||||||
|
enum class Image : uint8_t { NONE, A, B };
|
||||||
|
|
||||||
|
Image image = Image::NONE;
|
||||||
|
|
||||||
|
enum class Partition : uint8_t { NONE, UBOOT, BITSTREAM, LINUX_OS, APP_SW };
|
||||||
|
|
||||||
|
Partition partition = Partition::NONE;
|
||||||
|
|
||||||
|
uint32_t packetsSent = 0;
|
||||||
|
uint32_t remainingPackets = 0;
|
||||||
|
// Number of packets required to transfer the update image
|
||||||
|
uint32_t numOfUpdatePackets = 0;
|
||||||
|
|
||||||
|
std::string updateFile;
|
||||||
|
uint32_t imageSize = 0;
|
||||||
|
uint32_t imageCrc = 0;
|
||||||
|
|
||||||
|
void readCommandQueue();
|
||||||
|
void doStateMachine();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Extracts the path and name of the update image from the service 8 command data.
|
||||||
|
*/
|
||||||
|
ReturnValue_t getImageLocation(const uint8_t* data, size_t size);
|
||||||
|
|
||||||
|
ReturnValue_t checkNameLength(size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prepares and sends update available command to PLOC supervisor handler.
|
||||||
|
*/
|
||||||
|
void commandUpdateAvailable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prepares and sends and update packet to the PLOC supervisor handler.
|
||||||
|
*/
|
||||||
|
void commandUpdatePacket();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prepares and sends the update verification packet to the PLOC supervisor handler.
|
||||||
|
*/
|
||||||
|
void commandUpdateVerify();
|
||||||
|
|
||||||
|
void calcImageCrc();
|
||||||
|
|
||||||
|
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MISSION_DEVICES_PLOCUPDATER_H_ */
|
||||||
28
bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h
Normal file
28
bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_
|
||||||
|
#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_
|
||||||
|
|
||||||
|
#include <fsfw/src/fsfw/serialize/SerialLinkedListAdapter.h>
|
||||||
|
|
||||||
|
class MemoryParams : public SerialLinkedListAdapter<SerializeIF> {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
* @param startAddress Start of address range to dump
|
||||||
|
* @param endAddress End of address range to dump
|
||||||
|
*/
|
||||||
|
MemoryParams(uint32_t startAddress, uint32_t endAddress)
|
||||||
|
: startAddress(startAddress), endAddress(endAddress) {
|
||||||
|
setLinks();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setLinks() {
|
||||||
|
setStart(&startAddress);
|
||||||
|
startAddress.setNext(&endAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
SerializeElement<uint32_t> startAddress;
|
||||||
|
SerializeElement<uint32_t> endAddress;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_ */
|
||||||
1546
bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h
Normal file
1546
bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
|
||||||
gpioCallbacks.cpp
|
|
||||||
)
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user