예제 #1
0
		private void applyButton_Click(object sender, EventArgs e)
		{
            //Brazos merge 
			//var controls = new PStateControl[5] { p0StateControl, p1StateControl, p2StateControl, nbp0StateControl, nbp1StateControl };

			var controls = new PStateControl[10] { p0StateControl, p1StateControl, p2StateControl, p3StateControl, p4StateControl, p5StateControl, 
                p6StateControl, p7StateControl, nbp0StateControl, nbp1StateControl };
            var statuscontrols = new StatusControl[1] { statusinfo };

			int lastModifiedControl = Array.FindLastIndex(controls, (c) => { return c.IsModified; } );
			if (lastModifiedControl < 0)
				return; // no control is modified

            //Brazos merge 
			/*if (lastModifiedControl > 2)
            {
                lastModifiedControl = 2; //checking CPU P-States only -> skip NB P-States
            }*/

			if (lastModifiedControl > 7)
            {
                lastModifiedControl = 7; //checking CPU P-States only -> skip NB P-States
            }
			for (int i = 1; i <= lastModifiedControl; i++)
			{
				// make sure the neighboring P-state on the left specifies a >= VID
				if (controls[i - 1].Vid < controls[i].Vid)
				{
					MessageBox.Show(string.Format("P{0}'s VID is greater than P{1}'s.", i, i - 1), "Invalid P-state settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
					tabControl1.SelectedIndex = i;
					return;
				}
            }

			timer1.Enabled = false;
            timer2.Enabled = false;

			//Brazos merge next five lines are commented out in BT
			// try to temporarily set the number of boosted (Turbo) P-states to 0
			bool turboEnabled = K10Manager.IsTurboEnabled();
			int boostedStates = K10Manager.GetNumBoostedStates();
			if (boostedStates != 0)
				K10Manager.SetTurbo(false);
			
			//Brazos merge 
			//for (int i = 0; i < 5; i++)
			for (int i = 0; i < 10; i++)
				controls[i].Save();

			//Brazos merge next two lines are commented out in BT
			if (turboEnabled)
				K10Manager.SetTurbo(true);

			//Brazos merge 
			//for (int i = 0; i < 5; i++)
			// refresh the P-states
            for (int i = 0; i < 10; i++)
                controls[i].LoadFromHardware();
                

            statuscontrols[0].LoadFromHardware();

			timer1.Enabled = true;
            timer2.Enabled = true;
		}
예제 #2
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            //Brazos merge
            //var controls = new PStateControl[5] { p0StateControl, p1StateControl, p2StateControl, nbp0StateControl, nbp1StateControl };

            var controls = new PStateControl[10] {
                p0StateControl, p1StateControl, p2StateControl, p3StateControl, p4StateControl, p5StateControl,
                p6StateControl, p7StateControl, nbp0StateControl, nbp1StateControl
            };
            var statuscontrols = new StatusControl[1] {
                statusinfo
            };

            int lastModifiedControl = Array.FindLastIndex(controls, (c) => { return(c.IsModified); });

            if (lastModifiedControl < 0)
            {
                return;                 // no control is modified
            }
            //Brazos merge

            /*if (lastModifiedControl > 2)
             * {
             * lastModifiedControl = 2; //checking CPU P-States only -> skip NB P-States
             * }*/

            if (lastModifiedControl > 7)
            {
                lastModifiedControl = 7; //checking CPU P-States only -> skip NB P-States
            }
            for (int i = 1; i <= lastModifiedControl; i++)
            {
                // make sure the neighboring P-state on the left specifies a >= VID
                if (controls[i - 1].Vid < controls[i].Vid)
                {
                    MessageBox.Show(string.Format("P{0}'s VID is greater than P{1}'s.", i, i - 1), "Invalid P-state settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabControl1.SelectedIndex = i;
                    return;
                }
            }

            timer1.Enabled = false;
            timer2.Enabled = false;

            //Brazos merge next five lines are commented out in BT
            // try to temporarily set the number of boosted (Turbo) P-states to 0
            bool turboEnabled  = K10Manager.IsTurboEnabled();
            int  boostedStates = K10Manager.GetNumBoostedStates();

            if (boostedStates != 0)
            {
                K10Manager.SetTurbo(false);
            }

            //Brazos merge
            //for (int i = 0; i < 5; i++)
            for (int i = 0; i < 10; i++)
            {
                controls[i].Save();
            }

            //Brazos merge next two lines are commented out in BT
            if (turboEnabled)
            {
                K10Manager.SetTurbo(true);
            }

            //Brazos merge
            //for (int i = 0; i < 5; i++)
            // refresh the P-states
            for (int i = 0; i < 10; i++)
            {
                controls[i].LoadFromHardware();
            }


            statuscontrols[0].LoadFromHardware();

            timer1.Enabled = true;
            timer2.Enabled = true;
        }