Initial driver for Sapphire GPU (tested on RX580 Nitro+ on Windows)

This commit is contained in:
Adam Honse 2020-07-15 00:22:46 -05:00
parent 77ecfc3b46
commit 505e2d2aa4
7 changed files with 278 additions and 0 deletions

View file

@ -0,0 +1,56 @@
#include "SapphireGPUController.h"
#include "RGBController.h"
#include "RGBController_SapphireGPU.h"
#include "i2c_smbus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
/******************************************************************************************\
* *
* TestForSapphireGPUController *
* *
* Tests the given address to see if a Sapphire GPU controller exists there. First *
* does a quick write to test for a response *
* *
\******************************************************************************************/
bool TestForSapphireGPUController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res;
//TODO - detection
return(false);
} /* TestForSapphireGPUController() */
/******************************************************************************************\
* *
* DetectSapphireGPUControllers *
* *
* Detect Sapphire GPU controllers on the enumerated I2C busses at address 0x55. *
* *
* bus - pointer to i2c_smbus_interface where Sapphire GPU device is connected *
* dev - I2C address of Sapphire GPU device *
* *
\******************************************************************************************/
void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
{
SapphireGPUController* new_sapphire;
RGBController_SapphireGPU* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Check for Sapphire GPU controller at 0x55
if (TestForSapphireGPUController(busses[bus], 0x55))
{
new_sapphire = new SapphireGPUController(busses[bus], 0x55);
new_controller = new RGBController_SapphireGPU(new_sapphire);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectSapphireGPUControllers() */