first and last commit
This commit is contained in:
commit
1bf4efd552
2612 files changed
+636500
No files matched your search
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
|
||||
|
||||
#include <debug.h>
|
||||
#include <drivers/display.h>
|
||||
#include <drivers/hdmi.h>
|
||||
#include <sys/task.h>
|
||||
|
||||
#include <drivers/process_edid.h>
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// debug support
|
||||
|
||||
#define HDMI_DEBUG_MASK ( \
|
||||
HDMI_DEBUG_INIT | \
|
||||
HDMI_DEBUG_ERROR | \
|
||||
HDMI_DEBUG_INFO | \
|
||||
HDMI_DEBUG_TRAINING | \
|
||||
0)
|
||||
|
||||
#undef HDMI_DEBUG_MASK
|
||||
#define HDMI_DEBUG_MASK (HDMI_DEBUG_INIT | HDMI_DEBUG_ERROR)
|
||||
|
||||
#define HDMI_DEBUG_INIT (1<<16) // initialisation
|
||||
#define HDMI_DEBUG_ERROR (1<<17) // errors
|
||||
#define HDMI_DEBUG_INFO (1<<18) // info
|
||||
#define HDMI_DEBUG_ALWAYS (1<<31) // unconditional output
|
||||
|
||||
#define debug(_fac, _fmt, _args...) \
|
||||
do { \
|
||||
if ((HDMI_DEBUG_ ## _fac) & (HDMI_DEBUG_MASK | HDMI_DEBUG_ALWAYS)) \
|
||||
dprintf(DEBUG_CRITICAL, "HDMIC: %s, %d: " _fmt, __FUNCTION__, __LINE__, ##_args); \
|
||||
} while(0)
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// consts, macros
|
||||
|
||||
#define kMaxRetry 5
|
||||
#define kClockRecoveryDelay 100
|
||||
#define kEQDelay 400
|
||||
#define kMaxClockRecoveryIterations 100
|
||||
|
||||
|
||||
#define require(assertion, exception_label) \
|
||||
do { \
|
||||
if (__builtin_expect(!(assertion), 0)) \
|
||||
{ \
|
||||
goto exception_label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define require_action(assertion, exception_label, action) \
|
||||
do { \
|
||||
if (__builtin_expect(!(assertion), 0)) \
|
||||
{ \
|
||||
{ \
|
||||
action; \
|
||||
} \
|
||||
goto exception_label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define require_noerr(error_code, exception_label) \
|
||||
do { \
|
||||
if (__builtin_expect(0 != (error_code), 0)) \
|
||||
{ \
|
||||
goto exception_label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define require_noerr_action(error_code, exception_label, action) \
|
||||
do { \
|
||||
if (__builtin_expect(0 != (error_code), 0)) \
|
||||
{ \
|
||||
{ \
|
||||
action; \
|
||||
} \
|
||||
goto exception_label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// typedefs, enums, structs
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// local variables
|
||||
|
||||
static struct video_link_data hdmi_video_data;
|
||||
static uint32_t hdmi_pixel_clock;
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// local functions declaration
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// HDMI global functions
|
||||
|
||||
int hdmi_init()
|
||||
{
|
||||
// defaults to External display, and Master mode
|
||||
if ( hdmi_controller_start(kHDMIControllerType_HDMI, kHDMIControllerMode_Master) != 0 )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hdmi_init_with_timing_info(struct display_timing *timing_info)
|
||||
{
|
||||
u_int8_t type;
|
||||
u_int8_t mode;
|
||||
u_int32_t display_config;
|
||||
|
||||
display_config = *((uint32_t *)(timing_info->display_config));
|
||||
type = (display_config >> kHDMIControllerType_Shift) & kHDMIControllerType_Mask;
|
||||
mode = (display_config >> kHDMIControllerMode_Shift) & kHDMIControllerMode_Mask;
|
||||
|
||||
hdmi_set_timings(timing_info);
|
||||
|
||||
if ( hdmi_controller_start(type, mode) != 0 )
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hdmi_set_timings(struct display_timing *timing_info)
|
||||
{
|
||||
u_int8_t mode;
|
||||
u_int32_t display_config;
|
||||
|
||||
display_config = *((uint32_t *)(timing_info->display_config));
|
||||
mode = (display_config >> kHDMIControllerMode_Shift) & kHDMIControllerMode_Mask;
|
||||
|
||||
bzero(&hdmi_video_data, sizeof(struct video_link_data));
|
||||
|
||||
hdmi_pixel_clock = timing_info->pixel_clock;
|
||||
|
||||
hdmi_video_data.mirror_mode = (mode == kHDMIControllerMode_Slave) ? true : false;
|
||||
hdmi_video_data.test_mode = 0;
|
||||
hdmi_video_data.color.depth = 8;
|
||||
hdmi_video_data.color.space = kDisplayColorSpacesRGB;
|
||||
hdmi_video_data.color.range = kDisplayColorDynamicRangeVESA;
|
||||
hdmi_video_data.color.coefficient = kDisplayColorCoefficientITU601;
|
||||
hdmi_video_data.timing.axis[0].total = timing_info->h_active + timing_info->h_back_porch +
|
||||
timing_info->h_front_porch + timing_info->h_pulse_width;
|
||||
hdmi_video_data.timing.axis[0].active = timing_info->h_active;
|
||||
hdmi_video_data.timing.axis[0].sync_width = timing_info->h_pulse_width;
|
||||
hdmi_video_data.timing.axis[0].back_porch = timing_info->h_back_porch;
|
||||
hdmi_video_data.timing.axis[0].front_porch = timing_info->h_front_porch;
|
||||
hdmi_video_data.timing.axis[0].sync_rate = 0;
|
||||
// Hsync polarity: 0 active high, 1 active low
|
||||
hdmi_video_data.timing.axis[0].sync_polarity = timing_info->neg_hsync ? 0 : 1;
|
||||
hdmi_video_data.timing.axis[1].total = timing_info->v_active + timing_info->v_back_porch +
|
||||
timing_info->v_front_porch + timing_info->v_pulse_width;
|
||||
hdmi_video_data.timing.axis[1].active = timing_info->v_active;
|
||||
hdmi_video_data.timing.axis[1].sync_width = timing_info->v_pulse_width;
|
||||
hdmi_video_data.timing.axis[1].back_porch = timing_info->v_back_porch;
|
||||
hdmi_video_data.timing.axis[1].front_porch = timing_info->v_front_porch;
|
||||
hdmi_video_data.timing.axis[1].sync_rate = (60 << 16);
|
||||
// Vsync polarity: 0 active high, 1 active low
|
||||
hdmi_video_data.timing.axis[1].sync_polarity = timing_info->neg_vsync ? 0 : 1;
|
||||
|
||||
debug(INFO, "vTotal:%d hTotal:%d\n", hdmi_video_data.timing.axis[1].total, hdmi_video_data.timing.axis[0].total);
|
||||
|
||||
// Restrict EDID choices to timings matching these, otherwise the
|
||||
// framebuffer dimensions will mismatch.
|
||||
restrict_edid(hdmi_video_data.timing.axis[0].active,
|
||||
hdmi_video_data.timing.axis[1].active);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hdmi_quiesce()
|
||||
{
|
||||
hdmi_controller_stop();
|
||||
}
|
||||
|
||||
int hdmi_start_video(void)
|
||||
{
|
||||
return hdmi_controller_start_video(&hdmi_video_data, hdmi_pixel_clock);
|
||||
}
|
||||
|
||||
bool hdmi_video_configured()
|
||||
{
|
||||
return hdmi_controller_video_configured();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// controller global functions
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// controller local functions
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2012, 2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
|
||||
|
||||
#include <debug.h>
|
||||
#include <sys.h>
|
||||
#include <sys/menu.h>
|
||||
#include <sys/task.h>
|
||||
|
||||
#include <drivers/display.h>
|
||||
#include <drivers/hdmi.h>
|
||||
|
||||
#if defined(WITH_MENU) && WITH_MENU
|
||||
|
||||
static struct video_link_data hdmi_video_data;
|
||||
|
||||
int do_hdmi(int argc, struct cmd_arg *args)
|
||||
{
|
||||
static struct display_timing timing_list[] =
|
||||
{
|
||||
#if WITH_HW_DISPLAY_HDMI
|
||||
{ "720p", 0, 74250000, 243, 1280, 220, 110, 40, 720, 20, 5, 5, 0, 0, 0, 0, 24, DISPLAY_TYPE_HDMI, NULL},
|
||||
#endif
|
||||
};
|
||||
if (argc < 2) {
|
||||
puts("not enough arguments.\n");
|
||||
goto usage;
|
||||
}
|
||||
|
||||
if (strcmp("start", args[1].str) == 0) {
|
||||
|
||||
printf("MY PIXEL CLOCK %d\n", timing_list[0].pixel_clock);
|
||||
hdmi_init(&timing_list[0]);
|
||||
|
||||
bzero(&hdmi_video_data, sizeof(struct video_link_data));
|
||||
|
||||
hdmi_video_data.mirror_mode = false;
|
||||
hdmi_video_data.test_mode = 0;
|
||||
hdmi_video_data.color.depth = 8;
|
||||
hdmi_video_data.color.space = kDisplayColorSpacesRGB;
|
||||
hdmi_video_data.color.range = kDisplayColorDynamicRangeVESA;
|
||||
hdmi_video_data.color.coefficient = kDisplayColorCoefficientITU601;
|
||||
hdmi_video_data.timing.axis[0].total = timing_list[0].h_active + timing_list[0].h_back_porch + timing_list[0].h_front_porch + timing_list[0].h_pulse_width;
|
||||
hdmi_video_data.timing.axis[0].active = timing_list[0].h_active;
|
||||
hdmi_video_data.timing.axis[0].sync_width = timing_list[0].h_pulse_width;
|
||||
hdmi_video_data.timing.axis[0].back_porch = timing_list[0].h_back_porch;
|
||||
hdmi_video_data.timing.axis[0].front_porch = timing_list[0].h_front_porch;
|
||||
hdmi_video_data.timing.axis[0].sync_rate = 0;
|
||||
hdmi_video_data.timing.axis[0].sync_polarity = 0;
|
||||
hdmi_video_data.timing.axis[1].total = timing_list[0].v_active + timing_list[0].v_back_porch + timing_list[0].v_front_porch + timing_list[0].v_pulse_width;
|
||||
hdmi_video_data.timing.axis[1].active = timing_list[0].v_active;
|
||||
hdmi_video_data.timing.axis[1].sync_width = timing_list[0].v_pulse_width;
|
||||
hdmi_video_data.timing.axis[1].back_porch = timing_list[0].v_back_porch;
|
||||
hdmi_video_data.timing.axis[1].front_porch = timing_list[0].v_front_porch;
|
||||
hdmi_video_data.timing.axis[1].sync_rate = 60 << 16;
|
||||
hdmi_video_data.timing.axis[1].sync_polarity = 0;
|
||||
|
||||
} else if (strcmp("stop", args[1].str) == 0) {
|
||||
hdmi_quiesce();
|
||||
} else if (strcmp("video", args[1].str) == 0) {
|
||||
if (strcmp("logo", args[2].str) == 0) {
|
||||
hdmi_video_data.mirror_mode = false;
|
||||
hdmi_video_data.test_mode = 0;
|
||||
|
||||
hdmi_controller_start_video(&hdmi_video_data, timing_list[0].pixel_clock);
|
||||
}
|
||||
if (strcmp("bist", args[2].str) == 0) {
|
||||
|
||||
hdmi_video_data.mirror_mode = false;
|
||||
hdmi_video_data.test_mode = 1;
|
||||
|
||||
hdmi_controller_start_video(&hdmi_video_data, timing_list[0].pixel_clock);
|
||||
}
|
||||
if (strcmp("mirror", args[2].str) == 0) {
|
||||
hdmi_video_data.mirror_mode = true;
|
||||
hdmi_video_data.test_mode = 0;
|
||||
|
||||
hdmi_controller_start_video(&hdmi_video_data, timing_list[0].pixel_clock);
|
||||
}
|
||||
} else if (strcmp("readReg", args[1].str) == 0) {
|
||||
hdmi_read_reg(args[2].n);
|
||||
} else if (strcmp("writeReg", args[1].str) == 0) {
|
||||
hdmi_write_reg(args[2].n, args[3].n);
|
||||
} else {
|
||||
puts("unrecognized command.\n");
|
||||
goto usage;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
printf("%s start\n", args[0].str);
|
||||
printf("%s video logo\n", args[0].str);
|
||||
printf("%s video bist\n", args[0].str);
|
||||
printf("%s video mirror\n", args[0].str);
|
||||
printf("%s stop\n", args[0].str);
|
||||
printf("%s readReg\n", args[0].str);
|
||||
printf("%s writeReg\n", args[0].str);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
MENU_COMMAND_DEVELOPMENT(hdmi, do_hdmi, "hdmi stuff", NULL);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2014 Apple Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <drivers/display.h>
|
||||
#include <drivers/hdmi.h>
|
||||
#include <sys/task.h>
|
||||
|
||||
#include <drivers/process_edid.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// debug support
|
||||
|
||||
#define HDMI_DEBUG_MASK ( \
|
||||
HDMI_DEBUG_INIT | \
|
||||
HDMI_DEBUG_ERROR | \
|
||||
HDMI_DEBUG_INFO | \
|
||||
HDMI_DEBUG_TRAINING | \
|
||||
0)
|
||||
|
||||
#undef HDMI_DEBUG_MASK
|
||||
#define HDMI_DEBUG_MASK (HDMI_DEBUG_INIT | HDMI_DEBUG_ERROR)
|
||||
|
||||
#define HDMI_DEBUG_INIT (1<<16) // initialisation
|
||||
#define HDMI_DEBUG_INFO (1<<17) // info
|
||||
#define HDMI_DEBUG_TRAINING (1<<18) // link training
|
||||
#define HDMI_DEBUG_WAIT (1<<19) // start wait
|
||||
#define HDMI_DEBUG_ERROR (1<<20) // error
|
||||
#define HDMI_DEBUG_ALWAYS (1<<31) // unconditional output
|
||||
|
||||
#define debug(_fac, _fmt, _args...) \
|
||||
do { \
|
||||
if ((HDMI_DEBUG_ ## _fac) & (HDMI_DEBUG_MASK | HDMI_DEBUG_ALWAYS)) \
|
||||
dprintf(DEBUG_CRITICAL, "DPD: %s, %d: " _fmt, __FUNCTION__, __LINE__, ##_args); \
|
||||
} while(0)
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// consts
|
||||
|
||||
// Do not delay iBoot by more than this amount from power on (microseconds).
|
||||
// Give up waiting for a boot logo and carry on at this point.
|
||||
#define kHDMIDeviceStartTimeout (8 * 1000 * 1000)
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// typedefs, enums, structs
|
||||
|
||||
#define require_action(assertion, exception_label, action) \
|
||||
do { \
|
||||
if (__builtin_expect(!(assertion), 0)) \
|
||||
{ \
|
||||
{ \
|
||||
action; \
|
||||
} \
|
||||
goto exception_label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define require_noerr(error_code, exception_label) \
|
||||
do { \
|
||||
if (__builtin_expect(0 != (error_code), 0)) \
|
||||
{ \
|
||||
goto exception_label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// local variables
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// local functions declaration
|
||||
|
||||
static int set_power(bool enable);
|
||||
|
||||
static struct task_event hdmi_device_start_event =
|
||||
EVENT_STATIC_INIT(hdmi_device_start_event, false, 0);
|
||||
static bool hdmi_device_started;
|
||||
static bool hdmi_device_start_error;
|
||||
static utime_t hdmi_device_started_time;
|
||||
|
||||
extern utime_t gPowerOnTime;
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// hdmi-device global functions
|
||||
|
||||
int hdmi_device_start()
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if ( hdmi_device_started )
|
||||
return 0;
|
||||
|
||||
|
||||
debug(INIT, "starting\n");
|
||||
|
||||
if ( set_power(true) != 0 ) {
|
||||
debug(ERROR, "failed to set power\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ( obtain_edid() == 0 ) {
|
||||
// Enable info frames if HDMI endpoint connected, so
|
||||
// we get the right color space.
|
||||
} else {
|
||||
// Non-fatal.
|
||||
debug(ERROR, "Couldn't get EDID\n");
|
||||
}
|
||||
|
||||
if ( hdmi_start_video() != 0 ) {
|
||||
debug(ERROR, "failed to start video\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
hdmi_device_started = true;
|
||||
|
||||
ret = 0;
|
||||
|
||||
exit:
|
||||
if (ret != 0) {
|
||||
hdmi_device_start_error = true;
|
||||
debug(ERROR, "error starting device\n");
|
||||
}
|
||||
|
||||
hdmi_device_started_time = system_time();
|
||||
event_signal(&hdmi_device_start_event);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int hdmi_device_wait_started()
|
||||
{
|
||||
utime_t wait_start = system_time();
|
||||
utime_t timeout = gPowerOnTime + kHDMIDeviceStartTimeout;
|
||||
|
||||
if (hdmi_device_started || hdmi_device_start_error) {
|
||||
debug(WAIT, "HDMI done with %d usecs to spare\n",
|
||||
(int) (wait_start - hdmi_device_started_time));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!hdmi_device_started && !hdmi_device_start_error) {
|
||||
utime_t now = system_time();
|
||||
if (now >= timeout) {
|
||||
debug(WAIT, "Timeout waiting for HDMI start\n");
|
||||
return -1;
|
||||
}
|
||||
event_wait_timeout(&hdmi_device_start_event, timeout - now);
|
||||
}
|
||||
debug(WAIT, "Delayed boot by %llu usecs\n", system_time() - wait_start);
|
||||
exit:
|
||||
debug(WAIT, "Started waiting %llu usecs after power on\n",
|
||||
wait_start - gPowerOnTime);
|
||||
return hdmi_device_start_error ? -1 : 0;
|
||||
}
|
||||
|
||||
void hdmi_device_stop()
|
||||
{
|
||||
if ( !hdmi_device_started )
|
||||
return;
|
||||
|
||||
hdmi_controller_stop_video();
|
||||
|
||||
set_power(false);
|
||||
|
||||
hdmi_device_started = false;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
////////// hdmi-device local functions
|
||||
|
||||
static int set_power(bool state)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 2012 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_EDID_H
|
||||
#define _IOKIT_EDID_H
|
||||
|
||||
|
||||
#define kEDIDEstablishedTimingsCount 24
|
||||
#define kEDIDEstablishedTimingsIIICount 48
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedHeader {
|
||||
uint8_t header[2];
|
||||
}EDIDDetailedHeader;
|
||||
|
||||
//__packed
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedTiming {
|
||||
uint8_t pixelClock[2];
|
||||
|
||||
uint8_t hor_addr_low;
|
||||
uint8_t hor_blank_low;
|
||||
uint8_t hor_addr_blank_high;
|
||||
uint8_t ver_addr_low;
|
||||
uint8_t ver_blank_low;
|
||||
uint8_t ver_addr_blank_high;
|
||||
|
||||
uint8_t hor_fporch; // #8
|
||||
uint8_t hor_sync;
|
||||
uint8_t ver_fporch_sync;
|
||||
|
||||
uint8_t hor_ver_porch_sync_high;
|
||||
uint8_t inmm[3]; // in milimeter
|
||||
uint8_t hor_border;
|
||||
uint8_t ver_border;
|
||||
uint8_t detailed;
|
||||
} EDIDDetailedTiming;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDString{
|
||||
uint8_t flag;
|
||||
char string[13];
|
||||
} EDIDString;
|
||||
|
||||
typedef enum {
|
||||
kEDIDDetailedRangeFlagRateOffsetVerticalMin = (1<<0),
|
||||
kEDIDDetailedRangeFlagRateOffsetVerticalMax = (1<<1),
|
||||
kEDIDDetailedRangeFlagRateOffsetHorizontalMin = (1<<2),
|
||||
kEDIDDetailedRangeFlagRateOffsetHorizontalMax = (1<<3)
|
||||
} EDIDDetailedRangeFlags;
|
||||
|
||||
enum {
|
||||
kEDIDDetailedRangeVideoTimingTypeGTF = 0,
|
||||
kEDIDDetailedRangeVideoTimingTypeRangeLimitsOnly = 1,
|
||||
kEDIDDetailedRangeVideoTimingTypeSecondaryGTF = 2,
|
||||
kEDIDDetailedRangeVideoTimingTypeCVT = 4
|
||||
};
|
||||
typedef uint8_t EDIDDetailedRangeVideoTimingType;
|
||||
|
||||
typedef enum {
|
||||
kEDIDSupportedAspectFlag15_9 = (1<<3),
|
||||
kEDIDSupportedAspectFlag5_4 = (1<<4),
|
||||
kEDIDSupportedAspectFlag16_10 = (1<<5),
|
||||
kEDIDSupportedAspectFlag16_9 = (1<<6),
|
||||
kEDIDSupportedAspectFlag4_3 = (1<<7)
|
||||
} EDIDSupportedAspectFlags;
|
||||
|
||||
typedef enum {
|
||||
kEDIDPreferredAspectType4_3,
|
||||
kEDIDPreferredAspectType16_9,
|
||||
kEDIDPreferredAspectType16_10,
|
||||
kEDIDPreferredAspectType5_4,
|
||||
kEDIDPreferredAspectType15_9,
|
||||
kEDIDPreferredAspectTypeShift = 5,
|
||||
kEDIDPreferredAspectTypeMask = 0x7,
|
||||
|
||||
} EDIDPreferredAspectType;
|
||||
|
||||
typedef enum {
|
||||
kEDIDCVTBlankingFlagStandard = (1<<3),
|
||||
kEDIDCVTBlankingFlagReduced = (1<<4),
|
||||
} EDIDCVTBlankingFlags;
|
||||
|
||||
typedef enum {
|
||||
kEDIDDigitalScalingFlagVerticalStretch = (1<<4),
|
||||
kEDIDDigitalScalingFlagVerticalShrink = (1<<5),
|
||||
kEDIDDigitalScalingFlagHorizontalStretch = (1<<6),
|
||||
kEDIDDigitalScalingFlagHorizontalShrink = (1<<7)
|
||||
} EDIDDigitalScalingFlags;
|
||||
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedRangeGTF {
|
||||
uint8_t reserved;
|
||||
uint8_t breakFrequency; // horizontal freq / 2 (khz)
|
||||
uint8_t c; // c*2
|
||||
uint8_t m[2];
|
||||
uint8_t k;
|
||||
uint8_t j; // j*2
|
||||
} EDIDDetailedRangeGTF;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedRangeCVT {
|
||||
uint8_t version;
|
||||
// Max. Pix Clk = [(range.maxPixelClockRate) × 10] – [(Byte 12: bits 7-2) × 0.25MHz]
|
||||
uint8_t precision_activeMaxMSB; // pixel clock precision * 0.25Mhz (bits 7-2) | max active pixels per line MSB (bits 1-0)
|
||||
uint8_t activeMaxLSB; // max active pixels per line MSB
|
||||
uint8_t supportedFlags;
|
||||
uint8_t preferredFlags;
|
||||
uint8_t scaling;
|
||||
uint8_t verticalRefreshRate; //hz
|
||||
} EDIDDetailedRangeCVT;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedRange{
|
||||
uint8_t flag;
|
||||
uint8_t minVerticalRate;
|
||||
uint8_t maxVerticalRate;
|
||||
uint8_t minHorizontalRate;
|
||||
uint8_t maxHorizontalRate;
|
||||
uint8_t maxPixelClockRate;
|
||||
|
||||
struct {
|
||||
EDIDDetailedRangeVideoTimingType type;
|
||||
|
||||
union {
|
||||
EDIDDetailedRangeGTF gtf;
|
||||
EDIDDetailedRangeCVT cvt;
|
||||
} data;
|
||||
}timing;
|
||||
|
||||
} EDIDDetailedRange;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedWhitePoint {
|
||||
uint8_t index;
|
||||
uint8_t xyLSB;
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
uint8_t gamma;
|
||||
} EDIDDetailedWhitePoint;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedColorPoint {
|
||||
EDIDDetailedWhitePoint whitePoint[2];
|
||||
} EDIDDetailedColorPoint;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedEstablishedTimingsIII {
|
||||
uint8_t data[6];
|
||||
} EDIDDetailedEstablishedTimingsIII;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDDetailedDescriptor {
|
||||
uint8_t zero[2];
|
||||
uint8_t flag;
|
||||
uint8_t type;
|
||||
|
||||
union {
|
||||
EDIDString name;
|
||||
EDIDDetailedRange range;
|
||||
EDIDDetailedColorPoint color;
|
||||
uint8_t standard[12];
|
||||
uint8_t cvt[12];
|
||||
EDIDDetailedEstablishedTimingsIII established;
|
||||
}data;
|
||||
|
||||
}EDIDDetailedDescriptor;
|
||||
|
||||
|
||||
typedef struct __attribute__((packed)) EDIDDetailed {
|
||||
|
||||
union {
|
||||
EDIDDetailedHeader header;
|
||||
EDIDDetailedTiming timing;
|
||||
EDIDDetailedDescriptor descriptor;
|
||||
} data;
|
||||
|
||||
} EDIDDetailed;
|
||||
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDHeader {
|
||||
uint8_t header[8];
|
||||
} EDIDHeader;
|
||||
|
||||
typedef enum {
|
||||
kEDIDStandardFeatureFlagGTF = (1<<0),
|
||||
kEDIDStandardFeatureFlagPreferredNative = (1<<1),
|
||||
kEDIDStandardFeatureFlagSRGB = (1<<2),
|
||||
kEDIDStandardFeatureFlagColorDepth = (3<<3),
|
||||
kEDIDStandardFeatureFlagActiveOff = (1<<5),
|
||||
kEDIDStandardFeatureFlagSuspend = (1<<6),
|
||||
kEDIDStandardFeatureFlagStandby = (1<<7)
|
||||
} EDIDStandardFeatureFlags;
|
||||
|
||||
// STANDARD STUFF
|
||||
typedef struct __attribute__((packed)) _EDIDStandard {
|
||||
uint8_t header[8];
|
||||
// Vender / Product
|
||||
uint8_t vendorID[2];
|
||||
uint8_t productID[2];
|
||||
uint8_t serialNumber[4];
|
||||
uint8_t weekOfManu;
|
||||
uint8_t yearOfManu;
|
||||
// EDID structure version / rev.
|
||||
uint8_t version;
|
||||
uint8_t revision;
|
||||
// Basic Display Parameters / Features
|
||||
uint8_t videoInputDef;
|
||||
uint8_t maxHorzSize; // cm
|
||||
uint8_t maxVertSize; // cm
|
||||
uint8_t dispTransferChr;
|
||||
uint8_t feature;
|
||||
// Color Characteristics
|
||||
uint8_t redGreenLowBits;
|
||||
uint8_t blueWhiteLowBits;
|
||||
uint8_t redX;
|
||||
uint8_t redY;
|
||||
uint8_t greenX;
|
||||
uint8_t greenY;
|
||||
uint8_t blueX;
|
||||
uint8_t blueY;
|
||||
uint8_t whiteX;
|
||||
uint8_t whiteY;
|
||||
// Established Timings
|
||||
uint8_t established[3];
|
||||
// Standard Timing Identification
|
||||
uint8_t standard[16];
|
||||
EDIDDetailed preferred;
|
||||
EDIDDetailed detailed[3];
|
||||
// Extra
|
||||
uint8_t extensionFlag;
|
||||
uint8_t checksum;
|
||||
} EDIDStandard;
|
||||
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDEXTHeader {
|
||||
uint8_t tag;
|
||||
uint8_t revision;
|
||||
} EDIDEXTHeader;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCVT {
|
||||
uint8_t data[3];
|
||||
} EDIDCVT;
|
||||
|
||||
// CEA STUFF
|
||||
|
||||
typedef enum {
|
||||
kEDIDCEA3DataBlockTypeReserved,
|
||||
kEDIDCEA3DataBlockTypeAudio,
|
||||
kEDIDCEA3DataBlockTypeVideo,
|
||||
kEDIDCEA3DataBlockTypeVenderSpecific,
|
||||
kEDIDCEA3DataBlockTypeSpeakerAllocation,
|
||||
kEDIDCEA3DataBlockTypeVESADTC,
|
||||
kEDIDCEA3DataBlockTypeReserved1,
|
||||
kEDIDCEA3DataBlockTypeExtended
|
||||
} EDIDCEA3DataBlockType;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA3DataBlockAudio {
|
||||
uint8_t descriptor[0];
|
||||
} EDIDCEA3DataBlockAudio;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA3DataBlockVideo {
|
||||
uint8_t descriptor[0];
|
||||
} EDIDCEA3DataBlockVideo;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA3DataBlockVendorSpecific {
|
||||
uint8_t ieeeOui[3];
|
||||
uint8_t data[0];
|
||||
} EDIDCEA3DataBlockVendorSpecific;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA3DataBlockSpeakerAllocation {
|
||||
uint8_t data[3];
|
||||
} EDIDCEA3DataBlockSpeakerAllocation;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA3DataBlockExtended {
|
||||
uint8_t tag;
|
||||
uint8_t data[31];
|
||||
} EDIDCEA3DataBlockExtended;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA3DataBlock {
|
||||
uint8_t flags;
|
||||
|
||||
union {
|
||||
EDIDCEA3DataBlockAudio audio;
|
||||
EDIDCEA3DataBlockVideo video;
|
||||
EDIDCEA3DataBlockVendorSpecific vendor;
|
||||
EDIDCEA3DataBlockSpeakerAllocation speaker;
|
||||
EDIDCEA3DataBlockExtended extended;
|
||||
} data;
|
||||
|
||||
} EDIDCEA3DataBlock;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA_1 {
|
||||
struct {
|
||||
uint8_t tag;
|
||||
uint8_t revision;
|
||||
uint8_t dataOffset;
|
||||
uint8_t reserved;
|
||||
} header;
|
||||
|
||||
uint8_t data[123];
|
||||
uint8_t checksum;
|
||||
} EDIDCEA_1;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA_2 {
|
||||
struct {
|
||||
uint8_t tag;
|
||||
uint8_t revision;
|
||||
uint8_t dataOffset;
|
||||
uint8_t detailedFlags;
|
||||
} header;
|
||||
|
||||
uint8_t data[123];
|
||||
uint8_t checksum;
|
||||
} EDIDCEA_2;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA_3 {
|
||||
struct {
|
||||
uint8_t tag;
|
||||
uint8_t revision;
|
||||
uint8_t dataLength;
|
||||
uint8_t detailedFlags;
|
||||
} header;
|
||||
uint8_t data[123];
|
||||
uint8_t checksum;
|
||||
} EDIDCEA_3;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDCEA {
|
||||
union {
|
||||
EDIDEXTHeader header;
|
||||
EDIDCEA_1 cea1;
|
||||
EDIDCEA_2 cea2;
|
||||
EDIDCEA_3 cea3;
|
||||
} data;
|
||||
} EDIDCEA;
|
||||
|
||||
typedef struct __attribute__((packed)) _EDIDVTB{
|
||||
EDIDEXTHeader header;
|
||||
uint8_t dtbCount;
|
||||
uint8_t cvtCount;
|
||||
uint8_t stCount;
|
||||
uint8_t data[122];
|
||||
uint8_t checksum;
|
||||
} EDIDVTB;
|
||||
|
||||
typedef enum {
|
||||
kEDIDTypeCEA = 0x02,
|
||||
KEDIDTypeVTB = 0x10,
|
||||
kEDIDTypeDI = 0x40,
|
||||
} EDIDType;
|
||||
|
||||
// __packed
|
||||
typedef struct __attribute__((packed)) _EDID{
|
||||
union {
|
||||
EDIDHeader header;
|
||||
EDIDStandard standard;
|
||||
EDIDCEA cea;
|
||||
EDIDVTB vtb;
|
||||
} data;
|
||||
|
||||
} EDID;
|
||||
|
||||
|
||||
|
||||
#endif /* _IOKIT_EDID_H */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,18 @@
|
||||
# Copyright (C) 2012 Apple Computer, Inc. All rights reserved.
|
||||
#
|
||||
# This document is the property of Apple Computer, Inc.
|
||||
# It is considered confidential and proprietary.
|
||||
#
|
||||
# This document may not be reproduced or transmitted in any form,
|
||||
# in whole or in part, without the express written permission of
|
||||
# Apple Computer, Inc.
|
||||
#
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
GLOBAL_INCLUDES +=
|
||||
|
||||
ALL_OBJS += \
|
||||
$(LOCAL_DIR)/controller.o \
|
||||
$(LOCAL_DIR)/device.o \
|
||||
$(LOCAL_DIR)/debug.o \
|
||||
$(LOCAL_DIR)/process_edid.o
|
||||
Reference in new issue
Block a user