Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 1 | |
| 2 | #include <isolator/hei_isolator.hpp> |
Zane Shelley | 61565dc | 2019-09-18 21:57:10 -0500 | [diff] [blame] | 3 | #include <register/hei_hardware_register.hpp> |
Zane Shelley | fc7ab19 | 2019-09-27 15:45:16 -0500 | [diff] [blame] | 4 | #include <util/hei_flyweight.hpp> |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 5 | |
| 6 | namespace libhei |
| 7 | { |
| 8 | |
| 9 | ReturnCode Isolator::initialize( void * i_buffer, size_t i_bufferSize, |
| 10 | bool i_forceInit ) |
| 11 | { |
| 12 | ReturnCode rc; |
| 13 | |
| 14 | // BEGIN temporary code |
| 15 | HEI_INF( "Isolator::initialize(%p,%lu,%d)", i_buffer, i_bufferSize, |
| 16 | i_forceInit ); |
| 17 | // END temporary code |
| 18 | |
| 19 | return rc; |
| 20 | } |
| 21 | |
| 22 | void Isolator::uninitialize() |
| 23 | { |
Zane Shelley | d0af358 | 2019-09-19 10:48:59 -0500 | [diff] [blame] | 24 | // Must flush the hardware register cache before deleting any |
| 25 | // HardwareRegister objects. |
| 26 | HardwareRegister::flushAll(); |
| 27 | |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 28 | // BEGIN temporary code |
| 29 | HEI_INF( "Isolator::uninitialize()" ); |
| 30 | // END temporary code |
Zane Shelley | fc7ab19 | 2019-09-27 15:45:16 -0500 | [diff] [blame] | 31 | |
| 32 | // Remove all of the isolation objects stored in the flyweights. |
| 33 | Flyweight<HardwareRegister>::getSingleton().clear(); |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 34 | } |
| 35 | |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 36 | ReturnCode Isolator::isolate( const std::vector<Chip> & i_chipList, |
| 37 | IsolationData & o_isoData ) const |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 38 | { |
| 39 | ReturnCode rc; |
| 40 | |
| 41 | // Flush the isolation data to ensure a clean slate. |
| 42 | o_isoData.clear(); |
| 43 | |
Zane Shelley | d0af358 | 2019-09-19 10:48:59 -0500 | [diff] [blame] | 44 | // Flush the hardware register cache to avoid using stale data. |
| 45 | HardwareRegister::flushAll(); |
| 46 | |
Zane Shelley | 61565dc | 2019-09-18 21:57:10 -0500 | [diff] [blame] | 47 | // Analyze active error on each chip. |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 48 | for ( auto const & chip : i_chipList ) |
| 49 | { |
Zane Shelley | 61565dc | 2019-09-18 21:57:10 -0500 | [diff] [blame] | 50 | // In order to access hardware, we must tell the HardwareRegisters which |
| 51 | // chip to access. |
| 52 | HardwareRegister::setAccessor( chip ); |
| 53 | |
| 54 | // BEGIN temporary code |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 55 | HEI_INF( "Isolator::isolate(%p,%u)", chip.getChip(), |
| 56 | chip.getType() ); |
Zane Shelley | 61565dc | 2019-09-18 21:57:10 -0500 | [diff] [blame] | 57 | // END temporary code |
| 58 | |
| 59 | // Clean up the hardware accessor chip to prevent accidental hardware |
| 60 | // access. |
| 61 | HardwareRegister::clearAccessor(); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 62 | } |
Zane Shelley | 5a26661 | 2019-08-15 16:23:53 -0500 | [diff] [blame] | 63 | |
| 64 | return rc; |
| 65 | } |
| 66 | |
| 67 | } // end namespace libhei |