/*{{{ TransformerInitialize*/ static int TransformerInitialize(struct MMEContext_s *Context) { EVENT_LOG_InitTransformerParam_t EventLogInitParams = {0}; MME_TransformerInitParams_t MMEInitParams = {0}; MME_ERROR MMEStatus; int Status; Status = VerifyCapabilities(Context); if (Status != 0) return Status; EventLogInitParams.StructSize = sizeof(EVENT_LOG_InitTransformerParam_t); EventLogInitParams.TimeCodeMemoryAddress = Context->ClockAddress; MMEInitParams.Priority = MME_PRIORITY_LOWEST; MMEInitParams.StructSize = sizeof(MME_TransformerInitParams_t); MMEInitParams.Callback = &TransformerCallback; MMEInitParams.CallbackUserData = Context; MMEInitParams.TransformerInitParamsSize = sizeof(EVENT_LOG_InitTransformerParam_t); MMEInitParams.TransformerInitParams_p = (MME_GenericParams_t)(&EventLogInitParams); MMEStatus = MME_InitTransformer(Context->TransformerName, &MMEInitParams, &Context->MMEHandle); if (MMEStatus != MME_SUCCESS) { MONITOR_ERROR("%s: Failed to initialize transformer - Error 0x%08x.\n", Context->TransformerName, MMEStatus); return -EFAULT; } Context->TransformerInitialized = true; return 0; }
Status Activate() { RETURN_STATUS_IF_ERR(MapRegisters(m_hpetRegisters)); RETURN_STATUS_IF_ERR(VerifyCapabilities(m_frequency, m_counterBits)); // start the counter (if not already running) Write64(CONFIG, Read64(CONFIG)|1); // note: to avoid interfering with any other users of the timer // (e.g. Vista QPC), we don't reset the counter value to 0. return INFO::OK; }