blob: dc4d09b7f4143f35caca4433dc0e3891cc6c2821 [file] [log] [blame]
Zane Shelley5a266612019-08-15 16:23:53 -05001
Zane Shelley3a02e242020-05-08 16:25:36 -05002#include <hei_includes.hpp>
Zane Shelley7bf1f6d2019-10-18 16:03:51 -05003#include <isolator/hei_isolation_node.hpp>
Zane Shelleyca9f6252019-10-25 21:17:30 -05004#include <isolator/hei_isolator.hpp>
Zane Shelley75e68e92019-10-18 16:16:23 -05005#include <register/hei_hardware_register.hpp>
Zane Shelleyfc7ab192019-09-27 15:45:16 -05006#include <util/hei_flyweight.hpp>
Zane Shelley5a266612019-08-15 16:23:53 -05007
Zane Shelley75e68e92019-10-18 16:16:23 -05008// BEGIN temporary code
Zane Shelley11b89942019-11-07 11:07:28 -06009#include <isolator/hei_isolation_node.hpp>
Zane Shelleyb0559b92019-12-05 22:18:20 -060010#include <register/hei_operator_register.hpp>
Zane Shelley75e68e92019-10-18 16:16:23 -050011#include <register/hei_scom_register.hpp>
12// END temporary code
13
Zane Shelley5a266612019-08-15 16:23:53 -050014namespace libhei
15{
16
Zane Shelley3a02e242020-05-08 16:25:36 -050017//------------------------------------------------------------------------------
18
19// Definitions for the interfaces defined in hei_main.hpp.
20
21void initialize(void* i_buffer, size_t i_bufferSize)
22{
23 Isolator::getSingleton().initialize(i_buffer, i_bufferSize);
24}
25
26void uninitialize()
27{
28 Isolator::getSingleton().uninitialize();
29}
30
31void isolate(const std::vector<Chip>& i_chipList, IsolationData& o_isoData)
32{
33 Isolator::getSingleton().isolate(i_chipList, o_isoData);
34}
35
36//------------------------------------------------------------------------------
37
Zane Shelleydd109cc2020-04-30 21:41:41 -050038void Isolator::initialize(void* i_buffer, size_t i_bufferSize)
Zane Shelley5a266612019-08-15 16:23:53 -050039{
Zane Shelley4c155522020-05-05 13:53:10 -050040 // TODO
Zane Shelley5a266612019-08-15 16:23:53 -050041}
42
43void Isolator::uninitialize()
44{
Zane Shelley7bf1f6d2019-10-18 16:03:51 -050045 // Remove all of the IsolationNode objects stored in the flyweights. This
46 // must be done before removing the HardwareRegister objects
47 Flyweight<IsolationNode>::getSingleton().clear();
48
Zane Shelleyd0af3582019-09-19 10:48:59 -050049 // Must flush the hardware register cache before deleting any
50 // HardwareRegister objects.
51 HardwareRegister::flushAll();
52
Zane Shelley7bf1f6d2019-10-18 16:03:51 -050053 // Remove all of the HardwareRegister objects stored in the flyweights.
Zane Shelley8deb0902019-10-14 15:52:27 -050054 Flyweight<ScomRegister>::getSingleton().clear();
55 Flyweight<IdScomRegister>::getSingleton().clear();
Zane Shelley5a266612019-08-15 16:23:53 -050056}
57
Zane Shelley229c1552020-05-04 22:44:15 -050058void Isolator::isolate(const std::vector<Chip>& i_chipList,
59 IsolationData& o_isoData) const
Zane Shelley5a266612019-08-15 16:23:53 -050060{
Zane Shelley5a266612019-08-15 16:23:53 -050061 // Flush the isolation data to ensure a clean slate.
Zane Shelley93b61ad2019-10-16 20:41:03 -050062 o_isoData.flush();
Zane Shelley5a266612019-08-15 16:23:53 -050063
Zane Shelleyd0af3582019-09-19 10:48:59 -050064 // Flush the hardware register cache to avoid using stale data.
65 HardwareRegister::flushAll();
66
Zane Shelley61565dc2019-09-18 21:57:10 -050067 // Analyze active error on each chip.
Zane Shelleyfe27b652019-10-28 11:33:07 -050068 for (const auto& chip : i_chipList)
Zane Shelleyb406de42019-09-09 16:10:38 -050069 {
Zane Shelley4c155522020-05-05 13:53:10 -050070 // TODO
Zane Shelley83da2452019-10-25 15:45:34 -050071 HEI_INF("Isolator::isolate(%p,%u)", chip.getChip(), chip.getType());
Zane Shelleyb406de42019-09-09 16:10:38 -050072 }
Zane Shelley5a266612019-08-15 16:23:53 -050073}
74
75} // end namespace libhei