Example Of Breshenham's Algorithm Line Draw - Cirrus Logic EP93 Series User Manual

Arm 9 embedded processor family
Table of Contents

Advertisement

9. Setup BLKDESTWIDTH Register
Write 'abs(X2 -X1) modulo 4096, minus 1' to the WIDTH field in the
register.
10.Setup BLKDESTHEIGHT Register
Write 'abs(Y2 - Y1) / 4096, minus 1' to the HEIGHT field in the
register.
11.Setup BLOCKCTRL Register
A. Clear the
B. Set the LINE bit to '1'
C. If X2 > X1, set the DXDIR bit to '1', else set the DXDIR bit to '0'
D. If Y2 > Y1, set the DYDIR bit to '1', else set the DYDIR bit to '0'
E. Either set the BG bit to '1' to use the background color specified in
register or set the BG bit to '0' for transparent background.
F. Set the P bits to the value for the desired BPP color depth
G. If interrupts are desired, set the INTEN bit to '1'
H. Set the EN bit to '1'
The final step is to wait for an interrupt or poll for EN = '0' in the BLOCKCTRL register. When
the EN bit becomes cleared to '0', the line draw function is complete.

8.6.2 Example of Breshenham's Algorithm Line Draw

To achieve the following display and pattern, follow Steps 1 to 14 in this section.
• Display size is 640 x 480 x 16-bits per pixel
• Display memory starts at physical location 0x0000_0000
• Pattern is 8 transparent pixels and 8 white pixels
• X2 = 20, X1 = 101
• Y2 = 20, Y1 = 301
The following sequence describes how to set up those registers that are used for a
Breshenham's algorithm line draw.
1. Write XINIT = 0x800 (2048) and YINIT = 0x800 to the
2. Write PTTN = 0x00FF and CNT = 0xF to the
3. Write LEN = 0x140 to the
(1 / # of 16-bit pixels in word) = 640 x 1/2 = 320 = 0x140
4. Write SPEL = 0x8 and EPEL = 0x0 to the
DS785UM1
"BLOCKCTRL"
register by writing 0x0000_0000 to it.
"DESTLINELENGTH"
Copyright 2007 Cirrus Logic
"BLKDESTHEIGHT"
"LINEINIT"
"LINEPATTRN"
register
register, where LEN = 640 (pixels) x 1/2
"DESTPIXELSTRT"
register, where:
Graphics Accelerator
EP93xx User's Guide
"BLKDESTWIDTH"
"BACKGROUND"
register
8-15
8

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the EP93 Series and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Ep9315Ep9301Ep9302Ep9307Ep9312

Table of Contents