kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Restore default capture code
rodzic
f963eb5e24
commit
ec9b89862b
|
@ -63,7 +63,9 @@ file( GLOB core_files
|
|||
rgb_to_hdmi.c
|
||||
rgb_to_fb.S
|
||||
capture_line_mode7_4bpp.S
|
||||
capture_line_inband_4bpp_8bpp.S
|
||||
capture_line_default_4bpp_8bpp.S
|
||||
capture_line_oddeven_4bpp_8bpp.S
|
||||
capture_line_half_4bpp_8bpp.S
|
||||
capture_line_atom_4bpp.S
|
||||
capture_line_atom_8bpp.S
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
.global capture_line_default_4bpp
|
||||
.global capture_line_default_8bpp
|
||||
.global inBandData
|
||||
.global sentinel
|
||||
.global paletteFlags
|
||||
.global inBandPointer
|
||||
|
||||
// The capture line function is provided the following:
|
||||
// r0 = pointer to current line in frame buffer
|
||||
|
@ -23,168 +19,35 @@
|
|||
//
|
||||
// All registers are available as scratch registers (i.e. nothing needs to be preserved)
|
||||
|
||||
|
||||
inBandData:
|
||||
.space 32768, 0
|
||||
|
||||
|
||||
b preload_capture_line_default
|
||||
capture_line_default_4bpp:
|
||||
push {lr}
|
||||
|
||||
push {lr}
|
||||
ldr r11, inBandPointer
|
||||
ldr r8, paletteFlags
|
||||
mov r6, #0
|
||||
mov r7, #0
|
||||
tst r8, #BIT_IN_BAND_ENABLE
|
||||
ldrne r12, sentinel // 32 bit sentinel
|
||||
moveq r12, #0 // in band detection disabled
|
||||
|
||||
tst r8, #BIT_SET_MODE2_16COLOUR
|
||||
orrne r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
biceq r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
|
||||
cmp r5, #DUPLICATE_HEIGHT
|
||||
orrle r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
|
||||
capheader: // test for 640 bits in band format works only in mode 0
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
tst r3, #BIT_VSYNC_MARKER
|
||||
ldrne r7, =0x11111111
|
||||
moveq r7, #0
|
||||
tst r3, #BIT_DEBUG
|
||||
eorne r7, r7, #0x50 //magenta in leftmost
|
||||
eorne r7, r7, #0x02000000 //green in rightmost
|
||||
loop:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // input in r8, result in r10, corrupts r9
|
||||
CAPTURE_LOW_BITS // input in r8, result in r10, corrupts r9
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // input in r8, result in r10, corrupts r9
|
||||
WRITE_WORD
|
||||
cmp r12, #0 // test if in band detection disabled
|
||||
mvneq r6, #0 // trash r6 & r7 if in band disabled so below tests fail
|
||||
mvneq r7, #0 // this avoids another branch which seems to cause occasional glitches
|
||||
cmp r6, r12
|
||||
beq foundmode0inband
|
||||
cmp r7, r12
|
||||
beq foundmode0to6inband
|
||||
CAPTURE_HIGH_BITS // input in r8, result in r10, corrupts r9
|
||||
WRITE_WORD_FAST
|
||||
subs r1, r1, #1
|
||||
bne capheader
|
||||
bne loop
|
||||
pop {pc}
|
||||
|
||||
preload_capture_line_default:
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
b capture_line_default_4bpp
|
||||
|
||||
preload_foundmode0inband:
|
||||
push {lr}
|
||||
foundmode0inband: // found 640 bits in band format works only in mode 0
|
||||
subs r1, r1, #1 // too short for valid data
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
and r5, r6, #0xff // first byte read in r6 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
inBandLoop0:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
cmp r5, #0 // only write command bytes until last one read
|
||||
strneb r6, [r11], #1
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #16
|
||||
mov r11, #4
|
||||
blank0loop:
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r11, r11, #1
|
||||
bne blank0loop
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
preload_foundmode0to6inband:
|
||||
push {lr}
|
||||
foundmode0to6inband: // found 160 bits in band format works in all modes
|
||||
subs r1, r1, #1
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
mov r5, #4 // need to read 4 word in 160 bit mode to get 1 byte of data
|
||||
inBandLoop0to6_size:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
subs r5, r5, #1
|
||||
bne inBandLoop0to6_size
|
||||
and r5, r7, #0xff // first byte read in r7 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
mov r5, r5, lsl #2 // must read 4 words to get 1 byte in 160 bit mode
|
||||
inBandLoop0to6:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
and r8, r5, #3
|
||||
cmp r8, #1
|
||||
streqb r7, [r11], #1
|
||||
cmp r5, #0
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0to6
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #64
|
||||
mov r11, #16
|
||||
blank0to6loop:
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r11, r11, #1
|
||||
bne blank0to6loop
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
preload_capture_line_default:
|
||||
push {lr}
|
||||
ldr r0, paletteFlags
|
||||
ldr r1, inBandPointer
|
||||
push {r0, r1}
|
||||
mov r0, #0
|
||||
str r0, paletteFlags //disable in band detection
|
||||
ldr r0, =(dummyscreen + 1024) //data written backwards by inband code
|
||||
mov r1, #1
|
||||
mov r2, #0
|
||||
bl capture_line_default_4bpp
|
||||
mov r1, #3
|
||||
bl preload_foundmode0inband
|
||||
mov r1, #6
|
||||
bl preload_foundmode0to6inband
|
||||
pop {r0, r1}
|
||||
str r0, paletteFlags
|
||||
str r1, inBandPointer
|
||||
pop {pc}
|
||||
|
||||
|
||||
.ltorg
|
||||
|
||||
sentinel:
|
||||
.word 0
|
||||
|
||||
paletteFlags:
|
||||
.word 0
|
||||
|
||||
inBandPointer:
|
||||
.word 0
|
||||
|
||||
.ltorg
|
||||
|
||||
// *** 8 bit ***
|
||||
|
||||
|
@ -192,159 +55,29 @@ inBandPointer:
|
|||
b preload_capture_line_default_8bpp
|
||||
capture_line_default_8bpp:
|
||||
push {lr}
|
||||
ldr r11, inBandPointer
|
||||
ldr r8, paletteFlags
|
||||
mov r6, #0
|
||||
mov r7, #0
|
||||
tst r8, #BIT_IN_BAND_ENABLE
|
||||
ldrne r12, sentinel // 32 bit sentinel
|
||||
moveq r12, #0 // in band detection disabled
|
||||
|
||||
tst r8, #BIT_SET_MODE2_16COLOUR
|
||||
orrne r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
biceq r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
|
||||
|
||||
cmp r5, #DUPLICATE_HEIGHT
|
||||
orrle r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
tst r3, #BIT_VSYNC_MARKER
|
||||
ldrne r7, =0x01010101
|
||||
moveq r7, #0
|
||||
tst r3, #BIT_DEBUG
|
||||
eorne r7, r7, #0x05 //magenta in leftmost
|
||||
eorne r7, r7, #0x02000000 //green in rightmost
|
||||
|
||||
mov r8, r8, lsr #28
|
||||
bic r3, #MASKDUP_PALETTE_HIGH_NIBBLE
|
||||
orr r3, r3, r8, lsl #OFFSETDUP_PALETTE_HIGH_NIBBLE
|
||||
mov r1, r1, lsl #1
|
||||
|
||||
capheader_8bpp: // test for 640 bits in band format works only in mode 0
|
||||
loop_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE_8BPP // input in r8, result in r10, corrupts r9
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE_8BPP // input in r8, result in r9/r10
|
||||
WRITE_WORDS_8BPP
|
||||
cmp r12, #0 // test if in band detection disabled
|
||||
mvneq r6, #0 // trash r6 & r7 if in band disabled so below tests fail
|
||||
mvneq r7, #0 // this avoids another branch which seems to cause occasional glitches
|
||||
cmp r6, r12
|
||||
beq foundmode0inband_8bpp
|
||||
cmp r7, r12
|
||||
beq foundmode0to6inband_8bpp
|
||||
CAPTURE_BITS_8BPP // input in r8, result in r10, corrupts r9
|
||||
WRITE_WORD_FAST
|
||||
subs r1, r1, #1
|
||||
bne capheader_8bpp
|
||||
bne loop_8bpp
|
||||
pop {pc}
|
||||
|
||||
preload_foundmode0inband_8bpp:
|
||||
push {lr}
|
||||
foundmode0inband_8bpp: // found 640 bits in band format works only in mode 0
|
||||
subs r1, r1, #1 // too short for valid data
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
and r5, r6, #0xff // first byte read in r6 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
inBandLoop0_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
cmp r5, #0 // only write command bytes until last one read
|
||||
strneb r6, [r11], #1
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0_8bpp
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #32
|
||||
mov r11, #8
|
||||
blank0loop_8bpp:
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r11, r11, #1
|
||||
bne blank0loop_8bpp
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
preload_foundmode0to6inband_8bpp:
|
||||
push {lr}
|
||||
foundmode0to6inband_8bpp: // found 160 bits in band format works in all modes
|
||||
subs r1, r1, #1
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
|
||||
mov r5, #4 // need to read 4 word in 160 bit mode to get 1 byte of data
|
||||
inBandLoop0to6_size_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
subs r5, r5, #1
|
||||
bne inBandLoop0to6_size_8bpp
|
||||
and r5, r7, #0xff // first byte read in r7 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
mov r5, r5, lsl #2 // must read 4 words to get 1 byte in 160 bit mode
|
||||
inBandLoop0to6_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
and r8, r5, #3
|
||||
cmp r8, #1
|
||||
streqb r7, [r11], #1
|
||||
cmp r5, #0
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0to6_8bpp
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #128
|
||||
mov r11, #32
|
||||
blank0to6loop_8bpp:
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r11, r11, #1
|
||||
bne blank0to6loop_8bpp
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
|
||||
preload_capture_line_default_8bpp:
|
||||
push {lr}
|
||||
ldr r0, paletteFlags
|
||||
ldr r1, inBandPointer
|
||||
push {r0, r1}
|
||||
mov r0, #0
|
||||
str r0, paletteFlags //disable in band detection
|
||||
ldr r0, =dummyscreen
|
||||
add r0, r0, #256 //data written backwards by in band code
|
||||
mov r1, #1
|
||||
mov r2, #0
|
||||
bl capture_line_default_8bpp
|
||||
mov r1, #3
|
||||
bl preload_foundmode0inband_8bpp
|
||||
mov r1, #6
|
||||
bl preload_foundmode0to6inband_8bpp
|
||||
pop {r0, r1}
|
||||
str r0, paletteFlags
|
||||
str r1, inBandPointer
|
||||
pop {pc}
|
||||
preload_capture_line_default_8bpp:
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
b capture_line_default_8bpp
|
||||
|
||||
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
.text
|
||||
|
||||
.global capture_line_default_half_4bpp
|
||||
.global capture_line_default_half_8bpp
|
||||
.global capture_line_half_4bpp
|
||||
.global capture_line_half_8bpp
|
||||
|
||||
|
||||
// The capture line function is provided the following:
|
||||
|
@ -20,15 +20,15 @@
|
|||
//
|
||||
// All registers are available as scratch registers (i.e. nothing needs to be preserved)
|
||||
|
||||
b preload_capture_line_default_half_4bpp
|
||||
capture_line_default_half_4bpp:
|
||||
b preload_capture_line_half_4bpp
|
||||
capture_line_half_4bpp:
|
||||
push {lr}
|
||||
cmp r1, #400/8 //sanity check on buffer size as only capturing half of pixels so width >400 will never finish
|
||||
movgt r1, r1, lsr#1
|
||||
cmp r5, #DUPLICATE_HEIGHT
|
||||
orrle r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
capture_half_4bpp: //
|
||||
capture_half_4bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS // input in r8, result in r10, corrupts r9
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
|
@ -83,20 +83,17 @@ capture_half_4bpp: //
|
|||
bne capture_half_4bpp
|
||||
pop {pc}
|
||||
|
||||
preload_capture_line_default_half_4bpp:
|
||||
ldr r0, =(dummyscreen + 1024) //in case data written backwards
|
||||
mov r1, #1
|
||||
mov r2, #0
|
||||
mov r5, #0
|
||||
mov r6, #0
|
||||
b capture_line_default_half_4bpp
|
||||
preload_capture_line_half_4bpp:
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
b capture_line_half_4bpp
|
||||
|
||||
.ltorg
|
||||
|
||||
// *** 8 bit ***
|
||||
|
||||
|
||||
b preload_capture_line_default_half_8bpp
|
||||
capture_line_default_half_8bpp:
|
||||
b preload_capture_line_half_8bpp
|
||||
capture_line_half_8bpp:
|
||||
push {lr}
|
||||
cmp r1, #400/8 //sanity check on buffer size as only capturing half of pixels so width >400 will never finish
|
||||
movgt r1, r1, lsr#1
|
||||
|
@ -163,13 +160,9 @@ capture_half_8bpp:
|
|||
bne capture_half_8bpp
|
||||
pop {pc}
|
||||
|
||||
preload_capture_line_default_half_8bpp:
|
||||
ldr r0, =(dummyscreen + 1024) //in case data written backwards
|
||||
mov r1, #1
|
||||
mov r2, #0
|
||||
mov r5, #0
|
||||
mov r6, #0
|
||||
b capture_line_default_half_8bpp
|
||||
preload_capture_line_half_8bpp:
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
b capture_line_half_8bpp
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,336 @@
|
|||
#include "rpi-base.h"
|
||||
#include "defs.h"
|
||||
|
||||
#include "macros.S"
|
||||
|
||||
.text
|
||||
|
||||
.global capture_line_inband_4bpp
|
||||
.global capture_line_inband_8bpp
|
||||
.global inBandData
|
||||
.global sentinel
|
||||
.global paletteFlags
|
||||
.global inBandPointer
|
||||
|
||||
// The capture line function is provided the following:
|
||||
// r0 = pointer to current line in frame buffer
|
||||
// r1 = number of 8-pixel blocks to capture (=param_chars_per_line)
|
||||
// r2 = frame buffer line pitch in bytes (=param_fb_pitch)
|
||||
// r3 = flags register
|
||||
// r4 = GPLEV0 constant
|
||||
// r5 = frame buffer height (=param_fb_height)
|
||||
// r6 = scan line count modulo 10
|
||||
//
|
||||
// All registers are available as scratch registers (i.e. nothing needs to be preserved)
|
||||
|
||||
|
||||
inBandData:
|
||||
.space 32768, 0
|
||||
|
||||
b preload_capture_line_inband_4bpp
|
||||
capture_line_inband_4bpp:
|
||||
|
||||
push {lr}
|
||||
ldr r11, inBandPointer
|
||||
ldr r8, paletteFlags
|
||||
mov r6, #0
|
||||
mov r7, #0
|
||||
|
||||
tst r8, #BIT_SET_MODE2_16COLOUR
|
||||
orrne r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
biceq r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
|
||||
cmp r5, #DUPLICATE_HEIGHT
|
||||
orrle r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
|
||||
ldr r12, sentinel // 32 bit sentinel
|
||||
loop:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // input in r8, result in r10, corrupts r9
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // input in r8, result in r10, corrupts r9
|
||||
WRITE_WORD
|
||||
cmp r6, r12
|
||||
beq foundmode0inband
|
||||
cmp r7, r12
|
||||
beq foundmode0to6inband
|
||||
subs r1, r1, #1
|
||||
bne loop
|
||||
pop {pc}
|
||||
|
||||
preload_foundmode0inband:
|
||||
push {lr}
|
||||
foundmode0inband: // found 640 bits in band format works only in mode 0
|
||||
subs r1, r1, #1 // too short for valid data
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
and r5, r6, #0xff // first byte read in r6 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
inBandLoop0:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
cmp r5, #0 // only write command bytes until last one read
|
||||
strneb r6, [r11], #1
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #16
|
||||
mov r11, #4
|
||||
blank0loop:
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r11, r11, #1
|
||||
bne blank0loop
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
preload_foundmode0to6inband:
|
||||
push {lr}
|
||||
foundmode0to6inband: // found 160 bits in band format works in all modes
|
||||
subs r1, r1, #1
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
mov r5, #4 // need to read 4 word in 160 bit mode to get 1 byte of data
|
||||
inBandLoop0to6_size:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
subs r5, r5, #1
|
||||
bne inBandLoop0to6_size
|
||||
and r5, r7, #0xff // first byte read in r7 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
mov r5, r5, lsl #2 // must read 4 words to get 1 byte in 160 bit mode
|
||||
inBandLoop0to6:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
and r8, r5, #3
|
||||
cmp r8, #1
|
||||
streqb r7, [r11], #1
|
||||
cmp r5, #0
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0to6
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #64
|
||||
mov r11, #16
|
||||
blank0to6loop:
|
||||
mov r10, #0
|
||||
WRITE_WORD
|
||||
subs r11, r11, #1
|
||||
bne blank0to6loop
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
preload_capture_line_inband_4bpp:
|
||||
push {lr}
|
||||
ldr r0, paletteFlags
|
||||
ldr r1, inBandPointer
|
||||
push {r0, r1}
|
||||
mov r0, #0
|
||||
str r0, paletteFlags //disable flags
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
bl capture_line_inband_4bpp
|
||||
mov r1, #3
|
||||
bl preload_foundmode0inband
|
||||
mov r1, #6
|
||||
bl preload_foundmode0to6inband
|
||||
pop {r0, r1}
|
||||
str r0, paletteFlags
|
||||
str r1, inBandPointer
|
||||
pop {pc}
|
||||
|
||||
|
||||
.ltorg
|
||||
|
||||
sentinel:
|
||||
.word 0
|
||||
|
||||
paletteFlags:
|
||||
.word 0
|
||||
|
||||
inBandPointer:
|
||||
.word 0
|
||||
|
||||
|
||||
// *** 8 bit ***
|
||||
|
||||
|
||||
b preload_capture_line_inband_8bpp
|
||||
capture_line_inband_8bpp:
|
||||
push {lr}
|
||||
ldr r11, inBandPointer
|
||||
ldr r8, paletteFlags
|
||||
mov r6, #0
|
||||
mov r7, #0
|
||||
|
||||
tst r8, #BIT_SET_MODE2_16COLOUR
|
||||
orrne r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
biceq r3, r3, #BITDUP_MODE2_16COLOUR
|
||||
|
||||
cmp r5, #DUPLICATE_HEIGHT
|
||||
orrle r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
|
||||
mov r8, r8, lsr #28
|
||||
bic r3, #MASKDUP_PALETTE_HIGH_NIBBLE
|
||||
orr r3, r3, r8, lsl #OFFSETDUP_PALETTE_HIGH_NIBBLE
|
||||
|
||||
ldr r12, sentinel // 32 bit sentinel
|
||||
|
||||
loop_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE_8BPP // input in r8, result in r10, corrupts r9
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE_8BPP // input in r8, result in r9/r10
|
||||
WRITE_WORDS_8BPP
|
||||
cmp r6, r12
|
||||
beq foundmode0inband_8bpp
|
||||
cmp r7, r12
|
||||
beq foundmode0to6inband_8bpp
|
||||
subs r1, r1, #1
|
||||
bne loop_8bpp
|
||||
pop {pc}
|
||||
|
||||
preload_foundmode0inband_8bpp:
|
||||
push {lr}
|
||||
foundmode0inband_8bpp: // found 640 bits in band format works only in mode 0
|
||||
subs r1, r1, #1 // too short for valid data
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
and r5, r6, #0xff // first byte read in r6 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
inBandLoop0_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro as it's faster (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
cmp r5, #0 // only write command bytes until last one read
|
||||
strneb r6, [r11], #1
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0_8bpp
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #32
|
||||
mov r11, #8
|
||||
blank0loop_8bpp:
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r11, r11, #1
|
||||
bne blank0loop_8bpp
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
preload_foundmode0to6inband_8bpp:
|
||||
push {lr}
|
||||
foundmode0to6inband_8bpp: // found 160 bits in band format works in all modes
|
||||
subs r1, r1, #1
|
||||
popeq {pc}
|
||||
mov r12, r0 // save current screen pointer in r12 (points to end of sentinel)
|
||||
|
||||
mov r5, #4 // need to read 4 word in 160 bit mode to get 1 byte of data
|
||||
inBandLoop0to6_size_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r1, r1, #1
|
||||
popeq {pc} // too short for valid data
|
||||
subs r5, r5, #1
|
||||
bne inBandLoop0to6_size_8bpp
|
||||
and r5, r7, #0xff // first byte read in r7 is count of command bytes
|
||||
strb r5, [r11], #1
|
||||
mov r5, r5, lsl #2 // must read 4 words to get 1 byte in 160 bit mode
|
||||
inBandLoop0to6_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS_TRANSLATE // use 4 bit macro to avoid corrupting r5 (4 bit screen value discarded)
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
and r8, r5, #3
|
||||
cmp r8, #1
|
||||
streqb r7, [r11], #1
|
||||
cmp r5, #0
|
||||
subne r5, r5, #1
|
||||
subs r1, r1, #1
|
||||
bne inBandLoop0to6_8bpp
|
||||
str r11, inBandPointer
|
||||
sub r0, r12, #128
|
||||
mov r11, #32
|
||||
blank0to6loop_8bpp:
|
||||
mov r9, #0
|
||||
mov r10, #0
|
||||
WRITE_WORDS_8BPP
|
||||
subs r11, r11, #1
|
||||
bne blank0to6loop_8bpp
|
||||
ldr r8, paletteFlags
|
||||
orr r8, r8, #BIT_IN_BAND_DETECTED
|
||||
str r8, paletteFlags
|
||||
pop {pc}
|
||||
|
||||
|
||||
preload_capture_line_inband_8bpp:
|
||||
push {lr}
|
||||
ldr r0, paletteFlags
|
||||
ldr r1, inBandPointer
|
||||
push {r0, r1}
|
||||
mov r0, #0
|
||||
str r0, paletteFlags //disable flags
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
bl capture_line_inband_8bpp
|
||||
mov r1, #3
|
||||
bl preload_foundmode0inband_8bpp
|
||||
mov r1, #6
|
||||
bl preload_foundmode0to6inband_8bpp
|
||||
pop {r0, r1}
|
||||
str r0, paletteFlags
|
||||
str r1, inBandPointer
|
||||
pop {pc}
|
||||
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
#include "rpi-base.h"
|
||||
#include "defs.h"
|
||||
|
||||
#include "macros.S"
|
||||
|
||||
.text
|
||||
|
||||
.global capture_line_oddeven_4bpp
|
||||
.global capture_line_oddeven_8bpp
|
||||
|
||||
// The capture line function is provided the following:
|
||||
// r0 = pointer to current line in frame buffer
|
||||
// r1 = number of 8-pixel blocks to capture (=param_chars_per_line)
|
||||
// r2 = frame buffer line pitch in bytes (=param_fb_pitch)
|
||||
// r3 = flags register
|
||||
// r4 = GPLEV0 constant
|
||||
// r5 = frame buffer height (=param_fb_height)
|
||||
// r6 = scan line count modulo 10
|
||||
//
|
||||
// All registers are available as scratch registers (i.e. nothing needs to be preserved)
|
||||
|
||||
|
||||
b preload_capture_line_oddeven
|
||||
capture_line_oddeven_4bpp:
|
||||
push {lr}
|
||||
|
||||
cmp r5, #DUPLICATE_HEIGHT
|
||||
orrle r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
tst r3, #BIT_VSYNC_MARKER
|
||||
ldrne r7, =0x11111111
|
||||
moveq r7, #0
|
||||
tst r3, #BIT_DEBUG
|
||||
eorne r7, r7, #0x50 //magenta in leftmost
|
||||
eorne r7, r7, #0x02000000 //green in rightmost
|
||||
|
||||
tst r3, #BIT_EVEN_SAMPLES
|
||||
ldrne r6, =0x70707070
|
||||
tst r3, #BIT_ODD_SAMPLES
|
||||
ldrne r6, =0x07070707
|
||||
|
||||
loop:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_LOW_BITS // input in r8, result in r10, corrupts r9
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_HIGH_BITS // input in r8, result in r10, corrupts r9
|
||||
|
||||
tst r3, #BIT_EVEN_SAMPLES
|
||||
bicne r10, r10, r6
|
||||
orrne r10, r10, r10, lsl #4
|
||||
|
||||
tst r3, #BIT_ODD_SAMPLES
|
||||
bicne r10, r10, r6
|
||||
orrne r10, r10, r10, lsr #4
|
||||
|
||||
WRITE_WORD_FAST
|
||||
subs r1, r1, #1
|
||||
bne loop
|
||||
pop {pc}
|
||||
|
||||
preload_capture_line_oddeven:
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
b capture_line_oddeven_4bpp
|
||||
|
||||
.ltorg
|
||||
|
||||
// *** 8 bit ***
|
||||
|
||||
|
||||
b preload_capture_line_oddeven_8bpp
|
||||
capture_line_oddeven_8bpp:
|
||||
push {lr}
|
||||
|
||||
cmp r5, #DUPLICATE_HEIGHT
|
||||
orrle r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
bicgt r3, r3, #BITDUP_NO_LINE_DOUBLE
|
||||
tst r3, #BIT_VSYNC_MARKER
|
||||
ldrne r7, =0x01010101
|
||||
moveq r7, #0
|
||||
tst r3, #BIT_DEBUG
|
||||
eorne r7, r7, #0x05 //magenta in leftmost
|
||||
eorne r7, r7, #0x02000000 //green in rightmost
|
||||
mov r1, r1, lsl #1
|
||||
|
||||
tst r3, #BIT_EVEN_SAMPLES
|
||||
ldrne r6, =0x00070007
|
||||
tst r3, #BIT_ODD_SAMPLES
|
||||
ldrne r6, =0x07000700
|
||||
|
||||
loop_8bpp:
|
||||
WAIT_FOR_PSYNC_EDGE // expects GPLEV0 in r4, result in r8
|
||||
CAPTURE_BITS_8BPP // input in r8, result in r10, corrupts r9
|
||||
|
||||
tst r3, #BIT_EVEN_SAMPLES
|
||||
bicne r10, r10, r6
|
||||
orrne r10, r10, r10, lsr #8
|
||||
|
||||
tst r3, #BIT_ODD_SAMPLES
|
||||
bicne r10, r10, r6
|
||||
orrne r10, r10, r10, lsl #8
|
||||
|
||||
WRITE_WORD_FAST
|
||||
subs r1, r1, #1
|
||||
bne loop_8bpp
|
||||
pop {pc}
|
||||
|
||||
preload_capture_line_oddeven_8bpp:
|
||||
SETUP_DUMMY_PARAMETERS
|
||||
b capture_line_oddeven_8bpp
|
||||
|
||||
|
|
@ -395,17 +395,42 @@ static void cpld_set_mode(capture_info_t *capinfo, int mode) {
|
|||
if (capinfo) {
|
||||
if (!mode) {
|
||||
if (capinfo->bpp == 8) {
|
||||
if (capinfo->px_sampling == PS_HALF_E || capinfo->px_sampling == PS_HALF_O) {
|
||||
capinfo->capture_line = capture_line_default_half_8bpp;
|
||||
} else {
|
||||
capinfo->capture_line = capture_line_default_8bpp;
|
||||
}
|
||||
switch (capinfo->px_sampling) {
|
||||
case PS_INBAND:
|
||||
case PS_INBAND_E:
|
||||
case PS_INBAND_O:
|
||||
capinfo->capture_line = capture_line_inband_8bpp;
|
||||
break;
|
||||
case PS_NORMAL:
|
||||
capinfo->capture_line = capture_line_default_8bpp;
|
||||
break;
|
||||
case PS_NORMAL_E:
|
||||
case PS_NORMAL_O:
|
||||
capinfo->capture_line = capture_line_oddeven_8bpp;
|
||||
break;
|
||||
case PS_HALF_E:
|
||||
case PS_HALF_O:
|
||||
capinfo->capture_line = capture_line_half_8bpp;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (capinfo->px_sampling == PS_HALF_E || capinfo->px_sampling == PS_HALF_O) {
|
||||
capinfo->capture_line = capture_line_default_half_4bpp;
|
||||
} else {
|
||||
capinfo->capture_line = capture_line_default_4bpp;
|
||||
}
|
||||
switch (capinfo->px_sampling) {
|
||||
case PS_INBAND:
|
||||
case PS_INBAND_E:
|
||||
case PS_INBAND_O:
|
||||
capinfo->capture_line = capture_line_inband_4bpp;
|
||||
break;
|
||||
case PS_NORMAL:
|
||||
capinfo->capture_line = capture_line_default_4bpp;
|
||||
break;
|
||||
case PS_NORMAL_E:
|
||||
case PS_NORMAL_O:
|
||||
capinfo->capture_line = capture_line_oddeven_4bpp;
|
||||
break;
|
||||
case PS_HALF_E:
|
||||
case PS_HALF_O:
|
||||
capinfo->capture_line = capture_line_half_4bpp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,12 +4,15 @@
|
|||
|
||||
|
||||
static const char *px_sampling_names[] = {
|
||||
"Normal+Data",
|
||||
"Even+Data",
|
||||
"Odd+Data",
|
||||
"Normal",
|
||||
"Double Even",
|
||||
"Double Odd",
|
||||
"Even",
|
||||
"Odd",
|
||||
"Half Even",
|
||||
"Half Odd",
|
||||
};
|
||||
};
|
||||
|
||||
static param_t params[] = {
|
||||
{ H_OFFSET, "H offset", 0, 59, 1 },
|
||||
|
@ -20,7 +23,7 @@ static param_t params[] = {
|
|||
{ FB_HEIGHT, "FB height", 180, 600, 1 },
|
||||
{ FB_BPP, "Bits/pixel", 4, 8, 4 },
|
||||
{ CLOCK, "Clock freq", 75000000, 100000000, 1 },
|
||||
{ LINE_LEN, "Line length", 1000, 9999, 1 },
|
||||
{ LINE_LEN, "Line len", 1000, 9999, 1 },
|
||||
{ CLOCK_PPM, "Tolerance", 0, 100000, 1 },
|
||||
{ PX_SAMPLING, "Sampling", 0, NUM_PS-1, 1 },
|
||||
{ -1, NULL, 0, 0, 0 }
|
||||
|
@ -76,7 +79,7 @@ void geometry_init(int version) {
|
|||
mode7_geometry.clock = 96000000;
|
||||
mode7_geometry.line_len = 96 * 64;
|
||||
mode7_geometry.clock_ppm = 5000;
|
||||
mode7_geometry.px_sampling = PS_NORMAL;
|
||||
mode7_geometry.px_sampling = PS_INBAND;
|
||||
default_geometry.h_offset = 32;
|
||||
default_geometry.v_offset = 21;
|
||||
default_geometry.h_width = 672 / (32 / 4);
|
||||
|
@ -87,7 +90,7 @@ void geometry_init(int version) {
|
|||
default_geometry.clock = 96000000;
|
||||
default_geometry.line_len = 96 * 64;
|
||||
default_geometry.clock_ppm = 5000;
|
||||
default_geometry.px_sampling = PS_NORMAL;
|
||||
default_geometry.px_sampling = PS_INBAND;
|
||||
// For backwards compatibility with CPLDv1
|
||||
int supports_delay = (((version >> VERSION_DESIGN_BIT) & 0x0F) == 0) &&
|
||||
(((version >> VERSION_MAJOR_BIT ) & 0x0F) >= 2);
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
#include "cpld.h"
|
||||
|
||||
enum {
|
||||
PS_INBAND, // Each sampled pixel is mapped to one pixel in the frame buffer + In band data
|
||||
PS_INBAND_E, // Even pixels are replicated, odd pixels are ignored + In band data
|
||||
PS_INBAND_O, // Odd pixels are replicated, even pixels are ignored + In band data
|
||||
PS_NORMAL, // Each sampled pixel is mapped to one pixel in the frame buffer
|
||||
PS_SUBSAMP_E, // Even pixels are replicated, odd pixels are ignored
|
||||
PS_SUBSAMP_O, // Odd pixels are replicated, even pixels are ignored
|
||||
PS_HALF_E, // Even pixels are replicated, odd pixels are ignored
|
||||
PS_HALF_O, // Odd pixels are replicated, even pixels are ignored
|
||||
PS_NORMAL_E, // Even pixels are replicated, odd pixels are ignored
|
||||
PS_NORMAL_O, // Odd pixels are replicated, even pixels are ignored
|
||||
PS_HALF_E, // Even pixels are used, odd pixels are ignored
|
||||
PS_HALF_O, // Odd pixels are used, even pixels are ignored
|
||||
NUM_PS
|
||||
};
|
||||
|
||||
|
|
49
src/macros.S
49
src/macros.S
|
@ -178,13 +178,13 @@ wait\@:
|
|||
|
||||
tst r3, #BIT_EVEN_SAMPLES
|
||||
ldrne r9, =0x00070007
|
||||
bicne r10, r10, r9
|
||||
orrne r10, r10, r10, lsr #8
|
||||
bicne r5, r5, r9
|
||||
orrne r5, r5, r5, lsr #8
|
||||
|
||||
tst r3, #BIT_ODD_SAMPLES
|
||||
ldrne r9, =0x07000700
|
||||
bicne r10, r10, r9
|
||||
orrne r10, r10, r10, lsl #8
|
||||
bicne r5, r5, r9
|
||||
orrne r5, r5, r5, lsl #8
|
||||
|
||||
mov r6, r6, lsl #8 // mode 0 sentinel
|
||||
mov r7, r7, lsl #2 // mode 0-6 sentinel
|
||||
|
@ -254,11 +254,24 @@ wait\@:
|
|||
orrne r10, r10, r10, lsr #16
|
||||
.endm
|
||||
|
||||
.macro WRITE_WORD_FAST
|
||||
eor r10, r10, r7 //eor in vsync and debug
|
||||
str r10, [r0]
|
||||
// Line double always in Modes 0-6 regardless of interlace
|
||||
// On the multi core Pi this introduces stalling artefacts
|
||||
#ifndef HAS_MULTICORE
|
||||
tst r3, #BIT_SCANLINES
|
||||
movne r10, #0
|
||||
tst r3, #BITDUP_NO_LINE_DOUBLE
|
||||
streq r10, [r0, r2]
|
||||
#endif
|
||||
add r0, r0, #4
|
||||
.endm
|
||||
|
||||
.macro WRITE_WORD
|
||||
tst r3, #BIT_VSYNC_MARKER
|
||||
// eor in the VSync indicator (orr doesn't work on zx80/81 due to white screen)
|
||||
ldrne r8, =0x11111111
|
||||
eorne r10, r10, r8
|
||||
ldrne r8, =0x11111111
|
||||
eorne r10, r10, r8 // eor in the VSync indicator (orr doesn't work on zx80/81 due to white screen)
|
||||
tst r3, #BIT_DEBUG
|
||||
eorne r10, r10, #0x50 //magenta in leftmost
|
||||
eorne r10, r10, #0x02000000 //green in rightmost
|
||||
|
@ -268,12 +281,12 @@ wait\@:
|
|||
#ifndef HAS_MULTICORE
|
||||
tst r3, #BIT_SCANLINES
|
||||
movne r10, #0
|
||||
tst r3, #BITDUP_NO_LINE_DOUBLE
|
||||
tst r3, #BITDUP_NO_LINE_DOUBLE
|
||||
streq r10, [r0, r2]
|
||||
#endif
|
||||
add r0, r0, #4
|
||||
.endm
|
||||
|
||||
.endm
|
||||
|
||||
.macro WRITE_WORDS_8BPP
|
||||
and r8, r3, #MASKDUP_PALETTE_HIGH_NIBBLE
|
||||
mov r8, r8, lsr #(OFFSETDUP_PALETTE_HIGH_NIBBLE - 4)
|
||||
|
@ -282,9 +295,8 @@ wait\@:
|
|||
orr r9, r9, r8
|
||||
orr r10, r10, r8
|
||||
tst r3, #BIT_VSYNC_MARKER
|
||||
// eor in the VSync indicator (orr doesn't work on zx80/81 due to white screen)
|
||||
ldrne r8, =0x01010101
|
||||
eorne r9, r9, r8
|
||||
eorne r9, r9, r8 // eor in the VSync indicator (orr doesn't work on zx80/81 due to white screen)
|
||||
eorne r10, r10, r8
|
||||
tst r3, #BIT_DEBUG
|
||||
eorne r9, r9, #0x05 //magenta in leftmost
|
||||
|
@ -302,5 +314,14 @@ wait\@:
|
|||
subs r0, r0, r2
|
||||
#endif
|
||||
add r0, r0, #8
|
||||
.endm
|
||||
|
||||
.endm
|
||||
|
||||
.macro SETUP_DUMMY_PARAMETERS
|
||||
ldr r0, =(dummyscreen + 1024) //in case data written backwards
|
||||
mov r1, #1
|
||||
mov r2, #0
|
||||
orr r3, r3, #BIT_VSYNC_MARKER // ensure that constants are in data cache
|
||||
orr r3, r3, #BIT_EVEN_SAMPLES
|
||||
orr r3, r3, #BIT_ODD_SAMPLES
|
||||
mov r5, #(DUPLICATE_HEIGHT * 2)
|
||||
.endm
|
|
@ -47,7 +47,6 @@ typedef enum {
|
|||
|
||||
static const char *palette_names[] = {
|
||||
"Default",
|
||||
"Default (No In Band)",
|
||||
"Inverse",
|
||||
"Mono 1",
|
||||
"Mono 2",
|
||||
|
@ -732,10 +731,6 @@ static uint32_t palette_data[256];
|
|||
void osd_update_palette() {
|
||||
int m;
|
||||
int num_colours = (capinfo->bpp == 8) ? 256 : 16;
|
||||
if (palette == 0)
|
||||
paletteFlags |= BIT_IN_BAND_ENABLE;
|
||||
else
|
||||
paletteFlags &= ~BIT_IN_BAND_ENABLE;
|
||||
|
||||
for (int i = 0; i < num_colours; i++) {
|
||||
int r = (i & 1) ? 255 : 0;
|
||||
|
|
|
@ -25,7 +25,6 @@ enum {
|
|||
|
||||
enum {
|
||||
PALETTE_DEFAULT,
|
||||
PALETTE_DEFAULTNOINBAND,
|
||||
PALETTE_INVERSE,
|
||||
PALETTE_MONO1,
|
||||
PALETTE_MONO2,
|
||||
|
|
|
@ -21,13 +21,21 @@ extern int capture_line_atom_4bpp();
|
|||
|
||||
extern int capture_line_atom_8bpp();
|
||||
|
||||
extern int capture_line_inband_4bpp();
|
||||
|
||||
extern int capture_line_inband_8bpp();
|
||||
|
||||
extern int capture_line_default_4bpp();
|
||||
|
||||
extern int capture_line_default_8bpp();
|
||||
|
||||
extern int capture_line_default_half_4bpp();
|
||||
extern int capture_line_oddeven_4bpp();
|
||||
|
||||
extern int capture_line_default_half_8bpp();
|
||||
extern int capture_line_oddeven_8bpp();
|
||||
|
||||
extern int capture_line_half_4bpp();
|
||||
|
||||
extern int capture_line_half_8bpp();
|
||||
|
||||
extern int capture_line_mode7_4bpp();
|
||||
|
||||
|
|
|
@ -1355,10 +1355,10 @@ void rgb_to_hdmi_main() {
|
|||
flags |= BIT_OSD;
|
||||
}
|
||||
|
||||
if (!mode7 && (capinfo->px_sampling == PS_SUBSAMP_E || capinfo->px_sampling == PS_HALF_E)) {
|
||||
if (!mode7 && (capinfo->px_sampling == PS_INBAND_E || capinfo->px_sampling == PS_NORMAL_E || capinfo->px_sampling == PS_HALF_E)) {
|
||||
flags |= BIT_EVEN_SAMPLES;
|
||||
}
|
||||
if (!mode7 && (capinfo->px_sampling == PS_SUBSAMP_O || capinfo->px_sampling == PS_HALF_O)) {
|
||||
if (!mode7 && (capinfo->px_sampling == PS_INBAND_O || capinfo->px_sampling == PS_NORMAL_O || capinfo->px_sampling == PS_HALF_O)) {
|
||||
flags |= BIT_ODD_SAMPLES;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue