Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ECSS Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AcubeSat-OBC
ECSS Services
Commits
b443c78d
Unverified
Commit
b443c78d
authored
6 years ago
by
Dimitrios Stoupis
Browse files
Options
Downloads
Patches
Plain Diff
Initial code for TC[6,9] and TM[6,10]
parent
aadc2556
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+5
-5
5 additions, 5 deletions
CMakeLists.txt
inc/Services/MemoryManagementService.hpp
+21
-0
21 additions, 0 deletions
inc/Services/MemoryManagementService.hpp
src/Services/MemoryManagementService.cpp
+42
-0
42 additions, 0 deletions
src/Services/MemoryManagementService.cpp
with
68 additions
and
5 deletions
CMakeLists.txt
+
5
−
5
View file @
b443c78d
...
...
@@ -18,11 +18,11 @@ add_executable(ecss_services src/main.cpp src/Message.cpp src/Service.cpp
src/Services/TestService.cpp src/Services/MemoryManagementService.cpp
src/Services/RequestVerificationService.cpp
)
IF
(
EXISTS
"
${
PROJECT_SOURCE_DIR
}
/lib/Catch2/CMakeLists.txt"
)
IF
(
EXISTS
"
${
PROJECT_SOURCE_DIR
}
/lib/Catch2/CMakeLists.txt"
)
add_subdirectory
(
lib/Catch2
)
add_executable
(
tests src/Message.cpp src/Services/TestService.cpp
src/Services/RequestVerificationService.cpp src/Services/MemoryManagementService.cpp
test/tests.cpp test/Message.cpp test/TestPlatform.cpp test/Services/TestService.cpp
test/Services/MemoryManagementService.cpp test/Services/RequestVerificationService.cpp
)
src/Services/RequestVerificationService.cpp src/Services/MemoryManagementService.cpp
test/tests.cpp test/Message.cpp test/TestPlatform.cpp test/Services/TestService.cpp
test/Services/MemoryManagementService.cpp test/Services/RequestVerificationService.cpp
)
target_link_libraries
(
tests Catch2::Catch2
)
ENDIF
()
ENDIF
()
This diff is collapsed.
Click to expand it.
inc/Services/MemoryManagementService.hpp
+
21
−
0
View file @
b443c78d
#ifndef ECSS_SERVICES_MEMMANGSERVICE_HPP
#define ECSS_SERVICES_MEMMANGSERVICE_HPP
// Memory limits definitions
#define FIRST_ADRESS_FLASH 0x08000000
#define LAST_ADDRESS_FLASH 0x0801FFFF // todo: Define the last memory address based on the MCU
#define FIRST_ADDRESS_SRAM 0x20000000
#define SRAM_MEMORY_SIZE 16 // Specify the RAM size in kBytes
#include
"Service.hpp"
#include
<memory>
#include
<iostream>
...
...
@@ -36,6 +43,7 @@ public:
* @details This function loads new values to memory data areas
* specified in the request
* @param request: Provide the received message as a parameter
* @todo Only allow aligned memory address to be start addresses
*/
void
loadRawData
(
Message
&
request
);
...
...
@@ -47,8 +55,21 @@ public:
* @param request: Provide the received message as a parameter
* @todo In later embedded version, implement error checking for address validity for
* different memory types
* @todo Only allow aligned memory address to be start addresses
*/
void
dumpRawData
(
Message
&
request
);
/**
* TC[6,9] check raw memory data
*
* @details This function reads the raw data from the specified memory and
* triggers a TM[6,10] report
* @param request: Provide the received message as a parameter
* @todo In later embedded version, implement error checking for address validity for
* different memory types
* @todo Only allow aligned memory address to be start addresses
*/
void
checkRawData
(
Message
&
request
);
}
rawDataMemorySubservice
;
};
...
...
This diff is collapsed.
Click to expand it.
src/Services/MemoryManagementService.cpp
+
42
−
0
View file @
b443c78d
...
...
@@ -86,3 +86,45 @@ void MemoryManagementService::RawDataMemoryManagement::dumpRawData(Message &requ
mainService
.
storeMessage
(
report
);
// Save the report message
request
.
resetRead
();
// Reset the reading count
}
void
MemoryManagementService
::
RawDataMemoryManagement
::
checkRawData
(
Message
&
request
)
{
// Check if we have the correct packet
assert
(
request
.
serviceType
==
6
);
assert
(
request
.
messageType
==
9
);
// Create the report message object of telemetry message subtype 10
Message
report
=
mainService
.
createTM
(
10
);
// Variable declaration
uint8_t
readData
[
ECSS_MAX_STRING_SIZE
];
// Preallocate the array
uint8_t
memoryID
=
request
.
readEnum8
();
// Read the memory ID from the request
// todo: Add checks depending on the memory type
uint16_t
iterationCount
=
request
.
readUint16
();
// Get the iteration count
// Append the data to report message
report
.
appendEnum8
(
memoryID
);
// Memory ID
report
.
appendUint16
(
iterationCount
);
// Iteration count
// Iterate N times, as specified in the command message
for
(
std
::
size_t
j
=
0
;
j
<
iterationCount
;
j
++
)
{
uint64_t
startAddress
=
request
.
readUint64
();
// Data length to read
uint16_t
readLength
=
request
.
readUint16
();
// Start address for the memory read
// Read memory data and save them for checksum calculation
for
(
std
::
size_t
i
=
0
;
i
<
readLength
;
i
++
)
{
readData
[
i
]
=
*
(
reinterpret_cast
<
uint8_t
*>
(
startAddress
)
+
i
);
}
// This part is repeated N-times (N = iteration count)
report
.
appendUint64
(
startAddress
);
// Start address
report
.
appendUint16
(
readLength
);
// Save the read data
// todo: Calculate and append checksum in the report
//report.appendBits(16, /* checksum bits */);
}
// todo: implement and append the checksum part of the reporting packet
mainService
.
storeMessage
(
report
);
// Save the report message
request
.
resetRead
();
// Reset the reading count
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment