Contenues dans
Trouver plus de documentation
Ressources d'assistance comprises
| Télécharger cet ouvrage au format PDF
Display Devices
7
- This device type applies to framebuffers and other devices that appear to be memory to the processor with associated hardware to convert the memory image to a visual display. Display devices can be used as console output devices.
Required Methods
- The display device FCode must declare the display device-type, and must implement the methods open and close.
- System defer words are loaded by appropriate routines. is-install, is-remove and is-selftest are used to create the open, close and selftest routines.
- For display devices, created methods interact with OpenBoot commands in a way that is different from that of other device types. Other device types provide methods that are found by dictionary searches looking for specific names.
- Some FCodes are specifically designed for display devices. See Table A-35 through Table A-41 in Appendix A, "FCode Reference".
Required Properties
-
Table 7-1
| Property Name | Typical Value |
| name | SUNW,cgsix {any name chosen by the manufacturer] |
| device_type | display..{required for display devices} |
| reg | list of registers {depends on the device} |
Device Driver Examples
Simple Display Device Driver
- This is a sample FCode program for a display device that does not need to be usable as a console display device during system power-up.
-
\ Basic display device driver
\ cg6 (Lego) frame buffer driver
\ This version doesn't use the graphics accelerator because of
\ conflicts with the window system's use of same.
hex
fcode-version1
" SUNW,cgsix" name
" SUNW,501-xxxx" model
h# 20.0000 constant dac-offset h# 10 constant /dac
h# 30.0000 constant fhc-offset h# 10 constant /fhc
h# 30.1800 constant thc-offset h# 20 constant /thc
h# 70.0000 constant fbc-offset h# 10 constant /fbc
h# 70.1000 constant tec-offset h# 10 constant /tec
h# 80.0000 constant fb-offset h# 10.0000 constant /frame
: >reg-spec ( offset size -- xdrreg )
>r my-address + my-space xdrphys r> xdrint xdr+
;
dac-offset /dac >reg-spec
|
-
\ Basic display device driver
fhc-offset /fhc >reg-spec xdr+
thc-offset /thc >reg-spec xdr+
fbc-offset /fbc >reg-spec xdr+
tec-offset /tec >reg-spec xdr+
fb-offset /frame >reg-spec xdr+
" reg" attribute
5 0 intr
5 xdrint " interrupts" attribute
end0
|
Extended Display Device Driver
- This sample FCode program has added code to initialize and test the device, but still is not usable as a console display device during system power-up.
-
\ Extended Display device driver
\ cg6 (Lego) frame buffer driver
\ This version doesn't use the graphics accelerator because of
\ conflicts with the window system's use of same.
hex
fcode-version1
" SUNW,cgsix" name
" SUNW,501-xxxx" model
h# 20.0000 constant dac-offset h# 10 constant /dac
h# 30.0000 constant fhc-offset h# 10 constant /fhc
h# 30.1800 constant thc-offset h# 20 constant /thc
h# 70.0000 constant fbc-offset h# 10 constant /fbc
h# 70.1000 constant tec-offset h# 10 constant /tec
h# 80.0000 constant fb-offset h# 10.0000 constant /frame
: >reg-spec ( offset size -- xdrreg )
>r my-address + my-space xdrphys r> xdrint xdr+
;
|
-
\ Extended Display device driver
dac-offset /dac >reg-spec
fhc-offset /fhc >reg-spec xdr+
thc-offset /thc >reg-spec xdr+
fbc-offset /fbc >reg-spec xdr+
tec-offset /tec >reg-spec xdr+
fb-offset /frame >reg-spec xdr+
" reg" attribute
5 xdrint " interrupts" attribute
5 0 intr
-1 value dac-adr
-1 value fhc-adr
-1 value thc-adr
-1 value fbc-adr
-1 value tec-adr
-1 value fb-adr
: copyright ( -- adr len ) " Copyright (c) 1989 by Sun Microsystems, Inc. " ;
: do-map-in ( offset size -- ) swap my-address + swap map-sbus ;
: do-map-out ( vadr size -- ) free-virtual ;
: dac-map ( -- ) dac-offset /dac do-map-in is dac-adr ;
: dac-unmap ( -- ) dac-adr /dac do-map-out -1 is dac-adr ;
: fhc-map ( -- ) fhc-offset /fhc do-map-in is fhc-adr ;
: fhc-unmap ( -- ) fhc-adr /fhc do-map-out -1 is fhc-adr ;
: thc-map ( -- ) thc-offset /thc do-map-in is thc-adr ;
: thc-unmap ( -- ) thc-adr /thc do-map-out -1 is thc-adr ;
: fbc-map ( -- ) fbc-offset /fbc do-map-in is fbc-adr ;
: fbc-unmap ( -- ) fbc-adr /fbc do-map-out -1 is fbc-adr ;
: tec-map ( -- ) tec-offset /tec do-map-in is tec-adr ;
: tec-unmap ( -- ) tec-adr /tec do-map-out -1 is tec-adr ;
: fb-map ( -- ) fb-offset /frame do-map-in is fb-adr ;
: fb-unmap ( -- ) fb-adr /frame do-map-out -1 is fb-adr ;
|
-
\ Extended Display device driver
: map-regs ( -- ) dac-map fhc-map thc-map fbc-map tec-map ;
: unmap-regs ( -- ) tec-unmap fbc-unmap thc-unmap fhc-unmap dac-unmap ;
\ Brooktree DAC interface section
\ The Brooktree DAC has an internal address register which helps to
\ select the internal register which is to be accessed.
\ First, the address is written to register 0, then the data is written
\ to one of the other registers.
\ Ibis has 3 separate DAC chips which appear as the three least-significant
\ bytes of a longword. All three chips may be simultaneously updated
\ with a single longword write.
: dac! ( data reg# -- ) >r dup 2dup bljoin r> dac-adr + l! ;
: dac-ctl! ( data int.adr reg# -- ) swap 0 dac! dac! ;
\ color! sets an overlay color register.
\ In order to be able to use either the Brooktree 457 or 458 dacs, we
\ set the address once, then store the color 3 times. The chip internally
\ cycles each time the color register is written, selecting in turn the
\ red color, the green color, and the blue color.
\ The chip is used in "RGB mode".
: color! ( r g b c# -- )
0 dac! ( r g b )
swap rot ( b g r )
4 dac! ( b g )
4 dac! ( b )
4 dac! ( )
;
: lego-init-dac ( -- )
40 06 8 dac-ctl! \ Control reg: enable off, overlay off, RGB on
0 05 8 dac-ctl! \ Blinking off
ff 04 8 dac-ctl! \ Read mask set to all ones
ff ff ff 0 color! \ White in overlay background color register
0 0 0 ff color! \ Black in overlay foreground color register
64 41 b4 1 color! \ SUN-blue for logo
;
\ End of Brooktree DAC code
\ Lego Selftest section
|
-
\ Extended Display device driver
: fbc! ( value offset -- ) fbc-adr + l! ;
: fbc@ ( offset -- value ) fbc-adr + l@ ;
: tec! ( value offset -- ) tec-adr + l! ;
: lego-selftest ( -- failed? ) false ;
\ Hardware configuration register section
: fhc! ( value offset -- ) fhc-adr + l! ;
: thc! ( value offset -- ) thc-adr + l! ;
: set-res-params ( hcvd hcvs hchd hchsdvb hchs fhc-conf -- )
0 fhc! 0 thc! 4 thc! 8 thc! c thc! 10 thc!
;
\ Resolution params: hcvd hcvs hchd hchsdvb hchs fhc-conf
: r1024x768 ( -- params ) 2c032c 32c0005 110051 490000 510007 3bb ;
: r1152x900 ( -- params ) 2403a8 10005 15005d 570000 10009 bbb ;
: r1024x1024 ( -- params ) 200426 10005 180054 520000 10009 3bb ;
: r1152x870 ( -- params ) 2c0392 20005 120054 540000 10009 bbb ;
: r1600x1280 ( -- params ) 340534 534009 130045 3d0000 450007 1bbb ;
0 value lego-rez-width
0 value lego-rez-height
0 value sense-code
: set-resolution ( sense-code -- )
case
0 of d# 1152 d# 900 endof
12 of d# 1024 d# 1024 endof
13 of d# 1600 d# 1280 endof
drop d# 1152 d# 900 0
endcase
is lego-rez-height is lego-rez-width
;
8f value thc-misc
: lego-video-on ( -- ) thc-misc 400 or 18 thc! ;
: lego-video-off ( -- ) thc-misc 18 thc! ;
: lego-init-hc ( -- )
|
-
\ Extended Display device driver
sense-code case
0 of r1152x900 endof
12 of r1024x1024 endof
13 of r1600x1280 endof
drop r1152x900 0
endcase ( resolution-params )
set-res-params
016b 14 thc! \ THC_HCREFRESH
148f 18 thc! \ THC_HCMISC
\ 48f 18 thc! \ THC_HCMISC
lego-video-off \ Turn video on at install time
;
\ End of hardware configuration register section
end0
|
Complete Display Device Driver
- This sample FCode program is for a device that would be usable as a system console device.
-
\ Complete Display device driver
\ cg6 (Lego) frame buffer driver
\ This version doesn't use the graphics accelerator because of
\ conflicts with the window system's use of same.
hex
fcode-version1
" SUNW,cgsix" name
" SUNW,501-xxxx" model
" display" device-type
h# 20.0000 constant dac-offset h# 10 constant /dac
h# 30.0000 constant fhc-offset h# 10 constant /fhc
h# 30.1800 constant thc-offset h# 20 constant /thc
h# 70.0000 constant fbc-offset h# 10 constant /fbc
h# 70.1000 constant tec-offset h# 10 constant /tec
h# 80.0000 constant fb-offset h# 10.0000 constant /frame
: >reg-spec ( offset size -- xdrreg )
>r my-address + my-space xdrphys r> xdrint xdr+
;
dac-offset /dac >reg-spec
fhc-offset /fhc >reg-spec xdr+
thc-offset /thc >reg-spec xdr+
fbc-offset /fbc >reg-spec xdr+
tec-offset /tec >reg-spec xdr+
fb-offset /frame >reg-spec xdr+
" reg" attribute
5 xdrint " interrupts" attribute
5 0 intr
-1 value dac-adr
-1 value fhc-adr
-1 value thc-adr
-1 value fbc-adr
|
-
\ Complete Display device driver
-1 value tec-adr
-1 value fb-adr
: copyright ( -- adr len ) " Copyright (c) 1989 by Sun Microsystems, Inc. " ;
: do-map-in ( offset size -- ) swap my-address + swap map-sbus ;
: do-map-out ( vadr size -- ) free-virtual ;
: dac-map ( -- ) dac-offset /dac do-map-in is dac-adr ;
: dac-unmap ( -- ) dac-adr /dac do-map-out -1 is dac-adr ;
: fhc-map ( -- ) fhc-offset /fhc do-map-in is fhc-adr ;
: fhc-unmap ( -- ) fhc-adr /fhc do-map-out -1 is fhc-adr ;
: thc-map ( -- ) thc-offset /thc do-map-in is thc-adr ;
: thc-unmap ( -- ) thc-adr /thc do-map-out -1 is thc-adr ;
: fbc-map ( -- ) fbc-offset /fbc do-map-in is fbc-adr ;
: fbc-unmap ( -- ) fbc-adr /fbc do-map-out -1 is fbc-adr ;
: tec-map ( -- ) tec-offset /tec do-map-in is tec-adr ;
: tec-unmap ( -- ) tec-adr /tec do-map-out -1 is tec-adr ;
: fb-map ( -- ) fb-offset /frame do-map-in is fb-adr ;
: fb-unmap ( -- ) fb-adr /frame do-map-out -1 is fb-adr ;
: map-regs ( -- ) dac-map fhc-map thc-map fbc-map tec-map ;
: unmap-regs ( -- ) tec-unmap fbc-unmap thc-unmap fhc-unmap dac-unmap ;
\ Brooktree DAC interface section
\ The Brooktree DAC has an internal address register which helps to
\ select the internal register which is to be accessed.
\ First, the address is written to register 0, then the data is written
\ to one of the other registers.
\ Ibis has 3 separate DAC chips which appear as the three least-significant
\ bytes of a longword. All three chips may be simultaneously updated
\ with a single longword write.
: dac! ( data reg# -- ) >r dup 2dup bljoin r> dac-adr + l! ;
: dac-ctl! ( data int.adr reg# -- ) swap 0 dac! dac! ;
|
-
\ Complete Display device driver
\ color! sets an overlay color register.
\ In order to be able to use either the Brooktree 457 or 458 dacs, we
\ set the address once, then store the color 3 times. The chip internally
\ cycles each time the color register is written, selecting in turn the
\ red color, the green color, and the blue color.
\ The chip is used in "RGB mode".
: color! ( r g b c# -- )
0 dac! ( r g b )
swap rot ( b g r )
4 dac! ( b g )
4 dac! ( b )
4 dac! ( )
;
: lego-init-dac ( -- )
40 06 8 dac-ctl! \ Control reg: enable off, overlay off, RGB on
0 05 8 dac-ctl! \ Blinking off
ff 04 8 dac-ctl! \ Read mask set to all ones
ff ff ff 0 color! \ White in overlay background color register
0 0 0 ff color! \ Black in overlay foreground color register
64 41 b4 1 color! \ SUN-blue for logo
;
\ End of Brooktree DAC code
\ Lego Selftest section
: fbc! ( value offset -- ) fbc-adr + l! ;
: fbc@ ( offset -- value ) fbc-adr + l@ ;
: tec! ( value offset -- ) tec-adr + l! ;
: lego-selftest ( -- failed? ) false ;
\ Hardware configuration register section
: fhc! ( value offset -- ) fhc-adr + l! ;
: thc! ( value offset -- ) thc-adr + l! ;
: set-res-params ( hcvd hcvs hchd hchsdvb hchs fhc-conf -- )
0 fhc! 0 thc! 4 thc! 8 thc! c thc! 10 thc!
;
|
-
\ Complete Display device driver
\ Resolution params: hcvd hcvs hchd hchsdvb hchs fhc-conf
: r1024x768 ( -- params ) 2c032c 32c0005 110051 490000 510007 3bb ;
: r1152x900 ( -- params ) 2403a8 10005 15005d 570000 10009 bbb ;
: r1024x1024 ( -- params ) 200426 10005 180054 520000 10009 3bb ;
: r1152x870 ( -- params ) 2c0392 20005 120054 540000 10009 bbb ;
: r1600x1280 ( -- params ) 340534 534009 130045 3d0000 450007 1bbb ;
0 value lego-rez-width
0 value lego-rez-height
0 value sense-code
: set-resolution ( sense-code -- )
case
0 of d# 1152 d# 900 endof
12 of d# 1024 d# 1024 endof
13 of d# 1600 d# 1280 endof
drop d# 1152 d# 900 0
endcase
is lego-rez-height is lego-rez-width
;
8f value thc-misc
: lego-video-on ( -- ) thc-misc 400 or 18 thc! ;
: lego-video-off ( -- ) thc-misc 18 thc! ;
: lego-blink ( -- ) lego-video-off 20 ms lego-video-on ;
: lego-init-hc ( -- )
sense-code case
0 of r1152x900 endof
12 of r1024x1024 endof
13 of r1600x1280 endof
drop r1152x900 0
endcase ( resolution-params )
set-res-params
016b 14 thc! \ THC_HCREFRESH
148f 18 thc! \ THC_HCMISC
lego-video-off\ Turn video on at install time
;
\ End of hardware configuration register section
|
-
\ Complete Display device driver
\ Lego graphics section
: lego-install ( -- )
map-regs fb-map fb-adr is frame-buffer-adr
default-font ( param ... ) set-font
frame-buffer-adr xdrint " address" attribute
lego-rez-width lego-rez-height over char-width / over char-height /
fb8-install
['] lego-blink is blink-screen
lego-video-on
;
: lego-remove ( -- )
lego-video-off
unmap-regs
fb-unmap -1 is frame-buffer-adr
;
\ End of Lego graphics section
: lego-probe ( -- )
map-regs
sense-code set-resolution
lego-init-dac
lego-init-hc
unmap-regs
lego-rez-width xdrint " width" attribute
lego-rez-height xdrint " height" attribute
d# 8 xdrint " depth" attribute
lego-rez-width xdrint " linebytes" attribute
['] lego-install is-install
['] lego-remove is-remove
['] lego-selftest is-selftest
;
|
-
\ Complete Display device driver
lego-probe
end0
|
|
|