␊ |
static biosBuf_t bb;␊ |
␊ |
#if UNUSED␊ |
␊ |
//==============================================================================␊ |
␊ |
static inline void␊ |
|
␊ |
//==============================================================================␊ |
␊ |
#endif /* UNUSED */␊ |
␊ |
int getVBEInfo( void * infoBlock )␊ |
{␊ |
bb.intno = 0x10;␊ |
|
int paramType,␊ |
VBECRTCInfoBlock * timing )␊ |
{␊ |
double h_period_est, h_freq, h_period, h_total_pixels, h_sync_pixels;␊ |
double h_period, h_total_pixels, h_sync_pixels;␊ |
double h_active_pixels, h_ideal_duty_cycle, h_blank_pixels, pixel_freq = 0;␊ |
double v_sync_plus_bp = 0, v_total_lines = 0, v_field_rate_est, v_frame_rate = 0;␊ |
double v_sync_plus_bp = 0, v_total_lines = 0, v_frame_rate = 0;␊ |
const double h_pixels = (double) width;␊ |
const double v_lines = (double) height;␊ |
␊ |
|
double v_field_rate_in = (double) paramValue;␊ |
␊ |
// Estimate the horizontal period␊ |
h_period_est = ((1 / v_field_rate_in) - kMinVSyncPlusBP / 1000000) /␊ |
(v_lines + (2 * top_margin_lines) + kMinFrontPorch + interlace) * ␊ |
1000000;␊ |
double h_period_est = ((1 / v_field_rate_in) - kMinVSyncPlusBP / 1000000) /␊ |
(v_lines + (2 * top_margin_lines) + kMinFrontPorch + interlace) * ␊ |
1000000;␊ |
␊ |
// Estimate the vertical field frequency␊ |
double v_field_rate_est = 1 / h_period_est / v_total_lines * 1000000;␊ |
␊ |
// Number of lines in Vsync + back porch␊ |
v_sync_plus_bp = Round(kMinVSyncPlusBP / h_period_est);␊ |
␊ |
|
v_total_lines = v_lines + top_margin_lines + bot_margin_lines +␊ |
v_sync_plus_bp + interlace + kMinFrontPorch;␊ |
␊ |
// Estimate the vertical field frequency␊ |
v_field_rate_est = 1 / h_period_est / v_total_lines * 1000000;␊ |
␊ |
// Find the actual horizontal period␊ |
h_period = h_period_est / (v_field_rate_in / v_field_rate_est);␊ |
␊ |
|
if (paramType == kCRTCParamPixelClock)␊ |
{␊ |
// Horizontal frequency␊ |
h_freq = pixel_freq / h_total_pixels * 1000;␊ |
double h_freq = pixel_freq / h_total_pixels * 1000;␊ |
␊ |
// Number of lines in V sync + back porch␊ |
v_sync_plus_bp = Round(kMinVSyncPlusBP * h_freq / 1000);␊ |