|
|
@ -9,32 +9,32 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "config.h" |
|
|
|
#include "config.h" |
|
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_ADL) && (defined(__linux) || defined (WIN32)) |
|
|
|
#if defined(HAVE_ADL) && (defined(__unix__) || defined (WIN32)) |
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <math.h> |
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CURSES |
|
|
|
#ifdef HAVE_CURSES |
|
|
|
#include <curses.h> |
|
|
|
# include <curses.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#include "miner.h" |
|
|
|
#include "miner.h" |
|
|
|
#include "ADL_SDK/adl_sdk.h" |
|
|
|
#include "ADL_SDK/adl_sdk.h" |
|
|
|
#include "compat.h" |
|
|
|
#include "compat.h" |
|
|
|
|
|
|
|
|
|
|
|
#if defined (__linux) |
|
|
|
#if defined (__unix__) |
|
|
|
#include <dlfcn.h> |
|
|
|
# include <dlfcn.h> |
|
|
|
#include <stdlib.h> |
|
|
|
# include <stdlib.h> |
|
|
|
#include <unistd.h> |
|
|
|
# include <unistd.h> |
|
|
|
#else /* WIN32 */ |
|
|
|
#else /* WIN32 */ |
|
|
|
#include <windows.h> |
|
|
|
# include <windows.h> |
|
|
|
#include <tchar.h> |
|
|
|
# include <tchar.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#include "adl_functions.h" |
|
|
|
#include "adl_functions.h" |
|
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_CURSES |
|
|
|
#ifndef HAVE_CURSES |
|
|
|
#define wlogprint(...) applog(LOG_WARNING, __VA_ARGS__) |
|
|
|
# define wlogprint(...) applog(LOG_WARNING, __VA_ARGS__) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
bool adl_active; |
|
|
|
bool adl_active; |
|
|
@ -69,7 +69,7 @@ static void __stdcall ADL_Main_Memory_Free (void **lpBuffer) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if defined (LINUX) |
|
|
|
#if defined (UNIX) |
|
|
|
// equivalent functions in linux
|
|
|
|
// equivalent functions in linux
|
|
|
|
static void *GetProcAddress(void *pLibrary, const char *name) |
|
|
|
static void *GetProcAddress(void *pLibrary, const char *name) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -114,7 +114,7 @@ static ADL_OVERDRIVE6_FANSPEED_SET ADL_Overdrive6_FanSpeed_Set; |
|
|
|
static ADL_OVERDRIVE6_STATE_SET ADL_Overdrive6_State_Set; |
|
|
|
static ADL_OVERDRIVE6_STATE_SET ADL_Overdrive6_State_Set; |
|
|
|
static ADL_OVERDRIVE6_POWERCONTROL_SET ADL_Overdrive6_PowerControl_Set; |
|
|
|
static ADL_OVERDRIVE6_POWERCONTROL_SET ADL_Overdrive6_PowerControl_Set; |
|
|
|
|
|
|
|
|
|
|
|
#if defined (LINUX) |
|
|
|
#if defined (UNIX) |
|
|
|
static void *hDLL; // Handle to .so library
|
|
|
|
static void *hDLL; // Handle to .so library
|
|
|
|
#else |
|
|
|
#else |
|
|
|
HINSTANCE hDLL; // Handle to DLL
|
|
|
|
HINSTANCE hDLL; // Handle to DLL
|
|
|
@ -266,7 +266,7 @@ static bool prepare_adl(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int result; |
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
#if defined (LINUX) |
|
|
|
#if defined (UNIX) |
|
|
|
hDLL = dlopen( "libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL); |
|
|
|
hDLL = dlopen( "libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL); |
|
|
|
#else |
|
|
|
#else |
|
|
|
hDLL = LoadLibrary("atiadlxx.dll"); |
|
|
|
hDLL = LoadLibrary("atiadlxx.dll"); |
|
|
@ -397,7 +397,7 @@ void init_adl(int nDevs) |
|
|
|
"strUDID:%s " |
|
|
|
"strUDID:%s " |
|
|
|
"iBusNumber:%d " |
|
|
|
"iBusNumber:%d " |
|
|
|
"iDeviceNumber:%d " |
|
|
|
"iDeviceNumber:%d " |
|
|
|
#if defined(__linux) |
|
|
|
#if defined(__linux__) |
|
|
|
"iDrvIndex:%d " |
|
|
|
"iDrvIndex:%d " |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
"iFunctionNumber:%d " |
|
|
|
"iFunctionNumber:%d " |
|
|
@ -409,7 +409,7 @@ void init_adl(int nDevs) |
|
|
|
lpInfo[i].strUDID, |
|
|
|
lpInfo[i].strUDID, |
|
|
|
lpInfo[i].iBusNumber, |
|
|
|
lpInfo[i].iBusNumber, |
|
|
|
lpInfo[i].iDeviceNumber, |
|
|
|
lpInfo[i].iDeviceNumber, |
|
|
|
#if defined(__linux) |
|
|
|
#if defined(__linux__) |
|
|
|
lpInfo[i].iDrvIndex, |
|
|
|
lpInfo[i].iDrvIndex, |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
lpInfo[i].iFunctionNumber, |
|
|
|
lpInfo[i].iFunctionNumber, |
|
|
@ -1584,7 +1584,7 @@ static void free_adl(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ADL_Main_Memory_Free ((void **)&lpInfo); |
|
|
|
ADL_Main_Memory_Free ((void **)&lpInfo); |
|
|
|
ADL_Main_Control_Destroy (); |
|
|
|
ADL_Main_Control_Destroy (); |
|
|
|
#if defined (LINUX) |
|
|
|
#if defined (UNIX) |
|
|
|
dlclose(hDLL); |
|
|
|
dlclose(hDLL); |
|
|
|
#else |
|
|
|
#else |
|
|
|
FreeLibrary(hDLL); |
|
|
|
FreeLibrary(hDLL); |
|
|
|