当前位置: 技术问答>linux和unix
如何在LINUX下直接存取VGA中的具体某一页
来源: 互联网 发布时间:2014-12-11
本文导语: 如何在LINUX下直接存取VGA中的具体某一页 | 是!但是比较危险,调试时要小心。我没做过,我做过访问其他pci设备,只能给你一个参考: 1。首先找到pci设备的地址 #include #include #include #inc...
如何在LINUX下直接存取VGA中的具体某一页
|
是!但是比较危险,调试时要小心。我没做过,我做过访问其他pci设备,只能给你一个参考:
1。首先找到pci设备的地址
#include
#include
#include
#include
#include
#include
#include
#define PCI_CONFIG_ADDRESS_REGISTER (0xcf8)
#define PCI_CONFIG_DATA_REGISTER (0xcfc)
#define ENABLE_CONFIG_REGISTER (0x80000000)
#define MAX_BUS_NUMBER (0x100)
#define MAX_DEVICE_NUMBER (0x20)
#define MAX_FUNCTION_NUMBER (0x8)
#define BASE_ADDR (0x10)
#define CS_REG_NUM 8
#define BASE_ADDR_NUM 7
#define BASE_MEM_LEN (0x10000L * (CS_REG_NUM + 1))
#define VENDOR_ID1 0xxxxx //自己从/proc/pci文件中找
unsigned char *base_ptr[CS_REG_NUM];
unsigned char *user_base_ptr;
unsigned long get_pci_config(int busNum, int devNum, int funcNum, int regNum)
{
unsigned long i;
i = ENABLE_CONFIG_REGISTER | (busNum
1。首先找到pci设备的地址
#include
#include
#include
#include
#include
#include
#include
#define PCI_CONFIG_ADDRESS_REGISTER (0xcf8)
#define PCI_CONFIG_DATA_REGISTER (0xcfc)
#define ENABLE_CONFIG_REGISTER (0x80000000)
#define MAX_BUS_NUMBER (0x100)
#define MAX_DEVICE_NUMBER (0x20)
#define MAX_FUNCTION_NUMBER (0x8)
#define BASE_ADDR (0x10)
#define CS_REG_NUM 8
#define BASE_ADDR_NUM 7
#define BASE_MEM_LEN (0x10000L * (CS_REG_NUM + 1))
#define VENDOR_ID1 0xxxxx //自己从/proc/pci文件中找
unsigned char *base_ptr[CS_REG_NUM];
unsigned char *user_base_ptr;
unsigned long get_pci_config(int busNum, int devNum, int funcNum, int regNum)
{
unsigned long i;
i = ENABLE_CONFIG_REGISTER | (busNum