blob: aea45df2d5f7fa9507d4ddd481603260d2eff4be [file] [log] [blame]
Zane Shelley5a266612019-08-15 16:23:53 -05001
2#include <isolator/hei_isolator.hpp>
Zane Shelley61565dc2019-09-18 21:57:10 -05003#include <register/hei_hardware_register.hpp>
Zane Shelley5a266612019-08-15 16:23:53 -05004
5namespace libhei
6{
7
8ReturnCode 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
21void Isolator::uninitialize()
22{
Zane Shelleyd0af3582019-09-19 10:48:59 -050023 // Must flush the hardware register cache before deleting any
24 // HardwareRegister objects.
25 HardwareRegister::flushAll();
26
Zane Shelley5a266612019-08-15 16:23:53 -050027 // BEGIN temporary code
28 HEI_INF( "Isolator::uninitialize()" );
29 // END temporary code
30}
31
Zane Shelleyb406de42019-09-09 16:10:38 -050032ReturnCode Isolator::isolate( const std::vector<Chip> & i_chipList,
33 IsolationData & o_isoData ) const
Zane Shelley5a266612019-08-15 16:23:53 -050034{
35 ReturnCode rc;
36
37 // Flush the isolation data to ensure a clean slate.
38 o_isoData.clear();
39
Zane Shelleyd0af3582019-09-19 10:48:59 -050040 // Flush the hardware register cache to avoid using stale data.
41 HardwareRegister::flushAll();
42
Zane Shelley61565dc2019-09-18 21:57:10 -050043 // Analyze active error on each chip.
Zane Shelleyb406de42019-09-09 16:10:38 -050044 for ( auto const & chip : i_chipList )
45 {
Zane Shelley61565dc2019-09-18 21:57:10 -050046 // 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 Shelleyb406de42019-09-09 16:10:38 -050051 HEI_INF( "Isolator::isolate(%p,%u)", chip.getChip(),
52 chip.getType() );
Zane Shelley61565dc2019-09-18 21:57:10 -050053 // END temporary code
54
55 // Clean up the hardware accessor chip to prevent accidental hardware
56 // access.
57 HardwareRegister::clearAccessor();
Zane Shelleyb406de42019-09-09 16:10:38 -050058 }
Zane Shelley5a266612019-08-15 16:23:53 -050059
60 return rc;
61}
62
63} // end namespace libhei