Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C VBE.h一堆问题_C_Struct_Vbe - Fatal编程技术网

C VBE.h一堆问题

C VBE.h一堆问题,c,struct,vbe,C,Struct,Vbe,我有一个项目,我需要配置一些东西的图形卡,它是一个vbe.h文件,我不知道如何使用它 #ifndef __VBE_H #define __VBE_H #include <stdint.h> /** @defgroup vbe vbe * @{ * * Functions related to the VBE standard */ /** @name VBE Mode Info Block */ /**@{ * * Packed VBE Mode Info Bloc

我有一个项目,我需要配置一些东西的图形卡,它是一个vbe.h文件,我不知道如何使用它

#ifndef __VBE_H
#define __VBE_H

#include <stdint.h>

/** @defgroup vbe vbe
 * @{
 *
 * Functions related to the VBE standard
 */

/** @name VBE Mode Info Block */
/**@{
 *
 * Packed VBE Mode Info Block 
 */ 

typedef struct {
  /*  Mandatory information for all VBE revisions */
  uint16_t ModeAttributes;  /**< @brief mode attributes */
  uint8_t WinAAttributes;       /**< @brief window A attributes */
  uint8_t WinBAttributes;       /**< @brief window B attributes */
  uint16_t WinGranularity;  /**< @brief window granularity */
  uint16_t WinSize;     /**< @brief window size */
  uint16_t WinASegment;     /**< @brief window A start segment */
  uint16_t WinBSegment;     /**< @brief window B start segment */
  phys_bytes WinFuncPtr;    /**< @brief real mode/far pointer to window function */
  uint16_t BytesPerScanLine;    /**< @brief bytes per scan line */

  /* Mandatory information for VBE 1.2 and above */

  uint16_t XResolution;         /**< @brief horizontal resolution in pixels/characters */
  uint16_t YResolution;         /**< @brief vertical resolution in pixels/characters */
  uint8_t XCharSize;        /**< @brief character cell width in pixels */
  uint8_t YCharSize;        /**< @brief character cell height in pixels */
  uint8_t NumberOfPlanes;       /**< @brief number of memory planes */
  uint8_t BitsPerPixel;         /**< @brief bits per pixel */
  uint8_t NumberOfBanks;        /**< @brief number of banks */
  uint8_t MemoryModel;      /**< @brief memory model type */
  uint8_t BankSize;     /**< @brief bank size in KB */
  uint8_t NumberOfImagePages;   /**< @brief number of images */
  uint8_t Reserved1;        /**< @brief reserved for page function */

  /* Direct Color fields (required for direct/6 and YUV/7 memory models) */

  uint8_t RedMaskSize;      /* size of direct color red mask in bits */
  uint8_t RedFieldPosition; /* bit position of lsb of red mask */
  uint8_t GreenMaskSize;        /* size of direct color green mask in bits */
  uint8_t GreenFieldPosition;   /* bit position of lsb of green mask */
  uint8_t BlueMaskSize;         /* size of direct color blue mask in bits */
  uint8_t BlueFieldPosition;    /* bit position of lsb of blue mask */
  uint8_t RsvdMaskSize;     /* size of direct color reserved mask in bits */
  uint8_t RsvdFieldPosition;    /* bit position of lsb of reserved mask */
  uint8_t DirectColorModeInfo;  /* direct color mode attributes */

  /* Mandatory information for VBE 2.0 and above */
  phys_bytes PhysBasePtr;       /**< @brief physical address for flat memory frame buffer */
  uint8_t Reserved2[4];         /**< @brief Reserved - always set to 0 */
  uint8_t Reserved3[2];         /**< @brief Reserved - always set to 0 */

  /* Mandatory information for VBE 3.0 and above */
  uint16_t LinBytesPerScanLine;    /* bytes per scan line for linear modes */
  uint8_t BnkNumberOfImagePages;    /* number of images for banked modes */
  uint8_t LinNumberOfImagePages;    /* number of images for linear modes */
  uint8_t LinRedMaskSize;           /* size of direct color red mask (linear modes) */
  uint8_t LinRedFieldPosition;  /* bit position of lsb of red mask (linear modes) */
  uint8_t LinGreenMaskSize;     /* size of direct color green mask (linear modes) */
  uint8_t LinGreenFieldPosition; /* bit position of lsb of green mask (linear  modes) */
  uint8_t LinBlueMaskSize;  /* size of direct color blue mask (linear modes) */
  uint8_t LinBlueFieldPosition;     /* bit position of lsb of blue mask (linear modes ) */
  uint8_t LinRsvdMaskSize;  /* size of direct color reserved mask (linear modes) */
  uint8_t LinRsvdFieldPosition;  /* bit position of lsb of reserved mask (linear modes) */
  uint32_t MaxPixelClock;            /* maximum pixel clock (in Hz) for graphics mode */
  uint8_t Reserved4[190];        /* remainder of ModeInfoBlock */
} __attribute__((packed)) vbe_mode_info_t;

/** @} end of vbe_mode_info_t*/

/**
 * @brief Returns information on the input VBE mode, including screen dimensions, color depth and VRAM physical address
 * 
 * Initializes unpacked vbe_mode__info_t structure passed as an address with
 *  the information of the input mode, by calling VBE function 0x01
 *  Return VBE Mode Information and unpacking the ModeInfoBlock struct
 *  returned by that function.
 * 
 * @param mode mode whose information should be returned
 * @param vmi_p address of vbe_mode_info_t structure to be initialized
 * @return 0 on success, non-zero otherwise
 */
int vbe_get_mode_info(unsigned short mode, vbe_mode_info_t *vmi_p);

 /** @} end of vbe */

