-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/ldax control block #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
84eba63
rebased with dev
varunchennamadhava 0a1962f
ruff check
varunchennamadhava e55af2a
commit for testing PR comments 1
varunchennamadhava 4b3e4e3
leonard call 1
varunchennamadhava 99f3b37
clang and casting done correctly
varunchennamadhava 06816db
removed test cases
varunchennamadhava 28b88e1
made changes leonard suggested 2
varunchennamadhava 5cb08b5
removed one test case 1
varunchennamadhava 3e650e3
removed p_next_ldax since its not being used anywhere
varunchennamadhava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| #include "ldax.hpp" | ||
|
|
||
| #include <cvt.h> | ||
| #include <ihaascb.h> | ||
| #include <ihaassb.h> | ||
| #include <ihaldax.h> | ||
| #include <ihapsa.h> | ||
|
|
||
| #include <cstdint> | ||
| #include <nlohmann/json.hpp> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "asvt.hpp" | ||
| #include "logger.hpp" | ||
|
|
||
| namespace CBXP { | ||
|
|
||
| nlohmann::json LDAX::get(const void* p_control_block, | ||
| const size_t buffer_length) { | ||
| LDAX::checkDataLength(buffer_length); | ||
| const struct ldax* p_ldax; | ||
| nlohmann::json ldax_json = {}; | ||
| if (p_control_block == nullptr) { | ||
| // PSA starts at address 0 | ||
| const struct psa* __ptr32 p_psa = 0; | ||
|
|
||
| const struct cvtmap* __ptr32 p_cvtmap = | ||
| // cppcheck-suppress nullPointer | ||
| static_cast<struct cvtmap* __ptr32>(p_psa->flccvt); | ||
|
|
||
| const asvt_t* __ptr32 p_asvt = | ||
| static_cast<asvt_t* __ptr32>(p_cvtmap->cvtasvt); | ||
|
|
||
| ldax_json["ldaxs"] = std::vector<nlohmann::json>(); | ||
| std::vector<nlohmann::json>& ldaxs = | ||
| ldax_json["ldaxs"].get_ref<std::vector<nlohmann::json>&>(); | ||
|
|
||
| ldaxs.reserve(p_asvt->asvtmaxu); | ||
|
|
||
| const uint32_t* __ptr32 p_ascb_addr = | ||
| reinterpret_cast<const uint32_t* __ptr32>(&(p_asvt->asvtenty)); | ||
|
|
||
| for (int i = 0; i < p_asvt->asvtmaxu; i++) { | ||
| if (0x80000000 & *p_ascb_addr) { | ||
| Logger::getInstance().debug(formatter_.getHex<uint32_t>(p_ascb_addr) + | ||
| " is not a valid ASCB address"); | ||
| p_ascb_addr++; | ||
| continue; | ||
| } | ||
|
|
||
| // Cast ASCB address into ASCB pointer | ||
| const struct ascb* __ptr32 p_ascb = | ||
| reinterpret_cast<const struct ascb* __ptr32>(*p_ascb_addr); | ||
|
|
||
| // Get ASSB from ASCB | ||
| const struct assb* __ptr32 p_assb = | ||
| reinterpret_cast<const struct assb* __ptr32>(p_ascb->ascbassb); | ||
|
|
||
| nlohmann::json next_ldax = | ||
| LDAX::get(*reinterpret_cast<const void* const*>(p_assb->assbldax)); | ||
| if (!next_ldax.is_null()) { | ||
| ldaxs.push_back(next_ldax); | ||
| } | ||
|
|
||
| p_ascb_addr++; | ||
| } | ||
|
|
||
| return ldaxs; | ||
| } else { | ||
| p_ldax = static_cast<const struct ldax*>(p_control_block); | ||
| } | ||
|
|
||
| Logger::getInstance().debug("ldax hex dump:"); | ||
| Logger::getInstance().hexDump(reinterpret_cast<const char*>(p_ldax), | ||
| sizeof(struct ldax)); | ||
|
|
||
| ldax_json["ldax_id"] = formatter_.getString(p_ldax->ldax_id, 4); | ||
| ldax_json["ldax_version"] = | ||
| formatter_.getBitmap<uint8_t>(p_ldax->ldax_version); | ||
| ldax_json["ldax_ldaascb"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldaascb)); | ||
| ldax_json["ldax_ldastrta"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldastrta)); | ||
| ldax_json["ldax_ldasiza"] = p_ldax->ldax_ldasiza; | ||
| ldax_json["ldax_ldaestra"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldaestra)); | ||
| ldax_json["ldax_ldaesiza"] = p_ldax->ldax_ldaesiza; | ||
| ldax_json["ldax_ldacrgtp"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldacrgtp)); | ||
| ldax_json["ldax_ldaergtp"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldaergtp)); | ||
| ldax_json["ldax_ldalimit"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldalimit)); | ||
| ldax_json["ldax_ldavvrg"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldavvrg)); | ||
| ldax_json["ldax_ldaelim"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldaelim)); | ||
| ldax_json["ldax_ldaevvrg"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldaevvrg)); | ||
| ldax_json["ldax_ldaloal"] = | ||
| formatter_.getBitmap<uint32_t>(p_ldax->ldax_ldaloal); | ||
| ldax_json["ldax_ldahial"] = | ||
| formatter_.getBitmap<uint32_t>(p_ldax->ldax_ldahial); | ||
| ldax_json["ldax_ldaeloal"] = | ||
| formatter_.getBitmap<uint32_t>(p_ldax->ldax_ldaeloal); | ||
| ldax_json["ldax_ldaehial"] = | ||
| formatter_.getBitmap<uint32_t>(p_ldax->ldax_ldaehial); | ||
| ldax_json["ldax_tcthwm"] = p_ldax->ldax_tcthwm; | ||
| ldax_json["ldax_tctlwm"] = p_ldax->ldax_tctlwm; | ||
| ldax_json["ldax_tctehwm"] = p_ldax->ldax_tctehwm; | ||
| ldax_json["ldax_tctelwm"] = p_ldax->ldax_tctelwm; | ||
| ldax_json["ldax_curhighbot"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_curhighbot)); | ||
| ldax_json["ldax_curehighbot"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_curehighbot)); | ||
| ldax_json["ldax_ldasmad"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldasmad)); | ||
| ldax_json["ldax_ldasmsz"] = | ||
| formatter_.getHex<uint32_t>(&(p_ldax->ldax_ldasmsz)); | ||
| ldax_json["ldax_obtainshomespace"] = p_ldax->ldax_obtainshomespace; | ||
|
|
||
| if (LDAX::matchFilter(ldax_json)) { | ||
| return ldax_json; | ||
| } else { | ||
| return {}; | ||
| } | ||
| } | ||
|
|
||
| } // namespace CBXP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #ifndef __LDAX_H_ | ||
| #define __LDAX_H_ | ||
|
|
||
| #include <ihaldax.h> | ||
|
|
||
| #include "control_block.hpp" | ||
|
|
||
| namespace CBXP { | ||
|
|
||
| class LDAX : public ControlBlock { | ||
| public: | ||
| nlohmann::json get(const void* p_control_block = nullptr, | ||
| const size_t buffer_length = 0) override; | ||
| explicit LDAX(const cbxp_options_t& cbxp_options) | ||
| : ControlBlock("ldax", {}, cbxp_options, sizeof(struct ldax)) {} | ||
| }; | ||
|
|
||
| } // namespace CBXP | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.