3 Replies Latest reply on Apr 29, 2010 12:21 AM by saikamaldoss

    ADL Fan speed GET and SET

    saikamaldoss
      not working and dont know how to set settings for my card in c#

      I have been working on this ADL SDK for past 8 months and not getting anywhere.

      I am getting ODclock info get and ODper_get etc but FAN control get & Set is not working and i can get ODclockinfo but not able to set and not sure how to do its function and how to store values in the srtuct.

       

      internal delegate int ADL_Overdrive5_ODPerformanceLevels_Get( int AdapterIndex, int iDefault, IntPtr lpOdPerformanceLevels);

      ?

      [StructLayout(LayoutKind.Sequential)]

      internal struct ADLODPerformanceLevel

      {

      internal int iEngineClock;

      internal int iMemoryClock;

      internal int iVddc;

      }

      [StructLayout(LayoutKind.Sequential)]

      internal struct ADLODPerformanceLevel aLevels

      {

      internal DisplayID;

      internal int iSize;

      internal int iReserved;

      internal ADLODPerformanceLevel aLevels;

      }

      ?

      [DllImport(Atiadlxx_FileName)]

      internal static extern int ADL_Overdrive5_ODPerformanceLevels_Get( int AdapterIndex, int iDefault, IntPtr lpOdPerformanceLevels);

      ?

      internal static ADL_Overdrive5_ODPerformanceLevels_Get ADL_Overdrive5_ODPerformanceLevels_Get { get { if (!ADL_Overdrive5_ODPerformanceLevels_Get_Check && null == ADL_Overdrive5_ODPerformanceLevels_Get_) { ADL_Overdrive5_ODPerformanceLevels_Get_Check = true; if (ADLCheckLibrary.IsFunctionValid("ADL_Overdrive5_ODPerformanceLevels_Get")) { ADL_Overdrive5_ODPerformanceLevels_Get_ = ADLImport.ADL_Overdrive5_ODPerformanceLevels_Get; } } return ADL_Overdrive5_ODPerformanceLevels_Get_; } } private static ADL_Overdrive5_ODPerformanceLevels_Get ADL_Overdrive5_ODPerformanceLevels_Get_ = null; private static bool ADL_Overdrive5_ODPerformanceLevels_Get_Check = false;

       ++++++++++++++++++++++++++++++++++++++++++++++

       

      But i dont know if the Struct that i gave is right and how to wright function to Set clock...

      Please help me guys

        • ADL Fan speed GET and SET
          Byron

          Fan Get & Set will work only if the CAPS indicate the GPU Board supports it.

          Not all boards support API controlled Fan Speed

          Also, you mention OD5 Performance Levels, these APIs and struct have nothing to do with Fan Speed. 

          The Performance Levels refer to the N states (typically 3) that a GPU may be in (Idle, Moderate, Busy such as playing a game), and in each state, the GPU will read from a different record in the table (each record holds a value for GPU clock, GPU voltage, memory clock).

           

            • ADL Fan speed GET and SET
              Byron

              In the API document, one of the field’s documentation provides this support. 

              Items:  API, Structure, iFlags field description. 

              Here:

               

              int ADL_Overdrive5_FanSpeedInfo_Get

              (

              int 

              iAdapterIndex,

                

              int 

              iThermalControllerIndex,

                

              ADLFanSpeedInfo

              lpFanSpeedInfo

               

               

              )

                 

              Function to retrieve the fan speed reporting capability for thermal controllers.

              This function retrieves the fan speed reporting capability for a specified adapter and thermal controller.

              Supported Platforms:

              Linux and Windows(XP, Vista and Windows 7); 32bit and 64bit

              Parameters:

              [in] 

              iAdapterIndex 

              The ADL index handle of the desired adapter.

              [in] 

              iThermalControllerIndex 

              The ADL index handle of the desired thermal controller. Set to 0.

              [in,out] 

              lpFanSpeedInfo 

              The pointer to the ADLFanSpeedInfo structure storing the retrieved fan speed information.

              Returns:

              If the function succeeds, the return value is ADL_OK. Otherwise the return value is an ADL error code. Result Codes

               

               

               

              ADLFanSpeedInfo Struct Reference

              Structure containing information about thermal controller fan speed. More...

              Data Fields

              int 

              iSize

               

              Must be set to the size of the structure.

              int 

              iFlags

               

              Fan speed cotrol

              int 

              iMinPercent

               

              Minimum possible fan speed value in percents.

              int 

              iMaxPercent

               

              Maximum possible fan speed value in percents.

              int 

              iMinRPM

               

              Minimum possible fan speed value in RPM.

              int 

              iMaxRPM

               

              Maximum possible fan speed value in RPM.

              Detailed Description

              Structure containing information about thermal controller fan speed.

              This structure is used to store information about thermal controller fan speed. This structure is used by the ADL_PM_FanSpeedInfo_Get() function.

               

               

               

               

               

              Detailed Description

              Values for ADLFanSpeedInfo.iFlags

              Define Documentation

              #define ADL_DL_FANCTRL_SUPPORTS_PERCENT_READ   1

              #define ADL_DL_FANCTRL_SUPPORTS_PERCENT_WRITE   2

               

              #define ADL_DL_FANCTRL_SUPPORTS_RPM_READ   4

              #define ADL_DL_FANCTRL_SUPPORTS_RPM_WRITE   8

               

                • ADL Fan speed GET and SET
                  saikamaldoss

                  My card is 5770 and i also have a 4850 and

                  is this Struct right ??

                   

                   

                      #region ADLFanSpeedValue
                      [StructLayout(LayoutKind.Sequential)]
                      internal struct ADLFanSpeedValue
                      {
                          int Size;
                          internal int SpeedType;
                          internal int FanSpeed;
                          internal int Flags;
                      }
                      [StructLayout(LayoutKind.Sequential)]
                      internal struct ADLFanSpeedValueArray
                      {
                          [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)ADL.ADL_MAX_ADAPTERS)]
                          internal ADLFanSpeedValue[] ADLFanSpeedValue;
                      }
                      #endregion ADLFanSpeedValue

                   

                   

                          #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

                          #endregion Export Functions

                   

                  And on my GUI have

                   

                                                              ADLFanSpeedValue oneFanval = new ADLFanSpeedValue();
                                                              if (null != ADL.ADL_Overdrive5_FanSpeed_Get)
                                                              {
                                                                  IntPtr FanvBuffer = IntPtr.Zero;
                                                                  int fv = Marshal.SizeOf(OSADLFansv);
                                                                  FanvBuffer = Marshal.AllocCoTaskMem((int)fv);
                                                                  Marshal.StructureToPtr(OSADLFansv, FanvBuffer, false);

                                                                  ADLRet = ADL.ADL_Overdrive5_FanSpeed_Get(OSAdapterInfoData.ADLAdapterInfo.AdapterIndex, 0, FanvBuffer);

                                                                      List FanvlData = new List();

                                                                      oneFanval = (ADLFanSpeedValue)Marshal.PtrToStructure(FanvBuffer, oneFanval.GetType());
                                                                      FanvlData.Add(oneFanval);


                  Can you please chack and tell if it is right.. i am stuck at this for a year now

                   

                  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

                   

                  i tried fanspeedinfo

                   

                      internal delegate int ADL_Overdrive5_FanSpeedInfo_Get(int AdapterIndex, int ThermalControllerIndex, IntPtr FanSpeedInfo);

                   

                      #region ADLFanSpeedInfo
                      [StructLayout(LayoutKind.Sequential)]
                      internal struct ADLFanSpeedInfo
                      {
                          internal int iSize;
                          internal int iFlags;
                          internal int iMinPercent;
                          internal int iMaxPercent;
                          internal int iMinRPM;
                          internal int iMaxRPM;
                      }
                      [StructLayout(LayoutKind.Sequential)]
                      internal struct ADLFanSpeedInfoArray
                      {
                          [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)ADL.ADL_MAX_ADAPTERS)]
                          internal ADLFanSpeedInfo[] ADLFanSpeedInfo;
                      }
                      #endregion ADLFanSpeedInfo

                   

                          internal const int ADL_DL_FANCTRL_SUPPORTS_RPM_WRITE = 8;
                          internal const int ADL_DL_FANCTRL_SPEED_TYPE_PERCENT = 1;
                          internal const int ADL_DL_FANCTRL_SPEED_TYPE_RPM = 2;
                          internal const int ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED = 1;

                              [DllImport(Atiadlxx_FileName)]
                              internal static extern int ADL_Overdrive5_FanSpeedInfo_Get(int AdapterIndex, int ThermalControllerIndex, IntPtr FanSpeedInfo);

                  #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

                   

                  When i run it with the following...

                                                                      if (ADL.ADL_SUCCESS == ADLRet)
                                                                      {
                                                                          List<ADLFanSpeedInfo> FaninfData = new List<ADLFanSpeedInfo>();
                                                                          oneFaninf = (ADLFanSpeedInfo)Marshal.PtrToStructure(FaninfBuffer, oneFaninf.GetType());
                                                                          FaninfData.Add(oneFaninf);

                                                                          ADLFanSpeedValue oneFanval = new ADLFanSpeedValue();
                                                                          if (null != ADL.ADL_Overdrive5_FanSpeed_Get)
                                                                          {
                                                                              IntPtr FanvBuffer = IntPtr.Zero;
                                                                              int fv = Marshal.SizeOf(OSADLFansv);
                                                                              FanvBuffer = Marshal.AllocCoTaskMem((int)fv);
                                                                              Marshal.StructureToPtr(OSADLFansv, FanvBuffer, false);

                                                                              ADLRet = ADL.ADL_Overdrive5_FanSpeed_Get(OSAdapterInfoData.ADLAdapterInfo.AdapterIndex, 0, FanvBuffer);

                                                                              List<ADLFanSpeedValue> FanvlData = new List<ADLFanSpeedValue>();
                                                                              oneFanval = (ADLFanSpeedValue)Marshal.PtrToStructure(FanvBuffer, oneFanval.GetType());
                                                                              FanvlData.Add(oneFanval);

                   

                  I get Flag 3

                   

                  I am suppose to get 8/1 0r 1/2 RPM OR PER read write.. why am i geting "3"

                  click here to see the pic