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