i386/pc386: cammelCase (struct and function names) to underscores, typedefed structs, break >80 chars lines, removed newlines at EOFs

fb_vesa_rm.c: removed inline from functions declared in fb_vesa.h
              removed unnecessary printks in the end of patch
edid.h, vbe3.h: switched from custom *PACKED_ATTRIBUTE at the structs to the
                RTEMS_COMPILER_PACKED_ATTRIBUTE for easier maintainability
                of doxygen
This commit is contained in:
Jan Dolezal
2014-12-04 00:56:38 +01:00
committed by Gedare Bloom
parent adc1dbeb39
commit d78eac64a8
7 changed files with 250 additions and 245 deletions

View File

@@ -59,14 +59,14 @@ static pthread_mutex_t vesa_mutex = PTHREAD_MUTEX_INITIALIZER;
static struct fb_var_screeninfo fb_var; static struct fb_var_screeninfo fb_var;
static struct fb_fix_screeninfo fb_fix; static struct fb_fix_screeninfo fb_fix;
static uint16_t vbe_usedMode; static uint16_t vbe_used_mode;
inline uint32_t VBEControllerInformation( struct VBE_VbeInfoBlock *infoBlock, uint32_t VBE_controller_information( VBE_vbe_info_block *info_block,
uint16_t queriedVBEVersion) uint16_t queried_VBE_Version)
{ {
uint16_t size; uint16_t size;
struct VBE_VbeInfoBlock *VBE_buffer = VBE_vbe_info_block *VBE_buffer =
(struct VBE_VbeInfoBlock *)i386_get_default_rm_buffer(&size); (VBE_vbe_info_block *)i386_get_default_rm_buffer(&size);
i386_realmode_interrupt_registers parret; i386_realmode_interrupt_registers parret;
parret.reg_eax = VBE_RetVBEConInf; parret.reg_eax = VBE_RetVBEConInf;
uint16_t seg, off; uint16_t seg, off;
@@ -74,7 +74,7 @@ inline uint32_t VBEControllerInformation( struct VBE_VbeInfoBlock *infoBlock,
parret.reg_edi = (uint32_t)off; parret.reg_edi = (uint32_t)off;
parret.reg_es = seg; parret.reg_es = seg;
/* indicate to graphic's bios that VBE2.0 extended information is desired */ /* indicate to graphic's bios that VBE2.0 extended information is desired */
if (queriedVBEVersion >= 0x200) if (queried_VBE_Version >= 0x200)
{ {
strncpy( strncpy(
(char *)&VBE_buffer->VbeSignature, (char *)&VBE_buffer->VbeSignature,
@@ -87,20 +87,20 @@ inline uint32_t VBEControllerInformation( struct VBE_VbeInfoBlock *infoBlock,
if ((parret.reg_eax & 0xFFFF) == if ((parret.reg_eax & 0xFFFF) ==
(VBE_callSuccessful<<8 | VBE_functionSupported)) (VBE_callSuccessful<<8 | VBE_functionSupported))
{ {
*infoBlock = *VBE_buffer; *info_block = *VBE_buffer;
} }
return (parret.reg_eax & 0xFFFF); return (parret.reg_eax & 0xFFFF);
} }
inline uint32_t VBEModeInformation( struct VBE_ModeInfoBlock *infoBlock, uint32_t VBE_mode_information( VBE_mode_info_block *info_block,
uint16_t modeNumber) uint16_t mode_number)
{ {
uint16_t size; uint16_t size;
struct VBE_ModeInfoBlock *VBE_buffer = VBE_mode_info_block *VBE_buffer =
(struct VBE_ModeInfoBlock *)i386_get_default_rm_buffer(&size); (VBE_mode_info_block *)i386_get_default_rm_buffer(&size);
i386_realmode_interrupt_registers parret; i386_realmode_interrupt_registers parret;
parret.reg_eax = VBE_RetVBEModInf; parret.reg_eax = VBE_RetVBEModInf;
parret.reg_ecx = modeNumber; parret.reg_ecx = mode_number;
uint16_t seg, off; uint16_t seg, off;
i386_Physical_to_real(VBE_buffer, &seg, &off); i386_Physical_to_real(VBE_buffer, &seg, &off);
parret.reg_edi = (uint32_t)off; parret.reg_edi = (uint32_t)off;
@@ -110,22 +110,22 @@ inline uint32_t VBEModeInformation( struct VBE_ModeInfoBlock *infoBlock,
if ((parret.reg_eax & 0xFFFF) == if ((parret.reg_eax & 0xFFFF) ==
(VBE_callSuccessful<<8 | VBE_functionSupported)) (VBE_callSuccessful<<8 | VBE_functionSupported))
{ {
*infoBlock = *VBE_buffer; *info_block = *VBE_buffer;
} }
return (parret.reg_eax & 0xFFFF); return (parret.reg_eax & 0xFFFF);
} }
inline uint32_t VBESetMode( uint16_t modeNumber, uint32_t VBE_set_mode( uint16_t mode_number,
struct VBE_CRTCInfoBlock *infoBlock) VBE_CRTC_info_block *info_block)
{ {
uint16_t size; uint16_t size;
struct VBE_CRTCInfoBlock *VBE_buffer = VBE_CRTC_info_block *VBE_buffer =
(struct VBE_CRTCInfoBlock *)i386_get_default_rm_buffer(&size); (VBE_CRTC_info_block *)i386_get_default_rm_buffer(&size);
i386_realmode_interrupt_registers parret; i386_realmode_interrupt_registers parret;
/* copy CRTC */ /* copy CRTC */
*VBE_buffer = *infoBlock; *VBE_buffer = *info_block;
parret.reg_eax = VBE_SetVBEMod; parret.reg_eax = VBE_SetVBEMod;
parret.reg_ebx = modeNumber; parret.reg_ebx = mode_number;
uint16_t seg, off; uint16_t seg, off;
i386_Physical_to_real(VBE_buffer, &seg, &off); i386_Physical_to_real(VBE_buffer, &seg, &off);
parret.reg_edi = (uint32_t)off; parret.reg_edi = (uint32_t)off;
@@ -135,44 +135,44 @@ inline uint32_t VBESetMode( uint16_t modeNumber,
return (parret.reg_eax & 0xFFFF); return (parret.reg_eax & 0xFFFF);
} }
inline uint32_t VBECurrentMode(uint16_t *modeNumber) uint32_t VBE_current_mode(uint16_t *mode_number)
{ {
i386_realmode_interrupt_registers parret; i386_realmode_interrupt_registers parret;
parret.reg_eax = VBE_RetCurVBEMod; parret.reg_eax = VBE_RetCurVBEMod;
if (i386_real_interrupt_call(INTERRUPT_NO_VIDEO_SERVICES, &parret) == 0) if (i386_real_interrupt_call(INTERRUPT_NO_VIDEO_SERVICES, &parret) == 0)
return -1; return -1;
*modeNumber = (uint16_t)parret.reg_ebx; *mode_number = (uint16_t)parret.reg_ebx;
return (parret.reg_eax & 0xFFFF); return (parret.reg_eax & 0xFFFF);
} }
inline uint32_t VBEReportDDCCapabilities( uint16_t controllerUnitNumber, uint32_t VBE_report_DDC_capabilities(uint16_t controller_unit_number,
uint8_t *secondsToTransferEDIDBlock, uint8_t *seconds_to_transfer_EDID_block,
uint8_t *DDCLevelSupported) uint8_t *DDC_level_supported)
{ {
i386_realmode_interrupt_registers parret; i386_realmode_interrupt_registers parret;
parret.reg_eax = VBE_DisDatCha; parret.reg_eax = VBE_DisDatCha;
parret.reg_ebx = VBEDDC_Capabilities; parret.reg_ebx = VBEDDC_Capabilities;
parret.reg_ecx = controllerUnitNumber; parret.reg_ecx = controller_unit_number;
parret.reg_edi = 0; parret.reg_edi = 0;
parret.reg_es = 0; parret.reg_es = 0;
if (i386_real_interrupt_call(INTERRUPT_NO_VIDEO_SERVICES, &parret) == 0) if (i386_real_interrupt_call(INTERRUPT_NO_VIDEO_SERVICES, &parret) == 0)
return -1; return -1;
*secondsToTransferEDIDBlock = (uint8_t)parret.reg_ebx >> 8; *seconds_to_transfer_EDID_block = (uint8_t)parret.reg_ebx >> 8;
*DDCLevelSupported = (uint8_t)parret.reg_ebx; *DDC_level_supported = (uint8_t)parret.reg_ebx;
return (parret.reg_eax & 0xFFFF); return (parret.reg_eax & 0xFFFF);
} }
inline uint32_t VBEReadEDID(uint16_t controllerUnitNumber, uint32_t VBE_read_EDID(uint16_t controller_unit_number,
uint16_t EDIDBlockNumber, uint16_t EDID_block_number,
struct edid1 *buffer) EDID_edid1 *buffer)
{ {
uint16_t size; uint16_t size;
struct edid1 *VBE_buffer = (struct edid1 *)i386_get_default_rm_buffer(&size); EDID_edid1 *VBE_buffer = (EDID_edid1*)i386_get_default_rm_buffer(&size);
i386_realmode_interrupt_registers parret; i386_realmode_interrupt_registers parret;
parret.reg_eax = VBE_DisDatCha; parret.reg_eax = VBE_DisDatCha;
parret.reg_ebx = VBEDDC_ReadEDID; parret.reg_ebx = VBEDDC_ReadEDID;
parret.reg_ecx = controllerUnitNumber; parret.reg_ecx = controller_unit_number;
parret.reg_edx = EDIDBlockNumber; parret.reg_edx = EDID_block_number;
uint16_t seg, off; uint16_t seg, off;
i386_Physical_to_real(VBE_buffer, &seg, &off); i386_Physical_to_real(VBE_buffer, &seg, &off);
parret.reg_edi = (uint32_t)off; parret.reg_edi = (uint32_t)off;
@@ -188,11 +188,11 @@ inline uint32_t VBEReadEDID(uint16_t controllerUnitNumber,
} }
typedef struct { typedef struct {
uint16_t modeNumber; uint16_t mode_number;
uint16_t resX; uint16_t resX;
uint16_t resY; uint16_t resY;
uint8_t bpp; uint8_t bpp;
} modeParams; } Mode_params;
/* finds mode in 'modeList' of 'listLength' length according to resolution /* finds mode in 'modeList' of 'listLength' length according to resolution
given in 'searchedResolution'. If bpp is given in that struct as well given in 'searchedResolution'. If bpp is given in that struct as well
@@ -200,22 +200,22 @@ typedef struct {
has to be zero. Mode number found is returned and also filled into has to be zero. Mode number found is returned and also filled into
'searchedResolution'. bpp is also filled into 'searchedResolution' if it 'searchedResolution'. bpp is also filled into 'searchedResolution' if it
was 0 before call. */ was 0 before call. */
static uint16_t findModeByResolution( modeParams *modeList, static uint16_t find_mode_by_resolution(Mode_params *mode_list,
uint8_t listLength, uint8_t list_length,
modeParams *searchedResolution) Mode_params *searched_resolution)
{ {
uint8_t i = 0; uint8_t i = 0;
while (i < listLength) while (i < list_length)
{ {
if (searchedResolution->resX == modeList[i].resX && if (searched_resolution->resX == mode_list[i].resX &&
searchedResolution->resY == modeList[i].resY) searched_resolution->resY == mode_list[i].resY)
{ {
if (searchedResolution->bpp==0 || if (searched_resolution->bpp==0 ||
searchedResolution->bpp==modeList[i].bpp) searched_resolution->bpp==mode_list[i].bpp)
{ {
searchedResolution->bpp = modeList[i].bpp; searched_resolution->bpp = mode_list[i].bpp;
searchedResolution->modeNumber = modeList[i].modeNumber; searched_resolution->mode_number = mode_list[i].mode_number;
return modeList[i].modeNumber; return mode_list[i].mode_number;
} }
} }
i++; i++;
@@ -232,33 +232,33 @@ static uint16_t findModeByResolution( modeParams *modeList,
* @retval video mode number to be set * @retval video mode number to be set
* -1 on parsing error or when no suitable mode found * -1 on parsing error or when no suitable mode found
*/ */
static uint16_t findModeUsingCmdline( modeParams *modeList, static uint16_t find_mode_using_cmdline(Mode_params *mode_list,
uint8_t listLength) uint8_t list_length)
{ {
const char* opt; const char* opt;
modeParams cmdlineMode; Mode_params cmdline_mode;
char* endptr; char* endptr;
cmdlineMode.bpp = 0; cmdline_mode.bpp = 0;
opt = bsp_cmdline_arg("--video="); opt = bsp_cmdline_arg("--video=");
if (opt) if (opt)
{ {
opt += sizeof("--video=")-1; opt += sizeof("--video=")-1;
cmdlineMode.resX = strtol(opt, &endptr, 10); cmdline_mode.resX = strtol(opt, &endptr, 10);
if (*endptr != 'x') if (*endptr != 'x')
{ {
return -1; return -1;
} }
opt = endptr+1; opt = endptr+1;
cmdlineMode.resY = strtol(opt, &endptr, 10); cmdline_mode.resY = strtol(opt, &endptr, 10);
switch (*endptr) switch (*endptr)
{ {
case '-': case '-':
opt = endptr+1; opt = endptr+1;
if (strlen(opt) <= 2) if (strlen(opt) <= 2)
cmdlineMode.bpp = strtol(opt, &endptr, 10); cmdline_mode.bpp = strtol(opt, &endptr, 10);
else else
{ {
cmdlineMode.bpp = strtol(opt, &endptr, 10); cmdline_mode.bpp = strtol(opt, &endptr, 10);
if (*endptr != ' ') if (*endptr != ' ')
{ {
return -1; return -1;
@@ -271,9 +271,9 @@ static uint16_t findModeUsingCmdline( modeParams *modeList,
return -1; return -1;
} }
if (findModeByResolution(modeList, listLength, &cmdlineMode) != if (find_mode_by_resolution(mode_list, list_length, &cmdline_mode) !=
(uint16_t)-1) (uint16_t)-1)
return cmdlineMode.modeNumber; return cmdline_mode.mode_number;
} }
return -1; return -1;
} }
@@ -284,17 +284,17 @@ static uint16_t findModeUsingCmdline( modeParams *modeList,
* @retval video mode number to be set * @retval video mode number to be set
* -1 on parsing error or when no suitable mode found * -1 on parsing error or when no suitable mode found
*/ */
static uint16_t findModeUsingEDID( modeParams *modeList, static uint16_t find_mode_using_EDID( Mode_params *mode_list,
uint8_t listLength) uint8_t list_length)
{ {
struct edid1 edid; EDID_edid1 edid;
uint8_t checksum, iterator; uint8_t checksum, iterator;
uint8_t index, j; uint8_t index, j;
modeParams EDIDmode; Mode_params EDIDmode;
checksum = 0; checksum = 0;
iterator = 0; iterator = 0;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (VBEReadEDID(0, 0, &edid) != if (VBE_read_EDID(0, 0, &edid) !=
(VBE_callSuccessful<<8 | VBE_functionSupported)) (VBE_callSuccessful<<8 | VBE_functionSupported))
{ {
printk(FB_VESA_NAME " Function 15h (read EDID) not supported.\n"); printk(FB_VESA_NAME " Function 15h (read EDID) not supported.\n");
@@ -303,7 +303,7 @@ static uint16_t findModeUsingEDID( modeParams *modeList,
/* version of EDID structure */ /* version of EDID structure */
if (edid.Version == 1) if (edid.Version == 1)
{ /* EDID version 1 */ { /* EDID version 1 */
while (iterator < sizeof(struct edid1)) while (iterator < sizeof(EDID_edid1))
{ {
checksum += *((uint8_t *)&edid+iterator); checksum += *((uint8_t *)&edid+iterator);
iterator++; iterator++;
@@ -325,11 +325,11 @@ static uint16_t findModeUsingEDID( modeParams *modeList,
index++; index++;
continue; continue;
} }
EDIDmode.resX = DTD_HorizontalActive(&edid.dtd_md[0].dtd); EDIDmode.resX = DTD_horizontal_active(&edid.dtd_md[0].dtd);
EDIDmode.resY = DTD_VerticalActive(&edid.dtd_md[0].dtd); EDIDmode.resY = DTD_vertical_active(&edid.dtd_md[0].dtd);
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
index++; index++;
} }
@@ -350,13 +350,15 @@ static uint16_t findModeUsingEDID( modeParams *modeList,
edid.dtd_md[index].md.Flag1 == 0 && edid.dtd_md[index].md.Flag1 == 0 &&
edid.dtd_md[index].md.Flag2 == 0) edid.dtd_md[index].md.Flag2 == 0)
{ {
struct CVTTimingCodes3B *cvt = (struct CVTTimingCodes3B *) EDID_CVT_timing_codes_3B *cvt = (EDID_CVT_timing_codes_3B *)
&edid.dtd_md[index].md.DescriptorData[0]; &edid.dtd_md[index].md.DescriptorData[0];
j = 0; j = 0;
while (j < 4) while (j < 4)
{ {
EDIDmode.resY = edid1_CVT_AddressableLinesHigh(&cvt->cvt[j]); EDIDmode.resY = edid1_CVT_addressable_lines_high(
switch (edid1_CVT_AspectRatio(&cvt->cvt[j])) &cvt->cvt[j]
);
switch (edid1_CVT_aspect_ratio(&cvt->cvt[j]))
{ {
case EDID_CVT_AspectRatio_4_3: case EDID_CVT_AspectRatio_4_3:
EDIDmode.resX = (EDIDmode.resY*4)/3; EDIDmode.resX = (EDIDmode.resY*4)/3;
@@ -372,9 +374,9 @@ static uint16_t findModeUsingEDID( modeParams *modeList,
break; break;
} }
EDIDmode.resX = (EDIDmode.resX/8)*8; EDIDmode.resX = (EDIDmode.resX/8)*8;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(
(uint16_t)-1) mode_list, list_length, &EDIDmode) != (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
j++; j++;
} }
@@ -396,7 +398,8 @@ static uint16_t findModeUsingEDID( modeParams *modeList,
continue; continue;
} }
EDIDmode.resX = (edid.STI[index].HorizontalActivePixels+31)*8; EDIDmode.resX = (edid.STI[index].HorizontalActivePixels+31)*8;
switch (edid.STI[index].ImageAspectRatio_RefreshRate & EDID1_STI_ImageAspectRatioMask) switch (edid.STI[index].ImageAspectRatio_RefreshRate &
EDID1_STI_ImageAspectRatioMask)
{ {
case EDID_STI_AspectRatio_16_10: case EDID_STI_AspectRatio_16_10:
EDIDmode.resY = (EDIDmode.resX*10)/16; EDIDmode.resY = (EDIDmode.resX*10)/16;
@@ -411,9 +414,9 @@ static uint16_t findModeUsingEDID( modeParams *modeList,
EDIDmode.resY = (EDIDmode.resX*9)/16; EDIDmode.resY = (EDIDmode.resX*9)/16;
break; break;
} }
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
index++; index++;
} }
@@ -421,78 +424,78 @@ static uint16_t findModeUsingEDID( modeParams *modeList,
in controller mode list */ in controller mode list */
/* not implemented */ /* not implemented */
/* use Established Timings */ /* use Established Timings */
if (edid1_EstablishedTim(&edid, EST_1280x1024_75Hz)) if (edid1_established_tim(&edid, EST_1280x1024_75Hz))
{ {
EDIDmode.resX = 1280; EDIDmode.resX = 1280;
EDIDmode.resY = 1024; EDIDmode.resY = 1024;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
} }
if (edid1_EstablishedTim(&edid, EST_1152x870_75Hz)) if (edid1_established_tim(&edid, EST_1152x870_75Hz))
{ {
EDIDmode.resX = 1152; EDIDmode.resX = 1152;
EDIDmode.resY = 870; EDIDmode.resY = 870;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
} }
if (edid1_EstablishedTim(&edid, EST_1024x768_75Hz) || if (edid1_established_tim(&edid, EST_1024x768_75Hz) ||
edid1_EstablishedTim(&edid, EST_1024x768_70Hz) || edid1_established_tim(&edid, EST_1024x768_70Hz) ||
edid1_EstablishedTim(&edid, EST_1024x768_60Hz) || edid1_established_tim(&edid, EST_1024x768_60Hz) ||
edid1_EstablishedTim(&edid, EST_1024x768_87Hz)) edid1_established_tim(&edid, EST_1024x768_87Hz))
{ {
EDIDmode.resX = 1024; EDIDmode.resX = 1024;
EDIDmode.resY = 768; EDIDmode.resY = 768;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
} }
if (edid1_EstablishedTim(&edid, EST_832x624_75Hz)) if (edid1_established_tim(&edid, EST_832x624_75Hz))
{ {
EDIDmode.resX = 832; EDIDmode.resX = 832;
EDIDmode.resY = 624; EDIDmode.resY = 624;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
} }
if (edid1_EstablishedTim(&edid, EST_800x600_60Hz) || if (edid1_established_tim(&edid, EST_800x600_60Hz) ||
edid1_EstablishedTim(&edid, EST_800x600_56Hz) || edid1_established_tim(&edid, EST_800x600_56Hz) ||
edid1_EstablishedTim(&edid, EST_800x600_75Hz) || edid1_established_tim(&edid, EST_800x600_75Hz) ||
edid1_EstablishedTim(&edid, EST_800x600_72Hz)) edid1_established_tim(&edid, EST_800x600_72Hz))
{ {
EDIDmode.resX = 800; EDIDmode.resX = 800;
EDIDmode.resY = 600; EDIDmode.resY = 600;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
} }
if (edid1_EstablishedTim(&edid, EST_720x400_88Hz) || if (edid1_established_tim(&edid, EST_720x400_88Hz) ||
edid1_EstablishedTim(&edid, EST_720x400_70Hz)) edid1_established_tim(&edid, EST_720x400_70Hz))
{ {
EDIDmode.resX = 720; EDIDmode.resX = 720;
EDIDmode.resY = 400; EDIDmode.resY = 400;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
} }
if (edid1_EstablishedTim(&edid, EST_640x480_75Hz) || if (edid1_established_tim(&edid, EST_640x480_75Hz) ||
edid1_EstablishedTim(&edid, EST_640x480_72Hz) || edid1_established_tim(&edid, EST_640x480_72Hz) ||
edid1_EstablishedTim(&edid, EST_640x480_67Hz) || edid1_established_tim(&edid, EST_640x480_67Hz) ||
edid1_EstablishedTim(&edid, EST_640x480_60Hz)) edid1_established_tim(&edid, EST_640x480_60Hz))
{ {
EDIDmode.resX = 640; EDIDmode.resX = 640;
EDIDmode.resY = 480; EDIDmode.resY = 480;
EDIDmode.bpp = 0; EDIDmode.bpp = 0;
if (findModeByResolution(modeList, listLength, &EDIDmode) != if (find_mode_by_resolution(mode_list, list_length, &EDIDmode) !=
(uint16_t)-1) (uint16_t)-1)
return EDIDmode.modeNumber; return EDIDmode.mode_number;
} }
} }
else else
@@ -504,9 +507,9 @@ void vesa_realmode_bootup_init(void)
{ {
uint32_t vbe_ret_val; uint32_t vbe_ret_val;
uint16_t size; uint16_t size;
struct VBE_VbeInfoBlock *vib = (struct VBE_VbeInfoBlock *) VBE_vbe_info_block *vib = (VBE_vbe_info_block *)
i386_get_default_rm_buffer(&size); i386_get_default_rm_buffer(&size);
vbe_ret_val = VBEControllerInformation(vib, 0x300); vbe_ret_val = VBE_controller_information(vib, 0x300);
if (vbe_ret_val == -1) if (vbe_ret_val == -1)
{ {
printk(FB_VESA_NAME " error calling real mode interrupt.\n"); printk(FB_VESA_NAME " error calling real mode interrupt.\n");
@@ -525,7 +528,7 @@ void vesa_realmode_bootup_init(void)
structure and if found we set such mode using corresponding structure and if found we set such mode using corresponding
VESA function. */ VESA function. */
#define MAX_NO_OF_SORTED_MODES 100 #define MAX_NO_OF_SORTED_MODES 100
modeParams sortModeParams[MAX_NO_OF_SORTED_MODES]; Mode_params sorted_mode_params[MAX_NO_OF_SORTED_MODES];
uint16_t *vmpSegOff = (uint16_t *)&vib->VideoModePtr; uint16_t *vmpSegOff = (uint16_t *)&vib->VideoModePtr;
uint16_t *modeNOPtr = (uint16_t*) uint16_t *modeNOPtr = (uint16_t*)
@@ -543,17 +546,17 @@ void vesa_realmode_bootup_init(void)
{ /* some bios implementations ends the list incorrectly with 0 */ { /* some bios implementations ends the list incorrectly with 0 */
if (iterator < MAX_NO_OF_SORTED_MODES) if (iterator < MAX_NO_OF_SORTED_MODES)
{ {
sortModeParams[iterator].modeNumber = *(modeNOPtr+iterator); sorted_mode_params[iterator].mode_number =*(modeNOPtr+iterator);
iterator ++; iterator ++;
} }
else else
break; break;
} }
if (iterator < MAX_NO_OF_SORTED_MODES) if (iterator < MAX_NO_OF_SORTED_MODES)
sortModeParams[iterator].modeNumber = 0; sorted_mode_params[iterator].mode_number = 0;
} }
struct VBE_ModeInfoBlock *mib = (struct VBE_ModeInfoBlock *) VBE_mode_info_block *mib = (VBE_mode_info_block *)
i386_get_default_rm_buffer(&size); i386_get_default_rm_buffer(&size);
iterator = 0; iterator = 0;
uint8_t nextFilteredMode = 0; uint8_t nextFilteredMode = 0;
@@ -562,45 +565,49 @@ void vesa_realmode_bootup_init(void)
/* get parameters of modes and filter modes according to set /* get parameters of modes and filter modes according to set
required parameters */ required parameters */
while (iterator < MAX_NO_OF_SORTED_MODES && while (iterator < MAX_NO_OF_SORTED_MODES &&
sortModeParams[iterator].modeNumber!=0) sorted_mode_params[iterator].mode_number!=0)
{ {
VBEModeInformation(mib, sortModeParams[iterator].modeNumber); VBE_mode_information(mib, sorted_mode_params[iterator].mode_number);
if ((mib->ModeAttributes&required_mode_attributes) == if ((mib->ModeAttributes&required_mode_attributes) ==
required_mode_attributes) required_mode_attributes)
{ {
sortModeParams[nextFilteredMode].modeNumber = sorted_mode_params[nextFilteredMode].mode_number =
sortModeParams[iterator].modeNumber; sorted_mode_params[iterator].mode_number;
sortModeParams[nextFilteredMode].resX = mib->XResolution; sorted_mode_params[nextFilteredMode].resX = mib->XResolution;
sortModeParams[nextFilteredMode].resY = mib->YResolution; sorted_mode_params[nextFilteredMode].resY = mib->YResolution;
sortModeParams[nextFilteredMode].bpp = mib->BitsPerPixel; sorted_mode_params[nextFilteredMode].bpp = mib->BitsPerPixel;
nextFilteredMode ++; nextFilteredMode ++;
} }
iterator ++; iterator ++;
} }
sortModeParams[nextFilteredMode].modeNumber = 0; sorted_mode_params[nextFilteredMode].mode_number = 0;
uint8_t numberOfModes = nextFilteredMode; uint8_t number_of_modes = nextFilteredMode;
/* sort filtered modes */ /* sort filtered modes */
modeParams modeXchgPlace; Mode_params modeXchgPlace;
iterator = 0; iterator = 0;
uint8_t j; uint8_t j;
uint8_t idxBestMode; uint8_t idxBestMode;
while (iterator < numberOfModes) while (iterator < number_of_modes)
{ {
idxBestMode = iterator; idxBestMode = iterator;
j = iterator+1; j = iterator+1;
while (j < numberOfModes) while (j < number_of_modes)
{ {
if (sortModeParams[j].resX > sortModeParams[idxBestMode].resX) if (sorted_mode_params[j].resX >
sorted_mode_params[idxBestMode].resX)
idxBestMode = j; idxBestMode = j;
else if (sortModeParams[j].resX == sortModeParams[idxBestMode].resX) else if (sorted_mode_params[j].resX ==
sorted_mode_params[idxBestMode].resX)
{ {
if (sortModeParams[j].resY > sortModeParams[idxBestMode].resY) if (sorted_mode_params[j].resY >
sorted_mode_params[idxBestMode].resY)
idxBestMode = j; idxBestMode = j;
else if (sortModeParams[j].resY == else if (sorted_mode_params[j].resY ==
sortModeParams[idxBestMode].resY) sorted_mode_params[idxBestMode].resY)
{ {
if (sortModeParams[j].bpp > sortModeParams[idxBestMode].bpp) if (sorted_mode_params[j].bpp >
sorted_mode_params[idxBestMode].bpp)
idxBestMode = j; idxBestMode = j;
} }
} }
@@ -608,32 +615,34 @@ void vesa_realmode_bootup_init(void)
} }
if (idxBestMode != iterator) if (idxBestMode != iterator)
{ {
modeXchgPlace = sortModeParams[iterator]; modeXchgPlace = sorted_mode_params[iterator];
sortModeParams[iterator] = sortModeParams[idxBestMode]; sorted_mode_params[iterator] = sorted_mode_params[idxBestMode];
sortModeParams[idxBestMode] = modeXchgPlace; sorted_mode_params[idxBestMode] = modeXchgPlace;
} }
iterator++; iterator++;
} }
/* first search for video argument in multiboot options */ /* first search for video argument in multiboot options */
vbe_usedMode = findModeUsingCmdline(sortModeParams, numberOfModes); vbe_used_mode = find_mode_using_cmdline(sorted_mode_params,
if (vbe_usedMode == (uint16_t)-1) number_of_modes);
if (vbe_used_mode == (uint16_t)-1)
{ {
printk(FB_VESA_NAME " video on command line not provided" printk(FB_VESA_NAME " video on command line not provided"
"\n\ttrying EDID ...\n"); "\n\ttrying EDID ...\n");
/* second search monitor for good resolution */ /* second search monitor for good resolution */
vbe_usedMode = findModeUsingEDID(sortModeParams, numberOfModes); vbe_used_mode = find_mode_using_EDID(sorted_mode_params,
if (vbe_usedMode == (uint16_t)-1) number_of_modes);
if (vbe_used_mode == (uint16_t)-1)
{ {
printk(FB_VESA_NAME" monitor's EDID video parameters not supported" printk(FB_VESA_NAME" monitor's EDID video parameters not supported"
"\n\tusing mode with highest resolution, bpp\n"); "\n\tusing mode with highest resolution, bpp\n");
/* third set highest values */ /* third set highest values */
vbe_usedMode = sortModeParams[0].modeNumber; vbe_used_mode = sorted_mode_params[0].mode_number;
} }
} }
/* fill framebuffer structs with info about selected mode */ /* fill framebuffer structs with info about selected mode */
vbe_ret_val = VBEModeInformation(mib, vbe_usedMode); vbe_ret_val = VBE_mode_information(mib, vbe_used_mode);
if ((vbe_ret_val&0xff)!=VBE_functionSupported || if ((vbe_ret_val&0xff)!=VBE_functionSupported ||
(vbe_ret_val>>8)!=VBE_callSuccessful) (vbe_ret_val>>8)!=VBE_callSuccessful)
{ {
@@ -667,8 +676,8 @@ void vesa_realmode_bootup_init(void)
fb_fix.visual = FB_VISUAL_TRUECOLOR; fb_fix.visual = FB_VISUAL_TRUECOLOR;
/* set selected mode */ /* set selected mode */
vbe_ret_val = VBESetMode(vbe_usedMode | VBE_linearFlatFrameBufMask, vbe_ret_val = VBE_set_mode(vbe_used_mode | VBE_linearFlatFrameBufMask,
(struct VBE_CRTCInfoBlock *)(i386_get_default_rm_buffer(&size))); (VBE_CRTC_info_block *)(i386_get_default_rm_buffer(&size)));
if (vbe_ret_val>>8 == VBE_callFailed) if (vbe_ret_val>>8 == VBE_callFailed)
printk(FB_VESA_NAME " VBE: Requested mode is not available."); printk(FB_VESA_NAME " VBE: Requested mode is not available.");
@@ -799,14 +808,12 @@ frame_buffer_write(
static int get_fix_screen_info( struct fb_fix_screeninfo *info ) static int get_fix_screen_info( struct fb_fix_screeninfo *info )
{ {
printk("get_fix_screen_info\n");
*info = fb_fix; *info = fb_fix;
return 0; return 0;
} }
static int get_var_screen_info( struct fb_var_screeninfo *info ) static int get_var_screen_info( struct fb_var_screeninfo *info )
{ {
printk("get_var_screen_info\n");
*info = fb_var; *info = fb_var;
return 0; return 0;
} }

View File

@@ -34,7 +34,6 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#include <rtems/score/basedefs.h> #include <rtems/score/basedefs.h>
#define EDID_PACKED_ATTRIBUTE RTEMS_COMPILER_PACKED_ATTRIBUTE
#define EDID_INLINE_ROUTINE RTEMS_INLINE_ROUTINE #define EDID_INLINE_ROUTINE RTEMS_INLINE_ROUTINE
/* VESA Enhanced Extended Display Identification Data (E-EDID) Proposed /* VESA Enhanced Extended Display Identification Data (E-EDID) Proposed
@@ -70,7 +69,7 @@ extern "C" {
#define EDID1_DTD_HorizontalSyncIsPositiveOff 1 #define EDID1_DTD_HorizontalSyncIsPositiveOff 1
#define EDID1_DTD_HorizontalSyncIsPositiveMask 0x1 #define EDID1_DTD_HorizontalSyncIsPositiveMask 0x1
struct DetailedTimingDescriptor { typedef struct {
uint8_t PixelClock_div10000[2]; uint8_t PixelClock_div10000[2];
uint8_t HorizontalActiveLow; uint8_t HorizontalActiveLow;
uint8_t HorizontalBlankingLow; uint8_t HorizontalBlankingLow;
@@ -88,85 +87,85 @@ struct DetailedTimingDescriptor {
uint8_t HorizontalBorder; uint8_t HorizontalBorder;
uint8_t VerticalBorder; uint8_t VerticalBorder;
uint8_t Flags; uint8_t Flags;
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_detailed_timing_descriptor;
EDID_INLINE_ROUTINE uint16_t DTD_HorizontalActive ( EDID_INLINE_ROUTINE uint16_t DTD_horizontal_active (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->HorizontalActiveLow | return (dtd->HorizontalActiveLow |
(dtd->HorizontalBlanking_ActiveHigh & 0xF0) << 4); (dtd->HorizontalBlanking_ActiveHigh & 0xF0) << 4);
} }
EDID_INLINE_ROUTINE uint16_t DTD_HorizontalBlanking ( EDID_INLINE_ROUTINE uint16_t DTD_horizontal_blanking (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->HorizontalBlankingLow | return (dtd->HorizontalBlankingLow |
(dtd->HorizontalBlanking_ActiveHigh & 0xF) << 8); (dtd->HorizontalBlanking_ActiveHigh & 0xF) << 8);
} }
EDID_INLINE_ROUTINE uint16_t DTD_VerticalActive ( EDID_INLINE_ROUTINE uint16_t DTD_vertical_active (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->VerticalActiveLow | return (dtd->VerticalActiveLow |
(dtd->VerticalBlanking_ActiveHigh & 0xF0) << 4); (dtd->VerticalBlanking_ActiveHigh & 0xF0) << 4);
} }
EDID_INLINE_ROUTINE uint16_t DTD_VerticalBlanking ( EDID_INLINE_ROUTINE uint16_t DTD_vertical_blanking (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->VerticalBlankingLow | return (dtd->VerticalBlankingLow |
(dtd->VerticalBlanking_ActiveHigh & 0xF) << 8); (dtd->VerticalBlanking_ActiveHigh & 0xF) << 8);
} }
EDID_INLINE_ROUTINE uint16_t DTD_VerticalSyncPulseWidth ( EDID_INLINE_ROUTINE uint16_t DTD_vertical_sync_pulse_width (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return ((dtd->VerticalSyncPulseWidth_OffsetLow & 0xF) | return ((dtd->VerticalSyncPulseWidth_OffsetLow & 0xF) |
(dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0x3) << 4); (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0x3) << 4);
} }
EDID_INLINE_ROUTINE uint16_t DTD_VerticalSyncOffset ( EDID_INLINE_ROUTINE uint16_t DTD_vertical_sync_offset (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return ((dtd->VerticalSyncPulseWidth_OffsetLow >> 4) | return ((dtd->VerticalSyncPulseWidth_OffsetLow >> 4) |
(dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0xC) << 2); (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0xC) << 2);
} }
EDID_INLINE_ROUTINE uint16_t DTD_HorizontalSyncPulseWidth ( EDID_INLINE_ROUTINE uint16_t DTD_horizontal_sync_pulse_width (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->HorizontalSyncPulseWidthLow | return (dtd->HorizontalSyncPulseWidthLow |
(dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0x30) << 4); (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0x30) << 4);
} }
EDID_INLINE_ROUTINE uint16_t DTD_HorizontalSyncOffset ( EDID_INLINE_ROUTINE uint16_t DTD_horizontal_sync_offset (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->HorizontalSyncOffsetLow | return (dtd->HorizontalSyncOffsetLow |
(dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0xC0) << 2); (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0xC0) << 2);
} }
EDID_INLINE_ROUTINE uint16_t DTD_VerticalImageSize ( EDID_INLINE_ROUTINE uint16_t DTD_vertical_image_size (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->VerticalImageSizeLow | return (dtd->VerticalImageSizeLow |
(dtd->Vertical_HorizontalImageSizeHigh & 0xF) << 8); (dtd->Vertical_HorizontalImageSizeHigh & 0xF) << 8);
} }
EDID_INLINE_ROUTINE uint16_t DTD_HorizontalImageSize ( EDID_INLINE_ROUTINE uint16_t DTD_horizontal_image_size (
struct DetailedTimingDescriptor *dtd) EDID_detailed_timing_descriptor *dtd)
{ {
return (dtd->HorizontalImageSizeLow | return (dtd->HorizontalImageSizeLow |
(dtd->Vertical_HorizontalImageSizeHigh & 0xF0) << 4); (dtd->Vertical_HorizontalImageSizeHigh & 0xF0) << 4);
} }
struct ColorPointData { typedef struct {
uint8_t ColorPointWhitePointIndexNumber; uint8_t ColorPointWhitePointIndexNumber;
uint8_t ColorPointWhiteLowBits; uint8_t ColorPointWhiteLowBits;
uint8_t ColorPointWhite_x; uint8_t ColorPointWhite_x;
uint8_t ColorPointWhite_y; uint8_t ColorPointWhite_y;
uint8_t ColorPointWhiteGamma; uint8_t ColorPointWhiteGamma;
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_color_point_data;
/* Basic Display Parameters */ /* Basic Display Parameters */
/* Monitor Descriptor - Data Type Tag */ /* Monitor Descriptor - Data Type Tag */
@@ -175,7 +174,7 @@ struct ColorPointData {
#define EDID_DTT_ASCIIString 0xFE #define EDID_DTT_ASCIIString 0xFE
#define EDID_DTT_MonitorRangeLimits 0xFD #define EDID_DTT_MonitorRangeLimits 0xFD
struct MonitorRangeLimits { typedef struct {
uint8_t MinVerticalRateInHz; uint8_t MinVerticalRateInHz;
uint8_t MaxVerticalRateInHz; uint8_t MaxVerticalRateInHz;
uint8_t MinHorizontalInKHz; uint8_t MinHorizontalInKHz;
@@ -184,7 +183,7 @@ struct MonitorRangeLimits {
/* see VESA, Generalized Timing Formula Standard - GTF /* see VESA, Generalized Timing Formula Standard - GTF
Version 1.0, December 18, 1996 */ Version 1.0, December 18, 1996 */
uint8_t GTFStandard[8]; uint8_t GTFStandard[8];
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_monitor_range_limits;
#define EDID_DTT_MonitorName 0xFC #define EDID_DTT_MonitorName 0xFC
@@ -222,18 +221,18 @@ struct MonitorRangeLimits {
#define EDID_CVT_PrefVertRate60Hz 1 #define EDID_CVT_PrefVertRate60Hz 1
#define EDID_CVT_PrefVertRate75Hz 2 #define EDID_CVT_PrefVertRate75Hz 2
#define EDID_CVT_PrefVertRate85Hz 3 #define EDID_CVT_PrefVertRate85Hz 3
struct CVT3ByteCodeDescriptor { typedef struct {
uint8_t AddressableLinesLow; uint8_t AddressableLinesLow;
uint8_t AspectRatio_AddressableLinesHigh; uint8_t AspectRatio_AddressableLinesHigh;
uint8_t VerticalRate_PreferredVerticalRate; uint8_t VerticalRate_PreferredVerticalRate;
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_CVT_3_byte_code_descriptor;
struct CVTTimingCodes3B { typedef struct {
uint8_t VersionNumber; uint8_t VersionNumber;
struct CVT3ByteCodeDescriptor cvt[4]; EDID_CVT_3_byte_code_descriptor cvt[4];
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_CVT_timing_codes_3B;
EDID_INLINE_ROUTINE uint16_t edid1_CVT_AddressableLinesHigh ( EDID_INLINE_ROUTINE uint16_t edid1_CVT_addressable_lines_high (
struct CVT3ByteCodeDescriptor *cvt) EDID_CVT_3_byte_code_descriptor *cvt)
{ {
return (cvt->AddressableLinesLow | return (cvt->AddressableLinesLow |
(cvt->VerticalRate_PreferredVerticalRate & (cvt->VerticalRate_PreferredVerticalRate &
@@ -241,18 +240,18 @@ EDID_INLINE_ROUTINE uint16_t edid1_CVT_AddressableLinesHigh (
) << (8-EDID1_CVT_AddressableLinesHighOff) ); ) << (8-EDID1_CVT_AddressableLinesHighOff) );
} }
EDID_INLINE_ROUTINE uint8_t edid1_CVT_AspectRatio ( EDID_INLINE_ROUTINE uint8_t edid1_CVT_aspect_ratio (
struct CVT3ByteCodeDescriptor *cvt) EDID_CVT_3_byte_code_descriptor *cvt)
{ {
return (cvt->AspectRatio_AddressableLinesHigh >> EDID1_CVT_AspectRatioOff) & return (cvt->AspectRatio_AddressableLinesHigh >> EDID1_CVT_AspectRatioOff) &
EDID1_CVT_AspectRatioMask; EDID1_CVT_AspectRatioMask;
} }
#define EDID_DTT_EstablishedTimingsIII 0xF7 #define EDID_DTT_EstablishedTimingsIII 0xF7
struct EstablishedTimingsIII { typedef struct {
uint8_t RevisionNumber; uint8_t RevisionNumber;
uint8_t EST_III[12]; uint8_t EST_III[12];
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_established_timings_III;
enum EST_III { enum EST_III {
EST_1152x864_75Hz = 0, EST_1152x864_75Hz = 0,
EST_1024x768_85Hz = 1, EST_1024x768_85Hz = 1,
@@ -308,18 +307,18 @@ enum EST_III {
#define EDID_DTT_DescriptorSpaceUnused 0x10 #define EDID_DTT_DescriptorSpaceUnused 0x10
/* DTT 0x0 - 0xF are manufacturer specific */ /* DTT 0x0 - 0xF are manufacturer specific */
struct MonitorDescriptor { typedef struct {
uint8_t Flag0[2]; uint8_t Flag0[2];
uint8_t Flag1; uint8_t Flag1;
uint8_t DataTypeTag; uint8_t DataTypeTag;
uint8_t Flag2; uint8_t Flag2;
uint8_t DescriptorData[13]; uint8_t DescriptorData[13];
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_monitor_descriptor;
union DTD_MD { union EDID_DTD_MD {
struct DetailedTimingDescriptor dtd; EDID_detailed_timing_descriptor dtd;
struct MonitorDescriptor md; EDID_monitor_descriptor md;
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE;
#define EDID1_STI_ImageAspectRatioOff 0 #define EDID1_STI_ImageAspectRatioOff 0
#define EDID1_STI_ImageAspectRatioMask 0x3 #define EDID1_STI_ImageAspectRatioMask 0x3
@@ -331,10 +330,10 @@ union DTD_MD {
#define EDID_STI_AspectRatio_4_3 1 #define EDID_STI_AspectRatio_4_3 1
#define EDID_STI_AspectRatio_5_4 2 #define EDID_STI_AspectRatio_5_4 2
#define EDID_STI_AspectRatio_16_9 3 #define EDID_STI_AspectRatio_16_9 3
struct StandardTimingIdentification { typedef struct {
uint8_t HorizontalActivePixels; uint8_t HorizontalActivePixels;
uint8_t ImageAspectRatio_RefreshRate; uint8_t ImageAspectRatio_RefreshRate;
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_standard_timing_identification;
/* Video Input Definition */ /* Video Input Definition */
/* Analog = 0, Digital = 1 */ /* Analog = 0, Digital = 1 */
@@ -409,7 +408,7 @@ struct StandardTimingIdentification {
#define EDID_DisplayType_RGB444YCrCb422 2 #define EDID_DisplayType_RGB444YCrCb422 2
#define EDID_DisplayType_RGB444YCrCb444YCrCb422 3 #define EDID_DisplayType_RGB444YCrCb444YCrCb422 3
struct edid1 { typedef struct {
uint8_t Header[8]; uint8_t Header[8];
/* Vendor Product Identification */ /* Vendor Product Identification */
uint8_t IDManufacturerName[2]; uint8_t IDManufacturerName[2];
@@ -442,39 +441,39 @@ struct edid1 {
/* Established Timings I, II, Manufacturer's */ /* Established Timings I, II, Manufacturer's */
uint8_t EST_I_II_Man[3]; uint8_t EST_I_II_Man[3];
/* Standard Timing Identification */ /* Standard Timing Identification */
struct StandardTimingIdentification STI[8]; EDID_standard_timing_identification STI[8];
/* Detailed Timing Descriptions / Monitor Descriptions */ /* Detailed Timing Descriptions / Monitor Descriptions */
union DTD_MD dtd_md[4]; union EDID_DTD_MD dtd_md[4];
uint8_t ExtensionFlag; uint8_t ExtensionFlag;
uint8_t Checksum; uint8_t Checksum;
} EDID_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE EDID_edid1;
EDID_INLINE_ROUTINE uint16_t edid1_RedX (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_RedX (EDID_edid1 *edid) {
return (edid->RedXHigh<<2) | (edid->GreenRedLow>>6); return (edid->RedXHigh<<2) | (edid->GreenRedLow>>6);
} }
EDID_INLINE_ROUTINE uint16_t edid1_RedY (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_RedY (EDID_edid1 *edid) {
return (edid->RedYHigh<<2) | (edid->GreenRedLow>>4)&&0x3; return (edid->RedYHigh<<2) | (edid->GreenRedLow>>4)&&0x3;
} }
EDID_INLINE_ROUTINE uint16_t edid1_GreenX (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_GreenX (EDID_edid1 *edid) {
return (edid->GreenXHigh<<2) | (edid->GreenRedLow>>2)&&0x3; return (edid->GreenXHigh<<2) | (edid->GreenRedLow>>2)&&0x3;
} }
EDID_INLINE_ROUTINE uint16_t edid1_GreenY (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_GreenY (EDID_edid1 *edid) {
return (edid->GreenYHigh<<2) | (edid->GreenRedLow&0x3); return (edid->GreenYHigh<<2) | (edid->GreenRedLow&0x3);
} }
EDID_INLINE_ROUTINE uint16_t edid1_BlueX (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_BlueX (EDID_edid1 *edid) {
return (edid->BlueXHigh<<2) | (edid->WhiteBlueLow>>6); return (edid->BlueXHigh<<2) | (edid->WhiteBlueLow>>6);
} }
EDID_INLINE_ROUTINE uint16_t edid1_BlueY (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_BlueY (EDID_edid1 *edid) {
return (edid->BlueYHigh<<2) | (edid->WhiteBlueLow>>4)&&0x3; return (edid->BlueYHigh<<2) | (edid->WhiteBlueLow>>4)&&0x3;
} }
EDID_INLINE_ROUTINE uint16_t edid1_WhiteX (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_WhiteX (EDID_edid1 *edid) {
return (edid->WhiteXHigh<<2) | (edid->WhiteBlueLow>>2)&&0x3; return (edid->WhiteXHigh<<2) | (edid->WhiteBlueLow>>2)&&0x3;
} }
EDID_INLINE_ROUTINE uint16_t edid1_WhiteY (struct edid1 *edid) { EDID_INLINE_ROUTINE uint16_t edid1_WhiteY (EDID_edid1 *edid) {
return (edid->WhiteYHigh<<2) | (edid->WhiteBlueLow&0x3); return (edid->WhiteYHigh<<2) | (edid->WhiteBlueLow&0x3);
} }
enum edid1_EstablishedTimings { enum edid1_established_timings {
/* Established Timings I */ /* Established Timings I */
EST_800x600_60Hz = 0, EST_800x600_60Hz = 0,
EST_800x600_56Hz = 1, EST_800x600_56Hz = 1,
@@ -497,9 +496,9 @@ enum edid1_EstablishedTimings {
EST_1152x870_75Hz = 23, EST_1152x870_75Hz = 23,
}; };
EDID_INLINE_ROUTINE uint8_t edid1_EstablishedTim ( EDID_INLINE_ROUTINE uint8_t edid1_established_tim (
struct edid1 *edid, EDID_edid1 *edid,
enum edid1_EstablishedTimings est) enum edid1_established_timings est)
{ {
return (uint8_t)(edid->EST_I_II_Man[est/8] & (est%8)); return (uint8_t)(edid->EST_I_II_Man[est/8] & (est%8));
} }

View File

@@ -45,9 +45,9 @@ extern "C" {
* @retval register ax content as defined in VBE RETURN STATUS paragraph * @retval register ax content as defined in VBE RETURN STATUS paragraph
* -1 error calling graphical bios * -1 error calling graphical bios
*/ */
uint32_t VBEControllerInformation ( uint32_t VBE_controller_information (
struct VBE_VbeInfoBlock *infoBlock, VBE_vbe_info_block *info_block,
uint16_t queriedVBEVersion uint16_t queried_VBE_Version
); );
/** /**
@@ -59,9 +59,9 @@ uint32_t VBEControllerInformation (
* @retval register ax content as defined in VBE RETURN STATUS paragraph * @retval register ax content as defined in VBE RETURN STATUS paragraph
* -1 error calling graphical bios * -1 error calling graphical bios
*/ */
uint32_t VBEModeInformation ( uint32_t VBE_mode_information (
struct VBE_ModeInfoBlock *infoBlock, VBE_mode_info_block *info_block,
uint16_t modeNumber uint16_t mode_number
); );
/** /**
@@ -73,9 +73,9 @@ uint32_t VBEModeInformation (
* @retval register ax content as defined in VBE RETURN STATUS paragraph * @retval register ax content as defined in VBE RETURN STATUS paragraph
* -1 error calling graphical bios * -1 error calling graphical bios
*/ */
uint32_t VBESetMode ( uint32_t VBE_set_mode (
uint16_t modeNumber, uint16_t mode_number,
struct VBE_CRTCInfoBlock *infoBlock VBE_CRTC_info_block *info_block
); );
/** /**
@@ -85,8 +85,8 @@ uint32_t VBESetMode (
* @retval register ax content as defined in VBE RETURN STATUS paragraph * @retval register ax content as defined in VBE RETURN STATUS paragraph
* -1 error calling graphical bios * -1 error calling graphical bios
*/ */
uint32_t VBECurrentMode ( uint32_t VBE_current_mode (
uint16_t *modeNumber uint16_t *mode_number
); );
/** /**
@@ -101,10 +101,10 @@ uint32_t VBECurrentMode (
* @retval register ax content as defined in VBE RETURN STATUS paragraph * @retval register ax content as defined in VBE RETURN STATUS paragraph
* -1 error calling graphical bios * -1 error calling graphical bios
*/ */
uint32_t VBEReportDDCCapabilities ( uint32_t VBE_report_DDC_capabilities (
uint16_t controllerUnitNumber, uint16_t controller_unit_number,
uint8_t *secondsToTransferEDIDBlock, uint8_t *seconds_to_transfer_EDID_block,
uint8_t *DDCLevelSupported uint8_t *DDC_level_supported
); );
/** /**
@@ -116,10 +116,10 @@ uint32_t VBEReportDDCCapabilities (
* @retval register ax content as defined in VBE RETURN STATUS paragraph * @retval register ax content as defined in VBE RETURN STATUS paragraph
* -1 error calling graphical bios * -1 error calling graphical bios
*/ */
uint32_t VBEReadEDID ( uint32_t VBE_read_EDID (
uint16_t controllerUnitNumber, uint16_t controller_unit_number,
uint16_t EDIDBlockNumber, uint16_t EDID_block_number,
struct edid1 *buffer EDID_edid1 *buffer
); );
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -22,4 +22,3 @@
#define IDT_SIZE (256) #define IDT_SIZE (256)
#define GDT_SIZE (3 + NUM_APP_DRV_GDT_DESCRIPTORS) #define GDT_SIZE (3 + NUM_APP_DRV_GDT_DESCRIPTORS)

View File

@@ -33,7 +33,6 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#include <rtems/score/basedefs.h> #include <rtems/score/basedefs.h>
#define VBE3_PACKED_ATTRIBUTE RTEMS_COMPILER_PACKED_ATTRIBUTE
/* VESA BIOS EXTENSION (VBE) Core functions Standard /* VESA BIOS EXTENSION (VBE) Core functions Standard
Version: 3.0 Date: September 16, 1998 */ Version: 3.0 Date: September 16, 1998 */
@@ -156,12 +155,12 @@ extern "C" {
#define VBE_RetVBESupSpeInf 0x00 /* Return VBE Supplemental #define VBE_RetVBESupSpeInf 0x00 /* Return VBE Supplemental
Specification Information */ Specification Information */
/* *** Structures *** */ /* *** Structures *** */
struct VBE_FarPtr { typedef struct {
uint16_t offset; uint16_t offset;
uint16_t selector; uint16_t selector;
} VBE3_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_far_pointer;
struct VBE_PMInfoBlock { typedef struct {
uint8_t Signature[4]; /* PM Info Block Signature */ uint8_t Signature[4]; /* PM Info Block Signature */
uint16_t EntryPoint; /* Offset of PM entry point within BIOS */ uint16_t EntryPoint; /* Offset of PM entry point within BIOS */
uint16_t PMInitialize; /* Offset of PM initialization entry point */ uint16_t PMInitialize; /* Offset of PM initialization entry point */
@@ -172,7 +171,7 @@ struct VBE_PMInfoBlock {
uint16_t CodeSegSel; /* Selector to access code segment as data */ uint16_t CodeSegSel; /* Selector to access code segment as data */
uint8_t InProtectMode; /* Set to 1 when in protected mode */ uint8_t InProtectMode; /* Set to 1 when in protected mode */
uint8_t Checksum; /* Checksum byte for structure */ uint8_t Checksum; /* Checksum byte for structure */
} VBE3_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_protected_mode_info_block;
/* General VBE signature */ /* General VBE signature */
#define VBE_SIGNATURE "VESA" #define VBE_SIGNATURE "VESA"
@@ -181,7 +180,7 @@ struct VBE_PMInfoBlock {
/* for STUB see VBE CORE FUNCTIONS VERSION 3.0 - Appendix 1 */ /* for STUB see VBE CORE FUNCTIONS VERSION 3.0 - Appendix 1 */
#define VBE_END_OF_VideoModeList 0xFFFF #define VBE_END_OF_VideoModeList 0xFFFF
#define VBE_STUB_VideoModeList 0xFFFF #define VBE_STUB_VideoModeList 0xFFFF
struct VBE_VbeInfoBlock { typedef struct {
uint8_t VbeSignature[4]; /* VBE Signature */ uint8_t VbeSignature[4]; /* VBE Signature */
uint16_t VbeVersion; /* VBE Version */ uint16_t VbeVersion; /* VBE Version */
uint8_t *OemStringPtr; /* VbeFarPtr to OEM String */ uint8_t *OemStringPtr; /* VbeFarPtr to OEM String */
@@ -196,9 +195,9 @@ struct VBE_VbeInfoBlock {
uint8_t Reserved[222]; /* Reserved for VBE implementation scratch */ uint8_t Reserved[222]; /* Reserved for VBE implementation scratch */
/* area */ /* area */
uint8_t OemData[256]; /* Data Area for OEM Strings */ uint8_t OemData[256]; /* Data Area for OEM Strings */
} VBE3_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_vbe_info_block;
struct VBE_ModeInfoBlock { typedef struct {
/* Mandatory information for all VBE revisions */ /* Mandatory information for all VBE revisions */
uint16_t ModeAttributes; /* mode attributes */ uint16_t ModeAttributes; /* mode attributes */
uint8_t WinAAttributes; /* window A attributes */ uint8_t WinAAttributes; /* window A attributes */
@@ -252,9 +251,9 @@ struct VBE_ModeInfoBlock {
uint32_t MaxPixelClock; /* maximum pixel clock uint32_t MaxPixelClock; /* maximum pixel clock
(in Hz) for graphics mode */ (in Hz) for graphics mode */
uint8_t Reserved3[189]; /* remainder of ModeInfoBlock */ uint8_t Reserved3[189]; /* remainder of ModeInfoBlock */
} VBE3_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_mode_info_block;
struct VBE_CRTCInfoBlock { typedef struct {
uint16_t HorizontalTotal; /* Horizontal total in pixels */ uint16_t HorizontalTotal; /* Horizontal total in pixels */
uint16_t HorizontalSyncStart; /* Horizontal sync start in pixels */ uint16_t HorizontalSyncStart; /* Horizontal sync start in pixels */
uint16_t HorizontalSyncEnd; /* Horizontal sync end in pixels */ uint16_t HorizontalSyncEnd; /* Horizontal sync end in pixels */
@@ -265,16 +264,16 @@ struct VBE_CRTCInfoBlock {
uint32_t PixelClock; /* Pixel clock in units of Hz */ uint32_t PixelClock; /* Pixel clock in units of Hz */
uint16_t RefreshRate; /* Refresh rate in units of 0.01 Hz */ uint16_t RefreshRate; /* Refresh rate in units of 0.01 Hz */
uint8_t Reserved[40]; /* remainder of ModeInfoBlock */ uint8_t Reserved[40]; /* remainder of ModeInfoBlock */
} VBE3_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_CRTC_info_block;
struct VBE_PaletteEntry { typedef struct {
uint8_t Blue; /* Blue channel value (6 or 8 bits) */ uint8_t Blue; /* Blue channel value (6 or 8 bits) */
uint8_t Green; /* Green channel value (6 or 8 bits) */ uint8_t Green; /* Green channel value (6 or 8 bits) */
uint8_t Red; /* Red channel value(6 or 8 bits) */ uint8_t Red; /* Red channel value(6 or 8 bits) */
uint8_t Alignment; /* DWORD alignment byte (unused) */ uint8_t Alignment; /* DWORD alignment byte (unused) */
} VBE3_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_palette_entry;
struct VBE_SupVbeInfoBlock { typedef struct {
uint8_t SupVbeSignature[7]; /* Supplemental VBE Signature */ uint8_t SupVbeSignature[7]; /* Supplemental VBE Signature */
uint16_t SupVbeVersion; /* Supplemental VBE Version */ uint16_t SupVbeVersion; /* Supplemental VBE Version */
uint8_t SupVbeSubFunc[8]; /* Bitfield of supported subfunctions */ uint8_t SupVbeSubFunc[8]; /* Bitfield of supported subfunctions */
@@ -286,7 +285,7 @@ struct VBE_SupVbeInfoBlock {
uint8_t Reserved[221]; /* Reserved for description uint8_t Reserved[221]; /* Reserved for description
strings and future */ strings and future */
/* expansion */ /* expansion */
} VBE3_PACKED_ATTRIBUTE; } RTEMS_COMPILER_PACKED_ATTRIBUTE VBE_supplemental_vbe_info_block;
/* VbeInfoBlock Capabilities */ /* VbeInfoBlock Capabilities */
/* D0 = 0 DAC is fixed width, with 6 bits per primary color */ /* D0 = 0 DAC is fixed width, with 6 bits per primary color */
@@ -460,4 +459,3 @@ struct VBE_SupVbeInfoBlock {
#endif /* ASM */ #endif /* ASM */
#endif /* _VBE_H */ #endif /* _VBE_H */

View File

@@ -181,7 +181,7 @@ void *i386_get_default_rm_buffer(uint16_t *size) {
return default_rm_buffer_spot; return default_rm_buffer_spot;
} }
int i386_real_interrupt_call(uint8_t interruptNumber, int i386_real_interrupt_call(uint8_t interrupt_number,
i386_realmode_interrupt_registers *ir) i386_realmode_interrupt_registers *ir)
{ {
uint32_t pagingon; uint32_t pagingon;
@@ -270,7 +270,7 @@ int i386_real_interrupt_call(uint8_t interruptNumber,
: "=rm"(interrupt_number_off) : "=rm"(interrupt_number_off)
); );
interrupt_number_ptr = (uint8_t *)(rm_swtch_code_dst+interrupt_number_off); interrupt_number_ptr = (uint8_t *)(rm_swtch_code_dst+interrupt_number_off);
*interrupt_number_ptr = interruptNumber; *interrupt_number_ptr = interrupt_number;
/* execute code that jumps to coppied function, which switches to real mode, /* execute code that jumps to coppied function, which switches to real mode,
loads registers with values passed to interrupt and executes interrupt */ loads registers with values passed to interrupt and executes interrupt */
__asm__ volatile( "\t" __asm__ volatile( "\t"
@@ -403,4 +403,3 @@ int i386_real_interrupt_call(uint8_t interruptNumber,
*ir = int_passed_regs_spot->inoutregs; *ir = int_passed_regs_spot->inoutregs;
return 1; return 1;
} }

View File

@@ -74,7 +74,10 @@ extern void *i386_get_default_rm_buffer(uint16_t *size);
* @retval 0 call failed (GDT too small or pagin is on) * @retval 0 call failed (GDT too small or pagin is on)
* 1 call successful * 1 call successful
*/ */
extern int i386_real_interrupt_call(uint8_t interruptNumber, i386_realmode_interrupt_registers *ir); extern int i386_real_interrupt_call(
uint8_t interrupt_number,
i386_realmode_interrupt_registers *ir
);
#ifdef __cplusplus #ifdef __cplusplus
} }