Fix inverse video & support 512x342 w/o psram
This commit is contained in:
parent
5e5deca4e2
commit
cd3bb34482
3 changed files with 21 additions and 16 deletions
|
|
@ -11,14 +11,14 @@ DISP_WIDTH=512
|
|||
DISP_HEIGHT=342
|
||||
MEMSIZE=400
|
||||
DISK_IMAGE=""
|
||||
CMAKE_ARGS=
|
||||
CMAKE_ARGS=""
|
||||
|
||||
while getopts "hvd:m:" o; do
|
||||
case "$o" in
|
||||
(v)
|
||||
DISP_WIDTH=640
|
||||
DISP_HEIGHT=480
|
||||
CMAKE_ARGS="$CMAKE_ARGS -DUSE_VGA_RES=1 -DHSTX_CKP=12 -DHSTX_D0P=14 -DHSTX_D1P=16 -DHSTX_D2P=18"
|
||||
CMAKE_ARGS="-DUSE_VGA_RES=1"
|
||||
;;
|
||||
(m)
|
||||
MEMSIZE=$OPTARG
|
||||
|
|
@ -42,12 +42,17 @@ done
|
|||
shift $((OPTIND-1))
|
||||
|
||||
TAG=fruitjam_${DISP_WIDTH}x${DISP_HEIGHT}_${MEMSIZE}k
|
||||
PSRAM=$((MEMSIZE > 448 || DISP_WIDTH < 640))
|
||||
PSRAM=$((MEMSIZE > 400))
|
||||
if [ $PSRAM -ne 0 ] ; then
|
||||
TAG=${TAG}_psram
|
||||
CMAKE_ARGS="$CMAKE_ARGS -DUSE_PSRAM=1"
|
||||
fi
|
||||
|
||||
MIRROR_FRAMEBUFFER=$((USE_PSRAM || DISP_WIDTH != 640))
|
||||
if [ "$MIRROR_FRAMEBUFFER" -eq 0 ]; then
|
||||
CMAKE_ARGS="$CMAKE_ARGS -DHSTX_CKP=12 -DHSTX_D0P=14 -DHSTX_D1P=16 -DHSTX_D2P=18 "
|
||||
fi
|
||||
|
||||
# Append disk name to build directory if disk image is specified
|
||||
if [ -n "$DISK_IMAGE" ] && [ -f "$DISK_IMAGE" ]; then
|
||||
# Extract filename without extension
|
||||
|
|
@ -74,5 +79,6 @@ cmake -S . -B build_${TAG} \
|
|||
-DUSE_HSTX=1 \
|
||||
-DSD_TX=35 -DSD_RX=36 -DSD_SCK=34 -DSD_CS=39 -DUSE_SD=1 \
|
||||
-DUART_TX=44 -DUART_RX=45 -DUART=0 \
|
||||
-DBOARD_FILE=boards/adafruit_fruit_jam.c \
|
||||
${CMAKE_ARGS} "$@"
|
||||
make -C build_${TAG} -j$(nproc)
|
||||
|
|
|
|||
21
src/main.c
21
src/main.c
|
|
@ -82,12 +82,16 @@ static const uint8_t umac_rom[] = {
|
|||
};
|
||||
|
||||
#if USE_PSRAM
|
||||
static uint32_t umac_framebuffer_mirror[640*480/32];
|
||||
#define umac_ram ((uint8_t*)0x11000000)
|
||||
#else
|
||||
static uint8_t umac_ram[RAM_SIZE];
|
||||
#endif
|
||||
|
||||
#define MIRROR_FRAMEBUFFER (USE_PSRAM || DISP_WIDTH != 640)
|
||||
#if MIRROR_FRAMEBUFFER
|
||||
static uint32_t umac_framebuffer_mirror[640*480/32];
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void io_init()
|
||||
|
|
@ -115,13 +119,13 @@ static int umac_cursor_y = 0;
|
|||
static int umac_cursor_button = 0;
|
||||
|
||||
#define umac_get_audio_offset() (RAM_SIZE - 768)
|
||||
#if USE_PSRAM
|
||||
#if MIRROR_FRAMEBUFFER
|
||||
static void copy_framebuffer() {
|
||||
uint32_t *src = (uint32_t*)(umac_ram + umac_get_fb_offset());
|
||||
#if DISP_WIDTH==640 && DISP_HEIGHT==480
|
||||
uint32_t *dest = umac_framebuffer_mirror;
|
||||
for(int i=0; i<640*480/32; i++) {
|
||||
*dest++ = *src++ ^ 0xfffffffful;
|
||||
*dest++ = *src++;
|
||||
}
|
||||
#elif DISP_WIDTH==512 && DISP_HEIGHT==342
|
||||
#define DISP_XOFFSET ((640 - DISP_WIDTH) / 32 / 2)
|
||||
|
|
@ -131,7 +135,7 @@ static void copy_framebuffer() {
|
|||
for(int i=0; i<DISP_HEIGHT; i++) {
|
||||
uint32_t *dest = umac_framebuffer_mirror + (DISP_YOFFSET * LONGS_PER_OUTPUT_ROW + DISP_XOFFSET) + LONGS_PER_OUTPUT_ROW * i;
|
||||
for(int j=0; j<LONGS_PER_INPUT_ROW; j++) {
|
||||
*dest++ = *src++ ^ 0xfffffffful;
|
||||
*dest++ = *src++ ^ 0xffffffff;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
@ -155,7 +159,7 @@ static void poll_umac()
|
|||
pending_vsync |= audio_poll();
|
||||
#endif
|
||||
if (pending_vsync) {
|
||||
#if USE_PSRAM
|
||||
#if MIRROR_FRAMEBUFFER
|
||||
copy_framebuffer();
|
||||
#endif
|
||||
/* FIXME: Trigger this off actual vsync */
|
||||
|
|
@ -301,14 +305,13 @@ static void core1_main()
|
|||
printf("Core 1 started\n");
|
||||
disc_setup(discs);
|
||||
|
||||
#if USE_PSRAM
|
||||
umac_init(umac_ram, (void *)umac_rom, discs);
|
||||
video_init((uint32_t *)(umac_framebuffer_mirror));
|
||||
#else
|
||||
umac_init(umac_ram, (void *)umac_rom, discs);
|
||||
/* Video runs on core 1, i.e. IRQs/DMA are unaffected by
|
||||
* core 0's USB activity.
|
||||
*/
|
||||
#if MIRROR_FRAMEBUFFER
|
||||
video_init((uint32_t *)(umac_framebuffer_mirror));
|
||||
#else
|
||||
video_init((uint32_t *)(umac_ram + umac_get_fb_offset()));
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -141,10 +141,6 @@ static void __not_in_flash_func(dma_irq_handler)(void) {
|
|||
ch->al3_read_addr_trig = (uintptr_t)active_picodvi->dma_commands;
|
||||
}
|
||||
|
||||
#if (DISP_WIDTH != 640 || DISP_HEIGHT != 480) && !USE_PSRAM
|
||||
#error Only VGA resolution is supported without PSRAM
|
||||
#endif
|
||||
|
||||
#define REAL_DISP_WIDTH 640
|
||||
#define REAL_DISP_HEIGHT 480
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue