PicoVGA  1.0-cmake
VGA/TV display on Raspberry Pico
Configurating Video Mode

Description

Structures and functions for configuring video modes.

The sVgaCfg structure contains the required properties of the video mode: the display resolution, the minimum processor frequency and the timing of the sVideo signal, possibly also the required overlay mode. You can first call the VgaCfgDef() function, which presets the structure to the default parameters. The VgaCfg() function prepares the sVmode descriptor structure, which is later passed to the VgaInitReq() function. At this point no operations are taking place only the necessary settings are being calculated. After the calculation, some items of the sVmode structure can be adjusted. In the library there are global structures Cfg and Vmode that can be used for the function. The required screen resolution and signal timing are two independent properties. For timing, you are limited only by the number of video lines of the image, but otherwise you can set any screen resolution within them. For example, for PAL and NTSC video, you can set a VGA video resolution. To make the program versatile so that it can be run on both a VGA monitor and a TV, use a VGA resolution of 640x480 or 320x240 (or 512x400 and 256x192, due to RAM limitations). When changing the display, just select VGA/PAL or NTSC timing, the resolution does not change for the program.

Data Structures

struct  sVideo
 Video timings structure. More...
 
struct  sVgaCfg
 Required configuration to initialize VGA output. More...
 
struct  sVmode
 Videomode table - used to setup video driver. More...
 

Macros

#define VIDEO_NAME_LEN   5
 length of video timing name
 

Enumerations

enum  { DEV_PAL = 0, DEV_NTSC, DEV_VGA, DEV_MAX }
 Output device. More...
 
enum  {
  RES_ZX = 0, RES_CGA, RES_QVGA, RES_EGA,
  RES_VGA, RES_SVGA, RES_XGA, RES_HD,
  RES_MAX
}
 Preset videomode resolution. More...
 
enum  {
  FORM_8BIT = 0, FORM_4BIT, FORM_MONO, FORM_TILE8,
  FORM_TILE12, FORM_TILE16, FORM_TILE24, FORM_TILE32,
  FORM_TILE48, FORM_TILE64, FORM_MTEXT8, FORM_MTEXT16,
  FORM_TEXT8, FORM_TEXT16, FORM_RLE, FORM_MAX
}
 Graphics formats. More...
 

Functions

void VgaCfgDef (sVgaCfg *cfg)
 Initialize configuration structure to VGA defaults. More...
 
void VgaPrintCfg (const sVmode *vmode)
 Debug print videomode setup. More...
 
void VgaCfg (const sVgaCfg *cfg, sVmode *vmode)
 Calculate the structure for setting up the video mode. More...
 

Variables

const sVideo VideoPAL
 TV PAL interlaced 5:4 720x576 (4:3 768x576, 16:9 1024x576)
 
const sVideo VideoPALp
 TV PAL progressive 5:4 360x288 (4:3 384x288, 16:9 512x288)
 
const sVideo VideoNTSC
 TV NTSC interlaced 4:3 640x480 (5:4 600x480, 16:9 848x480)
 
const sVideo VideoNTSCp
 TV NTSC progressive 4:3 320x240 (5:4 300x240, 16:9 424x240)
 
const sVideo VideoEGA
 EGA 8:5 640x400 (5:4 500x400, 4:3 528x400, 16:9 704x400), vert. 70 Hz, hor. 31.4685 kHz, pixel clock 25.175 MHz.
 
const sVideo VideoVGA
 VGA 4:3 640x480 (16:9 848x480), vert. 60 Hz, hor. 31.4685 kHz, pixel clock 25.175 MHz.
 
const sVideo VideoSVGA
 SVGA 4:3 800x600 (16:9 1064x600), vert. 60 Hz, hor. 37.897 kHz, pixel clock 40 MHz.
 
const sVideo VideoXGA
 XGA 4:3 1024x768 (16:9 1360x768), vert. 60 Hz, hor. 48.36310 kHz, pixel clock 65 MHz.
 
const sVideo VideoVESA
 VESA 4:3 1152x864, vert. 60 Hz, hor. 53.697 kHz, pixel clock 81.62 MHz.
 
const sVideo VideoHD
 HD 4:3 1280x960, vert. 53 Hz, hor. 51.858 kHz, pixel clock 102.1 MHz.
 
sVmode Vmode
 Videomode setup.
 
sVgaCfg Cfg
 Required configuration.
 
sCanvas Canvas
 Canvas of draw box.
 
u16 Pal16Trans [256]
 16-color palette translation table
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Output device.

Enumerator
DEV_PAL 

PAL TV.

DEV_NTSC 

NTSC TV.

DEV_VGA 

VGA monitor.

◆ anonymous enum

anonymous enum

Preset videomode resolution.

Enumerator
RES_ZX 

256x192

RES_CGA 

320x200

RES_QVGA 

320x240

RES_EGA 

512x400

RES_VGA 

640x480

RES_SVGA 

800x600 (not for TV device)

RES_XGA 

1024x768 (not for TV device)

RES_HD 

1280x960 (not for TV device)

◆ anonymous enum

anonymous enum

Graphics formats.

Enumerator
FORM_8BIT 

8-bit pixel graphics (up to EGA resolution)

FORM_4BIT 

4-bit pixel graphics (up to SVGA graphics)

FORM_MONO 

1-bit pixel graphics

FORM_TILE8 

8x8 tiles

FORM_TILE12 

12x12 tiles

FORM_TILE16 

16x16 tiles

FORM_TILE24 

24x24 tiles

FORM_TILE32 

32x32 tiles

FORM_TILE48 

48x48 tiles

FORM_TILE64 

64x64 tiles

FORM_MTEXT8 

mono text with font 8x8

FORM_MTEXT16 

mono text with font 8x16

FORM_TEXT8 

attribute text with font 8x8

FORM_TEXT16 

attribute text with font 8x16

FORM_RLE 

images with RLE compression (on overlapped layer 1)

Function Documentation

◆ VgaCfgDef()

void VgaCfgDef ( sVgaCfg cfg)

Initialize configuration structure to VGA defaults.

The function presets the structure to the default parameters: 640x480 resolution, VGA display, processor frequency 120 to 270 MHz.

Parameters
cfgConfiguration to modify

◆ VgaPrintCfg()

void VgaPrintCfg ( const sVmode vmode)

Debug print videomode setup.

Parameters
vmodeVideo mode table

◆ VgaCfg()

void VgaCfg ( const sVgaCfg cfg,
sVmode vmode 
)

Calculate the structure for setting up the video mode.

Parameters
cfgSource configuration structure
vmodeDestination videomode setup for driver
See also
VgaInitReq()