00001 00027 #ifndef __NEW_SIM_H__ 00028 #define __NEW_SIM_H__ 00029 00030 00031 #include <sys/time.h> 00032 #include <stdio.h> 00033 #include <stdlib.h> 00034 #include <string.h> 00035 #include <unistd.h> 00036 00037 #ifndef __NEW_SIM_DOMAIN_H__ 00038 #include "new_sim_domain.h" 00039 #endif 00040 00042 #define dNewSimulatorMagic 0x47110815 00043 00049 class NewSimulator : public NewSimulatorDomain { 00051 unsigned int m_magic; 00053 oh_handler_state *m_handler; 00055 NewSimulatorEntityPath m_entity_root; 00056 00057 bool GetParams( GHashTable *handler_config ); 00058 00059 public: 00065 bool CheckMagic() { 00066 if ( m_magic == dNewSimulatorMagic ) return true; 00067 return false; 00068 } 00069 00076 bool CheckHandler( oh_handler_state *handler ) { 00077 if ( handler == m_handler ) return true; 00078 return false; 00079 } 00080 00081 virtual void IfEnter(); 00082 virtual void IfLeave(); 00083 00084 // openhpi abi interface functions 00085 virtual bool IfOpen( GHashTable *handler_config ); 00086 virtual void IfClose(); 00087 virtual SaErrorT IfGetEvent( oh_event *event ); 00088 virtual SaErrorT IfDiscoverResources(); 00089 00090 virtual SaErrorT IfSetResourceTag( NewSimulatorResource *ent, SaHpiTextBufferT *tag ); 00091 virtual SaErrorT IfSetResourceSeverity( NewSimulatorResource *res, SaHpiSeverityT sev ); 00092 00093 // hot swap 00094 virtual SaErrorT IfSetAutoInsertTimeout( SaHpiTimeoutT timeout); 00095 00096 virtual SaErrorT IfGetPowerState ( NewSimulatorResource *res, SaHpiPowerStateT &state ); 00097 virtual SaErrorT IfSetPowerState ( NewSimulatorResource *res, SaHpiPowerStateT state ); 00098 virtual SaErrorT IfGetIndicatorState( NewSimulatorResource *res, SaHpiHsIndicatorStateT &state ); 00099 virtual SaErrorT IfSetIndicatorState( NewSimulatorResource *res, SaHpiHsIndicatorStateT state ); 00100 virtual SaErrorT IfGetResetState ( NewSimulatorResource *res, SaHpiResetActionT &state ); 00101 virtual SaErrorT IfSetResetState ( NewSimulatorResource *res, SaHpiResetActionT state ); 00102 00103 virtual SaErrorT IfControlParm( NewSimulatorResource *res, SaHpiParmActionT act ); 00104 00106 cThreadLock m_event_lock; 00107 00108 virtual void AddHpiEvent( oh_event *event ); 00109 00115 virtual oh_evt_queue *GetHpiEventList() { return m_handler->eventq; } 00116 00117 NewSimulator(); 00118 ~NewSimulator(); 00119 00120 void SetHandler( oh_handler_state *handler ); 00121 oh_handler_state *GetHandler(); 00122 00123 virtual const NewSimulatorEntityPath &EntityRoot(); 00124 virtual SaHpiRptEntryT *FindResource( SaHpiResourceIdT id ); 00125 }; 00126 00127 00128 #endif