Hello guys,
I'm new to this forum. I have an application that receives some video frames from a camera and one or more images I get from the camera are torn or shifted. I spoke with the camera vendor and they told me when the PC enters an Idle state it can interfere with the transmission of the images over the firewire.
So my problem is I need to make the application not enter C1-C3 States. I tried it on win7 and it seems to work fine with the code below but I can't seem to prevent it on XP.
Please help.
I'm new to this forum. I have an application that receives some video frames from a camera and one or more images I get from the camera are torn or shifted. I spoke with the camera vendor and they told me when the PC enters an Idle state it can interfere with the transmission of the images over the firewire.
So my problem is I need to make the application not enter C1-C3 States. I tried it on win7 and it seems to work fine with the code below but I can't seem to prevent it on XP.
Code: Select all
//WIN7
const DWORD DISABLED = 1;
const DWORD ENABLED = 0;
GUID *scheme;
PowerGetActiveScheme(NULL, &scheme);
PowerWriteACValueIndex(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_IDLE_DISABLE, DISABLED);
PowerSetActiveScheme(NULL, scheme);
unsigned int ActPwrSch;
DWORD currPolicy,newPolicy, curr1Policy,curr2Policy, new1Policy, new2Policy;
MACHINE_PROCESSOR_POWER_POLICY Policy;
if(GetActivePwrScheme(&ActPwrSch))
{
if(ReadProcessorPwrScheme(ActPwrSch,&Policy))
{
printf("Read Power Scheme:\n");
//if(Policy.ProcessorPolicyAc.DisableCStates!=0)
currPolicy = Policy.ProcessorPolicyAc.Policy[0].AllowPromotion;
curr1Policy = Policy.ProcessorPolicyAc.Policy[1].AllowPromotion;
curr2Policy = Policy.ProcessorPolicyAc.Policy[2].AllowPromotion;
Policy.ProcessorPolicyAc.Policy[0].AllowPromotion = 0;
Policy.ProcessorPolicyAc.Policy[1].AllowPromotion = 0;
Policy.ProcessorPolicyAc.Policy[2].AllowPromotion = 0;
newPolicy = Policy.ProcessorPolicyAc.Policy[0].AllowPromotion;
if(WriteProcessorPwrScheme(ActPwrSch,&Policy))
{
printf("WriteProcessorPwrScheme succeed\n");
if(SetActivePwrScheme(ActPwrSch,0,0))
{
printf("SetActivePwrScheme succeed!!\n");
}
}
}
Please help.