* Fixed a warning.
* Removed unused include. * Minor cleanup to match our style guide better. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19575 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2003, Thomas Kurschel
|
||||
|
||||
* Copyright (c) 2003, Thomas Kurschel. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Part of DDC driver
|
||||
|
||||
EDID decoder.
|
||||
@@ -10,19 +12,20 @@
|
||||
converting it to a usable structure.
|
||||
*/
|
||||
|
||||
|
||||
#include "edid.h"
|
||||
#include <KernelExport.h>
|
||||
#include "ddc_int.h"
|
||||
|
||||
|
||||
//
|
||||
// from hereon a bunch of decoders follow for each EDID section
|
||||
//
|
||||
|
||||
static void decode_vendor( edid1_vendor *vendor, const edid1_vendor_raw *raw )
|
||||
static void
|
||||
decode_vendor(edid1_vendor *vendor, const edid1_vendor_raw *raw)
|
||||
{
|
||||
vendor->manufacturer[0] = raw->c1 + '@';
|
||||
vendor->manufacturer[1] =
|
||||
((raw->c2_high << 3) | raw->c2_low) + '@';
|
||||
vendor->manufacturer[1] = ((raw->c2_high << 3) | raw->c2_low) + '@';
|
||||
vendor->manufacturer[2] = raw->c3 + '@';
|
||||
vendor->manufacturer[3] = 0;
|
||||
vendor->prod_id = B_LENDIAN_TO_HOST_INT16(raw->prod_id);
|
||||
@@ -31,13 +34,17 @@ static void decode_vendor( edid1_vendor *vendor, const edid1_vendor_raw *raw )
|
||||
vendor->year = raw->year + 1990;
|
||||
}
|
||||
|
||||
static void decode_version( edid1_version *version, const edid1_version_raw *raw )
|
||||
|
||||
static void
|
||||
decode_version(edid1_version *version, const edid1_version_raw *raw)
|
||||
{
|
||||
version->version = raw->version;
|
||||
version->revision = raw->revision;
|
||||
}
|
||||
|
||||
static void decode_display( edid1_display *display, const edid1_display_raw *raw )
|
||||
|
||||
static void
|
||||
decode_display(edid1_display *display, const edid1_display_raw *raw)
|
||||
{
|
||||
display->input_type = raw->input_type;
|
||||
display->input_voltage = raw->input_voltage;
|
||||
@@ -69,11 +76,13 @@ static void decode_display( edid1_display *display, const edid1_display_raw *raw
|
||||
display->white_y = ((uint16)raw->white_y << 2) | raw->white_y_low;
|
||||
}
|
||||
|
||||
static void decode_std_timing( edid1_std_timing *timing,
|
||||
const edid1_std_timing_raw *raw )
|
||||
|
||||
static void
|
||||
decode_std_timing(edid1_std_timing *timing, const edid1_std_timing_raw *raw)
|
||||
{
|
||||
timing->h_size = (raw->timing.h_size + 31) * 8;
|
||||
timing->ratio = raw->timing.ratio;
|
||||
|
||||
switch (raw->timing.ratio) {
|
||||
case 0:
|
||||
timing->v_size = timing->h_size;
|
||||
@@ -92,8 +101,9 @@ static void decode_std_timing( edid1_std_timing *timing,
|
||||
timing->id = raw->id;
|
||||
}
|
||||
|
||||
static void decode_whitepoint( edid1_whitepoint *whitepoint,
|
||||
const edid1_whitepoint_raw *raw )
|
||||
|
||||
static void
|
||||
decode_whitepoint(edid1_whitepoint *whitepoint, const edid1_whitepoint_raw *raw)
|
||||
{
|
||||
whitepoint[0].index = raw->index1;
|
||||
whitepoint[0].white_x = ((uint16)raw->white_x1 << 2) | raw->white_x1_low;
|
||||
@@ -106,7 +116,9 @@ static void decode_whitepoint( edid1_whitepoint *whitepoint,
|
||||
whitepoint[1].gamma = raw->gamma2;
|
||||
}
|
||||
|
||||
static void decode_detailed_timing( edid1_detailed_timing *timing,
|
||||
|
||||
static void
|
||||
decode_detailed_timing( edid1_detailed_timing *timing,
|
||||
const edid1_detailed_timing_raw *raw)
|
||||
{
|
||||
timing->pixel_clock = raw->pixel_clock;
|
||||
@@ -128,10 +140,12 @@ static void decode_detailed_timing( edid1_detailed_timing *timing,
|
||||
timing->misc = raw->misc;
|
||||
}
|
||||
|
||||
// copy string until 0xa, removing trailing spaces
|
||||
static void copy_str( char *dest, const uint8 *src, size_t len )
|
||||
|
||||
//! copy string until 0xa, removing trailing spaces
|
||||
static void
|
||||
copy_str(char *dest, const uint8 *src, size_t len)
|
||||
{
|
||||
int i;
|
||||
uint32 i;
|
||||
|
||||
// copy until 0xa
|
||||
for (i = 0; i < len; ++i) {
|
||||
@@ -150,8 +164,10 @@ static void copy_str( char *dest, const uint8 *src, size_t len )
|
||||
*++dest = 0;
|
||||
}
|
||||
|
||||
static void decode_detailed_monitor( edid1_detailed_monitor *monitor,
|
||||
const edid1_detailed_monitor_raw *raw, bool enable_extra )
|
||||
|
||||
static void
|
||||
decode_detailed_monitor( edid1_detailed_monitor *monitor,
|
||||
const edid1_detailed_monitor_raw *raw, bool enableExtra)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@@ -163,10 +179,9 @@ static void decode_detailed_monitor( edid1_detailed_monitor *monitor,
|
||||
// they have some additional info that start at zero_4(!),
|
||||
// so even if only the first two _or_ the other two bytes are
|
||||
// zero, we accept it as a monitor description block
|
||||
if( enable_extra &&
|
||||
((raw->extra.zero_0[0] == 0 && raw->extra.zero_0[1] == 0) ||
|
||||
(raw->extra.zero_0[2] == 0 && raw->extra.zero_4 == 0)) )
|
||||
{
|
||||
if (enableExtra
|
||||
&& ((raw->extra.zero_0[0] == 0 && raw->extra.zero_0[1] == 0)
|
||||
|| (raw->extra.zero_0[2] == 0 && raw->extra.zero_4 == 0))) {
|
||||
monitor->monitor_desc_type = raw->extra.monitor_desc_type;
|
||||
|
||||
switch (raw->extra.monitor_desc_type) {
|
||||
@@ -190,9 +205,10 @@ static void decode_detailed_monitor( edid1_detailed_monitor *monitor,
|
||||
&raw->extra.data.whitepoint );
|
||||
break;
|
||||
case edid1_add_std_timing:
|
||||
for( j = 0; j < EDID1_NUM_EXTRA_STD_TIMING; ++j )
|
||||
for (j = 0; j < EDID1_NUM_EXTRA_STD_TIMING; ++j) {
|
||||
decode_std_timing(&monitor->data.std_timing[j],
|
||||
&raw->extra.data.std_timing[j]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -202,11 +218,15 @@ static void decode_detailed_monitor( edid1_detailed_monitor *monitor,
|
||||
}
|
||||
}
|
||||
|
||||
// main function to decode edid data
|
||||
void edid_decode( edid1_info *edid, const edid1_raw *raw )
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
//! main function to decode edid data
|
||||
void
|
||||
edid_decode(edid1_info *edid, const edid1_raw *raw)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(edid, 0, sizeof(edid));
|
||||
|
||||
decode_vendor(&edid->vendor, &raw->vendor);
|
||||
@@ -215,8 +235,9 @@ void edid_decode( edid1_info *edid, const edid1_raw *raw )
|
||||
|
||||
edid->established_timing = raw->established_timing;
|
||||
|
||||
for( i = 0; i < EDID1_NUM_STD_TIMING; ++i )
|
||||
for (i = 0; i < EDID1_NUM_STD_TIMING; ++i) {
|
||||
decode_std_timing(&edid->std_timing[i], &raw->std_timing[i]);
|
||||
}
|
||||
|
||||
decode_detailed_monitor(edid->detailed_monitor, raw->detailed_monitor,
|
||||
edid->version.version == 1 && edid->version.revision >= 1);
|
||||
|
||||
Reference in New Issue
Block a user