Pi Firmware: Added cpld_atom specific line capture (4bpp and 8bpp)

Change-Id: I2cd1a929231bdcad063c5e9db39e36642777a009
pull/11/head
David Banks 2018-11-27 16:03:34 +00:00
rodzic a40367459c
commit 0af1234a65
8 zmienionych plików z 176 dodań i 2 usunięć

Wyświetl plik

@ -64,6 +64,8 @@ file( GLOB core_files
rgb_to_fb.S
capture_line_default_4bpp.S
capture_line_default_8bpp.S
capture_line_atom_4bpp.S
capture_line_atom_8bpp.S
capture_line_mode7_4bpp.S
defs.h
arm-exception.c

Wyświetl plik

@ -0,0 +1,70 @@
#include "rpi-base.h"
#include "defs.h"
#include "macros.S"
.text
.global capture_line_atom_4bpp
// 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)
capture_line_atom_4bpp:
push {lr}
mov r12, r0 // pointer to the line in the frame buffer
mov r6, r1 // number of 8-bit characters per line
loop:
WAIT_FOR_PSYNC_10 // expects GPLEV0 in r4, result in r8
// Pixel 0 in GPIO 4..2 -> 2..0
// Pixel 1 in GPIO 8..6 -> 10..8
and r10, r8, #(7 << PIXEL_BASE)
and r9, r8, #(7 << (PIXEL_BASE + 4))
mov r10, r10, lsr #(PIXEL_BASE)
orr r10, r10, r9, lsl #(8 - (4 + PIXEL_BASE))
WAIT_FOR_PSYNC_01 // expects GPLEV0 in r4, result in r8
// Pixel 0 in GPIO 4..2 -> 18..16
// Pixel 1 in GPIO 8..6 -> 26..24
and r9, r8, #(7 << PIXEL_BASE)
and r14, r8, #(7 << (PIXEL_BASE + 4))
orr r10, r10, r9, lsl #(16 - PIXEL_BASE)
orr r10, r10, r14, lsl #(24 - (PIXEL_BASE + 4))
// Now pixel double
orr r10, r10, r10, lsl #4
// Orr in the VSync indicator
ldr r8, =0x11111111
tst r3, #BIT_VSYNC_MARKER
orrne r10, r10, r8
// 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 r0, #0
moveq r0, r10
str r0, [r12, r2]
#endif
str r10, [r12], #4
subs r6, r6, #1
bne loop
pop {pc}

Wyświetl plik

@ -0,0 +1,81 @@
#include "rpi-base.h"
#include "defs.h"
#include "macros.S"
.text
.global capture_line_atom_8bpp
.macro CAPTURE_BITS
// Pixel 0 in GPIO 5.. 2 -> 15.. 8 and 7.. 0
// Pixel 1 in GPIO 9.. 6 -> 31..24 and 23..16
and r10, r8, #(15 << PIXEL_BASE)
and r9, r8, #(15 << (PIXEL_BASE + 4))
mov r10, r10, lsr #(PIXEL_BASE)
orr r10, r10, r9, lsl #(16 - (PIXEL_BASE + 4))
orr r10, r10, r10, lsl #8
.endm
// 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)
capture_line_atom_8bpp:
push {lr}
mov r12, r0 // pointer to the line in the frame buffer
mov r6, r1 // number of 8-bit characters per line
loop:
WAIT_FOR_PSYNC_10
CAPTURE_BITS
// Orr in the VSync indicator
ldr r8, =0x01010101
tst r3, #BIT_VSYNC_MARKER
orrne r10, r10, r8
// 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 r0, #0
moveq r0, r10
str r0, [r12, r2]
#endif
str r10, [r12], #4
WAIT_FOR_PSYNC_01
CAPTURE_BITS
// Orr in the VSync indicator
ldr r8, =0x01010101
tst r3, #BIT_VSYNC_MARKER
orrne r10, r10, r8
// 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 r0, #0
moveq r0, r10
str r0, [r12, r2]
#endif
str r10, [r12], #4
subs r6, r6, #1
bne loop
exit:
pop {pc}

Wyświetl plik

@ -7,6 +7,7 @@
#include "cpld.h"
#include "osd.h"
#include "logging.h"
#include "rgb_to_fb.h"
#include "rpi-gpio.h"
#define RANGE 16
@ -173,6 +174,13 @@ static void cpld_calibrate(capture_info_t *capinfo, int elk) {
static void cpld_set_mode(capture_info_t *capinfo, int mode) {
write_config(config);
if (capinfo) {
if (capinfo->bpp == 8) {
capinfo->capture_line = capture_line_atom_8bpp;
} else {
capinfo->capture_line = capture_line_atom_4bpp;
}
}
}
static param_t *cpld_get_params() {

Wyświetl plik

@ -53,7 +53,8 @@ static const char *palette_names[] = {
"Just Blue",
"Not Red",
"Not Green",
"Not Blue"
"Not Blue",
"Atom"
};
static const char *pllh_names[] = {
@ -741,6 +742,12 @@ void osd_update_palette() {
g = (i & 3) * 255 / 3;
b = 0;
break;
case PALETTE_ATOM:
// In the Atom CPLD, colour bit 3 indicates a half green
if (i & 8) {
g >>= 1;
}
break;
}
if (active) {
if (i >= (num_colours >> 1)) {

Wyświetl plik

@ -30,6 +30,7 @@ enum {
PALETTE_NOT_RED,
PALETTE_NOT_GREEN,
PALETTE_NOT_BLUE,
PALETTE_ATOM,
NUM_PALETTES
};

Wyświetl plik

@ -15,6 +15,10 @@ extern int sw2counter;
extern int sw3counter;
extern int capture_line_atom_4bpp();
extern int capture_line_atom_8bpp();
extern int capture_line_default_4bpp();
extern int capture_line_default_8bpp();

Wyświetl plik

@ -102,6 +102,7 @@
# - 7 is Not Red
# - 8 is Not Green
# - 9 is Not Blue
# - 10 is Atom
#
# deinterlace: algorithm used for mode 7 deinterlacing
# - 0 is None
@ -189,7 +190,7 @@ sampling06=3 sampling7=0,2,2,2,2,2,2,0,8,5 info=1 palette=0 deinterlace=5 scanli
#sampling06=0,5,5,5,5,5,5,0 geometry06=24,16,76,240,608,480,4,85909091,5472,524 nbuffers=2 m7disable=1
#
# Here's an example that might work with an Atom (Atom CPLD)
#sampling06=2 geometry06=19,11,76,240,608,480,4,57272720,3648,524 nbuffers=2 m7disable=1 keymap=1233232
#sampling06=0 geometry06=19,11,76,240,608,480,8,57272720,3648,524 palette=10 nbuffers=2 m7disable=1 keymap=1233232
#
# Here's an example that might work with a ZX80/ZX81
#sampling06=0,4,4,4,4,4,4,0 geometry06=9,18,84,270,672,540,4,78000000,4968,620 nbuffers=2 m7disable=1 keymap=1323232 return=0