blob: 327da5482d45f18a73d6467d92542b63146fe351 [file] [log] [blame]
Zane Shelley5a266612019-08-15 16:23:53 -05001
Zane Shelley7bf1f6d2019-10-18 16:03:51 -05002#include <isolator/hei_isolation_node.hpp>
Zane Shelleyca9f6252019-10-25 21:17:30 -05003#include <isolator/hei_isolator.hpp>
Zane Shelley75e68e92019-10-18 16:16:23 -05004#include <register/hei_hardware_register.hpp>
Zane Shelleyfc7ab192019-09-27 15:45:16 -05005#include <util/hei_flyweight.hpp>
Zane Shelley5a266612019-08-15 16:23:53 -05006
Zane Shelley75e68e92019-10-18 16:16:23 -05007// BEGIN temporary code
Zane Shelley11b89942019-11-07 11:07:28 -06008#include <isolator/hei_isolation_node.hpp>
Zane Shelleyb0559b92019-12-05 22:18:20 -06009#include <register/hei_operator_register.hpp>
Zane Shelley75e68e92019-10-18 16:16:23 -050010#include <register/hei_scom_register.hpp>
11// END temporary code
12
Zane Shelley5a266612019-08-15 16:23:53 -050013namespace libhei
14{
15
Zane Shelleydd109cc2020-04-30 21:41:41 -050016void Isolator::initialize(void* i_buffer, size_t i_bufferSize)
Zane Shelley5a266612019-08-15 16:23:53 -050017{
Zane Shelley4c155522020-05-05 13:53:10 -050018 // TODO
Zane Shelley5a266612019-08-15 16:23:53 -050019}
20
21void Isolator::uninitialize()
22{
Zane Shelley7bf1f6d2019-10-18 16:03:51 -050023 // Remove all of the IsolationNode objects stored in the flyweights. This
24 // must be done before removing the HardwareRegister objects
25 Flyweight<IsolationNode>::getSingleton().clear();
26
Zane Shelleyd0af3582019-09-19 10:48:59 -050027 // Must flush the hardware register cache before deleting any
28 // HardwareRegister objects.
29 HardwareRegister::flushAll();
30
Zane Shelley7bf1f6d2019-10-18 16:03:51 -050031 // Remove all of the HardwareRegister objects stored in the flyweights.
Zane Shelley8deb0902019-10-14 15:52:27 -050032 Flyweight<ScomRegister>::getSingleton().clear();
33 Flyweight<IdScomRegister>::getSingleton().clear();
Zane Shelley5a266612019-08-15 16:23:53 -050034}
35
Zane Shelley229c1552020-05-04 22:44:15 -050036void Isolator::isolate(const std::vector<Chip>& i_chipList,
37 IsolationData& o_isoData) const
Zane Shelley5a266612019-08-15 16:23:53 -050038{
Zane Shelley5a266612019-08-15 16:23:53 -050039 // Flush the isolation data to ensure a clean slate.
Zane Shelley93b61ad2019-10-16 20:41:03 -050040 o_isoData.flush();
Zane Shelley5a266612019-08-15 16:23:53 -050041
Zane Shelleyd0af3582019-09-19 10:48:59 -050042 // Flush the hardware register cache to avoid using stale data.
43 HardwareRegister::flushAll();
44
Zane Shelley61565dc2019-09-18 21:57:10 -050045 // Analyze active error on each chip.
Zane Shelleyfe27b652019-10-28 11:33:07 -050046 for (const auto& chip : i_chipList)
Zane Shelleyb406de42019-09-09 16:10:38 -050047 {
Zane Shelley4c155522020-05-05 13:53:10 -050048 // TODO
Zane Shelley83da2452019-10-25 15:45:34 -050049 HEI_INF("Isolator::isolate(%p,%u)", chip.getChip(), chip.getType());
Zane Shelleyb406de42019-09-09 16:10:38 -050050 }
Zane Shelley5a266612019-08-15 16:23:53 -050051}
52
53} // end namespace libhei