diff options
Diffstat (limited to 'src/gfx')
34 files changed, 2926 insertions, 2717 deletions
diff --git a/src/gfx/disp_gu1.c b/src/gfx/disp_gu1.c index 58e42ee..2cb1ed5 100644 --- a/src/gfx/disp_gu1.c +++ b/src/gfx/disp_gu1.c @@ -23,9 +23,9 @@ * software without specific prior written permission. */ -void gu1_enable_compression(void); /* private routine definition */ -void gu1_disable_compression(void); /* private routine definition */ -void gfx_reset_video(void); /* private routine definition */ +void gu1_enable_compression(void); /* private routine definition */ +void gu1_disable_compression(void); /* private routine definition */ +void gfx_reset_video(void); /* private routine definition */ int gfx_set_display_control(int sync_polarities); /* private routine * definition */ int gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp); @@ -83,9 +83,9 @@ gu1_delay_precise(unsigned long milliseconds) else total_ticks = 1000 * milliseconds; /* timer resolution is 1 MHz */ - if (total_ticks > ((unsigned long)0xffffffff - timer_start)) + if (total_ticks > ((unsigned long) 0xffffffff - timer_start)) /* wrap-around */ - timer_end = total_ticks - ((unsigned long)0xffffffff - timer_start); + timer_end = total_ticks - ((unsigned long) 0xffffffff - timer_start); else timer_end = timer_start + total_ticks; @@ -110,7 +110,7 @@ gu1_delay_precise(unsigned long milliseconds) if (IND(SC1200_CB_BASE_ADDR + SC1200_CB_TMVALUE) > timer_end) break; } -#endif /* GFX_VIDEO_SC1200 */ +#endif /* GFX_VIDEO_SC1200 */ } /*---------------------------------------------------------------------------- @@ -152,7 +152,7 @@ gfx_delay_milliseconds(unsigned long milliseconds) #if GFX_VIDEO_DYNAMIC } #endif -#endif /* GFX_VIDEO_SC1200 */ +#endif /* GFX_VIDEO_SC1200 */ gu1_delay_approximate(milliseconds); } @@ -201,7 +201,7 @@ gu1_video_shutdown(void) tcfg = READ_REG32(DC_TIMING_CFG); /* BLANK THE GX DISPLAY AND DISABLE THE TIMING GENERATOR */ - tcfg &= ~((unsigned long)DC_TCFG_BLKE | (unsigned long)DC_TCFG_TGEN); + tcfg &= ~((unsigned long) DC_TCFG_BLKE | (unsigned long) DC_TCFG_TGEN); WRITE_REG32(DC_TIMING_CFG, tcfg); /* DELAY: WAIT FOR PENDING MEMORY REQUESTS */ @@ -210,7 +210,7 @@ gu1_video_shutdown(void) gfx_delay_milliseconds(1); /* DISABLE DISPLAY FIFO LOAD AND DISABLE COMPRESSION */ - gcfg &= ~(unsigned long)(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); + gcfg &= ~(unsigned long) (DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); WRITE_REG32(DC_GENERAL_CFG, gcfg); WRITE_REG32(DC_UNLOCK, unlock); return; @@ -295,7 +295,7 @@ gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) tcfg = READ_REG32(DC_TIMING_CFG); /* BLANK THE GX DISPLAY AND DISABLE THE TIMING GENERATOR */ - tcfg &= ~((unsigned long)DC_TCFG_BLKE | (unsigned long)DC_TCFG_TGEN); + tcfg &= ~((unsigned long) DC_TCFG_BLKE | (unsigned long) DC_TCFG_TGEN); WRITE_REG32(DC_TIMING_CFG, tcfg); /* DELAY: WAIT FOR PENDING MEMORY REQUESTS @@ -305,12 +305,12 @@ gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) gfx_delay_milliseconds(1); /* DISABLE DISPLAY FIFO LOAD AND DISABLE COMPRESSION */ - gcfg &= ~(unsigned long)(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); + gcfg &= ~(unsigned long) (DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); WRITE_REG32(DC_GENERAL_CFG, gcfg); /* CLEAR THE "DCLK_MUL" FIELD */ - gcfg &= ~(unsigned long)(DC_GCFG_DDCK | DC_GCFG_DPCK | DC_GCFG_DFCK); - gcfg &= ~(unsigned long)DC_GCFG_DCLK_MASK; + gcfg &= ~(unsigned long) (DC_GCFG_DDCK | DC_GCFG_DPCK | DC_GCFG_DFCK); + gcfg &= ~(unsigned long) DC_GCFG_DCLK_MASK; WRITE_REG32(DC_GENERAL_CFG, gcfg); /* SET THE DOT CLOCK FREQUENCY */ @@ -363,7 +363,8 @@ gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) /* requires a pitch of 2048. */ if ((pMode->flags & GFX_MODE_LINE_DOUBLE) && bpp > 8) pitch <<= 1; - } else { + } + else { if (gfx_cpu_version == GFX_CPU_PYRAMID) pitch = (size <= 2048) ? 2048 : 4096; else @@ -397,8 +398,7 @@ gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) /* SET FIFO PRIORITY, DCLK MULTIPLIER, AND FIFO ENABLE */ /* Default 6/5 for FIFO, 2x for DCLK multiplier. */ - gcfg = - (6 << DC_GCFG_DFHPEL_POS) | (5 << DC_GCFG_DFHPSL_POS) | DC_GCFG_DFLE; + gcfg = (6 << DC_GCFG_DFHPEL_POS) | (5 << DC_GCFG_DFHPSL_POS) | DC_GCFG_DFLE; /* INCREASE FIFO PRIORITY FOR LARGE MODES */ if (pMode->hactive == 1280 && pMode->vactive == 1024) { @@ -460,32 +460,32 @@ gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) /* COMBINE AND SET TIMING VALUES */ - value = (unsigned long)(hactive - 1) | - (((unsigned long)(pMode->htotal - 1)) << 16); + value = (unsigned long) (hactive - 1) | + (((unsigned long) (pMode->htotal - 1)) << 16); WRITE_REG32(DC_H_TIMING_1, value); - value = (unsigned long)(pMode->hblankstart - 1) | - (((unsigned long)(pMode->hblankend - 1)) << 16); + value = (unsigned long) (pMode->hblankstart - 1) | + (((unsigned long) (pMode->hblankend - 1)) << 16); WRITE_REG32(DC_H_TIMING_2, value); - value = (unsigned long)(pMode->hsyncstart - 1) | - (((unsigned long)(pMode->hsyncend - 1)) << 16); + value = (unsigned long) (pMode->hsyncstart - 1) | + (((unsigned long) (pMode->hsyncend - 1)) << 16); WRITE_REG32(DC_H_TIMING_3, value); WRITE_REG32(DC_FP_H_TIMING, value); - value = (unsigned long)(vactive - 1) | - (((unsigned long)(pMode->vtotal - 1)) << 16); + value = (unsigned long) (vactive - 1) | + (((unsigned long) (pMode->vtotal - 1)) << 16); WRITE_REG32(DC_V_TIMING_1, value); - value = (unsigned long)(pMode->vblankstart - 1) | - (((unsigned long)(pMode->vblankend - 1)) << 16); + value = (unsigned long) (pMode->vblankstart - 1) | + (((unsigned long) (pMode->vblankend - 1)) << 16); WRITE_REG32(DC_V_TIMING_2, value); - value = (unsigned long)(pMode->vsyncstart - 1) | - (((unsigned long)(pMode->vsyncend - 1)) << 16); + value = (unsigned long) (pMode->vsyncstart - 1) | + (((unsigned long) (pMode->vsyncend - 1)) << 16); WRITE_REG32(DC_V_TIMING_3, value); - value = (unsigned long)(pMode->vsyncstart - 2) | - (((unsigned long)(pMode->vsyncend - 2)) << 16); + value = (unsigned long) (pMode->vsyncstart - 2) | + (((unsigned long) (pMode->vsyncend - 2)) << 16); WRITE_REG32(DC_FP_V_TIMING, value); WRITE_REG32(DC_OUTPUT_CFG, ocfg); WRITE_REG32(DC_TIMING_CFG, tcfg); - gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ + gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ WRITE_REG32(DC_GENERAL_CFG, gcfg); /* ENABLE FLAT PANEL CENTERING */ @@ -496,13 +496,13 @@ gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) tcfg = READ_REG32(DC_TIMING_CFG); tcfg = tcfg | DC_TCFG_FCEN; WRITE_REG32(DC_TIMING_CFG, tcfg); - gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ + gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ } } /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ gfx_set_display_control(((pMode->flags & GFX_MODE_NEG_HSYNC) ? 1 : 0) | - ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); + ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); /* RESTORE VALUE OF DC_UNLOCK */ WRITE_REG32(DC_UNLOCK, unlock); @@ -517,10 +517,10 @@ gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) else if (pitch > 1024) value |= BC_FB_WIDTH_2048; - WRITE_REG16(GP_BLIT_STATUS, (unsigned short)value); + WRITE_REG16(GP_BLIT_STATUS, (unsigned short) value); return GFX_STATUS_OK; -} /* end gfx_set_specified_mode() */ +} /* end gfx_set_specified_mode() */ /*---------------------------------------------------------------------------- * GFX_IS_DISPLAY_MODE_SUPPORTED @@ -571,13 +571,13 @@ gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) /* ONLY PYRAMID SUPPORTS 4K PITCH */ if (gfx_cpu_version != GFX_CPU_PYRAMID && xres > 1024) { if (bpp > 8) - return (-1); /* return with mode not found */ + return (-1); /* return with mode not found */ } /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ for (mode = 0; mode < NUM_GX_DISPLAY_MODES; mode++) { - if ((DisplayParams[mode].hactive == (unsigned short)xres) && - (DisplayParams[mode].vactive == (unsigned short)yres) && + if ((DisplayParams[mode].hactive == (unsigned short) xres) && + (DisplayParams[mode].vactive == (unsigned short) yres) && (DisplayParams[mode].flags & hz_flag) && (DisplayParams[mode].flags & bpp_flag)) { @@ -613,8 +613,7 @@ gfx_set_display_mode(int xres, int yres, int bpp, int hz) mode = gfx_is_display_mode_supported(xres, yres, bpp, hz); if (mode >= 0) { - if (gu1_set_specified_mode(&DisplayParams[mode], - bpp) == GFX_STATUS_OK) + if (gu1_set_specified_mode(&DisplayParams[mode], bpp) == GFX_STATUS_OK) return (1); } return (0); @@ -632,21 +631,23 @@ gfx_set_display_mode(int xres, int yres, int bpp, int hz) #if GFX_DISPLAY_DYNAMIC int gu1_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblankstart, - unsigned short hsyncstart, unsigned short hsyncend, - unsigned short hblankend, unsigned short htotal, - unsigned short vactive, unsigned short vblankstart, - unsigned short vsyncstart, unsigned short vsyncend, - unsigned short vblankend, unsigned short vtotal, unsigned long frequency) + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) #else int gfx_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblankstart, - unsigned short hsyncstart, unsigned short hsyncend, - unsigned short hblankend, unsigned short htotal, - unsigned short vactive, unsigned short vblankstart, - unsigned short vsyncstart, unsigned short vsyncend, - unsigned short vblankend, unsigned short vtotal, unsigned long frequency) + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) #endif { /* SET MODE STRUCTURE WITH SPECIFIED VALUES */ @@ -711,13 +712,13 @@ gfx_set_vtotal(unsigned short vtotal) timing2 = READ_REG32(DC_V_TIMING_2); /* DISABLE THE TIMING GENERATOR */ - WRITE_REG32(DC_TIMING_CFG, tcfg & ~(unsigned long)DC_TCFG_TGEN); + WRITE_REG32(DC_TIMING_CFG, tcfg & ~(unsigned long) DC_TCFG_TGEN); /* WRITE NEW TIMING VALUES */ WRITE_REG32(DC_V_TIMING_1, - (timing1 & 0xffff) | (unsigned long)(vtotal - 1) << 16); + (timing1 & 0xffff) | (unsigned long) (vtotal - 1) << 16); WRITE_REG32(DC_V_TIMING_2, - (timing2 & 0xffff) | (unsigned long)(vtotal - 1) << 16); + (timing2 & 0xffff) | (unsigned long) (vtotal - 1) << 16); /* RESTORE GX VALUES */ WRITE_REG32(DC_TIMING_CFG, tcfg); @@ -751,7 +752,7 @@ gfx_set_display_pitch(unsigned short pitch) /* ALSO UPDATE PITCH IN GRAPHICS ENGINE */ /* Pyramid alone supports 4K line pitch */ - value = (unsigned long)READ_REG16(GP_BLIT_STATUS); + value = (unsigned long) READ_REG16(GP_BLIT_STATUS); value &= ~(BC_FB_WIDTH_2048 | BC_FB_WIDTH_4096); if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) @@ -760,7 +761,7 @@ gfx_set_display_pitch(unsigned short pitch) else if (pitch > 1024) value |= BC_FB_WIDTH_2048; - WRITE_REG16(GP_BLIT_STATUS, (unsigned short)value); + WRITE_REG16(GP_BLIT_STATUS, (unsigned short) value); return; } @@ -800,7 +801,8 @@ gfx_set_display_offset(unsigned long offset) gfx_wait_vertical_blank(); gu1_enable_compression(); } - } else { + } + else { /* ONLY DISABLE COMPRESSION ONCE */ if (gfx_compression_active) gu1_disable_compression(); @@ -933,7 +935,7 @@ gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) #if GFX_VIDEO_SC1200 if (gfx_test_timing_active()) - while ((gfx_get_vline()) > gfx_get_vactive()) ; + while ((gfx_get_vline()) > gfx_get_vactive()); #endif /* SET CURSOR COLORS */ WRITE_REG32(DC_PAL_ADDRESS, 0x100); @@ -958,13 +960,13 @@ gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) #if GFX_DISPLAY_DYNAMIC void gu1_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot) + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) #else void gfx_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot) + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) #endif { unsigned long unlock; @@ -981,8 +983,8 @@ gfx_set_cursor_position(unsigned long memoffset, if (gfx_line_double) ypos <<= 1; - x = (short)xpos - (short)xhotspot; - y = (short)ypos - (short)yhotspot; + x = (short) xpos - (short) xhotspot; + y = (short) ypos - (short) yhotspot; if (x < -31) return; @@ -999,13 +1001,13 @@ gfx_set_cursor_position(unsigned long memoffset, y = 0; } - memoffset += (unsigned long)yoffset << 3; + memoffset += (unsigned long) yoffset << 3; if (PanelEnable) { if ((ModeWidth > PanelWidth) || (ModeHeight > PanelHeight)) { gfx_enable_panning(xpos, ypos); - x = x - (short)panelLeft; - y = y - (short)panelTop; + x = x - (short) panelLeft; + y = y - (short) panelTop; } } @@ -1013,10 +1015,10 @@ gfx_set_cursor_position(unsigned long memoffset, unlock = READ_REG32(DC_UNLOCK); WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); WRITE_REG32(DC_CURS_ST_OFFSET, memoffset); - WRITE_REG32(DC_CURSOR_X, (unsigned long)x | - (((unsigned long)xoffset) << 11)); - WRITE_REG32(DC_CURSOR_Y, (unsigned long)y | - (((unsigned long)yoffset) << 11)); + WRITE_REG32(DC_CURSOR_X, (unsigned long) x | + (((unsigned long) xoffset) << 11)); + WRITE_REG32(DC_CURSOR_Y, (unsigned long) y | + (((unsigned long) yoffset) << 11)); WRITE_REG32(DC_UNLOCK, unlock); } @@ -1030,11 +1032,11 @@ gfx_set_cursor_position(unsigned long memoffset, #if GFX_DISPLAY_DYNAMIC void gu1_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) #else void gfx_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) #endif { int i; @@ -1190,7 +1192,7 @@ gfx_set_compression_pitch(unsigned short pitch) /* SET REGISTER VALUE */ lock = READ_REG32(DC_UNLOCK); line_delta = READ_REG32(DC_LINE_DELTA) & 0xFF800FFF; - line_delta |= ((unsigned long)pitch << 10l) & 0x007FF000; + line_delta |= ((unsigned long) pitch << 10l) & 0x007FF000; WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); WRITE_REG32(DC_LINE_DELTA, line_delta); WRITE_REG32(DC_UNLOCK, lock); @@ -1293,7 +1295,7 @@ gfx_set_display_video_size(unsigned short width, unsigned short height) { unsigned long lock, size, value; - size = (unsigned long)(width << 1) * (unsigned long)height; + size = (unsigned long) (width << 1) * (unsigned long) height; /* STORE THE VIDEO BUFFER SIZE AS A GLOBAL */ vid_buf_size = ((size + 63) >> 6) << 16; @@ -1410,8 +1412,8 @@ gfx_wait_vertical_blank(void) #endif { if (gfx_test_timing_active()) { - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); } return (0); @@ -1441,8 +1443,8 @@ gfx_enable_panning(int x, int y) (((ModeWidth + 1023) / 1024) * 1024) * modeBytesPerPixel; /* TEST FOR NO-WORK */ - if (x >= DeltaX && (unsigned short)x < (PanelWidth + DeltaX) && - y >= DeltaY && (unsigned short)y < (PanelHeight + DeltaY)) + if (x >= DeltaX && (unsigned short) x < (PanelWidth + DeltaX) && + y >= DeltaY && (unsigned short) y < (PanelHeight + DeltaY)) return; /* ADJUST PANNING VARIABLES WHEN CURSOR EXCEEDS BOUNDARY */ @@ -1450,12 +1452,12 @@ gfx_enable_panning(int x, int y) /* all variables and the starting offset accordingly. */ if (x < DeltaX) DeltaX = x; - else if ((unsigned short)x >= (DeltaX + PanelWidth)) + else if ((unsigned short) x >= (DeltaX + PanelWidth)) DeltaX = x - PanelWidth + 1; if (y < DeltaY) DeltaY = y; - else if ((unsigned short)y >= (DeltaY + PanelHeight)) + else if ((unsigned short) y >= (DeltaY + PanelHeight)) DeltaY = y - PanelHeight + 1; /* CALCULATE THE START OFFSET */ @@ -1483,19 +1485,19 @@ gfx_enable_panning(int x, int y) #if GFX_DISPLAY_DYNAMIC int gu1_set_fixed_timings(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #else int gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #endif { unsigned int mode; ModeWidth = width; ModeHeight = height; - PanelWidth = (unsigned short)panelResX; - PanelHeight = (unsigned short)panelResY; + PanelWidth = (unsigned short) panelResX; + PanelHeight = (unsigned short) panelResY; PanelEnable = 1; /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ @@ -1509,14 +1511,16 @@ gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, FIXEDTIMINGS *fmode = &FixedParams[mode]; gfx_set_display_timings(bpp, 3, fmode->hactive, - fmode->hblankstart, fmode->hsyncstart, fmode->hsyncend, - fmode->hblankend, fmode->htotal, fmode->vactive, - fmode->vblankstart, fmode->vsyncstart, fmode->vsyncend, - fmode->vblankend, fmode->vtotal, fmode->frequency); + fmode->hblankstart, fmode->hsyncstart, + fmode->hsyncend, fmode->hblankend, + fmode->htotal, fmode->vactive, + fmode->vblankstart, fmode->vsyncstart, + fmode->vsyncend, fmode->vblankend, + fmode->vtotal, fmode->frequency); return (1); - } /* end if() */ - } /* end for() */ + } /* end if() */ + } /* end for() */ return (-1); } @@ -1528,11 +1532,11 @@ gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, #if GFX_DISPLAY_DYNAMIC int gu1_set_panel_present(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #else int gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #endif { /* SET VALID BPP */ @@ -1549,8 +1553,8 @@ gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, ModeWidth = width; ModeHeight = height; - PanelWidth = (unsigned short)panelResX; - PanelHeight = (unsigned short)panelResY; + PanelWidth = (unsigned short) panelResX; + PanelHeight = (unsigned short) panelResY; PanelEnable = 1; gbpp = bpp; @@ -1590,11 +1594,12 @@ gfx_get_display_pitch(void) if (gfx_cpu_version == GFX_CPU_PYRAMID) { /* Pyramid update for 4KB line pitch */ value = (READ_REG32(DC_LINE_DELTA) & 0x07FF) << 2; - } else { + } + else { value = (READ_REG32(DC_LINE_DELTA) & 0x03FF) << 2; } - return ((unsigned short)value); + return ((unsigned short) value); } /*---------------------------------------------------------------------------- @@ -1680,11 +1685,11 @@ gfx_get_frame_buffer_line_size(void) #if GFX_DISPLAY_DYNAMIC int gu1_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency) + unsigned long frequency) #else int gfx_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency) + unsigned long frequency) #endif { unsigned int index; @@ -1696,8 +1701,8 @@ gfx_mode_frequency_supported(int xres, int yres, int bpp, bpp_flag = GFX_MODE_16BPP; for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { - if ((DisplayParams[index].hactive == (unsigned short)xres) && - (DisplayParams[index].vactive == (unsigned short)yres) && + if ((DisplayParams[index].hactive == (unsigned short) xres) && + (DisplayParams[index].vactive == (unsigned short) yres) && (DisplayParams[index].flags & bpp_flag) && (DisplayParams[index].frequency == frequency)) { int hz = 0; @@ -1732,11 +1737,11 @@ gfx_mode_frequency_supported(int xres, int yres, int bpp, #if GFX_DISPLAY_DYNAMIC int gu1_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #else int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #endif { unsigned int index, closematch = 0; @@ -1754,10 +1759,10 @@ gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, /* Search the table for the closest frequency (16.16 format). */ min = 0x7fffffff; for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { - if ((DisplayParams[index].htotal == (unsigned short)xres) && - (DisplayParams[index].vtotal == (unsigned short)yres) && + if ((DisplayParams[index].htotal == (unsigned short) xres) && + (DisplayParams[index].vtotal == (unsigned short) yres) && (DisplayParams[index].flags & bpp_flag)) { - diff = (long)frequency - (long)DisplayParams[index].frequency; + diff = (long) frequency - (long) DisplayParams[index].frequency; if (diff < 0) diff = -diff; @@ -1797,11 +1802,11 @@ gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, #if GFX_DISPLAY_DYNAMIC int gu1_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #else int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #endif { unsigned int index, closematch = 0; @@ -1819,10 +1824,10 @@ gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, /* Search the table for the closest frequency (16.16 format). */ min = 0x7fffffff; for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { - if ((DisplayParams[index].hactive == (unsigned short)xres) && - (DisplayParams[index].vactive == (unsigned short)yres) && + if ((DisplayParams[index].hactive == (unsigned short) xres) && + (DisplayParams[index].vactive == (unsigned short) yres) && (DisplayParams[index].flags & bpp_flag)) { - diff = (long)frequency - (long)DisplayParams[index].frequency; + diff = (long) frequency - (long) DisplayParams[index].frequency; if (diff < 0) diff = -diff; @@ -1860,11 +1865,11 @@ gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, #if GFX_DISPLAY_DYNAMIC int gu1_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, - int *frequency) + int *frequency) #else int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, - int *frequency) + int *frequency) #endif { unsigned int index; @@ -1894,8 +1899,8 @@ gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { - if ((DisplayParams[index].hactive == (unsigned short)xres) && - (DisplayParams[index].vactive == (unsigned short)yres) && + if ((DisplayParams[index].hactive == (unsigned short) xres) && + (DisplayParams[index].vactive == (unsigned short) yres) && (DisplayParams[index].flags & bpp_flag) && (DisplayParams[index].flags & hz_flag)) { *frequency = DisplayParams[index].frequency; @@ -1962,8 +1967,8 @@ gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) bpp_flag = GFX_MODE_16BPP; for (mode = 0; mode < NUM_GX_DISPLAY_MODES; mode++) { - if ((DisplayParams[mode].hactive == (unsigned short)*xres) && - (DisplayParams[mode].vactive == (unsigned short)*yres) && + if ((DisplayParams[mode].hactive == (unsigned short) *xres) && + (DisplayParams[mode].vactive == (unsigned short) *yres) && (DisplayParams[mode].frequency == pll_freq) && (DisplayParams[mode].flags & bpp_flag)) { @@ -2000,7 +2005,7 @@ unsigned short gfx_get_hactive(void) #endif { - return ((unsigned short)((READ_REG32(DC_H_TIMING_1) & 0x07F8) + 8)); + return ((unsigned short) ((READ_REG32(DC_H_TIMING_1) & 0x07F8) + 8)); } /*--------------------------------------------------------------------------- @@ -2015,7 +2020,7 @@ unsigned short gfx_get_hsync_start(void) #endif { - return ((unsigned short)((READ_REG32(DC_H_TIMING_3) & 0x07F8) + 8)); + return ((unsigned short) ((READ_REG32(DC_H_TIMING_3) & 0x07F8) + 8)); } /*--------------------------------------------------------------------------- @@ -2030,8 +2035,8 @@ unsigned short gfx_get_hsync_end(void) #endif { - return ((unsigned short)(((READ_REG32(DC_H_TIMING_3) >> 16) & 0x07F8) + - 8)); + return ((unsigned short) (((READ_REG32(DC_H_TIMING_3) >> 16) & 0x07F8) + + 8)); } /*--------------------------------------------------------------------------- @@ -2046,8 +2051,8 @@ unsigned short gfx_get_htotal(void) #endif { - return ((unsigned short)(((READ_REG32(DC_H_TIMING_1) >> 16) & 0x07F8) + - 8)); + return ((unsigned short) (((READ_REG32(DC_H_TIMING_1) >> 16) & 0x07F8) + + 8)); } /*--------------------------------------------------------------------------- @@ -2062,7 +2067,7 @@ unsigned short gfx_get_vactive(void) #endif { - return ((unsigned short)((READ_REG32(DC_V_TIMING_1) & 0x07FF) + 1)); + return ((unsigned short) ((READ_REG32(DC_V_TIMING_1) & 0x07FF) + 1)); } /*--------------------------------------------------------------------------- @@ -2077,8 +2082,8 @@ unsigned short gfx_get_vsync_end(void) #endif { - return ((unsigned short)(((READ_REG32(DC_V_TIMING_3) >> 16) & 0x07FF) + - 1)); + return ((unsigned short) (((READ_REG32(DC_V_TIMING_3) >> 16) & 0x07FF) + + 1)); } /*--------------------------------------------------------------------------- @@ -2093,8 +2098,8 @@ unsigned short gfx_get_vtotal(void) #endif { - return ((unsigned short)(((READ_REG32(DC_V_TIMING_1) >> 16) & 0x07FF) + - 1)); + return ((unsigned short) (((READ_REG32(DC_V_TIMING_1) >> 16) & 0x07FF) + + 1)); } /*----------------------------------------------------------------------------- @@ -2136,10 +2141,9 @@ gfx_get_vline(void) /* Read similar value twice to ensure that the value is not transitioning */ do { - current_scan_line = - (unsigned short)READ_REG32(DC_V_LINE_CNT) & 0x07FF; + current_scan_line = (unsigned short) READ_REG32(DC_V_LINE_CNT) & 0x07FF; } while (current_scan_line != - (unsigned short)(READ_REG32(DC_V_LINE_CNT) & 0x07FF)); + (unsigned short) (READ_REG32(DC_V_LINE_CNT) & 0x07FF)); return (current_scan_line); } @@ -2192,7 +2196,7 @@ unsigned short gfx_get_hblank_start(void) #endif { - return ((unsigned short)((READ_REG32(DC_H_TIMING_2) & 0x07F8) + 8)); + return ((unsigned short) ((READ_REG32(DC_H_TIMING_2) & 0x07F8) + 8)); } /*--------------------------------------------------------------------------- @@ -2207,8 +2211,8 @@ unsigned short gfx_get_hblank_end(void) #endif { - return ((unsigned short)(((READ_REG32(DC_H_TIMING_2) >> 16) & 0x07F8) + - 8)); + return ((unsigned short) (((READ_REG32(DC_H_TIMING_2) >> 16) & 0x07F8) + + 8)); } /*--------------------------------------------------------------------------- @@ -2223,7 +2227,7 @@ unsigned short gfx_get_vblank_start(void) #endif { - return ((unsigned short)((READ_REG32(DC_V_TIMING_2) & 0x07FF) + 1)); + return ((unsigned short) ((READ_REG32(DC_V_TIMING_2) & 0x07FF) + 1)); } /*--------------------------------------------------------------------------- @@ -2238,7 +2242,7 @@ unsigned short gfx_get_vsync_start(void) #endif { - return ((unsigned short)((READ_REG32(DC_V_TIMING_3) & 0x07FF) + 1)); + return ((unsigned short) ((READ_REG32(DC_V_TIMING_3) & 0x07FF) + 1)); } /*--------------------------------------------------------------------------- @@ -2253,8 +2257,8 @@ unsigned short gfx_get_vblank_end(void) #endif { - return ((unsigned short)(((READ_REG32(DC_V_TIMING_2) >> 16) & 0x07FF) + - 1)); + return ((unsigned short) (((READ_REG32(DC_V_TIMING_2) >> 16) & 0x07FF) + + 1)); } /*----------------------------------------------------------------------------- @@ -2334,7 +2338,7 @@ gfx_get_cursor_position(void) #endif { return ((READ_REG32(DC_CURSOR_X) & 0x07FF) | - ((READ_REG32(DC_CURSOR_Y) << 16) & 0x03FF0000)); + ((READ_REG32(DC_CURSOR_Y) << 16) & 0x03FF0000)); } /*----------------------------------------------------------------------------- @@ -2350,7 +2354,7 @@ gfx_get_cursor_clip(void) #endif { return (((READ_REG32(DC_CURSOR_X) >> 11) & 0x01F) | - ((READ_REG32(DC_CURSOR_Y) << 5) & 0x1F0000)); + ((READ_REG32(DC_CURSOR_Y) << 5) & 0x1F0000)); } /*----------------------------------------------------------------------------- @@ -2369,7 +2373,8 @@ gfx_get_cursor_color(int color) if (color) { WRITE_REG32(DC_PAL_ADDRESS, 0x101); - } else { + } + else { WRITE_REG32(DC_PAL_ADDRESS, 0x100); } data = READ_REG32(DC_PAL_DATA); @@ -2431,7 +2436,7 @@ gfx_get_compression_pitch(void) { unsigned short pitch; - pitch = (unsigned short)(READ_REG32(DC_LINE_DELTA) >> 12) & 0x03FF; + pitch = (unsigned short) (READ_REG32(DC_LINE_DELTA) >> 12) & 0x03FF; return (pitch << 2); } @@ -2449,7 +2454,7 @@ gfx_get_compression_size(void) { unsigned short size; - size = (unsigned short)((READ_REG32(DC_BUF_SIZE) >> 9) & 0x7F) - 1; + size = (unsigned short) ((READ_REG32(DC_BUF_SIZE) >> 9) & 0x7F) - 1; return ((size << 2) + 16); } @@ -2468,7 +2473,7 @@ gfx_get_valid_bit(int line) int valid; WRITE_REG32(MC_DR_ADD, line); - valid = (int)READ_REG32(MC_DR_ACC) & 1; + valid = (int) READ_REG32(MC_DR_ACC) & 1; return (valid); } @@ -2527,6 +2532,6 @@ gfx_get_display_priority_high(void) return (0); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ /* END OF FILE */ diff --git a/src/gfx/disp_gu2.c b/src/gfx/disp_gu2.c index 403a72a..f105cc1 100644 --- a/src/gfx/disp_gu2.c +++ b/src/gfx/disp_gu2.c @@ -27,8 +27,8 @@ * This file contains routines for the second generation display controller. * */ -void gu2_enable_compression(void); /* private routine definition */ -void gu2_disable_compression(void); /* private routine definition */ +void gu2_enable_compression(void); /* private routine definition */ +void gu2_disable_compression(void); /* private routine definition */ int gfx_set_display_control(int sync_polarities); /* private routine * definition */ void gfx_reset_video(void); @@ -98,7 +98,7 @@ gfx_set_display_bpp(unsigned short bpp) dcfg = READ_REG32(MDC_DISPLAY_CFG) & ~(MDC_DCFG_DISP_MODE_MASK | - MDC_DCFG_16BPP_MODE_MASK); + MDC_DCFG_16BPP_MODE_MASK); lock = READ_REG32(MDC_UNLOCK); switch (bpp) { @@ -207,7 +207,7 @@ gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) gfx_set_crt_enable(0); /* DISABLE THE TIMING GENERATOR */ - dcfg &= ~(unsigned long)MDC_DCFG_TGEN; + dcfg &= ~(unsigned long) MDC_DCFG_TGEN; WRITE_REG32(MDC_DISPLAY_CFG, dcfg); /* DELAY: WAIT FOR PENDING MEMORY REQUESTS */ @@ -216,11 +216,11 @@ gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) gfx_delay_milliseconds(5); /* DISABLE DISPLAY FIFO LOAD */ - gcfg &= ~(unsigned long)MDC_GCFG_DFLE; + gcfg &= ~(unsigned long) MDC_GCFG_DFLE; WRITE_REG32(MDC_GENERAL_CFG, gcfg); /* PRESERVE VIDEO INFORMATION */ - gcfg &= (unsigned long)(MDC_GCFG_YUVM | MDC_GCFG_VDSE); + gcfg &= (unsigned long) (MDC_GCFG_YUVM | MDC_GCFG_VDSE); dcfg = 0; /* SET THE DOT CLOCK FREQUENCY */ @@ -297,7 +297,7 @@ gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) /* ALWAYS ENABLE VIDEO AND GRAPHICS DATA */ /* These bits are relics from a previous design and */ /* should always be enabled. */ - dcfg |= (unsigned long)(MDC_DCFG_VDEN | MDC_DCFG_GDEN); + dcfg |= (unsigned long) (MDC_DCFG_VDEN | MDC_DCFG_GDEN); /* SET PIXEL FORMAT */ dcfg |= bpp_mask; @@ -305,8 +305,8 @@ gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) /* ENABLE TIMING GENERATOR, TIM. REG. UPDATES, PALETTE BYPASS */ /* AND VERT. INT. SELECT */ dcfg |= - (unsigned long)(MDC_DCFG_TGEN | MDC_DCFG_TRUP | MDC_DCFG_PALB | - MDC_DCFG_VISL); + (unsigned long) (MDC_DCFG_TGEN | MDC_DCFG_TRUP | MDC_DCFG_PALB | + MDC_DCFG_VISL); /* DISABLE ADDRESS MASKS */ dcfg |= MDC_DCFG_A20M; @@ -326,23 +326,23 @@ gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) dcfg |= MDC_DCFG_DCEN; /* COMBINE AND SET TIMING VALUES */ - value = (unsigned long)(pMode->hactive - 1) | - (((unsigned long)(pMode->htotal - 1)) << 16); + value = (unsigned long) (pMode->hactive - 1) | + (((unsigned long) (pMode->htotal - 1)) << 16); WRITE_REG32(MDC_H_ACTIVE_TIMING, value); - value = (unsigned long)(pMode->hblankstart - 1) | - (((unsigned long)(pMode->hblankend - 1)) << 16); + value = (unsigned long) (pMode->hblankstart - 1) | + (((unsigned long) (pMode->hblankend - 1)) << 16); WRITE_REG32(MDC_H_BLANK_TIMING, value); - value = (unsigned long)(pMode->hsyncstart - 1) | - (((unsigned long)(pMode->hsyncend - 1)) << 16); + value = (unsigned long) (pMode->hsyncstart - 1) | + (((unsigned long) (pMode->hsyncend - 1)) << 16); WRITE_REG32(MDC_H_SYNC_TIMING, value); - value = (unsigned long)(pMode->vactive - 1) | - (((unsigned long)(pMode->vtotal - 1)) << 16); + value = (unsigned long) (pMode->vactive - 1) | + (((unsigned long) (pMode->vtotal - 1)) << 16); WRITE_REG32(MDC_V_ACTIVE_TIMING, value); - value = (unsigned long)(pMode->vblankstart - 1) | - (((unsigned long)(pMode->vblankend - 1)) << 16); + value = (unsigned long) (pMode->vblankstart - 1) | + (((unsigned long) (pMode->vblankend - 1)) << 16); WRITE_REG32(MDC_V_BLANK_TIMING, value); - value = (unsigned long)(pMode->vsyncstart - 1) | - (((unsigned long)(pMode->vsyncend - 1)) << 16); + value = (unsigned long) (pMode->vsyncstart - 1) | + (((unsigned long) (pMode->vsyncend - 1)) << 16); WRITE_REG32(MDC_V_SYNC_TIMING, value); WRITE_REG32(MDC_DISPLAY_CFG, dcfg); @@ -350,15 +350,15 @@ gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ gfx_set_display_control(((pMode->flags & GFX_MODE_NEG_HSYNC) ? 1 : 0) | - ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); + ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); /* RESTORE VALUE OF MDC_UNLOCK */ WRITE_REG32(MDC_UNLOCK, unlock); /* RESET THE PITCH VALUES IN THE GP */ - gfx_reset_pitch((unsigned short)pitch); + gfx_reset_pitch((unsigned short) pitch); - gfx_set_bpp((unsigned short)bpp); + gfx_set_bpp((unsigned short) bpp); return GFX_STATUS_OK; } @@ -388,8 +388,8 @@ gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) gfx_mode_bpp_conversion /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ for (mode = 0; mode < NUM_RC_DISPLAY_MODES; mode++) { - if ((DisplayParams[mode].hactive == (unsigned short)xres) && - (DisplayParams[mode].vactive == (unsigned short)yres) && + if ((DisplayParams[mode].hactive == (unsigned short) xres) && + (DisplayParams[mode].vactive == (unsigned short) yres) && (DisplayParams[mode].flags & hz_flag) && (DisplayParams[mode].flags & bpp_flag)) { @@ -431,8 +431,7 @@ gfx_set_display_mode(int xres, int yres, int bpp, int hz) mode = gfx_is_display_mode_supported(xres, yres, bpp, hz); if (mode >= 0) { - if (gu2_set_specified_mode(&DisplayParams[mode], - bpp) == GFX_STATUS_OK) + if (gu2_set_specified_mode(&DisplayParams[mode], bpp) == GFX_STATUS_OK) return (1); } return (0); @@ -450,21 +449,23 @@ gfx_set_display_mode(int xres, int yres, int bpp, int hz) #if GFX_DISPLAY_DYNAMIC int gu2_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblankstart, - unsigned short hsyncstart, unsigned short hsyncend, - unsigned short hblankend, unsigned short htotal, - unsigned short vactive, unsigned short vblankstart, - unsigned short vsyncstart, unsigned short vsyncend, - unsigned short vblankend, unsigned short vtotal, unsigned long frequency) + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) #else int gfx_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblankstart, - unsigned short hsyncstart, unsigned short hsyncend, - unsigned short hblankend, unsigned short htotal, - unsigned short vactive, unsigned short vblankstart, - unsigned short vsyncstart, unsigned short vsyncend, - unsigned short vblankend, unsigned short vtotal, unsigned long frequency) + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) #endif { /* SET MODE STRUCTURE WITH SPECIFIED VALUES */ @@ -531,13 +532,15 @@ gfx_set_vtotal(unsigned short vtotal) vblank = READ_REG32(MDC_V_BLANK_TIMING); /* DISABLE TIMING REGISTER UPDATES */ - WRITE_REG32(MDC_DISPLAY_CFG, dcfg & ~(unsigned long)MDC_DCFG_TRUP); + WRITE_REG32(MDC_DISPLAY_CFG, dcfg & ~(unsigned long) MDC_DCFG_TRUP); /* WRITE NEW TIMING VALUES */ WRITE_REG32(MDC_V_ACTIVE_TIMING, - (vactive & MDC_VAT_VA_MASK) | (unsigned long)(vtotal - 1) << 16); + (vactive & MDC_VAT_VA_MASK) | (unsigned long) (vtotal - + 1) << 16); WRITE_REG32(MDC_V_BLANK_TIMING, - (vblank & MDC_VBT_VBS_MASK) | (unsigned long)(vtotal - 1) << 16); + (vblank & MDC_VBT_VBS_MASK) | (unsigned long) (vtotal - + 1) << 16); /* RESTORE OLD RC VALUES */ WRITE_REG32(MDC_DISPLAY_CFG, dcfg); @@ -579,9 +582,9 @@ gfx_set_display_pitch(unsigned short pitch) value = READ_REG32(MDC_GENERAL_CFG); if (pitch == 1024 || pitch == 2048 || pitch == 4096 || pitch == 8192) - value &= ~(unsigned long)(MDC_GCFG_FDTY); + value &= ~(unsigned long) (MDC_GCFG_FDTY); else - value |= (unsigned long)(MDC_GCFG_FDTY); + value |= (unsigned long) (MDC_GCFG_FDTY); WRITE_REG32(MDC_GENERAL_CFG, value); WRITE_REG32(MDC_UNLOCK, lock); @@ -622,7 +625,8 @@ gfx_set_display_offset(unsigned long offset) gfx_wait_vertical_blank(); gu2_enable_compression(); } - } else { + } + else { /* ONLY DISABLE COMPRESSION ONCE */ if (gfx_compression_active) gu2_disable_compression(); @@ -766,19 +770,19 @@ gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) #if GFX_DISPLAY_DYNAMIC void gu2_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot) + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) #else void gfx_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot) + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) #endif { unsigned long unlock; - short x = (short)xpos - (short)xhotspot; - short y = (short)ypos - (short)yhotspot; + short x = (short) xpos - (short) xhotspot; + short y = (short) ypos - (short) yhotspot; short xoffset = 0; short yoffset = 0; @@ -790,8 +794,8 @@ gfx_set_cursor_position(unsigned long memoffset, if (PanelEnable) { if ((ModeWidth > PanelWidth) || (ModeHeight > PanelHeight)) { gfx_enable_panning(xpos, ypos); - x = x - (unsigned short)panelLeft; - y = y - (unsigned short)panelTop; + x = x - (unsigned short) panelLeft; + y = y - (unsigned short) panelTop; } } @@ -809,16 +813,16 @@ gfx_set_cursor_position(unsigned long memoffset, yoffset = -y; y = 0; } - memoffset += (unsigned long)yoffset << 4; + memoffset += (unsigned long) yoffset << 4; /* SET CURSOR POSITION */ unlock = READ_REG32(MDC_UNLOCK); WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); WRITE_REG32(MDC_CURS_ST_OFFSET, memoffset); - WRITE_REG32(MDC_CURSOR_X, (unsigned long)x | - (((unsigned long)xoffset) << 11)); - WRITE_REG32(MDC_CURSOR_Y, (unsigned long)y | - (((unsigned long)yoffset) << 11)); + WRITE_REG32(MDC_CURSOR_X, (unsigned long) x | + (((unsigned long) xoffset) << 11)); + WRITE_REG32(MDC_CURSOR_Y, (unsigned long) y | + (((unsigned long) yoffset) << 11)); WRITE_REG32(MDC_UNLOCK, unlock); } @@ -834,11 +838,11 @@ gfx_set_cursor_position(unsigned long memoffset, #if GFX_DISPLAY_DYNAMIC void gu2_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) #else void gfx_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) #endif { int i; @@ -876,11 +880,11 @@ gfx_set_cursor_shape32(unsigned long memoffset, #if GFX_DISPLAY_DYNAMIC void gu2_set_cursor_shape64(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) #else void gfx_set_cursor_shape64(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) #endif { int i; @@ -943,11 +947,11 @@ gfx_set_icon_enable(int enable) #if GFX_DISPLAY_DYNAMIC void gu2_set_icon_colors(unsigned long color0, unsigned long color1, - unsigned long color2) + unsigned long color2) #else void gfx_set_icon_colors(unsigned long color0, unsigned long color1, - unsigned long color2) + unsigned long color2) #endif { /* ICON COLORS LOCATED AT PALETTE INDEXES 102-104h */ @@ -981,7 +985,7 @@ gfx_set_icon_position(unsigned long memoffset, unsigned short xpos) WRITE_REG32(MDC_ICON_ST_OFFSET, memoffset & 0x0FFFFFFF); /* PROGRAM THE XCOORDINATE */ - WRITE_REG32(MDC_ICON_X, (unsigned long)(xpos & 0x07FF)); + WRITE_REG32(MDC_ICON_X, (unsigned long) (xpos & 0x07FF)); WRITE_REG32(MDC_UNLOCK, lock); } @@ -995,11 +999,11 @@ gfx_set_icon_position(unsigned long memoffset, unsigned short xpos) #if GFX_DISPLAY_DYNAMIC void gu2_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, - unsigned long *xormask, unsigned int lines) + unsigned long *xormask, unsigned int lines) #else void gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, - unsigned long *xormask, unsigned int lines) + unsigned long *xormask, unsigned int lines) #endif { unsigned short i, height; @@ -1160,7 +1164,7 @@ gfx_set_compression_pitch(unsigned short pitch) /* SET REGISTER VALUE */ line_delta = READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF; - line_delta |= (((unsigned long)pitch << 13) & 0xFFFF0000); + line_delta |= (((unsigned long) pitch << 13) & 0xFFFF0000); WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); WRITE_REG32(MDC_GFX_PITCH, line_delta); WRITE_REG32(MDC_UNLOCK, lock); @@ -1196,7 +1200,7 @@ gfx_set_compression_size(unsigned short size) lock = READ_REG32(MDC_UNLOCK); buf_size = READ_REG32(MDC_LINE_SIZE) & 0xFF80FFFF; - buf_size |= ((((unsigned long)size >> 3) + 1) & 0x7F) << 16; + buf_size |= ((((unsigned long) size >> 3) + 1) & 0x7F) << 16; WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); WRITE_REG32(MDC_LINE_SIZE, buf_size); WRITE_REG32(MDC_UNLOCK, lock); @@ -1307,14 +1311,15 @@ gfx_set_display_video_size(unsigned short width, unsigned short height) if (yuv_420) { width >>= 1; width = (width + 7) & 0xFFF8; - } else { + } + else { width <<= 1; width = (width + 31) & 0xFFE0; } /* ONLY THE LINE SIZE IS PROGRAMMED IN THE DISPLAY CONTROLLER */ - value |= ((unsigned long)width << 21); + value |= ((unsigned long) width << 21); /* WRITE THE REGISTER */ @@ -1357,11 +1362,11 @@ gfx_set_display_video_offset(unsigned long offset) #if GFX_DISPLAY_DYNAMIC void gu2_set_display_video_yuv_offsets(unsigned long yoffset, - unsigned long uoffset, unsigned long voffset) + unsigned long uoffset, unsigned long voffset) #else void gfx_set_display_video_yuv_offsets(unsigned long yoffset, - unsigned long uoffset, unsigned long voffset) + unsigned long uoffset, unsigned long voffset) #endif { unsigned long lock; @@ -1431,7 +1436,7 @@ gfx_set_display_video_downscale(unsigned short srch, unsigned short dsth) if (dsth > srch || dsth <= (srch >> 1)) delta = 0; else - delta = (((unsigned long)srch << 14) / (unsigned long)dsth) << 18; + delta = (((unsigned long) srch << 14) / (unsigned long) dsth) << 18; WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); WRITE_REG32(MDC_VID_DS_DELTA, delta); @@ -1518,8 +1523,8 @@ gfx_wait_vertical_blank(void) #endif { if (gfx_test_timing_active()) { - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); } return (0); } @@ -1549,8 +1554,8 @@ gfx_enable_panning(int x, int y) /* TEST FOR NO-WORK */ - if (x >= DeltaX && x < ((int)PanelWidth + DeltaX) && - y >= DeltaY && y < ((int)PanelHeight + DeltaY)) + if (x >= DeltaX && x < ((int) PanelWidth + DeltaX) && + y >= DeltaY && y < ((int) PanelHeight + DeltaY)) return; /* ADJUST PANNING VARIABLES WHEN CURSOR EXCEEDS BOUNDARY */ @@ -1560,14 +1565,14 @@ gfx_enable_panning(int x, int y) if (x < DeltaX) DeltaX = x; - else if (x >= (DeltaX + (int)PanelWidth)) - DeltaX = x - (int)PanelWidth + 1; + else if (x >= (DeltaX + (int) PanelWidth)) + DeltaX = x - (int) PanelWidth + 1; if (y < DeltaY) DeltaY = y; - else if (y >= (DeltaY + (int)PanelHeight)) - DeltaY = y - (int)PanelHeight + 1; + else if (y >= (DeltaY + (int) PanelHeight)) + DeltaY = y - (int) PanelHeight + 1; /* CALCULATE THE START OFFSET */ @@ -1596,11 +1601,13 @@ gfx_enable_panning(int x, int y) #if GFX_DISPLAY_DYNAMIC int gu2_is_panel_mode_supported(int panelResX, int panelResY, - unsigned short width, unsigned short height, unsigned short bpp) + unsigned short width, unsigned short height, + unsigned short bpp) #else int gfx_is_panel_mode_supported(int panelResX, int panelResY, - unsigned short width, unsigned short height, unsigned short bpp) + unsigned short width, unsigned short height, + unsigned short bpp) #endif { unsigned int mode; @@ -1611,7 +1618,7 @@ gfx_is_panel_mode_supported(int panelResX, int panelResY, (FixedParams[mode].yres == height) && (FixedParams[mode].panelresx == panelResX) && (FixedParams[mode].panelresy == panelResY)) { - return ((int)mode); + return ((int) mode); } } @@ -1626,19 +1633,19 @@ gfx_is_panel_mode_supported(int panelResX, int panelResY, #if GFX_DISPLAY_DYNAMIC int gu2_set_fixed_timings(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #else int gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #endif { unsigned int mode; ModeWidth = width; ModeHeight = height; - PanelWidth = (unsigned short)panelResX; - PanelHeight = (unsigned short)panelResY; + PanelWidth = (unsigned short) panelResX; + PanelHeight = (unsigned short) panelResY; PanelEnable = 1; /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ @@ -1652,14 +1659,16 @@ gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, FIXEDTIMINGS *fmode = &FixedParams[mode]; gfx_set_display_timings(bpp, 3, fmode->hactive, - fmode->hblankstart, fmode->hsyncstart, fmode->hsyncend, - fmode->hblankend, fmode->htotal, fmode->vactive, - fmode->vblankstart, fmode->vsyncstart, fmode->vsyncend, - fmode->vblankend, fmode->vtotal, fmode->frequency); + fmode->hblankstart, fmode->hsyncstart, + fmode->hsyncend, fmode->hblankend, + fmode->htotal, fmode->vactive, + fmode->vblankstart, fmode->vsyncstart, + fmode->vsyncend, fmode->vblankend, + fmode->vtotal, fmode->frequency); return (1); - } /* end if() */ - } /* end for() */ + } /* end if() */ + } /* end for() */ return (-1); } @@ -1671,11 +1680,11 @@ gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, #if GFX_DISPLAY_DYNAMIC int gu2_set_panel_present(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #else int gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) #endif { /* SET VALID BPP */ @@ -1693,8 +1702,8 @@ gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, ModeWidth = width; ModeHeight = height; - PanelWidth = (unsigned short)panelResX; - PanelHeight = (unsigned short)panelResY; + PanelWidth = (unsigned short) panelResX; + PanelHeight = (unsigned short) panelResY; PanelEnable = 1; gbpp = bpp; @@ -1721,7 +1730,7 @@ unsigned short gfx_get_display_pitch(void) #endif { - return ((unsigned short)(READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF) << 3); + return ((unsigned short) (READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF) << 3); } /*---------------------------------------------------------------------------- @@ -1736,11 +1745,11 @@ gfx_get_display_pitch(void) #if GFX_DISPLAY_DYNAMIC int gu2_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency) + unsigned long frequency) #else int gfx_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency) + unsigned long frequency) #endif { unsigned int index; @@ -1750,8 +1759,8 @@ gfx_mode_frequency_supported(int xres, int yres, int bpp, gfx_mode_bpp_conversion_def(bpp) for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { - if ((DisplayParams[index].hactive == (unsigned int)xres) && - (DisplayParams[index].vactive == (unsigned int)yres) && + if ((DisplayParams[index].hactive == (unsigned int) xres) && + (DisplayParams[index].vactive == (unsigned int) yres) && (DisplayParams[index].flags & bpp_flag) && (DisplayParams[index].frequency == frequency)) { int hz = 0; @@ -1790,11 +1799,11 @@ gfx_mode_frequency_supported(int xres, int yres, int bpp, #if GFX_DISPLAY_DYNAMIC int gu2_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #else int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #endif { unsigned int index, closematch = 0; @@ -1810,10 +1819,10 @@ gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, /* Search the table for the closest frequency (16.16 format). */ min = 0x7fffffff; for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { - if ((DisplayParams[index].htotal == (unsigned int)xres) && - (DisplayParams[index].vtotal == (unsigned int)yres) && + if ((DisplayParams[index].htotal == (unsigned int) xres) && + (DisplayParams[index].vtotal == (unsigned int) yres) && (DisplayParams[index].flags & bpp_flag)) { - diff = (long)frequency - (long)DisplayParams[index].frequency; + diff = (long) frequency - (long) DisplayParams[index].frequency; if (diff < 0) diff = -diff; @@ -1857,11 +1866,11 @@ gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, #if GFX_DISPLAY_DYNAMIC int gu2_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #else int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) #endif { unsigned int index, closematch = 0; @@ -1877,10 +1886,10 @@ gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, /* Search the table for the closest frequency (16.16 format). */ min = 0x7fffffff; for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { - if ((DisplayParams[index].hactive == (unsigned int)xres) && - (DisplayParams[index].vactive == (unsigned int)yres) && + if ((DisplayParams[index].hactive == (unsigned int) xres) && + (DisplayParams[index].vactive == (unsigned int) yres) && (DisplayParams[index].flags & bpp_flag)) { - diff = (long)frequency - (long)DisplayParams[index].frequency; + diff = (long) frequency - (long) DisplayParams[index].frequency; if (diff < 0) diff = -diff; @@ -1922,11 +1931,11 @@ gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, #if GFX_DISPLAY_DYNAMIC int gu2_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, - int *frequency) + int *frequency) #else int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, - int *frequency) + int *frequency) #endif { unsigned int index; @@ -1940,9 +1949,9 @@ gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ /* Search the table for the closest frequency (16.16 format). */ - for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { - if ((DisplayParams[index].hactive == (unsigned short)xres) && - (DisplayParams[index].vactive == (unsigned short)yres) && + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short) xres) && + (DisplayParams[index].vactive == (unsigned short) yres) && (DisplayParams[index].flags & bpp_flag) && (DisplayParams[index].flags & hz_flag)) { *frequency = DisplayParams[index].frequency; @@ -1999,8 +2008,8 @@ gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) gfx_mode_bpp_conversion_def(*bpp) for (mode = 0; mode < NUM_RC_DISPLAY_MODES; mode++) { - if ((DisplayParams[mode].hactive == (unsigned int)*xres) && - (DisplayParams[mode].vactive == (unsigned int)*yres) && + if ((DisplayParams[mode].hactive == (unsigned int) *xres) && + (DisplayParams[mode].vactive == (unsigned int) *yres) && (DisplayParams[mode].frequency == pll_freq) && (DisplayParams[mode].flags & bpp_flag)) { @@ -2122,7 +2131,7 @@ unsigned short gfx_get_hactive(void) #endif { - return ((unsigned short)((READ_REG32(MDC_H_ACTIVE_TIMING) & 0x0FF8) + 8)); + return ((unsigned short) ((READ_REG32(MDC_H_ACTIVE_TIMING) & 0x0FF8) + 8)); } /*--------------------------------------------------------------------------- @@ -2137,7 +2146,7 @@ unsigned short gfx_get_hsync_start(void) #endif { - return ((unsigned short)((READ_REG32(MDC_H_SYNC_TIMING) & 0x0FF8) + 8)); + return ((unsigned short) ((READ_REG32(MDC_H_SYNC_TIMING) & 0x0FF8) + 8)); } /*--------------------------------------------------------------------------- @@ -2152,8 +2161,8 @@ unsigned short gfx_get_hsync_end(void) #endif { - return ((unsigned short)(((READ_REG32(MDC_H_SYNC_TIMING) >> 16) & 0x0FF8) - + 8)); + return ((unsigned short) (((READ_REG32(MDC_H_SYNC_TIMING) >> 16) & 0x0FF8) + + 8)); } /*--------------------------------------------------------------------------- @@ -2168,8 +2177,8 @@ unsigned short gfx_get_htotal(void) #endif { - return ((unsigned short)(((READ_REG32(MDC_H_ACTIVE_TIMING) >> 16) & - 0x0FF8) + 8)); + return ((unsigned short) (((READ_REG32(MDC_H_ACTIVE_TIMING) >> 16) & + 0x0FF8) + 8)); } /*--------------------------------------------------------------------------- @@ -2184,7 +2193,7 @@ unsigned short gfx_get_vactive(void) #endif { - return ((unsigned short)((READ_REG32(MDC_V_ACTIVE_TIMING) & 0x07FF) + 1)); + return ((unsigned short) ((READ_REG32(MDC_V_ACTIVE_TIMING) & 0x07FF) + 1)); } /*--------------------------------------------------------------------------- @@ -2199,8 +2208,8 @@ unsigned short gfx_get_vsync_end(void) #endif { - return ((unsigned short)(((READ_REG32(MDC_V_SYNC_TIMING) >> 16) & 0x07FF) - + 1)); + return ((unsigned short) (((READ_REG32(MDC_V_SYNC_TIMING) >> 16) & 0x07FF) + + 1)); } /*--------------------------------------------------------------------------- @@ -2215,8 +2224,8 @@ unsigned short gfx_get_vtotal(void) #endif { - return ((unsigned short)(((READ_REG32(MDC_V_ACTIVE_TIMING) >> 16) & - 0x07FF) + 1)); + return ((unsigned short) (((READ_REG32(MDC_V_ACTIVE_TIMING) >> 16) & + 0x07FF) + 1)); } /*---------------------------------------------------------------------------- @@ -2275,11 +2284,11 @@ gfx_get_vline(void) * transitioning */ do current_scan_line = - (unsigned short)(READ_REG32(MDC_LINE_CNT_STATUS) & - MDC_LNCNT_V_LINE_CNT); + (unsigned short) (READ_REG32(MDC_LINE_CNT_STATUS) & + MDC_LNCNT_V_LINE_CNT); while (current_scan_line != - (unsigned short)(READ_REG32(MDC_LINE_CNT_STATUS) & - MDC_LNCNT_V_LINE_CNT)); + (unsigned short) (READ_REG32(MDC_LINE_CNT_STATUS) & + MDC_LNCNT_V_LINE_CNT)); return (current_scan_line >> 16); } @@ -2332,7 +2341,7 @@ unsigned short gfx_get_hblank_start(void) #endif { - return ((unsigned short)((READ_REG32(MDC_H_BLANK_TIMING) & 0x0FF8) + 8)); + return ((unsigned short) ((READ_REG32(MDC_H_BLANK_TIMING) & 0x0FF8) + 8)); } /*--------------------------------------------------------------------------- @@ -2347,8 +2356,8 @@ unsigned short gfx_get_hblank_end(void) #endif { - return ((unsigned short)(((READ_REG32(MDC_H_BLANK_TIMING) >> 16) & 0x0FF8) - + 8)); + return ((unsigned short) (((READ_REG32(MDC_H_BLANK_TIMING) >> 16) & 0x0FF8) + + 8)); } /*--------------------------------------------------------------------------- @@ -2363,7 +2372,7 @@ unsigned short gfx_get_vblank_start(void) #endif { - return ((unsigned short)((READ_REG32(MDC_V_BLANK_TIMING) & 0x07FF) + 1)); + return ((unsigned short) ((READ_REG32(MDC_V_BLANK_TIMING) & 0x07FF) + 1)); } /*--------------------------------------------------------------------------- @@ -2378,7 +2387,7 @@ unsigned short gfx_get_vsync_start(void) #endif { - return ((unsigned short)((READ_REG32(MDC_V_SYNC_TIMING) & 0x07FF) + 1)); + return ((unsigned short) ((READ_REG32(MDC_V_SYNC_TIMING) & 0x07FF) + 1)); } /*--------------------------------------------------------------------------- @@ -2393,8 +2402,8 @@ unsigned short gfx_get_vblank_end(void) #endif { - return ((unsigned short)(((READ_REG32(MDC_V_BLANK_TIMING) >> 16) & 0x07FF) - + 1)); + return ((unsigned short) (((READ_REG32(MDC_V_BLANK_TIMING) >> 16) & 0x07FF) + + 1)); } /*---------------------------------------------------------------------------- @@ -2466,7 +2475,7 @@ gfx_get_cursor_position(void) #endif { return ((READ_REG32(MDC_CURSOR_X) & 0x07FF) | - ((READ_REG32(MDC_CURSOR_Y) << 16) & 0x07FF0000)); + ((READ_REG32(MDC_CURSOR_Y) << 16) & 0x07FF0000)); } /*---------------------------------------------------------------------------- @@ -2482,7 +2491,7 @@ gfx_get_cursor_clip(void) #endif { return (((READ_REG32(MDC_CURSOR_X) >> 11) & 0x03F) | - ((READ_REG32(MDC_CURSOR_Y) << 5) & 0x3F0000)); + ((READ_REG32(MDC_CURSOR_Y) << 5) & 0x3F0000)); } /*---------------------------------------------------------------------------- @@ -2499,7 +2508,8 @@ gfx_get_cursor_color(int color) { if (color) { WRITE_REG32(MDC_PAL_ADDRESS, 0x101); - } else { + } + else { WRITE_REG32(MDC_PAL_ADDRESS, 0x100); } return READ_REG32(MDC_PAL_DATA); @@ -2617,7 +2627,7 @@ gfx_get_compression_pitch(void) { unsigned short pitch; - pitch = (unsigned short)(READ_REG32(MDC_GFX_PITCH) >> 16); + pitch = (unsigned short) (READ_REG32(MDC_GFX_PITCH) >> 16); return (pitch << 3); } @@ -2635,7 +2645,7 @@ gfx_get_compression_size(void) { unsigned short size; - size = (unsigned short)((READ_REG32(MDC_LINE_SIZE) >> 16) & 0x7F) - 1; + size = (unsigned short) ((READ_REG32(MDC_LINE_SIZE) >> 16) & 0x7F) - 1; return ((size << 3) + 32); } @@ -2658,7 +2668,7 @@ gfx_get_valid_bit(int line) offset |= line; WRITE_REG32(MDC_PHY_MEM_OFFSET, offset); - valid = (int)READ_REG32(MDC_DV_ACC) & 2; + valid = (int) READ_REG32(MDC_DV_ACC) & 2; if (valid) return 1; @@ -2693,11 +2703,13 @@ gfx_get_display_video_offset(void) #if GFX_DISPLAY_DYNAMIC void gu2_get_display_video_yuv_offsets(unsigned long *yoffset, - unsigned long *uoffset, unsigned long *voffset) + unsigned long *uoffset, + unsigned long *voffset) #else void gfx_get_display_video_yuv_offsets(unsigned long *yoffset, - unsigned long *uoffset, unsigned long *voffset) + unsigned long *uoffset, + unsigned long *voffset) #endif { *yoffset = (READ_REG32(MDC_VID_Y_ST_OFFSET) & 0x0FFFFFFF); @@ -2760,7 +2772,7 @@ int gfx_get_display_video_downscale_enable(void) #endif { - return ((int)((READ_REG32(MDC_GENERAL_CFG) >> 19) & 1)); + return ((int) ((READ_REG32(MDC_GENERAL_CFG) >> 19) & 1)); } /*--------------------------------------------------------------------------- @@ -2783,6 +2795,6 @@ gfx_get_display_video_size(void) return ((READ_REG32(MDC_LINE_SIZE) >> 21) & 0x000007FF); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ /* END OF FILE */ diff --git a/src/gfx/gfx_dcdr.c b/src/gfx/gfx_dcdr.c index 57abe37..40a4b47 100644 --- a/src/gfx/gfx_dcdr.c +++ b/src/gfx/gfx_dcdr.c @@ -219,7 +219,7 @@ gfx_set_decoder_output_size(unsigned short width, unsigned short height) */ int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) { int status = GFX_STATUS_UNSUPPORTED; @@ -409,7 +409,7 @@ gfx_get_decoder_hue(void) if (gfx_decoder_type == GFX_DECODER_SAA7114) hue = saa7114_get_decoder_hue(); #endif - return ((char)hue); + return ((char) hue); } /*---------------------------------------------------------------------------- @@ -492,8 +492,8 @@ gfx_get_decoder_vbi_format(int line) return (format); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ -#endif /* GFX_DECODER_DYNAMIC */ +#endif /* GFX_DECODER_DYNAMIC */ /* END OF FILE */ diff --git a/src/gfx/gfx_defs.h b/src/gfx/gfx_defs.h index dde8385..045128c 100644 --- a/src/gfx/gfx_defs.h +++ b/src/gfx/gfx_defs.h @@ -112,9 +112,9 @@ /* ACCESS TO MSRS */ void gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, - unsigned long *ptrHigh, unsigned long *ptrLow); + unsigned long *ptrHigh, unsigned long *ptrLow); void gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, - unsigned long *ptrHigh, unsigned long *ptrLow); + unsigned long *ptrHigh, unsigned long *ptrLow); #define MSR_READ( MBD_MSR_CAP, address, valueHigh_ptr, valueLow_ptr ) \ gfx_msr_asm_read( ((unsigned short)(MBD_MSR_CAP)), address, \ diff --git a/src/gfx/gfx_disp.c b/src/gfx/gfx_disp.c index a1cd78f..62238b2 100644 --- a/src/gfx/gfx_disp.c +++ b/src/gfx/gfx_disp.c @@ -117,513 +117,513 @@ DISPLAYMODE DisplayParams[] = { /* 320 x 200 */ { - GFX_MODE_70HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ - GFX_MODE_NEG_HSYNC | /* negative HSYNC */ - GFX_MODE_PIXEL_DOUBLE | /* Double width */ - GFX_MODE_LINE_DOUBLE, /* Double height */ - 0x140, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ - 0x0C8, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ - 0x00192CCC, /* freq = 25.175 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_NEG_HSYNC | /* negative HSYNC */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x140, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ + 0x0C8, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, /* 320 x 240 */ { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ - GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC | /* negative syncs */ - GFX_MODE_PIXEL_DOUBLE | /* Double width */ - GFX_MODE_LINE_DOUBLE, /* Double height */ - 0x0140, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, - /* horizontal timings */ - 0x00F0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, - /* vertical timings */ - 0x001F8000, /* freq = 31.5 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC | /* negative syncs */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0140, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, + /* horizontal timings */ + 0x00F0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, + /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, /* 400 x 300 */ { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ - GFX_MODE_PIXEL_DOUBLE | /* Double width */ - GFX_MODE_LINE_DOUBLE, /* Double height */ - 0x0190, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, - /* horizontal timings */ - 0x012C, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, - /* vertical timings */ - 0x00318000, /* freq = 49.5 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0190, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, + /* horizontal timings */ + 0x012C, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, + /* vertical timings */ + 0x00318000, /* freq = 49.5 MHz */ + }, /* 512 x 384 */ { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ - GFX_MODE_PIXEL_DOUBLE | /* Double width */ - GFX_MODE_LINE_DOUBLE, /* Double height */ - 0x0200, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, - /* horizontal timings */ - 0x0180, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, - /* vertical timings */ - 0x004EC000, /* freq = 78.75 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0200, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, + /* horizontal timings */ + 0x0180, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, + /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, /* 640 x 400 */ { - GFX_MODE_70HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC, - /* negative HSYNC */ - 0x280, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ - 0x190, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ - 0x00192CCC, /* freq = 25.175 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC, + /* negative HSYNC */ + 0x280, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ + 0x190, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, /* 640x480 */ { - GFX_MODE_60HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ - 0x0280, 0x0288, 0x0290, 0x02E8, 0x0318, 0x0320, - /* horizontal timings */ - 0x01E0, 0x01E8, 0x01EA, 0x01EC, 0x0205, 0x020D, - /* vertical timings */ - 0x00192CCC, /* freq = 25.175 MHz */ - }, + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0288, 0x0290, 0x02E8, 0x0318, 0x0320, + /* horizontal timings */ + 0x01E0, 0x01E8, 0x01EA, 0x01EC, 0x0205, 0x020D, + /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, { - GFX_MODE_70HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0280, 0x0280, 0x0298, 0x02D8, 0x0330, 0x0330, - /* horizontal timings */ - 0x01E0, 0x01E0, 0x01E2, 0x01E5, 0x01F4, 0x01F4, - /* vertical timings */ - 0x001C8F5C, /* freq = 28.560 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0280, 0x0280, 0x0298, 0x02D8, 0x0330, 0x0330, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E2, 0x01E5, 0x01F4, 0x01F4, + /* vertical timings */ + 0x001C8F5C, /* freq = 28.560 MHz */ + }, { - GFX_MODE_72HZ | /* refresh rate = 72 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ - 0x0280, 0x0288, 0x0298, 0x02c0, 0x0338, 0x0340, - /* horizontal timings */ - 0x01e0, 0x01e8, 0x01e9, 0x01ec, 0x0200, 0x0208, - /* vertical timings */ - 0x001F8000, /* freq = 31.5 MHz */ - }, + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0288, 0x0298, 0x02c0, 0x0338, 0x0340, + /* horizontal timings */ + 0x01e0, 0x01e8, 0x01e9, 0x01ec, 0x0200, 0x0208, + /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ - 0x0280, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, - /* horizontal timings */ - 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, - /* vertical timings */ - 0x001F8000, /* freq = 31.5 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, + /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, { - GFX_MODE_85HZ | /* refresh rate = 85 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ - 0x0280, 0x0280, 0x02B8, 0x02F0, 0x0340, 0x0340, - /* horizontal timings */ - 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, - /* vertical timings */ - 0x00240000, /* freq = 36.0 MHz */ - }, + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0280, 0x02B8, 0x02F0, 0x0340, 0x0340, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, + /* vertical timings */ + 0x00240000, /* freq = 36.0 MHz */ + }, { - GFX_MODE_90HZ | /* refresh rate = 90 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0280, 0x0280, 0x02A0, 0x02E0, 0x0340, 0x0340, - /* horizontal timings */ - 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FA, 0x01FA, - /* vertical timings */ - 0x0025E395, /* freq = 37.889 MHz */ - }, + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0280, 0x0280, 0x02A0, 0x02E0, 0x0340, 0x0340, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FA, 0x01FA, + /* vertical timings */ + 0x0025E395, /* freq = 37.889 MHz */ + }, { - GFX_MODE_100HZ | /* refresh rate = 100 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0280, 0x0280, 0x02A8, 0x02E8, 0x0350, 0x0350, - /* horizontal timings */ - 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, - /* vertical timings */ - 0x002B29BA, /* freq = 43.163 MHz */ - }, + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0280, 0x0280, 0x02A8, 0x02E8, 0x0350, 0x0350, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, + /* vertical timings */ + 0x002B29BA, /* freq = 43.163 MHz */ + }, /* 800x600 */ { - GFX_MODE_56HZ | /* refresh rate = 56 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0320, 0x0338, 0x0380, 0x0400, 0x0400, - /* horizontal timings */ - 0x0258, 0x0258, 0x0259, 0x025B, 0x0271, 0x0271, - /* vertical timings */ - 0x00240000, /* freq = 36.00 MHz */ - }, + GFX_MODE_56HZ | /* refresh rate = 56 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0338, 0x0380, 0x0400, 0x0400, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025B, 0x0271, 0x0271, + /* vertical timings */ + 0x00240000, /* freq = 36.00 MHz */ + }, { - GFX_MODE_60HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420, - /* horizontal timings */ - 0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274, - /* vertical timings */ - 0x00280000, /* freq = 40.00 MHz */ - }, + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274, + /* vertical timings */ + 0x00280000, /* freq = 40.00 MHz */ + }, { - GFX_MODE_70HZ | /* refresh rate = 70 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0320, 0x0348, 0x0398, 0x0410, 0x0410, - /* horizontal timings */ - 0x0258, 0x0258, 0x025c, 0x025F, 0x0274, 0x0274, - /* vertical timings */ - 0x002DB851, /* freq = 45.72 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0348, 0x0398, 0x0410, 0x0410, + /* horizontal timings */ + 0x0258, 0x0258, 0x025c, 0x025F, 0x0274, 0x0274, + /* vertical timings */ + 0x002DB851, /* freq = 45.72 MHz */ + }, { - GFX_MODE_72HZ | /* refresh rate = 72 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0320, 0x0358, 0x03D0, 0x0410, 0x0410, - /* horizontal timings */ - 0x0258, 0x0258, 0x027D, 0x0283, 0x029A, 0x029A, - /* vertical timings */ - 0x00320000, /* freq = 49.5 MHz */ - }, + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0358, 0x03D0, 0x0410, 0x0410, + /* horizontal timings */ + 0x0258, 0x0258, 0x027D, 0x0283, 0x029A, 0x029A, + /* vertical timings */ + 0x00320000, /* freq = 49.5 MHz */ + }, { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, - /* horizontal timings */ - 0x0258, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, - /* vertical timings */ - 0x00318000, /* freq = 49.5 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, + /* vertical timings */ + 0x00318000, /* freq = 49.5 MHz */ + }, { - GFX_MODE_85HZ | /* refresh rate = 85 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0320, 0x0340, 0x0380, 0x0418, 0x0418, - /* horizontal timings */ - 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x0277, - /* vertical timings */ - 0x00384000, /* freq = 56.25 MHz */ - }, + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0340, 0x0380, 0x0418, 0x0418, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x0277, + /* vertical timings */ + 0x00384000, /* freq = 56.25 MHz */ + }, { - GFX_MODE_90HZ | /* refresh rate = 90 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0320, 0x0348, 0x03A0, 0x0420, 0x0420, - /* horizontal timings */ - 0x0258, 0x0258, 0x0259, 0x025C, 0x0278, 0x0278, - /* vertical timings */ - 0x003C10A3, /* freq = 60.065 MHz */ - }, + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0348, 0x03A0, 0x0420, 0x0420, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0278, 0x0278, + /* vertical timings */ + 0x003C10A3, /* freq = 60.065 MHz */ + }, { - GFX_MODE_100HZ | /* refresh rate = 100 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0320, 0x0320, 0x0350, 0x03A8, 0x0430, 0x0430, - /* horizontal timings */ - 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x027C, - /* vertical timings */ - 0x00442DD2, /* freq = 68.179 MHz */ - }, + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0350, 0x03A8, 0x0430, 0x0430, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x027C, + /* vertical timings */ + 0x00442DD2, /* freq = 68.179 MHz */ + }, /* 1024x768 */ { - GFX_MODE_60HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ - 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, - /* horizontal timings */ - 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, - /* vertical timings */ - 0x00410000, /* freq = 65.00 MHz */ - }, + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + /* horizontal timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + /* vertical timings */ + 0x00410000, /* freq = 65.00 MHz */ + }, { - GFX_MODE_70HZ | /* refresh rate = 70 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ - 0x0400, 0x0400, 0x0418, 0x04A0, 0x0530, 0x0530, - /* horizontal timings */ - 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, - /* vertical timings */ - 0x004B0000, /* freq = 75.00 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0530, 0x0530, + /* horizontal timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + /* vertical timings */ + 0x004B0000, /* freq = 75.00 MHz */ + }, { - GFX_MODE_72HZ | /* refresh rate = 72 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0400, 0x0400, 0x0438, 0x04A8, 0x0550, 0x0550, - /* horizontal timings */ - 0x0300, 0x0300, 0x0304, 0x0307, 0x0324, 0x0324, - /* vertical timings */ - 0x004EC000, /* freq = 78.75 MHz */ - }, + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0438, 0x04A8, 0x0550, 0x0550, + /* horizontal timings */ + 0x0300, 0x0300, 0x0304, 0x0307, 0x0324, 0x0324, + /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0400, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, - /* horizontal timings */ - 0x0300, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, - /* vertical timings */ - 0x004EC000, /* freq = 78.75 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, + /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, { - GFX_MODE_85HZ | /* refresh rate = 85 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0400, 0x0400, 0x0430, 0x0490, 0x0560, 0x0560, - /* horizontal timings */ - 0x0300, 0x0300, 0x0301, 0x0304, 0x0328, 0x0328, - /* vertical timings */ - 0x005E8000, /* freq = 94.50 MHz */ - }, + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0430, 0x0490, 0x0560, 0x0560, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0328, 0x0328, + /* vertical timings */ + 0x005E8000, /* freq = 94.50 MHz */ + }, { - GFX_MODE_90HZ | /* refresh rate = 90 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0400, 0x0400, 0x0440, 0x04B0, 0x0560, 0x0560, - /* horizontal timings */ - 0x0300, 0x0300, 0x0301, 0x0304, 0x0329, 0x0329, - /* vertical timings */ - 0x00642FDF, /* freq = 100.187 MHz */ - }, + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0440, 0x04B0, 0x0560, 0x0560, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0329, 0x0329, + /* vertical timings */ + 0x00642FDF, /* freq = 100.187 MHz */ + }, { - GFX_MODE_100HZ | /* refresh rate = 100 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0400, 0x0400, 0x0448, 0x04B8, 0x0570, 0x0570, - /* horizontal timings */ - 0x0300, 0x0300, 0x0301, 0x0304, 0x032E, 0x032E, - /* vertical timings */ - 0x00714F1A, /* freq = 113.309 MHz */ - }, + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0448, 0x04B8, 0x0570, 0x0570, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x032E, 0x032E, + /* vertical timings */ + 0x00714F1A, /* freq = 113.309 MHz */ + }, /* 1152x864 */ { - GFX_MODE_60HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0480, 0x0480, 0x04C0, 0x0538, 0x05F0, 0x05F0, - /* horizontal timings */ - 0x0360, 0x0360, 0x0361, 0x0364, 0x037F, 0x037F, - /* vertical timings */ - 0x00519999, /* freq = 81.60 MHz */ - }, + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C0, 0x0538, 0x05F0, 0x05F0, + /* horizontal timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x037F, 0x037F, + /* vertical timings */ + 0x00519999, /* freq = 81.60 MHz */ + }, { - GFX_MODE_70HZ | /* refresh rate = 70 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0480, 0x0480, 0x04C8, 0x0540, 0x0600, 0x0600, - /* horizontal timings */ - 0x0360, 0x0360, 0x0368, 0x036B, 0x038B, 0x038B, - /* vertical timings */ - 0x00618560, /* freq = 97.521 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C8, 0x0540, 0x0600, 0x0600, + /* horizontal timings */ + 0x0360, 0x0360, 0x0368, 0x036B, 0x038B, 0x038B, + /* vertical timings */ + 0x00618560, /* freq = 97.521 MHz */ + }, { - GFX_MODE_72HZ | /* refresh rate = 70 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, - /* horizontal timings */ - 0x0360, 0x0360, 0x0367, 0x036A, 0x038B, 0x038B, - /* vertical timings */ - 0x00656B85, /* freq = 101.42 MHz */ - }, + GFX_MODE_72HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, + /* horizontal timings */ + 0x0360, 0x0360, 0x0367, 0x036A, 0x038B, 0x038B, + /* vertical timings */ + 0x00656B85, /* freq = 101.42 MHz */ + }, { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0480, 0x0480, 0x04C0, 0x0540, 0x0640, 0x0640, - /* horizontal timings */ - 0x0360, 0x0360, 0x0361, 0x0364, 0x0384, 0x0384, - /* vertical timings */ - 0x006C0000, /* freq = 108.00 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C0, 0x0540, 0x0640, 0x0640, + /* horizontal timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x0384, 0x0384, + /* vertical timings */ + 0x006C0000, /* freq = 108.00 MHz */ + }, { - GFX_MODE_85HZ | /* refresh rate = 85 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, - /* horizontal timings */ - 0x0360, 0x0360, 0x0363, 0x0366, 0x038B, 0x038B, - /* vertical timings */ - 0x0077A666, /* freq = 119.65 MHz */ - }, + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, + /* horizontal timings */ + 0x0360, 0x0360, 0x0363, 0x0366, 0x038B, 0x038B, + /* vertical timings */ + 0x0077A666, /* freq = 119.65 MHz */ + }, { - GFX_MODE_90HZ | /* refresh rate = 90 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, - /* horizontal timings */ - 0x0360, 0x0360, 0x0363, 0x0366, 0x038E, 0x038E, - /* vertical timings */ - 0x00806666, /* freq = 128.40 MHz */ - }, + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, + /* horizontal timings */ + 0x0360, 0x0360, 0x0363, 0x0366, 0x038E, 0x038E, + /* vertical timings */ + 0x00806666, /* freq = 128.40 MHz */ + }, { - GFX_MODE_100HZ | /* refresh rate = 100 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, - /* horizontal timings */ - 0x0360, 0x0360, 0x0365, 0x0368, 0x0398, 0x0398, - /* vertical timings */ - 0x00906147, /* freq = 144.38 MHz */ - }, + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, + /* horizontal timings */ + 0x0360, 0x0360, 0x0365, 0x0368, 0x0398, 0x0398, + /* vertical timings */ + 0x00906147, /* freq = 144.38 MHz */ + }, /* 1280x1024 */ { - GFX_MODE_60HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0500, 0x0500, 0x0530, 0x05A0, 0x0698, 0x0698, - /* horizontal timings */ - 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, - /* vertical timings */ - 0x006C0000, /* freq = 108.0 MHz */ - }, + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0530, 0x05A0, 0x0698, 0x0698, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, + /* vertical timings */ + 0x006C0000, /* freq = 108.0 MHz */ + }, { - GFX_MODE_70HZ | /* refresh rate = 70 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, - /* horizontal timings */ - 0x0400, 0x0400, 0x040A, 0x040D, 0x0433, 0x0433, - /* vertical timings */ - 0x00821999, /* freq = 130.1 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, + /* horizontal timings */ + 0x0400, 0x0400, 0x040A, 0x040D, 0x0433, 0x0433, + /* vertical timings */ + 0x00821999, /* freq = 130.1 MHz */ + }, { - GFX_MODE_72HZ | /* refresh rate = 72 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, - /* horizontal timings */ - 0x0400, 0x0400, 0x0407, 0x040A, 0x0431, 0x0431, - /* vertical timings */ - 0x00858000, /* freq = 133.5 MHz */ - }, + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0407, 0x040A, 0x0431, 0x0431, + /* vertical timings */ + 0x00858000, /* freq = 133.5 MHz */ + }, { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0500, 0x0500, 0x0510, 0x05A0, 0x0698, 0x0698, - /* horizontal timings */ - 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, - /* vertical timings */ - 0x00870000, /* freq = 135.0 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0510, 0x05A0, 0x0698, 0x0698, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, + /* vertical timings */ + 0x00870000, /* freq = 135.0 MHz */ + }, { - GFX_MODE_85HZ | /* refresh rate = 85 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0500, 0x0500, 0x0540, 0x05E0, 0x06C0, 0x06C0, - /* horizontal timings */ - 0x0400, 0x0400, 0x0401, 0x0404, 0x0430, 0x0430, - /* vertical timings */ - 0x009D8000, /* freq = 157.5 MHz */ - }, + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0540, 0x05E0, 0x06C0, 0x06C0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x0430, 0x0430, + /* vertical timings */ + 0x009D8000, /* freq = 157.5 MHz */ + }, { - GFX_MODE_90HZ | /* refresh rate = 90 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0500, 0x0500, 0x0560, 0x05E8, 0x06D0, 0x06D0, - /* horizontal timings */ - 0x0400, 0x0400, 0x0401, 0x0404, 0x0436, 0x0436, - /* vertical timings */ - 0x00A933F7, /* freq = 169.203 MHz */ - }, + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0560, 0x05E8, 0x06D0, 0x06D0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x0436, 0x0436, + /* vertical timings */ + 0x00A933F7, /* freq = 169.203 MHz */ + }, { - GFX_MODE_100HZ | /* refresh rate = 100 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0500, 0x0500, 0x0560, 0x05F0, 0x06E0, 0x06E0, - /* horizontal timings */ - 0x0400, 0x0400, 0x0401, 0x0404, 0x043D, 0x043D, - /* vertical timings */ - 0x00BEF5C2, /* freq = 190.96 MHz */ - }, + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0560, 0x05F0, 0x06E0, 0x06E0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x043D, 0x043D, + /* vertical timings */ + 0x00BEF5C2, /* freq = 190.96 MHz */ + }, /*********************************/ /* BEGIN REDCLOUD-SPECIFIC MODES */ @@ -632,64 +632,64 @@ DISPLAYMODE DisplayParams[] = { /* 1600 x 1200 */ { - GFX_MODE_60HZ | /* refresh rate = 60 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, - /* horizontal timings */ - 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, - /* vertical timings */ - 0x00A20000, /* freq = 162.0 MHz */ - }, + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00A20000, /* freq = 162.0 MHz */ + }, { - GFX_MODE_70HZ | /* refresh rate = 70 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, - /* horizontal timings */ - 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, - /* vertical timings */ - 0x00BD0000, /* freq = 189.0 MHz */ - }, + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00BD0000, /* freq = 189.0 MHz */ + }, { - GFX_MODE_72HZ | /* refresh rate = 72 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0640, 0x0640, 0x06B0, 0x0760, 0x0880, 0x0880, - /* horizontal timings */ - 0x04B0, 0x04B0, 0x04BD, 0x04C0, 0x04EF, 0x04EF, - /* vertical timings */ - 0x00C60000, /* freq = 198.0 MHz */ - }, + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x06B0, 0x0760, 0x0880, 0x0880, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04BD, 0x04C0, 0x04EF, 0x04EF, + /* vertical timings */ + 0x00C60000, /* freq = 198.0 MHz */ + }, { - GFX_MODE_75HZ | /* refresh rate = 75 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, - /* horizontal timings */ - 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, - /* vertical timings */ - 0x00CA8000, /* freq = 202.5 MHz */ - }, + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00CA8000, /* freq = 202.5 MHz */ + }, { - GFX_MODE_85HZ | /* refresh rate = 85 */ - GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | - /* all BPP valid */ - GFX_MODE_16BPP | GFX_MODE_24BPP, - 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, - /* horizontal timings */ - 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, - /* vertical timings */ - 0x00E58000, /* freq = 229.5 MHz */ - }, + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00E58000, /* freq = 229.5 MHz */ + }, }; /* UPDATE THIS VARIABLE WHENEVER NEW REDCLOUD-SPECIFIC MODES ARE ADDED */ @@ -702,145 +702,145 @@ DISPLAYMODE DisplayParams[] = { FIXEDTIMINGS FixedParams[] = { /* 640x480 Panel */ {640, 480, 640, 480, - 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, - 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, - 0x00192CCC, - }, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, {640, 480, 800, 600, - 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, - 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, - 0x00192CCC, - }, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, {640, 480, 1024, 768, - 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, - 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, - 0x00192CCC, - }, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, {640, 480, 1152, 864, - 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, - 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, - 0x00192CCC, - }, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, {640, 480, 1280, 1024, - 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, - 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, - 0x00192CCC, - }, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, {640, 480, 1600, 1200, - 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, - 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, - 0x00192CCC, - }, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, /* 800x600 Panel */ {800, 600, 640, 480, - 0x0280, 0x2d0, 0x2f8, 0x378, 0x3d0, 0x420, - 0x1e0, 0x21c, 0x21d, 0x221, 0x238, 0x274, - 0x00280000, - }, + 0x0280, 0x2d0, 0x2f8, 0x378, 0x3d0, 0x420, + 0x1e0, 0x21c, 0x21d, 0x221, 0x238, 0x274, + 0x00280000, + }, {800, 600, 800, 600, - 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, - 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, - 0x00280000, - }, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, {800, 600, 1024, 768, - 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, - 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, - 0x00280000, - }, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, {800, 600, 1152, 864, - 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, - 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, - 0x00280000, - }, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, {800, 600, 1280, 1024, - 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, - 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, - 0x00280000, - }, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, {800, 600, 1600, 1200, - 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, - 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, - 0x00280000, - }, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, /* 1024x768 panel */ {1024, 768, 640, 480, - 0x0280, 0x340, 0x368, 0x3e8, 0x480, 0x540, - 0x1e0, 0x270, 0x271, 0x275, 0x296, 0x326, - 0x00410000, - }, + 0x0280, 0x340, 0x368, 0x3e8, 0x480, 0x540, + 0x1e0, 0x270, 0x271, 0x275, 0x296, 0x326, + 0x00410000, + }, {1024, 768, 800, 600, - 0x0320, 0x390, 0x3b8, 0x438, 0x4D0, 0x540, - 0x258, 0x2ac, 0x2ad, 0x2b1, 0x2D2, 0x326, - 0x00410000, - }, + 0x0320, 0x390, 0x3b8, 0x438, 0x4D0, 0x540, + 0x258, 0x2ac, 0x2ad, 0x2b1, 0x2D2, 0x326, + 0x00410000, + }, {1024, 768, 1024, 768, - 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, - 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, - 0x00410000, - }, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, {1024, 768, 1152, 864, - 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, - 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, - 0x00410000, - }, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, {1024, 768, 1280, 1024, - 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, - 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, - 0x00410000, - }, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, {1024, 768, 1600, 1200, - 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, - 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, - 0x00410000, - }, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, /* 1280x1024 panel */ {1280, 1024, 640, 480, - 640, 960, 1008, 1120, 1368, 1688, - 480, 752, 753, 756, 794, 1066, - 0x006C0000, - }, + 640, 960, 1008, 1120, 1368, 1688, + 480, 752, 753, 756, 794, 1066, + 0x006C0000, + }, {1280, 1024, 800, 600, - 800, 1040, 1088, 1200, 1448, 1688, - 600, 812, 813, 816, 854, 1066, - 0x006C0000, - }, + 800, 1040, 1088, 1200, 1448, 1688, + 600, 812, 813, 816, 854, 1066, + 0x006C0000, + }, {1280, 1024, 1024, 768, - 1024, 1152, 1200, 1312, 1560, 1688, - 768, 896, 897, 900, 938, 1066, - 0x006C0000, - }, + 1024, 1152, 1200, 1312, 1560, 1688, + 768, 896, 897, 900, 938, 1066, + 0x006C0000, + }, {1280, 1024, 1152, 864, - 1152, 1216, 1264, 1376, 1624, 1688, - 864, 944, 945, 948, 986, 1066, - 0x006C0000, - }, + 1152, 1216, 1264, 1376, 1624, 1688, + 864, 944, 945, 948, 986, 1066, + 0x006C0000, + }, {1280, 1024, 1280, 1024, - 1280, 1280, 1328, 1440, 1688, 1688, - 1024, 1024, 1025, 1028, 1066, 1066, - 0x006C0000, - }, + 1280, 1280, 1328, 1440, 1688, 1688, + 1024, 1024, 1025, 1028, 1066, 1066, + 0x006C0000, + }, }; @@ -944,28 +944,31 @@ gfx_set_display_mode(int xres, int yres, int bpp, int hz) */ int gfx_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblankstart, - unsigned short hsyncstart, unsigned short hsyncend, - unsigned short hblankend, unsigned short htotal, - unsigned short vactive, unsigned short vblankstart, - unsigned short vsyncstart, unsigned short vsyncend, - unsigned short vblankend, unsigned short vtotal, unsigned long frequency) + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, + unsigned long frequency) { int retval = 0; #if GFX_DISPLAY_GU1 if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) retval = gu1_set_display_timings(bpp, flags, - hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal, - vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal, - frequency); + hactive, hblankstart, hsyncstart, + hsyncend, hblankend, htotal, vactive, + vblankstart, vsyncstart, vsyncend, + vblankend, vtotal, frequency); #endif #if GFX_DISPLAY_GU2 if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) retval = gu2_set_display_timings(bpp, flags, - hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal, - vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal, - frequency); + hactive, hblankstart, hsyncstart, + hsyncend, hblankend, htotal, vactive, + vblankstart, vsyncstart, vsyncend, + vblankend, vtotal, frequency); #endif return (retval); } @@ -1084,8 +1087,8 @@ gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) */ void gfx_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot) + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) { #if GFX_DISPLAY_GU1 if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) @@ -1103,7 +1106,7 @@ gfx_set_cursor_position(unsigned long memoffset, */ void gfx_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) { #if GFX_DISPLAY_GU1 if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) @@ -1121,7 +1124,7 @@ gfx_set_cursor_shape32(unsigned long memoffset, */ void gfx_set_cursor_shape64(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask) + unsigned long *andmask, unsigned long *xormask) { #if GFX_DISPLAY_GU2 if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) @@ -1148,7 +1151,7 @@ gfx_set_icon_enable(int enable) */ void gfx_set_icon_colors(unsigned long color0, unsigned long color1, - unsigned long color2) + unsigned long color2) { #if GFX_DISPLAY_GU2 if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) @@ -1175,7 +1178,8 @@ gfx_set_icon_position(unsigned long memoffset, unsigned short xpos) */ void gfx_set_icon_shape64(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask, unsigned int lines) + unsigned long *andmask, unsigned long *xormask, + unsigned int lines) { #if GFX_DISPLAY_GU2 if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) @@ -1362,7 +1366,7 @@ gfx_set_display_video_offset(unsigned long offset) */ void gfx_set_display_video_yuv_offsets(unsigned long yoffset, - unsigned long uoffset, unsigned long voffset) + unsigned long uoffset, unsigned long voffset) { #if GFX_DISPLAY_GU2 if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) @@ -1538,7 +1542,8 @@ gfx_enable_panning(int x, int y) */ int gfx_is_panel_mode_supported(int panelResX, int panelResY, - unsigned short width, unsigned short height, unsigned short bpp) + unsigned short width, unsigned short height, + unsigned short bpp) { int status = -1; @@ -1546,7 +1551,7 @@ gfx_is_panel_mode_supported(int panelResX, int panelResY, if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) status = gu2_is_panel_mode_supported(panelResX, panelResY, width, height, - bpp); + bpp); #endif return (status); @@ -1558,7 +1563,7 @@ gfx_is_panel_mode_supported(int panelResX, int panelResY, */ int gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) { int status = 0; @@ -1581,7 +1586,7 @@ gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, */ int gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp) + unsigned short height, unsigned short bpp) { int status = 0; @@ -1635,7 +1640,7 @@ gfx_set_vtotal(unsigned short vtotal) */ int gfx_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency) + unsigned long frequency) { int freq = 0; @@ -1656,7 +1661,7 @@ gfx_mode_frequency_supported(int xres, int yres, int bpp, */ int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) { #if GFX_DISPLAY_GU1 if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) @@ -1676,7 +1681,7 @@ gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, */ int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency) + unsigned long frequency) { #if GFX_DISPLAY_GU1 if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) @@ -1696,21 +1701,19 @@ gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, */ int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, - int *frequency) + int *frequency) { int retval = -1; #if GFX_DISPLAY_GU1 if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) retval = - gu1_get_frequency_from_refreshrate(xres, yres, bpp, hz, - frequency); + gu1_get_frequency_from_refreshrate(xres, yres, bpp, hz, frequency); #endif #if GFX_DISPLAY_GU2 if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) retval = - gu2_get_frequency_from_refreshrate(xres, yres, bpp, hz, - frequency); + gu2_get_frequency_from_refreshrate(xres, yres, bpp, hz, frequency); #endif return retval; @@ -2475,6 +2478,7 @@ unsigned long gfx_get_display_video_color_key(void) { unsigned long value = 0; + return (value); } @@ -2504,7 +2508,8 @@ gfx_get_display_video_offset(void) */ void gfx_get_display_video_yuv_offsets(unsigned long *yoffset, - unsigned long *uoffset, unsigned long *voffset) + unsigned long *uoffset, + unsigned long *voffset) { #if GFX_DISPLAY_GU2 if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) @@ -2587,9 +2592,10 @@ unsigned long gfx_get_display_video_color_key_mask(void) { unsigned long mask = 0; + return (mask); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ -#endif /* GFX_DISPLAY_DYNAMIC */ +#endif /* GFX_DISPLAY_DYNAMIC */ diff --git a/src/gfx/gfx_i2c.c b/src/gfx/gfx_i2c.c index 7a3ad42..0ceb460 100644 --- a/src/gfx/gfx_i2c.c +++ b/src/gfx/gfx_i2c.c @@ -90,7 +90,7 @@ gfx_i2c_select_gpio(int clock, int data) */ int gfx_i2c_write(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data) + unsigned char subadr, unsigned char bytes, unsigned char *data) { int status = -1; @@ -111,7 +111,7 @@ gfx_i2c_write(unsigned char busnum, unsigned char chipadr, */ int gfx_i2c_read(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data) + unsigned char subadr, unsigned char bytes, unsigned char *data) { int status = -1; @@ -163,6 +163,6 @@ gfx_i2c_cleanup(void) #endif } -#endif /* GFX_I2C_DYNAMIC */ +#endif /* GFX_I2C_DYNAMIC */ /* END OF FILE */ diff --git a/src/gfx/gfx_init.c b/src/gfx/gfx_init.c index 469c70f..648d9cb 100644 --- a/src/gfx/gfx_init.c +++ b/src/gfx/gfx_init.c @@ -122,7 +122,8 @@ gfx_detect_chip(void) } if (rev > 0x6) gfx_chip_revision = SC1200_FUTURE_REV; - } else if (pid == 0x5) { + } + else if (pid == 0x5) { if (rev == 0x6) gfx_chip_revision = SC1200_REV_D2_MVE; else if (rev > 0x6) @@ -184,12 +185,13 @@ gfx_detect_cpu(void) /* Major version is one less than what appears in DIR1 */ if ((dir1 & 0xF0) < 0x70) { - version = GFX_CPU_GXLV | (((((unsigned long)dir1 >> 4) - 1) << 8)) | /* major - 1 */ - ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ - } else { - version = GFX_CPU_GXLV | ((((unsigned long)dir1 >> 4)) - << 8) | /* major */ - ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + version = GFX_CPU_GXLV | (((((unsigned long) dir1 >> 4) - 1) << 8)) | /* major - 1 */ + ((((unsigned long) dir1 & 0x0F)) << 16); /* minor */ + } + else { + version = GFX_CPU_GXLV | ((((unsigned long) dir1 >> 4)) + << 8) | /* major */ + ((((unsigned long) dir1 & 0x0F)) << 16); /* minor */ } /* Currently always CS5530 for video overlay. */ @@ -207,13 +209,14 @@ gfx_detect_cpu(void) gfx_tv_type = GFX_TV_TYPE_FS451; #endif } - } else if (dir0 == 0xB0) { + } + else if (dir0 == 0xB0) { /* CHECK FOR SC1200 */ if ((dir1 == 0x70) || (dir1 == 0x81)) { - version = GFX_CPU_SC1200 | ((((unsigned long)dir1 >> 4)) - << 8) | /* major */ - ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + version = GFX_CPU_SC1200 | ((((unsigned long) dir1 >> 4)) + << 8) | /* major */ + ((((unsigned long) dir1 & 0x0F)) << 16); /* minor */ /* Detect SC1200 revision */ @@ -356,12 +359,12 @@ gfx_detect_cpu(void) ((msr_value.low & 0x0F) << 16); /* MINOR */ /* READ THE CORE FREQUENCY */ - /* I can't find GX implementations that need - * this - we're trying to avoid virtual reads - * anyway, so bail on it - */ + /* I can't find GX implementations that need + * this - we're trying to avoid virtual reads + * anyway, so bail on it + */ - /* gfx_cpu_frequency = gfx_get_core_freq(); */ + /* gfx_cpu_frequency = gfx_get_core_freq(); */ /* SET THE GP SCRATCH AREA */ /* Color bitmap BLTs use the last 16K of frame buffer space */ diff --git a/src/gfx/gfx_mode.h b/src/gfx/gfx_mode.h index f9b42b0..a38bc73 100644 --- a/src/gfx/gfx_mode.h +++ b/src/gfx/gfx_mode.h @@ -127,8 +127,7 @@ /* STRUCTURE DEFINITION */ -typedef struct tagDISPLAYMODE -{ +typedef struct tagDISPLAYMODE { /* DISPLAY MODE FLAGS */ /* Specify valid color depths and the refresh rate. */ @@ -157,8 +156,7 @@ typedef struct tagDISPLAYMODE } DISPLAYMODE; /* For Fixed timings */ -typedef struct tagFIXEDTIMINGS -{ +typedef struct tagFIXEDTIMINGS { /* DISPLAY MODE FLAGS */ /* Specify valid color depths and the refresh rate. */ @@ -189,6 +187,6 @@ typedef struct tagFIXEDTIMINGS } FIXEDTIMINGS; -#endif /* !_gfx_mode_h */ +#endif /* !_gfx_mode_h */ /* END OF FILE */ diff --git a/src/gfx/gfx_msr.c b/src/gfx/gfx_msr.c index 1705acb..a779971 100644 --- a/src/gfx/gfx_msr.c +++ b/src/gfx/gfx_msr.c @@ -140,8 +140,7 @@ gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) *---------------------------------------------------------------------------- */ DEV_STATUS -gfx_msr_write(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue) +gfx_msr_write(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) { DEV_STATUS ret_value = NOT_KNOWN; diff --git a/src/gfx/gfx_priv.h b/src/gfx/gfx_priv.h index 5647af8..6a2218e 100644 --- a/src/gfx/gfx_priv.h +++ b/src/gfx/gfx_priv.h @@ -89,13 +89,13 @@ DEV_STATUS redcloud_find_msr_device(MSR * pDev); int redcloud_msr_init(void); DEV_STATUS redcloud_id_msr_device(MSR * pDev, unsigned long address); DEV_STATUS redcloud_get_msr_dev_address(unsigned int device, - unsigned long *address); + unsigned long *address); DEV_STATUS redcloud_get_glink_id_at_address(unsigned int *device, - unsigned long address); + unsigned long address); DEV_STATUS redcloud_msr_read(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue); + Q_WORD * msrValue); DEV_STATUS redcloud_msr_write(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue); + Q_WORD * msrValue); #endif #endif @@ -131,13 +131,14 @@ int gu1_set_display_bpp(unsigned short bpp); int gu1_is_display_mode_supported(int xres, int yres, int bpp, int hz); int gu1_set_display_mode(int xres, int yres, int bpp, int hz); int gu1_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblank_start, - unsigned short hsync_start, unsigned short hsync_end, - unsigned short hblank_end, unsigned short htotal, - unsigned short vactive, unsigned short vblank_start, - unsigned short vsync_start, unsigned short vsync_end, - unsigned short vblank_end, unsigned short vtotal, - unsigned long frequency); + unsigned short hactive, unsigned short hblank_start, + unsigned short hsync_start, + unsigned short hsync_end, unsigned short hblank_end, + unsigned short htotal, unsigned short vactive, + unsigned short vblank_start, + unsigned short vsync_start, + unsigned short vsync_end, unsigned short vblank_end, + unsigned short vtotal, unsigned long frequency); int gu1_set_vtotal(unsigned short vtotal); void gu1_set_display_pitch(unsigned short pitch); void gu1_set_display_offset(unsigned long offset); @@ -147,10 +148,10 @@ void gu1_video_shutdown(void); void gu1_set_cursor_enable(int enable); void gu1_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); void gu1_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot); + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot); void gu1_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask); + unsigned long *andmask, unsigned long *xormask); int gu1_set_compression_enable(int enable); int gu1_set_compression_offset(unsigned long offset); int gu1_set_compression_pitch(unsigned short pitch); @@ -163,21 +164,21 @@ void gu1_delay_milliseconds(unsigned long milliseconds); void gu1_delay_microseconds(unsigned long microseconds); void gu1_enable_panning(int x, int y); int gu1_set_fixed_timings(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp); + unsigned short height, unsigned short bpp); int gu1_set_panel_present(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp); + unsigned short height, unsigned short bpp); void gu1_reset_timing_lock(void); int gu1_get_display_details(unsigned int mode, int *xres, int *yres, int *hz); unsigned short gu1_get_display_pitch(void); unsigned long gu1_get_max_supported_pixel_clock(void); int gu1_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency); + unsigned long frequency); int gu1_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, - unsigned long frequency); + unsigned long frequency); int gu1_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency); + unsigned long frequency); int gu1_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, - int *frequency); + int *frequency); int gu1_get_display_mode_count(void); int gu1_get_display_mode(int *xres, int *yres, int *bpp, int *hz); unsigned long gu1_get_frame_buffer_line_size(void); @@ -196,8 +197,7 @@ unsigned short gu1_get_vblank_end(void); unsigned short gu1_get_vtotal(void); unsigned short gu1_get_display_bpp(void); unsigned long gu1_get_display_offset(void); -int gu1_get_display_palette_entry(unsigned long index, - unsigned long *palette); +int gu1_get_display_palette_entry(unsigned long index, unsigned long *palette); void gu1_get_display_palette(unsigned long *palette); unsigned long gu1_get_cursor_enable(void); unsigned long gu1_get_cursor_offset(void); @@ -220,16 +220,17 @@ int gu1_get_valid_bit(int line); void gfx_set_display_video_format(unsigned long format); void gfx_set_display_video_yuv_offsets(unsigned long yoffset, - unsigned long uoffset, unsigned long voffset); + unsigned long uoffset, + unsigned long voffset); void gfx_set_display_video_yuv_pitch(unsigned long ypitch, - unsigned long uvpitch); -void gfx_set_display_video_downscale(unsigned short srch, - unsigned short dsth); + unsigned long uvpitch); +void gfx_set_display_video_downscale(unsigned short srch, unsigned short dsth); void gfx_set_display_video_vertical_downscale_enable(int enable); void gfx_get_display_video_yuv_offsets(unsigned long *yoffset, - unsigned long *uoffset, unsigned long *voffset); + unsigned long *uoffset, + unsigned long *voffset); void gfx_get_display_video_yuv_pitch(unsigned long *ypitch, - unsigned long *uvpitch); + unsigned long *uvpitch); unsigned long gfx_get_display_video_downscale_delta(void); int gfx_get_display_video_downscale_enable(void); @@ -248,18 +249,19 @@ void gu2_disable_compression(void); #if GFX_DISPLAY_DYNAMIC void gu2_get_display_video_yuv_offsets(unsigned long *yoffset, - unsigned long *uoffset, unsigned long *voffset); + unsigned long *uoffset, + unsigned long *voffset); void gu2_get_display_video_yuv_pitch(unsigned long *ypitch, - unsigned long *uvpitch); + unsigned long *uvpitch); unsigned long gu2_get_display_video_downscale_delta(void); int gu2_get_display_video_downscale_enable(void); void gu2_set_display_video_yuv_offsets(unsigned long yoffset, - unsigned long uoffset, unsigned long voffset); + unsigned long uoffset, + unsigned long voffset); void gu2_set_display_video_format(unsigned long format); void gu2_set_display_video_yuv_pitch(unsigned long ypitch, - unsigned long uvpitch); -void gu2_set_display_video_downscale(unsigned short srch, - unsigned short dsth); + unsigned long uvpitch); +void gu2_set_display_video_downscale(unsigned short srch, unsigned short dsth); void gu2_set_display_video_vertical_downscale_enable(int enable); void gu2_set_display_video_enable(int enable); void gu2_set_display_video_size(unsigned short width, unsigned short height); @@ -270,13 +272,14 @@ int gu2_set_display_bpp(unsigned short bpp); int gu2_is_display_mode_supported(int xres, int yres, int bpp, int hz); int gu2_set_display_mode(int xres, int yres, int bpp, int hz); int gu2_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblank_start, - unsigned short hsync_start, unsigned short hsync_end, - unsigned short hblank_end, unsigned short htotal, - unsigned short vactive, unsigned short vblank_start, - unsigned short vsync_start, unsigned short vsync_end, - unsigned short vblank_end, unsigned short vtotal, - unsigned long frequency); + unsigned short hactive, unsigned short hblank_start, + unsigned short hsync_start, + unsigned short hsync_end, unsigned short hblank_end, + unsigned short htotal, unsigned short vactive, + unsigned short vblank_start, + unsigned short vsync_start, + unsigned short vsync_end, unsigned short vblank_end, + unsigned short vtotal, unsigned long frequency); int gu2_set_vtotal(unsigned short vtotal); void gu2_set_display_pitch(unsigned short pitch); void gu2_set_display_offset(unsigned long offset); @@ -285,18 +288,18 @@ int gu2_set_display_palette(unsigned long *palette); void gu2_set_cursor_enable(int enable); void gu2_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); void gu2_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot); + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot); void gu2_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask); + unsigned long *andmask, unsigned long *xormask); void gu2_set_cursor_shape64(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask); + unsigned long *andmask, unsigned long *xormask); void gu2_set_icon_enable(int enable); void gu2_set_icon_colors(unsigned long color0, unsigned long color1, - unsigned long color2); + unsigned long color2); void gu2_set_icon_position(unsigned long memoffset, unsigned short xpos); void gu2_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, - unsigned long *xormask, unsigned int lines); + unsigned long *xormask, unsigned int lines); int gu2_set_compression_enable(int enable); int gu2_set_compression_offset(unsigned long offset); int gu2_set_compression_pitch(unsigned short pitch); @@ -309,23 +312,24 @@ void gu2_delay_milliseconds(unsigned long milliseconds); void gu2_delay_microseconds(unsigned long microseconds); void gu2_enable_panning(int x, int y); int gu2_is_panel_mode_supported(int panelResX, int panelResY, - unsigned short width, unsigned short height, unsigned short bpp); + unsigned short width, unsigned short height, + unsigned short bpp); int gu2_set_fixed_timings(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp); + unsigned short height, unsigned short bpp); int gu2_set_panel_present(int panelResX, int panelResY, unsigned short width, - unsigned short height, unsigned short bpp); + unsigned short height, unsigned short bpp); void gu2_reset_timing_lock(void); int gu2_get_display_details(unsigned int mode, int *xres, int *yres, int *hz); unsigned short gu2_get_display_pitch(void); unsigned long gu2_get_max_supported_pixel_clock(void); int gu2_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency); + unsigned long frequency); int gu2_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, - unsigned long frequency); + unsigned long frequency); int gu2_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency); + unsigned long frequency); int gu2_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, - int *frequency); + int *frequency); int gu2_get_display_mode_count(void); int gu2_get_display_mode(int *xres, int *yres, int *bpp, int *hz); unsigned long gu2_get_frame_buffer_line_size(void); @@ -344,8 +348,7 @@ unsigned short gu2_get_vblank_end(void); unsigned short gu2_get_vtotal(void); unsigned short gu2_get_display_bpp(void); unsigned long gu2_get_display_offset(void); -int gu2_get_display_palette_entry(unsigned long index, - unsigned long *palette); +int gu2_get_display_palette_entry(unsigned long index, unsigned long *palette); void gu2_get_display_palette(unsigned long *palette); unsigned long gu2_get_cursor_enable(void); unsigned long gu2_get_cursor_offset(void); @@ -374,7 +377,8 @@ int gu2_get_valid_bit(int line); /* PRIVATE ROUTINES */ void gu1_solid_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long color); + unsigned short width, unsigned short height, + unsigned long color); void gu1_detect_blt_buffer_base(void); /* DYNAMIC ROUTINES */ @@ -383,41 +387,50 @@ void gu1_detect_blt_buffer_base(void); void gu1_set_bpp(unsigned short bpp); void gu1_set_solid_pattern(unsigned long color); void gu1_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparency); + unsigned long data0, unsigned long data1, + unsigned char transparency); void gu1_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned long data2, - unsigned long data3, unsigned char transparency); + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparency); void gu1_load_color_pattern_line(short y, unsigned long *pattern_8x8); void gu1_set_solid_source(unsigned long color); void gu1_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent); + unsigned short transparent); void gu1_set_pattern_flags(unsigned short flags); void gu1_set_raster_operation(unsigned char rop); void gu1_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height); + unsigned short width, unsigned short height); void gu1_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern); + unsigned short width, unsigned short height, + unsigned long *pattern); void gu1_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height); void gu1_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color); void gu1_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch); void gu1_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch, - unsigned long color); + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, unsigned char *data, + long pitch, unsigned long color); void gu1_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, short pitch); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch); void gu1_text_blt(unsigned short dstx, unsigned short dsty, - unsigned short width, unsigned short height, unsigned char *data); + unsigned short width, unsigned short height, + unsigned char *data); void gu1_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, unsigned short axialerr, - unsigned short diagerr, unsigned short flags); + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags); void gu1_wait_until_idle(void); int gu1_test_blt_pending(void); #endif @@ -438,41 +451,50 @@ void gu2_reset_pitch(unsigned short pitch); void gu2_set_bpp(unsigned short bpp); void gu2_set_solid_pattern(unsigned long color); void gu2_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparency); + unsigned long data0, unsigned long data1, + unsigned char transparency); void gu2_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned long data2, - unsigned long data3, unsigned char transparency); + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparency); void gu2_load_color_pattern_line(short y, unsigned long *pattern_8x8); void gu2_set_solid_source(unsigned long color); void gu2_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent); + unsigned short transparent); void gu2_set_pattern_flags(unsigned short flags); void gu2_set_raster_operation(unsigned char rop); void gu2_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height); + unsigned short width, unsigned short height); void gu2_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern); + unsigned short width, unsigned short height, + unsigned long *pattern); void gu2_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height); void gu2_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color); void gu2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch); void gu2_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch, - unsigned long color); + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, unsigned char *data, + long pitch, unsigned long color); void gu2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, short pitch); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch); void gu2_text_blt(unsigned short dstx, unsigned short dsty, - unsigned short width, unsigned short height, unsigned char *data); + unsigned short width, unsigned short height, + unsigned char *data); void gu2_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, unsigned short axialerr, - unsigned short diagerr, unsigned short flags); + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags); void gu2_wait_until_idle(void); int gu2_test_blt_pending(void); @@ -483,26 +505,30 @@ void gu22_set_source_transparency(unsigned long color, unsigned long mask); void gu22_set_alpha_mode(int mode); void gu22_set_alpha_value(unsigned char value); void gu22_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height); + unsigned short height); void gu22_color_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned long *pattern); + unsigned short height, unsigned long *pattern); void gu22_screen_to_screen_blt(unsigned long srcoffset, - unsigned long dstoffset, unsigned short width, unsigned short height, - int flags); + unsigned long dstoffset, unsigned short width, + unsigned short height, int flags); void gu22_mono_expand_blt(unsigned long srcbase, unsigned short srcx, - unsigned short srcy, unsigned long dstoffset, unsigned short width, - unsigned short height, int byte_packed); + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed); void gu22_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, unsigned short height, - unsigned char *data, short pitch); + unsigned long dstoffset, + unsigned short width, + unsigned short height, unsigned char *data, + short pitch); void gu22_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, unsigned short height, - unsigned char *data, short pitch); + unsigned long dstoffset, + unsigned short width, unsigned short height, + unsigned char *data, short pitch); void gu22_text_blt(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data); + unsigned short height, unsigned char *data); void gu22_bresenham_line(unsigned long dstoffset, unsigned short length, - unsigned short initerr, unsigned short axialerr, unsigned short diagerr, - unsigned short flags); + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags); void gu22_sync_to_vblank(void); #endif @@ -535,12 +561,12 @@ int cs5530_set_video_format(unsigned long format); int cs5530_set_video_size(unsigned short width, unsigned short height); int cs5530_set_video_offset(unsigned long offset); int cs5530_set_video_window(short x, short y, unsigned short w, - unsigned short h); + unsigned short h); int cs5530_set_video_left_crop(unsigned short x); int cs5530_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int cs5530_set_video_color_key(unsigned long key, unsigned long mask, - int bluescreen); + int bluescreen); int cs5530_set_video_filter(int xfilter, int yfilter); int cs5530_set_video_palette(unsigned long *palette); int cs5530_set_video_palette_entry(unsigned long index, unsigned long color); @@ -562,8 +588,7 @@ unsigned long cs5530_get_video_dst_size(void); unsigned long cs5530_get_video_position(void); unsigned long cs5530_get_video_color_key(void); unsigned long cs5530_get_video_color_key_mask(void); -int cs5530_get_video_palette_entry(unsigned long index, - unsigned long *palette); +int cs5530_get_video_palette_entry(unsigned long index, unsigned long *palette); int cs5530_get_video_color_key_src(void); int cs5530_get_video_filter(void); unsigned long cs5530_read_crc(void); @@ -594,21 +619,23 @@ int sc1200_set_video_format(unsigned long format); int sc1200_set_video_size(unsigned short width, unsigned short height); int sc1200_set_video_offset(unsigned long offset); int sc1200_set_video_window(short x, short y, unsigned short w, - unsigned short h); + unsigned short h); int sc1200_set_video_left_crop(unsigned short x); int sc1200_set_video_upscale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int sc1200_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int sc1200_set_video_downscale_config(unsigned short type, unsigned short m); int sc1200_set_video_color_key(unsigned long key, unsigned long mask, - int bluescreen); + int bluescreen); int sc1200_set_video_filter(int xfilter, int yfilter); int sc1200_set_video_palette(unsigned long *palette); int sc1200_set_video_palette_bypass(int enable); int sc1200_set_video_palette_entry(unsigned long index, unsigned long color); int sc1200_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4); + unsigned short coef2, + unsigned short coef3, + unsigned short coef4); int sc1200_set_video_downscale_enable(int enable); int sc1200_set_video_source(VideoSourceType source); int sc1200_set_vbi_source(VbiSourceType source); @@ -621,13 +648,14 @@ int sc1200_set_top_line_in_odd(int enable); int sc1200_set_genlock_delay(unsigned long delay); int sc1200_set_genlock_enable(int flags); int sc1200_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, unsigned long color2); + unsigned short select_color2, unsigned long color1, + unsigned long color2); int sc1200_set_video_request(short x, short y); int sc1200_select_alpha_region(int region); int sc1200_set_alpha_enable(int enable); int sc1200_set_alpha_window(short x, short y, - unsigned short width, unsigned short height); + unsigned short width, unsigned short height); int sc1200_set_alpha_value(unsigned char alpha, char delta); int sc1200_set_alpha_priority(int priority); int sc1200_set_alpha_color(unsigned long color); @@ -648,17 +676,17 @@ unsigned long sc1200_get_video_xclip(void); unsigned long sc1200_get_video_offset(void); unsigned long sc1200_get_video_upscale(void); unsigned long sc1200_get_video_scale(void); -int sc1200_get_video_downscale_config(unsigned short *type, - unsigned short *m); +int sc1200_get_video_downscale_config(unsigned short *type, unsigned short *m); void sc1200_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4); + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4); void sc1200_get_video_downscale_enable(int *enable); unsigned long sc1200_get_video_dst_size(void); unsigned long sc1200_get_video_position(void); unsigned long sc1200_get_video_color_key(void); unsigned long sc1200_get_video_color_key_mask(void); -int sc1200_get_video_palette_entry(unsigned long index, - unsigned long *palette); +int sc1200_get_video_palette_entry(unsigned long index, unsigned long *palette); int sc1200_get_video_color_key_src(void); int sc1200_get_video_filter(void); int sc1200_get_video_request(short *x, short *y); @@ -672,14 +700,14 @@ int sc1200_get_vertical_scaler_offset(char *offset); unsigned long sc1200_get_genlock_delay(void); int sc1200_get_genlock_enable(void); int sc1200_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2); + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2); unsigned long sc1200_read_crc(void); int sc1200_get_macrovision_enable(void); void sc1200_get_alpha_enable(int *enable); void sc1200_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height); + unsigned short *width, unsigned short *height); void sc1200_get_alpha_value(unsigned char *alpha, char *delta); void sc1200_get_alpha_priority(int *priority); void sc1200_get_alpha_color(unsigned long *color); @@ -709,38 +737,40 @@ int redcloud_set_video_size(unsigned short width, unsigned short height); int redcloud_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); int redcloud_set_video_offset(unsigned long offset); int redcloud_set_video_yuv_offsets(unsigned long yoffset, - unsigned long uoffset, unsigned long voffset); + unsigned long uoffset, + unsigned long voffset); int redcloud_set_video_window(short x, short y, unsigned short w, - unsigned short h); + unsigned short h); int redcloud_set_video_left_crop(unsigned short x); int redcloud_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int redcloud_set_video_vertical_downscale(unsigned short srch, - unsigned short dsth); + unsigned short dsth); void redcloud_set_video_vertical_downscale_enable(int enable); -int redcloud_set_video_downscale_config(unsigned short type, - unsigned short m); +int redcloud_set_video_downscale_config(unsigned short type, unsigned short m); int redcloud_set_video_color_key(unsigned long key, unsigned long mask, - int bluescreen); + int bluescreen); int redcloud_set_video_filter(int xfilter, int yfilter); int redcloud_set_video_palette(unsigned long *palette); int redcloud_set_graphics_palette(unsigned long *palette); int redcloud_set_video_palette_bypass(int enable); -int redcloud_set_video_palette_entry(unsigned long index, - unsigned long color); +int redcloud_set_video_palette_entry(unsigned long index, unsigned long color); int redcloud_set_graphics_palette_entry(unsigned long index, - unsigned long color); + unsigned long color); int redcloud_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4); + unsigned short coef2, + unsigned short coef3, + unsigned short coef4); int redcloud_set_video_downscale_enable(int enable); int redcloud_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, unsigned long color2); + unsigned short select_color2, + unsigned long color1, unsigned long color2); int redcloud_set_video_cursor_enable(int enable); int redcloud_select_alpha_region(int region); int redcloud_set_alpha_enable(int enable); int redcloud_set_alpha_window(short x, short y, - unsigned short width, unsigned short height); + unsigned short width, unsigned short height); int redcloud_set_alpha_value(unsigned char alpha, char delta); int redcloud_set_alpha_priority(int priority); int redcloud_set_alpha_color(unsigned long color); @@ -757,36 +787,40 @@ unsigned long redcloud_get_video_line_size(void); unsigned long redcloud_get_video_xclip(void); unsigned long redcloud_get_video_offset(void); void redcloud_get_video_yuv_offsets(unsigned long *yoffset, - unsigned long *uoffset, unsigned long *voffset); + unsigned long *uoffset, + unsigned long *voffset); void redcloud_get_video_yuv_pitch(unsigned long *ypitch, - unsigned long *uvpitch); + unsigned long *uvpitch); unsigned long redcloud_get_video_scale(void); unsigned long redcloud_get_video_downscale_delta(void); int redcloud_get_video_vertical_downscale_enable(void); int redcloud_get_video_downscale_config(unsigned short *type, - unsigned short *m); + unsigned short *m); void redcloud_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4); + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4); void redcloud_get_video_downscale_enable(int *enable); unsigned long redcloud_get_video_dst_size(void); unsigned long redcloud_get_video_position(void); unsigned long redcloud_get_video_color_key(void); unsigned long redcloud_get_video_color_key_mask(void); int redcloud_get_video_palette_entry(unsigned long index, - unsigned long *palette); + unsigned long *palette); int redcloud_get_video_color_key_src(void); int redcloud_get_video_filter(void); int redcloud_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2); + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2); unsigned long redcloud_read_crc(void); unsigned long redcloud_read_crc32(void); unsigned long redcloud_read_window_crc(int source, unsigned short x, - unsigned short y, unsigned short width, unsigned short height, int crc32); + unsigned short y, unsigned short width, + unsigned short height, int crc32); void redcloud_get_alpha_enable(int *enable); void redcloud_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height); + unsigned short *width, unsigned short *height); void redcloud_get_alpha_value(unsigned char *alpha, char *delta); void redcloud_get_alpha_priority(int *priority); void redcloud_get_alpha_color(unsigned long *color); @@ -853,12 +887,11 @@ int saa7114_set_decoder_contrast(unsigned char contrast); int saa7114_set_decoder_hue(char hue); int saa7114_set_decoder_saturation(unsigned char saturation); int saa7114_set_decoder_input_offset(unsigned short x, unsigned short y); -int saa7114_set_decoder_input_size(unsigned short width, - unsigned short height); +int saa7114_set_decoder_input_size(unsigned short width, unsigned short height); int saa7114_set_decoder_output_size(unsigned short width, - unsigned short height); + unsigned short height); int saa7114_set_decoder_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int saa7114_set_decoder_vbi_format(int start, int end, int format); int saa7114_set_decoder_vbi_enable(int enable); int saa7114_set_decoder_vbi_upscale(void); @@ -885,9 +918,11 @@ int saa7114_get_decoder_vbi_format(int line); #if GFX_I2C_DYNAMIC int acc_i2c_reset(unsigned char busnum, short adr, char freq); int acc_i2c_write(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data); + unsigned char subadr, unsigned char bytes, + unsigned char *data); int acc_i2c_read(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data); + unsigned char subadr, unsigned char bytes, + unsigned char *data); int acc_i2c_select_gpio(int clock, int data); int acc_i2c_init(void); void acc_i2c_cleanup(void); @@ -901,9 +936,11 @@ void acc_i2c_cleanup(void); #if GFX_I2C_DYNAMIC int gpio_i2c_reset(unsigned char busnum, short adr, char freq); int gpio_i2c_write(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data); + unsigned char subadr, unsigned char bytes, + unsigned char *data); int gpio_i2c_read(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data); + unsigned char subadr, unsigned char bytes, + unsigned char *data); int gpio_i2c_select_gpio(int clock, int data); int gpio_i2c_init(void); void gpio_i2c_cleanup(void); @@ -935,9 +972,11 @@ int sc1200_get_tv_output(void); int sc1200_get_tv_mode_count(TVStandardType format); int sc1200_get_tv_display_mode(int *width, int *height, int *bpp, int *hz); int sc1200_get_tv_display_mode_frequency(unsigned short width, - unsigned short height, TVStandardType format, int *frequency); + unsigned short height, + TVStandardType format, int *frequency); int sc1200_is_tv_display_mode_supported(unsigned short width, - unsigned short height, TVStandardType format); + unsigned short height, + TVStandardType format); unsigned char cc_add_parity_bit(unsigned char data); #endif diff --git a/src/gfx/gfx_regs.h b/src/gfx/gfx_regs.h index 2326f61..c43f294 100644 --- a/src/gfx/gfx_regs.h +++ b/src/gfx/gfx_regs.h @@ -184,17 +184,17 @@ #define DC_GCFG_CMPE 0x00000010 /* compression enable */ #define DC_GCFG_DECE 0x00000020 /* decompression enable */ #define DC_GCFG_DCLK_MASK 0x000000C0 /* dotclock multiplier */ -#define DC_GCFG_DCLK_POS 6 /* dotclock multiplier */ +#define DC_GCFG_DCLK_POS 6 /* dotclock multiplier */ #define DC_GCFG_DFHPSL_MASK 0x00000F00 /* FIFO high-priority start */ -#define DC_GCFG_DFHPSL_POS 8 /* FIFO high-priority start */ +#define DC_GCFG_DFHPSL_POS 8 /* FIFO high-priority start */ #define DC_GCFG_DFHPEL_MASK 0x0000F000 /* FIFO high-priority end */ -#define DC_GCFG_DFHPEL_POS 12 /* FIFO high-priority end */ +#define DC_GCFG_DFHPEL_POS 12 /* FIFO high-priority end */ #define DC_GCFG_CIM_MASK 0x00030000 /* compressor insert mode */ -#define DC_GCFG_CIM_POS 16 /* compressor insert mode */ +#define DC_GCFG_CIM_POS 16 /* compressor insert mode */ #define DC_GCFG_FDTY 0x00040000 /* frame dirty mode */ #define DC_GCFG_RTPM 0x00080000 /* real-time perf. monitor */ #define DC_GCFG_DAC_RS_MASK 0x00700000 /* DAC register selects */ -#define DC_GCFG_DAC_RS_POS 20 /* DAC register selects */ +#define DC_GCFG_DAC_RS_POS 20 /* DAC register selects */ #define DC_GCFG_CKWR 0x00800000 /* clock write */ #define DC_GCFG_LDBL 0x01000000 /* line double */ #define DC_GCFG_DIAG 0x02000000 /* FIFO diagnostic mode */ @@ -229,7 +229,7 @@ #define DC_TCFG_PXDB 0x00008000 /* pixel double */ #define DC_TCFG_BKRT 0x00010000 /* blink rate */ #define DC_TCFG_PSD_MASK 0x000E0000 /* power sequence delay */ -#define DC_TCFG_PSD_POS 17 /* power sequence delay */ +#define DC_TCFG_PSD_POS 17 /* power sequence delay */ #define DC_TCFG_DDCI 0x08000000 /* DDC input (RO) */ #define DC_TCFG_SENS 0x10000000 /* monitor sense (RO) */ #define DC_TCFG_DNA 0x20000000 /* display not active (RO) */ @@ -261,7 +261,7 @@ /* MC_MEM_CNTRL1 BIT DEFINITIONS */ -#define MC_XBUSARB 0x00000008 /* 0 = GP priority < CPU priority */ +#define MC_XBUSARB 0x00000008 /* 0 = GP priority < CPU priority */ /* 1 = GP priority = CPU priority */ /* GXm databook V2.0 is wrong ! */ /*----------*/ @@ -1200,14 +1200,14 @@ /* GEODELINK DEVICE MSR REGISTER SUMMARY */ -#define MBD_MSR_CAP 0x2000 /* Device Capabilities */ -#define MBD_MSR_CONFIG 0x2001 /* Device Master Configuration */ +#define MBD_MSR_CAP 0x2000 /* Device Capabilities */ +#define MBD_MSR_CONFIG 0x2001 /* Device Master Configuration */ /* Register */ -#define MBD_MSR_SMI 0x2002 /* MBus Device SMI Register */ -#define MBD_MSR_ERROR 0x2003 /* MBus Device Error */ -#define MBD_MSR_PM 0x2004 /* MBus Device Power Management */ +#define MBD_MSR_SMI 0x2002 /* MBus Device SMI Register */ +#define MBD_MSR_ERROR 0x2003 /* MBus Device Error */ +#define MBD_MSR_PM 0x2004 /* MBus Device Power Management */ /* Register */ -#define MBD_MSR_DIAG 0x2005 /* Mbus Device Diagnostic Register */ +#define MBD_MSR_DIAG 0x2005 /* Mbus Device Diagnostic Register */ /* DISPLAY FILTER MBD_MSR_DIAG DEFINITIONS */ diff --git a/src/gfx/gfx_rndr.c b/src/gfx/gfx_rndr.c index c5a46ac..09f88f0 100644 --- a/src/gfx/gfx_rndr.c +++ b/src/gfx/gfx_rndr.c @@ -128,7 +128,7 @@ gfx_set_solid_source(unsigned long color) */ void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent) + unsigned short transparent) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) @@ -169,7 +169,8 @@ gfx_set_solid_pattern(unsigned long color) */ void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned char transparent) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) @@ -187,18 +188,19 @@ gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, */ void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, - unsigned long data2, unsigned long data3, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) gu1_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, - transparent); + transparent); #endif #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu2_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, - transparent); + transparent); #endif } @@ -242,7 +244,7 @@ gfx_set_raster_operation(unsigned char rop) */ void gfx_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) @@ -260,7 +262,8 @@ gfx_pattern_fill(unsigned short x, unsigned short y, */ void gfx_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern) + unsigned short width, unsigned short height, + unsigned long *pattern) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) @@ -278,8 +281,8 @@ gfx_color_pattern_fill(unsigned short x, unsigned short y, */ void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) @@ -297,18 +300,17 @@ gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, */ void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) - gu1_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, - color); + gu1_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); #endif #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) - gu2_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, - color); + gu2_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); #endif } @@ -318,18 +320,19 @@ gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, */ void gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) gu1_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, - data, pitch); + data, pitch); #endif #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu2_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, - data, pitch); + data, pitch); #endif } @@ -339,19 +342,20 @@ gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, */ void gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch, - unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) gu1_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, - data, pitch, color); + data, pitch, color); #endif #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu2_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, - data, pitch, color); + data, pitch, color); #endif } @@ -361,18 +365,19 @@ gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, */ void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) gu1_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, - data, pitch); + data, pitch); #endif #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu2_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, - data, pitch); + data, pitch); #endif } @@ -382,7 +387,7 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, */ void gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) @@ -400,8 +405,9 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, */ void gfx_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) { #if GFX_2DACCEL_GU1 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) @@ -539,7 +545,7 @@ gfx2_set_alpha_value(unsigned char value) */ void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height) + unsigned short height) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) @@ -553,7 +559,7 @@ gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, */ void gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned long *pattern) + unsigned short height, unsigned long *pattern) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) @@ -567,7 +573,8 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, */ void gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, - unsigned short width, unsigned short height, int flags) + unsigned short width, unsigned short height, + int flags) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) @@ -581,13 +588,14 @@ gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, */ void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, - unsigned short srcy, unsigned long dstoffset, unsigned short width, - unsigned short height, int byte_packed) + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu22_mono_expand_blt(srcbase, srcx, srcy, dstoffset, width, height, - byte_packed); + byte_packed); #endif } @@ -597,13 +605,14 @@ gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, */ void gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, unsigned short height, - unsigned char *data, short pitch) + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu22_color_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, - data, pitch); + data, pitch); #endif } @@ -613,7 +622,7 @@ gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, */ void gfx2_text_blt(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) @@ -627,13 +636,14 @@ gfx2_text_blt(unsigned long dstoffset, unsigned short width, */ void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, unsigned short height, - unsigned char *data, short pitch) + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu22_mono_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, - data, pitch); + data, pitch); #endif } @@ -643,13 +653,14 @@ gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, */ void gfx2_bresenham_line(unsigned long dstoffset, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) { #if GFX_2DACCEL_GU2 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) gu22_bresenham_line(dstoffset, length, initerr, axialerr, diagerr, - flags); + flags); #endif } @@ -666,6 +677,6 @@ gfx2_sync_to_vblank(void) #endif } -#endif /* GFX_2DACCEL_DYNAMIC */ +#endif /* GFX_2DACCEL_DYNAMIC */ /* END OF FILE */ diff --git a/src/gfx/gfx_rtns.h b/src/gfx/gfx_rtns.h index d7e001e..bfcfe9f 100644 --- a/src/gfx/gfx_rtns.h +++ b/src/gfx/gfx_rtns.h @@ -44,8 +44,7 @@ /* COMPILER OPTION FOR C++ PROGRAMS */ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif /* DURANGO MEMORY POINTERS */ @@ -126,13 +125,13 @@ extern "C" int gfx_msr_init(void); DEV_STATUS gfx_id_msr_device(MSR * pDev, unsigned long address); DEV_STATUS gfx_get_msr_dev_address(unsigned int device, - unsigned long *address); + unsigned long *address); DEV_STATUS gfx_get_glink_id_at_address(unsigned int *device, - unsigned long address); + unsigned long address); DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue); + Q_WORD * msrValue); DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue); + Q_WORD * msrValue); /* ROUTINES IN GFX_DISP.C */ @@ -140,18 +139,22 @@ extern "C" int gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz); int gfx_set_display_mode(int xres, int yres, int bpp, int hz); int gfx_set_display_timings(unsigned short bpp, unsigned short flags, - unsigned short hactive, unsigned short hblank_start, - unsigned short hsync_start, unsigned short hsync_end, - unsigned short hblank_end, unsigned short htotal, - unsigned short vactive, unsigned short vblank_start, - unsigned short vsync_start, unsigned short vsync_end, - unsigned short vblank_end, unsigned short vtotal, - unsigned long frequency); + unsigned short hactive, + unsigned short hblank_start, + unsigned short hsync_start, + unsigned short hsync_end, + unsigned short hblank_end, + unsigned short htotal, unsigned short vactive, + unsigned short vblank_start, + unsigned short vsync_start, + unsigned short vsync_end, + unsigned short vblank_end, + unsigned short vtotal, unsigned long frequency); int gfx_set_vtotal(unsigned short vtotal); void gfx_set_display_pitch(unsigned short pitch); void gfx_set_display_offset(unsigned long offset); int gfx_set_display_palette_entry(unsigned long index, - unsigned long palette); + unsigned long palette); int gfx_set_display_palette(unsigned long *palette); void gfx_video_shutdown(void); void gfx_set_clock_frequency(unsigned long frequency); @@ -159,18 +162,19 @@ extern "C" void gfx_set_cursor_enable(int enable); void gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); void gfx_set_cursor_position(unsigned long memoffset, - unsigned short xpos, unsigned short ypos, - unsigned short xhotspot, unsigned short yhotspot); - void gfx_set_cursor_shape32(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask); - void gfx_set_cursor_shape64(unsigned long memoffset, - unsigned long *andmask, unsigned long *xormask); + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, + unsigned short yhotspot); + void gfx_set_cursor_shape32(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask); + void gfx_set_cursor_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask); void gfx_set_icon_enable(int enable); void gfx_set_icon_colors(unsigned long color0, unsigned long color1, - unsigned long color2); + unsigned long color2); void gfx_set_icon_position(unsigned long memoffset, unsigned short xpos); void gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, - unsigned long *xormask, unsigned int lines); + unsigned long *xormask, unsigned int lines); int gfx_set_compression_enable(int enable); int gfx_set_compression_offset(unsigned long offset); @@ -184,30 +188,33 @@ extern "C" void gfx_delay_microseconds(unsigned long microseconds); void gfx_enable_panning(int x, int y); int gfx_is_panel_mode_supported(int panelResX, int panelResY, - unsigned short width, unsigned short height, unsigned short bpp); + unsigned short width, unsigned short height, + unsigned short bpp); int gfx_set_fixed_timings(int panelResX, int panelResY, - unsigned short width, unsigned short height, unsigned short bpp); + unsigned short width, unsigned short height, + unsigned short bpp); int gfx_set_panel_present(int panelResX, int panelResY, - unsigned short width, unsigned short height, unsigned short bpp); + unsigned short width, unsigned short height, + unsigned short bpp); void gfx_reset_timing_lock(void); /* "READ" ROUTINES IN GFX_DISP.C */ int gfx_get_display_details(unsigned int mode, int *xres, int *yres, - int *hz); + int *hz); unsigned short gfx_get_display_pitch(void); int gfx_get_vsa2_softvga_enable(void); int gfx_get_sync_polarities(void); unsigned long gfx_get_clock_frequency(void); unsigned long gfx_get_max_supported_pixel_clock(void); int gfx_mode_frequency_supported(int xres, int yres, int bpp, - unsigned long frequency); + unsigned long frequency); int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, - int *hz, unsigned long frequency); + int *hz, unsigned long frequency); int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, - unsigned long frequency); + unsigned long frequency); int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, - int hz, int *frequency); + int hz, int *frequency); int gfx_get_display_mode_count(void); int gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz); unsigned long gfx_get_frame_buffer_line_size(void); @@ -227,7 +234,7 @@ extern "C" unsigned short gfx_get_display_bpp(void); unsigned long gfx_get_display_offset(void); int gfx_get_display_palette_entry(unsigned long index, - unsigned long *palette); + unsigned long *palette); void gfx_get_display_palette(unsigned long *palette); unsigned long gfx_get_cursor_enable(void); unsigned long gfx_get_cursor_offset(void); @@ -250,44 +257,57 @@ extern "C" void gfx_set_bpp(unsigned short bpp); void gfx_set_solid_pattern(unsigned long color); void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparency); + unsigned long data0, unsigned long data1, + unsigned char transparency); void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned long data2, - unsigned long data3, unsigned char transparency); + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparency); void gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8); void gfx_set_solid_source(unsigned long color); void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent); + unsigned short transparent); void gfx_set_pattern_flags(unsigned short flags); void gfx_set_raster_operation(unsigned char rop); void gfx_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height); + unsigned short width, unsigned short height); void gfx_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern); + unsigned short width, unsigned short height, + unsigned long *pattern); void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height); void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color); + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color); void gfx_color_bitmap_to_screen_blt(unsigned short srcx, - unsigned short srcy, unsigned short dstx, unsigned short dsty, - unsigned short width, unsigned short height, unsigned char *data, - long pitch); + unsigned short srcy, + unsigned short dstx, + unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch); void gfx_color_bitmap_to_screen_xblt(unsigned short srcx, - unsigned short srcy, unsigned short dstx, unsigned short dsty, - unsigned short width, unsigned short height, unsigned char *data, - long pitch, unsigned long color); - void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, - unsigned short srcy, unsigned short dstx, unsigned short dsty, - unsigned short width, unsigned short height, unsigned char *data, - short pitch); + unsigned short srcy, + unsigned short dstx, + unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, long pitch, + unsigned long color); + void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); void gfx_text_blt(unsigned short dstx, unsigned short dsty, - unsigned short width, unsigned short height, unsigned char *data); + unsigned short width, unsigned short height, + unsigned char *data); void gfx_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, - unsigned short flags); + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags); void gfx_wait_until_idle(void); int gfx_test_blt_pending(void); @@ -296,31 +316,39 @@ extern "C" void gfx2_set_source_stride(unsigned short stride); void gfx2_set_destination_stride(unsigned short stride); void gfx2_set_pattern_origin(int x, int y); - void gfx2_set_source_transparency(unsigned long color, - unsigned long mask); + void gfx2_set_source_transparency(unsigned long color, unsigned long mask); void gfx2_set_alpha_mode(int mode); void gfx2_set_alpha_value(unsigned char value); void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height); + unsigned short height); void gfx2_color_pattern_fill(unsigned long dstoffset, - unsigned short width, unsigned short height, unsigned long *pattern); + unsigned short width, unsigned short height, + unsigned long *pattern); void gfx2_screen_to_screen_blt(unsigned long srcoffset, - unsigned long dstoffset, unsigned short width, unsigned short height, - int flags); + unsigned long dstoffset, + unsigned short width, unsigned short height, + int flags); void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, - unsigned short srcy, unsigned long dstoffset, unsigned short width, - unsigned short height, int byte_packed); + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed); void gfx2_color_bitmap_to_screen_blt(unsigned short srcx, - unsigned short srcy, unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data, short pitch); + unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, - unsigned short srcy, unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data, short pitch); + unsigned short srcy, + unsigned long dstoffset, + unsigned short width, + unsigned short height, + unsigned char *data, short pitch); void gfx2_text_blt(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data); + unsigned short height, unsigned char *data); void gfx2_bresenham_line(unsigned long dstoffset, unsigned short length, - unsigned short initerr, unsigned short axialerr, - unsigned short diagerr, unsigned short flags); + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags); void gfx2_sync_to_vblank(void); /* ROUTINES IN GFX_VID.C */ @@ -331,29 +359,31 @@ extern "C" int gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); int gfx_set_video_offset(unsigned long offset); int gfx_set_video_yuv_offsets(unsigned long yoffset, - unsigned long uoffset, unsigned long voffset); + unsigned long uoffset, unsigned long voffset); int gfx_set_video_window(short x, short y, unsigned short w, - unsigned short h); + unsigned short h); int gfx_set_video_left_crop(unsigned short x); int gfx_set_video_upscale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int gfx_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int gfx_set_video_vertical_downscale(unsigned short srch, - unsigned short dsth); + unsigned short dsth); void gfx_set_video_vertical_downscale_enable(int enable); int gfx_set_video_downscale_config(unsigned short type, unsigned short m); int gfx_set_video_color_key(unsigned long key, unsigned long mask, - int bluescreen); + int bluescreen); int gfx_set_video_filter(int xfilter, int yfilter); int gfx_set_video_palette(unsigned long *palette); int gfx_set_graphics_palette(unsigned long *palette); int gfx_set_video_palette_bypass(int enable); int gfx_set_video_palette_entry(unsigned long index, unsigned long color); int gfx_set_graphics_palette_entry(unsigned long index, - unsigned long color); + unsigned long color); int gfx_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4); + unsigned short coef2, + unsigned short coef3, + unsigned short coef4); int gfx_set_video_downscale_enable(int enable); int gfx_set_video_source(VideoSourceType source); int gfx_set_vbi_source(VbiSourceType source); @@ -366,15 +396,15 @@ extern "C" int gfx_set_genlock_delay(unsigned long delay); int gfx_set_genlock_enable(int flags); int gfx_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, - unsigned long color2); + unsigned short select_color2, unsigned long color1, + unsigned long color2); int gfx_set_video_cursor_enable(int enable); int gfx_set_video_request(short x, short y); int gfx_select_alpha_region(int region); int gfx_set_alpha_enable(int enable); int gfx_set_alpha_window(short x, short y, - unsigned short width, unsigned short height); + unsigned short width, unsigned short height); int gfx_set_alpha_value(unsigned char alpha, char delta); int gfx_set_alpha_priority(int priority); int gfx_set_alpha_color(unsigned long color); @@ -394,24 +424,25 @@ extern "C" unsigned long gfx_get_video_xclip(void); unsigned long gfx_get_video_offset(void); void gfx_get_video_yuv_offsets(unsigned long *yoffset, - unsigned long *uoffset, unsigned long *voffset); - void gfx_get_video_yuv_pitch(unsigned long *ypitch, - unsigned long *uvpitch); + unsigned long *uoffset, + unsigned long *voffset); + void gfx_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch); unsigned long gfx_get_video_upscale(void); unsigned long gfx_get_video_scale(void); unsigned long gfx_get_video_downscale_delta(void); int gfx_get_video_vertical_downscale_enable(void); - int gfx_get_video_downscale_config(unsigned short *type, - unsigned short *m); + int gfx_get_video_downscale_config(unsigned short *type, unsigned short *m); void gfx_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4); + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4); void gfx_get_video_downscale_enable(int *enable); unsigned long gfx_get_video_dst_size(void); unsigned long gfx_get_video_position(void); unsigned long gfx_get_video_color_key(void); unsigned long gfx_get_video_color_key_mask(void); int gfx_get_video_palette_entry(unsigned long index, - unsigned long *palette); + unsigned long *palette); int gfx_get_video_color_key_src(void); int gfx_get_video_filter(void); int gfx_get_video_request(short *x, short *y); @@ -425,18 +456,18 @@ extern "C" unsigned long gfx_get_genlock_delay(void); int gfx_get_genlock_enable(void); int gfx_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2); + unsigned short *select_color2, + unsigned long *color1, unsigned short *color2); unsigned long gfx_read_crc(void); unsigned long gfx_read_crc32(void); unsigned long gfx_read_window_crc(int source, unsigned short x, - unsigned short y, unsigned short width, unsigned short height, - int crc32); + unsigned short y, unsigned short width, + unsigned short height, int crc32); int gfx_get_macrovision_enable(void); void gfx_get_alpha_enable(int *enable); void gfx_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height); + unsigned short *width, unsigned short *height); void gfx_get_alpha_value(unsigned char *alpha, char *delta); void gfx_get_alpha_priority(int *priority); void gfx_get_alpha_color(unsigned long *color); @@ -484,12 +515,11 @@ extern "C" int gfx_set_decoder_hue(char hue); int gfx_set_decoder_saturation(unsigned char saturation); int gfx_set_decoder_input_offset(unsigned short x, unsigned short y); - int gfx_set_decoder_input_size(unsigned short width, - unsigned short height); + int gfx_set_decoder_input_size(unsigned short width, unsigned short height); int gfx_set_decoder_output_size(unsigned short width, - unsigned short height); + unsigned short height); int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth); + unsigned short dstw, unsigned short dsth); int gfx_set_decoder_vbi_format(int start, int end, int format); int gfx_set_decoder_vbi_enable(int enable); int gfx_set_decoder_vbi_upscale(void); @@ -514,9 +544,11 @@ extern "C" int gfx_i2c_reset(unsigned char busnum, short adr, char freq); int gfx_i2c_write(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data); + unsigned char subadr, unsigned char bytes, + unsigned char *data); int gfx_i2c_read(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data); + unsigned char subadr, unsigned char bytes, + unsigned char *data); int gfx_i2c_select_gpio(int clock, int data); int gfx_i2c_init(void); void gfx_i2c_cleanup(void); @@ -543,9 +575,12 @@ extern "C" int gfx_get_tv_mode_count(TVStandardType format); int gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz); int gfx_get_tv_display_mode_frequency(unsigned short width, - unsigned short height, TVStandardType format, int *frequency); + unsigned short height, + TVStandardType format, + int *frequency); int gfx_is_tv_display_mode_supported(unsigned short width, - unsigned short height, TVStandardType format); + unsigned short height, + TVStandardType format); int gfx_get_tv_standard(unsigned long *p_standard); int gfx_get_available_tv_standards(unsigned long *p_standards); @@ -582,8 +617,7 @@ extern "C" int gfx_vga_set_pci_command(unsigned char command); int gfx_vga_seq_reset(int reset); int gfx_vga_set_graphics_bits(void); - int gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, - int hz); + int gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, int hz); int gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch); int gfx_vga_save(gfx_vga_struct * vga, int flags); int gfx_vga_restore(gfx_vga_struct * vga, int flags); @@ -595,7 +629,5 @@ extern "C" #ifdef __cplusplus } #endif - -#endif /* !_gfx_rtns_h */ - +#endif /* !_gfx_rtns_h */ /* END OF FILE */ diff --git a/src/gfx/gfx_tv.c b/src/gfx/gfx_tv.c index fb34d60..3ee4a0c 100644 --- a/src/gfx/gfx_tv.c +++ b/src/gfx/gfx_tv.c @@ -50,42 +50,42 @@ DISPLAYMODE TVTimings[] = { /* NTSC resolution */ - {0x3 | /* negative syncs */ - GFX_MODE_TV_NTSC, /* NTSC format */ - 640, 640, 656, 744, 792, 792, /* horizontal timings */ - 480, 480, 490, 492, 517, 525, /* vertical timings */ - 0x0018EC4D, /* freq = 24.923052 MHz */ - } + {0x3 | /* negative syncs */ + GFX_MODE_TV_NTSC, /* NTSC format */ + 640, 640, 656, 744, 792, 792, /* horizontal timings */ + 480, 480, 490, 492, 517, 525, /* vertical timings */ + 0x0018EC4D, /* freq = 24.923052 MHz */ + } , /* PAL resolution */ - {0x3 | /* negative syncs */ - GFX_MODE_TV_PAL, /* PAL format */ - 768, 768, 800, 848, 864, 864, /* horizontal timings */ - 576, 576, 586, 588, 625, 625, /* vertical timings */ - 0x001B0000, /* freq = 27.00 MHz */ - } + {0x3 | /* negative syncs */ + GFX_MODE_TV_PAL, /* PAL format */ + 768, 768, 800, 848, 864, 864, /* horizontal timings */ + 576, 576, 586, 588, 625, 625, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + } , /* NTSC resolution non-square pixels */ - {0x3 | /* negative syncs */ - GFX_MODE_TV_NTSC, /* NTSC format */ - 720, 720, 736, 752, 792, 792, /* horizontal timings */ - 480, 480, 490, 492, 517, 525, /* vertical timings */ - 0x0018EC4D, /* freq = 24.923052 MHz */ - } + {0x3 | /* negative syncs */ + GFX_MODE_TV_NTSC, /* NTSC format */ + 720, 720, 736, 752, 792, 792, /* horizontal timings */ + 480, 480, 490, 492, 517, 525, /* vertical timings */ + 0x0018EC4D, /* freq = 24.923052 MHz */ + } , /* PAL resolution non-square pixels */ - {0x3 | /* negative syncs */ - GFX_MODE_TV_PAL, /* PAL format */ - 720, 720, 752, 816, 864, 864, /* horizontal timings */ - 576, 576, 586, 588, 625, 625, /* vertical timings */ - 0x001B0000, /* freq = 27.00 MHz */ - } + {0x3 | /* negative syncs */ + GFX_MODE_TV_PAL, /* PAL format */ + 720, 720, 752, 816, 864, 864, /* horizontal timings */ + 576, 576, 586, 588, 625, 625, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + } }; #define NUM_TV_MODES sizeof(TVTimings)/sizeof(DISPLAYMODE) @@ -438,7 +438,7 @@ gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) */ int gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, - TVStandardType format, int *frequency) + TVStandardType format, int *frequency) { int retval = -1; @@ -446,7 +446,7 @@ gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, if (gfx_tv_type & GFX_TV_TYPE_SC1200) retval = sc1200_get_tv_display_mode_frequency(width, height, format, - frequency); + frequency); #endif return (retval); } @@ -457,7 +457,7 @@ gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, */ int gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height, - TVStandardType format) + TVStandardType format) { int retval = -1; @@ -831,6 +831,6 @@ gfx_set_aps_trigger_bits(unsigned int trigger_bits) return (retval); } -#endif /* GFX_TV_DYNAMIC */ +#endif /* GFX_TV_DYNAMIC */ /* END OF FILE */ diff --git a/src/gfx/gfx_type.h b/src/gfx/gfx_type.h index 33b6cab..4492354 100644 --- a/src/gfx/gfx_type.h +++ b/src/gfx/gfx_type.h @@ -34,24 +34,21 @@ /* MSR DEFINITIONS */ typedef enum DevStatus -{ FOUND, NOT_KNOWN, REQ_NOT_FOUND, REQ_NOT_INSTALLED } DEV_STATUS; + { FOUND, NOT_KNOWN, REQ_NOT_FOUND, REQ_NOT_INSTALLED } DEV_STATUS; -typedef struct msr -{ - DEV_STATUS Present; /* Node enumeration status */ - unsigned char Id; /* Device ID (from MSR specs) */ - unsigned long Address; /* Address - 32-bit MBus address at */ +typedef struct msr { + DEV_STATUS Present; /* Node enumeration status */ + unsigned char Id; /* Device ID (from MSR specs) */ + unsigned long Address; /* Address - 32-bit MBus address at */ /* which 'Id' is found */ } MSR; -typedef struct mValue -{ +typedef struct mValue { unsigned long high; unsigned long low; } Q_WORD; -typedef struct mbusNode -{ +typedef struct mbusNode { unsigned long address; unsigned int deviceId; unsigned int claimed; @@ -126,14 +123,12 @@ typedef struct mbusNode /* TV DEFINITIONS */ -typedef enum TVStandardType -{ +typedef enum TVStandardType { TV_STANDARD_NTSC = 1, TV_STANDARD_PAL } TVStandardType; -typedef enum GfxOnTVType -{ +typedef enum GfxOnTVType { GFX_ON_TV_SQUARE_PIXELS = 1, GFX_ON_TV_NO_SCALING } GfxOnTVType; @@ -195,14 +190,12 @@ typedef enum GfxOnTVType #define VIDEO_DOWNSCALE_KEEP_1_OF 0x1 #define VIDEO_DOWNSCALE_DROP_1_OF 0x2 -typedef enum VideoSourceType -{ /* The source from which the video processor shows full screen video */ +typedef enum VideoSourceType { /* The source from which the video processor shows full screen video */ VIDEO_SOURCE_MEMORY = 1, VIDEO_SOURCE_DVIP } VideoSourceType; -typedef enum VbiSourceType -{ /* The source from which the video processor takes VBI */ +typedef enum VbiSourceType { /* The source from which the video processor takes VBI */ VBI_SOURCE_MEMORY = 1, VBI_SOURCE_DVIP } VbiSourceType; @@ -281,8 +274,7 @@ typedef enum VbiSourceType #define GFX_APS_TRIGGER_AGC_2_LINE 2 #define GFX_APS_TRIGGER_AGC_4_LINE 3 -typedef struct -{ +typedef struct { int xsize; int ysize; int hz; @@ -312,8 +304,7 @@ typedef struct /* CHIP NAME AND REVISION */ -typedef enum ChipType -{ +typedef enum ChipType { CHIP_NOT_DETECTED, SC1200_REV_A, SC1200_REV_B1_B2, @@ -321,9 +312,9 @@ typedef enum ChipType SC1200_REV_C1, SC1200_REV_D1, SC1200_REV_D1_1, - SC1200_REV_D2_MVD, /* Macrovision disabled */ - SC1200_REV_D2_MVE, /* Macrovision enabled */ + SC1200_REV_D2_MVD, /* Macrovision disabled */ + SC1200_REV_D2_MVE, /* Macrovision enabled */ SC1200_FUTURE_REV } ChipType; -#endif /* !_gfx_type_h */ +#endif /* !_gfx_type_h */ diff --git a/src/gfx/gfx_vga.c b/src/gfx/gfx_vga.c index 8ab9b6a..101c7a8 100644 --- a/src/gfx/gfx_vga.c +++ b/src/gfx/gfx_vga.c @@ -40,6 +40,6 @@ #if GFX_VGA_DYNAMIC -#endif /* GFX_DISPLAY_DYNAMIC */ +#endif /* GFX_DISPLAY_DYNAMIC */ /* END OF FILE */ diff --git a/src/gfx/gfx_vid.c b/src/gfx/gfx_vid.c index 41fef74..15f0048 100644 --- a/src/gfx/gfx_vid.c +++ b/src/gfx/gfx_vid.c @@ -129,23 +129,23 @@ /* STATIC VARIABLES FOR VIDEO OVERLAY CONTROL */ /* These are saved to allow these routines to do clipping. */ -unsigned long gfx_vid_offset = 0; /* copy from last gfx_set_video_offset */ -unsigned long gfx_vid_uoffset = 0; /* copy from last - * gfx_set_video_yuv_offsets */ -unsigned long gfx_vid_voffset = 0; /* copy from last - * gfx_set_video_yuv_offsets */ -unsigned long gfx_vid_srcw = 300; /* copy from last gfx_set_video_scale */ -unsigned long gfx_vid_srch = 300; /* copy from last gfx_set_video_scale */ -unsigned long gfx_vid_dstw = 300; /* copy from last gfx_set_video_scale */ -unsigned long gfx_vid_dsth = 300; /* copy from last gfx_set_video_scale */ -short gfx_vid_xpos = 0; /* copy from last gfx_set_video_window */ -short gfx_vid_ypos = 0; /* copy from last gfx_set_video_window */ -unsigned short gfx_vid_width = 0; /* copy from last gfx_set_video_window */ -unsigned short gfx_vid_height = 0; /* copy from last gfx_set_video_window */ - -int gfx_alpha_select = 0; /* currently selected alpha region */ - -int gfx_set_screen_enable(int enable); /* forward declaration */ +unsigned long gfx_vid_offset = 0; /* copy from last gfx_set_video_offset */ +unsigned long gfx_vid_uoffset = 0; /* copy from last + * gfx_set_video_yuv_offsets */ +unsigned long gfx_vid_voffset = 0; /* copy from last + * gfx_set_video_yuv_offsets */ +unsigned long gfx_vid_srcw = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_srch = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_dstw = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_dsth = 300; /* copy from last gfx_set_video_scale */ +short gfx_vid_xpos = 0; /* copy from last gfx_set_video_window */ +short gfx_vid_ypos = 0; /* copy from last gfx_set_video_window */ +unsigned short gfx_vid_width = 0; /* copy from last gfx_set_video_window */ +unsigned short gfx_vid_height = 0; /* copy from last gfx_set_video_window */ + +int gfx_alpha_select = 0; /* currently selected alpha region */ + +int gfx_set_screen_enable(int enable); /* forward declaration */ /* INCLUDE SUPPORT FOR CS5530, IF SPECIFIED. */ @@ -420,7 +420,7 @@ gfx_set_video_offset(unsigned long offset) */ int gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, - unsigned long voffset) + unsigned long voffset) { int status = GFX_STATUS_UNSUPPORTED; @@ -437,7 +437,7 @@ gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, */ int gfx_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) { int status = GFX_STATUS_UNSUPPORTED; @@ -462,7 +462,7 @@ gfx_set_video_scale(unsigned short srcw, unsigned short srch, */ int gfx_set_video_upscale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) { int status = GFX_STATUS_UNSUPPORTED; @@ -528,21 +528,21 @@ gfx_set_video_downscale_config(unsigned short type, unsigned short m) */ int gfx_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4) + unsigned short coef2, unsigned short coef3, + unsigned short coef4) { int status = GFX_STATUS_UNSUPPORTED; #if GFX_VIDEO_SC1200 if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) status = - sc1200_set_video_downscale_coefficients(coef1, coef2, coef3, - coef4); + sc1200_set_video_downscale_coefficients(coef1, coef2, coef3, coef4); #endif #if GFX_VIDEO_REDCLOUD if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) status = redcloud_set_video_downscale_coefficients(coef1, coef2, coef3, - coef4); + coef4); #endif return (status); } @@ -951,7 +951,8 @@ gfx_set_genlock_enable(int flags) */ int gfx_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, unsigned long color2) + unsigned short select_color2, unsigned long color1, + unsigned long color2) { int status = GFX_STATUS_UNSUPPORTED; @@ -963,8 +964,7 @@ gfx_set_video_cursor(unsigned long key, unsigned long mask, #if GFX_VIDEO_REDCLOUD if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) status = - redcloud_set_video_cursor(key, mask, select_color2, color1, - color2); + redcloud_set_video_cursor(key, mask, select_color2, color1, color2); #endif return (status); } @@ -1011,7 +1011,7 @@ gfx_set_alpha_enable(int enable) */ int gfx_set_alpha_window(short x, short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) { int status = GFX_STATUS_UNSUPPORTED; @@ -1451,7 +1451,7 @@ gfx_get_video_offset(void) */ void gfx_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, - unsigned long *voffset) + unsigned long *voffset) { #if GFX_VIDEO_REDCLOUD if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) @@ -1570,7 +1570,9 @@ gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) */ void gfx_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) { #if GFX_VIDEO_SC1200 if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) @@ -1802,7 +1804,7 @@ gfx_get_vbi_source(VbiSourceType * source) unsigned long gfx_get_vbi_lines(int odd) { - unsigned long lines = (unsigned long)GFX_STATUS_UNSUPPORTED; + unsigned long lines = (unsigned long) GFX_STATUS_UNSUPPORTED; #if GFX_VIDEO_SC1200 if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) @@ -1818,7 +1820,7 @@ gfx_get_vbi_lines(int odd) unsigned long gfx_get_vbi_total(int odd) { - unsigned long total = (unsigned long)GFX_STATUS_UNSUPPORTED; + unsigned long total = (unsigned long) GFX_STATUS_UNSUPPORTED; #if GFX_VIDEO_SC1200 if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) @@ -1882,7 +1884,7 @@ gfx_get_vertical_scaler_offset(char *offset) unsigned long gfx_get_genlock_delay(void) { - unsigned long delay = (unsigned long)GFX_STATUS_UNSUPPORTED; + unsigned long delay = (unsigned long) GFX_STATUS_UNSUPPORTED; #if GFX_VIDEO_SC1200 if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) @@ -1913,8 +1915,8 @@ gfx_get_genlock_enable(void) */ int gfx_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2) + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) { int enable = GFX_STATUS_UNSUPPORTED; @@ -1926,8 +1928,7 @@ gfx_get_video_cursor(unsigned long *key, unsigned long *mask, #if GFX_VIDEO_REDCLOUD if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) enable = - redcloud_get_video_cursor(key, mask, select_color2, color1, - color2); + redcloud_get_video_cursor(key, mask, select_color2, color1, color2); #endif return (enable); } @@ -1978,7 +1979,7 @@ gfx_read_crc32(void) */ unsigned long gfx_read_window_crc(int source, unsigned short x, unsigned short y, - unsigned short width, unsigned short height, int crc32) + unsigned short width, unsigned short height, int crc32) { unsigned long crc = 0; @@ -2029,7 +2030,7 @@ gfx_get_alpha_enable(int *enable) */ void gfx_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height) + unsigned short *width, unsigned short *height) { #if GFX_VIDEO_SC1200 if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) @@ -2096,8 +2097,8 @@ gfx_get_alpha_color(unsigned long *color) return; } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ -#endif /* GFX_VIDEO_DYNAMIC */ +#endif /* GFX_VIDEO_DYNAMIC */ /* END OF FILE */ diff --git a/src/gfx/gfx_vip.c b/src/gfx/gfx_vip.c index e38c2f7..d3994a6 100644 --- a/src/gfx/gfx_vip.c +++ b/src/gfx/gfx_vip.c @@ -524,8 +524,8 @@ gfx_get_vip_bus_request_threshold_high(void) return (enable); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ -#endif /* GFX_VIP_DYNAMIC */ +#endif /* GFX_VIP_DYNAMIC */ /* END OF FILE */ diff --git a/src/gfx/i2c_acc.c b/src/gfx/i2c_acc.c index a45a2c3..f6a0b2f 100644 --- a/src/gfx/i2c_acc.c +++ b/src/gfx/i2c_acc.c @@ -48,15 +48,15 @@ unsigned short index_reg, data_reg; /* ACCESS BUS DEFINITIONS */ -#define ACC_I2C_TIMEOUT 1000000 /* Number of reads before timing out */ -#define ACB1_BASE 0x810 /* ACCESS.bus base addresses */ +#define ACC_I2C_TIMEOUT 1000000 /* Number of reads before timing out */ +#define ACB1_BASE 0x810 /* ACCESS.bus base addresses */ #define ACB2_BASE 0x820 -#define ACBSDA 0 /* ACB serial data */ -#define ACBST 1 /* ACB status */ -#define ACBCST 2 /* ACB control status */ -#define ACBCTL1 3 /* ACB control 1 */ -#define ACBADDR 4 /* ACB own address */ -#define ACBCTL2 5 /* ACB control 2 */ +#define ACBSDA 0 /* ACB serial data */ +#define ACBST 1 /* ACB status */ +#define ACBCST 2 /* ACB control status */ +#define ACBCTL1 3 /* ACB control 1 */ +#define ACBADDR 4 /* ACB own address */ +#define ACBCTL2 5 /* ACB control 2 */ #define LDN 0x7 /* Logical Device Numbers */ #define ACB1_LDN 0x5 #define ACB2_LDN 0x6 @@ -64,6 +64,7 @@ unsigned short index_reg, data_reg; /* INITIAL ACCESS.bus BASE ADDRESS VALUES */ unsigned short base_address_array[3] = { 0, ACB1_BASE, ACB2_BASE }; + char Freq = 0x71; /* LOCAL ACCESS.bus FUNCTION DECLARATIONS */ @@ -88,7 +89,7 @@ unsigned short acc_i2c_set_base_address(unsigned char busnum, short adr); /* LOCAL HELPER ROUTINES */ void OsPciReadDWord(int bus, int dev, int func, int address, - unsigned long *data); + unsigned long *data); int sio_set_index_data_reg(void); void sio_write_reg(unsigned char reg, unsigned char data); unsigned char sio_read_reg(unsigned char reg); @@ -112,8 +113,8 @@ OsPciReadDWord(int bus, int dev, int func, int address, unsigned long *data) * {10000000,bus[23:16],device[15:11],function[10:8],address[7:2],00} */ long addr = (0x80000000 | - ((bus & 0xff) << 16) | - ((dev & 0x1f) << 11) | ((func & 0x7) << 8) | (address & 0xff)); + ((bus & 0xff) << 16) | + ((dev & 0x1f) << 11) | ((func & 0x7) << 8) | (address & 0xff)); OUTD(PCI_INDEX, addr); *data = IND(PCI_DATA); } @@ -135,7 +136,7 @@ sio_set_index_data_reg(void) OsPciReadDWord(0, 0x12, 5, 0x10, &xbus_expention_bar); xbus_expention_bar = xbus_expention_bar & 0xfffffffe; - io_control_reg1 = IND((unsigned short)xbus_expention_bar); + io_control_reg1 = IND((unsigned short) xbus_expention_bar); if ((io_control_reg1) & (SIO_BASE_ADR_15C_15D)) { index_reg = INDEX_1; @@ -240,11 +241,11 @@ gfx_i2c_select_gpio(int clock, int data) #if GFX_I2C_DYNAMIC int acc_i2c_write(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data) + unsigned char subadr, unsigned char bytes, unsigned char *data) #else int gfx_i2c_write(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data) + unsigned char subadr, unsigned char bytes, unsigned char *data) #endif { int loop = 0; @@ -261,7 +262,7 @@ gfx_i2c_write(unsigned char busnum, unsigned char chipadr, acc_i2c_ack(busnum, 1, 0); acc_i2c_stall_after_start(busnum, 1); - acc_i2c_send_address(busnum, (unsigned char)(chipadr & 0xFE)); + acc_i2c_send_address(busnum, (unsigned char) (chipadr & 0xFE)); acc_i2c_stall_after_start(busnum, 0); if (!acc_i2c_ack(busnum, 0, 0)) return (GFX_STATUS_ERROR); @@ -297,11 +298,11 @@ gfx_i2c_write(unsigned char busnum, unsigned char chipadr, #if GFX_I2C_DYNAMIC int acc_i2c_read(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data) + unsigned char subadr, unsigned char bytes, unsigned char *data) #else int gfx_i2c_read(unsigned char busnum, unsigned char chipadr, - unsigned char subadr, unsigned char bytes, unsigned char *data) + unsigned char subadr, unsigned char bytes, unsigned char *data) #endif { unsigned char bytesRead; @@ -321,7 +322,7 @@ gfx_i2c_read(unsigned char busnum, unsigned char chipadr, acc_i2c_ack(busnum, 1, 0); acc_i2c_stall_after_start(busnum, 1); - acc_i2c_send_address(busnum, (unsigned char)(chipadr & 0xFE)); + acc_i2c_send_address(busnum, (unsigned char) (chipadr & 0xFE)); acc_i2c_stall_after_start(busnum, 0); if (!acc_i2c_ack(busnum, 0, 0)) return (GFX_STATUS_ERROR); @@ -340,7 +341,7 @@ gfx_i2c_read(unsigned char busnum, unsigned char chipadr, acc_i2c_ack(busnum, 1, 1); acc_i2c_stall_after_start(busnum, 1); - acc_i2c_send_address(busnum, (unsigned char)(chipadr | 0x01)); + acc_i2c_send_address(busnum, (unsigned char) (chipadr | 0x01)); /* IF LAST BYTE */ @@ -360,11 +361,13 @@ gfx_i2c_read(unsigned char busnum, unsigned char chipadr, if (bytesRead < (bytes - 2)) { data[bytesRead] = acc_i2c_read_byte(busnum, 0); acc_i2c_ack(busnum, 1, 0); - } else if (bytesRead == (bytes - 2)) { /* TWO BYTES LEFT */ + } + else if (bytesRead == (bytes - 2)) { /* TWO BYTES LEFT */ acc_i2c_ack(busnum, 1, 1); data[bytesRead] = acc_i2c_read_byte(busnum, 0); acc_i2c_ack(busnum, 1, 1); - } else { /* LAST BYTE */ + } + else { /* LAST BYTE */ data[bytesRead] = acc_i2c_read_byte(busnum, 1); acc_i2c_stop(busnum); @@ -432,32 +435,32 @@ acc_i2c_reset_bus(unsigned char busnum) /* Disable the ACCESS.bus device and */ /* Configure the SCL frequency */ - OUTB((unsigned short)(bus_base_address + ACBCTL2), - (unsigned char)(Freq & 0xFE)); + OUTB((unsigned short) (bus_base_address + ACBCTL2), + (unsigned char) (Freq & 0xFE)); /* Configure no interrupt mode (polling) and */ /* Disable global call address */ - OUTB((unsigned short)(bus_base_address + ACBCTL1), 0x0); + OUTB((unsigned short) (bus_base_address + ACBCTL1), 0x0); /* Disable slave address */ - OUTB((unsigned short)(bus_base_address + ACBADDR), 0x0); + OUTB((unsigned short) (bus_base_address + ACBADDR), 0x0); /* Enable the ACCESS.bus device */ - reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg = INB((unsigned short) (bus_base_address + ACBCTL2)); reg |= 0x01; - OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL2), reg); /* Issue STOP event */ acc_i2c_stop(busnum); /* Clear NEGACK, STASTR and BER bits */ - OUTB((unsigned short)(bus_base_address + ACBST), 0x38); + OUTB((unsigned short) (bus_base_address + ACBST), 0x38); /* Clear BB (BUS BUSY) bit */ - reg = INB((unsigned short)(bus_base_address + ACBCST)); + reg = INB((unsigned short) (bus_base_address + ACBCST)); reg |= 0x02; - OUTB((unsigned short)(bus_base_address + ACBCST), reg); + OUTB((unsigned short) (bus_base_address + ACBCST), reg); } /*--------------------------------------------------------------------------- @@ -472,9 +475,9 @@ acc_i2c_start(unsigned char busnum) unsigned char reg; unsigned short bus_base_address = base_address_array[busnum]; - reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg = INB((unsigned short) (bus_base_address + ACBCTL1)); reg |= 0x01; - OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL1), reg); } /*--------------------------------------------------------------------------- @@ -489,9 +492,9 @@ acc_i2c_stop(unsigned char busnum) unsigned char reg; unsigned short bus_base_address = base_address_array[busnum]; - reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg = INB((unsigned short) (bus_base_address + ACBCTL1)); reg |= 0x02; - OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL1), reg); } /*--------------------------------------------------------------------------- @@ -505,9 +508,9 @@ acc_i2c_abort_data(unsigned char busnum) unsigned short bus_base_address = base_address_array[busnum]; acc_i2c_stop(busnum); - reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg = INB((unsigned short) (bus_base_address + ACBCTL1)); reg |= 0x10; - OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL1), reg); } /*--------------------------------------------------------------------------- @@ -531,17 +534,17 @@ acc_i2c_stall_after_start(unsigned char busnum, int state) unsigned char reg; unsigned short bus_base_address = base_address_array[busnum]; - reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg = INB((unsigned short) (bus_base_address + ACBCTL1)); if (state) reg |= 0x80; else reg &= 0x7F; - OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL1), reg); if (!state) { - reg = INB((unsigned short)(bus_base_address + ACBST)); + reg = INB((unsigned short) (bus_base_address + ACBST)); reg |= 0x08; - OUTB((unsigned short)(bus_base_address + ACBST), reg); + OUTB((unsigned short) (bus_base_address + ACBST), reg); } } @@ -558,10 +561,10 @@ acc_i2c_send_address(unsigned char busnum, unsigned char cData) /* WRITE THE DATA */ - OUTB((unsigned short)(bus_base_address + ACBSDA), cData); + OUTB((unsigned short) (bus_base_address + ACBSDA), cData); while (1) { - reg = INB((unsigned short)(bus_base_address + ACBST)); - if ((reg & 0x38) != 0) /* check STASTR, BER and NEGACK */ + reg = INB((unsigned short) (bus_base_address + ACBST)); + if ((reg & 0x38) != 0) /* check STASTR, BER and NEGACK */ break; if (timeout++ == ACC_I2C_TIMEOUT) { acc_i2c_bus_recovery(busnum); @@ -598,23 +601,25 @@ acc_i2c_ack(unsigned char busnum, int fPut, int negAck) unsigned short bus_base_address = base_address_array[busnum]; unsigned long timeout = 0; - if (fPut) { /* read operation */ + if (fPut) { /* read operation */ if (!negAck) { /* Push Ack onto I2C bus */ - reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg = INB((unsigned short) (bus_base_address + ACBCTL1)); reg &= 0xE7; - OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); - } else { + OUTB((unsigned short) (bus_base_address + ACBCTL1), reg); + } + else { /* Push negAck onto I2C bus */ - reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg = INB((unsigned short) (bus_base_address + ACBCTL1)); reg |= 0x10; - OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL1), reg); } - } else { /* write operation */ + } + else { /* write operation */ /* Receive Ack from I2C bus */ while (1) { - reg = INB((unsigned short)(bus_base_address + ACBST)); - if ((reg & 0x70) != 0) /* check SDAST, BER and NEGACK */ + reg = INB((unsigned short) (bus_base_address + ACBST)); + if ((reg & 0x70) != 0) /* check SDAST, BER and NEGACK */ break; if (timeout++ == ACC_I2C_TIMEOUT) { acc_i2c_bus_recovery(busnum); @@ -651,9 +656,9 @@ acc_i2c_stop_clock(unsigned char busnum) unsigned char reg; unsigned short bus_base_address = base_address_array[busnum]; - reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg = INB((unsigned short) (bus_base_address + ACBCTL2)); reg &= ~0x01; - OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL2), reg); } /*--------------------------------------------------------------------------- @@ -668,9 +673,9 @@ acc_i2c_activate_clock(unsigned char busnum) unsigned char reg; unsigned short bus_base_address = base_address_array[busnum]; - reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg = INB((unsigned short) (bus_base_address + ACBCTL2)); reg |= 0x01; - OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); + OUTB((unsigned short) (bus_base_address + ACBCTL2), reg); } /*--------------------------------------------------------------------------- @@ -687,7 +692,7 @@ acc_i2c_write_byte(unsigned char busnum, unsigned char cData) unsigned long timeout = 0; while (1) { - reg = INB((unsigned short)(bus_base_address + ACBST)); + reg = INB((unsigned short) (bus_base_address + ACBST)); if (reg & 0x70) break; if (timeout++ == ACC_I2C_TIMEOUT) { @@ -712,7 +717,7 @@ acc_i2c_write_byte(unsigned char busnum, unsigned char cData) /* WRITE THE DATA */ - OUTB((unsigned short)(bus_base_address + ACBSDA), cData); + OUTB((unsigned short) (bus_base_address + ACBSDA), cData); } /*--------------------------------------------------------------------------- @@ -729,7 +734,7 @@ acc_i2c_read_byte(unsigned char busnum, int last_byte) unsigned long timeout = 0; while (1) { - reg = INB((unsigned short)(bus_base_address + ACBST)); + reg = INB((unsigned short) (bus_base_address + ACBST)); if (reg & 0x60) break; if (timeout++ == ACC_I2C_TIMEOUT) { @@ -748,7 +753,7 @@ acc_i2c_read_byte(unsigned char busnum, int last_byte) /* READ DATA */ if (last_byte) acc_i2c_stop_clock(busnum); - cData = INB((unsigned short)(bus_base_address + ACBSDA)); + cData = INB((unsigned short) (bus_base_address + ACBSDA)); if (last_byte) acc_i2c_activate_clock(busnum); @@ -768,7 +773,7 @@ acc_i2c_request_master(unsigned char busnum) acc_i2c_start(busnum); while (1) { - reg = INB((unsigned short)(bus_base_address + ACBST)); + reg = INB((unsigned short) (bus_base_address + ACBST)); if (reg & 0x60) break; if (timeout++ == ACC_I2C_TIMEOUT) { @@ -821,7 +826,7 @@ acc_i2c_set_freq(unsigned char busnum, char freq) { unsigned short bus_base_address = base_address_array[busnum]; - OUTB((unsigned short)(bus_base_address + ACBCTL2), 0x0); + OUTB((unsigned short) (bus_base_address + ACBCTL2), 0x0); if (freq == -1) freq = 0x71; @@ -830,7 +835,7 @@ acc_i2c_set_freq(unsigned char busnum, char freq) freq |= 0x01; } - OUTB((unsigned short)(bus_base_address + ACBCTL2), freq); + OUTB((unsigned short) (bus_base_address + ACBCTL2), freq); return (freq); } @@ -867,8 +872,8 @@ acc_i2c_set_base_address(unsigned char busnum, short adr) } /* Set ACCESS.bus base address */ - sio_write_reg(BASE_ADR_LSB_REG, (unsigned char)(adr & 0xFF)); - sio_write_reg(BASE_ADR_MSB_REG, (unsigned char)(adr >> 8)); + sio_write_reg(BASE_ADR_LSB_REG, (unsigned char) (adr & 0xFF)); + sio_write_reg(BASE_ADR_MSB_REG, (unsigned char) (adr >> 8)); return adr; } diff --git a/src/gfx/i2c_gpio.c b/src/gfx/i2c_gpio.c index 7614cd0..9774a8d 100644 --- a/src/gfx/i2c_gpio.c +++ b/src/gfx/i2c_gpio.c @@ -35,11 +35,11 @@ int gpio_data = 0; static int g_initialized = 0; -#define I2CWRITE 0x00 /* Write address */ -#define I2CREAD 0x01 /* Read address */ +#define I2CWRITE 0x00 /* Write address */ +#define I2CREAD 0x01 /* Read address */ -#define I2CACK 0x00 /* Ack value */ -#define I2CNACK 0x01 /* Not - ack value */ +#define I2CACK 0x00 /* Ack value */ +#define I2CNACK 0x01 /* Not - ack value */ #define CS5530_ID (0x80000000 | (0x00<<16) | (0x12<<11) | (0<<8) | 0x00) #define CS5530_GPIO (0x80000000 | (0x00<<16) | (0x12<<11) | (0<<8) | 0x90) @@ -52,9 +52,9 @@ int I2C_init(void); void I2C_cleanup(void); int I2C_Read(unsigned char address, unsigned int reg, unsigned long *p_value, - unsigned int bytes); + unsigned int bytes); int I2C_Write(unsigned char address, unsigned int reg, unsigned long value, - unsigned int bytes); + unsigned int bytes); int I2CAL_init(void); void I2CAL_cleanup(void); @@ -123,11 +123,11 @@ gfx_i2c_select_gpio(int clock, int data) #if GFX_I2C_DYNAMIC int gpio_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, - unsigned char bytes, unsigned char *value) + unsigned char bytes, unsigned char *value) #else int gfx_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, - unsigned char bytes, unsigned char *value) + unsigned char bytes, unsigned char *value) #endif { /* ### ADD ### CODE TO WRITE BYTE TO I2B BUS */ @@ -139,13 +139,13 @@ gfx_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, /* The address is shifted left by one to make room for Read/Write * bit */ SendI2CStart(); - SendI2CData((char)((address << 1) | I2CWRITE)); + SendI2CData((char) ((address << 1) | I2CWRITE)); if (!ReceiveI2CAck()) { SendI2CStop(); gfx_delay_milliseconds(10); continue; } - SendI2CData((unsigned char)reg); + SendI2CData((unsigned char) reg); if (!ReceiveI2CAck()) { SendI2CStop(); gfx_delay_milliseconds(10); @@ -189,11 +189,11 @@ gfx_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, #if GFX_I2C_DYNAMIC int gpio_i2c_read(unsigned char busnum, unsigned char address, unsigned char reg, - unsigned char bytes, unsigned char *p_value) + unsigned char bytes, unsigned char *p_value) #else int gfx_i2c_read(unsigned char busnum, unsigned char address, unsigned char reg, - unsigned char bytes, unsigned char *p_value) + unsigned char bytes, unsigned char *p_value) #endif { /* ### ADD ### CODE TO WRITE BYTE TO I2B BUS */ @@ -209,18 +209,18 @@ gfx_i2c_read(unsigned char busnum, unsigned char address, unsigned char reg, /* The address is shifted left by one to make room for Read/Write * bit */ SendI2CStart(); - SendI2CData((char)((address << 1) | I2CWRITE)); + SendI2CData((char) ((address << 1) | I2CWRITE)); if (!ReceiveI2CAck()) { SendI2CStop(); gfx_delay_milliseconds(10); continue; } - SendI2CData((unsigned char)(reg & 0xFF)); + SendI2CData((unsigned char) (reg & 0xFF)); SendI2CNack(); /* read the first data byte. */ SendI2CStart(); - SendI2CData((char)((address << 1) | I2CREAD)); + SendI2CData((char) ((address << 1) | I2CREAD)); if (!ReceiveI2CAck()) { SendI2CStop(); gfx_delay_milliseconds(10); @@ -490,7 +490,7 @@ I2CAL_init(void) return 1; l_reg = gfx_pci_config_read(CS5530_GPIO); - reg = (unsigned short)l_reg; + reg = (unsigned short) l_reg; /* both outputs, both high. */ reg |= (SDADIR | SCLDIR | SDA | SCL); @@ -525,11 +525,12 @@ I2CAL_output_clock(int inState) unsigned long value; value = gfx_pci_config_read(CS5530_GPIO); - reg = (unsigned short)value; + reg = (unsigned short) value; - if (inState) { /* write a 1. */ + if (inState) { /* write a 1. */ reg |= SCL; - } else { /* write a 0. */ + } + else { /* write a 0. */ reg &= ~SCL; } @@ -554,11 +555,12 @@ I2CAL_output_data(int inState) unsigned long value; value = gfx_pci_config_read(CS5530_GPIO); - reg = (unsigned short)value; + reg = (unsigned short) value; - if (inState) { /* write a 1. */ + if (inState) { /* write a 1. */ reg |= SDA; - } else { + } + else { /* write a 0. */ reg &= ~SDA; } @@ -583,7 +585,7 @@ I2CAL_input_data(void) unsigned long value; value = gfx_pci_config_read(CS5530_GPIO); - reg = (unsigned short)value; + reg = (unsigned short) value; if (reg & SDA) return 1; @@ -605,7 +607,7 @@ I2CAL_set_data_for_input(void) unsigned long value; value = gfx_pci_config_read(CS5530_GPIO); - reg = (unsigned short)value; + reg = (unsigned short) value; reg &= ~SDADIR; @@ -628,7 +630,7 @@ I2CAL_set_data_for_output(void) unsigned long value; value = gfx_pci_config_read(CS5530_GPIO); - reg = (unsigned short)value; + reg = (unsigned short) value; reg |= SDADIR; value = reg; diff --git a/src/gfx/init_gu1.c b/src/gfx/init_gu1.c index e7d9987..647fab5 100644 --- a/src/gfx/init_gu1.c +++ b/src/gfx/init_gu1.c @@ -43,7 +43,7 @@ gfx_gxm_config_read(unsigned char index) OUTB(0x22, GXM_CONFIG_CCR3); lock = INB(0x23); OUTB(0x22, GXM_CONFIG_CCR3); - OUTB(0x23, (unsigned char)(lock | 0x10)); + OUTB(0x23, (unsigned char) (lock | 0x10)); OUTB(0x22, index); value = INB(0x23); OUTB(0x22, GXM_CONFIG_CCR3); @@ -103,7 +103,8 @@ gfx_get_core_freq(void) default: return (0); } - } else { + } + else { switch (dir0) { case 0: case 2: @@ -150,7 +151,7 @@ gfx_get_cpu_register_base(void) { unsigned long base; - base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (unsigned long) gfx_gxm_config_read(GXM_CONFIG_GCR); base = (base & 0x03) << 30; return (base); } @@ -175,7 +176,7 @@ gfx_get_frame_buffer_base(void) { unsigned long base; - base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (unsigned long) gfx_gxm_config_read(GXM_CONFIG_GCR); base = (base & 0x03) << 30; if (base) base |= 0x00800000; @@ -225,7 +226,7 @@ gfx_get_vid_register_base(void) { unsigned long base; - base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (unsigned long) gfx_gxm_config_read(GXM_CONFIG_GCR); base = (base & 0x03) << 30; if (base) base |= 0x00010000; @@ -254,7 +255,7 @@ gfx_get_vip_register_base(void) unsigned long base = 0; if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200) { - base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (unsigned long) gfx_gxm_config_read(GXM_CONFIG_GCR); base = (base & 0x03) << 30; if (base) base |= 0x00015000; diff --git a/src/gfx/init_gu2.c b/src/gfx/init_gu2.c index 0bbb064..72a16c8 100644 --- a/src/gfx/init_gu2.c +++ b/src/gfx/init_gu2.c @@ -50,7 +50,7 @@ gfx_get_core_freq(void) OUTW(0xAC1C, 0xFC53); OUTW(0xAC1C, 0x1201); - value = (unsigned long)(INW(0xAC1E)); + value = (unsigned long) (INW(0xAC1E)); return (value); } @@ -129,7 +129,7 @@ gfx_get_frame_buffer_size(void) OUTW(0xAC1C, 0xFC53); OUTW(0xAC1C, 0x0200); - value = (unsigned long)(INW(0xAC1E)) & 0xFFl; + value = (unsigned long) (INW(0xAC1E)) & 0xFFl; return (value << 19); } diff --git a/src/gfx/msr_rdcl.c b/src/gfx/msr_rdcl.c index 548e8a4..2f85e6a 100644 --- a/src/gfx/msr_rdcl.c +++ b/src/gfx/msr_rdcl.c @@ -27,7 +27,7 @@ * This file contains MSR access routines for Redcloud. * */ -void redcloud_build_mbus_tree(void); /* private routine definition */ +void redcloud_build_mbus_tree(void); /* private routine definition */ int redcloud_init_msr_devices(MSR aDev[], unsigned int array_size); /* private routine definition */ @@ -212,7 +212,7 @@ redcloud_build_mbus_tree(void) MBIU0[port].deviceId = NOT_POPULATED; else { MSR_READ(MBD_MSR_CAP, MBIU0[port].address, &(msrValue.high), - &(msrValue.low)); + &(msrValue.low)); MBIU0[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); } } @@ -253,7 +253,7 @@ redcloud_build_mbus_tree(void) MBIU1[port].deviceId = NOT_POPULATED; else { MSR_READ(MBD_MSR_CAP, MBIU1[port].address, &(msrValue.high), - &(msrValue.low)); + &(msrValue.low)); MBIU1[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); } } @@ -273,8 +273,7 @@ redcloud_build_mbus_tree(void) /* Query the MBIU for the port through which we are communicating. */ /* We will avoid accesses to this port to avoid a self-reference. */ - MSR_READ(MBIU_WHOAMI, CP_MB0_MBIU0, &(msrValue.high), - &(msrValue.low)); + MSR_READ(MBIU_WHOAMI, CP_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); reflective = msrValue.low & WHOAMI_MASK; /* ENUMERATE ALL PORTS */ @@ -298,12 +297,13 @@ redcloud_build_mbus_tree(void) MBIU2[port].deviceId = NOT_POPULATED; else { MSR_READ(MBD_MSR_CAP, MBIU2[port].address, &(msrValue.high), - &(msrValue.low)); + &(msrValue.low)); MBIU2[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); } } - } else { + } + else { /* NO 5535 */ /* If the CS5535 is not installed, fill in the cached table */ /* with the 'NOT_INSTALLED' flag. Also, fill in the device */ @@ -544,10 +544,12 @@ gfx_get_glink_id_at_address(unsigned int *device, unsigned long address) if (MBIU0[port].address == address) { *device = MBIU0[port].deviceId; return FOUND; - } else if (MBIU1[port].address == address) { + } + else if (MBIU1[port].address == address) { *device = MBIU1[port].deviceId; return FOUND; - } else if (MBIU2[port].address == address) { + } + else if (MBIU2[port].address == address) { *device = MBIU2[port].deviceId; return FOUND; } @@ -577,7 +579,7 @@ gfx_get_glink_id_at_address(unsigned int *device, unsigned long address) #if GFX_MSR_DYNAMIC DEV_STATUS redcloud_msr_read(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue) + Q_WORD * msrValue) #else DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) @@ -586,7 +588,7 @@ gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) if (device < NUM_DEVS) { if (msrDev[device].Present == FOUND) MSR_READ(msrRegister, msrDev[device].Address, &(msrValue->high), - &(msrValue->low)); + &(msrValue->low)); return msrDev[device].Present; } @@ -614,17 +616,16 @@ gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) #if GFX_MSR_DYNAMIC DEV_STATUS redcloud_msr_write(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue) + Q_WORD * msrValue) #else DEV_STATUS -gfx_msr_write(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue) +gfx_msr_write(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) #endif { if (device < NUM_DEVS) { if (msrDev[device].Present == FOUND) MSR_WRITE(msrRegister, msrDev[device].Address, &(msrValue->high), - &(msrValue->low)); + &(msrValue->low)); return msrDev[device].Present; } diff --git a/src/gfx/rndr_gu1.c b/src/gfx/rndr_gu1.c index 5ad5af1..57fe9b1 100644 --- a/src/gfx/rndr_gu1.c +++ b/src/gfx/rndr_gu1.c @@ -104,7 +104,8 @@ gfx_set_bpp(unsigned short bpp) } if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) { control |= BC_FB_WIDTH_4096; - } else if (pitch > 1024) { + } + else if (pitch > 1024) { control |= BC_FB_WIDTH_2048; } GFX_WAIT_BUSY; @@ -143,8 +144,8 @@ gfx_set_solid_source(unsigned long color) /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */ GFX_WAIT_PENDING; - WRITE_REG16(GP_SRC_COLOR_0, (unsigned short)color); - WRITE_REG16(GP_SRC_COLOR_1, (unsigned short)color); + WRITE_REG16(GP_SRC_COLOR_0, (unsigned short) color); + WRITE_REG16(GP_SRC_COLOR_1, (unsigned short) color); } /* @@ -159,11 +160,11 @@ gfx_set_solid_source(unsigned long color) #if GFX_2DACCEL_DYNAMIC void gu1_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent) + unsigned short transparent) #else void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent) + unsigned short transparent) #endif { /* SET TRANSPARENCY FLAG */ @@ -183,8 +184,8 @@ gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */ GFX_WAIT_PENDING; - WRITE_REG16(GP_SRC_COLOR_0, (unsigned short)bgcolor); - WRITE_REG16(GP_SRC_COLOR_1, (unsigned short)fgcolor); + WRITE_REG16(GP_SRC_COLOR_0, (unsigned short) bgcolor); + WRITE_REG16(GP_SRC_COLOR_1, (unsigned short) fgcolor); } /* @@ -231,7 +232,7 @@ gfx_set_solid_pattern(unsigned long color) /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ GFX_WAIT_PENDING; - WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short) color); } /* @@ -244,11 +245,13 @@ gfx_set_solid_pattern(unsigned long color) #if GFX_2DACCEL_DYNAMIC void gu1_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned char transparent) #else void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned char transparent) #endif { /* CLEAR TRANSPARENCY FLAG */ @@ -273,8 +276,8 @@ gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ GFX_WAIT_PENDING; - WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)bgcolor); - WRITE_REG16(GP_PAT_COLOR_1, (unsigned short)fgcolor); + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short) bgcolor); + WRITE_REG16(GP_PAT_COLOR_1, (unsigned short) fgcolor); WRITE_REG32(GP_PAT_DATA_0, data0); WRITE_REG32(GP_PAT_DATA_1, data1); } @@ -289,13 +292,15 @@ gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, #if GFX_2DACCEL_DYNAMIC void gu1_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned long data2, - unsigned long data3, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) #else void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned long data2, - unsigned long data3, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) #endif { /* CLEAR TRANSPARENCY FLAG */ @@ -321,8 +326,8 @@ gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ GFX_WAIT_PENDING; - WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)bgcolor); - WRITE_REG16(GP_PAT_COLOR_1, (unsigned short)fgcolor); + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short) bgcolor); + WRITE_REG16(GP_PAT_COLOR_1, (unsigned short) fgcolor); WRITE_REG32(GP_PAT_DATA_0, data0); WRITE_REG32(GP_PAT_DATA_1, data1); if (GFXbpp > 8) { @@ -392,7 +397,7 @@ gfx_set_raster_operation(unsigned char rop) /* GENERATE 16-BIT VERSION OF ROP WITH PATTERN FLAGS */ - rop16 = (unsigned short)rop | GFXpatternFlags; + rop16 = (unsigned short) rop | GFXpatternFlags; if ((rop & 0x33) ^ ((rop >> 2) & 0x33)) rop16 |= GFXsourceFlags; @@ -440,7 +445,7 @@ gfx_set_raster_operation(unsigned char rop) */ void gu1_solid_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long color) + unsigned short width, unsigned short height, unsigned long color) { unsigned short section; @@ -455,7 +460,7 @@ gu1_solid_fill(unsigned short x, unsigned short y, WRITE_REG16(GP_DST_YCOOR, y); WRITE_REG16(GP_HEIGHT, height); WRITE_REG16(GP_RASTER_MODE, 0x00F0); /* PATCOPY */ - WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short) color); /* CHECK WIDTH FOR GX BUG WORKAROUND */ @@ -464,7 +469,8 @@ gu1_solid_fill(unsigned short x, unsigned short y, WRITE_REG16(GP_WIDTH, width); WRITE_REG16(GP_BLIT_MODE, 0); - } else { + } + else { /* DRAW FIRST PART OF RECTANGLE */ /* Get to a 16 pixel boundary. */ @@ -500,11 +506,11 @@ gu1_solid_fill(unsigned short x, unsigned short y, #if GFX_2DACCEL_DYNAMIC void gu1_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #else void gfx_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #endif { unsigned short section, buffer_width, blit_mode; @@ -517,10 +523,10 @@ gfx_pattern_fill(unsigned short x, unsigned short y, /* Need hardware workaround for fast "burst write" cases. */ case 0x00F0: - gu1_solid_fill(x, y, width, height, (unsigned short)GFXsavedColor); + gu1_solid_fill(x, y, width, height, (unsigned short) GFXsavedColor); break; case 0x000F: - gu1_solid_fill(x, y, width, height, (unsigned short)~GFXsavedColor); + gu1_solid_fill(x, y, width, height, (unsigned short) ~GFXsavedColor); break; case 0x0000: gu1_solid_fill(x, y, width, height, 0x0000); @@ -605,11 +611,13 @@ gfx_pattern_fill(unsigned short x, unsigned short y, #if GFX_2DACCEL_DYNAMIC void gu1_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern) + unsigned short width, unsigned short height, + unsigned long *pattern) #else void gfx_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern) + unsigned short width, unsigned short height, + unsigned long *pattern) #endif { unsigned short blit_mode, passes, cur_y, pat_y, i; @@ -632,7 +640,8 @@ gfx_color_pattern_fill(unsigned short x, unsigned short y, GFX_WAIT_PENDING; WRITE_REG16(GP_RASTER_MODE, - (GFXsavedRop & ~RM_PAT_MASK & ~RM_PAT_TRANSPARENT) | RM_PAT_COLOR); + (GFXsavedRop & ~RM_PAT_MASK & ~RM_PAT_TRANSPARENT) | + RM_PAT_COLOR); /* WRITE THE REGISTERS THAT DO NOT CHANGE */ /* If destination data is required, the width and */ @@ -695,7 +704,8 @@ gfx_color_pattern_fill(unsigned short x, unsigned short y, line_width -= section; } - } else { + } + else { while (cur_y < y + height) { GFX_WAIT_PENDING; WRITE_REG16(GP_DST_YCOOR, cur_y); @@ -731,13 +741,13 @@ gfx_color_pattern_fill(unsigned short x, unsigned short y, #if GFX_2DACCEL_DYNAMIC void gu1_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) #else void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) #endif { unsigned short section, buffer_width; @@ -811,7 +821,8 @@ gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, WRITE_REG16(GP_SRC_XCOOR, srcx); WRITE_REG16(GP_DST_XCOOR, dstx); WRITE_REG16(GP_BLIT_MODE, blit_mode); - } else { + } + else { /* POSITIVE X DIRECTION */ WRITE_REG16(GP_SRC_XCOOR, srcx); @@ -843,13 +854,15 @@ gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu1_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) #else void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) #endif { unsigned short section, buffer_width; @@ -947,7 +960,8 @@ gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, WRITE_REG16(GP_SRC_XCOOR, srcx); WRITE_REG16(GP_DST_XCOOR, dstx); WRITE_REG16(GP_BLIT_MODE, blit_mode); - } else { + } + else { /* POSITIVE X DIRECTION */ WRITE_REG16(GP_SRC_XCOOR, srcx); @@ -985,13 +999,15 @@ gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu1_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) #else void gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) #endif { unsigned short section, buffer_width; @@ -1048,7 +1064,7 @@ gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, /* CALCULATE THE BITMAP OFFSET */ array_offset = - (unsigned long)srcy *(long)pitch + ((long)srcx << bpp_shift); + (unsigned long) srcy *(long) pitch + ((long) srcx << bpp_shift); while (temp_height--) { GFX_WAIT_PIPELINE; @@ -1059,7 +1075,7 @@ gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, * */ WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, - array_offset); + array_offset); WRITE_REG16(GP_BLIT_MODE, blit_mode); array_offset += pitch; @@ -1094,15 +1110,17 @@ gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu1_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch, - unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) #else void gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch, - unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) #endif { unsigned short section, buffer_width; @@ -1178,7 +1196,7 @@ gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, /* CALCULATE THE BITMAP OFFSET */ array_offset = - (unsigned long)srcy *(long)pitch + ((long)srcx << bpp_shift); + (unsigned long) srcy *(long) pitch + ((long) srcx << bpp_shift); while (temp_height--) { GFX_WAIT_PIPELINE; @@ -1188,7 +1206,7 @@ gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, - array_offset); + array_offset); WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0); array_offset += pitch; @@ -1219,13 +1237,15 @@ gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu1_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) #else void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) #endif { unsigned short section, buffer_width; @@ -1242,7 +1262,8 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, if (GFXusesDstData) { buffer_width = GFXbufferWidthPixels; blit_mode |= BM_READ_DST_FB1; - } else + } + else buffer_width = 3200; /* CHECK IF DATA ALREADY IN BLIT BUFFER */ @@ -1297,7 +1318,7 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, /* CALCULATE THE BITMAP OFFSET */ - array_offset = (unsigned long)srcy *(long)pitch + ((long)srcx >> 3); + array_offset = (unsigned long) srcy *(long) pitch + ((long) srcx >> 3); while (temp_height--) { GFX_WAIT_PIPELINE; @@ -1307,7 +1328,7 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, - array_offset); + array_offset); WRITE_REG16(GP_BLIT_MODE, blit_mode); array_offset += pitch; @@ -1335,11 +1356,11 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu1_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) #else void gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) #endif { unsigned long dword_bytes_needed, bytes_extra; @@ -1348,7 +1369,7 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, /* CALCULATE DATA SIZE */ pitch = (width + 7) >> 3; - data_bytes = (long)height *pitch; + data_bytes = (long) height *pitch; /* CHECK FOR SIMPLE CASE */ /* This routine is designed to render a source copy text glyph. If @@ -1363,7 +1384,7 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, if (GFXusesDstData || data_bytes > buffer_bytes) { gfx_mono_bitmap_to_screen_blt(0, 0, dstx, dsty, width, height, data, - (short)pitch); + (short) pitch); return; } @@ -1415,13 +1436,15 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, #if GFX_2DACCEL_DYNAMIC void gu1_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) #else void gfx_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) #endif { unsigned short vector_mode = flags; diff --git a/src/gfx/rndr_gu2.c b/src/gfx/rndr_gu2.c index db3ccf3..a8126fb 100644 --- a/src/gfx/rndr_gu2.c +++ b/src/gfx/rndr_gu2.c @@ -214,11 +214,11 @@ gfx_set_solid_source(unsigned long color) #if GFX_2DACCEL_DYNAMIC void gu2_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent) + unsigned short transparent) #else void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, - unsigned short transparent) + unsigned short transparent) #endif { /* SET TRANSPARENCY FLAG */ @@ -277,11 +277,13 @@ gfx_set_solid_pattern(unsigned long color) #if GFX_2DACCEL_DYNAMIC void gu2_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned char transparent) #else void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned char transparent) #endif { /* CLEAR TRANSPARENCY FLAG */ @@ -315,13 +317,15 @@ gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, #if GFX_2DACCEL_DYNAMIC void gu2_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned long data2, - unsigned long data3, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) #else void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, - unsigned long data0, unsigned long data1, unsigned long data2, - unsigned long data3, unsigned char transparent) + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, + unsigned char transparent) #endif { /* REMOVE */ @@ -358,7 +362,7 @@ gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) GU2_WAIT_PENDING; WRITE_GP32(MGP_RASTER_MODE, - (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); + (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); /* LOAD THE PATTERN DATA */ /* This routine is designed to work in tandem with gfx_pattern_fill. */ @@ -384,7 +388,8 @@ gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) WRITE_GP32(MGP_PAT_COLOR_2, temp2); WRITE_GP32(MGP_PAT_COLOR_5, temp1); WRITE_GP32(MGP_PAT_COLOR_4, temp2); - } else if (gu2_xshift == 1) { + } + else if (gu2_xshift == 1) { pattern_8x8 += (y & 7) << 2; temp1 = WORD_SWIZZLE(pattern_8x8[0]); temp2 = WORD_SWIZZLE(pattern_8x8[1]); @@ -401,7 +406,8 @@ gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) WRITE_GP32(MGP_PAT_COLOR_4, temp2); WRITE_GP32(MGP_PAT_COLOR_3, temp3); WRITE_GP32(MGP_PAT_COLOR_2, temp4); - } else { + } + else { pattern_8x8 += (y & 7) << 3; WRITE_GP32(MGP_PAT_COLOR_1, pattern_8x8[4]); @@ -441,7 +447,7 @@ gfx_set_raster_operation(unsigned char rop) /* GENERATE 32-BIT VERSION OF ROP WITH PATTERN FLAGS */ - gu2_rop32 = (unsigned long)rop | GFXpatternFlags | gu2_bpp; + gu2_rop32 = (unsigned long) rop | GFXpatternFlags | gu2_bpp; /* CHECK IF SOURCE FLAGS SHOULD BE MERGED */ @@ -457,7 +463,8 @@ gfx_set_raster_operation(unsigned char rop) if ((rop & 0x55) ^ ((rop >> 1) & 0x55)) { gu2_blt_mode |= MGP_BM_DST_REQ; gu2_vector_mode = MGP_VM_DST_REQ; - } else { + } + else { gu2_vector_mode = 0; } } @@ -480,28 +487,28 @@ gfx_set_raster_operation(unsigned char rop) #if GFX_2DACCEL_DYNAMIC void gu2_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #else void gfx_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #endif { unsigned long offset = 0, size; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* CALCULATE STARTING OFFSET */ - offset = (unsigned long)y *gu2_pitch + (((unsigned long)x) << gu2_xshift); + offset = (unsigned long) y *gu2_pitch + (((unsigned long) x) << gu2_xshift); /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ if (GFXpatternFlags) { /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ - offset |= ((unsigned long)(x & 7)) << 26; - offset |= ((unsigned long)(y & 7)) << 29; + offset |= ((unsigned long) (x & 7)) << 26; + offset |= ((unsigned long) (y & 7)) << 29; } /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ @@ -534,22 +541,24 @@ gfx_pattern_fill(unsigned short x, unsigned short y, #if GFX_2DACCEL_DYNAMIC void gu2_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern) + unsigned short width, unsigned short height, + unsigned long *pattern) #else void gfx_color_pattern_fill(unsigned short x, unsigned short y, - unsigned short width, unsigned short height, unsigned long *pattern) + unsigned short width, unsigned short height, + unsigned long *pattern) #endif { /* CALL GFX2 ROUTINE TO AVOID DUPLICATION OF CODE */ - unsigned long offset = (unsigned long)y * gu2_pitch + - (((unsigned long)x) << gu2_xshift); + unsigned long offset = (unsigned long) y * gu2_pitch + + (((unsigned long) x) << gu2_xshift); unsigned long origin = gu2_pattern_origin; unsigned long pitch = gu2_dst_pitch; gfx2_set_pattern_origin(x, y); - gfx2_set_destination_stride((unsigned short)gu2_pitch); + gfx2_set_destination_stride((unsigned short) gu2_pitch); gfx2_color_pattern_fill(offset, width, height, pattern); /* RESTORE GFX2 VALUES */ @@ -576,19 +585,19 @@ gfx_color_pattern_fill(unsigned short x, unsigned short y, #if GFX_2DACCEL_DYNAMIC void gu2_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) #else void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height) #endif { unsigned long srcoffset, dstoffset, size; unsigned short blt_mode; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* CALCULATE THE DIRECTION OF THE BLT */ @@ -606,10 +615,10 @@ gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, /* CALCULATE STARTING OFFSETS */ - srcoffset = (unsigned long)srcy *gu2_pitch + - (((unsigned long)srcx) << gu2_xshift); - dstoffset = ((unsigned long)dsty * gu2_pitch + - (((unsigned long)dstx) << gu2_xshift)) & 0xFFFFFF; + srcoffset = (unsigned long) srcy *gu2_pitch + + (((unsigned long) srcx) << gu2_xshift); + dstoffset = ((unsigned long) dsty * gu2_pitch + + (((unsigned long) dstx) << gu2_xshift)) & 0xFFFFFF; /* MERGE PATTERN INFORMATION */ /* This must be done after the x and y coordinates have been updated, */ @@ -618,8 +627,8 @@ gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, if (GFXpatternFlags) { /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ - dstoffset |= ((unsigned long)(dstx & 7)) << 26; - dstoffset |= ((unsigned long)(dsty & 7)) << 29; + dstoffset |= ((unsigned long) (dstx & 7)) << 26; + dstoffset |= ((unsigned long) (dsty & 7)) << 29; } /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */ @@ -661,13 +670,15 @@ gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu2_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) #else void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned long color) #endif { unsigned long rop32; @@ -720,13 +731,15 @@ gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) #else void gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch) #endif { unsigned long dstoffset, srcoffset, size, bytes; @@ -735,22 +748,22 @@ gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, unsigned short blt_mode; blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_FB; - size = (((unsigned long)width) << 16) | 1; + size = (((unsigned long) width) << 16) | 1; /* CALCULATE STARTING OFFSETS */ - offset = (unsigned long)srcy *pitch + ((unsigned long)srcx << gu2_xshift); + offset = (unsigned long) srcy *pitch + ((unsigned long) srcx << gu2_xshift); - dstoffset = (unsigned long)dsty *gu2_pitch + - (((unsigned long)dstx) << gu2_xshift); + dstoffset = (unsigned long) dsty *gu2_pitch + + (((unsigned long) dstx) << gu2_xshift); /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ if (GFXpatternFlags) { /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ - dstoffset |= ((unsigned long)(dstx & 7)) << 26; - dstoffset |= ((unsigned long)(dsty & 7)) << 29; + dstoffset |= ((unsigned long) (dstx & 7)) << 26; + dstoffset |= ((unsigned long) (dsty & 7)) << 29; } bytes = width << gu2_xshift; @@ -786,13 +799,12 @@ gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, dstoffset += gu2_pitch; dstoffset += 0x20000000; - WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, - temp_offset); + WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, temp_offset); if (bytes_extra) { temp_offset += dword_bytes; srcoffset += dword_bytes; WRITE_FRAME_BUFFER_STRING8(srcoffset, bytes_extra, data, - temp_offset); + temp_offset); } WRITE_GP16(MGP_BLT_MODE, blt_mode); offset += pitch; @@ -823,15 +835,17 @@ gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu2_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch, - unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) #else void gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, long pitch, - unsigned long color) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, long pitch, + unsigned long color) #endif { unsigned long rop32; @@ -856,7 +870,7 @@ gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, /* CALL NORMAL COLOR BITMAP TO SCREEN BLT ROUTINE */ gfx_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, - data, pitch); + data, pitch); /* RESTORE RASTER SETTINGS */ @@ -882,13 +896,15 @@ gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) #else void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) #endif { unsigned long dstoffset, size, bytes; @@ -896,22 +912,22 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; unsigned long shift = 0; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* CALCULATE STARTING OFFSETS */ - offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + offset = (unsigned long) srcy *pitch + ((unsigned long) srcx >> 3); - dstoffset = (unsigned long)dsty *gu2_pitch + - (((unsigned long)dstx) << gu2_xshift); + dstoffset = (unsigned long) dsty *gu2_pitch + + (((unsigned long) dstx) << gu2_xshift); /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ if (GFXpatternFlags) { /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ - dstoffset |= ((unsigned long)(dstx & 7)) << 26; - dstoffset |= ((unsigned long)(dsty & 7)) << 29; + dstoffset |= ((unsigned long) (dstx & 7)) << 26; + dstoffset |= ((unsigned long) (dsty & 7)) << 29; } bytes = ((srcx & 7) + width + 7) >> 3; @@ -927,13 +943,13 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, GU2_WAIT_PENDING; WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); - WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long) srcx & 7) << 26); WRITE_GP32(MGP_DST_OFFSET, dstoffset); WRITE_GP32(MGP_WID_HEIGHT, size); WRITE_GP32(MGP_STRIDE, gu2_pitch); WRITE_GP16(MGP_BLT_MODE, - (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_HOST | - MGP_BM_SRC_MONO); + (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_HOST | + MGP_BM_SRC_MONO); /* WAIT FOR BLT TO BE LATCHED */ @@ -949,7 +965,7 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, for (i = 0; i < fifo_lines; i++) { GU2_WAIT_HALF_EMPTY; WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, - temp1); + temp1); temp_offset += 32; } @@ -958,7 +974,7 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, GU2_WAIT_HALF_EMPTY; if (dwords_extra) { WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, - temp_offset, temp1); + temp_offset, temp1); temp_offset += (dwords_extra << 2); } @@ -967,7 +983,7 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, shift = 0; if (bytes_extra) WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, - temp_offset, temp1, temp2); + temp_offset, temp1, temp2); offset += pitch; } @@ -983,11 +999,11 @@ gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu2_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) #else void gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) #endif { unsigned long size, bytes; @@ -995,18 +1011,18 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; unsigned long shift; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; - dstoffset = (unsigned long)dsty *gu2_pitch + - (((unsigned long)dstx) << gu2_xshift); + dstoffset = (unsigned long) dsty *gu2_pitch + + (((unsigned long) dstx) << gu2_xshift); /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ if (GFXpatternFlags) { /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ - dstoffset |= ((unsigned long)(dstx & 7)) << 26; - dstoffset |= ((unsigned long)(dsty & 7)) << 29; + dstoffset |= ((unsigned long) (dstx & 7)) << 26; + dstoffset |= ((unsigned long) (dsty & 7)) << 29; } /* CALCULATE STARTING OFFSETS */ @@ -1025,8 +1041,8 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, WRITE_GP32(MGP_WID_HEIGHT, size); WRITE_GP32(MGP_STRIDE, gu2_pitch); WRITE_GP16(MGP_BLT_MODE, - (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_HOST | - MGP_BM_SRC_BP_MONO); + (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_HOST | + MGP_BM_SRC_BP_MONO); /* WAIT FOR BLT TO BE LATCHED */ @@ -1046,13 +1062,13 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, GU2_WAIT_HALF_EMPTY; if (dwords_extra) { WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, - temp_offset, temp1); + temp_offset, temp1); temp_offset += (dwords_extra << 2); } if (bytes_extra) { shift = 0; WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, - temp_offset, temp1, temp2); + temp_offset, temp1, temp2); } } } @@ -1079,23 +1095,25 @@ gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, #if GFX_2DACCEL_DYNAMIC void gu2_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) #else void gfx_bresenham_line(unsigned short x, unsigned short y, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) #endif { unsigned long offset; - unsigned long data1 = (((unsigned long)axialerr) << 16) | diagerr; - unsigned long data2 = (((unsigned long)length) << 16) | initerr; + unsigned long data1 = (((unsigned long) axialerr) << 16) | diagerr; + unsigned long data2 = (((unsigned long) length) << 16) | initerr; unsigned short vector_mode = gu2_vector_mode | flags; /* CALCULATE STARTING OFFSET */ - offset = (unsigned long)y *gu2_pitch + (((unsigned long)x) << gu2_xshift); + offset = (unsigned long) y *gu2_pitch + (((unsigned long) x) << gu2_xshift); /* CHECK NULL LENGTH */ @@ -1129,7 +1147,7 @@ void gfx_wait_until_idle(void) #endif { - while (READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY) ; + while (READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY); } /*--------------------------------------------------------------------------- @@ -1177,7 +1195,7 @@ gfx2_set_source_stride(unsigned short stride) { /* SAVE STRIDE TO BE USED LATER */ - gu2_src_pitch = (unsigned long)stride; + gu2_src_pitch = (unsigned long) stride; } /*--------------------------------------------------------------------------- @@ -1196,7 +1214,7 @@ gfx2_set_destination_stride(unsigned short stride) { /* SAVE STRIDE TO BE USED LATER */ - gu2_dst_pitch = (unsigned long)stride; + gu2_dst_pitch = (unsigned long) stride; } /*--------------------------------------------------------------------------- @@ -1216,8 +1234,8 @@ gfx2_set_pattern_origin(int x, int y) { /* STORE IN FORMAT THAT CAN BE COMBINED WITH THE DESTINATION OFFSET */ - gu2_pattern_origin = (((unsigned long)(x & 7)) << 26) | - (((unsigned long)(y & 7)) << 29); + gu2_pattern_origin = (((unsigned long) (x & 7)) << 26) | + (((unsigned long) (y & 7)) << 29); } /*--------------------------------------------------------------------------- @@ -1285,7 +1303,7 @@ gfx2_set_alpha_value(unsigned char value) { /* SAVE ALPHA VALUE TO BE USED LATER */ - gu2_alpha_value = (unsigned long)value; + gu2_alpha_value = (unsigned long) value; /* SET GLOBAL FLAG */ /* gfx2_* routines will use this flag to program alpha values */ @@ -1372,16 +1390,16 @@ gfx2_set_alpha_value(unsigned char value) #if GFX_2DACCEL_DYNAMIC void gu22_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height) + unsigned short height) #else void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height) + unsigned short height) #endif { unsigned long size; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ /* Put off poll for as long as possible (do most calculations first). */ @@ -1408,11 +1426,11 @@ gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, #if GFX_2DACCEL_DYNAMIC void gu22_color_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned long *pattern) + unsigned short height, unsigned long *pattern) #else void gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned long *pattern) + unsigned short height, unsigned long *pattern) #endif { int pass; @@ -1427,7 +1445,7 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, GU2_WAIT_PENDING; WRITE_GP32(MGP_RASTER_MODE, - (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); + (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); /* ATTEMPT TO OPTIMIZE */ /* If possible, we can perform the pattern fill in only a few passes */ @@ -1439,7 +1457,7 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, /* HANDLE VARIOUS COLOR DEPTHS DIFFERENTLY */ switch (gu2_xshift) { - case 0: /* 8 BPP */ + case 0: /* 8 BPP */ /* TWO PASSES FOR 8 BPP */ /* Render every other line per pass by doubling the pitch. */ @@ -1453,16 +1471,16 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, lines = (height + 1 - pass) >> 1; if (!lines) break; - size = (((unsigned long)width) << 16) | lines; + size = (((unsigned long) width) << 16) | lines; WRITE_GP32(MGP_WID_HEIGHT, size); WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 1); WRITE_GP32(MGP_PAT_DATA_1, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_DATA_0, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); patoffset = (patoffset + 4) & 0x0E; WRITE_GP32(MGP_PAT_COLOR_1, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_0, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); patoffset = (patoffset + 4) & 0x0E; /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ @@ -1471,11 +1489,11 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, GU2_WAIT_BUSY; WRITE_GP32(MGP_PAT_COLOR_3, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_2, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); patoffset = (patoffset + 4) & 0x0E; WRITE_GP32(MGP_PAT_COLOR_5, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_4, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); gu2_bm_throttle = 0; gu2_vm_throttle = 0; @@ -1487,7 +1505,7 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, } break; - case 1: /* 12, 15, OR 16 BPP */ + case 1: /* 12, 15, OR 16 BPP */ /* FOUR PASSES FOR 16 BPP */ /* Render every 4th line per pass by quadrupling the pitch. */ @@ -1501,16 +1519,16 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, lines = (height + 3 - pass) >> 2; if (!lines) break; - size = (((unsigned long)width) << 16) | lines; + size = (((unsigned long) width) << 16) | lines; WRITE_GP32(MGP_WID_HEIGHT, size); WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 2); WRITE_GP32(MGP_PAT_COLOR_1, WORD_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_0, - WORD_SWIZZLE(pattern[patoffset + 1])); + WORD_SWIZZLE(pattern[patoffset + 1])); WRITE_GP32(MGP_PAT_DATA_1, - WORD_SWIZZLE(pattern[patoffset + 2])); + WORD_SWIZZLE(pattern[patoffset + 2])); WRITE_GP32(MGP_PAT_DATA_0, - WORD_SWIZZLE(pattern[patoffset + 3])); + WORD_SWIZZLE(pattern[patoffset + 3])); patoffset = (patoffset + 16) & 0x1C; /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ @@ -1519,11 +1537,11 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, GU2_WAIT_BUSY; WRITE_GP32(MGP_PAT_COLOR_5, WORD_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_4, - WORD_SWIZZLE(pattern[patoffset + 1])); + WORD_SWIZZLE(pattern[patoffset + 1])); WRITE_GP32(MGP_PAT_COLOR_3, - WORD_SWIZZLE(pattern[patoffset + 2])); + WORD_SWIZZLE(pattern[patoffset + 2])); WRITE_GP32(MGP_PAT_COLOR_2, - WORD_SWIZZLE(pattern[patoffset + 3])); + WORD_SWIZZLE(pattern[patoffset + 3])); WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); gu2_bm_throttle = 0; gu2_vm_throttle = 0; @@ -1535,7 +1553,7 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, } break; - case 2: /* 32 BPP */ + case 2: /* 32 BPP */ /* EIGHT PASSES FOR 32 BPP */ /* Render every 8th line per pass by setting pitch * 8. */ @@ -1549,7 +1567,7 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, lines = (height + 7 - pass) >> 3; if (!lines) break; - size = (((unsigned long)width) << 16) | lines; + size = (((unsigned long) width) << 16) | lines; WRITE_GP32(MGP_WID_HEIGHT, size); WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 3); WRITE_GP32(MGP_PAT_COLOR_1, pattern[patoffset + 4]); @@ -1582,7 +1600,7 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); switch (gu2_xshift) { - case 0: /* 8 BPP - 4 LINES PER PASS */ + case 0: /* 8 BPP - 4 LINES PER PASS */ patoffset = (gu2_pattern_origin >> 28) & 0x0E; while (height) { @@ -1592,14 +1610,14 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); WRITE_GP32(MGP_WID_HEIGHT, - (((unsigned long)width) << 16) | lines); + (((unsigned long) width) << 16) | lines); WRITE_GP32(MGP_PAT_DATA_1, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_DATA_0, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); patoffset = (patoffset + 2) & 0x0E; WRITE_GP32(MGP_PAT_COLOR_1, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_0, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); patoffset = (patoffset + 2) & 0x0E; /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ @@ -1608,22 +1626,22 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, GU2_WAIT_BUSY; WRITE_GP32(MGP_PAT_COLOR_3, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_2, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); patoffset = (patoffset + 2) & 0x0E; WRITE_GP32(MGP_PAT_COLOR_5, BYTE_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_4, - BYTE_SWIZZLE(pattern[patoffset + 1])); + BYTE_SWIZZLE(pattern[patoffset + 1])); patoffset = (patoffset + 2) & 0x0E; WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); /* ADJUST FOR NEXT PASS */ dstoffset += gu2_dst_pitch << 2; - height -= (unsigned short)lines; + height -= (unsigned short) lines; } break; - case 1: /* 12, 15 AND 16 BPP - 2 LINES PER PASS */ + case 1: /* 12, 15 AND 16 BPP - 2 LINES PER PASS */ patoffset = (gu2_pattern_origin >> 27) & 0x1C; while (height) { @@ -1633,14 +1651,14 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); WRITE_GP32(MGP_WID_HEIGHT, - (((unsigned long)width) << 16) | lines); + (((unsigned long) width) << 16) | lines); WRITE_GP32(MGP_PAT_COLOR_1, WORD_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_0, - WORD_SWIZZLE(pattern[patoffset + 1])); + WORD_SWIZZLE(pattern[patoffset + 1])); WRITE_GP32(MGP_PAT_DATA_1, - WORD_SWIZZLE(pattern[patoffset + 2])); + WORD_SWIZZLE(pattern[patoffset + 2])); WRITE_GP32(MGP_PAT_DATA_0, - WORD_SWIZZLE(pattern[patoffset + 3])); + WORD_SWIZZLE(pattern[patoffset + 3])); patoffset = (patoffset + 4) & 0x1C; /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ @@ -1649,22 +1667,22 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, GU2_WAIT_BUSY; WRITE_GP32(MGP_PAT_COLOR_5, WORD_SWIZZLE(pattern[patoffset])); WRITE_GP32(MGP_PAT_COLOR_4, - WORD_SWIZZLE(pattern[patoffset + 1])); + WORD_SWIZZLE(pattern[patoffset + 1])); WRITE_GP32(MGP_PAT_COLOR_3, - WORD_SWIZZLE(pattern[patoffset + 2])); + WORD_SWIZZLE(pattern[patoffset + 2])); WRITE_GP32(MGP_PAT_COLOR_2, - WORD_SWIZZLE(pattern[patoffset + 3])); + WORD_SWIZZLE(pattern[patoffset + 3])); patoffset = (patoffset + 4) & 0x1C; WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); /* ADJUST FOR NEXT PASS */ dstoffset += gu2_dst_pitch << 1; - height -= (unsigned short)lines; + height -= (unsigned short) lines; } break; - case 2: /* 32 BPP - 1 LINE PER PASS */ + case 2: /* 32 BPP - 1 LINE PER PASS */ patoffset = (gu2_pattern_origin >> 26) & 0x38; while (height) { @@ -1672,7 +1690,7 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); WRITE_GP32(MGP_WID_HEIGHT, - (((unsigned long)width) << 16) | 1l); + (((unsigned long) width) << 16) | 1l); WRITE_GP32(MGP_PAT_COLOR_1, pattern[patoffset + 4]); WRITE_GP32(MGP_PAT_COLOR_0, pattern[patoffset + 5]); WRITE_GP32(MGP_PAT_DATA_1, pattern[patoffset + 6]); @@ -1712,17 +1730,19 @@ gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, #if GFX_2DACCEL_DYNAMIC void gu22_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, - unsigned short width, unsigned short height, int flags) + unsigned short width, unsigned short height, + int flags) #else void gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, - unsigned short width, unsigned short height, int flags) + unsigned short width, unsigned short height, + int flags) #endif { unsigned long size, xbytes; unsigned short blt_mode; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* USE ALPHA SETTINGS, IF REQUESTED */ @@ -1762,7 +1782,8 @@ gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, if (gu2_alpha_active) { WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); - } else { + } + else { WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); } @@ -1787,26 +1808,28 @@ gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, #if GFX_2DACCEL_DYNAMIC void gu22_mono_expand_blt(unsigned long srcbase, unsigned short srcx, - unsigned short srcy, unsigned long dstoffset, unsigned short width, - unsigned short height, int byte_packed) + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed) #else void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, - unsigned short srcy, unsigned long dstoffset, unsigned short width, - unsigned short height, int byte_packed) + unsigned short srcy, unsigned long dstoffset, + unsigned short width, unsigned short height, + int byte_packed) #endif { unsigned long size, srcoffset; unsigned short blt_mode; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* CALCULATE SOURCE OFFSET */ - srcoffset = srcbase + (unsigned long)srcy *gu2_src_pitch; + srcoffset = srcbase + (unsigned long) srcy *gu2_src_pitch; srcoffset += srcx >> 3; - srcoffset |= ((unsigned long)srcx & 7) << 26; + srcoffset |= ((unsigned long) srcx & 7) << 26; /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ /* Put off poll for as long as possible (do most calculations first). */ @@ -1817,7 +1840,8 @@ gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, blt_mode = gu2_alpha_blt_mode; WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); - } else { + } + else { blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); @@ -1848,13 +1872,15 @@ gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, #if GFX_2DACCEL_DYNAMIC void gu22_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) #else void gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) #endif { unsigned long size, bytes; @@ -1862,11 +1888,11 @@ gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, unsigned long srcoffset, dword_bytes, bytes_extra; unsigned short blt_mode; - size = (((unsigned long)width) << 16) | 1; + size = (((unsigned long) width) << 16) | 1; /* CALCULATE STARTING OFFSETS */ - offset = (unsigned long)srcy *pitch + ((unsigned long)srcx << gu2_xshift); + offset = (unsigned long) srcy *pitch + ((unsigned long) srcx << gu2_xshift); dstoffset |= gu2_pattern_origin; @@ -1886,7 +1912,8 @@ gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, blt_mode = gu2_alpha_blt_mode; WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); - } else { + } + else { blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); @@ -1916,13 +1943,12 @@ gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, dstoffset += gu2_dst_pitch; dstoffset += 0x20000000; - WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, - temp_offset); + WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, temp_offset); if (bytes_extra) { temp_offset += dword_bytes; srcoffset += dword_bytes; WRITE_FRAME_BUFFER_STRING8(srcoffset, bytes_extra, data, - temp_offset); + temp_offset); } WRITE_GP16(MGP_BLT_MODE, blt_mode); offset += pitch; @@ -1940,11 +1966,11 @@ gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu22_text_blt(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) #else void gfx2_text_blt(unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data) + unsigned short height, unsigned char *data) #endif { unsigned long size, bytes; @@ -1953,7 +1979,7 @@ gfx2_text_blt(unsigned long dstoffset, unsigned short width, unsigned long shift; unsigned short blt_mode; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* CALCULATE STARTING OFFSETS */ @@ -1970,7 +1996,8 @@ gfx2_text_blt(unsigned long dstoffset, unsigned short width, blt_mode = gu2_alpha_blt_mode; WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); - } else { + } + else { blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); @@ -1981,7 +2008,7 @@ gfx2_text_blt(unsigned long dstoffset, unsigned short width, WRITE_GP32(MGP_WID_HEIGHT, size); WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); WRITE_GP16(MGP_BLT_MODE, blt_mode | MGP_BM_SRC_HOST | - MGP_BM_SRC_BP_MONO | gu2_bm_throttle); + MGP_BM_SRC_BP_MONO | gu2_bm_throttle); gu2_bm_throttle = 0; gu2_vm_throttle = 0; @@ -2003,13 +2030,13 @@ gfx2_text_blt(unsigned long dstoffset, unsigned short width, GU2_WAIT_HALF_EMPTY; if (dwords_extra) { WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, - temp_offset, temp1); + temp_offset, temp1); temp_offset += (dwords_extra << 2); } if (bytes_extra) { shift = 0; WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, - temp_offset, temp1, temp2); + temp_offset, temp1, temp2); } } } @@ -2024,13 +2051,15 @@ gfx2_text_blt(unsigned long dstoffset, unsigned short width, #if GFX_2DACCEL_DYNAMIC void gu22_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) #else void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, - unsigned long dstoffset, unsigned short width, - unsigned short height, unsigned char *data, short pitch) + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, + short pitch) #endif { unsigned long size, bytes; @@ -2039,11 +2068,11 @@ gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, unsigned long shift = 0; unsigned short blt_mode; - size = (((unsigned long)width) << 16) | height; + size = (((unsigned long) width) << 16) | height; /* CALCULATE STARTING OFFSETS */ - offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + offset = (unsigned long) srcy *pitch + ((unsigned long) srcx >> 3); bytes = ((srcx & 7) + width + 7) >> 3; fifo_lines = bytes >> 5; @@ -2058,18 +2087,19 @@ gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, blt_mode = gu2_alpha_blt_mode; WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); - } else { + } + else { blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); } - WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long) srcx & 7) << 26); WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); WRITE_GP32(MGP_WID_HEIGHT, size); WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); WRITE_GP16(MGP_BLT_MODE, blt_mode | MGP_BM_SRC_HOST | - MGP_BM_SRC_MONO | gu2_bm_throttle); + MGP_BM_SRC_MONO | gu2_bm_throttle); gu2_bm_throttle = 0; gu2_vm_throttle = 0; @@ -2087,7 +2117,7 @@ gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, for (i = 0; i < fifo_lines; i++) { GU2_WAIT_HALF_EMPTY; WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, - temp1); + temp1); temp_offset += 32; } @@ -2096,7 +2126,7 @@ gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, GU2_WAIT_HALF_EMPTY; if (dwords_extra) WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, - temp_offset, temp1); + temp_offset, temp1); temp_offset += (dwords_extra << 2); /* WRITE REMAINING BYTES */ @@ -2104,7 +2134,7 @@ gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, shift = 0; if (bytes_extra) WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, - temp_offset, temp1, temp2); + temp_offset, temp1, temp2); offset += pitch; } @@ -2120,18 +2150,20 @@ gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, #if GFX_2DACCEL_DYNAMIC void gu22_bresenham_line(unsigned long dstoffset, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) #else void gfx2_bresenham_line(unsigned long dstoffset, - unsigned short length, unsigned short initerr, - unsigned short axialerr, unsigned short diagerr, unsigned short flags) + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags) #endif { unsigned long vector_mode = gu2_vector_mode | flags; - unsigned long data1 = (((unsigned long)axialerr) << 16) | diagerr; - unsigned long data2 = (((unsigned long)length) << 16) | initerr; + unsigned long data1 = (((unsigned long) axialerr) << 16) | diagerr; + unsigned long data2 = (((unsigned long) length) << 16) | initerr; /* CHECK NULL LENGTH */ @@ -2147,7 +2179,8 @@ gfx2_bresenham_line(unsigned long dstoffset, vector_mode = gu2_alpha_vec_mode | flags; WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); - } else + } + else WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); diff --git a/src/gfx/saa7114.c b/src/gfx/saa7114.c index df516bc..6e9ab8d 100644 --- a/src/gfx/saa7114.c +++ b/src/gfx/saa7114.c @@ -31,8 +31,7 @@ /* TABLE OF DEFAULT VALUES */ /*---------------------------*/ -typedef struct tagGFX_SAA7114_INIT -{ +typedef struct tagGFX_SAA7114_INIT { unsigned char index; unsigned char value; } GFX_SAA7114_INIT; @@ -97,8 +96,7 @@ GFX_SAA7114_INIT gfx_saa7114_init_values[] = { int optimize_for_aliasing = 0; -typedef struct tagGFX_SAA7114_FIR_PREFILTER -{ +typedef struct tagGFX_SAA7114_FIR_PREFILTER { unsigned char prescaler; unsigned char acl_low; unsigned char prefilter_low; @@ -255,7 +253,7 @@ gfx_set_decoder_defaults(void) for (i = 0; i < GFX_NUM_SAA7114_INIT_VALUES; i++) { saa7114_write_reg(gfx_saa7114_init_values[i].index, - gfx_saa7114_init_values[i].value); + gfx_saa7114_init_values[i].value); } gfx_decoder_software_reset(); @@ -312,7 +310,7 @@ int gfx_set_decoder_contrast(unsigned char contrast) #endif { - saa7114_write_reg(SAA7114_CONTRAST, (unsigned char)(contrast >> 1)); + saa7114_write_reg(SAA7114_CONTRAST, (unsigned char) (contrast >> 1)); return (0); } @@ -330,7 +328,7 @@ int gfx_set_decoder_hue(char hue) #endif { - saa7114_write_reg(SAA7114_HUE, (unsigned char)hue); + saa7114_write_reg(SAA7114_HUE, (unsigned char) hue); return (0); } @@ -348,7 +346,7 @@ int gfx_set_decoder_saturation(unsigned char saturation) #endif { - saa7114_write_reg(SAA7114_SATURATION, (unsigned char)(saturation >> 1)); + saa7114_write_reg(SAA7114_SATURATION, (unsigned char) (saturation >> 1)); return (0); } @@ -368,10 +366,10 @@ gfx_set_decoder_input_offset(unsigned short x, unsigned short y) { /* SET THE INPUT WINDOW OFFSET */ - saa7114_write_reg(SAA7114_HORZ_OFFSET_LO, (unsigned char)(x & 0x00FF)); - saa7114_write_reg(SAA7114_HORZ_OFFSET_HI, (unsigned char)(x >> 8)); - saa7114_write_reg(SAA7114_VERT_OFFSET_LO, (unsigned char)(y & 0x00FF)); - saa7114_write_reg(SAA7114_VERT_OFFSET_HI, (unsigned char)(y >> 8)); + saa7114_write_reg(SAA7114_HORZ_OFFSET_LO, (unsigned char) (x & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_OFFSET_HI, (unsigned char) (x >> 8)); + saa7114_write_reg(SAA7114_VERT_OFFSET_LO, (unsigned char) (y & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_OFFSET_HI, (unsigned char) (y >> 8)); gfx_decoder_software_reset(); return (0); @@ -397,11 +395,10 @@ gfx_set_decoder_input_size(unsigned short width, unsigned short height) /* SET THE INPUT WINDOW SIZE */ - saa7114_write_reg(SAA7114_HORZ_INPUT_LO, (unsigned char)(width & 0x00FF)); - saa7114_write_reg(SAA7114_HORZ_INPUT_HI, (unsigned char)(width >> 8)); - saa7114_write_reg(SAA7114_VERT_INPUT_LO, - (unsigned char)(height & 0x00FF)); - saa7114_write_reg(SAA7114_VERT_INPUT_HI, (unsigned char)(height >> 8)); + saa7114_write_reg(SAA7114_HORZ_INPUT_LO, (unsigned char) (width & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_INPUT_HI, (unsigned char) (width >> 8)); + saa7114_write_reg(SAA7114_VERT_INPUT_LO, (unsigned char) (height & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_INPUT_HI, (unsigned char) (height >> 8)); gfx_decoder_software_reset(); return (0); @@ -431,12 +428,11 @@ gfx_set_decoder_output_size(unsigned short width, unsigned short height) /* SET THE OUTPUT WINDOW SIZE */ - saa7114_write_reg(SAA7114_HORZ_OUTPUT_LO, - (unsigned char)(width & 0x00FF)); - saa7114_write_reg(SAA7114_HORZ_OUTPUT_HI, (unsigned char)(width >> 8)); + saa7114_write_reg(SAA7114_HORZ_OUTPUT_LO, (unsigned char) (width & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_OUTPUT_HI, (unsigned char) (width >> 8)); saa7114_write_reg(SAA7114_VERT_OUTPUT_LO, - (unsigned char)(height & 0x00FF)); - saa7114_write_reg(SAA7114_VERT_OUTPUT_HI, (unsigned char)(height >> 8)); + (unsigned char) (height & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_OUTPUT_HI, (unsigned char) (height >> 8)); gfx_decoder_software_reset(); return (0); @@ -451,11 +447,11 @@ gfx_set_decoder_output_size(unsigned short width, unsigned short height) #if GFX_DECODER_DYNAMIC int saa7114_set_decoder_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #else int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #endif { unsigned char prescale = 0; @@ -465,7 +461,7 @@ gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, /* Downscale from 1 to 1/63 source size. */ if (dstw) - prescale = (unsigned char)(srcw / dstw); + prescale = (unsigned char) (srcw / dstw); if (!prescale) prescale = 1; if (prescale > 63) @@ -477,27 +473,32 @@ gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, if (prescale < 36) { if (optimize_for_aliasing) { saa7114_write_reg(SAA7114_HORZ_ACL, - gfx_saa7114_fir_values[prescale - 1].acl_low); + gfx_saa7114_fir_values[prescale - 1].acl_low); saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, - gfx_saa7114_fir_values[prescale - 1].prefilter_low); - } else { + gfx_saa7114_fir_values[prescale - + 1].prefilter_low); + } + else { saa7114_write_reg(SAA7114_HORZ_ACL, - gfx_saa7114_fir_values[prescale - 1].acl_high); + gfx_saa7114_fir_values[prescale - 1].acl_high); saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, - gfx_saa7114_fir_values[prescale - 1].prefilter_high); + gfx_saa7114_fir_values[prescale - + 1].prefilter_high); } - } else { + } + else { /* SAME SETTINGS FOR RATIO 1/35 DOWNTO 1/63 */ if (optimize_for_aliasing) { saa7114_write_reg(SAA7114_HORZ_ACL, - gfx_saa7114_fir_values[34].acl_low); + gfx_saa7114_fir_values[34].acl_low); saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, - gfx_saa7114_fir_values[34].prefilter_low); - } else { + gfx_saa7114_fir_values[34].prefilter_low); + } + else { saa7114_write_reg(SAA7114_HORZ_ACL, - gfx_saa7114_fir_values[34].acl_high); + gfx_saa7114_fir_values[34].acl_high); saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, - gfx_saa7114_fir_values[34].prefilter_high); + gfx_saa7114_fir_values[34].prefilter_high); } } @@ -508,13 +509,12 @@ gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, scale = ((1024 * srcw * 1000) / (dstw * prescale)) / 1000; if ((scale > 8191) || (scale < 300)) return (1); - saa7114_write_reg(SAA7114_HSCALE_LUMA_LO, - (unsigned char)(scale & 0x00FF)); - saa7114_write_reg(SAA7114_HSCALE_LUMA_HI, (unsigned char)(scale >> 8)); + saa7114_write_reg(SAA7114_HSCALE_LUMA_LO, (unsigned char) (scale & 0x00FF)); + saa7114_write_reg(SAA7114_HSCALE_LUMA_HI, (unsigned char) (scale >> 8)); scale >>= 1; saa7114_write_reg(SAA7114_HSCALE_CHROMA_LO, - (unsigned char)(scale & 0x00FF)); - saa7114_write_reg(SAA7114_HSCALE_CHROMA_HI, (unsigned char)(scale >> 8)); + (unsigned char) (scale & 0x00FF)); + saa7114_write_reg(SAA7114_HSCALE_CHROMA_HI, (unsigned char) (scale >> 8)); /* SET THE VERTICAL SCALING (INTERPOLATION MODE) */ @@ -526,13 +526,12 @@ gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, dsth = ((dsth + 1) >> 1) << 1; - scale = (int)((1024 * srch) / dsth); - saa7114_write_reg(SAA7114_VSCALE_LUMA_LO, - (unsigned char)(scale & 0x00FF)); - saa7114_write_reg(SAA7114_VSCALE_LUMA_HI, (unsigned char)(scale >> 8)); + scale = (int) ((1024 * srch) / dsth); + saa7114_write_reg(SAA7114_VSCALE_LUMA_LO, (unsigned char) (scale & 0x00FF)); + saa7114_write_reg(SAA7114_VSCALE_LUMA_HI, (unsigned char) (scale >> 8)); saa7114_write_reg(SAA7114_VSCALE_CHROMA_LO, - (unsigned char)(scale & 0x00FF)); - saa7114_write_reg(SAA7114_VSCALE_CHROMA_HI, (unsigned char)(scale >> 8)); + (unsigned char) (scale & 0x00FF)); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_HI, (unsigned char) (scale >> 8)); if (dsth >= (srch >> 1)) { /* USE INTERPOLATION MODE FOR SCALE FACTOR ABOVE 0.5 */ @@ -545,22 +544,27 @@ gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS0, SAA7114_VSCALE_PHO); saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS1, SAA7114_VSCALE_PHO); saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS2, - (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + (unsigned char) (SAA7114_VSCALE_PHO + scale / 64 - + 16)); saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS3, - (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + (unsigned char) (SAA7114_VSCALE_PHO + scale / 64 - + 16)); saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS0, SAA7114_VSCALE_PHO); saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS1, SAA7114_VSCALE_PHO); saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS2, - (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + (unsigned char) (SAA7114_VSCALE_PHO + scale / 64 - + 16)); saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS3, - (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + (unsigned char) (SAA7114_VSCALE_PHO + scale / 64 - + 16)); /* RESTORE CONTRAST AND SATURATION FOR INTERPOLATION MODE */ - saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char)0x40); - saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char)0x40); - } else { + saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char) 0x40); + saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char) 0x40); + } + else { /* USE ACCUMULATION MODE FOR DOWNSCALING BY MORE THAN 2x */ saa7114_write_reg(SAA7114_VSCALE_CONTROL, 0x01); @@ -580,8 +584,8 @@ gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, if (srch) scale = (64 * dsth) / srch; - saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char)scale); - saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char)scale); + saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char) scale); + saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char) scale); } gfx_decoder_software_reset(); @@ -610,20 +614,20 @@ gfx_set_decoder_vbi_format(int start, int end, int format) switch (format) { case VBI_FORMAT_VIDEO: data = 0xFF; - break; /* Active video */ + break; /* Active video */ case VBI_FORMAT_RAW: data = 0x77; - break; /* Raw VBI data */ + break; /* Raw VBI data */ case VBI_FORMAT_CC: data = 0x55; - break; /* US CC */ + break; /* US CC */ case VBI_FORMAT_NABTS: data = 0xCC; - break; /* US NABTS */ + break; /* US NABTS */ default: return GFX_STATUS_BAD_PARAMETER; } - saa7114_write_reg((unsigned char)(0x3F + i), data); + saa7114_write_reg((unsigned char) (0x3F + i), data); } return GFX_STATUS_OK; } @@ -701,7 +705,7 @@ gfx_set_decoder_luminance_filter(unsigned char lufi) saa7114_read_reg(SAA7114_LUMINANCE_CONTROL, &data); saa7114_write_reg(SAA7114_LUMINANCE_CONTROL, - (unsigned char)((data & ~0x0F) | (lufi & 0x0F))); + (unsigned char) ((data & ~0x0F) | (lufi & 0x0F))); return (0); } @@ -769,7 +773,7 @@ gfx_get_decoder_hue(void) unsigned char hue = 0; saa7114_read_reg(SAA7114_HUE, &hue); - return ((char)hue); + return ((char) hue); } /*---------------------------------------------------------------------------- @@ -811,13 +815,13 @@ gfx_get_decoder_input_offset(void) unsigned char data; saa7114_read_reg(SAA7114_HORZ_OFFSET_LO, &data); - value = (unsigned long)data; + value = (unsigned long) data; saa7114_read_reg(SAA7114_HORZ_OFFSET_HI, &data); - value |= ((unsigned long)data) << 8; + value |= ((unsigned long) data) << 8; saa7114_read_reg(SAA7114_VERT_OFFSET_LO, &data); - value |= ((unsigned long)data) << 16; + value |= ((unsigned long) data) << 16; saa7114_read_reg(SAA7114_VERT_OFFSET_HI, &data); - value |= ((unsigned long)data) << 24; + value |= ((unsigned long) data) << 24; return (value); } @@ -839,13 +843,13 @@ gfx_get_decoder_input_size(void) unsigned char data; saa7114_read_reg(SAA7114_HORZ_INPUT_LO, &data); - value = (unsigned long)data; + value = (unsigned long) data; saa7114_read_reg(SAA7114_HORZ_INPUT_HI, &data); - value |= ((unsigned long)data) << 8; + value |= ((unsigned long) data) << 8; saa7114_read_reg(SAA7114_VERT_INPUT_LO, &data); - value |= ((unsigned long)data) << 17; + value |= ((unsigned long) data) << 17; saa7114_read_reg(SAA7114_VERT_INPUT_HI, &data); - value |= ((unsigned long)data) << 25; + value |= ((unsigned long) data) << 25; return (value); } @@ -867,13 +871,13 @@ gfx_get_decoder_output_size(void) unsigned char data; saa7114_read_reg(SAA7114_HORZ_OUTPUT_LO, &data); - value = (unsigned long)data; + value = (unsigned long) data; saa7114_read_reg(SAA7114_HORZ_OUTPUT_HI, &data); - value |= ((unsigned long)data) << 8; + value |= ((unsigned long) data) << 8; saa7114_read_reg(SAA7114_VERT_OUTPUT_LO, &data); - value |= ((unsigned long)data) << 17; + value |= ((unsigned long) data) << 17; saa7114_read_reg(SAA7114_VERT_OUTPUT_HI, &data); - value |= ((unsigned long)data) << 25; + value |= ((unsigned long) data) << 25; return (value); } @@ -893,24 +897,24 @@ gfx_get_decoder_vbi_format(int line) { unsigned char format = 0, data; - saa7114_read_reg((unsigned char)(0x3F + line), &data); + saa7114_read_reg((unsigned char) (0x3F + line), &data); switch (data) { case 0xFF: format = VBI_FORMAT_VIDEO; - break; /* Active video */ + break; /* Active video */ case 0x77: format = VBI_FORMAT_RAW; - break; /* Raw VBI data */ + break; /* Raw VBI data */ case 0x55: format = VBI_FORMAT_CC; - break; /* US CC */ + break; /* US CC */ case 0xCC: format = VBI_FORMAT_NABTS; - break; /* US NABTS */ + break; /* US NABTS */ } return (format); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ /* END OF FILE */ diff --git a/src/gfx/tv_1200.c b/src/gfx/tv_1200.c index a75cc32..8ebcffc 100644 --- a/src/gfx/tv_1200.c +++ b/src/gfx/tv_1200.c @@ -47,7 +47,7 @@ gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) /* Save TV output mode */ ctrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2) & (SC1200_TVENC_OUTPUT_YCBCR | - SC1200_TVENC_CFS_MASK); + SC1200_TVENC_CFS_MASK); /* Save flicker filter setting */ mode = READ_VID32(SC1200_TVOUT_HORZ_SCALING) & @@ -105,7 +105,8 @@ gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) /* Horizontal display end is 919, i.e. 720 active pixels */ /* Total number of display lines per field is 240 */ WRITE_VID32(SC1200_TVOUT_LINE_END, 0x039700f0); - } else { /* Use new scaler available in Rev. C */ + } + else { /* Use new scaler available in Rev. C */ /* Horizontal Display start is 111 */ /* Total number of pixels per line is 857 */ WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x006f0359); @@ -214,7 +215,8 @@ gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) /* Horizontal display end is 906, i.e. 704 active pixels */ /* Total number of display lines per field is 288 */ WRITE_VID32(SC1200_TVOUT_LINE_END, 0x038a0120); - } else { + } + else { /* HSYNC generated in the TV Encoder module */ /* Interval between resets of TV Encoder is once every odd * field */ @@ -260,8 +262,7 @@ gfx_set_tv_output(int output) ctrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2); ctrl3 = READ_VID32(SC1200_TVENC_TIM_CTRL_3); ctrl2 &= ~(SC1200_TVENC_OUTPUT_YCBCR | SC1200_TVENC_CFS_MASK); - ctrl3 &= - ~(SC1200_TVENC_CM | SC1200_TVENC_SYNCMODE_MASK | SC1200_TVENC_CS); + ctrl3 &= ~(SC1200_TVENC_CM | SC1200_TVENC_SYNCMODE_MASK | SC1200_TVENC_CS); switch (output) { case TV_OUTPUT_COMPOSITE: /* Analog outputs provide Y, C and CVBS */ @@ -279,16 +280,17 @@ gfx_set_tv_output(int output) /* Analog outputs provide Y, Cb and Cr */ /* A 7.5 IRE setup is applied to the output */ WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, - ctrl2 | SC1200_TVENC_OUTPUT_YCBCR | SC1200_TVENC_CFS_BYPASS); + ctrl2 | SC1200_TVENC_OUTPUT_YCBCR | + SC1200_TVENC_CFS_BYPASS); WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, - ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_CS); + ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_CS); break; case TV_OUTPUT_SCART: /* Analog outputs provide SCART (RGB and CVBS) */ /* Sync is added to green signal */ WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, ctrl2 | SC1200_TVENC_CFS_CVBS); WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, - ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_SYNC_ON_GREEN); + ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_SYNC_ON_GREEN); break; default: return (GFX_STATUS_BAD_PARAMETER); @@ -336,7 +338,8 @@ gfx_set_tv_enable(int enable) value_dac &= ~SC1200_TVENC_POWER_DOWN; /* ENABLE GRAPHICS DISPLAY LOGIC IN VIDEO PROCESSOR */ gfx_set_screen_enable(1); - } else { + } + else { value_tim &= ~SC1200_TVENC_VIDEO_TIMING_ENABLE; value_dac |= SC1200_TVENC_POWER_DOWN; /* Do not disable the graphics display logic because it might be @@ -370,15 +373,15 @@ gfx_set_tv_flicker_filter(int ff) switch (ff) { case TV_FLICKER_FILTER_NONE: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - mode | SC1200_TVOUT_FLICKER_FILTER_DISABLED); + mode | SC1200_TVOUT_FLICKER_FILTER_DISABLED); break; case TV_FLICKER_FILTER_NORMAL: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - mode | SC1200_TVOUT_FLICKER_FILTER_FOURTH_HALF_FOURTH); + mode | SC1200_TVOUT_FLICKER_FILTER_FOURTH_HALF_FOURTH); break; case TV_FLICKER_FILTER_INTERLACED: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - mode | SC1200_TVOUT_FLICKER_FILTER_HALF_ONE_HALF); + mode | SC1200_TVOUT_FLICKER_FILTER_HALF_ONE_HALF); break; default: return GFX_STATUS_BAD_PARAMETER; @@ -407,19 +410,19 @@ gfx_set_tv_sub_carrier_reset(int screset) switch (screset) { case TV_SUB_CARRIER_RESET_NEVER: WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, - mode | SC1200_TVENC_SUB_CARRIER_RESET_NEVER); + mode | SC1200_TVENC_SUB_CARRIER_RESET_NEVER); break; case TV_SUB_CARRIER_RESET_EVERY_TWO_LINES: WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, - mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_LINES); + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_LINES); break; case TV_SUB_CARRIER_RESET_EVERY_TWO_FRAMES: WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, - mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_FRAMES); + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_FRAMES); break; case TV_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES: WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, - mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES); + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES); break; default: return GFX_STATUS_BAD_PARAMETER; @@ -474,19 +477,19 @@ gfx_set_tv_YC_delay(int delay) switch (delay) { case TV_YC_DELAY_NONE: WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, - mode | SC1200_TVOUT_YC_DELAY_NONE); + mode | SC1200_TVOUT_YC_DELAY_NONE); break; case TV_Y_DELAY_ONE_PIXEL: WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, - mode | SC1200_TVOUT_Y_DELAY_ONE_PIXEL); + mode | SC1200_TVOUT_Y_DELAY_ONE_PIXEL); break; case TV_C_DELAY_ONE_PIXEL: WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, - mode | SC1200_TVOUT_C_DELAY_ONE_PIXEL); + mode | SC1200_TVOUT_C_DELAY_ONE_PIXEL); break; case TV_C_DELAY_TWO_PIXELS: WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, - mode | SC1200_TVOUT_C_DELAY_TWO_PIXELS); + mode | SC1200_TVOUT_C_DELAY_TWO_PIXELS); break; default: return GFX_STATUS_BAD_PARAMETER; @@ -516,23 +519,23 @@ gfx_set_tvenc_reset_interval(int interval) switch (interval) { case TVENC_RESET_EVERY_ODD_FIELD: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - value | SC1200_TVENC_EXTERNAL_RESET_EVERY_ODD_FIELD); + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_ODD_FIELD); break; case TVENC_RESET_EVERY_EVEN_FIELD: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - value | SC1200_TVENC_EXTERNAL_RESET_EVERY_EVEN_FIELD); + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_EVEN_FIELD); break; case TVENC_RESET_NEXT_ODD_FIELD: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - value | SC1200_TVENC_EXTERNAL_RESET_NEXT_ODD_FIELD); + value | SC1200_TVENC_EXTERNAL_RESET_NEXT_ODD_FIELD); break; case TVENC_RESET_NEXT_EVEN_FIELD: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - value | SC1200_TVENC_EXTERNAL_RESET_NEXT_EVEN_FIELD); + value | SC1200_TVENC_EXTERNAL_RESET_NEXT_EVEN_FIELD); break; case TVENC_RESET_EVERY_FIELD: WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, - value | SC1200_TVENC_EXTERNAL_RESET_EVERY_FIELD); + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_FIELD); break; case TVENC_RESET_EVERY_X_ODD_FIELDS: case TVENC_RESET_EVERY_X_EVEN_FIELDS: @@ -588,8 +591,8 @@ gfx_set_tv_display(int width, int height) for (i = 0; i < NUM_TV_MODES; i++) { pMode = &TVTimings[i]; - if ((unsigned)width == pMode->hactive - && (unsigned)height == pMode->vactive) + if ((unsigned) width == pMode->hactive + && (unsigned) height == pMode->vactive) break; } @@ -597,10 +600,12 @@ gfx_set_tv_display(int width, int height) return 0; gfx_set_display_timings(gfx_get_display_bpp(), - (unsigned short)pMode->flags, pMode->hactive, pMode->hblankstart, - pMode->hsyncstart, pMode->hsyncend, pMode->hblankend, pMode->htotal, - pMode->vactive, pMode->vblankstart, pMode->vsyncstart, - pMode->vsyncend, pMode->vblankend, pMode->vtotal, pMode->frequency); + (unsigned short) pMode->flags, pMode->hactive, + pMode->hblankstart, pMode->hsyncstart, + pMode->hsyncend, pMode->hblankend, pMode->htotal, + pMode->vactive, pMode->vblankstart, + pMode->vsyncstart, pMode->vsyncend, + pMode->vblankend, pMode->vtotal, pMode->frequency); return 1; } @@ -719,7 +724,8 @@ gfx_set_tv_field_status_invert(int enable) if (enable) { value |= SC1200_TVOUT_FIELD_STATUS_INVERT; - } else { + } + else { value &= ~(SC1200_TVOUT_FIELD_STATUS_INVERT); } @@ -744,8 +750,7 @@ gfx_get_tv_vphase(void) { unsigned long mode = READ_VID32(SC1200_TVENC_TIM_CTRL_1); - return (int)((mode & SC1200_TVENC_VPHASE_MASK) >> - SC1200_TVENC_VPHASE_POS); + return (int) ((mode & SC1200_TVENC_VPHASE_MASK) >> SC1200_TVENC_VPHASE_POS); } /*--------------------------------------------------------------------------- @@ -764,7 +769,7 @@ gfx_get_tv_enable(unsigned int *p_on) { unsigned long control = READ_VID32(SC1200_TVENC_DAC_CONTROL); - *p_on = (unsigned int)(!(control & SC1200_TVENC_POWER_DOWN)); + *p_on = (unsigned int) (!(control & SC1200_TVENC_POWER_DOWN)); return GFX_STATUS_OK; } @@ -863,8 +868,8 @@ gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) frequency = gfx_get_clock_frequency(); for (mode = 0; mode < NUM_TV_MODES; mode++) { - if (TVTimings[mode].hactive == (unsigned short)(*width) && - TVTimings[mode].vactive == (unsigned short)(*height) && + if (TVTimings[mode].hactive == (unsigned short) (*width) && + TVTimings[mode].vactive == (unsigned short) (*height) && TVTimings[mode].frequency == frequency) { flags = TVTimings[mode].flags; @@ -890,11 +895,12 @@ gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) #if GFX_TV_DYNAMIC int sc1200_get_tv_display_mode_frequency(unsigned short width, - unsigned short height, TVStandardType format, int *frequency) + unsigned short height, + TVStandardType format, int *frequency) #else int gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, - TVStandardType format, int *frequency) + TVStandardType format, int *frequency) #endif { unsigned long mode, flag; @@ -933,11 +939,12 @@ gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, #if GFX_TV_DYNAMIC int sc1200_is_tv_display_mode_supported(unsigned short width, - unsigned short height, TVStandardType format) + unsigned short height, + TVStandardType format) #else int gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height, - TVStandardType format) + TVStandardType format) #endif { unsigned long mode, flag; @@ -957,7 +964,7 @@ gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height, if (TVTimings[mode].hactive == width && TVTimings[mode].vactive == height && (TVTimings[mode].flags & flag)) { - return ((int)mode); + return ((int) mode); } } diff --git a/src/gfx/tv_fs450.c b/src/gfx/tv_fs450.c index 942907b..24e7446 100644 --- a/src/gfx/tv_fs450.c +++ b/src/gfx/tv_fs450.c @@ -51,8 +51,7 @@ #define WRITE 2 #define READ_WRITE (READ | WRITE) -typedef struct -{ +typedef struct { char *name; unsigned long offset; unsigned char bit_length; @@ -61,8 +60,7 @@ typedef struct char *bitfield_names[MAX_BITS]; } S_REGISTER_DESCRIP; -typedef struct -{ +typedef struct { int source; char *name; S_REGISTER_DESCRIP registers[MAX_REGISTERS]; @@ -247,8 +245,7 @@ const S_SET_DESCRIP *gcc_regs(void); */ #define TRACE(parameters) {} /* GCC timing structure */ -typedef struct _S_TIMING_SPECS -{ +typedef struct _S_TIMING_SPECS { int vga_width; int vga_lines; int tv_width; @@ -302,15 +299,15 @@ DMAL_WriteUInt32(unsigned long phys_addr, unsigned long data) static int houston_ReadReg(unsigned int reg, unsigned long *p_value, unsigned int bytes) { - return gfx_i2c_read(1, PLAL_FS450_i2c_address(), (unsigned char)reg, - (unsigned char)bytes, (unsigned char *)p_value); + return gfx_i2c_read(1, PLAL_FS450_i2c_address(), (unsigned char) reg, + (unsigned char) bytes, (unsigned char *) p_value); } static int houston_WriteReg(unsigned int reg, unsigned long value, unsigned int bytes) { - return gfx_i2c_write(1, PLAL_FS450_i2c_address(), (unsigned char)reg, - (unsigned char)bytes, (unsigned char *)&value); + return gfx_i2c_write(1, PLAL_FS450_i2c_address(), (unsigned char) reg, + (unsigned char) bytes, (unsigned char *) &value); } /* TV configuration functions. */ @@ -324,7 +321,8 @@ static unsigned long supported_standards(void); static void config_tvout_mode(unsigned long tvout_mode); static void conget_tvout_mode(unsigned long *p_tvout_mode); static void config_overscan_xy(unsigned long tv_std, unsigned long vga_mode, - int overscan_x, int overscan_y, int pos_x, int pos_y); + int overscan_x, int overscan_y, int pos_x, + int pos_y); static void config_nco(unsigned long tv_std, unsigned long vga_mode); static void config_sharpness(int sharpness); static void conget_sharpness(int *p_sharpness); @@ -333,20 +331,21 @@ static void conget_flicker(int *p_flicker); static void config_color(int color); static void conget_color(int *p_color); static void config_brightness_contrast(unsigned long tv_std, - unsigned int trigger_bits, int brightness, int contrast); + unsigned int trigger_bits, + int brightness, int contrast); static void conget_brightness_contrast(unsigned long tv_std, - unsigned int trigger_bits, int *p_brightness, int *p_contrast); + unsigned int trigger_bits, + int *p_brightness, int *p_contrast); static void config_yc_filter(unsigned long tv_std, int luma_filter, - int chroma_filter); + int chroma_filter); static void conget_yc_filter(int *p_luma_filter, int *p_chroma_filter); static void config_macrovision(unsigned long tv_std, - unsigned int cp_trigger_bits); + unsigned int cp_trigger_bits); static void conget_macrovision(unsigned long tv_std, - unsigned int *p_cp_trigger_bits); + unsigned int *p_cp_trigger_bits); /* Device settings. */ -typedef struct _S_DEVICE_SETTINGS -{ +typedef struct _S_DEVICE_SETTINGS { int tv_on; unsigned long vga_mode; unsigned long tv_std; @@ -372,8 +371,7 @@ static S_DEVICE_SETTINGS d; *========================================================================== * */ -static const struct -{ +static const struct { unsigned long chroma_freq[5]; unsigned short chroma_phase[5]; unsigned short cphase_rst[5]; @@ -496,8 +494,7 @@ static const struct /* MediaGX default underscan and centered position setups. */ #define SCANTABLE_ENTRIES 5 -struct _scantable -{ +struct _scantable { unsigned long mode; unsigned short v_total[5]; unsigned short v_sync[5]; @@ -508,56 +505,54 @@ struct _scantable static struct _scantable scantable[SCANTABLE_ENTRIES] = { { - GFX_VGA_MODE_640X480, - {617, 624, 617, 624, 624}, /* v_total */ - {69, 88, 69, 88, 88}, /* v_sync */ - {720, 720, 720, 720, 720}, /* iha */ - {0, 0, 0, 0, 0}, /* iho */ - {-12, 0, -6, 0, 0} /* hsc */ - }, + GFX_VGA_MODE_640X480, + {617, 624, 617, 624, 624}, /* v_total */ + {69, 88, 69, 88, 88}, /* v_sync */ + {720, 720, 720, 720, 720}, /* iha */ + {0, 0, 0, 0, 0}, /* iho */ + {-12, 0, -6, 0, 0} /* hsc */ + }, { - GFX_VGA_MODE_800X600, - {740, 740, 740, 740, 740}, /* v_total */ - {90, 88, 90, 88, 88}, /* v_sync */ - {720, 720, 508, 720, 720}, /* iha */ - {-8, 11, -8, -8, 11}, /* iho */ - {-27, -27, -27, -27, -27} /* hsc */ - }, + GFX_VGA_MODE_800X600, + {740, 740, 740, 740, 740}, /* v_total */ + {90, 88, 90, 88, 88}, /* v_sync */ + {720, 720, 508, 720, 720}, /* iha */ + {-8, 11, -8, -8, 11}, /* iho */ + {-27, -27, -27, -27, -27} /* hsc */ + }, { - GFX_VGA_MODE_720X487, - {525, 720, 525, 720, 720}, /* v_total */ - {23, 230, 23, 230, 230}, /* v_sync */ - {720, 720, 720, 720, 720}, /* iha */ - {0xa2, 0xa2, 0xa2, 0xa2, 0xa2}, /* iho */ - {0, 0, 0, 0, 0} /* hsc */ - }, + GFX_VGA_MODE_720X487, + {525, 720, 525, 720, 720}, /* v_total */ + {23, 230, 23, 230, 230}, /* v_sync */ + {720, 720, 720, 720, 720}, /* iha */ + {0xa2, 0xa2, 0xa2, 0xa2, 0xa2}, /* iho */ + {0, 0, 0, 0, 0} /* hsc */ + }, { - GFX_VGA_MODE_720X576, - {720, 625, 720, 625, 625}, /* v_total */ - {129, 25, 129, 25, 25}, /* v_sync */ - {720, 720, 720, 720, 720}, /* iha */ - {0xaa, 0xaa, 0xaa, 0xaa, 0xaa}, /* iho */ - {0, 0, 0, 0, 0} /* hsc */ - }, + GFX_VGA_MODE_720X576, + {720, 625, 720, 625, 625}, /* v_total */ + {129, 25, 129, 25, 25}, /* v_sync */ + {720, 720, 720, 720, 720}, /* iha */ + {0xaa, 0xaa, 0xaa, 0xaa, 0xaa}, /* iho */ + {0, 0, 0, 0, 0} /* hsc */ + }, { - GFX_VGA_MODE_1024X768, - {933, 942, 933, 806, 806}, /* v_total */ - {121, 112, 121, 88, 88}, /* v_sync */ - {600, 600, 600, 600, 600}, /* iha */ - {0x3c, 0x23, 0x3c, 0x65, 0x65}, /* iho */ - {35, 26, 35, 26, 26} /* hsc */ - }, + GFX_VGA_MODE_1024X768, + {933, 942, 933, 806, 806}, /* v_total */ + {121, 112, 121, 88, 88}, /* v_sync */ + {600, 600, 600, 600, 600}, /* iha */ + {0x3c, 0x23, 0x3c, 0x65, 0x65}, /* iho */ + {35, 26, 35, 26, 26} /* hsc */ + }, }; /* Houston fifo configuration constants. */ -struct _ffolat -{ +struct _ffolat { int v_total; unsigned short ffolat; }; -struct _ffolativo -{ +struct _ffolativo { int v_total; unsigned short ivo; unsigned short ffolat; @@ -668,7 +663,7 @@ static struct _ffolat ffo7x5pal[SIZE7X5PAL + 1] = { /* h_total=1056, vga_lines=600 */ #define SIZE8X6NTSC 37 static struct _ffolat ffo8x6ntsc[SIZE8X6NTSC + 1] = { - {620, 0x40}, /* v_total_min >= vsync+10 >= vga_lines+10 = 610 */ + {620, 0x40}, /* v_total_min >= vsync+10 >= vga_lines+10 = 610 */ {625, 0x58}, {630, 0x40}, {635, 0x40}, {640, 0x40}, {645, 0x46}, {650, 0x46}, {655, 0x4f}, {660, 0x4c}, {665, 0x4a}, {670, 0x50}, {675, 0x2f}, {680, 0x48}, @@ -862,7 +857,7 @@ FS450_init(void) d.brightness = 50; d.contrast = 60; config_brightness_contrast(d.tv_std, d.aps_trigger_bits, d.brightness, - d.contrast); + d.contrast); /* get the current yc filtering */ { @@ -949,8 +944,9 @@ write_config(int req) if (REQ_OVERSCAN_POSITION_BIT & req) { config_overscan_xy(d.tv_std, - d.vga_mode, - d.overscan_x, d.overscan_y, d.position_x, d.position_y); + d.vga_mode, + d.overscan_x, d.overscan_y, d.position_x, + d.position_y); /*h_timing and v_timing and syncs. */ if (PLAL_IsTVOn()) @@ -971,13 +967,14 @@ write_config(int req) if (REQ_BRIGHTNESS_CONTRAST_BIT & req) { config_brightness_contrast(d.tv_std, - d.aps_trigger_bits, d.brightness, d.contrast); + d.aps_trigger_bits, d.brightness, + d.contrast); } if (REQ_YC_FILTER_BIT & req) { config_yc_filter(d.tv_std, - (d.yc_filter & GFX_LUMA_FILTER), - (d.yc_filter & GFX_CHROMA_FILTER)); + (d.yc_filter & GFX_LUMA_FILTER), + (d.yc_filter & GFX_CHROMA_FILTER)); } if (REQ_MACROVISION_BIT & req) @@ -1054,9 +1051,9 @@ gfx_set_tv_enable(int on) /*configure encoder and nco. */ write_config(REQ_VGA_MODE | - REQ_TV_STANDARD | - REQ_TVOUT_MODE | - REQ_OVERSCAN_POSITION | REQ_YC_FILTER | REQ_MACROVISION); + REQ_TV_STANDARD | + REQ_TVOUT_MODE | + REQ_OVERSCAN_POSITION | REQ_YC_FILTER | REQ_MACROVISION); /*set LP_EN and UIM */ houston_ReadReg(HOUSTON_CR, ®, 2); @@ -1664,19 +1661,19 @@ FS450_ReadRegister(S_REG_INFO * p_reg) switch (p_reg->size) { case 1: case 2: - { - houston_ReadReg((int)p_reg->offset, &tmp, (int)p_reg->size); - p_reg->value = tmp; - } + { + houston_ReadReg((int) p_reg->offset, &tmp, (int) p_reg->size); + p_reg->value = tmp; + } return 0; case 4: - { - houston_ReadReg((unsigned int)p_reg->offset, &tmp, 2); - p_reg->value = (tmp << 16); - houston_ReadReg((unsigned int)(p_reg->offset + 2), &tmp, 2); - p_reg->value |= tmp; - } + { + houston_ReadReg((unsigned int) p_reg->offset, &tmp, 2); + p_reg->value = (tmp << 16); + houston_ReadReg((unsigned int) (p_reg->offset + 2), &tmp, 2); + p_reg->value |= tmp; + } return 0; } } @@ -1691,8 +1688,8 @@ FS450_WriteRegister(S_REG_INFO * p_reg) return 0; if (SOURCE_HOUSTON == p_reg->source) { - houston_WriteReg((unsigned int)p_reg->offset, p_reg->value, - p_reg->size); + houston_WriteReg((unsigned int) p_reg->offset, p_reg->value, + p_reg->size); return 0; } @@ -1736,7 +1733,7 @@ houston_init(void) /*read chip revision. */ houston_ReadReg(HOUSTON_REV, &read, 2); - g_houston_rev = (int)read; + g_houston_rev = (int) read; /*ok. */ return 0; @@ -1793,8 +1790,7 @@ z2w10bit(unsigned short z) /* TV Standards */ /*==========================================================================*/ -static const struct -{ +static const struct { unsigned long standard; int tvsetup_index; } g_tv_standards[] = { @@ -1853,7 +1849,8 @@ config_power(int on) houston_WriteReg(HOUSTON_CR, reg, 2); reg &= ~CR_RESET; houston_WriteReg(HOUSTON_CR, reg, 2); - } else { + } + else { houston_ReadReg(HOUSTON_CR, ®, 2); reg |= CR_CLKOFF; houston_WriteReg(HOUSTON_CR, reg, 2); @@ -1877,7 +1874,8 @@ config_power(int on) houston_ReadReg(HOUSTON_MISC, ®, 2); reg &= ~MISC_GTLIO_PD; houston_WriteReg(HOUSTON_MISC, reg, 2); - } else { + } + else { /* CLKOFF, COMPOFF, YCOFF */ houston_ReadReg(HOUSTON_CR, ®, 2); reg |= (CR_CLKOFF | CR_COMPOFF | CR_YCOFF); @@ -1899,8 +1897,7 @@ config_vga_mode(unsigned long vga_mode) { /*h_total must be evenly divisible by 32? */ - static struct - { + static struct { unsigned long mode; int width; int lines; @@ -1940,7 +1937,8 @@ config_vga_mode(unsigned long vga_mode) /*XGA*/ cr |= CR_UIM_DEC; misc |= MISC_VGACKDIV; byp |= (BYP_HDS_BYPASS | BYP_CAC_BYPASS); - } else { + } + else { /*VGA,SVGA */ cr &= ~CR_UIM_DEC; misc &= ~MISC_VGACKDIV; @@ -1981,10 +1979,10 @@ config_tv_std(unsigned long tv_std, unsigned int trigger_bits) /*setup the encoder. */ l = tvsetup.chroma_freq[k]; - houston_WriteReg(ENC_CHROMA_FREQ, (int)(l & 0x00ff), 1); - houston_WriteReg(ENC_CHROMA_FREQ + 1, (int)((l >> 8) & 0x00ff), 1); - houston_WriteReg(ENC_CHROMA_FREQ + 2, (int)((l >> 16) & 0x00ff), 1); - houston_WriteReg(ENC_CHROMA_FREQ + 3, (int)((l >> 24) & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ, (int) (l & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 1, (int) ((l >> 8) & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 2, (int) ((l >> 16) & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 3, (int) ((l >> 24) & 0x00ff), 1); houston_WriteReg(ENC_CHROMA_PHASE, tvsetup.chroma_phase[k], 1); houston_WriteReg(ENC_REG05, 0x00, 1); /*reg 0x05 */ @@ -1999,11 +1997,11 @@ config_tv_std(unsigned long tv_std, unsigned int trigger_bits) if (trigger_bits == 0) w = w10bit2z(tvsetup.blank_level[k]); /*blank level */ else - w = w10bit2z((unsigned short)(tvsetup.blank_level[k] - - tvsetup.hamp_offset[k])); + w = w10bit2z((unsigned short) (tvsetup.blank_level[k] - + tvsetup.hamp_offset[k])); houston_WriteReg(ENC_BLANK_LEVEL, w & 0x00ff, 1); houston_WriteReg(ENC_BLANK_LEVEL + 1, w >> 8, 1); - w = w10bit2z(tvsetup.tv_lines[k]); /*num_lines */ + w = w10bit2z(tvsetup.tv_lines[k]); /*num_lines */ houston_WriteReg(ENC_NUM_LINES, w & 0x00ff, 1); houston_WriteReg(ENC_NUM_LINES + 1, w >> 8, 1); @@ -2022,7 +2020,7 @@ config_tv_std(unsigned long tv_std, unsigned int trigger_bits) if (trigger_bits == 0) w = w10bit2z(tvsetup.vbi_blank_level[k]); /*blank level */ else - w = w10bit2z((unsigned short)(tvsetup.vbi_blank_level[k] - 1)); + w = w10bit2z((unsigned short) (tvsetup.vbi_blank_level[k] - 1)); houston_WriteReg(ENC_VBI_BLANK_LEVEL, w & 0x00ff, 1); houston_WriteReg(ENC_VBI_BLANK_LEVEL + 1, w >> 8, 1); } @@ -2115,7 +2113,8 @@ conget_tvout_mode(unsigned long *p_tvout_mode) static void get_ffolat_ivo(unsigned long vga_mode, - unsigned long tv_std, long i, unsigned short *ffolat, unsigned short *ivo) + unsigned long tv_std, long i, unsigned short *ffolat, + unsigned short *ivo) { switch (vga_mode) { case GFX_VGA_MODE_640X480: @@ -2124,7 +2123,8 @@ get_ffolat_ivo(unsigned long vga_mode, i = SIZE6X4NTSC - 1; *ffolat = ffo6x4ntsc[i].ffolat; *ivo = 0x20; - } else { + } + else { if (i > SIZE6X4PAL - 1) i = SIZE6X4PAL - 1; *ffolat = ffo6x4pal[i].ffolat; @@ -2138,7 +2138,8 @@ get_ffolat_ivo(unsigned long vga_mode, i = SIZE8X6NTSC - 1; *ffolat = ffo8x6ntsc[i].ffolat; *ivo = 0x3a; - } else { + } + else { if (i > SIZE8X6PAL - 1) i = SIZE8X6PAL - 1; *ffolat = ffo8x6pal[i].ffolat; @@ -2147,12 +2148,12 @@ get_ffolat_ivo(unsigned long vga_mode, break; case GFX_VGA_MODE_720X487: - *ffolat = 0x40; /*FFO7x4; */ + *ffolat = 0x40; /*FFO7x4; */ *ivo = 0x1a; break; case GFX_VGA_MODE_720X576: - *ffolat = 0x40; /*FFO7x5; */ + *ffolat = 0x40; /*FFO7x5; */ *ivo = 0x1a; break; @@ -2163,7 +2164,8 @@ get_ffolat_ivo(unsigned long vga_mode, i = SIZE10X7NTSC - 1; *ffolat = ffo10x7ntsc[i].ffolat; *ivo = ffo10x7ntsc[i].ivo; - } else { + } + else { if (i > SIZE10X7PAL - 1) i = SIZE10X7PAL - 1; *ffolat = ffo10x7pal[i].ffolat; @@ -2177,7 +2179,8 @@ get_ffolat_ivo(unsigned long vga_mode, static void get_vtotal_min_max(unsigned long vga_mode, - unsigned long tv_std, int *v_total_min, int *v_total_max, int *v_step) + unsigned long tv_std, int *v_total_min, int *v_total_max, + int *v_step) { int k = map_tvstd_to_index(tv_std); @@ -2186,7 +2189,8 @@ get_vtotal_min_max(unsigned long vga_mode, if (IS_NTSC(tv_std)) { *v_total_min = ffo6x4ntsc[0].v_total; *v_total_max = ffo6x4ntsc[SIZE6X4NTSC - 1].v_total; - } else { + } + else { *v_total_min = ffo6x4pal[0].v_total; *v_total_max = ffo6x4pal[SIZE6X4PAL - 1].v_total; } @@ -2197,7 +2201,8 @@ get_vtotal_min_max(unsigned long vga_mode, if (IS_NTSC(tv_std)) { *v_total_min = ffo8x6ntsc[0].v_total; *v_total_max = ffo8x6ntsc[SIZE8X6NTSC - 1].v_total; - } else { + } + else { *v_total_min = ffo8x6pal[0].v_total; *v_total_max = ffo8x6pal[SIZE8X6PAL - 1].v_total; } @@ -2215,7 +2220,8 @@ get_vtotal_min_max(unsigned long vga_mode, if (IS_NTSC(tv_std)) { *v_total_min = ffo10x7ntsc[0].v_total; *v_total_max = ffo10x7ntsc[SIZE10X7NTSC - 1].v_total; - } else { + } + else { *v_total_min = ffo10x7pal[0].v_total; *v_total_max = ffo10x7pal[SIZE10X7PAL - 1].v_total; } @@ -2226,8 +2232,8 @@ get_vtotal_min_max(unsigned long vga_mode, static void config_overscan_xy(unsigned long tv_std, - unsigned long vga_mode, - int overscan_x, int overscan_y, int pos_x, int pos_y) + unsigned long vga_mode, + int overscan_x, int overscan_y, int pos_x, int pos_y) { unsigned int vga_index; unsigned long reg; @@ -2266,7 +2272,7 @@ config_overscan_xy(unsigned long tv_std, TRACE(("v_total range = %d\n", range)) /*map +/-1000 overscan y into +/-range. */ - v_offset = (int)((((float)overscan_y * range) / 1000.f) + .5f); + v_offset = (int) ((((float) overscan_y * range) / 1000.f) + .5f); TRACE(("v_offset = %d\n", v_offset)) /*range limit v_total. */ @@ -2283,26 +2289,27 @@ config_overscan_xy(unsigned long tv_std, houston_WriteReg(HOUSTON_IVO, ivo, 2); /*scale base sync offset by scaling ratio. */ - r = (float)g_specs.v_total / (float)base_v_total; - v_offset = (int)(r * (float)scantable[vga_index].v_sync[k]); + r = (float) g_specs.v_total / (float) base_v_total; + v_offset = (int) (r * (float) scantable[vga_index].v_sync[k]); /*scale ivo. */ - f = (float)ivo; - v_offset -= (int)(f - f / r); + f = (float) ivo; + v_offset -= (int) (f - f / r); /*compensate for center screen. */ - f = (float)tvsetup.tv_active_lines[k] / 2.f; - v_offset += (int)(f * r - f); + f = (float) tvsetup.tv_active_lines[k] / 2.f; + v_offset += (int) (f * r - f); /*calculate vsync. */ g_specs.v_sync = g_specs.v_total - v_offset + pos_y; TRACE(("desired v_total=%d, desired v_sync=%d\n", g_specs.v_total, - g_specs.v_sync)) + g_specs.v_sync)) if (g_specs.v_sync < g_specs.vga_lines + 10) { TRACE(("vsync too low\n")) /*d.v_total += d.vga_lines+10-d.v_sync; */ g_specs.v_sync = g_specs.vga_lines + 10; - } else if (g_specs.v_sync > g_specs.v_total - 10) { + } + else if (g_specs.v_sync > g_specs.v_total - 10) { TRACE(("vsync too high\n")) g_specs.v_sync = g_specs.v_total - 10; } @@ -2314,11 +2321,12 @@ config_overscan_xy(unsigned long tv_std, /* VSC. */ vsc = (65536.0f * (1.0f - - (double)g_specs.tv_lines / (double)g_specs.v_total)) + 0.5f; - reg = ((unsigned long)-vsc) & 0xffff; + (double) g_specs.tv_lines / (double) g_specs.v_total)) + + 0.5f; + reg = ((unsigned long) -vsc) & 0xffff; TRACE(("vsc=%04x, tv_lines=%d, v_total=%d\n", reg, g_specs.tv_lines, - g_specs.v_total)) - houston_WriteReg(HOUSTON_VSC, (int)reg, 2); + g_specs.v_total)) + houston_WriteReg(HOUSTON_VSC, (int) reg, 2); /* horizontal scaling. */ @@ -2333,22 +2341,22 @@ config_overscan_xy(unsigned long tv_std, hscale_max = (720.0f / vga_pixels); hscale_min = fsmax((0.75f * hscale_max), (1.0f - (63.0f / 128.0f))); TRACE(("hscale_min = %u.%u, hscale_max = %u.%u\n", - (int)hscale_min, - (int)((hscale_min - (int)hscale_min) * 1000), - (int)hscale_max, (int)((hscale_max - (int)hscale_max) * 1000))) + (int) hscale_min, + (int) ((hscale_min - (int) hscale_min) * 1000), + (int) hscale_max, (int) ((hscale_max - (int) hscale_max) * 1000))) /* map overscan_x into min to max. */ hscale = hscale_min + ((overscan_x + 1000.0f) / 2000.0f) * (hscale_max - - hscale_min); - TRACE(("hscale = %u.%u\n", (int)hscale, - (int)((hscale - (int)hscale) * 1000))) + hscale_min); + TRACE(("hscale = %u.%u\n", (int) hscale, + (int) ((hscale - (int) hscale) * 1000))) /* determine hsc where hscale = (1 + hsc/128) */ if (hscale >= 1.0f) - hsc = (int)(128.f * (hscale - 1.0f) + .5f); + hsc = (int) (128.f * (hscale - 1.0f) + .5f); else - hsc = (int)(128.f * (hscale - 1.0f) - .5f); + hsc = (int) (128.f * (hscale - 1.0f) - .5f); TRACE(("hsc = %d\n", hsc)) if (hsc >= 0) @@ -2358,15 +2366,15 @@ config_overscan_xy(unsigned long tv_std, /* recalculate hscale for future formulas */ hscale = 1.0f + (hsc / 128.0f); - TRACE(("recalculated hscale = %u.%u\n", (int)hscale, - (int)((hscale - (int)hscale) * 1000))) + TRACE(("recalculated hscale = %u.%u\n", (int) hscale, + (int) ((hscale - (int) hscale) * 1000))) /* horizontal offset. */ /* place hsync 40 before halfway from vga_width to htotal */ /* but not less than vga_width + 10 */ g_specs.h_sync = fsmax((g_specs.h_total + g_specs.vga_width) / 2 - 40, - g_specs.vga_width + 10); + g_specs.vga_width + 10); /* also, make it even */ g_specs.h_sync &= ~1; TRACE(("hsync = %u\n", g_specs.h_sync)) @@ -2380,13 +2388,13 @@ config_overscan_xy(unsigned long tv_std, /* to skip, or subtract. iho=0 maps to farthest right. */ /* map -pos_x = +/-1000 into (0 to iho_max) */ pre_pixels = - (int)((long)(g_specs.h_total - - g_specs.h_sync) * vga_pixels / g_specs.vga_width); - iho_max = (2 * pre_pixels) - ((int)(720.0f / hscale + 0.5f) - vga_pixels); + (int) ((long) (g_specs.h_total - + g_specs.h_sync) * vga_pixels / g_specs.vga_width); + iho_max = (2 * pre_pixels) - ((int) (720.0f / hscale + 0.5f) - vga_pixels); TRACE(("iho_max = %u\n", iho_max)) iho = - (int)range_limit(((long)(1000 - pos_x) * iho_max / 2000) + - scantable[vga_index].iho[k], 0, iho_max); + (int) range_limit(((long) (1000 - pos_x) * iho_max / 2000) + + scantable[vga_index].iho[k], 0, iho_max); TRACE(("iho = %u\n", iho)) houston_WriteReg(HOUSTON_IHO, iho, 2); @@ -2396,17 +2404,17 @@ config_overscan_xy(unsigned long tv_std, /* additionally, ihw cannot exceed tv width / hscale */ /* and if hsc is negative, (ihw)(-hsc/128) cannot exceed ~250. */ /* and ihw should be even. */ - ihw = fsmin(vga_pixels + pre_pixels - iho, (int)(720.0f / hscale)); + ihw = fsmin(vga_pixels + pre_pixels - iho, (int) (720.0f / hscale)); if (hsc < 0) - ihw = (int)fsmin(ihw, 253L * 128 / (-hsc)); + ihw = (int) fsmin(ihw, 253L * 128 / (-hsc)); ihw &= ~1; TRACE(("ihw = %u\n", ihw)) houston_WriteReg(HOUSTON_IHA, ihw, 2); - f = (((float)g_specs.h_total * g_specs.v_total) * 27.f) / - ((float)g_specs.tv_width * g_specs.tv_lines); + f = (((float) g_specs.h_total * g_specs.v_total) * 27.f) / + ((float) g_specs.tv_width * g_specs.tv_lines); - TRACE(("freq=%u.%uMHz\n", (int)f, (int)((f - (int)f) * 1000))) + TRACE(("freq=%u.%uMHz\n", (int) f, (int) ((f - (int) f) * 1000))) } /*==========================================================================*/ @@ -2452,20 +2460,21 @@ config_nco(unsigned long tv_std, unsigned long vga_mode) houston_WriteReg(HOUSTON_MISC, misc, 2); /*NCON. */ - reg = ((unsigned long)g_specs.v_total * g_specs.h_total) / 2; + reg = ((unsigned long) g_specs.v_total * g_specs.h_total) / 2; houston_WriteReg(HOUSTON_NCONH, reg >> 16, 2); houston_WriteReg(HOUSTON_NCONL, reg & 0xffff, 2); /*NCOD. */ houston_WriteReg(HOUSTON_NCODL, tvsetup.houston_ncodl[k], 2); houston_WriteReg(HOUSTON_NCODH, tvsetup.houston_ncodh[k], 2); - } else { + } + else { /*setup for M and N load (Nco_load=2). */ misc |= (MISC_NCO_LOAD1); houston_WriteReg(HOUSTON_MISC, misc, 2); /*NCON. */ - reg = (unsigned long)g_specs.v_total * g_specs.h_total; + reg = (unsigned long) g_specs.v_total * g_specs.h_total; houston_WriteReg(HOUSTON_NCONH, reg >> 16, 2); houston_WriteReg(HOUSTON_NCONL, reg & 0xffff, 2); @@ -2474,12 +2483,12 @@ config_nco(unsigned long tv_std, unsigned long vga_mode) houston_WriteReg(HOUSTON_NCODH, tvsetup.houston_ncodh[k], 2); TRACE(("NCON = %lu (0x%08lx), NCOD = %lu (0x%08lx)\n", - reg, - reg, - ((unsigned long)tvsetup.houston_ncodh[k] << 16) + - tvsetup.houston_ncodl[k], - ((unsigned long)tvsetup.houston_ncodh[k] << 16) + - tvsetup.houston_ncodl[k])) + reg, + reg, + ((unsigned long) tvsetup.houston_ncodh[k] << 16) + + tvsetup.houston_ncodl[k], + ((unsigned long) tvsetup.houston_ncodh[k] << 16) + + tvsetup.houston_ncodl[k])) } /*latch M/N and NCON/NCOD in. */ @@ -2499,7 +2508,7 @@ config_sharpness(int sharpness) unsigned int shp; /*map 0-1000 to 0-20. */ - shp = (unsigned int)(0.5f + ((float)sharpness * 20.0f / 1000.0f)); + shp = (unsigned int) (0.5f + ((float) sharpness * 20.0f / 1000.0f)); shp = range_limit(shp, 0, 20); houston_WriteReg(HOUSTON_SHP, shp, 2); @@ -2516,7 +2525,7 @@ conget_sharpness(int *p_sharpness) houston_ReadReg(HOUSTON_SHP, &shp, 2); /*map 0-20 to 0-1000. */ - *p_sharpness = (int)(0.5f + ((float)shp * 1000.0f / 20.0f)); + *p_sharpness = (int) (0.5f + ((float) shp * 1000.0f / 20.0f)); } /*==========================================================================*/ @@ -2529,7 +2538,7 @@ config_flicker(int flicker) unsigned int flk; /*map 0-1000 to 0-16. */ - flk = (unsigned int)(0.5f + ((float)flicker * 16.0f / 1000.0f)); + flk = (unsigned int) (0.5f + ((float) flicker * 16.0f / 1000.0f)); flk = range_limit(flk, 0, 16); houston_WriteReg(HOUSTON_FLK, flk, 2); @@ -2546,7 +2555,7 @@ conget_flicker(int *p_flicker) houston_ReadReg(HOUSTON_FLK, &flk, 2); /*map 0-16 to 0-1000. */ - *p_flicker = (int)(0.5f + ((float)flk * 1000.0f / 16.0f)); + *p_flicker = (int) (0.5f + ((float) flk * 1000.0f / 16.0f)); } /*==========================================================================*/ @@ -2561,7 +2570,7 @@ config_color(int color) /*map 0-100 to 0-255. */ /*montreal production test needs 169 to be mappable, so */ /*use .8 rounding factor, 169=(int)(66.*2.55+.8). */ - clr = (unsigned long)(0.8f + ((float)color * 255.0f / 100.0f)); + clr = (unsigned long) (0.8f + ((float) color * 255.0f / 100.0f)); clr = range_limit(clr, 0, 255); houston_WriteReg(ENC_CR_GAIN, clr, 1); @@ -2580,7 +2589,7 @@ conget_color(int *p_color) houston_ReadReg(ENC_CR_GAIN, &cr_gain, 1); /*map 0-255 to 0-100. */ - *p_color = (int)(0.5f + ((float)cr_gain * 100.0f / 255.0f)); + *p_color = (int) (0.5f + ((float) cr_gain * 100.0f / 255.0f)); } /*==========================================================================*/ @@ -2594,7 +2603,7 @@ static const int max_white_level = 1023; static void config_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, - int brightness, int contrast) + int brightness, int contrast) { int brightness_off; float contrast_mult; @@ -2604,10 +2613,10 @@ config_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, /*0-100 maps to +/-220. */ brightness_off = - (int)(0.5f + ((float)brightness * 440.0f / 100.0f)) - 220; + (int) (0.5f + ((float) brightness * 440.0f / 100.0f)) - 220; /*0-100 maps to .75-1.25. */ - contrast_mult = ((float)contrast * 0.5f / 100.0f) + 0.75f; + contrast_mult = ((float) contrast * 0.5f / 100.0f) + 0.75f; black = tvsetup.black_level[k]; if (trigger_bits != 0) @@ -2617,24 +2626,24 @@ config_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, if (trigger_bits != 0) white -= tvsetup.hamp_offset[k]; - black = (int)((float)(black + brightness_off) * contrast_mult); - white = (int)((float)(white + brightness_off) * contrast_mult); + black = (int) ((float) (black + brightness_off) * contrast_mult); + white = (int) ((float) (white + brightness_off) * contrast_mult); if (black < min_black_level) black = min_black_level; if (white > max_white_level) white = max_white_level; - w = w10bit2z((unsigned short)black); + w = w10bit2z((unsigned short) black); houston_WriteReg(ENC_BLACK_LEVEL, w & 0x00ff, 1); houston_WriteReg(ENC_BLACK_LEVEL + 1, w >> 8, 1); - w = w10bit2z((unsigned short)white); + w = w10bit2z((unsigned short) white); houston_WriteReg(ENC_WHITE_LEVEL, w & 0x00ff, 1); houston_WriteReg(ENC_WHITE_LEVEL + 1, w >> 8, 1); } static void conget_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, - int *p_brightness, int *p_contrast) + int *p_brightness, int *p_contrast) { int brightness_off; float contrast_mult; @@ -2649,32 +2658,32 @@ conget_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, houston_ReadReg(ENC_BLACK_LEVEL, &zl, 1); houston_ReadReg(ENC_BLACK_LEVEL + 1, &zh, 1); - black = z2w10bit((unsigned short)(zl + (zh << 8))); + black = z2w10bit((unsigned short) (zl + (zh << 8))); if (trigger_bits != 0) black += tvsetup.hamp_offset[k]; houston_ReadReg(ENC_WHITE_LEVEL, &zl, 1); houston_ReadReg(ENC_WHITE_LEVEL + 1, &zh, 1); - white = z2w10bit((unsigned short)(zl + (zh << 8))); + white = z2w10bit((unsigned short) (zl + (zh << 8))); if (trigger_bits != 0) white += tvsetup.hamp_offset[k]; /*this reverse computation does not account for clipping, but should */ /*provide somewhat reasonable numbers */ contrast_mult = - ((float)white - (float)black) / ((float)tvsetup.white_level[k] - - (float)tvsetup.black_level[k]); + ((float) white - (float) black) / ((float) tvsetup.white_level[k] - + (float) tvsetup.black_level[k]); brightness_off = - (int)(((float)black / contrast_mult) - tvsetup.black_level[k]); + (int) (((float) black / contrast_mult) - tvsetup.black_level[k]); /*+/-220 maps to 0-100. */ *p_brightness = - range_limit((int)(0.5f + ((float)(brightness_off + - 220) * 100.0f / 440.0f)), 0, 100); + range_limit((int) (0.5f + ((float) (brightness_off + + 220) * 100.0f / 440.0f)), 0, 100); /*.75-1.25 maps to 0-100. */ *p_contrast = - range_limit((int)(0.5f + ((float)(contrast_mult - - 0.75f) * 100.0f / 0.5f)), 0, 100); + range_limit((int) (0.5f + ((float) (contrast_mult - + 0.75f) * 100.0f / 0.5f)), 0, 100); } /*==========================================================================*/ @@ -2702,7 +2711,8 @@ config_yc_filter(unsigned long tv_std, int luma_filter, int chroma_filter) if (chroma_filter) { reg07 &= ~0x08; reg34 &= ~0x20; - } else { + } + else { reg07 |= 0x08; reg34 |= 0x20; } @@ -2742,17 +2752,16 @@ static void config_macrovision(unsigned long tv_std, unsigned int trigger_bits) { /*Constants to index into mvsetup columns.*/ -#define nNTSC_APS00 0 /*ntsc mv off. */ -#define nNTSC_APS01 1 /*ntsc AGC only. */ -#define nNTSC_APS10 2 /*ntsc AGC + 2-line CS. */ -#define nNTSC_APS11 3 /*ntsc AGC + 4-line CS. */ -#define nPAL_APS00 4 /*pal mv off. */ -#define nPAL_APSXX 5 /*pal mv on. */ +#define nNTSC_APS00 0 /*ntsc mv off. */ +#define nNTSC_APS01 1 /*ntsc AGC only. */ +#define nNTSC_APS10 2 /*ntsc AGC + 2-line CS. */ +#define nNTSC_APS11 3 /*ntsc AGC + 4-line CS. */ +#define nPAL_APS00 4 /*pal mv off. */ +#define nPAL_APSXX 5 /*pal mv on. */ #define nMVModes 6 /*Macrovision setup table. */ - static const struct mvparms - { + static const struct mvparms { unsigned short n0[nMVModes]; unsigned short n1[nMVModes]; unsigned short n2[nMVModes]; @@ -2778,9 +2787,7 @@ config_macrovision(unsigned long tv_std, unsigned int trigger_bits) unsigned short n22[nMVModes]; unsigned short agc_pulse_level[nMVModes]; unsigned short bp_pulse_level[nMVModes]; - } - - mvsetup = { + } mvsetup = { /* ntsc ntsc ntsc ntsc pal pal */ /* MV AGC AGC + AGC + MV MV */ /* off. only 2-line 4-line off. on. */ @@ -2849,22 +2856,27 @@ config_macrovision(unsigned long tv_std, unsigned int trigger_bits) if (trigger_bits == 0) { /*turn Macrovision OFF. */ nMode = nNTSC_APS00; - } else if (trigger_bits == 1) { + } + else if (trigger_bits == 1) { /*AGC Only. */ nMode = nNTSC_APS01; - } else if (trigger_bits == 2) { + } + else if (trigger_bits == 2) { /*AGC + 2-line CS. */ nMode = nNTSC_APS10; - } else { + } + else { /*AGC + 4-line CS. */ nMode = nNTSC_APS11; } - } else { + } + else { /*PAL TV Standard. */ if (trigger_bits == 0) { /*turn Macrovision OFF. */ nMode = nPAL_APS00; - } else { + } + else { /*APS 01, 10, or 11. */ nMode = nPAL_APSXX; } @@ -2943,15 +2955,16 @@ conget_macrovision(unsigned long tv_std, unsigned int *p_cp_trigger_bits) break; case 0x3E: - { - if (0x1D == n1) - *p_cp_trigger_bits = 2; - else - *p_cp_trigger_bits = 3; - } + { + if (0x1D == n1) + *p_cp_trigger_bits = 2; + else + *p_cp_trigger_bits = 3; + } break; } - } else if (IS_PAL(tv_std)) { + } + else if (IS_PAL(tv_std)) { if (0 == n0) *p_cp_trigger_bits = 0; else { @@ -3178,7 +3191,7 @@ PLAL_PrepForTVout(void) WriteGx(CX_TV_CONFIG, reg); /*invert FP clock */ - reg = (int)ReadGx(CX_TV_CONFIG); + reg = (int) ReadGx(CX_TV_CONFIG); reg |= CX_INVERT_FPCLK; WriteGx(CX_TV_CONFIG, reg); @@ -3240,12 +3253,12 @@ PLAL_FinalEnableTVout(unsigned long vga_mode) unsigned int reg; /*Cx5530 select tv dot clock. */ - reg = (int)ReadGx(CX_DOT_CLK); + reg = (int) ReadGx(CX_DOT_CLK); reg |= CX_TVCLK_SELECT; WriteGx(CX_DOT_CLK, reg); /*2 x dclk (actually 1x) */ - reg = (int)ReadGx(DC_GENERAL_CFG); + reg = (int) ReadGx(DC_GENERAL_CFG); reg &= ~GX_DCLK_MUL; WriteGx(DC_GENERAL_CFG, reg); @@ -3253,7 +3266,7 @@ PLAL_FinalEnableTVout(unsigned long vga_mode) WriteGx(DC_GENERAL_CFG, reg); /*Cx5530 display configuration register. */ - reg = (int)ReadGx(CX_DISPLAY_CONFIG); + reg = (int) ReadGx(CX_DISPLAY_CONFIG); reg |= (CX_FPVSYNC_POL | CX_FPHSYNC_POL | CX_FPDATA_ENB | CX_FPPOWER_ENB); WriteGx(CX_DISPLAY_CONFIG, reg); diff --git a/src/gfx/tv_fs450.h b/src/gfx/tv_fs450.h index 7e917c0..4da7a21 100644 --- a/src/gfx/tv_fs450.h +++ b/src/gfx/tv_fs450.h @@ -31,8 +31,7 @@ #define __FS450_H__ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif /*==========================================================================*/ @@ -171,8 +170,7 @@ extern "C" #define SOURCE_HOUSTON 0 #define SOURCE_GCC 1 - typedef struct _S_REG_INFO - { + typedef struct _S_REG_INFO { int source; unsigned int size; unsigned long offset; @@ -202,5 +200,4 @@ extern "C" #ifdef __cplusplus } #endif - #endif diff --git a/src/gfx/vga_gu1.c b/src/gfx/vga_gu1.c index 20cf232..8cbfe4f 100644 --- a/src/gfx/vga_gu1.c +++ b/src/gfx/vga_gu1.c @@ -60,189 +60,189 @@ int gu1_detect_vsa2(void); gfx_vga_struct gfx_vga_modes[] = { /*--------------------------------------------------------------------------*/ { - 640, 480, 60, /* 640x480 */ - 25, /* 25 MHz clock = 60 Hz refresh rate */ - 0xE3, /* miscOutput register */ - { - 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, - /* standard CRTC */ - 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xEA, 0x0C, 0xDF, 0x50, 0x00, 0xE7, 0x04, 0xE3, 0xFF}, - { - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00} - }, + 640, 480, 60, /* 640x480 */ + 25, /* 25 MHz clock = 60 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, + /* standard CRTC */ + 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xEA, 0x0C, 0xDF, 0x50, 0x00, 0xE7, 0x04, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 640, 480, 72, /* 640x480 */ - 29, /* 29 MHz clock = 72 Hz refresh rate */ - 0xE3, /* miscOutput register */ - { - 0x63, 0x4f, 0x50, 0x86, 0x55, 0x99, 0x06, 0x3e, - /* standard CRTC */ - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe9, 0x0c, 0xdf, 0x00, 0x00, 0xe7, 0x00, 0xe3, 0xff}, - { - 0x6D, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x01, 0x08, 0x80, 0x1F, 0x00, 0x4B} - }, + 640, 480, 72, /* 640x480 */ + 29, /* 29 MHz clock = 72 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x63, 0x4f, 0x50, 0x86, 0x55, 0x99, 0x06, 0x3e, + /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe9, 0x0c, 0xdf, 0x00, 0x00, 0xe7, 0x00, 0xe3, 0xff}, + { + 0x6D, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x08, 0x80, 0x1F, 0x00, 0x4B} + }, /*--------------------------------------------------------------------------*/ { - 640, 480, 75, /* 640x480 */ - 31, - /* 31.5 MHz clock = 75 Hz refresh rate */ - 0xE3, /* miscOutput register */ - { - 0x64, 0x4F, 0x4F, 0x88, 0x54, 0x9B, 0xF2, 0x1F, - /* standard CRTC */ - 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xE1, 0x04, 0xDF, 0x50, 0x00, 0xDF, 0xF3, 0xE3, 0xFF}, - { - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x80, 0x1F, 0x00, 0x00} - }, + 640, 480, 75, /* 640x480 */ + 31, + /* 31.5 MHz clock = 75 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x64, 0x4F, 0x4F, 0x88, 0x54, 0x9B, 0xF2, 0x1F, + /* standard CRTC */ + 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE1, 0x04, 0xDF, 0x50, 0x00, 0xDF, 0xF3, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x1F, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 800, 600, 60, /* 800x600 */ - 40, /* 40 MHz clock = 60 Hz refresh rate */ - 0x23, /* miscOutput register */ - { - 0x7F, 0x63, 0x64, 0x82, 0x6B, 0x1B, 0x72, 0xF0, - /* standard CRTC */ - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x59, 0x0D, 0x57, 0x64, 0x00, 0x57, 0x73, 0xE3, 0xFF}, - { - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x80, 0x28, 0x00, 0x00} - }, + 800, 600, 60, /* 800x600 */ + 40, /* 40 MHz clock = 60 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0x7F, 0x63, 0x64, 0x82, 0x6B, 0x1B, 0x72, 0xF0, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x0D, 0x57, 0x64, 0x00, 0x57, 0x73, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x28, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 800, 600, 72, /* 800x600 */ - 47, /* 47 MHz clock = 72 Hz refresh rate */ - 0x2B, /* miscOutput register */ - { - 0x7D, 0x63, 0x63, 0x81, 0x6D, 0x1B, 0x98, 0xF0, - /* standard CRTC */ - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7D, 0x03, 0x57, 0x00, 0x00, 0x57, 0x9A, 0xE3, 0xFF}, - { - 0x6F, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x01, 0x08, 0x80, 0x32, 0x00, 0x4B} - }, + 800, 600, 72, /* 800x600 */ + 47, /* 47 MHz clock = 72 Hz refresh rate */ + 0x2B, /* miscOutput register */ + { + 0x7D, 0x63, 0x63, 0x81, 0x6D, 0x1B, 0x98, 0xF0, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7D, 0x03, 0x57, 0x00, 0x00, 0x57, 0x9A, 0xE3, 0xFF}, + { + 0x6F, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x08, 0x80, 0x32, 0x00, 0x4B} + }, /*--------------------------------------------------------------------------*/ { - 800, 600, 75, /* 800x600 */ - 49, - /* 49.5 MHz clock = 75 Hz refresh rate */ - 0x23, /* miscOutput register */ - { - 0x7F, 0x63, 0x63, 0x83, 0x68, 0x11, 0x6F, 0xF0, - /* standard CRTC */ - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x59, 0x1C, 0x57, 0x64, 0x00, 0x57, 0x70, 0xE3, 0xFF}, - { - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x80, 0x31, 0x00, 0x00} - }, + 800, 600, 75, /* 800x600 */ + 49, + /* 49.5 MHz clock = 75 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0x7F, 0x63, 0x63, 0x83, 0x68, 0x11, 0x6F, 0xF0, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x1C, 0x57, 0x64, 0x00, 0x57, 0x70, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x31, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 1024, 768, 60, /* 1024x768 */ - 65, /* 65 MHz clock = 60 Hz refresh rate */ - 0xE3, /* miscOutput register */ - { - 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xF5, - /* standard CRTC */ - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x0A, 0xFF, 0x80, 0x00, 0xFF, 0x25, 0xE3, 0xFF}, - { - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x80, 0x41, 0x00, 0x00} - }, + 1024, 768, 60, /* 1024x768 */ + 65, /* 65 MHz clock = 60 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xF5, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x0A, 0xFF, 0x80, 0x00, 0xFF, 0x25, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x41, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 1024, 768, 70, /* 1024x768 */ - 76, /* 76 MHz clock = 70 Hz refresh rate */ - 0x2B, /* miscOutput register */ - { - 0xA1, 0x7F, 0x7F, 0x85, 0x85, 0x95, 0x24, 0xF5, - /* standard CRTC */ - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x09, 0xFF, 0x00, 0x00, 0xFF, 0x26, 0xE3, 0xFF}, - { - 0x62, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x01, 0x02, 0x80, 0x4B, 0x00, 0x4B} - }, + 1024, 768, 70, /* 1024x768 */ + 76, /* 76 MHz clock = 70 Hz refresh rate */ + 0x2B, /* miscOutput register */ + { + 0xA1, 0x7F, 0x7F, 0x85, 0x85, 0x95, 0x24, 0xF5, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x00, 0x00, 0xFF, 0x26, 0xE3, 0xFF}, + { + 0x62, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x02, 0x80, 0x4B, 0x00, 0x4B} + }, /*--------------------------------------------------------------------------*/ { - 1024, 768, 75, /* 1024x768 */ - 79, /* 79 MHz clock = 75 Hz refresh rate */ - 0xE3, /* miscOutput register */ - { - 0x9F, 0x7F, 0x7F, 0x83, 0x84, 0x8F, 0x1E, 0xF5, - /* standard CRTC */ - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x04, 0xFF, 0x80, 0x00, 0xFF, 0x1F, 0xE3, 0xFF}, - { - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x80, 0x4F, 0x00, 0x00} - }, + 1024, 768, 75, /* 1024x768 */ + 79, /* 79 MHz clock = 75 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x9F, 0x7F, 0x7F, 0x83, 0x84, 0x8F, 0x1E, 0xF5, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0x80, 0x00, 0xFF, 0x1F, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x4F, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 1280, 1024, 60, /* 1280x1024 */ - 108, - /* 108 MHz clock = 60 Hz refresh rate */ - 0x23, /* miscOutput register */ - { - 0xCF, 0x9F, 0xA0, 0x92, 0xAA, 0x19, 0x28, 0x52, - /* standard CRTC */ - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, - { - 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x80, 0x6C, 0x00, 0x00} - }, + 1280, 1024, 60, /* 1280x1024 */ + 108, + /* 108 MHz clock = 60 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0xCF, 0x9F, 0xA0, 0x92, 0xAA, 0x19, 0x28, 0x52, + /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, + { + 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x6C, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 1280, 1024, 75, /* 1280x1024 */ - 135, - /* 135 MHz clock = 75 Hz refresh rate */ - 0x23, /* miscOutput register */ - { - 0xCE, 0x9F, 0x9F, 0x92, 0xA4, 0x15, 0x28, 0x52, - /* standard CRTC */ - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, - { - 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x00, 0x03, 0x80, 0x87, 0x00, 0x00} - }, + 1280, 1024, 75, /* 1280x1024 */ + 135, + /* 135 MHz clock = 75 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0xCE, 0x9F, 0x9F, 0x92, 0xA4, 0x15, 0x28, 0x52, + /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, + { + 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x87, 0x00, 0x00} + }, /*--------------------------------------------------------------------------*/ { - 1280, 1024, 85, /* 1280x1024 */ - 159, - /* 159 MHz clock = 85 Hz refresh rate */ - 0x2B, /* miscOutput register */ - { - 0xD3, 0x9F, 0xA0, 0x98, 0xA8, 0x9C, 0x2E, 0x5A, - /* standard CRTC */ - 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x04, 0xFF, 0x00, 0x00, 0xFF, 0x30, 0xE3, 0xFF}, - { - 0x6B, 0x41, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, - /* extended CRTC */ - 0x00, 0x00, 0x01, 0x00, 0x80, 0x9D, 0x00, 0x4B} - }, + 1280, 1024, 85, /* 1280x1024 */ + 159, + /* 159 MHz clock = 85 Hz refresh rate */ + 0x2B, /* miscOutput register */ + { + 0xD3, 0x9F, 0xA0, 0x98, 0xA8, 0x9C, 0x2E, 0x5A, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0x00, 0x00, 0xFF, 0x30, 0xE3, 0xFF}, + { + 0x6B, 0x41, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x00, 0x80, 0x9D, 0x00, 0x4B} + }, /*--------------------------------------------------------------------------*/ }; @@ -314,7 +314,7 @@ gfx_vga_get_pci_command(void) unsigned long value; value = gfx_pci_config_read(0x80009404); - return ((unsigned char)value); + return ((unsigned char) value); } /*---------------------------------------------------------------------------- @@ -333,7 +333,7 @@ gfx_vga_set_pci_command(unsigned char command) unsigned long value; value = gfx_pci_config_read(0x80009404) & 0xFFFFFF00; - value |= (unsigned long)command; + value |= (unsigned long) command; gfx_pci_config_write(0x80009404, value); return (GFX_STATUS_OK); } @@ -351,7 +351,7 @@ int gfx_vga_seq_reset(int reset) { OUTB(0x3C4, 0); - OUTB(0x3C5, (unsigned char)(reset ? 0x00 : 0x03)); + OUTB(0x3C5, (unsigned char) (reset ? 0x00 : 0x03)); return (GFX_STATUS_OK); } @@ -377,7 +377,7 @@ gfx_vga_set_graphics_bits(void) /* SET GRAPHICS BIT IN ATTRIBUTE CONTROLLER REG 0x10 */ - INB(0x3BA); /* Reset flip-flop */ + INB(0x3BA); /* Reset flip-flop */ INB(0x3DA); OUTB(0x3C0, 0x10); OUTB(0x3C0, 0x01); @@ -409,15 +409,15 @@ gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, int hz) /* SET PITCH TO 1K OR 2K */ /* CRTC_EXTENDED_OFFSET index is 0x45, so offset = 0x05 */ - pitch = (unsigned short)xres; + pitch = (unsigned short) xres; if (bpp > 8) pitch <<= 1; if (pitch <= 1024) pitch = 1024 >> 3; else pitch = 2048 >> 3; - vga->stdCRTCregs[0x13] = (unsigned char)pitch; - vga->extCRTCregs[0x05] = (unsigned char)((pitch >> 8) & 0x03); + vga->stdCRTCregs[0x13] = (unsigned char) pitch; + vga->extCRTCregs[0x05] = (unsigned char) ((pitch >> 8) & 0x03); /* SET PROPER COLOR DEPTH VALUE */ /* CRTC_EXTENDED_COLOR_CONTROL index is 0x46, so offset = 0x06 */ @@ -450,8 +450,8 @@ int gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch) { pitch >>= 3; - vga->stdCRTCregs[0x13] = (unsigned char)pitch; - vga->extCRTCregs[0x05] = (unsigned char)((pitch >> 8) & 0x03); + vga->stdCRTCregs[0x13] = (unsigned char) pitch; + vga->extCRTCregs[0x05] = (unsigned char) ((pitch >> 8) & 0x03); return (0); } @@ -486,7 +486,7 @@ gfx_vga_save(gfx_vga_struct * vga, int flags) /* SAVE STANDARD CRTC REGISTERS */ for (i = 0; i < GFX_STD_CRTC_REGS; i++) { - OUTB(crtcindex, (unsigned char)i); + OUTB(crtcindex, (unsigned char) i); vga->stdCRTCregs[i] = INB(crtcdata); } } @@ -497,7 +497,7 @@ gfx_vga_save(gfx_vga_struct * vga, int flags) /* SAVE EXTENDED CRTC REGISTERS */ for (i = 0; i < GFX_EXT_CRTC_REGS; i++) { - OUTB(crtcindex, (unsigned char)(0x40 + i)); + OUTB(crtcindex, (unsigned char) (0x40 + i)); vga->extCRTCregs[i] = INB(crtcdata); } } @@ -524,7 +524,7 @@ gfx_vga_clear_extended(void) OUTB(crtcdata, 0x57); OUTB(crtcdata, 0x4C); for (i = 0x40; i <= 0x4F; i++) { - OUTB(crtcindex, (unsigned char)i); + OUTB(crtcindex, (unsigned char) i); OUTB(crtcdata, 0); } OUTB(crtcindex, 0x30); @@ -567,7 +567,7 @@ gfx_vga_restore(gfx_vga_struct * vga, int flags) /* RESTORE STANDARD CRTC REGISTERS */ for (i = 0; i < GFX_STD_CRTC_REGS; i++) { - OUTB(crtcindex, (unsigned char)i); + OUTB(crtcindex, (unsigned char) i); OUTB(crtcdata, vga->stdCRTCregs[i]); } } @@ -584,7 +584,7 @@ gfx_vga_restore(gfx_vga_struct * vga, int flags) /* RESTORE EXTENDED CRTC REGISTERS */ for (i = 0; i < GFX_EXT_CRTC_REGS; i++) { - OUTB(crtcindex, (unsigned char)(0x40 + i)); + OUTB(crtcindex, (unsigned char) (0x40 + i)); OUTB(crtcdata, vga->extCRTCregs[i]); } @@ -600,7 +600,7 @@ gfx_vga_restore(gfx_vga_struct * vga, int flags) /* This really should be another thing saved/restored, but */ /* Durango currently doesn't do the attr controller registers. */ - INB(0x3BA); /* Reset flip-flop */ + INB(0x3BA); /* Reset flip-flop */ INB(0x3DA); OUTB(0x3C0, 0x11); OUTB(0x3C0, 0x00); @@ -636,7 +636,7 @@ gfx_vga_mode_switch(int active) OUTB(crtcindex, CRTC_MODE_SWITCH_CONTROL); active = active ? 1 : 0; - OUTB(crtcdata, (unsigned char)active); + OUTB(crtcdata, (unsigned char) active); /* WAIT UNTIL SOFTVGA HAS VALIDATED MODE IF ENDING MODE SWITCH */ /* This is for VSA1 only, where SoftVGA waits until the next */ @@ -644,7 +644,7 @@ gfx_vga_mode_switch(int active) if ((!active) && (!(gu1_detect_vsa2()))) { OUTB(crtcindex, 0x33); - while (INB(crtcdata) & 0x80) ; + while (INB(crtcdata) & 0x80); } /* LOCK EXTENDED CRTC REGISTERS */ diff --git a/src/gfx/vid_1200.c b/src/gfx/vid_1200.c index 5eb5793..abc1b54 100644 --- a/src/gfx/vid_1200.c +++ b/src/gfx/vid_1200.c @@ -83,10 +83,9 @@ unsigned long gfx_gamma_ram_1200[] = { *---------------------------------------------------------------------------- */ -typedef struct tagSC1200PLL -{ - long frequency; /* 16.16 fixed point frequency */ - unsigned long clock_select; /* clock select register (0x2C) */ +typedef struct tagSC1200PLL { + long frequency; /* 16.16 fixed point frequency */ + unsigned long clock_select; /* clock select register (0x2C) */ } SC1200PLL; SC1200PLL gfx_sc1200_clock_table[] = { @@ -132,20 +131,20 @@ SC1200PLL gfx_sc1200_clock_table[] = { {(232L << 16) | ((0000L * 65536L) / 10000L), 0x0010AA04}, /* 232.50 */ /* Precomputed inidces in the hardware */ - {0x0018EC4D, 0x000F0000}, /* 24.923052 */ - {0x00192CCC, 0x00000000}, /* 25.1750 */ - {0x001B0000, 0x00300100}, /* 27.0000 */ - {0x001F8000, 0x00010000}, /* 31.5000 */ - {0x00240000, 0x00020000}, /* 36.0000 */ - {0x00280000, 0x00030000}, /* 40.0000 */ - {0x00318000, 0x00050000}, /* 49.5000 */ - {0x00320000, 0x00040000}, /* 50.0000 */ - {0x00384000, 0x00060000}, /* 56.2500 */ - {0x00410000, 0x00080000}, /* 65.0000 */ - {0x004E8000, 0x000A0000}, /* 78.5000 */ - {0x005E8000, 0x000B0000}, /* 94.5000 */ - {0x006C0000, 0x000C0000}, /* 108.0000 */ - {0x00870000, 0x000D0000}, /* 135.0000 */ + {0x0018EC4D, 0x000F0000}, /* 24.923052 */ + {0x00192CCC, 0x00000000}, /* 25.1750 */ + {0x001B0000, 0x00300100}, /* 27.0000 */ + {0x001F8000, 0x00010000}, /* 31.5000 */ + {0x00240000, 0x00020000}, /* 36.0000 */ + {0x00280000, 0x00030000}, /* 40.0000 */ + {0x00318000, 0x00050000}, /* 49.5000 */ + {0x00320000, 0x00040000}, /* 50.0000 */ + {0x00384000, 0x00060000}, /* 56.2500 */ + {0x00410000, 0x00080000}, /* 65.0000 */ + {0x004E8000, 0x000A0000}, /* 78.5000 */ + {0x005E8000, 0x000B0000}, /* 94.5000 */ + {0x006C0000, 0x000C0000}, /* 108.0000 */ + {0x00870000, 0x000D0000}, /* 135.0000 */ }; #define NUM_SC1200_FREQUENCIES \ @@ -186,10 +185,10 @@ gfx_reset_video(void) gfx_set_display_video_size(0, 0); if (gfx_test_timing_active()) { - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); } } @@ -222,11 +221,11 @@ gfx_set_display_control(int sync_polarities) dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); dcfg &= ~(SC1200_DCFG_CRT_SYNC_SKW_MASK | SC1200_DCFG_PWR_SEQ_DLY_MASK | - SC1200_DCFG_CRT_HSYNC_POL | SC1200_DCFG_CRT_VSYNC_POL | - SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); + SC1200_DCFG_CRT_HSYNC_POL | SC1200_DCFG_CRT_VSYNC_POL | + SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); dcfg |= (SC1200_DCFG_CRT_SYNC_SKW_INIT | - SC1200_DCFG_PWR_SEQ_DLY_INIT | SC1200_DCFG_GV_PAL_BYP); + SC1200_DCFG_PWR_SEQ_DLY_INIT | SC1200_DCFG_GV_PAL_BYP); if (PanelEnable) dcfg |= SC1200_DCFG_FP_PWR_EN; @@ -267,11 +266,11 @@ gfx_set_clock_frequency(unsigned long frequency) /* Search the table for the closest frequency (16.16 format). */ value = gfx_sc1200_clock_table[0].clock_select; - min = (long)gfx_sc1200_clock_table[0].frequency - frequency; + min = (long) gfx_sc1200_clock_table[0].frequency - frequency; if (min < 0L) min = -min; for (index = 1; index < NUM_SC1200_FREQUENCIES; index++) { - diff = (long)gfx_sc1200_clock_table[index].frequency - frequency; + diff = (long) gfx_sc1200_clock_table[index].frequency - frequency; if (diff < 0L) diff = -diff; if (diff < min) { @@ -338,30 +337,31 @@ gfx_set_crt_enable(int enable) */ switch (enable) { - case CRT_DISABLE: /* HSync:Off VSync:Off */ + case CRT_DISABLE: /* HSync:Off VSync:Off */ WRITE_VID32(SC1200_DISPLAY_CONFIG, config & ~(SC1200_DCFG_HSYNC_EN - | SC1200_DCFG_VSYNC_EN | SC1200_DCFG_DAC_BL_EN)); + | SC1200_DCFG_VSYNC_EN | + SC1200_DCFG_DAC_BL_EN)); WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); break; - case CRT_ENABLE: /* Enable CRT display, including - * display logic */ + case CRT_ENABLE: /* Enable CRT display, including + * display logic */ WRITE_VID32(SC1200_DISPLAY_CONFIG, config | SC1200_DCFG_HSYNC_EN - | SC1200_DCFG_VSYNC_EN | SC1200_DCFG_DAC_BL_EN); + | SC1200_DCFG_VSYNC_EN | SC1200_DCFG_DAC_BL_EN); WRITE_VID32(SC1200_VID_MISC, misc & ~SC1200_DAC_POWER_DOWN); /* ENABLE GRAPHICS DISPLAY LOGIC */ gfx_set_screen_enable(1); break; - case CRT_STANDBY: /* HSync:Off VSync:On */ + case CRT_STANDBY: /* HSync:Off VSync:On */ WRITE_VID32(SC1200_DISPLAY_CONFIG, (config & ~(SC1200_DCFG_HSYNC_EN - | SC1200_DCFG_DAC_BL_EN)) - | SC1200_DCFG_VSYNC_EN); + | SC1200_DCFG_DAC_BL_EN)) + | SC1200_DCFG_VSYNC_EN); WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); break; - case CRT_SUSPEND: /* HSync:On VSync:Off */ + case CRT_SUSPEND: /* HSync:On VSync:Off */ WRITE_VID32(SC1200_DISPLAY_CONFIG, (config & ~(SC1200_DCFG_VSYNC_EN - | SC1200_DCFG_DAC_BL_EN)) - | SC1200_DCFG_HSYNC_EN); + | SC1200_DCFG_DAC_BL_EN)) + | SC1200_DCFG_HSYNC_EN); WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); break; default: @@ -391,9 +391,9 @@ gfx_set_video_enable(int enable) if (gfx_test_timing_active()) { if (!gfx_test_vertical_active()) { - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); } - while (gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); } vcfg = READ_VID32(SC1200_VIDEO_CONFIG); @@ -402,7 +402,8 @@ gfx_set_video_enable(int enable) vcfg |= SC1200_VCFG_VID_EN; WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); - } else { + } + else { /* DISABLE SC1200 VIDEO OVERLAY */ vcfg &= ~SC1200_VCFG_VID_EN; @@ -531,7 +532,7 @@ gfx_set_video_size(unsigned short width, unsigned short height) /* Use private routine to abstract the display controller. */ /* Add 1 line to bypass issue #803 */ - gfx_set_display_video_size(width, (unsigned short)(height + 2)); + gfx_set_display_video_size(width, (unsigned short) (height + 2)); return (0); } @@ -571,11 +572,11 @@ gfx_set_video_offset(unsigned long offset) #if GFX_VIDEO_DYNAMIC int sc1200_set_video_upscale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #else int gfx_set_video_upscale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #endif { unsigned long xscale, yscale; @@ -625,7 +626,7 @@ gfx_set_video_upscale(unsigned short srcw, unsigned short srch, /* amount of data that needs to be transferred. */ gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, - gfx_vid_height); + gfx_vid_height); return (0); } @@ -639,11 +640,11 @@ gfx_set_video_upscale(unsigned short srcw, unsigned short srch, #if GFX_VIDEO_DYNAMIC int sc1200_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #else int gfx_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #endif { return gfx_set_video_upscale(srcw, srch, dstw, dsth); @@ -673,7 +674,7 @@ gfx_set_video_downscale_config(unsigned short type, unsigned short m) downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); downscale &= ~(SC1200_VIDEO_DOWNSCALE_FACTOR_MASK | - SC1200_VIDEO_DOWNSCALE_TYPE_MASK); + SC1200_VIDEO_DOWNSCALE_TYPE_MASK); downscale |= ((m - 1l) << SC1200_VIDEO_DOWNSCALE_FACTOR_POS); switch (type) { case VIDEO_DOWNSCALE_KEEP_1_OF: @@ -698,21 +699,24 @@ gfx_set_video_downscale_config(unsigned short type, unsigned short m) #if GFX_VIDEO_DYNAMIC int sc1200_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4) + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) #else int gfx_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4) + unsigned short coef2, unsigned short coef3, + unsigned short coef4) #endif { if ((coef1 + coef2 + coef3 + coef4) != 16) return GFX_STATUS_BAD_PARAMETER; WRITE_VID32(SC1200_VIDEO_DOWNSCALER_COEFFICIENTS, - ((unsigned long)coef1 << SC1200_VIDEO_DOWNSCALER_COEF1_POS) | - ((unsigned long)coef2 << SC1200_VIDEO_DOWNSCALER_COEF2_POS) | - ((unsigned long)coef3 << SC1200_VIDEO_DOWNSCALER_COEF3_POS) | - ((unsigned long)coef4 << SC1200_VIDEO_DOWNSCALER_COEF4_POS)); + ((unsigned long) coef1 << SC1200_VIDEO_DOWNSCALER_COEF1_POS) | + ((unsigned long) coef2 << SC1200_VIDEO_DOWNSCALER_COEF2_POS) | + ((unsigned long) coef3 << SC1200_VIDEO_DOWNSCALER_COEF3_POS) | + ((unsigned long) coef4 << SC1200_VIDEO_DOWNSCALER_COEF4_POS)); return (0); } @@ -786,37 +790,37 @@ gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) /* HORIZONTAL START */ - xstart = (unsigned long)x + hadjust; + xstart = (unsigned long) x + hadjust; /* HORIZONTAL END */ /* End positions in register are non-inclusive (one more than the actual * end) */ if ((x + w) < gfx_get_hactive()) - xend = (unsigned long)x + (unsigned long)w + hadjust; - else /* right clipping needed */ - xend = (unsigned long)gfx_get_hactive() + hadjust; + xend = (unsigned long) x + (unsigned long) w + hadjust; + else /* right clipping needed */ + xend = (unsigned long) gfx_get_hactive() + hadjust; /* VERTICAL START */ - ystart = (unsigned long)y + vadjust; + ystart = (unsigned long) y + vadjust; /* VERTICAL END */ if ((y + h) < gfx_get_vactive()) - yend = (unsigned long)y + (unsigned long)h + vadjust; - else /* bottom clipping needed */ - yend = (unsigned long)gfx_get_vactive() + vadjust; + yend = (unsigned long) y + (unsigned long) h + vadjust; + else /* bottom clipping needed */ + yend = (unsigned long) gfx_get_vactive() + vadjust; /* SET VIDEO LINE INVERT BIT */ control = READ_VID32(SC1200_VID_ALPHA_CONTROL); if (y & 0x1) WRITE_VID32(SC1200_VID_ALPHA_CONTROL, - control | SC1200_VIDEO_LINE_OFFSET_ODD); + control | SC1200_VIDEO_LINE_OFFSET_ODD); else WRITE_VID32(SC1200_VID_ALPHA_CONTROL, - control & ~SC1200_VIDEO_LINE_OFFSET_ODD); + control & ~SC1200_VIDEO_LINE_OFFSET_ODD); /* SET VIDEO POSITION */ @@ -849,7 +853,7 @@ gfx_set_video_left_crop(unsigned short x) /* Adjust initial read for scale, checking for divide by zero */ if (gfx_vid_dstw) - initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + initread = (unsigned long) x *gfx_vid_srcw / gfx_vid_dstw; else initread = 0l; @@ -879,8 +883,7 @@ gfx_set_video_left_crop(unsigned short x) */ #if GFX_VIDEO_DYNAMIC int -sc1200_set_video_color_key(unsigned long key, unsigned long mask, - int graphics) +sc1200_set_video_color_key(unsigned long key, unsigned long mask, int graphics) #else int gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) @@ -956,9 +959,9 @@ gfx_set_video_palette(unsigned long *palette) if (gfx_test_timing_active()) { if (gfx_test_vertical_active()) { - while (gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); } - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); } /* LOAD SC1200 VIDEO PALETTE */ @@ -1012,9 +1015,9 @@ gfx_set_video_palette_entry(unsigned long index, unsigned long palette) if (gfx_test_timing_active()) { if (gfx_test_vertical_active()) { - while (gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); } - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); } /* SET A SINGLE ENTRY */ @@ -1091,8 +1094,8 @@ gfx_set_video_request(short x, short y) return GFX_STATUS_BAD_PARAMETER; WRITE_VID32(SC1200_VIDEO_REQUEST, - ((unsigned long)x << SC1200_VIDEO_X_REQUEST_POS) | ((unsigned long)y - << SC1200_VIDEO_Y_REQUEST_POS)); + ((unsigned long) x << SC1200_VIDEO_X_REQUEST_POS) | + ((unsigned long) y << SC1200_VIDEO_Y_REQUEST_POS)); return (0); } @@ -1118,13 +1121,13 @@ gfx_set_video_source(VideoSourceType source) switch (source) { case VIDEO_SOURCE_MEMORY: WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, - (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | - SC1200_VIDEO_SOURCE_GX1); + (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | + SC1200_VIDEO_SOURCE_GX1); break; case VIDEO_SOURCE_DVIP: WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, - (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | - SC1200_VIDEO_SOURCE_DVIP); + (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | + SC1200_VIDEO_SOURCE_DVIP); break; default: return GFX_STATUS_BAD_PARAMETER; @@ -1154,12 +1157,13 @@ gfx_set_vbi_source(VbiSourceType source) switch (source) { case VBI_SOURCE_MEMORY: WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, - (display_mode & ~SC1200_VBI_SOURCE_MASK) | SC1200_VBI_SOURCE_GX1); + (display_mode & ~SC1200_VBI_SOURCE_MASK) | + SC1200_VBI_SOURCE_GX1); break; case VBI_SOURCE_DVIP: WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, - (display_mode & ~SC1200_VBI_SOURCE_MASK) | - SC1200_VBI_SOURCE_DVIP); + (display_mode & ~SC1200_VBI_SOURCE_MASK) | + SC1200_VBI_SOURCE_DVIP); break; default: return GFX_STATUS_BAD_PARAMETER; @@ -1183,9 +1187,9 @@ gfx_set_vbi_lines(unsigned long even, unsigned long odd) { /* SET SC1200 VBI LINES */ WRITE_VID32(SC1200_VIDEO_EVEN_VBI_LINE_ENABLE, - even & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + even & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); WRITE_VID32(SC1200_VIDEO_ODD_VBI_LINE_ENABLE, - odd & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + odd & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); return (0); } @@ -1206,9 +1210,9 @@ gfx_set_vbi_total(unsigned long even, unsigned long odd) { /* SET SC1200 VBI TOTAL */ WRITE_VID32(SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT, - even & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + even & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); WRITE_VID32(SC1200_VIDEO_ODD_VBI_TOTAL_COUNT, - odd & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + odd & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); return (0); } @@ -1233,10 +1237,10 @@ gfx_set_video_interlaced(int enable) /* SET INTERLACED VIDEO */ if (enable) WRITE_VID32(SC1200_VID_ALPHA_CONTROL, - control | SC1200_VIDEO_IS_INTERLACED); + control | SC1200_VIDEO_IS_INTERLACED); else WRITE_VID32(SC1200_VID_ALPHA_CONTROL, - control & ~SC1200_VIDEO_IS_INTERLACED); + control & ~SC1200_VIDEO_IS_INTERLACED); return (0); } @@ -1274,7 +1278,8 @@ gfx_set_color_space_YUV(int enable) if (control & SC1200_VIDEO_INPUT_IS_RGB) return (GFX_STATUS_UNSUPPORTED); /* Can't convert video from * RGB to YUV */ - } else { + } + else { /* RGB BLENDING */ control &= ~SC1200_CSC_GFX_RGB_TO_YUV; /* Leave graphics in RGB */ @@ -1314,12 +1319,14 @@ gfx_set_vertical_scaler_offset(char offset) /* Set shifting value */ control |= SC1200_VERTICAL_SCALER_SHIFT_EN; /* Enable odd frame shifting */ - } else if (offset == 0) { + } + else if (offset == 0) { control &= ~SC1200_VERTICAL_SCALER_SHIFT_EN; /* No shifting occurs */ control &= ~SC1200_VERTICAL_SCALER_SHIFT_MASK; /* Clear shifting value */ - } else + } + else return (GFX_STATUS_BAD_PARAMETER); /* TODO: how to program other values ? */ WRITE_VID32(SC1200_VID_ALPHA_CONTROL, control); @@ -1451,18 +1458,20 @@ gfx_set_genlock_enable(int flags) #if GFX_VIDEO_DYNAMIC int sc1200_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, unsigned long color2) + unsigned short select_color2, unsigned long color1, + unsigned long color2) #else int gfx_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, unsigned long color2) + unsigned short select_color2, unsigned long color1, + unsigned long color2) #endif { if (select_color2 > SC1200_CURSOR_COLOR_BITS) return GFX_STATUS_BAD_PARAMETER; key = - (key & SC1200_COLOR_MASK) | ((unsigned long)select_color2 << - SC1200_CURSOR_COLOR_KEY_OFFSET_POS); + (key & SC1200_COLOR_MASK) | ((unsigned long) select_color2 << + SC1200_CURSOR_COLOR_KEY_OFFSET_POS); WRITE_VID32(SC1200_CURSOR_COLOR_KEY, key); WRITE_VID32(SC1200_CURSOR_COLOR_MASK, mask); WRITE_VID32(SC1200_CURSOR_COLOR_1, color1); @@ -1488,7 +1497,7 @@ gfx_set_alpha_enable(int enable) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = SC1200_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 4); + address = SC1200_ALPHA_CONTROL_1 + ((unsigned long) gfx_alpha_select << 4); value = READ_VID32(address); if (enable) value |= (SC1200_ACTRL_WIN_ENABLE | SC1200_ACTRL_LOAD_ALPHA); @@ -1509,11 +1518,11 @@ gfx_set_alpha_enable(int enable) #if GFX_VIDEO_DYNAMIC int sc1200_set_alpha_window(short x, short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #else int gfx_set_alpha_window(short x, short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #endif { unsigned long address = 0; @@ -1532,15 +1541,15 @@ gfx_set_alpha_window(short x, short y, if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = SC1200_ALPHA_XPOS_1 + ((unsigned long)gfx_alpha_select << 4); + address = SC1200_ALPHA_XPOS_1 + ((unsigned long) gfx_alpha_select << 4); /* End positions in register are non-inclusive (one more than the actual * end) */ - WRITE_VID32(address, (unsigned long)x | - ((unsigned long)(x + width) << 16)); - WRITE_VID32(address + 4l, (unsigned long)y | - ((unsigned long)(y + height) << 16)); + WRITE_VID32(address, (unsigned long) x | + ((unsigned long) (x + width) << 16)); + WRITE_VID32(address + 4l, (unsigned long) y | + ((unsigned long) (y + height) << 16)); return (GFX_STATUS_OK); } @@ -1565,11 +1574,11 @@ gfx_set_alpha_value(unsigned char alpha, char delta) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = SC1200_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 4); + address = SC1200_ALPHA_CONTROL_1 + ((unsigned long) gfx_alpha_select << 4); value = READ_VID32(address); - value &= SC1200_ACTRL_WIN_ENABLE; /* keep only enable bit */ - value |= (unsigned long)alpha; - value |= (((unsigned long)delta) & 0xff) << 8; + value &= SC1200_ACTRL_WIN_ENABLE; /* keep only enable bit */ + value |= (unsigned long) alpha; + value |= (((unsigned long) delta) & 0xff) << 8; value |= SC1200_ACTRL_LOAD_ALPHA; WRITE_VID32(address, value); @@ -1580,12 +1589,12 @@ gfx_set_alpha_value(unsigned char alpha, char delta) /* WAIT FOR VERTICAL BLANK TO END */ if (gfx_test_timing_active()) { if (gfx_test_vertical_active()) - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); } new_value = - (unsigned char)((READ_VID32(SC1200_ALPHA_WATCH) >> - (gfx_alpha_select << 3)) & 0xff); + (unsigned char) ((READ_VID32(SC1200_ALPHA_WATCH) >> + (gfx_alpha_select << 3)) & 0xff); if (new_value == alpha) return GFX_STATUS_OK; if (++loop > 10) @@ -1619,7 +1628,7 @@ gfx_set_alpha_priority(int priority) value = READ_VID32(SC1200_VID_ALPHA_CONTROL); pos = 16 + (gfx_alpha_select << 1); value &= ~(0x03l << pos); - value |= (unsigned long)priority << pos; + value |= (unsigned long) priority << pos; WRITE_VID32(SC1200_VID_ALPHA_CONTROL, value); return (GFX_STATUS_OK); } @@ -1647,7 +1656,7 @@ gfx_set_alpha_color(unsigned long color) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = SC1200_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 4); + address = SC1200_ALPHA_COLOR_1 + ((unsigned long) gfx_alpha_select << 4); /* ONLY 24 VALID BITS */ color &= 0xffffffl; @@ -1676,7 +1685,7 @@ gfx_set_alpha_color_enable(int enable) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = SC1200_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 4); + address = SC1200_ALPHA_COLOR_1 + ((unsigned long) gfx_alpha_select << 4); color = READ_VID32(address); if (enable) color |= SC1200_ALPHA_COLOR_ENABLE; @@ -1712,10 +1721,10 @@ gfx_set_no_ck_outside_alpha(int enable) value = READ_VID32(SC1200_VID_ALPHA_CONTROL); if (enable) WRITE_VID32(SC1200_VID_ALPHA_CONTROL, - value | SC1200_NO_CK_OUTSIDE_ALPHA); + value | SC1200_NO_CK_OUTSIDE_ALPHA); else WRITE_VID32(SC1200_VID_ALPHA_CONTROL, - value & ~SC1200_NO_CK_OUTSIDE_ALPHA); + value & ~SC1200_NO_CK_OUTSIDE_ALPHA); return (0); } @@ -1995,7 +2004,8 @@ gfx_get_video_format(void) case SC1200_VCFG_YVYU_FORMAT: return VIDEO_FORMAT_Y1Y2Y3Y0; } - } else { + } + else { switch (vcfg & SC1200_VCFG_VID_INP_FORMAT) { case SC1200_VCFG_UYVY_FORMAT: return VIDEO_FORMAT_UYVY; @@ -2158,8 +2168,8 @@ gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) unsigned long downscale; downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); - *m = (unsigned short)((downscale & SC1200_VIDEO_DOWNSCALE_FACTOR_MASK) >> - SC1200_VIDEO_DOWNSCALE_FACTOR_POS) + 1; + *m = (unsigned short) ((downscale & SC1200_VIDEO_DOWNSCALE_FACTOR_MASK) >> + SC1200_VIDEO_DOWNSCALE_FACTOR_POS) + 1; switch (downscale & SC1200_VIDEO_DOWNSCALE_TYPE_MASK) { case SC1200_VIDEO_DOWNSCALE_TYPE_A: @@ -2184,28 +2194,32 @@ gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) #if GFX_VIDEO_DYNAMIC void sc1200_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) #else void gfx_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) #endif { unsigned long coef; coef = READ_VID32(SC1200_VIDEO_DOWNSCALER_COEFFICIENTS); *coef1 = - (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF1_POS) & - SC1200_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> SC1200_VIDEO_DOWNSCALER_COEF1_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); *coef2 = - (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF2_POS) & - SC1200_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> SC1200_VIDEO_DOWNSCALER_COEF2_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); *coef3 = - (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF3_POS) & - SC1200_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> SC1200_VIDEO_DOWNSCALER_COEF3_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); *coef4 = - (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF4_POS) & - SC1200_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> SC1200_VIDEO_DOWNSCALER_COEF4_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); return; } @@ -2282,10 +2296,10 @@ gfx_get_video_position(void) /* Use routines to abstract version of display controller. */ hadjust = - (unsigned long)gfx_get_htotal() - (unsigned long)gfx_get_hsync_end() - + (unsigned long) gfx_get_htotal() - (unsigned long) gfx_get_hsync_end() - 14l; vadjust = - (unsigned long)gfx_get_vtotal() - (unsigned long)gfx_get_vsync_end() + + (unsigned long) gfx_get_vtotal() - (unsigned long) gfx_get_vsync_end() + 1l; xpos -= hadjust; ypos -= vadjust; @@ -2385,7 +2399,7 @@ gfx_get_video_request(short *x, short *y) { int request = 0; - request = (int)(READ_VID32(SC1200_VIDEO_REQUEST)); + request = (int) (READ_VID32(SC1200_VIDEO_REQUEST)); *x = (request >> SC1200_VIDEO_X_REQUEST_POS) & SC1200_VIDEO_REQUEST_MASK; *y = (request >> SC1200_VIDEO_Y_REQUEST_POS) & SC1200_VIDEO_REQUEST_MASK; @@ -2465,9 +2479,9 @@ gfx_get_vbi_lines(int odd) { if (odd) return (READ_VID32(SC1200_VIDEO_ODD_VBI_LINE_ENABLE) & - SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + SC1200_VIDEO_VBI_LINE_ENABLE_MASK); return (READ_VID32(SC1200_VIDEO_EVEN_VBI_LINE_ENABLE) & - SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + SC1200_VIDEO_VBI_LINE_ENABLE_MASK); } /*--------------------------------------------------------------------------- @@ -2486,9 +2500,9 @@ gfx_get_vbi_total(int odd) { if (odd) return (READ_VID32(SC1200_VIDEO_ODD_VBI_TOTAL_COUNT) & - SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); return (READ_VID32(SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT) & - SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); } /*--------------------------------------------------------------------------- @@ -2564,7 +2578,8 @@ gfx_get_vertical_scaler_offset(char *offset) else return GFX_STATUS_ERROR; /* TODO: find the interpretation of other values */ - } else + } + else *offset = 0; return (0); } @@ -2619,24 +2634,24 @@ gfx_get_genlock_enable(void) #if GFX_VIDEO_DYNAMIC int sc1200_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2) + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) #else int gfx_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2) + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) #endif { *select_color2 = - (unsigned short)(READ_VID32(SC1200_CURSOR_COLOR_KEY) >> - SC1200_CURSOR_COLOR_KEY_OFFSET_POS); + (unsigned short) (READ_VID32(SC1200_CURSOR_COLOR_KEY) >> + SC1200_CURSOR_COLOR_KEY_OFFSET_POS); *key = READ_VID32(SC1200_CURSOR_COLOR_KEY) & SC1200_COLOR_MASK; *mask = READ_VID32(SC1200_CURSOR_COLOR_MASK) & SC1200_COLOR_MASK; *color1 = READ_VID32(SC1200_CURSOR_COLOR_1) & SC1200_COLOR_MASK; *color2 = - (unsigned short)(READ_VID32(SC1200_CURSOR_COLOR_2) & - SC1200_COLOR_MASK); + (unsigned short) (READ_VID32(SC1200_CURSOR_COLOR_2) & + SC1200_COLOR_MASK); return (0); } @@ -2661,7 +2676,7 @@ gfx_read_crc(void) if (gfx_test_timing_active()) { /* WAIT UNTIL ACTIVE DISPLAY */ - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); /* RESET CRC DURING ACTIVE DISPLAY */ @@ -2670,10 +2685,10 @@ gfx_read_crc(void) /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); crc = READ_VID32(SC1200_VID_CRC) >> 8; } return (crc); @@ -2720,7 +2735,7 @@ gfx_get_alpha_enable(int *enable) if (gfx_alpha_select <= 2) { value = READ_VID32(SC1200_ALPHA_CONTROL_1 + - ((unsigned long)gfx_alpha_select << 4)); + ((unsigned long) gfx_alpha_select << 4)); if (value & SC1200_ACTRL_WIN_ENABLE) *enable = 1; } @@ -2736,11 +2751,11 @@ gfx_get_alpha_enable(int *enable) #if GFX_VIDEO_DYNAMIC void sc1200_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height) + unsigned short *width, unsigned short *height) #else void gfx_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height) + unsigned short *width, unsigned short *height) #endif { unsigned long value = 0; @@ -2752,14 +2767,14 @@ gfx_get_alpha_size(unsigned short *x, unsigned short *y, if (gfx_alpha_select <= 2) { value = READ_VID32(SC1200_ALPHA_XPOS_1 + - ((unsigned long)gfx_alpha_select << 4)); - *x = (unsigned short)(value & 0x000007FF); - *width = (unsigned short)((value >> 16) & 0x000007FF) - *x; + ((unsigned long) gfx_alpha_select << 4)); + *x = (unsigned short) (value & 0x000007FF); + *width = (unsigned short) ((value >> 16) & 0x000007FF) - *x; value = READ_VID32(SC1200_ALPHA_YPOS_1 + - ((unsigned long)gfx_alpha_select << 4)); - *y = (unsigned short)(value & 0x000007FF); - *height = (unsigned short)((value >> 16) & 0x000007FF) - *y; + ((unsigned long) gfx_alpha_select << 4)); + *y = (unsigned short) (value & 0x000007FF); + *height = (unsigned short) ((value >> 16) & 0x000007FF) - *y; } *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; @@ -2788,9 +2803,9 @@ gfx_get_alpha_value(unsigned char *alpha, char *delta) if (gfx_alpha_select <= 2) { value = READ_VID32(SC1200_ALPHA_CONTROL_1 + - ((unsigned long)gfx_alpha_select << 4)); - *alpha = (unsigned char)(value & 0x00FF); - *delta = (char)((value >> 8) & 0x00FF); + ((unsigned long) gfx_alpha_select << 4)); + *alpha = (unsigned char) (value & 0x00FF); + *delta = (char) ((value >> 8) & 0x00FF); } return; } @@ -2815,7 +2830,7 @@ gfx_get_alpha_priority(int *priority) if (gfx_alpha_select <= 2) { value = READ_VID32(SC1200_VID_ALPHA_CONTROL); pos = 16 + (gfx_alpha_select << 1); - *priority = (int)((value >> pos) & 3); + *priority = (int) ((value >> pos) & 3); } return; } @@ -2839,11 +2854,11 @@ gfx_get_alpha_color(unsigned long *color) if (gfx_alpha_select <= 2) { *color = READ_VID32(SC1200_ALPHA_COLOR_1 + - ((unsigned long)gfx_alpha_select << 4)); + ((unsigned long) gfx_alpha_select << 4)); } return; } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ /* END OF FILE */ diff --git a/src/gfx/vid_5530.c b/src/gfx/vid_5530.c index 40e3ffc..f524300 100644 --- a/src/gfx/vid_5530.c +++ b/src/gfx/vid_5530.c @@ -31,50 +31,49 @@ * CS5530 PLL TABLE *---------------------------------------------------------------------------- */ -typedef struct tagCS5530PLLENTRY -{ - long frequency; /* 16.16 fixed point frequency */ - unsigned long pll_value; /* associated register value */ +typedef struct tagCS5530PLLENTRY { + long frequency; /* 16.16 fixed point frequency */ + unsigned long pll_value; /* associated register value */ } CS5530PLLENTRY; CS5530PLLENTRY CS5530_PLLtable[] = { - {0x00192CCC, 0x31C45801,}, /* 25.1750 */ - {0x001C526E, 0x20E36802,}, /* 28.3220 */ - {0x001F8000, 0x33915801,}, /* 31.5000 */ - {0x00240000, 0x31EC4801,}, /* 36.0000 */ - {0x00258000, 0x21E22801,}, /* 37.5000 */ - {0x00280000, 0x33088801,}, /* 40.0000 */ - {0x002CE666, 0x33E22801,}, /* 44.9000 */ - {0x00318000, 0x336C4801,}, /* 49.5000 */ - {0x00320000, 0x23088801,}, /* 50.0000 */ - {0x00325999, 0x23088801,}, /* 50.3500 */ - {0x00360000, 0x3708A801,}, /* 54.0000 */ - {0x00384000, 0x23E36802,}, /* 56.2500 */ - {0x0038643F, 0x23E36802,}, /* 56.3916 */ - {0x0038A4DD, 0x23E36802,}, /* 56.6444 */ - {0x003B0000, 0x37C45801,}, /* 59.0000 */ - {0x003F0000, 0x23EC4801,}, /* 63.0000 */ - {0x00410000, 0x37911801,}, /* 65.0000 */ - {0x00438000, 0x37963803,}, /* 67.5000 */ - {0x0046CCCC, 0x37058803,}, /* 70.8000 */ - {0x00480000, 0x3710C805,}, /* 72.0000 */ - {0x004B0000, 0x37E22801,}, /* 75.0000 */ - {0x004EC000, 0x27915801,}, /* 78.7500 */ - {0x00500000, 0x37D8D802,}, /* 80.0000 */ - {0x0059CCCC, 0x27588802,}, /* 89.8000 */ - {0x005E8000, 0x27EC4802,}, /* 94.5000 */ - {0x00630000, 0x27AC6803,}, /* 99.0000 */ - {0x00640000, 0x27088801,}, /* 100.0000 */ - {0x006C0000, 0x2710C805,}, /* 108.0000 */ - {0x00708000, 0x27E36802,}, /* 112.5000 */ - {0x00820000, 0x27C58803,}, /* 130.0000 */ - {0x00870000, 0x27316803,}, /* 135.0000 */ - {0x009D8000, 0x2F915801,}, /* 157.5000 */ - {0x00A20000, 0x2F08A801,}, /* 162.0000 */ - {0x00AF0000, 0x2FB11802,}, /* 175.0000 */ - {0x00BD0000, 0x2FEC4802,}, /* 189.0000 */ - {0x00CA0000, 0x2F963803,}, /* 202.0000 */ - {0x00E80000, 0x2FB1B802,}, /* 232.0000 */ + {0x00192CCC, 0x31C45801,}, /* 25.1750 */ + {0x001C526E, 0x20E36802,}, /* 28.3220 */ + {0x001F8000, 0x33915801,}, /* 31.5000 */ + {0x00240000, 0x31EC4801,}, /* 36.0000 */ + {0x00258000, 0x21E22801,}, /* 37.5000 */ + {0x00280000, 0x33088801,}, /* 40.0000 */ + {0x002CE666, 0x33E22801,}, /* 44.9000 */ + {0x00318000, 0x336C4801,}, /* 49.5000 */ + {0x00320000, 0x23088801,}, /* 50.0000 */ + {0x00325999, 0x23088801,}, /* 50.3500 */ + {0x00360000, 0x3708A801,}, /* 54.0000 */ + {0x00384000, 0x23E36802,}, /* 56.2500 */ + {0x0038643F, 0x23E36802,}, /* 56.3916 */ + {0x0038A4DD, 0x23E36802,}, /* 56.6444 */ + {0x003B0000, 0x37C45801,}, /* 59.0000 */ + {0x003F0000, 0x23EC4801,}, /* 63.0000 */ + {0x00410000, 0x37911801,}, /* 65.0000 */ + {0x00438000, 0x37963803,}, /* 67.5000 */ + {0x0046CCCC, 0x37058803,}, /* 70.8000 */ + {0x00480000, 0x3710C805,}, /* 72.0000 */ + {0x004B0000, 0x37E22801,}, /* 75.0000 */ + {0x004EC000, 0x27915801,}, /* 78.7500 */ + {0x00500000, 0x37D8D802,}, /* 80.0000 */ + {0x0059CCCC, 0x27588802,}, /* 89.8000 */ + {0x005E8000, 0x27EC4802,}, /* 94.5000 */ + {0x00630000, 0x27AC6803,}, /* 99.0000 */ + {0x00640000, 0x27088801,}, /* 100.0000 */ + {0x006C0000, 0x2710C805,}, /* 108.0000 */ + {0x00708000, 0x27E36802,}, /* 112.5000 */ + {0x00820000, 0x27C58803,}, /* 130.0000 */ + {0x00870000, 0x27316803,}, /* 135.0000 */ + {0x009D8000, 0x2F915801,}, /* 157.5000 */ + {0x00A20000, 0x2F08A801,}, /* 162.0000 */ + {0x00AF0000, 0x2FB11802,}, /* 175.0000 */ + {0x00BD0000, 0x2FEC4802,}, /* 189.0000 */ + {0x00CA0000, 0x2F963803,}, /* 202.0000 */ + {0x00E80000, 0x2FB1B802,}, /* 232.0000 */ }; #define NUM_CS5530_FREQUENCIES sizeof(CS5530_PLLtable)/sizeof(CS5530PLLENTRY) @@ -98,36 +97,36 @@ gfx_set_crt_enable(int enable) config = READ_VID32(CS5530_DISPLAY_CONFIG); switch (enable) { - case CRT_DISABLE: /* Disable everything */ + case CRT_DISABLE: /* Disable everything */ WRITE_VID32(CS5530_DISPLAY_CONFIG, - config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | - CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | - CS5530_DCFG_DAC_PWDNX)); + config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | + CS5530_DCFG_DAC_PWDNX)); break; - case CRT_ENABLE: /* Enable CRT display, including display logic */ + case CRT_ENABLE: /* Enable CRT display, including display logic */ WRITE_VID32(CS5530_DISPLAY_CONFIG, - config | CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | - CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | - CS5530_DCFG_DAC_PWDNX); + config | CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | + CS5530_DCFG_DAC_PWDNX); break; - case CRT_STANDBY: /* HSync:Off VSync:On */ + case CRT_STANDBY: /* HSync:Off VSync:On */ WRITE_VID32(CS5530_DISPLAY_CONFIG, - (config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | - CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) - | CS5530_DCFG_VSYNC_EN); + (config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) + | CS5530_DCFG_VSYNC_EN); break; - case CRT_SUSPEND: /* HSync:On VSync:Off */ + case CRT_SUSPEND: /* HSync:On VSync:Off */ WRITE_VID32(CS5530_DISPLAY_CONFIG, - (config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_VSYNC_EN | - CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) - | CS5530_DCFG_HSYNC_EN); + (config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_VSYNC_EN | + CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) + | CS5530_DCFG_HSYNC_EN); break; default: @@ -161,10 +160,10 @@ gfx_reset_video(void) gfx_set_display_video_size(0, 0); if (gfx_test_timing_active()) { - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); } } @@ -200,13 +199,13 @@ gfx_set_display_control(int sync_polarities) /* CLEAR RELEVANT FIELDS */ dcfg &= ~(CS5530_DCFG_CRT_SYNC_SKW_MASK | CS5530_DCFG_PWR_SEQ_DLY_MASK | - CS5530_DCFG_CRT_HSYNC_POL | CS5530_DCFG_CRT_VSYNC_POL | - CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); + CS5530_DCFG_CRT_HSYNC_POL | CS5530_DCFG_CRT_VSYNC_POL | + CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); /* INITIALIZATION */ dcfg |= (CS5530_DCFG_CRT_SYNC_SKW_INIT | - CS5530_DCFG_PWR_SEQ_DLY_INIT | CS5530_DCFG_GV_PAL_BYP); + CS5530_DCFG_PWR_SEQ_DLY_INIT | CS5530_DCFG_GV_PAL_BYP); if (PanelEnable) { dcfg |= CS5530_DCFG_FP_PWR_EN; @@ -248,11 +247,11 @@ gfx_set_clock_frequency(unsigned long frequency) /* Search the table for the closest frequency (16.16 format). */ value = CS5530_PLLtable[0].pll_value; - min = (long)CS5530_PLLtable[0].frequency - frequency; + min = (long) CS5530_PLLtable[0].frequency - frequency; if (min < 0L) min = -min; for (index = 1; index < NUM_CS5530_FREQUENCIES; index++) { - diff = (long)CS5530_PLLtable[index].frequency - frequency; + diff = (long) CS5530_PLLtable[index].frequency - frequency; if (diff < 0L) diff = -diff; if (diff < min) { @@ -266,7 +265,7 @@ gfx_set_clock_frequency(unsigned long frequency) WRITE_VID32(CS5530_DOT_CLK_CONFIG, value); WRITE_VID32(CS5530_DOT_CLK_CONFIG, value | 0x80000100); /* set reset/bypass */ - gfx_delay_milliseconds(1); /* wait for PLL to settle */ + gfx_delay_milliseconds(1); /* wait for PLL to settle */ WRITE_VID32(CS5530_DOT_CLK_CONFIG, value & 0x7FFFFFFF); /* clear reset */ WRITE_VID32(CS5530_DOT_CLK_CONFIG, value & 0x7FFFFEFF); @@ -295,9 +294,9 @@ gfx_set_video_enable(int enable) if (gfx_test_timing_active()) { if (!gfx_test_vertical_active()) { - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); } - while (gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); } vcfg = READ_VID32(CS5530_VIDEO_CONFIG); if (enable) { @@ -311,7 +310,8 @@ gfx_set_video_enable(int enable) vcfg |= CS5530_VCFG_VID_EN; WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); - } else { + } + else { /* DISABLE CS5530 VIDEO OVERLAY */ vcfg &= ~CS5530_VCFG_VID_EN; @@ -431,11 +431,11 @@ gfx_set_video_offset(unsigned long offset) #if GFX_VIDEO_DYNAMIC int cs5530_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #else int gfx_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #endif { unsigned long xscale, yscale; @@ -471,7 +471,7 @@ gfx_set_video_scale(unsigned short srcw, unsigned short srch, /* amount of data that needs to be transferred. */ gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, - gfx_vid_height); + gfx_vid_height); return (0); } @@ -514,11 +514,12 @@ gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) /* LEFT CLIPPING */ if (x < 0) { - gfx_set_video_left_crop((unsigned short)(-x)); + gfx_set_video_left_crop((unsigned short) (-x)); xstart = hadjust; - } else { + } + else { gfx_set_video_left_crop(0); - xstart = (unsigned long)x + hadjust; + xstart = (unsigned long) x + hadjust; } /* CLIPPING ON RIGHT */ @@ -533,7 +534,8 @@ gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) offset = gfx_vid_offset; if (y >= 0) { ystart = y + vadjust; - } else { + } + else { ystart = vadjust; line_size = (READ_VID32(CS5530_VIDEO_CONFIG) >> 7) & 0x000001FE; if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_LINE_SIZE_UPPER) @@ -595,7 +597,7 @@ gfx_set_video_left_crop(unsigned short x) /* Adjust initial read for scale, checking for divide by zero */ if (gfx_vid_dstw) - initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + initread = (unsigned long) x *gfx_vid_srcw / gfx_vid_dstw; else initread = 0; @@ -626,8 +628,7 @@ gfx_set_video_left_crop(unsigned short x) */ #if GFX_VIDEO_DYNAMIC int -cs5530_set_video_color_key(unsigned long key, unsigned long mask, - int graphics) +cs5530_set_video_color_key(unsigned long key, unsigned long mask, int graphics) #else int gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) @@ -1057,7 +1058,7 @@ gfx_get_video_format(void) if (vcfg & CS5530_VCFG_4_2_0_MODE) return (VIDEO_FORMAT_Y0Y1Y2Y3); - return ((int)((vcfg >> 2) & 3)); + return ((int) ((vcfg >> 2) & 3)); } /*---------------------------------------------------------------------------- @@ -1331,7 +1332,7 @@ gfx_read_crc(void) if (gfx_test_timing_active()) { /* WAIT UNTIL ACTIVE DISPLAY */ - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); /* RESET CRC DURING ACTIVE DISPLAY */ @@ -1340,15 +1341,15 @@ gfx_read_crc(void) /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); crc = READ_VID32(CS5530_CRCSIG_TFT_TV) >> 8; } return (crc); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ /* END OF FILE */ diff --git a/src/gfx/vid_rdcl.c b/src/gfx/vid_rdcl.c index 7c98d2d..3ccc57a 100644 --- a/src/gfx/vid_rdcl.c +++ b/src/gfx/vid_rdcl.c @@ -76,74 +76,73 @@ unsigned long gfx_gamma_ram_redcloud[] = { /* REDCLOUD PLL TABLE */ -typedef struct RCDFPLL -{ - long frequency; /* 16.16 fixed point frequency */ - unsigned long post_div3; /* MCP Frequency dividers and multipliers */ +typedef struct RCDFPLL { + long frequency; /* 16.16 fixed point frequency */ + unsigned long post_div3; /* MCP Frequency dividers and multipliers */ unsigned long pre_mul2; unsigned long pre_div2; - unsigned long pll_value; /* MCP DotPLL Register Upper 32(0x0015) */ + unsigned long pll_value; /* MCP DotPLL Register Upper 32(0x0015) */ } RCDFPLLENTRY; RCDFPLLENTRY RCDF_PLLtable[] = { - {0x0018EC4D, 1, 0, 0, 0x0000099E}, /* 24.9230 */ - {0x00192CCC, 0, 0, 0, 0x00000037}, /* 25.1750 */ - {0x001C526E, 1, 0, 0, 0x000009DA}, /* 28.3220 */ - {0x001C8F5C, 1, 0, 0, 0x0000005E}, /* 28.5600 */ - {0x001F8000, 1, 0, 0, 0x000002D2}, /* 31.5000 */ - {0x00240000, 1, 0, 0, 0x000007E2}, /* 36.0000 */ - {0x00258000, 1, 0, 0, 0x0000057A}, /* 37.5000 */ - {0x0025E395, 1, 0, 0, 0x000007FA}, /* 37.8890 */ - {0x00280000, 1, 0, 0, 0x0000030A}, /* 40.0000 */ - {0x002B29BA, 0, 0, 0, 0x0000005F}, /* 43.1630 */ - {0x002CE666, 0, 0, 0, 0x00000063}, /* 44.9000 */ - {0x002DB851, 1, 0, 0, 0x00000BC9}, /* 45.7200 */ - {0x00318000, 0, 0, 0, 0x0000054B}, /* 49.5000 */ - {0x00320000, 0, 0, 0, 0x0000006F}, /* 50.0000 */ - {0x00325999, 0, 1, 0, 0x00000037}, /* 50.3500 */ - {0x00360000, 1, 1, 0, 0x00000B0D}, /* 54.0000 */ - {0x00384000, 0, 0, 0, 0x000007F7}, /* 56.2500 */ - {0x0038643F, 0, 0, 0, 0x000007F7}, /* 56.3916 */ - {0x0038A4DD, 0, 0, 0, 0x0000057B}, /* 56.6444 */ - {0x003B0000, 0, 1, 0, 0x00000707}, /* 59.0000 */ - {0x003C10A3, 0, 0, 0, 0x0000030B}, /* 60.0650 */ - {0x003F0000, 1, 1, 0, 0x00000B39}, /* 63.0000 */ - {0x00410000, 1, 0, 0, 0x00000545}, /* 65.0000 */ - {0x00442DD2, 1, 0, 0, 0x000002E1}, /* 68.1790 */ - {0x00438000, 1, 1, 0, 0x00000FC1}, /* 67.5000 */ - {0x0046CCCC, 1, 0, 0, 0x00000561}, /* 70.8000 */ - {0x00480000, 1, 0, 0, 0x000007E1}, /* 72.0000 */ - {0x004A7B22, 0, 1, 0, 0x00000F4A}, /* 74.4810 */ - {0x004B0000, 1, 0, 0, 0x000007F5}, /* 75.0000 */ - {0x004EC000, 1, 0, 0, 0x00000305}, /* 78.7500 */ - {0x00500000, 1, 1, 0, 0x00000709}, /* 80.0000 */ - {0x00519999, 0, 0, 0, 0x000009C6}, /* 81.6000 */ - {0x0059CCCC, 0, 1, 0, 0x00000262}, /* 89.8000 */ - {0x005E8000, 0, 0, 0, 0x000002D2}, /* 94.5000 */ - {0x00618560, 0, 0, 0, 0x00000546}, /* 97.5200 */ - {0x00630000, 0, 1, 0, 0x00000B4A}, /* 99.0000 */ - {0x00642FDF, 0, 0, 0, 0x0000006E}, /* 100.1870 */ - {0x00656B85, 0, 0, 0, 0x00000552}, /* 101.4200 */ - {0x006C0000, 0, 0, 0, 0x000007E2}, /* 108.0000 */ - {0x00708000, 0, 0, 0, 0x000007F6}, /* 112.5000 */ - {0x00714F1A, 0, 0, 0, 0x0000057A}, /* 113.3090 */ - {0x0077A666, 0, 0, 0, 0x0000030A}, /* 119.6500 */ - {0x00806666, 1, 0, 0, 0x00000068}, /* 128.4000 */ - {0x00820000, 1, 1, 0, 0x00000FB0}, /* 130.0000 */ - {0x00821999, 1, 0, 0, 0x00000544}, /* 130.1000 */ - {0x00858000, 1, 0, 0, 0x0000006C}, /* 133.5000 */ - {0x00870000, 1, 0, 0, 0x00000550}, /* 135.0000 */ - {0x00906147, 1, 0, 0, 0x000007E0}, /* 144.3800 */ - {0x009D8000, 1, 0, 0, 0x00000304}, /* 157.5000 */ - {0x00A20000, 0, 0, 0, 0x000002B1}, /* 162.0000 */ - {0x00A933F7, 0, 0, 0, 0x000002B9}, /* 169.2030 */ - {0x00ACCC49, 0, 1, 0, 0x0000002D}, /* 172.798 */ - {0x00AF8000, 0, 0, 0, 0x000002C1}, /* 175.5000 */ - {0x00BD0000, 0, 0, 0, 0x000002D1}, /* 189.0000 */ - {0x00BEF5C2, 0, 0, 0, 0x0000053D}, /* 190.9600 */ - {0x00C60000, 0, 0, 0, 0x00000549}, /* 198.0000 */ - {0x00CA8000, 0, 0, 0, 0x00000551}, /* 202.5000 */ - {0x00E58000, 0, 0, 0, 0x0000057D}, /* 229.5000 */ + {0x0018EC4D, 1, 0, 0, 0x0000099E}, /* 24.9230 */ + {0x00192CCC, 0, 0, 0, 0x00000037}, /* 25.1750 */ + {0x001C526E, 1, 0, 0, 0x000009DA}, /* 28.3220 */ + {0x001C8F5C, 1, 0, 0, 0x0000005E}, /* 28.5600 */ + {0x001F8000, 1, 0, 0, 0x000002D2}, /* 31.5000 */ + {0x00240000, 1, 0, 0, 0x000007E2}, /* 36.0000 */ + {0x00258000, 1, 0, 0, 0x0000057A}, /* 37.5000 */ + {0x0025E395, 1, 0, 0, 0x000007FA}, /* 37.8890 */ + {0x00280000, 1, 0, 0, 0x0000030A}, /* 40.0000 */ + {0x002B29BA, 0, 0, 0, 0x0000005F}, /* 43.1630 */ + {0x002CE666, 0, 0, 0, 0x00000063}, /* 44.9000 */ + {0x002DB851, 1, 0, 0, 0x00000BC9}, /* 45.7200 */ + {0x00318000, 0, 0, 0, 0x0000054B}, /* 49.5000 */ + {0x00320000, 0, 0, 0, 0x0000006F}, /* 50.0000 */ + {0x00325999, 0, 1, 0, 0x00000037}, /* 50.3500 */ + {0x00360000, 1, 1, 0, 0x00000B0D}, /* 54.0000 */ + {0x00384000, 0, 0, 0, 0x000007F7}, /* 56.2500 */ + {0x0038643F, 0, 0, 0, 0x000007F7}, /* 56.3916 */ + {0x0038A4DD, 0, 0, 0, 0x0000057B}, /* 56.6444 */ + {0x003B0000, 0, 1, 0, 0x00000707}, /* 59.0000 */ + {0x003C10A3, 0, 0, 0, 0x0000030B}, /* 60.0650 */ + {0x003F0000, 1, 1, 0, 0x00000B39}, /* 63.0000 */ + {0x00410000, 1, 0, 0, 0x00000545}, /* 65.0000 */ + {0x00442DD2, 1, 0, 0, 0x000002E1}, /* 68.1790 */ + {0x00438000, 1, 1, 0, 0x00000FC1}, /* 67.5000 */ + {0x0046CCCC, 1, 0, 0, 0x00000561}, /* 70.8000 */ + {0x00480000, 1, 0, 0, 0x000007E1}, /* 72.0000 */ + {0x004A7B22, 0, 1, 0, 0x00000F4A}, /* 74.4810 */ + {0x004B0000, 1, 0, 0, 0x000007F5}, /* 75.0000 */ + {0x004EC000, 1, 0, 0, 0x00000305}, /* 78.7500 */ + {0x00500000, 1, 1, 0, 0x00000709}, /* 80.0000 */ + {0x00519999, 0, 0, 0, 0x000009C6}, /* 81.6000 */ + {0x0059CCCC, 0, 1, 0, 0x00000262}, /* 89.8000 */ + {0x005E8000, 0, 0, 0, 0x000002D2}, /* 94.5000 */ + {0x00618560, 0, 0, 0, 0x00000546}, /* 97.5200 */ + {0x00630000, 0, 1, 0, 0x00000B4A}, /* 99.0000 */ + {0x00642FDF, 0, 0, 0, 0x0000006E}, /* 100.1870 */ + {0x00656B85, 0, 0, 0, 0x00000552}, /* 101.4200 */ + {0x006C0000, 0, 0, 0, 0x000007E2}, /* 108.0000 */ + {0x00708000, 0, 0, 0, 0x000007F6}, /* 112.5000 */ + {0x00714F1A, 0, 0, 0, 0x0000057A}, /* 113.3090 */ + {0x0077A666, 0, 0, 0, 0x0000030A}, /* 119.6500 */ + {0x00806666, 1, 0, 0, 0x00000068}, /* 128.4000 */ + {0x00820000, 1, 1, 0, 0x00000FB0}, /* 130.0000 */ + {0x00821999, 1, 0, 0, 0x00000544}, /* 130.1000 */ + {0x00858000, 1, 0, 0, 0x0000006C}, /* 133.5000 */ + {0x00870000, 1, 0, 0, 0x00000550}, /* 135.0000 */ + {0x00906147, 1, 0, 0, 0x000007E0}, /* 144.3800 */ + {0x009D8000, 1, 0, 0, 0x00000304}, /* 157.5000 */ + {0x00A20000, 0, 0, 0, 0x000002B1}, /* 162.0000 */ + {0x00A933F7, 0, 0, 0, 0x000002B9}, /* 169.2030 */ + {0x00ACCC49, 0, 1, 0, 0x0000002D}, /* 172.798 */ + {0x00AF8000, 0, 0, 0, 0x000002C1}, /* 175.5000 */ + {0x00BD0000, 0, 0, 0, 0x000002D1}, /* 189.0000 */ + {0x00BEF5C2, 0, 0, 0, 0x0000053D}, /* 190.9600 */ + {0x00C60000, 0, 0, 0, 0x00000549}, /* 198.0000 */ + {0x00CA8000, 0, 0, 0, 0x00000551}, /* 202.5000 */ + {0x00E58000, 0, 0, 0, 0x0000057D}, /* 229.5000 */ }; #define NUM_RCDF_FREQUENCIES sizeof(RCDF_PLLtable)/sizeof(RCDFPLLENTRY) @@ -205,8 +204,8 @@ gfx_set_display_control(int sync_polarities) dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); dcfg &= ~(RCDF_DCFG_CRT_SYNC_SKW_MASK | RCDF_DCFG_PWR_SEQ_DLY_MASK | - RCDF_DCFG_CRT_HSYNC_POL | RCDF_DCFG_CRT_VSYNC_POL | - RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); + RCDF_DCFG_CRT_HSYNC_POL | RCDF_DCFG_CRT_VSYNC_POL | + RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); /* Don't blindly set the PAL_BYP bit - assume that somebody along * the line has set up the gamma correctly before this point */ @@ -222,16 +221,16 @@ gfx_set_display_control(int sync_polarities) /* SET APPROPRIATE SYNC POLARITIES */ if (PanelEnable) { - unsigned int pt2 = READ_VID32(0x408); + unsigned int pt2 = READ_VID32(0x408); - pt2 &= ~((1 << 22) | (1 << 23)); - WRITE_VID32(0x408, pt2); + pt2 &= ~((1 << 22) | (1 << 23)); + WRITE_VID32(0x408, pt2); } if (sync_polarities & 0x1) - dcfg |= RCDF_DCFG_CRT_HSYNC_POL; - if (sync_polarities & 0x2) - dcfg |= RCDF_DCFG_CRT_VSYNC_POL; + dcfg |= RCDF_DCFG_CRT_HSYNC_POL; + if (sync_polarities & 0x2) + dcfg |= RCDF_DCFG_CRT_VSYNC_POL; WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); @@ -265,11 +264,11 @@ gfx_set_clock_frequency(unsigned long frequency) /* Search the table for the closest frequency (16.16 format). */ value = RCDF_PLLtable[0].pll_value; - min = (long)RCDF_PLLtable[0].frequency - frequency; + min = (long) RCDF_PLLtable[0].frequency - frequency; if (min < 0L) min = -min; for (i = 1; i < NUM_RCDF_FREQUENCIES; i++) { - diff = (long)RCDF_PLLtable[i].frequency - frequency; + diff = (long) RCDF_PLLtable[i].frequency - frequency; if (diff < 0L) diff = -diff; if (diff < min) { @@ -296,9 +295,8 @@ gfx_set_clock_frequency(unsigned long frequency) if ((msr_value.low & MCP_DOTPLL_LOCK) && (msr_value.high == RCDF_PLLtable[index].pll_value) && - ((sys_value. - low & (MCP_DOTPOSTDIV3 | MCP_DOTPREDIV2 | MCP_DOTPREMULT2)) == - sys_low)) { + ((sys_value.low & (MCP_DOTPOSTDIV3 | MCP_DOTPREDIV2 | MCP_DOTPREMULT2)) + == sys_low)) { return; } @@ -349,36 +347,36 @@ gfx_set_crt_enable(int enable) misc = READ_VID32(RCDF_VID_MISC); switch (enable) { - case CRT_DISABLE: /* DISABLE EVERYTHING */ + case CRT_DISABLE: /* DISABLE EVERYTHING */ WRITE_VID32(RCDF_DISPLAY_CONFIG, - config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | - RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN)); + config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN)); WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); break; - case CRT_ENABLE: /* ENABLE CRT DISPLAY, INCLUDING DISPLAY LOGIC */ + case CRT_ENABLE: /* ENABLE CRT DISPLAY, INCLUDING DISPLAY LOGIC */ WRITE_VID32(RCDF_DISPLAY_CONFIG, - config | RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | - RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN); + config | RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN); WRITE_VID32(RCDF_VID_MISC, - misc & ~RCDF_DAC_POWER_DOWN & ~RCDF_ANALOG_POWER_DOWN); + misc & ~RCDF_DAC_POWER_DOWN & ~RCDF_ANALOG_POWER_DOWN); break; - case CRT_STANDBY: /* HSYNC:OFF VSYNC:ON */ + case CRT_STANDBY: /* HSYNC:OFF VSYNC:ON */ WRITE_VID32(RCDF_DISPLAY_CONFIG, - (config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | - RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_VSYNC_EN); + (config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_VSYNC_EN); WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); break; - case CRT_SUSPEND: /* HSYNC:ON VSYNC:OFF */ + case CRT_SUSPEND: /* HSYNC:ON VSYNC:OFF */ WRITE_VID32(RCDF_DISPLAY_CONFIG, - (config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_VSYNC_EN | - RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_HSYNC_EN); + (config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_VSYNC_EN | + RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_HSYNC_EN); WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); break; @@ -409,9 +407,9 @@ gfx_set_video_enable(int enable) if (gfx_test_timing_active()) { if (!gfx_test_vertical_active()) { - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); } - while (gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()); } vcfg = READ_VID32(RCDF_VIDEO_CONFIG); @@ -425,7 +423,8 @@ gfx_set_video_enable(int enable) vcfg |= RCDF_VCFG_VID_EN; WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); - } else { + } + else { /* DISABLE DISPLAY FILTER VIDEO OVERLAY */ vcfg &= ~RCDF_VCFG_VID_EN; @@ -619,11 +618,11 @@ gfx_set_video_offset(unsigned long offset) #if GFX_VIDEO_DYNAMIC int redcloud_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, - unsigned long voffset) + unsigned long voffset) #else int gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, - unsigned long voffset) + unsigned long voffset) #endif { /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ @@ -672,11 +671,11 @@ gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) #if GFX_VIDEO_DYNAMIC int redcloud_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #else int gfx_set_video_scale(unsigned short srcw, unsigned short srch, - unsigned short dstw, unsigned short dsth) + unsigned short dstw, unsigned short dsth) #endif { unsigned long xscale, yscale; @@ -727,7 +726,7 @@ gfx_set_video_scale(unsigned short srcw, unsigned short srch, /* amount of data that needs to be transferred. */ gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, - gfx_vid_height); + gfx_vid_height); return (0); } @@ -741,8 +740,7 @@ gfx_set_video_scale(unsigned short srcw, unsigned short srch, */ #if GFX_VIDEO_DYNAMIC int -redcloud_set_video_vertical_downscale(unsigned short srch, - unsigned short dsth) +redcloud_set_video_vertical_downscale(unsigned short srch, unsigned short dsth) #else int gfx_set_video_vertical_downscale(unsigned short srch, unsigned short dsth) @@ -800,7 +798,7 @@ gfx_set_video_downscale_config(unsigned short type, unsigned short m) downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); downscale &= ~(RCDF_VIDEO_DOWNSCALE_FACTOR_MASK | RCDF_VIDEO_DOWNSCALE_TYPE_MASK); - downscale |= ((unsigned long)(m - 1) << RCDF_VIDEO_DOWNSCALE_FACTOR_POS); + downscale |= ((unsigned long) (m - 1) << RCDF_VIDEO_DOWNSCALE_FACTOR_POS); switch (type) { case VIDEO_DOWNSCALE_KEEP_1_OF: downscale |= RCDF_VIDEO_DOWNSCALE_TYPE_A; @@ -824,21 +822,24 @@ gfx_set_video_downscale_config(unsigned short type, unsigned short m) #if GFX_VIDEO_DYNAMIC int redcloud_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4) + unsigned short coef2, + unsigned short coef3, + unsigned short coef4) #else int gfx_set_video_downscale_coefficients(unsigned short coef1, - unsigned short coef2, unsigned short coef3, unsigned short coef4) + unsigned short coef2, unsigned short coef3, + unsigned short coef4) #endif { if ((coef1 + coef2 + coef3 + coef4) != 16) return GFX_STATUS_BAD_PARAMETER; WRITE_VID32(RCDF_VIDEO_DOWNSCALER_COEFFICIENTS, - ((unsigned long)coef1 << RCDF_VIDEO_DOWNSCALER_COEF1_POS) | - ((unsigned long)coef2 << RCDF_VIDEO_DOWNSCALER_COEF2_POS) | - ((unsigned long)coef3 << RCDF_VIDEO_DOWNSCALER_COEF3_POS) | - ((unsigned long)coef4 << RCDF_VIDEO_DOWNSCALER_COEF4_POS)); + ((unsigned long) coef1 << RCDF_VIDEO_DOWNSCALER_COEF1_POS) | + ((unsigned long) coef2 << RCDF_VIDEO_DOWNSCALER_COEF2_POS) | + ((unsigned long) coef3 << RCDF_VIDEO_DOWNSCALER_COEF3_POS) | + ((unsigned long) coef4 << RCDF_VIDEO_DOWNSCALER_COEF4_POS)); return (0); } @@ -879,8 +880,7 @@ gfx_set_video_downscale_enable(int enable) */ #if GFX_VIDEO_DYNAMIC int -redcloud_set_video_window(short x, short y, unsigned short w, - unsigned short h) +redcloud_set_video_window(short x, short y, unsigned short w, unsigned short h) #else int gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) @@ -906,11 +906,12 @@ gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) /* LEFT CLIPPING */ if (x < 0) { - gfx_set_video_left_crop((unsigned short)(-x)); + gfx_set_video_left_crop((unsigned short) (-x)); xstart = hadjust; - } else { + } + else { gfx_set_video_left_crop(0); - xstart = (unsigned long)x + hadjust; + xstart = (unsigned long) x + hadjust; } /* HORIZONTAL END */ @@ -918,24 +919,24 @@ gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) * end) */ if ((x + w) < gfx_get_hactive()) - xend = (unsigned long)x + (unsigned long)w + hadjust; + xend = (unsigned long) x + (unsigned long) w + hadjust; /* RIGHT-CLIPPING */ else - xend = (unsigned long)gfx_get_hactive() + hadjust; + xend = (unsigned long) gfx_get_hactive() + hadjust; /* VERTICAL START */ - ystart = (unsigned long)y + vadjust; + ystart = (unsigned long) y + vadjust; /* VERTICAL END */ if ((y + h) < gfx_get_vactive()) - yend = (unsigned long)y + (unsigned long)h + vadjust; + yend = (unsigned long) y + (unsigned long) h + vadjust; /* BOTTOM-CLIPPING */ else - yend = (unsigned long)gfx_get_vactive() + vadjust; + yend = (unsigned long) gfx_get_vactive() + vadjust; /* SET VIDEO POSITION */ @@ -976,11 +977,12 @@ gfx_set_video_left_crop(unsigned short x) * */ if (gfx_vid_dstw) { - initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + initread = (unsigned long) x *gfx_vid_srcw / gfx_vid_dstw; if (vcfg & RCDF_VCFG_4_2_0_MODE) initread &= 0xFFF8; - } else + } + else initread = 0; /* SET INITIAL READ ADDRESS */ @@ -1008,7 +1010,7 @@ gfx_set_video_left_crop(unsigned short x) #if GFX_VIDEO_DYNAMIC int redcloud_set_video_color_key(unsigned long key, unsigned long mask, - int graphics) + int graphics) #else int gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) @@ -1093,9 +1095,9 @@ gfx_set_video_palette(unsigned long *palette) WRITE_VID32(RCDF_VID_MISC, misc); if (gfx_test_timing_active()) { - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); } /* LOAD REDCLOUD VIDEO PALETTE */ @@ -1147,9 +1149,9 @@ gfx_set_graphics_palette(unsigned long *palette) WRITE_VID32(RCDF_VID_MISC, misc); if (gfx_test_timing_active()) { - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); } /* LOAD REDCLOUD VIDEO PALETTE */ @@ -1174,8 +1176,7 @@ gfx_set_graphics_palette(unsigned long *palette) */ #if GFX_VIDEO_DYNAMIC int -redcloud_set_graphics_palette_entry(unsigned long index, - unsigned long palette) +redcloud_set_graphics_palette_entry(unsigned long index, unsigned long palette) #else int gfx_set_graphics_palette_entry(unsigned long index, unsigned long palette) @@ -1300,8 +1301,8 @@ gfx_set_video_request(short x, short y) return GFX_STATUS_BAD_PARAMETER; WRITE_VID32(RCDF_VIDEO_REQUEST, - ((unsigned long)x << RCDF_VIDEO_X_REQUEST_POS) | ((unsigned long)y << - RCDF_VIDEO_Y_REQUEST_POS)); + ((unsigned long) x << RCDF_VIDEO_X_REQUEST_POS) | + ((unsigned long) y << RCDF_VIDEO_Y_REQUEST_POS)); return (0); } @@ -1332,18 +1333,20 @@ gfx_set_video_request(short x, short y) #if GFX_VIDEO_DYNAMIC int redcloud_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, unsigned long color2) + unsigned short select_color2, unsigned long color1, + unsigned long color2) #else int gfx_set_video_cursor(unsigned long key, unsigned long mask, - unsigned short select_color2, unsigned long color1, unsigned long color2) + unsigned short select_color2, unsigned long color1, + unsigned long color2) #endif { if (select_color2 > RCDF_CURSOR_COLOR_BITS) return GFX_STATUS_BAD_PARAMETER; key = - (key & RCDF_COLOR_MASK) | ((unsigned long)select_color2 << - RCDF_CURSOR_COLOR_KEY_OFFSET_POS); + (key & RCDF_COLOR_MASK) | ((unsigned long) select_color2 << + RCDF_CURSOR_COLOR_KEY_OFFSET_POS); WRITE_VID32(RCDF_CURSOR_COLOR_KEY, key); WRITE_VID32(RCDF_CURSOR_COLOR_MASK, mask); WRITE_VID32(RCDF_CURSOR_COLOR_1, color1); @@ -1412,7 +1415,7 @@ gfx_set_alpha_enable(int enable) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = RCDF_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 5); + address = RCDF_ALPHA_CONTROL_1 + ((unsigned long) gfx_alpha_select << 5); value = READ_VID32(address); if (enable) value |= RCDF_ACTRL_WIN_ENABLE; @@ -1433,11 +1436,11 @@ gfx_set_alpha_enable(int enable) #if GFX_VIDEO_DYNAMIC int redcloud_set_alpha_window(short x, short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #else int gfx_set_alpha_window(short x, short y, - unsigned short width, unsigned short height) + unsigned short width, unsigned short height) #endif { unsigned long address = 0; @@ -1456,15 +1459,15 @@ gfx_set_alpha_window(short x, short y, if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = RCDF_ALPHA_XPOS_1 + ((unsigned long)gfx_alpha_select << 5); + address = RCDF_ALPHA_XPOS_1 + ((unsigned long) gfx_alpha_select << 5); /* END POSITIONS IN REGISTERS ARE NON-INCLUSIVE (ONE MORE THAN ACTUAL END) * */ - WRITE_VID32(address, (unsigned long)x | - ((unsigned long)(x + width) << 16)); - WRITE_VID32(address + 8, (unsigned long)y | - ((unsigned long)(y + height) << 16)); + WRITE_VID32(address, (unsigned long) x | + ((unsigned long) (x + width) << 16)); + WRITE_VID32(address + 8, (unsigned long) y | + ((unsigned long) (y + height) << 16)); return (GFX_STATUS_OK); } @@ -1487,11 +1490,11 @@ gfx_set_alpha_value(unsigned char alpha, char delta) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = RCDF_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 5); + address = RCDF_ALPHA_CONTROL_1 + ((unsigned long) gfx_alpha_select << 5); value = READ_VID32(address); - value &= RCDF_ACTRL_WIN_ENABLE; /* keep only enable bit */ - value |= (unsigned long)alpha; - value |= (((unsigned long)delta) & 0xff) << 8; + value &= RCDF_ACTRL_WIN_ENABLE; /* keep only enable bit */ + value |= (unsigned long) alpha; + value |= (((unsigned long) delta) & 0xff) << 8; value |= RCDF_ACTRL_LOAD_ALPHA; WRITE_VID32(address, value); return (GFX_STATUS_OK); @@ -1522,7 +1525,7 @@ gfx_set_alpha_priority(int priority) value = READ_VID32(RCDF_VID_ALPHA_CONTROL); pos = 16 + (gfx_alpha_select << 1); value &= ~(0x03l << pos); - value |= (unsigned long)priority << pos; + value |= (unsigned long) priority << pos; WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value); return (GFX_STATUS_OK); } @@ -1550,7 +1553,7 @@ gfx_set_alpha_color(unsigned long color) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = RCDF_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 5); + address = RCDF_ALPHA_COLOR_1 + ((unsigned long) gfx_alpha_select << 5); WRITE_VID32(address, color); return (GFX_STATUS_OK); } @@ -1574,7 +1577,7 @@ gfx_set_alpha_color_enable(int enable) if (gfx_alpha_select > 2) return (GFX_STATUS_UNSUPPORTED); - address = RCDF_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 5); + address = RCDF_ALPHA_COLOR_1 + ((unsigned long) gfx_alpha_select << 5); color = READ_VID32(address); if (enable) color |= RCDF_ALPHA_COLOR_ENABLE; @@ -1611,8 +1614,7 @@ gfx_set_no_ck_outside_alpha(int enable) if (enable) WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value | RCDF_NO_CK_OUTSIDE_ALPHA); else - WRITE_VID32(RCDF_VID_ALPHA_CONTROL, - value & ~RCDF_NO_CK_OUTSIDE_ALPHA); + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value & ~RCDF_NO_CK_OUTSIDE_ALPHA); return (0); } @@ -1778,7 +1780,8 @@ gfx_get_video_format(void) case RCDF_VCFG_YVYU_FORMAT: return VIDEO_FORMAT_Y1Y2Y3Y0; } - } else { + } + else { switch (vcfg & RCDF_VCFG_VID_INP_FORMAT) { case RCDF_VCFG_UYVY_FORMAT: return VIDEO_FORMAT_UYVY; @@ -1922,11 +1925,11 @@ gfx_get_video_offset(void) #if GFX_VIDEO_DYNAMIC void redcloud_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, - unsigned long *voffset) + unsigned long *voffset) #else void gfx_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, - unsigned long *voffset) + unsigned long *voffset) #endif { gfx_get_display_video_yuv_offsets(yoffset, uoffset, voffset); @@ -2023,8 +2026,8 @@ gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) unsigned long downscale; downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); - *m = (unsigned short)((downscale & RCDF_VIDEO_DOWNSCALE_FACTOR_MASK) >> - RCDF_VIDEO_DOWNSCALE_FACTOR_POS) + 1; + *m = (unsigned short) ((downscale & RCDF_VIDEO_DOWNSCALE_FACTOR_MASK) >> + RCDF_VIDEO_DOWNSCALE_FACTOR_POS) + 1; switch (downscale & RCDF_VIDEO_DOWNSCALE_TYPE_MASK) { case RCDF_VIDEO_DOWNSCALE_TYPE_A: @@ -2049,28 +2052,32 @@ gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) #if GFX_VIDEO_DYNAMIC void redcloud_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) #else void gfx_get_video_downscale_coefficients(unsigned short *coef1, - unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) + unsigned short *coef2, + unsigned short *coef3, + unsigned short *coef4) #endif { unsigned long coef; coef = READ_VID32(RCDF_VIDEO_DOWNSCALER_COEFFICIENTS); *coef1 = - (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF1_POS) & - RCDF_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> RCDF_VIDEO_DOWNSCALER_COEF1_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); *coef2 = - (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF2_POS) & - RCDF_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> RCDF_VIDEO_DOWNSCALER_COEF2_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); *coef3 = - (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF3_POS) & - RCDF_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> RCDF_VIDEO_DOWNSCALER_COEF3_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); *coef4 = - (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF4_POS) & - RCDF_VIDEO_DOWNSCALER_COEF_MASK); + (unsigned short) ((coef >> RCDF_VIDEO_DOWNSCALER_COEF4_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); return; } @@ -2089,8 +2096,7 @@ void gfx_get_video_downscale_enable(int *enable) #endif { - if (READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL) & - RCDF_VIDEO_DOWNSCALE_ENABLE) + if (READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL) & RCDF_VIDEO_DOWNSCALE_ENABLE) *enable = 1; else *enable = 0; @@ -2147,10 +2153,10 @@ gfx_get_video_position(void) /* Use routines to abstract version of display controller. */ hadjust = - (unsigned long)gfx_get_htotal() - (unsigned long)gfx_get_hsync_end() - + (unsigned long) gfx_get_htotal() - (unsigned long) gfx_get_hsync_end() - 14l; vadjust = - (unsigned long)gfx_get_vtotal() - (unsigned long)gfx_get_vsync_end() + + (unsigned long) gfx_get_vtotal() - (unsigned long) gfx_get_vsync_end() + 1l; xpos -= hadjust; ypos -= vadjust; @@ -2251,10 +2257,10 @@ gfx_get_video_request(short *x, short *y) unsigned long request = 0; request = (READ_VID32(RCDF_VIDEO_REQUEST)); - *x = (short)((request >> RCDF_VIDEO_X_REQUEST_POS) & - RCDF_VIDEO_REQUEST_MASK); - *y = (short)((request >> RCDF_VIDEO_Y_REQUEST_POS) & - RCDF_VIDEO_REQUEST_MASK); + *x = (short) ((request >> RCDF_VIDEO_X_REQUEST_POS) & + RCDF_VIDEO_REQUEST_MASK); + *y = (short) ((request >> RCDF_VIDEO_Y_REQUEST_POS) & + RCDF_VIDEO_REQUEST_MASK); *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; @@ -2274,23 +2280,23 @@ gfx_get_video_request(short *x, short *y) #if GFX_VIDEO_DYNAMIC int redcloud_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2) + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) #else int gfx_get_video_cursor(unsigned long *key, unsigned long *mask, - unsigned short *select_color2, unsigned long *color1, - unsigned short *color2) + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) #endif { *select_color2 = - (unsigned short)(READ_VID32(RCDF_CURSOR_COLOR_KEY) >> - RCDF_CURSOR_COLOR_KEY_OFFSET_POS); + (unsigned short) (READ_VID32(RCDF_CURSOR_COLOR_KEY) >> + RCDF_CURSOR_COLOR_KEY_OFFSET_POS); *key = READ_VID32(RCDF_CURSOR_COLOR_KEY) & RCDF_COLOR_MASK; *mask = READ_VID32(RCDF_CURSOR_COLOR_MASK) & RCDF_COLOR_MASK; *color1 = READ_VID32(RCDF_CURSOR_COLOR_1) & RCDF_COLOR_MASK; *color2 = - (unsigned short)(READ_VID32(RCDF_CURSOR_COLOR_2) & RCDF_COLOR_MASK); + (unsigned short) (READ_VID32(RCDF_CURSOR_COLOR_2) & RCDF_COLOR_MASK); return (0); } @@ -2324,7 +2330,7 @@ gfx_read_crc(void) if (gfx_test_timing_active()) { /* WAIT UNTIL ACTIVE DISPLAY */ - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); /* RESET CRC DURING ACTIVE DISPLAY */ @@ -2333,11 +2339,11 @@ gfx_read_crc(void) /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); crc = READ_VID32(RCDF_VID_CRC) >> 8; } return (crc); @@ -2373,7 +2379,7 @@ gfx_read_crc32(void) if (gfx_test_timing_active()) { /* WAIT UNTIL ACTIVE DISPLAY */ - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); /* RESET CRC DURING ACTIVE DISPLAY */ @@ -2382,11 +2388,11 @@ gfx_read_crc32(void) /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); crc = READ_VID32(RCDF_VID_CRC32); } return (crc); @@ -2402,11 +2408,11 @@ gfx_read_crc32(void) #if GFX_VIDEO_DYNAMIC unsigned long redcloud_read_window_crc(int source, unsigned short x, unsigned short y, - unsigned short width, unsigned short height, int crc32) + unsigned short width, unsigned short height, int crc32) #else unsigned long gfx_read_window_crc(int source, unsigned short x, unsigned short y, - unsigned short width, unsigned short height, int crc32) + unsigned short width, unsigned short height, int crc32) #endif { Q_WORD msr_value; @@ -2432,8 +2438,7 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, msr_value.low &= ~(RCDF_CONFIG_FMT_MASK); msr_value.low |= ((source == - CRC_SOURCE_FP_DATA) ? RCDF_CONFIG_FMT_FP : - RCDF_CONFIG_FMT_CRT); + CRC_SOURCE_FP_DATA) ? RCDF_CONFIG_FMT_FP : RCDF_CONFIG_FMT_CRT); gfx_msr_write(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); } @@ -2466,7 +2471,8 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, sync_polarities = gfx_get_sync_polarities(); vsync_bit = 29; hsync_bit = 30; - } else { + } + else { vsync_bit = 25; hsync_bit = 26; } @@ -2474,7 +2480,8 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, if (sync_polarities & 1) { hsync_active_base = MCP_SETM0CTL; hsync_active_shift = 2; - } else { + } + else { hsync_active_base = MCP_SETN0CTL; hsync_active_shift = 1; } @@ -2483,7 +2490,8 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, vsync_inactive_base = MCP_SETN0CTL; vsync_active_shift = 2; vsync_inactive_shift = 1; - } else { + } + else { vsync_active_base = MCP_SETN0CTL; vsync_inactive_base = MCP_SETM0CTL; vsync_active_shift = 1; @@ -2498,8 +2506,8 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, /* VG VSync = Diag Bus Bit 25 */ msr_value.low = 0x000000A0; - msr_value.high = 0x00008000 | ((unsigned long)vsync_bit << 16) | - ((unsigned long)vsync_bit << 21) | ((unsigned long)vsync_bit << 26); + msr_value.high = 0x00008000 | ((unsigned long) vsync_bit << 16) | + ((unsigned long) vsync_bit << 21) | ((unsigned long) vsync_bit << 26); gfx_msr_write(RC_ID_MCP, vsync_inactive_base, &msr_value); /* STATE 1-2 TRANSITION (SET 4) */ @@ -2519,8 +2527,8 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, /* Notes: DF HSync = Diag Bus Bit 30 */ /* VG HSync = Diag Bus Bit 26 */ - msr_value.high = 0x00008000 | ((unsigned long)hsync_bit << 16) | - ((unsigned long)hsync_bit << 21) | ((unsigned long)hsync_bit << 26); + msr_value.high = 0x00008000 | ((unsigned long) hsync_bit << 16) | + ((unsigned long) hsync_bit << 21) | ((unsigned long) hsync_bit << 26); msr_value.low = 0x00000120; gfx_msr_write(RC_ID_MCP, hsync_active_base + 5, &msr_value); @@ -2552,8 +2560,8 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, /* data to access the diag bus */ /* 2. h_blank_pixels = HTOTAL - HSYNC_END */ - xpos = (unsigned long)x + ((unsigned long)gfx_get_htotal() - - (unsigned long)gfx_get_hsync_end() - 1l) - 3l; + xpos = (unsigned long) x + ((unsigned long) gfx_get_htotal() - + (unsigned long) gfx_get_hsync_end() - 1l) - 3l; if (source == CRC_SOURCE_GFX_DATA) xpos++; msr_value.high = 0x00000000; @@ -2563,7 +2571,7 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, /* COMPARATOR 1 */ /* Upper limit = xpos + width + (h_blank_pixels - 1) - 3 */ - msr_value.low = xpos + (unsigned long)width; + msr_value.low = xpos + (unsigned long) width; gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 2, &msr_value); /* COMPARATOR 2 */ @@ -2572,15 +2580,15 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, /* 1. v_blank_pixels = VTOTAL - VSYNC_END */ ypos = - (unsigned long)y + (unsigned long)gfx_get_vtotal() - - (unsigned long)gfx_get_vsync_end(); + (unsigned long) y + (unsigned long) gfx_get_vtotal() - + (unsigned long) gfx_get_vsync_end(); msr_value.low = ypos << 16; gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 4, &msr_value); /* COMPARATOR 3 */ /* Upper limit = ypos + height + v_blank_pixels */ - msr_value.low = (ypos + (unsigned long)height) << 16; + msr_value.low = (ypos + (unsigned long) height) << 16; gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 6, &msr_value); /* SET COMPARATOR MASKS */ @@ -2612,7 +2620,7 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, msr_value.high = 0x00000000; msr_value.low = 0xFFFF0000 | ((gfx_get_htotal() - (gfx_get_hsync_end() - gfx_get_hsync_start()) - - 1) & 0xFFFF); + 1) & 0xFFFF); gfx_msr_write(RC_ID_MCP, MCP_REGBVAL, &msr_value); /* PROGRAM ACTIONS */ @@ -2706,11 +2714,11 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y, /* DELAY TWO FRAMES */ - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; - while (gfx_test_vertical_active()) ; - while (!gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); + while (gfx_test_vertical_active()); + while (!gfx_test_vertical_active()); /* VERIFY THAT XSTATE = 11 */ @@ -2767,7 +2775,7 @@ gfx_get_alpha_enable(int *enable) if (gfx_alpha_select <= 2) { value = READ_VID32(RCDF_ALPHA_CONTROL_1 + - ((unsigned long)gfx_alpha_select << 5)); + ((unsigned long) gfx_alpha_select << 5)); if (value & RCDF_ACTRL_WIN_ENABLE) *enable = 1; } @@ -2783,11 +2791,11 @@ gfx_get_alpha_enable(int *enable) #if GFX_VIDEO_DYNAMIC void redcloud_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height) + unsigned short *width, unsigned short *height) #else void gfx_get_alpha_size(unsigned short *x, unsigned short *y, - unsigned short *width, unsigned short *height) + unsigned short *width, unsigned short *height) #endif { unsigned long value = 0; @@ -2799,14 +2807,14 @@ gfx_get_alpha_size(unsigned short *x, unsigned short *y, if (gfx_alpha_select <= 2) { value = READ_VID32(RCDF_ALPHA_XPOS_1 + - ((unsigned long)gfx_alpha_select << 5)); - *x = (unsigned short)(value & 0x000007FF); - *width = (unsigned short)((value >> 16) & 0x000007FF) - *x; + ((unsigned long) gfx_alpha_select << 5)); + *x = (unsigned short) (value & 0x000007FF); + *width = (unsigned short) ((value >> 16) & 0x000007FF) - *x; value = READ_VID32(RCDF_ALPHA_YPOS_1 + - ((unsigned long)gfx_alpha_select << 5)); - *y = (unsigned short)(value & 0x000007FF); - *height = (unsigned short)((value >> 16) & 0x000007FF) - *y; + ((unsigned long) gfx_alpha_select << 5)); + *y = (unsigned short) (value & 0x000007FF); + *height = (unsigned short) ((value >> 16) & 0x000007FF) - *y; } *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; @@ -2835,9 +2843,9 @@ gfx_get_alpha_value(unsigned char *alpha, char *delta) if (gfx_alpha_select <= 2) { value = READ_VID32(RCDF_ALPHA_CONTROL_1 + - ((unsigned long)gfx_alpha_select << 5)); - *alpha = (unsigned char)(value & 0x00FF); - *delta = (char)((value >> 8) & 0x00FF); + ((unsigned long) gfx_alpha_select << 5)); + *alpha = (unsigned char) (value & 0x00FF); + *delta = (char) ((value >> 8) & 0x00FF); } return; } @@ -2862,7 +2870,7 @@ gfx_get_alpha_priority(int *priority) if (gfx_alpha_select <= 2) { value = READ_VID32(RCDF_VID_ALPHA_CONTROL); pos = 16 + (gfx_alpha_select << 1); - *priority = (int)((value >> pos) & 3); + *priority = (int) ((value >> pos) & 3); } return; } @@ -2886,11 +2894,11 @@ gfx_get_alpha_color(unsigned long *color) if (gfx_alpha_select <= 2) { *color = READ_VID32(RCDF_ALPHA_COLOR_1 + - ((unsigned long)gfx_alpha_select << 5)); + ((unsigned long) gfx_alpha_select << 5)); } return; } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ /* END OF FILE */ diff --git a/src/gfx/vip_1200.c b/src/gfx/vip_1200.c index 731e1b8..34acb8a 100644 --- a/src/gfx/vip_1200.c +++ b/src/gfx/vip_1200.c @@ -107,9 +107,9 @@ gfx_set_vip_base(unsigned long even, unsigned long odd) if (even) WRITE_VIP32(SC1200_VIP_EVEN_BASE, - even + (unsigned long)gfx_phys_fbptr); + even + (unsigned long) gfx_phys_fbptr); if (odd) - WRITE_VIP32(SC1200_VIP_ODD_BASE, odd + (unsigned long)gfx_phys_fbptr); + WRITE_VIP32(SC1200_VIP_ODD_BASE, odd + (unsigned long) gfx_phys_fbptr); return (0); } @@ -204,7 +204,7 @@ gfx_set_vbi_mode(int mode) config = READ_VIP32(SC1200_VIP_CONFIG); config &= ~(SC1200_VBI_ANCILLARY_TO_MEMORY | SC1200_VBI_TASK_A_TO_MEMORY | - SC1200_VBI_TASK_B_TO_MEMORY); + SC1200_VBI_TASK_B_TO_MEMORY); if (mode & VBI_ANCILLARY) config |= SC1200_VBI_ANCILLARY_TO_MEMORY; @@ -275,9 +275,9 @@ gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) #endif { WRITE_VIP32(SC1200_EVEN_DIRECT_VBI_LINE_ENABLE, - even_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + even_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); WRITE_VIP32(SC1200_ODD_DIRECT_VBI_LINE_ENABLE, - odd_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + odd_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); return (0); } @@ -424,7 +424,8 @@ gfx_test_vip_fifo_overflow(void) * writing 1 */ WRITE_VIP32(SC1200_VIP_STATUS, SC1200_VIP_FIFO_OVERFLOW); return (1); - } else { + } + else { return (0); } } @@ -444,8 +445,8 @@ int gfx_get_vip_line(void) #endif { - return (int)(READ_VIP32(SC1200_VIP_CURRENT_LINE) & - SC1200_VIP_CURRENT_LINE_MASK); + return (int) (READ_VIP32(SC1200_VIP_CURRENT_LINE) & + SC1200_VIP_CURRENT_LINE_MASK); } /*---------------------------------------------------------------------------- @@ -573,8 +574,9 @@ gfx_get_vbi_mode(void) int mode = 0; config = - (int)(READ_VIP32(SC1200_VIP_CONFIG) & (SC1200_VBI_ANCILLARY_TO_MEMORY - | SC1200_VBI_TASK_A_TO_MEMORY | SC1200_VBI_TASK_B_TO_MEMORY)); + (int) (READ_VIP32(SC1200_VIP_CONFIG) & (SC1200_VBI_ANCILLARY_TO_MEMORY + | SC1200_VBI_TASK_A_TO_MEMORY | + SC1200_VBI_TASK_B_TO_MEMORY)); if (config & SC1200_VBI_ANCILLARY_TO_MEMORY) mode |= VBI_ANCILLARY; if (config & SC1200_VBI_TASK_A_TO_MEMORY) @@ -619,9 +621,9 @@ gfx_get_vbi_direct(int odd) if (odd) return (READ_VIP32(SC1200_ODD_DIRECT_VBI_LINE_ENABLE) & - SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + SC1200_DIRECT_VBI_LINE_ENABLE_MASK); return (READ_VIP32(SC1200_EVEN_DIRECT_VBI_LINE_ENABLE) & - SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + SC1200_DIRECT_VBI_LINE_ENABLE_MASK); } /*--------------------------------------------------------------------------- @@ -658,6 +660,6 @@ gfx_get_vip_bus_request_threshold_high(void) return (0); } -#endif /* GFX_READ_ROUTINES */ +#endif /* GFX_READ_ROUTINES */ /* END OF FILE */ |