1 Reply Latest reply on Apr 11, 2009 9:16 AM by saikamaldoss

    ATI Fanspeed Control SDK related

    saikamaldoss
      ATI Fanspeed Control

      Hi,

      I am trying to implement the fan control. But it does not show me the expected result. I see that there is no information being stored  in my fanspeedinfo structure.
      the fanspeedinfo structure has the following
      internal struct ADLFanSpeedInfo
          {
              int Size;
              internal int iSize;
              internal int iFlags;
              internal int iMinPercent;
              internal int iMaxPercent;
              internal int iMinRPM;
              internal int iMaxRPM;
          }
      In the below listed code i tried to assign the iMinPercent value of the structure to a label, but it shows me 0(since there is no information for iMinPercent available in the structure).
       if (null != ADL.ADL_Adapter_AdapterInfo_Get)
                                  {
                                      ADLRet = ADL.ADL_Adapter_AdapterInfo_Get(AdapterBuffer, size);
                                      if (ADL.ADL_SUCCESS == ADLRet)
                                      {
                                          OSAdapterInfoData = (ADLAdapterInfoArray)Marshal.PtrToStructure(AdapterBuffer, OSAdapterInfoData.GetType());
                                          int IsActive = 0;
                                          for (int i = 0; i < NumberOfAdapters; i++)
                                          {
                                              if (null != ADL.ADL_Adapter_Active_Get)
                                                  ADLRet = ADL.ADL_Adapter_Active_Get(OSAdapterInfoData.ADLAdapterInfo.AdapterIndex, ref IsActive);
                                              if (ADL.ADL_SUCCESS == ADLRet)
                                              {
                                                  display_dev_lbl.Text =System.Convert.ToString(OSAdapterInfoData.ADLAdapterInfo
      .AdapterIndex);
                                                  //int value = OSAdapterInfoData.ADLAdapterInfo.AdapterIndex;
                                                  if (null != ADL.ADL_Overdrive5_FanSpeedInfo_Get)
                                                  {
                                                      IntPtr fanbuffer = IntPtr.Zero;
                                                      int sizefan = Marshal.SizeOf(OSFanSpeedData);
                                                      fanbuffer = Marshal.AllocCoTaskMem((int)sizefan);
                                                      Marshal.StructureToPtr(OSFanSpeedData, fanbuffer, false);
                                                      ADLFanSpeedInfoArray x = new ADLFanSpeedInfoArray();
                                                      ADLRet = ADL.ADL_Overdrive5_FanSpeedInfo_Get(OSAdapterInfoData.ADLAdapterInfo
      .AdapterIndex, 0, out x);
                                                      if (ADL.ADL_SUCCESS == ADLRet)
                                                      {
                                                          OSFanSpeedData = (ADLFanSpeedInfoArray)Marshal.PtrToStructure(fanbuffer, OSFanSpeedData.GetType());
                                                       fan_speed_lbl.Text = System.Convert.ToString(OSFanSpeedData.ADLFanSpeedInfo.iMinPercent);
                                                      }
                                                      else
                                                      {
                                                      }
                                                  }
                                              }
                                          }
                                      }
      Below are my delegate and enum declarations(in ADL.Cs) . Also other related info for your reference :
      [DllImport(Atiadlxx_FileName)]
                  internal static extern int ADL_Overdrive5_FanSpeed_Get(int iAdapterIndex, int iThermalControllerIndex,out ADLFanSpeedValue lpFanSpeedValue);
       [DllImport(Atiadlxx_FileName)]
                  public static extern int ADL_Overdrive5_FanSpeedInfo_Get(int iAdapterIndex, int iThermalControllerIndex,out ADLFanSpeedInfoArray lpFanSpeedInfo);
      internal delegate int ADL_Overdrive5_FanSpeedInfo_Get(int iAdapterIndex, int iThermalControllerIndex,out ADLFanSpeedInfoArray lpFanSpeedInfo);
       enum iFlags { ADL_DL_FANCTRL_SUPPORTS_PERCENT_READ = 1, ADL_DL_FANCTRL_SUPPORTS_PERCENT_WRITE = 2, ADL_DL_FANCTRL_SUPPORTS_RPM_READ = 4, ADL_DL_FANCTRL_SUPPORTS_RPM_WRITE = 8 }
      #region ADLFanSpeedInfo
          [StructLayout(LayoutKind.Sequential)]
          internal struct ADLFanSpeedInfo
          {
              int Size;
              internal int iSize;
              internal int iFlags;
              internal int iMinPercent;
              internal int iMaxPercent;
              internal int iMinRPM;
              internal int iMaxRPM;
          }
          #region ADLFanSpeedValue
          [StructLayout(LayoutKind.Sequential)]
          internal struct ADLFanSpeedValue
          {
              int Size;
              internal int iSize;
              internal int iSpeedType;
              internal int iFanSpeed;
              internal int iFlags;
          }
          #endregion ADLFanSpeedValue
       #region ADL_Overdrive5_FanSpeedInfo_Get
              internal static ADL_Overdrive5_FanSpeedInfo_Get ADL_Overdrive5_FanSpeedInfo_Get
              {
                  get
                  {
                      if (!ADL_Overdrive5_FanSpeedInfo_Get_Check && null == ADL_Overdrive5_FanSpeedInfo_Get_)
                      {
                          ADL_Overdrive5_FanSpeedInfo_Get_Check = true;
                          if (ADLCheckLibrary.IsFunctionValid("ADL_Overdrive5_FanSpeedInfo_Get"))
                          {
                              ADL_Overdrive5_FanSpeedInfo_Get_ = ADLImport.ADL_Overdrive5_FanSpeedInfo_Get;
                          }
                      }
                      return ADL_Overdrive5_FanSpeedInfo_Get_;
                  }
              }
              private static ADL_Overdrive5_FanSpeedInfo_Get ADL_Overdrive5_FanSpeedInfo_Get_ = null;
              private static bool ADL_Overdrive5_FanSpeedInfo_Get_Check = false;
              #endregion ADL_Overdrive5_FanSpeedInfo_Get
              #region ADL_Overdrive5_FanSpeed_Get
              internal static ADL_Overdrive5_FanSpeed_Get ADL_Overdrive5_FanSpeed_Get
              {
                  get
                  {
                      if (!ADL_Overdrive5_FanSpeed_Get_Check && null == ADL_Overdrive5_FanSpeed_Get_)
                      {
                          ADL_Overdrive5_FanSpeed_Get_Check = true;
                          if (ADLCheckLibrary.IsFunctionValid("ADL_Overdrive5_FanSpeed_Get"))
                          {
                              ADL_Overdrive5_FanSpeed_Get_ = ADLImport.ADL_Overdrive5_FanSpeed_Get;
                          }
                      }
                      return ADL_Overdrive5_FanSpeed_Get_;
                  }
              }
              private static ADL_Overdrive5_FanSpeed_Get ADL_Overdrive5_FanSpeed_Get_ = null;
              private static bool ADL_Overdrive5_FanSpeed_Get_Check = false;
              #endregion ADL_Overdrive5_FanSpeed_Get

      I hope someone can help me in completing this tool .

      Thanks in advance.

       

      here is the tool that i'm working on... http://www.ngohq.com/skd-s-corner/15719-skd-stt-tray-tool.html

      Regards
      SaiKamalDoss

        • ATI Fanspeed Control SDK related
          saikamaldoss

          And also I noticed that ADL_Overdrive5_FanSpeedInfo_Get fuction is returning null and that is why the strucrue also shows null values. Can someone tell me how to fix this??  Or is that the driver does not support the function???

           internal static ADL_Overdrive5_FanSpeedInfo_Get ADL_Overdrive5_FanSpeedInfo_Get
                  {

                      get
                      {
                          if (!ADL_Overdrive5_FanSpeedInfo_Get_Check && null == )
                          {
                              ADL_Overdrive5_FanSpeedInfo_Get_Check = true;
                              if (ADLCheckLibrary.IsFunctionValid("ADL_Overdrive5_FanSpeedInfo_Get"))
                              {
                                  ADL_Overdrive5_FanSpeedInfo_Get_ = ADLImport.ADL_Overdrive5_FanSpeedInfo_Get;
                              }
                          }
                        return ADL_Overdrive5_FanSpeedInfo_Get_;             
                        
                      }
                  }

          SKD