#endif /* __VBE_H */
\ifndef\uvbe\H
#定义
#包括
/**@defgroup-vbe-vbe
* @{
*
*与VBE标准相关的功能
*/
/**@name VBE模式信息块*/
/**@{
*
*压缩VBE模式信息块
*/ 
类型定义结构{
/*所有VBE修订的强制性信息*/
uint16\u t ModeAttributes;/**<@简要模式属性*/
uint8\u t WinAAttributes;/**<@简要窗口A属性*/
uint8\u t WinBAttributes;/**<@简短窗口B属性*/
uint16_t WinGranularity;/**<@简短窗口粒度*/
uint16\u t WinSize;/**<@简短窗口大小*/
uint16\u t WinASegment;/**<@简短窗口A开始段*/
uint16\u t WinBSegment;/**<@简短窗口B开始段*/
phys_bytes WinFuncPtr;/**<@brief实模式/指向窗口函数的远指针*/
uint16字节每扫描行;/**<@每个扫描行的简短字节*/
/*VBE 1.2及以上版本的强制性信息*/
uint16\u t x分辨率;/**<@以像素/字符为单位的简要水平分辨率*/
uint16_t YResolution;/**@以像素/字符为单位的简要垂直分辨率*/
uint8\u t XCharSize;/**@以像素为单位的简短字符单元格宽度*/
uint8\u t YCharSize;/**@以像素为单位的简短字符单元高度*/
uint8\u t NumberOfPlanes;/**@内存平面的简要数量*/
uint8_t BitsPerPixel;/**<@每像素简短位*/
uint8\u t银行数量;/**<@银行简要数量*/
uint8\u t MemoryModel;/**<@简短内存模型类型*/
uint8\u t BankSize;/**@简短的银行规模(KB)*/
uint8\u t图像页数;/**<@图像简要编号*/
uint8\u t Reserved1;/**<@为页面功能保留摘要*/
/*直接颜色字段(Direct/6和YUV/7内存型号需要)*/
uint8_t RedMaskSize;/*直接彩色红色掩码的大小(位)*/
uint8_t RedFieldPosition;/*红色掩码lsb的位位置*/
uint8_t GreenMaskSize;/*直接彩色绿色掩码的大小(以位为单位)*/
uint8_t绿地位置;/*绿色遮罩lsb的位位置*/
uint8_t BlueMaskSize;/*直接彩色蓝色掩码的大小(以位为单位)*/
uint8_t BlueFieldPosition;/*蓝色掩码lsb的位位置*/
uint8_t RsvdMaskSize;/*直接彩色保留掩码的大小(位)*/
uint8_t RsvdFieldPosition;/*保留掩码lsb的位位置*/
uint8\u t DirectColorModeInfo;/*直接颜色模式属性*/
/*VBE 2.0及以上版本的必填信息*/
phys_bytes PhysBasePtr;/**<@平面内存帧缓冲区的简要物理地址*/
uint8_t Reserved2[4];/**<@brief Reserved-始终设置为0*/
uint8_t Reserved3[2];/**<@brief Reserved-始终设置为0*/
/*VBE 3.0及以上版本的必填信息*/
uint16\u t LinBytesPerScanLine;对于线性模式,每条扫描线的字节数为/**/
uint8\u t BnkNumberOfImagePages;/*倾斜模式的图像数*/
uint8\u t LinNumberOfImagePages;/*线性模式的图像数*/
uint8_t LinRedMaskSize;/*直接彩色红色掩模的大小(线性模式)*/
uint8_t LinRedFieldPosition;/*红色掩码lsb的位位置(线性模式)*/
uint8_t LinGreenMaskSize;/*直接彩色绿色遮罩的大小(线性模式)*/
uint8_t LinGreenFieldPosition;/*绿色掩模lsb的位位置(线性模式)*/
uint8_t LinBlueMaskSize;/*直接彩色蓝色掩模的大小(线性模式)*/
uint8_t LinBlueFieldPosition;/*蓝色掩模lsb的位位置(线性模式)*/
uint8_t LinRsvdMaskSize;/*直接彩色保留掩码的大小(线性模式)*/
uint8_t LinRsvdFieldPosition;/*保留掩码的lsb位位置(线性模式)*/
uint32_t MaxPixelClock;/*图形模式的最大像素时钟(单位:Hz)*/
uint8_t Reserved4[190];/*ModeInfoBlock的剩余部分*/
}属性(压缩)vbe模式信息;
/**@}vbe_模式信息结束*/
/**
*@brief返回有关输入VBE模式的信息,包括屏幕尺寸、颜色深度和VRAM物理地址
* 
*初始化以地址形式传递的未打包vbe_mode__信息结构
*通过调用VBE函数0x01,输入模式的信息
*返回VBE模式信息并解压缩ModeInfoBlock结构
*由该函数返回。
* 
*@param mode应返回其信息的模式
*要初始化的vbe_模式信息结构的@param vmi_p地址
*@成功返回0,否则返回非零
*/
int vbe_get_mode_info(无符号短模式、vbe_mode_info_t*vmi_p);
/**@}vbe的结尾*/
#endif/*\uu VBE\u H*/
我想知道如何使用一些函数,比如RedMaskSize、RedFieldPosition等等。有什么想法吗


关于

那里只有一个函数,
vbe\u get\u mode\u info
。您使用指向结构的指针调用它,给它一个模式,它会为您填充结构:

vbe_mode_info_t params;
vbe_get_mode_info(0 /* guess at a mode */, &params);

// now you can use params.RedMaskSize for example as you want

请确保在编译时链接您的库,这里有相关文档:

作为旁注,这个问题非常适合结束。“VBE”不是此库的特定名称,它已经是一个非常广泛使用的首字母缩略词,您根本不提供上下文。很抱歉,我想更改名称。可能吗?但是我怎么才能得到所有这些选择呢?可能吗?