Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 1 | |
Zane Shelley | 3a02e24 | 2020-05-08 16:25:36 -0500 | [diff] [blame] | 2 | #include <hei_includes.hpp> |
Zane Shelley | 7bf1f6d | 2019-10-18 16:03:51 -0500 | [diff] [blame] | 3 | #include <isolator/hei_isolation_node.hpp> |
Zane Shelley | ca9f625 | 2019-10-25 21:17:30 -0500 | [diff] [blame] | 4 | #include <isolator/hei_isolator.hpp> |
Zane Shelley | 75e68e9 | 2019-10-18 16:16:23 -0500 | [diff] [blame] | 5 | #include <register/hei_hardware_register.hpp> |
Zane Shelley | fc7ab19 | 2019-09-27 15:45:16 -0500 | [diff] [blame] | 6 | #include <util/hei_flyweight.hpp> |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 7 | |
Zane Shelley | 75e68e9 | 2019-10-18 16:16:23 -0500 | [diff] [blame] | 8 | // BEGIN temporary code |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 9 | #include <isolator/hei_isolation_node.hpp> |
Zane Shelley | b0559b9 | 2019-12-05 22:18:20 -0600 | [diff] [blame] | 10 | #include <register/hei_operator_register.hpp> |
Zane Shelley | 75e68e9 | 2019-10-18 16:16:23 -0500 | [diff] [blame] | 11 | #include <register/hei_scom_register.hpp> |
| 12 | // END temporary code |
| 13 | |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 14 | namespace libhei |
| 15 | { |
| 16 | |
Zane Shelley | 3a02e24 | 2020-05-08 16:25:36 -0500 | [diff] [blame] | 17 | //------------------------------------------------------------------------------ |
| 18 | |
| 19 | // Definitions for the interfaces defined in hei_main.hpp. |
| 20 | |
| 21 | void initialize(void* i_buffer, size_t i_bufferSize) |
| 22 | { |
| 23 | Isolator::getSingleton().initialize(i_buffer, i_bufferSize); |
| 24 | } |
| 25 | |
| 26 | void uninitialize() |
| 27 | { |
| 28 | Isolator::getSingleton().uninitialize(); |
| 29 | } |
| 30 | |
| 31 | void isolate(const std::vector<Chip>& i_chipList, IsolationData& o_isoData) |
| 32 | { |
| 33 | Isolator::getSingleton().isolate(i_chipList, o_isoData); |
| 34 | } |
| 35 | |
| 36 | //------------------------------------------------------------------------------ |
| 37 | |
Zane Shelley | dd109cc | 2020-04-30 21:41:41 -0500 | [diff] [blame] | 38 | void Isolator::initialize(void* i_buffer, size_t i_bufferSize) |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 39 | { |
Zane Shelley | 4c15552 | 2020-05-05 13:53:10 -0500 | [diff] [blame] | 40 | // TODO |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | void Isolator::uninitialize() |
| 44 | { |
Zane Shelley | 7bf1f6d | 2019-10-18 16:03:51 -0500 | [diff] [blame] | 45 | // 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 Shelley | d0af358 | 2019-09-19 10:48:59 -0500 | [diff] [blame] | 49 | // Must flush the hardware register cache before deleting any |
| 50 | // HardwareRegister objects. |
| 51 | HardwareRegister::flushAll(); |
| 52 | |
Zane Shelley | 7bf1f6d | 2019-10-18 16:03:51 -0500 | [diff] [blame] | 53 | // Remove all of the HardwareRegister objects stored in the flyweights. |
Zane Shelley | 8deb090 | 2019-10-14 15:52:27 -0500 | [diff] [blame] | 54 | Flyweight<ScomRegister>::getSingleton().clear(); |
| 55 | Flyweight<IdScomRegister>::getSingleton().clear(); |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 56 | } |
| 57 | |
Zane Shelley | 229c155 | 2020-05-04 22:44:15 -0500 | [diff] [blame] | 58 | void Isolator::isolate(const std::vector<Chip>& i_chipList, |
| 59 | IsolationData& o_isoData) const |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 60 | { |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 61 | // Flush the isolation data to ensure a clean slate. |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 62 | o_isoData.flush(); |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 63 | |
Zane Shelley | d0af358 | 2019-09-19 10:48:59 -0500 | [diff] [blame] | 64 | // Flush the hardware register cache to avoid using stale data. |
| 65 | HardwareRegister::flushAll(); |
| 66 | |
Zane Shelley | 61565dc | 2019-09-18 21:57:10 -0500 | [diff] [blame] | 67 | // Analyze active error on each chip. |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 68 | for (const auto& chip : i_chipList) |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 69 | { |
Zane Shelley | 4c15552 | 2020-05-05 13:53:10 -0500 | [diff] [blame] | 70 | // TODO |
Zane Shelley | 83da245 | 2019-10-25 15:45:34 -0500 | [diff] [blame] | 71 | HEI_INF("Isolator::isolate(%p,%u)", chip.getChip(), chip.getType()); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 72 | } |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | } // end namespace libhei |