Changeset 038e1dba in rtems
- Timestamp:
- 12/03/14 23:56:39 (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 4251b88
- Parents:
- d78eac6
- git-author:
- Jan Dolezal <dolezj21@…> (12/03/14 23:56:39)
- git-committer:
- Gedare Bloom <gedare@…> (12/04/14 18:37:50)
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
rd78eac6 r038e1dba 1 /** 2 * @file fb_vesa_rm.c 3 * 4 * @ingroup i386_pc386 5 * 6 * @brief FB driver for graphic hardware compatible with VESA Bios Extension 7 * Real mode interface utilized 8 * Tested on real HW. 9 * 10 * Public sources related: 11 * - VESA BIOS EXTENSION (VBE) Core Function Standard, Ver: 3.0, Sep 16, 1998 12 * - VESA Enhanced Extended Display Identification Data (E-EDID) Standard 13 * Release A, Revision 2, September 25, 2006 14 * 15 * Hardware is completely initialized upon boot of the system. 16 * Therefore there is no way to change graphics mode later. 17 * 18 * Interrupt 0x10 is used for entering graphics BIOS. 19 * 20 * Driver reads parameter from multiboot command line to setup video: 21 * "--video=<resX>x<resY>[-<bpp>]" 22 * If cmdline parameter is not specified an attempt for obtaining 23 * resolution from display attached is made. 24 */ 25 1 26 /* 2 * FB driver for graphic hardware compatible with VESA Bios Extension 3 * Real mode interface utilized 4 * Tested on real HW. 5 * 6 * Copyright (c) 2014 - CTU in Prague 7 * Jan DoleÅŸal ( dolezj21@fel.cvut.cz ) 8 * 9 * The license and distribution terms for this file may be 10 * found in the file LICENSE in this distribution or at 11 * http://www.rtems.org/license/LICENSE. 12 * 13 * The code for rtems_buffer_* functions were greatly 14 * inspired or coppied from: 15 * - RTEMS fb_cirrus.c - Alexandru-Sever Horin (alex.sever.h@gmail.com) 16 * 17 * Public sources related: 18 * - VESA BIOS EXTENSION (VBE) Core Function Standard, Ver: 3.0, Sep 16, 1998 19 * - VESA Enhanced Extended Display Identification Data (E-EDID) Standard 20 * Release A, Revision 2, September 25, 2006 21 */ 22 23 /* 24 * Hardware is completely initialized upon boot of the system. 25 * Therefore there is no way to change graphics mode later. 26 * 27 * Interrupt 0x10 is used for entering graphics BIOS. 28 * 29 * Driver reads parameter from multiboot command line to setup video: 30 * "--video=<resX>x<resY>[-<bpp>]" 31 * If cmdline parameter is not specified an attempt for obtaining 32 * resolution from display attached is made. 27 * Copyright (c) 2014 - CTU in Prague 28 * Jan DoleÅŸal ( dolezj21@fel.cvut.cz ) 29 * 30 * The license and distribution terms for this file may be 31 * found in the file LICENSE in this distribution or at 32 * http://www.rtems.org/license/LICENSE. 33 * 34 * The code for rtems_buffer_* functions were greatly 35 * inspired or coppied from: 36 * - RTEMS fb_cirrus.c - Alexandru-Sever Horin (alex.sever.h@gmail.com) 33 37 */ 34 38 … … 49 53 #define FB_VESA_NAME "FB_VESA_RM" 50 54 55 /** 56 * @brief Initializes VBE framebuffer during bootup. 57 * 58 * utilizes switches to real mode interrupts and therefore must be 59 * called during bootup before tick is set up and real-time 60 * interrupt vectors utilized 61 */ 51 62 void vesa_realmode_bootup_init(void); 52 63 … … 188 199 } 189 200 201 /** 202 * @brief Basic graphic's mode parameters 203 */ 190 204 typedef struct { 205 /** number of the graphic's mode */ 191 206 uint16_t mode_number; 207 /** number of pixels in one line */ 192 208 uint16_t resX; 209 /** number of lines */ 193 210 uint16_t resY; 211 /** bits per pixel */ 194 212 uint8_t bpp; 195 213 } Mode_params; 196 214 197 /* finds mode in 'modeList' of 'listLength' length according to resolution 198 given in 'searchedResolution'. If bpp is given in that struct as well 199 mode with such color depth and resolution is searched for. Otherwise bpp 200 has to be zero. Mode number found is returned and also filled into 201 'searchedResolution'. bpp is also filled into 'searchedResolution' if it 202 was 0 before call. */ 215 /** 216 * @brief Find mode by resolution in the given list of modes 217 * 218 * finds mode in \p mode_list of \p list_length length according to resolution 219 * given in \p searched_resolution . If bpp is given in that struct as well 220 * mode with such color depth and resolution is searched for. Otherwise bpp 221 * has to be zero. Mode number found is returned and also filled into 222 * \p searched_resolution . bpp is also filled into \p searchedResolution if it 223 * was 0 before call. 224 * 225 * @param[in] mode_list list of modes to be searched 226 * @param[in] list_length number of modes in the list 227 * @param[in,out] searched_resolution element filled with searched resolution 228 * or/and bpp; mode_number is filled in if appropriate mode found 229 * @retval mode number satisfying given parameters 230 * @retval -1 no suitable mode found 231 */ 203 232 static uint16_t find_mode_by_resolution(Mode_params *mode_list, 204 233 uint8_t list_length, … … 224 253 } 225 254 226 /* 227 * Parse comandline option "--video=" if available. 255 /** 256 * @brief Find mode given within command line. 257 * 258 * Parse command line option "--video=" if available. 228 259 * expected format 229 260 * --video=<resX>x<resY>[-<bpp>] 230 261 * numbers <resX>, <resY> and <bpp> are decadic 231 262 * 263 * @param[in] mode_list list of modes to be searched 264 * @param[in] list_length number of modes in the list 232 265 * @retval video mode number to be set 233 * 266 * @retval -1 on parsing error or when no suitable mode found 234 267 */ 235 268 static uint16_t find_mode_using_cmdline(Mode_params *mode_list, … … 279 312 } 280 313 281 /* 282 * returns mode number best fitting to monitor attached 283 * 314 /** 315 * @brief Find mode number best fitting to monitor attached 316 * 317 * @param[in] mode_list list of modes to be searched 318 * @param[in] list_length number of modes in the list 284 319 * @retval video mode number to be set 285 * 320 * @retval -1 on parsing error or when no suitable mode found 286 321 */ 287 322 static uint16_t find_mode_using_EDID( Mode_params *mode_list, -
c/src/lib/libbsp/i386/pc386/include/edid.h
rd78eac6 r038e1dba 5 5 * 6 6 * @brief VESA EDID definitions. 7 * 8 * This file contains definitions for constants related to 9 * VESA Extended Display Identification Data. 10 * More information can be found at 11 * <http://www.vesa.org/vesa-standards/free-standards/> 12 * VESA public standards may be found at 13 * <http://www.vesa.org/wp-content/uploads/2010/12/thankspublic.htm> 7 14 */ 8 15 9 16 /* 10 * edid.h - This file contains definitions for constants related to11 * VESA Extended Display Identification Data.12 * More information can be found at13 * <http://www.vesa.org/vesa-standards/free-standards/>14 * VESA public standards may be found at15 * <http://www.vesa.org/wp-content/uploads/2010/12/thankspublic.htm>16 *17 17 * Copyright (C) 2014 Jan DoleÅŸal (dolezj21@fel.cvut.cz) 18 18 * CTU in Prague. -
c/src/lib/libbsp/i386/pc386/include/fb_vesa.h
rd78eac6 r038e1dba 4 4 * @ingroup i386_pc386 5 5 * 6 * @brief Definitioins for vesa based framebuffer drivers.6 * @brief Headers specific for framebuffer drivers utilizing VESA VBE. 7 7 */ 8 8 9 9 /* 10 * Headers specific for framebuffer drivers utilizing VESA VBE.11 *12 10 * Copyright (C) 2014 Jan DoleÅŸal (dolezj21@fel.cvut.cz) 13 11 * CTU in Prague. … … 36 34 37 35 /** 38 * Returns information about graphic's controller in the infoBlock structure. 36 * @brief Returns information about graphic's controller in the \p info_block 37 * structure. 39 38 * 40 * @param infoBlock pointer to the struct to be filled with41 42 * @param queriedVBEVersion if >0x200 then video bios is asked to fill in39 * @param[out] info_block pointer to the struct to be filled with 40 * controller information 41 * @param[in] queried_VBE_Version if >0x200 then video bios is asked to fill in 43 42 * parameters which appeared with second version 44 43 * of VBE. 45 * @retval register axcontent as defined in VBE RETURN STATUS paragraph46 * 44 * @retval ax register content as defined in VBE RETURN STATUS paragraph 45 * @retval -1 error calling graphical bios 47 46 */ 48 47 uint32_t VBE_controller_information ( … … 52 51 53 52 /** 54 * Fills structure infoBlock with informations about selected mode in55 * modeNumber variable.53 * @brief Fills structure \p info_block with informations about selected mode in 54 * \p mode_number variable. 56 55 * 57 * @param infoBlock pointer to the struct to be filled with mode information 58 * @param modeNumber detailes of this mode to be filled 59 * @retval register ax content as defined in VBE RETURN STATUS paragraph 60 * -1 error calling graphical bios 56 * @param[out] info_block pointer to the struct to be filled with 57 * mode information 58 * @param[in] mode_number detailes of this mode to be filled 59 * @retval ax register content as defined in VBE RETURN STATUS paragraph 60 * @retval -1 error calling graphical bios 61 61 */ 62 62 uint32_t VBE_mode_information ( … … 66 66 67 67 /** 68 * Sets graphics mode selected. If mode has refreshRateCtrl bit set, than the69 * infoBlock must be filled accordingly.68 * @brief Sets graphics mode selected. If mode has refreshRateCtrl bit set, than 69 * the \p info_block must be filled accordingly. 70 70 * 71 * @param modeNumber number of mode to be set72 * @param infoBlock pointer to struct containing refresh rate control info73 * @retval register axcontent as defined in VBE RETURN STATUS paragraph74 * 71 * @param[in] mode_number number of mode to be set 72 * @param[in] info_block pointer to struct containing refresh rate control info 73 * @retval ax register content as defined in VBE RETURN STATUS paragraph 74 * @retval -1 error calling graphical bios 75 75 */ 76 76 uint32_t VBE_set_mode ( … … 80 80 81 81 /** 82 * Get currently set mode number.82 * @brief Get currently set mode number. 83 83 * 84 * @param modeNumber variable to be filled with current mode number85 * @retval register axcontent as defined in VBE RETURN STATUS paragraph86 * 84 * @param[out] mode_number variable to be filled with current mode number 85 * @retval ax register content as defined in VBE RETURN STATUS paragraph 86 * @retval -1 error calling graphical bios 87 87 */ 88 88 uint32_t VBE_current_mode ( … … 91 91 92 92 /** 93 * Gets information about display data channel implemented in the93 * @brief Gets information about display data channel implemented in the 94 94 * graphic's controller. 95 95 * 96 * @param controllerUnitNumber97 * @param secondsToTransferEDIDBlock approximate time to transfer one EDID block98 * rounded up to seconds99 * @param DDCLevelSupported after callcontains DDC version supported and96 * @param[in] controller_unit_number 97 * @param[out] seconds_to_transfer_EDID_block approximate time to transfer one 98 * EDID block rounded up to seconds 99 * @param[out] DDC_level_supported contains DDC version supported and 100 100 * screen blanking state during transfer 101 * @retval register axcontent as defined in VBE RETURN STATUS paragraph102 * 101 * @retval ax register content as defined in VBE RETURN STATUS paragraph 102 * @retval -1 error calling graphical bios 103 103 */ 104 104 uint32_t VBE_report_DDC_capabilities ( … … 109 109 110 110 /** 111 * Reads selected EDID block from display attached to controller's interface. 111 * @brief Reads selected EDID block from display attached to controller's 112 * interface. 112 113 * 113 * @param controllerUnitNumber114 * @param EDIDBlockNumber block no. to be read from the display115 * @param buffer place to store block fetched from the display116 * @retval register axcontent as defined in VBE RETURN STATUS paragraph117 * 114 * @param[in] controller_unit_number 115 * @param[in] EDID_block_number block no. to be read from the display 116 * @param[out] buffer place to store block fetched from the display 117 * @retval ax register content as defined in VBE RETURN STATUS paragraph 118 * @retval -1 error calling graphical bios 118 119 */ 119 120 uint32_t VBE_read_EDID ( -
c/src/lib/libbsp/i386/pc386/include/tblsizes.h
rd78eac6 r038e1dba 8 8 9 9 /* 10 * Definitions related to the PC386 BSP.11 10 * This header file is also used in assembler modules. 12 11 * -
c/src/lib/libbsp/i386/pc386/include/vbe3.h
rd78eac6 r038e1dba 5 5 * 6 6 * @brief VESA Bios Extension definitions. 7 * 8 * This file contains definitions for constants related to VBE. 9 * More information can be found at 10 * <http://www.vesa.org/vesa-standards/free-standards/>. 11 * VESA public standards may be found at 12 * <http://www.vesa.org/wp-content/uploads/2010/12/thankspublic.htm>. 7 13 */ 8 14 9 15 /* 10 * vbe3.h - This file contains definitions for constants related to VBE.11 * More information can be found at12 * <http://www.vesa.org/vesa-standards/free-standards/>13 * VESA public standards may be found at14 * <http://www.vesa.org/wp-content/uploads/2010/12/thankspublic.htm>15 *16 16 * Copyright (C) 2014 Jan DoleÅŸal (dolezj21@fel.cvut.cz) 17 17 * CTU in Prague. … … 38 38 Version: 3.0 Date: September 16, 1998 */ 39 39 40 /* VBE RETURN STATUS */ 41 /* AL == 4Fh: Function is supported */ 42 /* AL != 4Fh: Function is not supported */ 40 /** AL == 4Fh: Function is supported \n 41 * AL != 4Fh: Function is not supported */ 43 42 #define VBE_functionSupported 0x4F 44 /* AH == 00h: Function call successful */43 /** AH == 00h: Function call successful */ 45 44 #define VBE_callSuccessful 0x00 46 /* AH == 01h: Function call failed */45 /** AH == 01h: Function call failed */ 47 46 #define VBE_callFailed 0x01 48 /* AH == 02h: Function is not supported in the current hardware configuration*/47 /** AH == 02h: Function is not supported in the current hardware configuration*/ 49 48 #define VBE_notSupportedInCurHWConf 0x02 50 /* AH == 03h: Function call invalid in current video mode */49 /** AH == 03h: Function call invalid in current video mode */ 51 50 #define VBE_callInvalid 0x03 52 51 53 52 /* VBE Mode Numbers */ 54 /* D0-D8 = Mode number */53 /** D0-D8 = Mode number */ 55 54 #define VBE_modeNumberMask 0x01FF 56 55 #define VBE_modeNumberShift 0x00 57 /* If D8 == 0, this is not a VESA defined VBE mode */ 56 /** If D8 == 0, this is not a VESA defined VBE mode \n 57 If D8 == 1, this is a VESA defined VBE mode */ 58 58 #define VBE_VESAmodeMask 0x0100 59 /* If D8 == 1, this is a VESA defined VBE mode */60 /* D9-D12 = Reserved by VESA for future expansion (= 0) */61 59 #define VBE_VESAmodeShift 0x08 62 /* If D11 == 0, Use current BIOS default refresh rate */ 60 /* D9-D10 = Reserved by VESA for future expansion (= 0) */ 61 /** If D11 == 0, Use current BIOS default refresh rate \n 62 If D11 == 1, Use user specified CRTC values for refresh rate */ 63 63 #define VBE_refreshRateCtrlMask 0x0800 64 /* If D11 == 1, Use user specified CRTC values for refresh rate */ 64 #define VBE_refreshRateCtrlShift 0x0B 65 65 /* D12-13 = Reserved for VBE/AF (must be 0) */ 66 #define VBE_refreshRateCtrlShift 0x0B 67 /* If D14 == 0, Use Banked/WindowedFrame Buffer */66 /** If D14 == 0, Use Banked/Windowed Frame Buffer \n 67 If D14 == 1, Use Linear/Flat Frame Buffer */ 68 68 #define VBE_linearFlatFrameBufMask 0x4000 69 /* If D14 == 1, Use Linear/Flat Frame Buffer */70 69 #define VBE_linearFlatFrameBufShift 0x0E 71 /* If D15 == 0, Clear display memory */ 70 /** If D15 == 0, Clear display memory \n 71 If D15 == 1, Preserve display memory */ 72 72 #define VBE_preserveDispMemMask 0x8000 73 /* If D15 == 1, Preserve display memory */74 73 #define VBE_preserveDispMemShift 0x0F 75 74 76 75 /* Graphics modes */ 77 /* 15-bit mode, Resolution: 640x400, Colors: 256 */76 /** 15-bit mode, Resolution: 640x400, Colors: 256 */ 78 77 #define VBE_R640x400C256 0x100 79 /* 15-bit mode, Resolution: 640x480, Colors: 256 */78 /** 15-bit mode, Resolution: 640x480, Colors: 256 */ 80 79 #define VBE_R640x480C256 0x101 81 /* 15-bit mode, Resolution: 800x600, Colors: 16 */80 /** 15-bit mode, Resolution: 800x600, Colors: 16 */ 82 81 #define VBE_R800x600C16 0x102 83 /* 7-bit mode, Resolution: 800x600, Colors: 16 */82 /** 7-bit mode, Resolution: 800x600, Colors: 16 */ 84 83 #define VBE_b7R800x600C16 0x6A 85 /* 15-bit mode, Resolution: 800x600, Colors: 256 */84 /** 15-bit mode, Resolution: 800x600, Colors: 256 */ 86 85 #define VBE_R800x600C256 0x103 87 /* 15-bit mode, Resolution: 1024x768, Colors: 16 */86 /** 15-bit mode, Resolution: 1024x768, Colors: 16 */ 88 87 #define VBE_R1024x768C16 0x104 89 /* 15-bit mode, Resolution: 1024x768, Colors: 256 */88 /** 15-bit mode, Resolution: 1024x768, Colors: 256 */ 90 89 #define VBE_R1024x768C256 0x105 91 /* 15-bit mode, Resolution: 1280x1024, Colors: 16 */90 /** 15-bit mode, Resolution: 1280x1024, Colors: 16 */ 92 91 #define VBE_R1280x1024C16 0x106 93 /* 15-bit mode, Resolution: 1280x1024, Colors: 256 */92 /** 15-bit mode, Resolution: 1280x1024, Colors: 256 */ 94 93 #define VBE_R1280x1024C256 0x107 95 /* 15-bit mode, Resolution: 320x200, Colors: 32K (1:5:5:5) */94 /** 15-bit mode, Resolution: 320x200, Colors: 32K (1:5:5:5) */ 96 95 #define VBE_R320x200C32K 0x10D 97 /* 15-bit mode, Resolution: 320x200, Colors: 64K (5:6:5) */96 /** 15-bit mode, Resolution: 320x200, Colors: 64K (5:6:5) */ 98 97 #define VBE_R320x200C64K 0x10E 99 /* 15-bit mode, Resolution: 320x200, Colors: 16.8M (8:8:8) */98 /** 15-bit mode, Resolution: 320x200, Colors: 16.8M (8:8:8) */ 100 99 #define VBE_R320x200C17M 0x10F 101 /* 15-bit mode, Resolution: 640x480, Colors: 32K (1:5:5:5) */100 /** 15-bit mode, Resolution: 640x480, Colors: 32K (1:5:5:5) */ 102 101 #define VBE_R640x480C32K 0x110 103 /* 15-bit mode, Resolution: 640x480, Colors: 64K (5:6:5) */102 /** 15-bit mode, Resolution: 640x480, Colors: 64K (5:6:5) */ 104 103 #define VBE_R640x480C64K 0x111 105 /* 15-bit mode, Resolution: 640x480, Colors: 16.8M (8:8:8) */104 /** 15-bit mode, Resolution: 640x480, Colors: 16.8M (8:8:8) */ 106 105 #define VBE_R640x480C17M 0x112 107 /* 15-bit mode, Resolution: 800x600, Colors: 32K (1:5:5:5) */106 /** 15-bit mode, Resolution: 800x600, Colors: 32K (1:5:5:5) */ 108 107 #define VBE_R800x600C32K 0x113 109 /* 15-bit mode, Resolution: 800x600, Colors: 64K (5:6:5) */108 /** 15-bit mode, Resolution: 800x600, Colors: 64K (5:6:5) */ 110 109 #define VBE_R800x600C64K 0x114 111 /* 15-bit mode, Resolution: 800x600, Colors: 16.8M (8:8:8) */110 /** 15-bit mode, Resolution: 800x600, Colors: 16.8M (8:8:8) */ 112 111 #define VBE_R800x600C17M 0x115 113 /* 15-bit mode, Resolution: 1024x768, Colors: 32K (1:5:5:5) */112 /** 15-bit mode, Resolution: 1024x768, Colors: 32K (1:5:5:5) */ 114 113 #define VBE_R1024x768C32K 0x116 115 /* 15-bit mode, Resolution: 1024x768, Colors: 64K (5:6:5) */114 /** 15-bit mode, Resolution: 1024x768, Colors: 64K (5:6:5) */ 116 115 #define VBE_R1024x768C64K 0x117 117 /* 15-bit mode, Resolution: 1024x768, Colors: 16.8M (8:8:8) */116 /** 15-bit mode, Resolution: 1024x768, Colors: 16.8M (8:8:8) */ 118 117 #define VBE_R1024x768C17M 0x118 119 /* 15-bit mode, Resolution: 1280x1024, Colors: 32K (1:5:5:5) */118 /** 15-bit mode, Resolution: 1280x1024, Colors: 32K (1:5:5:5) */ 120 119 #define VBE_R1280x1024C32K 0x119 121 /* 15-bit mode, Resolution: 1280x1024, Colors: 64K (5:6:5) */120 /** 15-bit mode, Resolution: 1280x1024, Colors: 64K (5:6:5) */ 122 121 #define VBE_R1280x1024C64K 0x11A 123 /* 15-bit mode, Resolution: 1280x1024, Colors: 16.8M (8:8:8) */122 /** 15-bit mode, Resolution: 1280x1024, Colors: 16.8M (8:8:8) */ 124 123 #define VBE_R1280x1024C17M 0x11B 125 124 #define VBE_SpecialMode 0x81FF 126 125 127 126 /* Text modes */ 128 #define VBE_C80R60 0x108 /*15-bit mode, Columns: 80, Rows: 60 */129 #define VBE_C132R25 0x109 /*15-bit mode, Columns: 132, Rows: 25 */130 #define VBE_C132R43 0x10A /*15-bit mode, Columns: 132, Rows: 43 */131 #define VBE_C132R50 0x10B /*15-bit mode, Columns: 132, Rows: 50 */132 #define VBE_C132R60 0x10C /*15-bit mode, Columns: 132, Rows: 60 */127 #define VBE_C80R60 0x108 /**< 15-bit mode, Columns: 80, Rows: 60 */ 128 #define VBE_C132R25 0x109 /**< 15-bit mode, Columns: 132, Rows: 25 */ 129 #define VBE_C132R43 0x10A /**< 15-bit mode, Columns: 132, Rows: 43 */ 130 #define VBE_C132R50 0x10B /**< 15-bit mode, Columns: 132, Rows: 50 */ 131 #define VBE_C132R60 0x10C /**< 15-bit mode, Columns: 132, Rows: 60 */ 133 132 134 133 /* VBE function numbers - passed in AX register */ 135 #define VBE_RetVBEConInf 0x4F00 /* Return VBE Controller Information */ 136 #define VBE_RetVBEModInf 0x4F01 /* Return VBE Mode Information */ 137 #define VBE_SetVBEMod 0x4F02 /* Set VBE Mode */ 138 #define VBE_RetCurVBEMod 0x4F03 /* Return Current VBE Mode */ 139 #define VBE_SavResSta 0x4F04 /* Save/Restore State */ 140 #define VBE_DisWinCon 0x4F05 /* Display Window Control */ 141 #define VBE_SetGetLogScaLinLen 0x4F06 /* Set/Get Logical Scan Line Length */ 142 #define VBE_SetGetDisSta 0x4F07 /* Set/Get Display Start */ 143 #define VBE_SetGetDACPalFor 0x4F08 /* Set/Get DAC Palette Format */ 144 #define VBE_SetGetPalDat 0x4F09 /* Set/Get Palette Data */ 145 #define VBE_RetVBEProModInt 0x4F0A /* Return VBE Protected Mode Interface */ 146 #define VBE_GetSetpixclo 0x4F0B /* Get/Set pixel clock */ 147 #define VBE_PowManExt 0x4F10 /* Power Management Extensions (PM) */ 148 #define VBE_FlaPanIntExt 0x4F11 /* Flat Panel Interface Extensions (FP) */ 149 #define VBE_AudIntExt 0x4F13 /* Audio Interface Extensions (AI) */ 150 #define VBE_OEMExt 0x4F14 /* OEM Extensions */ 151 #define VBE_DisDatCha 0x4F15 /* Display Data Channel (DDC), 152 Serial Control Interface (SCI) */ 134 /** VBE function - Return VBE Controller Information */ 135 #define VBE_RetVBEConInf 0x4F00 136 /** VBE function - Return VBE Mode Information */ 137 #define VBE_RetVBEModInf 0x4F01 138 /** VBE function - Set VBE Mode */ 139 #define VBE_SetVBEMod 0x4F02 140 /** VBE function - Return Current VBE Mode */ 141 #define VBE_RetCurVBEMod 0x4F03 142 /** VBE function - Save/Restore State */ 143 #define VBE_SavResSta 0x4F04 144 /** VBE function - Display Window Control */ 145 #define VBE_DisWinCon 0x4F05 146 /** VBE function - Set/Get Logical Scan Line Length */ 147 #define VBE_SetGetLogScaLinLen 0x4F06 148 /** VBE function - Set/Get Display Start */ 149 #define VBE_SetGetDisSta 0x4F07 150 /** VBE function - Set/Get DAC Palette Format */ 151 #define VBE_SetGetDACPalFor 0x4F08 152 /** VBE function - Set/Get Palette Data */ 153 #define VBE_SetGetPalDat 0x4F09 154 /** VBE function - Return VBE Protected Mode Interface */ 155 #define VBE_RetVBEProModInt 0x4F0A 156 /** VBE function - Get/Set pixel clock */ 157 #define VBE_GetSetpixclo 0x4F0B 158 /** VBE function - Power Management Extensions (PM) */ 159 #define VBE_PowManExt 0x4F10 160 /** VBE function - Flat Panel Interface Extensions (FP) */ 161 #define VBE_FlaPanIntExt 0x4F11 162 /** VBE function - Audio Interface Extensions (AI) */ 163 #define VBE_AudIntExt 0x4F13 164 /** VBE function - OEM Extensions */ 165 #define VBE_OEMExt 0x4F14 166 /** VBE function - Display Data Channel (DDC), Serial Control Interface (SCI) */ 167 #define VBE_DisDatCha 0x4F15 153 168 154 169 /* VBE subfunction numbers - passed in BL register */ 155 #define VBE_RetVBESupSpeInf 0x00 /* Return VBE Supplemental156 170 #define VBE_RetVBESupSpeInf 0x00 /**< Return VBE Supplemental 171 * Specification Information */ 157 172 /* *** Structures *** */ 173 /** 174 * @brief Far pointer as defined by VBE standard. 175 */ 158 176 typedef struct { 177 /** @brief Offset to segment described by \a selector. */ 159 178 uint16_t offset; 179 /** @brief Selector or Segment depending on whether this is used from 16bit 180 protected mode or from real mode. */ 160 181 uint16_t selector; 161 182 } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_far_pointer; 162 183 184 /** 185 * @brief Protected mode info block as defined by VBE standard. 186 */ 163 187 typedef struct { 164 uint8_t Signature[4]; /* PM Info Block Signature */ 165 uint16_t EntryPoint; /* Offset of PM entry point within BIOS */ 166 uint16_t PMInitialize; /* Offset of PM initialization entry point */ 167 uint16_t BIOSDataSel; /* Selector to BIOS data area emulation block */ 168 uint16_t A0000Sel; /* Selector to access A0000h physical mem */ 169 uint16_t B0000Sel; /* Selector to access B0000h physical mem */ 170 uint16_t B8000Sel; /* Selector to access B8000h physical mem */ 171 uint16_t CodeSegSel; /* Selector to access code segment as data */ 172 uint8_t InProtectMode; /* Set to 1 when in protected mode */ 173 uint8_t Checksum; /* Checksum byte for structure */ 188 /** PM Info Block Signature */ 189 uint8_t Signature[4]; 190 /** Offset of PM entry point within BIOS */ 191 uint16_t EntryPoint; 192 /** Offset of PM initialization entry point */ 193 uint16_t PMInitialize; 194 /** Selector to BIOS data area emulation block */ 195 uint16_t BIOSDataSel; 196 /** Selector to access A0000h physical memmory */ 197 uint16_t A0000Sel; 198 /** Selector to access B0000h physical memmory */ 199 uint16_t B0000Sel; 200 /** Selector to access B8000h physical memmory */ 201 uint16_t B8000Sel; 202 /** Selector to access code segment as data */ 203 uint16_t CodeSegSel; 204 /** Set to 1 when in protected mode */ 205 uint8_t InProtectMode; 206 /** Checksum byte for structure. Sum over all structure bytes gives 0. */ 207 uint8_t Checksum; 174 208 } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_protected_mode_info_block; 175 209 176 /* General VBE signature */210 /** General VBE signature */ 177 211 #define VBE_SIGNATURE "VESA" 178 /* Signature for VBE 2.0 and higher */212 /** Signature for VBE 2.0 and higher */ 179 213 #define VBE20plus_SIGNATURE "VBE2" 180 /* for STUB see VBE CORE FUNCTIONS VERSION 3.0 - Appendix 1 */ 214 /** for STUB see VBE CORE FUNCTIONS VERSION 3.0 - Appendix 1 */ 215 #define VBE_STUB_VideoModeList 0xFFFF 181 216 #define VBE_END_OF_VideoModeList 0xFFFF 182 #define VBE_STUB_VideoModeList 0xFFFF 217 /** 218 * @brief Information about VBE implementation. 219 */ 183 220 typedef struct { 184 uint8_t VbeSignature[4]; /* VBE Signature */ 185 uint16_t VbeVersion; /* VBE Version */ 186 uint8_t *OemStringPtr; /* VbeFarPtr to OEM String */ 187 uint8_t Capabilities[4]; /* Capabilities of graphics controller */ 188 uint32_t *VideoModePtr; /* VbeFarPtr to VideoModeList */ 189 uint16_t TotalMemory; /* Number of 64kb memory blocks */ 221 /** VBE Signature */ 222 uint8_t VbeSignature[4]; 223 /** VBE Version */ 224 uint16_t VbeVersion; 225 /** VBE_far_pointer to OEM String */ 226 uint8_t *OemStringPtr; 227 /** Capabilities of graphics controller */ 228 uint8_t Capabilities[4]; 229 /** VBE_far_pointer to VideoModeList */ 230 uint32_t *VideoModePtr; 231 /** Number of 64kb memory blocks */ 232 uint16_t TotalMemory; 190 233 /* Added for VBE 2.0+ */ 191 uint16_t OemSoftwareRev; /* VBE implementation Software revision */ 192 uint8_t *OemVendorNamePtr; /* VbeFarPtr to Vendor Name String */ 193 uint8_t *OemProductNamePtr; /* VbeFarPtr to Product Name String */ 194 uint8_t *OemProductRevPtr; /* VbeFarPtr to Product Revision String */ 195 uint8_t Reserved[222]; /* Reserved for VBE implementation scratch */ 196 /* area */ 197 uint8_t OemData[256]; /* Data Area for OEM Strings */ 234 /** VBE implementation Software revision */ 235 uint16_t OemSoftwareRev; 236 /** VBE_far_pointer to Vendor Name String */ 237 uint8_t *OemVendorNamePtr; 238 /** VBE_far_pointer to Product Name String */ 239 uint8_t *OemProductNamePtr; 240 /** VBE_far_pointer to Product Revision String */ 241 uint8_t *OemProductRevPtr; 242 /** Reserved for VBE implementation scratch */ 243 uint8_t Reserved[222]; 244 /** Data Area for OEM Strings */ 245 uint8_t OemData[256]; 198 246 } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_vbe_info_block; 199 247 248 /** 249 * @brief Describes graphic's mode parameter. 250 */ 200 251 typedef struct { 201 252 /* Mandatory information for all VBE revisions */ 202 uint16_t ModeAttributes; /* mode attributes */ 203 uint8_t WinAAttributes; /* window A attributes */ 204 uint8_t WinBAttributes; /* window B attributes */ 205 uint16_t WinGranularity; /* window granularity */ 206 uint16_t WinSize; /* window size */ 207 uint16_t WinASegment; /* window A start segment */ 208 uint16_t WinBSegment; /* window B start segment */ 209 uint32_t *WinFuncPtr; /* real mode pointer to window function */ 210 uint16_t BytesPerScanLine; /* bytes per scan line */ 253 /** mode attributes */ 254 uint16_t ModeAttributes; 255 /** window A attributes */ 256 uint8_t WinAAttributes; 257 /** window B attributes */ 258 uint8_t WinBAttributes; 259 /** window granularity */ 260 uint16_t WinGranularity; 261 /** window size */ 262 uint16_t WinSize; 263 /** window A start segment */ 264 uint16_t WinASegment; 265 /** window B start segment */ 266 uint16_t WinBSegment; 267 /** real mode pointer to window function */ 268 uint32_t *WinFuncPtr; 269 /** bytes per scan line */ 270 uint16_t BytesPerScanLine; 211 271 /* Mandatory information for VBE 1.2 and above */ 212 uint16_t XResolution; /* horizontal resolution in px or chars */ 213 uint16_t YResolution; /* vertical resolution in px or chars */ 214 uint8_t XCharSize; /* character cell width in pixels */ 215 uint8_t YCharSize; /* character cell height in pixels */ 216 uint8_t NumberOfPlanes; /* number of memory planes */ 217 uint8_t BitsPerPixel; /* bits per pixel */ 218 uint8_t NumberOfBanks; /* number of banks */ 219 uint8_t MemoryModel; /* memory model type */ 220 uint8_t BankSize; /* bank size in KB */ 221 uint8_t NumberOfImagePages; /* number of images */ 222 uint8_t Reserved0; /* reserved for page function */ 272 /** horizontal resolution in px or chars */ 273 uint16_t XResolution; 274 /** vertical resolution in px or chars */ 275 uint16_t YResolution; 276 /** character cell width in pixels */ 277 uint8_t XCharSize; 278 /** character cell height in pixels */ 279 uint8_t YCharSize; 280 /** number of memory planes */ 281 uint8_t NumberOfPlanes; 282 /** bits per pixel */ 283 uint8_t BitsPerPixel; 284 /** number of banks */ 285 uint8_t NumberOfBanks; 286 /** memory model type */ 287 uint8_t MemoryModel; 288 /** bank size in KB */ 289 uint8_t BankSize; 290 /** number of images */ 291 uint8_t NumberOfImagePages; 292 /** reserved for page function */ 293 uint8_t Reserved0; 223 294 /* Direct Color fields (required for direct/6 and YUV/7 memory models) */ 224 uint8_t RedMaskSize; /* size of direct color red mask in bits */ 225 uint8_t RedFieldPosition; /* bit position of lsb of red mask */ 226 uint8_t GreenMaskSize; /* size of direct color green mask in b */ 227 uint8_t GreenFieldPosition; /* bit position of lsb of green mask */ 228 uint8_t BlueMaskSize; /* size of direct color blue mask in b */ 229 uint8_t BlueFieldPosition; /* bit position of lsb of blue mask */ 230 uint8_t RsvdMaskSize; /* size of direct color reserved mask */ 231 uint8_t RsvdFieldPosition; /* bit position of lsb of reserved mask */ 232 uint8_t DirectColorModeInfo; /* direct color mode attributes */ 295 /** size of direct color red mask in bits */ 296 uint8_t RedMaskSize; 297 /** bit position of lsb of red mask */ 298 uint8_t RedFieldPosition; 299 /** size of direct color green mask in b */ 300 uint8_t GreenMaskSize; 301 /** bit position of lsb of green mask */ 302 uint8_t GreenFieldPosition; 303 /** size of direct color blue mask in b */ 304 uint8_t BlueMaskSize; 305 /** bit position of lsb of blue mask */ 306 uint8_t BlueFieldPosition; 307 /** size of direct color reserved mask */ 308 uint8_t RsvdMaskSize; 309 /** bit position of lsb of reserved mask */ 310 uint8_t RsvdFieldPosition; 311 /** direct color mode attributes */ 312 uint8_t DirectColorModeInfo; 233 313 /* Mandatory information for VBE 2.0 and above */ 234 uint32_t *PhysBasePtr; /* physical address for 235 flat memory frame buffer */ 236 uint32_t Reserved1; /* Reserved - always set to 0 */ 237 uint16_t Reserved2; /* Reserved - always set to 0 */ 314 /** physical address for flat memory frame buffer */ 315 uint32_t *PhysBasePtr; 316 /** Reserved - always set to 0 */ 317 uint32_t Reserved1; 318 /** Reserved - always set to 0 */ 319 uint16_t Reserved2; 238 320 /* Mandatory information for VBE 3.0 and above */ 239 uint16_t LinBytesPerScanLine; /* bytes per scan line for linear modes */ 240 uint8_t BnkNumberOfImagePages; /* number of images for banked modes */ 241 uint8_t LinNumberOfImagePages; /* number of images for linear modes */ 321 /** bytes per scan line for linear modes */ 322 uint16_t LinBytesPerScanLine; 323 /** number of images for banked modes */ 324 uint8_t BnkNumberOfImagePages; 325 /** number of images for linear modes */ 326 uint8_t LinNumberOfImagePages; 242 327 /* linear modes */ 243 uint8_t LinRedMaskSize; /* size of direct color red mask */ 244 uint8_t LinRedFieldPosition; /* bit position of lsb of red mask */ 245 uint8_t LinGreenMaskSize; /* size of direct color green mask */ 246 uint8_t LinGreenFieldPosition; /* bit position of lsb of green mask */ 247 uint8_t LinBlueMaskSize; /* size of direct color blue mask */ 248 uint8_t LinBlueFieldPosition; /* bit position of lsb of blue mask */ 249 uint8_t LinRsvdMaskSize; /* size of direct color reserved mask */ 250 uint8_t LinRsvdFieldPosition; /* bit position of lsb of reserved mask */ 251 uint32_t MaxPixelClock; /* maximum pixel clock 252 (in Hz) for graphics mode */ 253 uint8_t Reserved3[189]; /* remainder of ModeInfoBlock */ 328 /** size of direct color red mask */ 329 uint8_t LinRedMaskSize; 330 /** bit position of lsb of red mask */ 331 uint8_t LinRedFieldPosition; 332 /** size of direct color green mask */ 333 uint8_t LinGreenMaskSize; 334 /** bit position of lsb of green mask */ 335 uint8_t LinGreenFieldPosition; 336 /** size of direct color blue mask */ 337 uint8_t LinBlueMaskSize; 338 /** bit position of lsb of blue mask */ 339 uint8_t LinBlueFieldPosition; 340 /** size of direct color reserved mask */ 341 uint8_t LinRsvdMaskSize; 342 /** bit position of lsb of reserved mask */ 343 uint8_t LinRsvdFieldPosition; 344 /** maximum pixel clock (in Hz) for graphics mode */ 345 uint32_t MaxPixelClock; 346 /** remainder of VBE_mode_info_block */ 347 uint8_t Reserved3[189]; 254 348 } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_mode_info_block; 255 349 350 /** 351 * @brief Describes monitor synchronization. 352 */ 256 353 typedef struct { 257 uint16_t HorizontalTotal; /* Horizontal total in pixels */ 258 uint16_t HorizontalSyncStart; /* Horizontal sync start in pixels */ 259 uint16_t HorizontalSyncEnd; /* Horizontal sync end in pixels */ 260 uint16_t VerticalTotal; /* Vertical total in lines */ 261 uint16_t VerticalSyncStart; /* Vertical sync start in lines */ 262 uint16_t VerticalSyncEnd; /* Vertical sync end in lines */ 263 uint8_t Flags; /* Flags (Interlaced, Double Scan etc) */ 264 uint32_t PixelClock; /* Pixel clock in units of Hz */ 265 uint16_t RefreshRate; /* Refresh rate in units of 0.01 Hz */ 266 uint8_t Reserved[40]; /* remainder of ModeInfoBlock */ 354 /** Horizontal total in pixels */ 355 uint16_t HorizontalTotal; 356 /** Horizontal sync start in pixels */ 357 uint16_t HorizontalSyncStart; 358 /** Horizontal sync end in pixels */ 359 uint16_t HorizontalSyncEnd; 360 /** Vertical total in lines */ 361 uint16_t VerticalTotal; 362 /** Vertical sync start in lines */ 363 uint16_t VerticalSyncStart; 364 /** Vertical sync end in lines */ 365 uint16_t VerticalSyncEnd; 366 /** Flags (Interlaced, Double Scan etc) */ 367 uint8_t Flags; 368 /** Pixel clock in units of Hz */ 369 uint32_t PixelClock; 370 /** Refresh rate in units of 0.01 Hz */ 371 uint16_t RefreshRate; 372 /** remainder of VBE_mode_info_block */ 373 uint8_t Reserved[40]; 267 374 } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_CRTC_info_block; 268 375 376 /** 377 * @brief Describes palette entry. 378 */ 269 379 typedef struct { 270 uint8_t Blue; /* Blue channel value (6 or 8 bits) */ 271 uint8_t Green; /* Green channel value (6 or 8 bits) */ 272 uint8_t Red; /* Red channel value(6 or 8 bits) */ 273 uint8_t Alignment; /* DWORD alignment byte (unused) */ 380 /** Blue channel value (6 or 8 bits) */ 381 uint8_t Blue; 382 /** Green channel value (6 or 8 bits) */ 383 uint8_t Green; 384 /** Red channel value(6 or 8 bits) */ 385 uint8_t Red; 386 /** DWORD alignment byte (unused) */ 387 uint8_t Alignment; 274 388 } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_palette_entry; 275 389 390 /** 391 * @brief Supplemental VBE info block. 392 */ 276 393 typedef struct { 277 uint8_t SupVbeSignature[7]; /* Supplemental VBE Signature */ 278 uint16_t SupVbeVersion; /* Supplemental VBE Version */ 279 uint8_t SupVbeSubFunc[8]; /* Bitfield of supported subfunctions */ 280 uint16_t OemSoftwareRev; /* OEM Software revision */ 281 uint8_t *OemVendorNamePtr; /* VbeFarPtr to Vendor Name String */ 282 uint8_t *OemProductNamePtr; /* VbeFarPtr to Product Name String */ 283 uint8_t *OemProductRevPtr; /* VbeFarPtr to Product Revision String */ 284 uint8_t *OemStringPtr; /* VbeFarPtr to OEM String */ 285 uint8_t Reserved[221]; /* Reserved for description 286 strings and future */ 287 /* expansion */ 394 /** Supplemental VBE Signature */ 395 uint8_t SupVbeSignature[7]; 396 /** Supplemental VBE Version */ 397 uint16_t SupVbeVersion; 398 /** Bitfield of supported subfunctions */ 399 uint8_t SupVbeSubFunc[8]; 400 /** OEM Software revision */ 401 uint16_t OemSoftwareRev; 402 /** VBE_far_pointer to Vendor Name String */ 403 uint8_t *OemVendorNamePtr; 404 /** VBE_far_pointer to Product Name String */ 405 uint8_t *OemProductNamePtr; 406 /** VBE_far_pointer to Product Revision String */ 407 uint8_t *OemProductRevPtr; 408 /** VBE_far_pointer to OEM String */ 409 uint8_t *OemStringPtr; 410 /** Reserved for description strings and future expansion */ 411 uint8_t Reserved[221]; 288 412 } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_supplemental_vbe_info_block; 289 413 290 /* VbeInfoBlock Capabilities */ 291 /* D0 = 0 DAC is fixed width, with 6 bits per primary color */ 292 /* = 1 DAC width is switchable to 8 bits per primary color */ 414 /* VBE_vbe_info_block Capabilities */ 415 /** VBE Info Block - Capabilities\n 416 D0 = 0 DAC is fixed width, with 6 bits per primary color \n 417 D0 = 1 DAC width is switchable to 8 bits per primary color */ 293 418 #define VBE_DACswitchableMask 0x0001 294 /* D1 = 0 Controller is VGA compatible */ 295 /* = 1 Controller is not VGA compatible */ 419 /** VBE Info Block - Capabilities\n 420 D1 = 0 Controller is VGA compatible \n 421 D1 = 1 Controller is not VGA compatible */ 296 422 #define VBE_notVGAcompatibleMask 0x0002 297 /* D2 = 0 Normal RAMDAC operation */ 298 /* = 1 When programming large blocks of information to the RAMDAC, 423 /** VBE Info Block - Capabilities\n 424 D2 = 0 Normal RAMDAC operation \n 425 D2 = 1 When programming large blocks of information to the RAMDAC, 299 426 use the blank bit in Function 09h. */ 300 427 #define VBE_specialRAMDACopMask 0x0004 301 /* D3 = 0 No hardware stereoscopic signaling support */ 302 /* = 1 Hardware stereoscopic signaling supported by controller */ 428 /** VBE Info Block - Capabilities\n 429 D3 = 0 No hardware stereoscopic signaling support \n 430 D3 = 1 Hardware stereoscopic signaling supported by controller */ 303 431 #define VBE_hwStereoscopicMask 0x0008 304 /* D4 = 0 Stereo signaling supported via external VESA stereo connector */ 305 /* = 1 Stereo signaling supported via VESA EVC connector */ 432 /** VBE Info Block - Capabilities\n 433 D4 = 0 Stereo signaling supported via external VESA stereo connector \n 434 D4 = 1 Stereo signaling supported via VESA EVC connector */ 306 435 #define VBE_supportEVCconnMask 0x0010 307 436 /* D5-31 = Reserved */ 308 437 309 /* ModeInfoBlock ModeAttributes */ 310 /* D0 = Mode supported by hardware configuration */ 311 /* 0 = Mode not supported in hardware */ 312 /* 1 = Mode supported in hardware */ 438 /* VBE_mode_info_block ModeAttributes */ 439 /** Mode Info Block - Mode Attributes\n 440 D0 = Mode supported by hardware configuration. 441 0 = Mode not supported in hardware\n 442 1 = Mode supported in hardware */ 313 443 #define VBE_modSupInHWMask 0x0001 314 444 /* D1 = 1 (Reserved) */ 315 /* D2 = TTY Output functions supported by BIOS */ 316 /* 0 = TTY Output functions not supported by BIOS */ 317 /* 1 = TTY Output functions supported by BIOS */ 445 /** Mode Info Block - Mode Attributes\n 446 D2 = TTY Output functions supported by BIOS. 447 0 = TTY Output functions not supported by BIOS\n 448 1 = TTY Output functions supported by BIOS */ 318 449 #define VBE_TTYOutSupByBIOSMask 0x0004 319 /* D3 = Monochrome/color mode (see note below) */ 320 /* 0 = Monochrome mode */ 321 /* 1 = Color mode */ 450 /** Mode Info Block - Mode Attributes\n 451 D3 = Monochrome/color mode (see note below). 452 0 = Monochrome mode\n 453 1 = Color mode */ 322 454 #define VBE_ColorModeMask 0x0008 323 /* D4 = Mode type */ 324 /* 0 = Text mode */ 325 /* 1 = Graphics mode */ 455 /** Mode Info Block - Mode Attributes\n 456 D4 = Mode type. 457 0 = Text mode\n 458 1 = Graphics mode */ 326 459 #define VBE_GraphicsModeMask 0x0010 327 /* D5 = VGA compatible mode */ 328 /* 0 = Yes */ 329 /* 1 = No */ 460 /** Mode Info Block - Mode Attributes\n 461 D5 = VGA compatible mode. 462 0 = Yes\n 463 1 = No */ 330 464 #define VBE_VGACompModeMask 0x0020 331 /* D6 = VGA compatible windowed memory mode is available */ 332 /* 0 = Yes */ 333 /* 1 = No */ 465 /** Mode Info Block - Mode Attributes\n 466 D6 = VGA compatible windowed memory mode is available. 467 0 = Yes\n 468 1 = No */ 334 469 #define VBE_VGACompWinMemModeMask 0x0040 335 /* D7 = Linear frame buffer mode is available */ 336 /* 0 = No */ 337 /* 1 = Yes */ 470 /** Mode Info Block - Mode Attributes\n 471 D7 = Linear frame buffer mode is available. 472 0 = No\n 473 1 = Yes */ 338 474 #define VBE_LinFraBufModeAvaiMask 0x0080 339 /* D8 = Double scan mode is available */ 340 /* 0 = No */ 341 /* 1 = Yes */ 475 /** Mode Info Block - Mode Attributes\n 476 D8 = Double scan mode is available. 477 0 = No\n 478 1 = Yes */ 342 479 #define VBE_DblScnModeAvaiMask 0x0100 343 /* D9 = Interlaced mode is available */ 344 /* 0 = No */ 345 /* 1 = Yes */ 480 /** Mode Info Block - Mode Attributes\n 481 D9 = Interlaced mode is available. 482 0 = No\n 483 1 = Yes */ 346 484 #define VBE_InterlModeAvaiMask 0x0200 347 /* D10 = Hardware triple buffering support */ 348 /* 0 = No */ 349 /* 1 = Yes */ 485 /** Mode Info Block - Mode Attributes\n 486 D10 = Hardware triple buffering support. 487 0 = No\n 488 1 = Yes */ 350 489 #define VBE_HWTripBufSupMask 0x0400 351 /* D11 = Hardware stereoscopic display support */ 352 /* 0 = No */ 353 /* 1 = Yes */ 490 /** Mode Info Block - Mode Attributes\n 491 D11 = Hardware stereoscopic display support. 492 0 = No\n 493 1 = Yes */ 354 494 #define VBE_HWSterDispSupMask 0x0800 355 /* D12 = Dual display start address support */ 356 /* 0 = No */ 357 /* 1 = Yes */ 495 /** Mode Info Block - Mode Attributes\n 496 D12 = Dual display start address support. 497 0 = No\n 498 1 = Yes */ 358 499 #define VBE_DualDispStAdrSupMask 0x1000 359 500 /* D13-D15 = Reserved */ 360 501 361 /* ModeInfoBlock WinXAttributes */362 /* D0 = Relocatable window(s) supported */363 /* 0 = Single non-relocatable window only */ 364 /*1 = Relocatable window(s) are supported */502 /* VBE_mode_info_block WinXAttributes */ 503 /** D0 = Relocatable window(s) supported. 504 0 = Single non-relocatable window only\n 505 1 = Relocatable window(s) are supported */ 365 506 #define VBE_RelocWinSupMask 0x01 366 /* D1 = Window readable */367 /* 0 = Window is not readable */ 368 /*1 = Window is readable */507 /** D1 = Window readable. 508 0 = Window is not readable\n 509 1 = Window is readable */ 369 510 #define VBE_WinReadableMask 0x02 370 /* D2 = Window writeable */371 /* 0 = Window is not writeable */ 372 /*1 = Window is writeable */511 /** D2 = Window writeable. 512 0 = Window is not writeable\n 513 1 = Window is writeable */ 373 514 #define VBE_WinWritableMask 0x04 374 515 /* D3-D7 = Reserved */ 375 516 376 /* ModeInfoBlock MemoryModel */517 /* VBE_mode_info_block MemoryModel */ 377 518 #define VBE_TextMode 0x00 378 519 #define VBE_CGAGraphics 0x01 … … 386 527 /* 0x10-0xFF To be defined by OEM */ 387 528 388 /* ModeInfoBlock DirectColorModeInfo */389 /* D0 = Color ramp is fixed/programmable */390 /* 0 = Color ramp is fixed */ 391 /*1 = Color ramp is programmable */529 /* VBE_mode_info_block DirectColorModeInfo */ 530 /** D0 = Color ramp is fixed/programmable. 531 0 = Color ramp is fixed\n 532 1 = Color ramp is programmable */ 392 533 #define VBE_ColRampProgMask 0x01 393 /* D1 = Bits in Rsvd field are usable/reserved */394 /* 0 = Bits in Rsvd field are reserved */ 395 /*1 = Bits in Rsvd field are usable by the application */534 /** D1 = Bits in Rsvd field are usable/reserved. 535 0 = Bits in Rsvd field are reserved\n 536 1 = Bits in Rsvd field are usable by the application */ 396 537 #define VBE_RsvdBitsUsableMask 0x02 397 538 398 /* CRTCInfoBlock Flags */ 399 /* D0 = Double Scan Mode Enable */ 400 /* 0 = Graphics mode is not double scanned */ 401 /* 1 = Graphics mode is double scanned */ 539 /* VBE_CRTC_info_block Flags */ 540 /** CRTC Info Block - Flags\n 541 D0 = Double Scan Mode Enable. 542 0 = Graphics mode is not double scanned\n 543 1 = Graphics mode is double scanned */ 402 544 #define VBE_GrModeDblScanMask 0x01 403 /* D1 = Interlaced Mode Enable */ 404 /* 0 = Graphics mode is non-interlaced */ 405 /* 1 = Graphics mode is interlaced */ 545 /** CRTC Info Block - Flags\n 546 D1 = Interlaced Mode Enable. 547 0 = Graphics mode is non-interlaced\n 548 1 = Graphics mode is interlaced */ 406 549 #define VBE_GrModeInterlMask 0x02 407 /* D2 = Horizontal sync polarity */ 408 /* 0 = Horizontal sync polarity is positive (+) */ 409 /* 1 = Horizontal sync polarity is negative (-) */ 550 /** CRTC Info Block - Flags\n 551 D2 = Horizontal sync polarity. 552 0 = Horizontal sync polarity is positive (+)\n 553 1 = Horizontal sync polarity is negative (-) */ 410 554 #define VBE_HorSncPolNegMask 0x04 411 /* D3 = Vertical sync polarity */ 412 /* 0 = Vertical sync polarity is positive (+) */ 413 /* 1 = Vertical sync polarity is negative (-) */ 555 /** CRTC Info Block - Flags\n 556 D3 = Vertical sync polarity. 557 0 = Vertical sync polarity is positive (+)\n 558 1 = Vertical sync polarity is negative (-) */ 414 559 #define VBE_VerSncPolNegMask 0x08 415 560 … … 419 564 420 565 /* VBE/DDC subfunction numbers - passed in BL register */ 421 #define VBEDDC_Capabilities 0x0 /* Report VBE/DDC Capabilities */ 422 #define VBEDDC_ReadEDID 0x1 /* Read EDID */ 566 /** VBE/DDC subfunction - Report VBE/DDC Capabilities */ 567 #define VBEDDC_Capabilities 0x0 568 /** VBE/DDC subfunction - Read EDID */ 569 #define VBEDDC_ReadEDID 0x1 423 570 424 571 /* DDC Capabilities */ 425 572 /* DDC level supported - returned in BL register */ 426 /* 0 - DDC1 not supported; 1 - DDC1 supported */573 /** 0 - DDC1 not supported; 1 - DDC1 supported */ 427 574 #define VBEDDC_1SupportedMask 0x1 428 /* 0 - DDC2 not supported; 1 - DDC2 supported */575 /** 0 - DDC2 not supported; 1 - DDC2 supported */ 429 576 #define VBEDDC_2SupportedMask 0x2 430 /* 0 - Screen not blanked during data transfer;431 1 - Screen blanked during data transfer */577 /** 0 - Screen not blanked during data transfer\n 578 1 - Screen blanked during data transfer */ 432 579 #define VBEDDC_scrBlnkDatTrMs 0x4 433 580 … … 437 584 438 585 /* VBE/SCI subfunction numbers - passed in BL register */ 439 #define VBESCI_ReportCapabil 0x10 /* Report VBE/SCI Capabilities */ 440 #define VBESCI_BegSCLSDACtrl 0x11 /* Begin SCL/SDA control */ 441 #define VBESCI_EndSCLSDACtrl 0x12 /* End SCL/SDA control */ 442 #define VBESCI_WrtSCLClkLine 0x13 /* Write SCL clock line */ 443 #define VBESCI_WrtSDADatLine 0x14 /* Write SDA data line */ 444 #define VBESCI_RdySCLClkLine 0x15 /* Read SCL clock line */ 445 #define VBESCI_RdySDADatLine 0x16 /* Read SDA data line */ 586 /** VBE/SCI subfunction - Report VBE/SCI Capabilities */ 587 #define VBESCI_ReportCapabil 0x10 588 /** VBE/SCI subfunction - Begin SCL/SDA control */ 589 #define VBESCI_BegSCLSDACtrl 0x11 590 /** VBE/SCI subfunction - End SCL/SDA control */ 591 #define VBESCI_EndSCLSDACtrl 0x12 592 /** VBE/SCI subfunction - Write SCL clock line */ 593 #define VBESCI_WrtSCLClkLine 0x13 594 /** VBE/SCI subfunction - Write SDA data line */ 595 #define VBESCI_WrtSDADatLine 0x14 596 /** VBE/SCI subfunction - Read SCL clock line */ 597 #define VBESCI_RdySCLClkLine 0x15 598 /** VBE/SCI subfunction - Read SDA data line */ 599 #define VBESCI_RdySDADatLine 0x16 446 600 447 601 /* SCI Capabilities */ 448 602 /* I2C level supported - returned in BL register */ 449 #define VBESCI_capSCLwrtMask 0x1 /* Can write to SCL clock line */ 450 #define VBESCI_capSDAwrtMask 0x2 /* Can write to SDA data line */ 451 #define VBESCI_capSCLrdyMask 0x4 /* Can read from SCL clock line */ 452 #define VBESCI_capSDArdyMask 0x8 /* Can read from SDA data line */ 603 /** Can write to SCL clock line */ 604 #define VBESCI_capSCLwrtMask 0x1 605 /** Can write to SDA data line */ 606 #define VBESCI_capSDAwrtMask 0x2 607 /** Can read from SCL clock line */ 608 #define VBESCI_capSCLrdyMask 0x4 609 /** Can read from SDA data line */ 610 #define VBESCI_capSDArdyMask 0x8 453 611 454 612 -
c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.c
rd78eac6 r038e1dba 1 /** 2 * @file realmode_int.c 3 * 4 * @ingroup i386_shared 5 * 6 * @brief Real mode interrupt call implementation 7 */ 8 1 9 /* 2 * Realmode interrupt call implementation. 3 * 4 * 5 * Copyright (c) 2014 - CTU in Prague 6 * Jan DoleÅŸal ( dolezj21@fel.cvut.cz ) 10 * Copyright (c) 2014 - CTU in Prague 11 * Jan DoleÅŸal ( dolezj21@fel.cvut.cz ) 7 12 * 8 13 * The license and distribution terms for this file may be 9 14 * found in the file LICENSE in this distribution or at 10 15 * http://www.rtems.org/license/LICENSE. 11 *12 16 */ 13 17 … … 16 20 #include <rtems/score/cpu.h> 17 21 22 /* 23 * offsets to \a i386_realmode_interrupt_registers declared in realmode_int.h 24 * used in inline assmbler for better readability 25 */ 18 26 #define IR_EAX_OFF "0x00" 19 27 #define IR_EBX_OFF "0x04" … … 27 35 #define IR_GS_OFF "0x1E" 28 36 37 /* 38 * offsets to \a rm_int_regs_bkp_param 39 */ 29 40 #define BKP_ESP_OFF "0x20" 30 41 #define BKP_SS_OFF "0x24" … … 33 44 #define PM_ENTRY "0x2C" 34 45 35 /* parameters, results, backup values accessible in real mode */ 46 /** 47 * @brief parameters, results, backup values accessible in real mode 48 * 49 * @note Struct members not necessarily used in C. This serves also as 50 * layout of memory and it is used within inline assembler. 51 */ 36 52 typedef struct { 37 53 i386_realmode_interrupt_registers inoutregs; 54 /** spot for back up of protected mode stack pointer */ 38 55 uint32_t pm_esp_bkp; 56 /** spot for back up of protected mode stack selector */ 39 57 uint16_t pm_ss_bkp; 58 /** spot for back up of protected mode data selector */ 40 59 uint16_t ds_bkp; 60 /** spot for setting up long indirect jump offset 61 to real mode from 16bit protected mode */ 41 62 uint16_t rm_entry; 63 /** spot for setting up long indirect jump segment 64 to real mode from 16bit protected mode */ 42 65 uint16_t rm_code_segment; 66 /** returning offset for long indirect jump back 67 to 32bit protected mode */ 43 68 uint32_t pm_entry; 69 /** returning selector for long indirect jump back 70 to 32bit protected mode */ 44 71 uint16_t pm_code_selector; 45 /* if modifyingupdate offset definitions as well */72 /* if this struct is to be modified update offset definitions as well */ 46 73 } RTEMS_COMPILER_PACKED_ATTRIBUTE rm_int_regs_bkp_param; 47 74 75 /* offsets to \a pm_bkp_and_param */ 48 76 #define BKP_IDTR_LIM "0x00" 49 77 #define BKP_IDTR_BASE "0x02" … … 56 84 #define RM_SP "0x16" 57 85 #define RM_DS "0x18" 58 /* backup values, pointers/parameters accessible in protected mode */ 86 87 /** 88 * @brief backup values, pointers/parameters accessible in protected mode 89 * 90 * @note Struct members not necessarily used in C. This serves also as 91 * layout of memory and it is used within inline assembler. 92 */ 59 93 typedef struct { 94 /** spot for backup protected mode interrupt descriptor table register */ 60 95 uint16_t idtr_lim_bkp; 96 /** @see idtr_lim_bkp */ 61 97 uint32_t idtr_base_bkp; 98 /** spot to backup of ES register value in 32bit protected mode */ 62 99 uint16_t es_bkp; 100 /** spot to backup of FS register value in 32bit protected mode */ 63 101 uint16_t fs_bkp; 102 /** spot to backup of GS register value in 32bit protected mode */ 64 103 uint16_t gs_bkp; 104 /** values for indirect jump to 16bit protected mode */ 65 105 uint32_t rml_entry; 106 /** @see rml_entry */ 66 107 uint16_t rml_code_selector; 108 /** data selector for 16bit protected mode */ 67 109 uint16_t rml_data_selector; 110 /** values determinig location of real mode stack */ 68 111 uint16_t rm_stack_segment; 112 /** @see rm_stack_segment */ 69 113 uint16_t rm_stack_pointer; 114 /** data segment for real mode */ 70 115 uint16_t rm_data_segment; 71 116 } RTEMS_COMPILER_PACKED_ATTRIBUTE pm_bkp_and_param; … … 113 158 static uint16_t rml_data_dsc_index = 0; 114 159 115 /* 116 * Prepares real-mode like descriptors to be used for switching160 /** 161 * @brief Prepares real-mode like descriptors to be used for switching 117 162 * to real mode. 118 163 * 164 * Descriptors will be placed to the GDT. 165 * 166 * @param[in] base32 32-bit physical address to be used as base for 16-bit 167 * protected mode descriptors 119 168 * @retval __DP_YES descriptors are prepared 120 169 * @retval __DP_FAIL descriptors allocation failed (GDT too small) -
c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h
rd78eac6 r038e1dba 5 5 * 6 6 * @brief Definitioins supporting real mode interrupt calls. 7 * 8 * Interface allows calling given interrupt number with content of the 9 * registers defined. For passing or receiving higher amounts of the data 10 * there is a buffer accessible from real mode available. Real mode pointer 11 * to this buffer is passed to the interrupt in the registers. 7 12 */ 8 13 9 14 /* 10 * Interface allows calling given interrupt number with content of the11 * registers defined. For passing or receiving higher amounts of the data12 * there is a buffer accessible from real mode available. Real mode pointer13 * to this buffer is passed to the interrupt in the registers.14 *15 15 * Copyright (C) 2014 Jan DoleÅŸal (dolezj21@fel.cvut.cz) 16 16 * CTU in Prague. … … 37 37 #define INTERRUPT_NO_VIDEO_SERVICES 0x10 38 38 39 typedef struct { /* used for passing parameters, fetching results and preserving values */ 39 /** 40 * @brief Used for passing and retrieving registers content to/from real mode 41 * interrupt call. 42 */ 43 typedef struct { 40 44 uint32_t reg_eax; 41 45 uint32_t reg_ebx; … … 51 55 52 56 /** 57 * @brief Returns buffer and its size usable with real mode interrupt call. 58 * 53 59 * Provides position to real mode buffer. It is buffer 54 60 * accessible from real mode context - it is located below … … 58 64 * interrupt service routine than just by using register. 59 65 * 60 * @param size pointer to variable, where the size of buffer61 * will be filled66 * @param[out] size pointer to variable, where the size of buffer 67 * will be filled 62 68 * @retval pointer to buffer 63 69 */ … … 65 71 66 72 /** 73 * @brief Call to real mode interrupt with specified int NO and processor 74 * registers. 75 * 67 76 * This function allows calling interrupts in real mode and to set processor 68 77 * registers as desired before interrupt call is made and to retrieve the 69 78 * registers content after call was made. 70 79 * 71 * @param interruptNumber interrupt number to be called72 * @param ir pointer to structure containing registers to be passed to interrupt73 * and to retrieve register content after call was made.80 * @param[in] interrupt_number interrupt number to be called 81 * @param[in] ir pointer to structure containing registers to be passed to 82 * interrupt and to retrieve register content after call was made. 74 83 * @retval 0 call failed (GDT too small or pagin is on) 75 * 84 * @retval 1 call successful 76 85 */ 77 86 extern int i386_real_interrupt_call( -
c/src/lib/libcpu/i386/cpu.h
rd78eac6 r038e1dba 1 1 /* 2 * cpu.h - This file contains definitions for data structure related 2 * @file cpu.h 3 * 4 * This file contains definitions for data structure related 3 5 * to Intel system programming. More information can be found 4 6 * on Intel site and more precisely in the following book : … … 242 244 * 243 245 */ 244 246 /** 247 * @brief describes one entry of Global/Local Descriptor Table 248 */ 245 249 typedef struct { 246 250 unsigned int limit_15_0 : 16; … … 273 277 274 278 /** 275 * C callable function: 276 * Puts global descriptor @sd to the global descriptor table on index 277 * @segment_selector_index 278 * 279 * @brief Allows to set a GDT entry. 280 * 281 * Puts global descriptor \p sd to the global descriptor table on index 282 * \p segment_selector_index 283 * 284 * @param[in] segment_selector_index index to GDT entry 285 * @param[in] sd structure to be coppied to given \p segment_selector in GDT 279 286 * @retval 0 FAILED out of GDT range or index is 0, which is not valid 280 287 * index in GDT 281 * 288 * @retval 1 SUCCESS 282 289 */ 283 290 extern uint32_t i386_raw_gdt_entry (uint16_t segment_selector_index, … … 285 292 286 293 /** 287 * C callable function 288 * fills @sd with provided @base in appropriate fields of @sd 289 * 290 * @param base 32-bit address to be set as descriptor's base 291 * @param sd descriptor being filled with @base 294 * @brief fills \p sd with provided \p base in appropriate fields of \p sd 295 * 296 * @param[in] base 32-bit address to be set as descriptor's base 297 * @param[out] sd descriptor being filled with \p base 292 298 */ 293 299 extern void i386_fill_segment_desc_base (uint32_t base, … … 295 301 296 302 /** 297 * C callable function298 * fills @sd with provided @limit in appropriate fields of @sd299 * also influences granularity bit300 * 301 * @param limit 32-bit value representing number of limit bytes302 * @param sd descriptor being filled with @limit303 * @brief fills \p sd with provided \p limit in appropriate fields of \p sd 304 * 305 * sets granularity bit if necessary 306 * 307 * @param[in] limit 32-bit value representing number of limit bytes 308 * @param[out] sd descriptor being filled with \p limit 303 309 */ 304 310 extern void i386_fill_segment_desc_limit (uint32_t limit, … … 313 319 314 320 /** 315 * C callable function returns next empty descriptor in GDT. 321 * @brief Returns next empty descriptor in GDT. 322 * 323 * Number of descriptors that can be returned depends on \a GDT_SIZE 316 324 * 317 325 * @retval 0 FAILED GDT is full 318 * 326 * @retval <1;65535> segment_selector number as index to GDT 319 327 */ 320 328 extern uint16_t i386_next_empty_gdt_entry (void); 321 329 322 330 /** 323 * Copies GDT entry at index @segment_selector to structure 324 * pointed to by @struct_to_fill 325 * 326 * @param segment_selector index to GDT table for specifying descriptor to copy 331 * @brief Copies GDT entry at index \p segment_selector to structure 332 * pointed to by \p struct_to_fill 333 * 334 * @param[in] segment_selector index to GDT table specifying descriptor to copy 335 * @param[out] struct_to_fill pointer to memory where will be descriptor coppied 327 336 * @retval 0 FAILED segment_selector out of GDT range 328 * 337 * @retval <1;65535> retrieved segment_selector 329 338 */ 330 339 extern uint16_t i386_cpy_gdt_entry (uint16_t segment_selector, … … 332 341 333 342 /** 334 * Returns pointer to GDT table at index given by @segment_selector335 * 336 * @param segment_selector index to GDT table for specifying descriptor to get343 * @brief Returns pointer to GDT table at index given by \p segment_selector 344 * 345 * @param[in] sgmnt_selector index to GDT table for specifying descriptor to get 337 346 * @retval NULL FAILED segment_selector out of GDT range 338 * pointer to GDT table at @segment_selector347 * @retval pointer to GDT table at \p segment_selector 339 348 */ 340 349 extern segment_descriptors* i386_get_gdt_entry (uint16_t sgmnt_selector); 341 350 342 351 /** 343 * Extracts base address from GDT entry pointed to by @gdt_entry344 * 345 * @param gdt_entry pointer to entry from which base should be retrieved352 * @brief Extracts base address from GDT entry pointed to by \p gdt_entry 353 * 354 * @param[in] gdt_entry pointer to entry from which base should be retrieved 346 355 * @retval base address from GDT entry 347 356 */ … … 354 363 355 364 /** 356 * Extracts limit in bytes from GDT entry pointed to by @gdt_entry357 * 358 * @param gdt_entry pointer to entry from which limit should be retrieved365 * @brief Extracts limit in bytes from GDT entry pointed to by \p gdt_entry 366 * 367 * @param[in] gdt_entry pointer to entry from which limit should be retrieved 359 368 * @retval limit value in bytes from GDT entry 360 369 */ -
cpukit/score/cpu/i386/cpu_asm.S
rd78eac6 r038e1dba 335 335 * ); 336 336 * 337 * Fills segment:offest real mode pointer counted from thirty-two bit physical337 * Fills segment:offest real mode pointer counted from thirty-two bit physical 338 338 * address. 339 * Returns 0 if unconvertible, 1 if successfuly converted.339 * Returns 0 if inconvertible, 1 if successfuly converted. 340 340 */ 341 341 -
cpukit/score/cpu/i386/rtems/score/i386.h
rd78eac6 r038e1dba 186 186 ); 187 187 188 /* 189 * i386_Real_to_physical 190 * 191 * Converts real mode pointer {segment, offset} to physical address. 188 /** 189 * @brief Converts real mode pointer {segment, offset} to physical address. 190 * 191 * i386_Real_to_physical 192 * 193 * @param[in] segment used with \p offset to compute physical address 194 * @param[in] offset used with \p segment to compute physical address 195 * @retval physical address 192 196 */ 193 197 RTEMS_INLINE_ROUTINE void *i386_Real_to_physical( … … 198 202 } 199 203 200 /* 201 * i386_Physical_to_real 202 * Retreives real mode pointer elements {segmnet, offset} from physical address 203 * Function returns the highest segment (base) address possible. 204 * Example: input address - 0x4B3A2 205 * output segment - 0x4B3A 206 * offset - 0x2 207 * input address - 0x10F12E 208 * output segment - 0xFFFF 209 * offset - 0xF13E 210 * 211 * return 0 address not convertible, must be less than 0x10FFEF 212 * 1 segment and offset extracted 204 /** 205 * @brief Retreives real mode pointer elements {segmnet, offset} from 206 * physical address. 207 * 208 * i386_Physical_to_real 209 * Function returns the highest segment (base) address possible. 210 * Example: input address - 0x4B3A2 211 * output segment - 0x4B3A 212 * offset - 0x2 213 * input address - 0x10F12E 214 * output segment - 0xFFFF 215 * offset - 0xF13E 216 * 217 * @param[in] address address to be converted, must be less than 0x10FFEF 218 * @param[out] segment segment computed from \p address 219 * @param[out] offset offset computed from \p address 220 * @retval 0 address not convertible 221 * @retval 1 segment and offset extracted 213 222 */ 214 223 int i386_Physical_to_real(
Note: See TracChangeset
for help on using the changeset viewer.