vga: delete

This is replaced with the (slightly cleaner) holly/video_output.
This commit is contained in:
Zack Buhman 2024-03-08 20:46:55 +08:00
parent db323c85c5
commit c0e10fe8f1
43 changed files with 248 additions and 374 deletions

View File

@ -15,7 +15,7 @@ namespace vreg {
namespace pdtra {
namespace cable_type {
constexpr uint32_t vga = 0b00 << 8;
constexpr uint32_t rbg = 0b10 << 8;
constexpr uint32_t rgb = 0b10 << 8;
constexpr uint32_t cvbs_yc = 0b11 << 8;
constexpr uint32_t bit_mask = 0x3 << 8;

View File

@ -3,7 +3,7 @@
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
#include "holly/core_bits.hpp"
@ -240,7 +240,7 @@ void main()
uint32_t * command_buf = align_32byte(_command_buf);
uint32_t * receive_buf = align_32byte(_receive_buf);
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -3,7 +3,7 @@
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
#include "holly/core_bits.hpp"
@ -218,7 +218,7 @@ void main()
uint32_t * command_buf = align_32byte(_command_buf);
uint32_t * receive_buf = align_32byte(_receive_buf);
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -3,7 +3,7 @@
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
#include "holly/core_bits.hpp"
@ -257,7 +257,7 @@ void main()
uint32_t * command_buf = align_32byte(_command_buf);
uint32_t * receive_buf = align_32byte(_receive_buf);
vga();
video_output::set_mode_vga();
init_macaw_texture();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.

View File

@ -2,7 +2,7 @@
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
#include "holly/core_bits.hpp"
@ -150,7 +150,7 @@ uint32_t _ta_parameter_buf[((32 * (5 * 6 + 1)) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -186,7 +186,7 @@ void dump()
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -1,6 +1,6 @@
SPRITE_OBJ = \
example/sprite.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -11,11 +11,11 @@ example/sprite.elf: $(START_OBJ) $(SPRITE_OBJ)
MACAW_OBJ = \
example/macaw.o \
vga.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
holly/ta_fifo_polygon_converter.o \
holly/video_output.o \
macaw.data.o
example/macaw.elf: LDSCRIPT = $(LIB)/alt.lds
@ -23,7 +23,7 @@ example/macaw.elf: $(START_OBJ) $(MACAW_OBJ)
MACAW_TWIDDLE_OBJ = \
example/macaw_twiddle.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -35,7 +35,7 @@ example/macaw_twiddle.elf: $(START_OBJ) $(MACAW_TWIDDLE_OBJ)
FONT_BITMAP_OBJ = \
example/font_bitmap.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -47,7 +47,7 @@ example/font_bitmap.elf: $(START_OBJ) $(FONT_BITMAP_OBJ)
FONT_OUTLINE_OBJ = \
example/font_outline.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -59,7 +59,7 @@ example/font_outline.elf: $(START_OBJ) $(FONT_OUTLINE_OBJ)
FONT_OUTLINE_PUNCH_THROUGH_OBJ = \
example/font_outline_punch_through.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -71,7 +71,7 @@ example/font_outline_punch_through.elf: $(START_OBJ) $(FONT_OUTLINE_PUNCH_THROUG
MACAW_MULTIPASS_OBJ = \
example/macaw_multipass.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -83,7 +83,7 @@ example/macaw_multipass.elf: $(START_OBJ) $(MACAW_MULTIPASS_OBJ)
TRANSLUCENCY_OBJ = \
example/translucency.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -95,7 +95,7 @@ example/translucency.elf: $(START_OBJ) $(TRANSLUCENCY_OBJ)
CUBE_OBJ = \
example/cube.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -106,7 +106,7 @@ example/cube.elf: $(START_OBJ) $(CUBE_OBJ)
ICOSPHERE_OBJ = \
example/icosphere.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -117,7 +117,7 @@ example/icosphere.elf: $(START_OBJ) $(ICOSPHERE_OBJ)
SUZANNE_PROFILE_OBJ = \
example/suzanne_profile.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -131,7 +131,7 @@ example/suzanne_profile.elf: $(START_OBJ) $(SUZANNE_PROFILE_OBJ)
WIFFLE_ATTENUATION_OBJ = \
example/wiffle_attenuation.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -142,7 +142,7 @@ example/wiffle_attenuation.elf: $(START_OBJ) $(WIFFLE_ATTENUATION_OBJ)
MODIFIER_VOLUME_OBJ = \
example/modifier_volume.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -153,7 +153,7 @@ example/modifier_volume.elf: $(START_OBJ) $(MODIFIER_VOLUME_OBJ)
MODIFIER_VOLUME_WITH_TWO_VOLUMES_OBJ = \
example/modifier_volume_with_two_volumes.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -168,7 +168,7 @@ example/modifier_volume_with_two_volumes.elf: $(START_OBJ) $(MODIFIER_VOLUME_WIT
HEART_OBJ = \
example/heart.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -179,7 +179,7 @@ example/heart.elf: $(START_OBJ) $(HEART_OBJ)
VIEWING_SYSTEM_OBJ = \
example/viewing_system.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -191,7 +191,7 @@ example/viewing_system.elf: $(START_OBJ) $(VIEWING_SYSTEM_OBJ)
MACAW_CUBE_OBJ = \
example/macaw_cube.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -203,7 +203,7 @@ example/macaw_cube.elf: $(START_OBJ) $(MACAW_CUBE_OBJ)
MACAW_CUBE_RENDER_TO_TEXTURE_OBJ = \
example/macaw_cube_render_to_texture.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -215,7 +215,7 @@ example/macaw_cube_render_to_texture.elf: $(START_OBJ) $(MACAW_CUBE_RENDER_TO_TE
CLIPPING_OBJ = \
example/clipping.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -227,7 +227,7 @@ example/clipping.elf: $(START_OBJ) $(CLIPPING_OBJ)
CLIPPING2_OBJ = \
example/clipping2.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -241,7 +241,7 @@ example/clipping2.elf: $(START_OBJ) $(CLIPPING2_OBJ)
CLIPPING_TEXTURED_OBJ = \
example/clipping_textured.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -256,7 +256,7 @@ example/clipping_textured.elf: $(START_OBJ) $(CLIPPING_TEXTURED_OBJ)
MAPLE_DEVICE_REQUEST_OBJ = \
example/maple_device_request.o \
vga.o \
holly/video_output.o \
sh7091/serial.o \
maple/maple.o
@ -265,7 +265,7 @@ example/maple_device_request.elf: $(START_OBJ) $(MAPLE_DEVICE_REQUEST_OBJ)
MAPLE_CONTROLLER_OBJ = \
example/maple_controller.o \
vga.o \
holly/video_output.o \
sh7091/serial.o \
maple/maple.o
@ -274,7 +274,7 @@ example/maple_controller.elf: $(START_OBJ) $(MAPLE_CONTROLLER_OBJ)
MAPLE_WINK_OBJ = \
example/maple_wink.o \
vga.o \
holly/video_output.o \
rgb.o \
sh7091/serial.o \
maple/maple.o \
@ -285,7 +285,7 @@ example/maple_wink.elf: $(START_OBJ) $(MAPLE_WINK_OBJ)
MAPLE_VIBRATOR_OBJ = \
example/maple_vibrator.o \
vga.o \
holly/video_output.o \
rgb.o \
sh7091/serial.o \
maple/maple.o
@ -295,7 +295,7 @@ example/maple_vibrator.elf: $(START_OBJ) $(MAPLE_VIBRATOR_OBJ)
MAPLE_ANALOG_OBJ = \
example/maple_analog.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -322,7 +322,7 @@ example/interrupt.elf: $(START_OBJ) $(INTERRUPT_OBJ)
DUMP_OBJECT_LIST_OBJ = \
example/dump_object_list.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \
@ -341,7 +341,7 @@ example/dump_ram.elf: $(START_OBJ) $(DUMP_RAM_OBJ)
SOFTWARE_TA_OBJ = \
example/software_ta.o \
vga.o \
holly/video_output.o \
holly/core.o \
holly/region_array.o \
holly/background.o \

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -227,7 +227,7 @@ uint32_t _ta_parameter_buf[((32 * 10 * 17) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
auto src = reinterpret_cast<const uint8_t *>(&_binary_sperrypc_8x8_data_start);
inflate_font(src);

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -212,7 +212,7 @@ uint32_t _ta_parameter_buf[((32 * 10 * 17) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
auto font = reinterpret_cast<const struct font *>(&_binary_dejavusansmono_data_start);
auto glyphs = reinterpret_cast<const struct glyph *>(&font[1]);

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -216,7 +216,7 @@ uint32_t _ta_parameter_buf[((32 * 10 * 17) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
auto font = reinterpret_cast<const struct font *>(&_binary_dejavusansmono_mono_data_start);
auto glyphs = reinterpret_cast<const struct glyph *>(&font[1]);

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -247,7 +247,7 @@ uint32_t _ta_parameter_buf[((32 * 8192) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
@ -235,7 +235,7 @@ uint32_t _ta_parameter_buf[((32 * 8192) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -1,7 +1,6 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -15,6 +14,7 @@
#include "holly/isp_tsp.hpp"
#include "holly/region_array.hpp"
#include "holly/background.hpp"
#include "holly/video_output.hpp"
#include "memorymap.hpp"
#include "macaw.hpp"
@ -137,7 +137,7 @@ uint32_t _ta_parameter_buf[((32 * (strip_length + 2)) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
copy_macaw_texture();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -167,7 +167,7 @@ uint32_t _ta_parameter_buf[((32 * (5 * 6 + 1)) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
copy_macaw_texture();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -230,7 +230,7 @@ uint32_t _ta_parameter_buf[((32 * (5 * 6 + 1)) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
copy_macaw_texture();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly.hpp"
@ -100,7 +100,7 @@ uint32_t _ta_parameter_buf[((32 * (strip_length + 2)) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
auto src = reinterpret_cast<const uint8_t *>(&_binary_macaw_data_start);
auto size = reinterpret_cast<const uint32_t>(&_binary_macaw_data_size);

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -141,7 +141,7 @@ uint32_t _ta_parameter_buf[((32 * (strip_length + 2)) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
init_macaw_texture();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.

View File

@ -3,7 +3,7 @@
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
#include "holly/core_bits.hpp"
@ -164,7 +164,7 @@ void main()
uint32_t * command_buf = align_32byte(_command_buf);
uint32_t * receive_buf = align_32byte(_receive_buf);
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -1,6 +1,6 @@
#include <bit>
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "align.hpp"
#include "maple/maple.hpp"
@ -107,7 +107,7 @@ void main()
// flycast needs this in HLE mode, or else it won't start the vcount
// counter.
vga();
video_output::set_mode_vga();
while (1) {
v_sync_in();

View File

@ -1,6 +1,6 @@
#include <bit>
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "align.hpp"
#include "maple/maple.hpp"
@ -184,7 +184,7 @@ void main()
command_buf = reinterpret_cast<uint32_t *>(reinterpret_cast<uint32_t>(command_buf) | 0xa000'0000);
receive_buf = align_32byte(_receive_buf);
vga();
video_output::set_mode_vga();
while (1) {
for (int i = 0; i < 120; i++) {

View File

@ -3,7 +3,6 @@
#include "maple/maple.hpp"
#include "maple/maple_bus_commands.hpp"
#include "maple/maple_bus_bits.hpp"
#include "vga.hpp"
#include "align.hpp"
#include "sh7091/serial.hpp"
@ -58,8 +57,5 @@ void main()
serial::integer<uint8_t>(host_response->bus_data.source_ap);
serial::integer<uint8_t>(host_response->bus_data.data_size);
vga();
v_sync_in();
vga_fill_framebuffer();
while(1);
}

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly.hpp"
@ -184,7 +184,7 @@ uint32_t _ta_parameter_buf[((32 * 8192) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -2,7 +2,7 @@
#include <bit>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -348,7 +348,7 @@ uint32_t _receive_buf[(1024 + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
auto src0 = reinterpret_cast<const uint8_t *>(&_binary_macaw_data_start);
auto size0 = reinterpret_cast<const uint32_t>(&_binary_macaw_data_size);

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
@ -154,7 +154,7 @@ constexpr software_ta::point rotate(const software_ta::point& p, const float the
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -2,7 +2,7 @@
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly.hpp"
#include "holly/core.hpp"
#include "holly/core_bits.hpp"
@ -71,7 +71,7 @@ uint32_t _ta_parameter_buf[((32 + 64 + 32) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
@ -148,7 +148,7 @@ uint32_t _ta_parameter_buf[((32 * (strip_length + 2)) * 2 + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
auto src = reinterpret_cast<const uint8_t *>(&_binary_macaw_data_start);
auto size = reinterpret_cast<const uint32_t>(&_binary_macaw_data_size);

View File

@ -2,7 +2,7 @@
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/texture_memory_alloc.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
@ -118,7 +118,7 @@ void init_texture_memory(const struct opb_size& opb_size)
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -1,7 +1,7 @@
#include <cstdint>
#include "align.hpp"
#include "vga.hpp"
#include "holly/video_output.hpp"
#include "holly/holly.hpp"
#include "holly/core.hpp"
@ -246,7 +246,7 @@ uint32_t _ta_parameter_buf[((32 * 8192) + 32) / 4];
void main()
{
vga();
video_output::set_mode_vga();
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
// This is mandatory for ch2-dma to the ta fifo polygon converter.

View File

@ -36,7 +36,7 @@ holly/ta_vertex_parameter.hpp: regs/vertex_parameter_format.csv regs/gen/ta_para
holly/object_list_data.hpp: regs/object_list.csv regs/gen/core_bits.py
python regs/gen/core_bits.py $< object_list_data > $@
holly/video_output_mode.cpp: regs/video_output.csv regs/gen/video_output.py
holly/video_output_mode.inc: regs/video_output.csv regs/gen/video_output.py
python regs/gen/video_output.py $< > $@
# MAPLE

View File

@ -52,7 +52,7 @@ void core_init()
}
void core_start_render(uint32_t frame_address,
uint32_t frame_linestride, // in pixels
uint32_t frame_width, // in pixels
uint32_t frame_size, // in bytes
uint32_t frame_ix, uint32_t num_frames)
{
@ -65,9 +65,10 @@ void core_start_render(uint32_t frame_address,
holly.ISP_BACKGND_D = _i(1.f/100000.f);
holly.FB_W_CTRL = fb_w_ctrl::fb_dither | fb_w_ctrl::fb_packmode::_565_rgb_16bit;
holly.FB_W_LINESTRIDE = (frame_linestride * 2) / 8;
constexpr uint32_t bytes_per_pixel = 2;
holly.FB_W_LINESTRIDE = (frame_width * bytes_per_pixel) / 8;
uint32_t w_fb = (frame_ix & num_frames) * frame_size;
const uint32_t w_fb = (frame_ix & num_frames) * frame_size;
holly.FB_W_SOF1 = frame_address + w_fb;
holly.STARTRENDER = 1;
@ -76,7 +77,7 @@ void core_start_render(uint32_t frame_address,
void core_start_render(uint32_t frame_ix, uint32_t num_frames)
{
core_start_render((offsetof (struct texture_memory_alloc, framebuffer)),
640, // frame_linestride
640, // frame_width
0x00096000, // frame_size
frame_ix, num_frames);
}
@ -89,10 +90,10 @@ void core_wait_end_of_render_video()
"Furthermore, it is strongly recommended that the End of ISP and End of Video interrupts
be cleared at the same time in order to make debugging easier when an error occurs."
*/
while ((system.ISTNRM & ISTNRM__END_OF_RENDER_TSP) == 0);
system.ISTNRM = ISTNRM__END_OF_RENDER_TSP
| ISTNRM__END_OF_RENDER_ISP
| ISTNRM__END_OF_RENDER_VIDEO;
while ((system.ISTNRM & istnrm::end_of_render_tsp) == 0);
system.ISTNRM = istnrm::end_of_render_tsp
| istnrm::end_of_render_isp
| istnrm::end_of_render_video;
}
void core_flip(uint32_t frame_ix, uint32_t num_frames)

View File

@ -3,7 +3,7 @@
void core_init();
void core_start_render(uint32_t frame_address,
uint32_t frame_linestride, // in pixels
uint32_t frame_width, // in pixels
uint32_t frame_size, // in bytes
uint32_t frame_ix, uint32_t num_frames);
void core_start_render(uint32_t frame_ix, uint32_t num_frames);

View File

@ -96,40 +96,40 @@ void ta_polygon_converter_transfer(volatile uint32_t * buf, uint32_t size)
sh7091.DMAC.DMAOR = dmaor::ddt::on_demand_data_transfer_mode /* on-demand data transfer mode */
| dmaor::pr::ch2_ch0_ch1_ch3 /* priority mode; CH2 > CH0 > CH1 > CH3 */
| dmaor::dme::operation_enabled_on_all_channels; /* DMAC master enable */
system.C2DSTAT = C2DSTAT__ADDRESS(0x10000000); /* CH2-DMA destination address */
system.C2DLEN = CD2LEN__LENGTH(size); /* CH2-DMA length (must be a multiple of 32) */
system.C2DSTAT = c2dstat::texture_memory_start_address(0x10000000); /* CH2-DMA destination address */
system.C2DLEN = c2dlen::transfer_length(size); /* CH2-DMA length (must be a multiple of 32) */
system.C2DST = 1; /* CH2-DMA start (an 'external' request from SH7091's perspective) */
// wait for CH2-DMA completion
while ((system.ISTNRM & ISTNRM__END_OF_DMA_CH2_DMA) == 0);
// reset CH2-DMA interrupt status
system.ISTNRM = ISTNRM__END_OF_DMA_CH2_DMA;
// wait for ch2-dma completion
while ((system.ISTNRM & istnrm::end_of_dma_ch2_dma) == 0);
// reset ch2-dma interrupt status
system.ISTNRM = istnrm::end_of_dma_ch2_dma;
}
void ta_wait_opaque_list()
{
while ((system.ISTNRM & ISTNRM__END_OF_TRANSFERRING_OPAQUE_LIST) == 0);
while ((system.ISTNRM & istnrm::end_of_transferring_opaque_list) == 0);
system.ISTNRM = ISTNRM__END_OF_TRANSFERRING_OPAQUE_LIST;
system.ISTNRM = istnrm::end_of_transferring_opaque_list;
}
void ta_wait_opaque_modifier_volume_list()
{
while ((system.ISTNRM & ISTNRM__END_OF_TRANSFERRING_OPAQUE_MODIFIER_VOLUME_LIST) == 0);
while ((system.ISTNRM & istnrm::end_of_transferring_opaque_modifier_volume_list) == 0);
system.ISTNRM = ISTNRM__END_OF_TRANSFERRING_OPAQUE_MODIFIER_VOLUME_LIST;
system.ISTNRM = istnrm::end_of_transferring_opaque_modifier_volume_list;
}
void ta_wait_translucent_list()
{
while ((system.ISTNRM & ISTNRM__END_OF_TRANSFERRING_TRANSLUCENT_LIST) == 0);
while ((system.ISTNRM & istnrm::end_of_transferring_translucent_list) == 0);
system.ISTNRM = ISTNRM__END_OF_TRANSFERRING_TRANSLUCENT_LIST;
system.ISTNRM = istnrm::end_of_transferring_translucent_list;
}
void ta_wait_punch_through_list()
{
while ((system.ISTNRM & ISTNRM__END_OF_TRANSFERRING_PUNCH_THROUGH_LIST) == 0);
while ((system.ISTNRM & istnrm::end_of_transferring_punch_through_list) == 0);
system.ISTNRM = ISTNRM__END_OF_TRANSFERRING_PUNCH_THROUGH_LIST;
system.ISTNRM = istnrm::end_of_transferring_punch_through_list;
}

View File

@ -1,11 +1,14 @@
#include <cstdint>
#include "sh7091/sh7091.hpp"
#include "sh7091/serial.hpp"
#include "aica/aica.hpp"
#include "dve.hpp"
#include "holly.hpp"
#include "holly_bits.hpp"
#include "holly/core_bits.hpp"
#include "video_output.hpp"
#include "video_output_mode.inc"
namespace video_output {
@ -61,25 +64,45 @@ uint32_t get_cable_type()
return sh7091.BSC.PDTRA & pdtra::cable_type::bit_mask;
}
void automatic()
void set_mode_automatic()
{
switch (get_cable_type()) {
default: [[fallthrough]];
case pdtra::cable_type::vga:
set_mode(vga);
set_framebuffer_resolution(640, 480);
aica.common.VREG(vreg::output_mode::vga);
aica_sound.common.VREG(vreg::output_mode::vga);
break;
case pdtra::cable_type::rgb:
set_mode(ntsc_ni);
set_framebuffer_resolution(320, 240);
aica.common.VREG(vreg::output_mode::rgb);
aica_sound.common.VREG(vreg::output_mode::rgb);
break;
case pdtra::cable_type::cvbs_yc:
set_mode(pal_ni);
set_mode(ntsc_ni);
set_framebuffer_resolution(320, 240);
aica.common.VREG(vreg::output_mode::cvbs_yc);
aica_sound.common.VREG(vreg::output_mode::cvbs_yc);
break;
}
}
void set_mode_vga()
{
set_mode(vga);
set_framebuffer_resolution(640, 480);
aica_sound.common.VREG(vreg::output_mode::vga);
}
void reset_sdram()
{
holly.SOFTRESET = softreset::sdram_if_soft_reset
| softreset::pipeline_soft_reset
| softreset::ta_soft_reset;
holly.SDRAM_CFG = 0x15D1C951;
holly.SDRAM_REFRESH = 0x00000020;
holly.SOFTRESET = 0;
}
}

View File

@ -24,4 +24,11 @@ extern const struct mode ntsc_i;
extern const struct mode pal_ni;
extern const struct mode pal_i;
void set_framebuffer_resolution(const uint32_t x_size, const uint32_t y_size);
void set_mode(const struct mode& mode);
uint32_t get_cable_type();
void set_mode_automatic();
void set_mode_vga();
void reset_sdram();
}

View File

@ -116,7 +116,7 @@ static inline void _dma_start(const uint32_t * command_buf)
| dmaor::dme::operation_enabled_on_all_channels; /* DMAC master enable */
// clear maple-DMA end status
system.ISTNRM = ISTNRM__END_OF_DMA_MAPLE_DMA;
system.ISTNRM = istnrm::end_of_dma_maple_dma;
// disable maple-DMA
maple_if.MDEN = mden::dma_enable::abort;
@ -169,8 +169,8 @@ void dma_start(const uint32_t * command_buf,
}
// wait for maple DMA completion
while ((system.ISTNRM & ISTNRM__END_OF_DMA_MAPLE_DMA) == 0);
system.ISTNRM = ISTNRM__END_OF_DMA_MAPLE_DMA;
while ((system.ISTNRM & istnrm::end_of_dma_maple_dma) == 0);
system.ISTNRM = istnrm::end_of_dma_maple_dma;
}
// wait for completion

View File

@ -4,7 +4,7 @@
"VREG","output_mode","1-0","cvbs_yc","0b11",,
,,,,,,
"PDTRA","cable_type","9-8","vga","0b00",,
"PDTRA","cable_type","9-8","rbg","0b10",,
"PDTRA","cable_type","9-8","rgb","0b10",,
"PDTRA","cable_type","9-8","cvbs_yc","0b11",,
,,,,,,
"PDTRA","video_mode","4-2","ntsc","0b000",,

1 register_name enum_name bits bit_name value mask description
4 VREG output_mode 1-0 cvbs_yc 0b11
5
6 PDTRA cable_type 9-8 vga 0b00
7 PDTRA cable_type 9-8 rbg rgb 0b10
8 PDTRA cable_type 9-8 cvbs_yc 0b11
9
10 PDTRA video_mode 4-2 ntsc 0b000

Binary file not shown.

View File

@ -3,59 +3,59 @@
"C2DLEN",,"23-0","transfer_length",,"0xffffe0",
"C2DST",,"0","start","1",,
,,,,,,
"ISTNRM",,"21","end_of_transferring_punch_through_list",,,
"ISTNRM",,"20","end_of_dma_sort_dma",,,
"ISTNRM",,"19","end_of_dma_ch2_dma",,,
"ISTNRM",,"18","end_of_dma_dev_dma",,,
"ISTNRM",,"17","end_of_dma_ext_dma2",,,
"ISTNRM",,"16","end_of_dma_ext_dma1",,,
"ISTNRM",,"15","end_of_dma_aica_dma",,,
"ISTNRM",,"14","end_of_dma_gd_dma",,,
"ISTNRM",,"13","maple_v_blank_over_interrupt",,,
"ISTNRM",,"12","end_of_dma_maple_dma",,,
"ISTNRM",,"11","end_of_dma_pvr_dma",,,
"ISTNRM",,"10","end_of_transferring_translucent_modifier_volume_list",,,
"ISTNRM",,"9","end_of_transferring_translucent_list",,,
"ISTNRM",,"8","end_of_transferring_opaque_modifier_volume_list",,,
"ISTNRM",,"7","end_of_transferring_opaque_list",,,
"ISTNRM",,"6","end_of_transferring_yuv",,,
"ISTNRM",,"5","h_blank_in_interrupt",,,
"ISTNRM",,"4","v_blank_out_interrupt",,,
"ISTNRM",,"3","v_blank_in_interrupt",,,
"ISTNRM",,"2","end_of_render_tsp",,,
"ISTNRM",,"1","end_of_render_isp",,,
"ISTNRM",,"0","end_of_render_video",,,
"ISTNRM",,"21","end_of_transferring_punch_through_list","1",,
"ISTNRM",,"20","end_of_dma_sort_dma","1",,
"ISTNRM",,"19","end_of_dma_ch2_dma","1",,
"ISTNRM",,"18","end_of_dma_dev_dma","1",,
"ISTNRM",,"17","end_of_dma_ext_dma2","1",,
"ISTNRM",,"16","end_of_dma_ext_dma1","1",,
"ISTNRM",,"15","end_of_dma_aica_dma","1",,
"ISTNRM",,"14","end_of_dma_gd_dma","1",,
"ISTNRM",,"13","maple_v_blank_over_interrupt","1",,
"ISTNRM",,"12","end_of_dma_maple_dma","1",,
"ISTNRM",,"11","end_of_dma_pvr_dma","1",,
"ISTNRM",,"10","end_of_transferring_translucent_modifier_volume_list","1",,
"ISTNRM",,"9","end_of_transferring_translucent_list","1",,
"ISTNRM",,"8","end_of_transferring_opaque_modifier_volume_list","1",,
"ISTNRM",,"7","end_of_transferring_opaque_list","1",,
"ISTNRM",,"6","end_of_transferring_yuv","1",,
"ISTNRM",,"5","h_blank_in_interrupt","1",,
"ISTNRM",,"4","v_blank_out_interrupt","1",,
"ISTNRM",,"3","v_blank_in_interrupt","1",,
"ISTNRM",,"2","end_of_render_tsp","1",,
"ISTNRM",,"1","end_of_render_isp","1",,
"ISTNRM",,"0","end_of_render_video","1",,
,,,,,,
"ISTERR",,"31","sh4__if_access_inhibited_area",,,
"ISTERR",,"28","ddt__if_sort_dma_command_error",,,
"ISTERR",,"27","g2__time_out_in_cpu_access",,,
"ISTERR",,"26","g2__dev_dma_time_out",,,
"ISTERR",,"25","g2__ext_dma2_time_out",,,
"ISTERR",,"24","g2__ext_dma1_time_out",,,
"ISTERR",,"23","g2__aica_dma_time_out",,,
"ISTERR",,"22","g2__dev_dma_over_run",,,
"ISTERR",,"21","g2__ext_dma2_over_run",,,
"ISTERR",,"20","g2__ext_dma1_over_run",,,
"ISTERR",,"19","g2__aica_dma_over_run",,,
"ISTERR",,"18","g2__dev_dma_illegal_address_set",,,
"ISTERR",,"17","g2__ext_dma2_illegal_address_set",,,
"ISTERR",,"16","g2__ext_dma1_illegal_address_set",,,
"ISTERR",,"15","g2__aica_dma_illegal_address_set",,,
"ISTERR",,"14","g1__rom_flash_access_at_gd_dma",,,
"ISTERR",,"13","g1__gd_dma_over_run",,,
"ISTERR",,"12","g1__illegal_address_set",,,
"ISTERR",,"11","maple__illegal_command",,,
"ISTERR",,"10","maple__write_fifo_over_flow",,,
"ISTERR",,"9","maple__dma_over_run",,,
"ISTERR",,"8","maple__illegal_address_set",,,
"ISTERR",,"7","pvrif__dma_over_run",,,
"ISTERR",,"6","pvrif__illegal_address_set",,,
"ISTERR",,"5","ta__fifo_overflow",,,
"ISTERR",,"4","ta__illegal_parameter",,,
"ISTERR",,"3","ta__object_list_pointer_overflow",,,
"ISTERR",,"2","ta__isp_tsp_parameter_overflow",,,
"ISTERR",,"1","render__hazard_processing_of_strip_buffer",,,
"ISTERR",,"0","render__isp_out_of_cache",,,
"ISTERR",,"31","sh4__if_access_inhibited_area","1",,
"ISTERR",,"28","ddt__if_sort_dma_command_error","1",,
"ISTERR",,"27","g2__time_out_in_cpu_access","1",,
"ISTERR",,"26","g2__dev_dma_time_out","1",,
"ISTERR",,"25","g2__ext_dma2_time_out","1",,
"ISTERR",,"24","g2__ext_dma1_time_out","1",,
"ISTERR",,"23","g2__aica_dma_time_out","1",,
"ISTERR",,"22","g2__dev_dma_over_run","1",,
"ISTERR",,"21","g2__ext_dma2_over_run","1",,
"ISTERR",,"20","g2__ext_dma1_over_run","1",,
"ISTERR",,"19","g2__aica_dma_over_run","1",,
"ISTERR",,"18","g2__dev_dma_illegal_address_set","1",,
"ISTERR",,"17","g2__ext_dma2_illegal_address_set","1",,
"ISTERR",,"16","g2__ext_dma1_illegal_address_set","1",,
"ISTERR",,"15","g2__aica_dma_illegal_address_set","1",,
"ISTERR",,"14","g1__rom_flash_access_at_gd_dma","1",,
"ISTERR",,"13","g1__gd_dma_over_run","1",,
"ISTERR",,"12","g1__illegal_address_set","1",,
"ISTERR",,"11","maple__illegal_command","1",,
"ISTERR",,"10","maple__write_fifo_over_flow","1",,
"ISTERR",,"9","maple__dma_over_run","1",,
"ISTERR",,"8","maple__illegal_address_set","1",,
"ISTERR",,"7","pvrif__dma_over_run","1",,
"ISTERR",,"6","pvrif__illegal_address_set","1",,
"ISTERR",,"5","ta__fifo_overflow","1",,
"ISTERR",,"4","ta__illegal_parameter","1",,
"ISTERR",,"3","ta__object_list_pointer_overflow","1",,
"ISTERR",,"2","ta__isp_tsp_parameter_overflow","1",,
"ISTERR",,"1","render__hazard_processing_of_strip_buffer","1",,
"ISTERR",,"0","render__isp_out_of_cache","1",,
,,,,,,
"FFST",,"5","holly_cpu_if_block_internal_write_buffer",,,
"FFST",,"4","holly_g2_if_block_internal_write_buffer",,,

1 register_name enum_name bits bit_name value mask description
3 C2DLEN 23-0 transfer_length 0xffffe0
4 C2DST 0 start 1
5
6 ISTNRM 21 end_of_transferring_punch_through_list 1
7 ISTNRM 20 end_of_dma_sort_dma 1
8 ISTNRM 19 end_of_dma_ch2_dma 1
9 ISTNRM 18 end_of_dma_dev_dma 1
10 ISTNRM 17 end_of_dma_ext_dma2 1
11 ISTNRM 16 end_of_dma_ext_dma1 1
12 ISTNRM 15 end_of_dma_aica_dma 1
13 ISTNRM 14 end_of_dma_gd_dma 1
14 ISTNRM 13 maple_v_blank_over_interrupt 1
15 ISTNRM 12 end_of_dma_maple_dma 1
16 ISTNRM 11 end_of_dma_pvr_dma 1
17 ISTNRM 10 end_of_transferring_translucent_modifier_volume_list 1
18 ISTNRM 9 end_of_transferring_translucent_list 1
19 ISTNRM 8 end_of_transferring_opaque_modifier_volume_list 1
20 ISTNRM 7 end_of_transferring_opaque_list 1
21 ISTNRM 6 end_of_transferring_yuv 1
22 ISTNRM 5 h_blank_in_interrupt 1
23 ISTNRM 4 v_blank_out_interrupt 1
24 ISTNRM 3 v_blank_in_interrupt 1
25 ISTNRM 2 end_of_render_tsp 1
26 ISTNRM 1 end_of_render_isp 1
27 ISTNRM 0 end_of_render_video 1
28
29 ISTERR 31 sh4__if_access_inhibited_area 1
30 ISTERR 28 ddt__if_sort_dma_command_error 1
31 ISTERR 27 g2__time_out_in_cpu_access 1
32 ISTERR 26 g2__dev_dma_time_out 1
33 ISTERR 25 g2__ext_dma2_time_out 1
34 ISTERR 24 g2__ext_dma1_time_out 1
35 ISTERR 23 g2__aica_dma_time_out 1
36 ISTERR 22 g2__dev_dma_over_run 1
37 ISTERR 21 g2__ext_dma2_over_run 1
38 ISTERR 20 g2__ext_dma1_over_run 1
39 ISTERR 19 g2__aica_dma_over_run 1
40 ISTERR 18 g2__dev_dma_illegal_address_set 1
41 ISTERR 17 g2__ext_dma2_illegal_address_set 1
42 ISTERR 16 g2__ext_dma1_illegal_address_set 1
43 ISTERR 15 g2__aica_dma_illegal_address_set 1
44 ISTERR 14 g1__rom_flash_access_at_gd_dma 1
45 ISTERR 13 g1__gd_dma_over_run 1
46 ISTERR 12 g1__illegal_address_set 1
47 ISTERR 11 maple__illegal_command 1
48 ISTERR 10 maple__write_fifo_over_flow 1
49 ISTERR 9 maple__dma_over_run 1
50 ISTERR 8 maple__illegal_address_set 1
51 ISTERR 7 pvrif__dma_over_run 1
52 ISTERR 6 pvrif__illegal_address_set 1
53 ISTERR 5 ta__fifo_overflow 1
54 ISTERR 4 ta__illegal_parameter 1
55 ISTERR 3 ta__object_list_pointer_overflow 1
56 ISTERR 2 ta__isp_tsp_parameter_overflow 1
57 ISTERR 1 render__hazard_processing_of_strip_buffer 1
58 ISTERR 0 render__isp_out_of_cache 1
59
60 FFST 5 holly_cpu_if_block_internal_write_buffer
61 FFST 4 holly_g2_if_block_internal_write_buffer

Binary file not shown.

View File

@ -15,61 +15,61 @@ namespace c2dst {
}
namespace istnrm {
constexpr uint32_t end_of_transferring_punch_through_list(uint32_t reg) { return (reg >> 21) & 0x1; }
constexpr uint32_t end_of_dma_sort_dma(uint32_t reg) { return (reg >> 20) & 0x1; }
constexpr uint32_t end_of_dma_ch2_dma(uint32_t reg) { return (reg >> 19) & 0x1; }
constexpr uint32_t end_of_dma_dev_dma(uint32_t reg) { return (reg >> 18) & 0x1; }
constexpr uint32_t end_of_dma_ext_dma2(uint32_t reg) { return (reg >> 17) & 0x1; }
constexpr uint32_t end_of_dma_ext_dma1(uint32_t reg) { return (reg >> 16) & 0x1; }
constexpr uint32_t end_of_dma_aica_dma(uint32_t reg) { return (reg >> 15) & 0x1; }
constexpr uint32_t end_of_dma_gd_dma(uint32_t reg) { return (reg >> 14) & 0x1; }
constexpr uint32_t maple_v_blank_over_interrupt(uint32_t reg) { return (reg >> 13) & 0x1; }
constexpr uint32_t end_of_dma_maple_dma(uint32_t reg) { return (reg >> 12) & 0x1; }
constexpr uint32_t end_of_dma_pvr_dma(uint32_t reg) { return (reg >> 11) & 0x1; }
constexpr uint32_t end_of_transferring_translucent_modifier_volume_list(uint32_t reg) { return (reg >> 10) & 0x1; }
constexpr uint32_t end_of_transferring_translucent_list(uint32_t reg) { return (reg >> 9) & 0x1; }
constexpr uint32_t end_of_transferring_opaque_modifier_volume_list(uint32_t reg) { return (reg >> 8) & 0x1; }
constexpr uint32_t end_of_transferring_opaque_list(uint32_t reg) { return (reg >> 7) & 0x1; }
constexpr uint32_t end_of_transferring_yuv(uint32_t reg) { return (reg >> 6) & 0x1; }
constexpr uint32_t h_blank_in_interrupt(uint32_t reg) { return (reg >> 5) & 0x1; }
constexpr uint32_t v_blank_out_interrupt(uint32_t reg) { return (reg >> 4) & 0x1; }
constexpr uint32_t v_blank_in_interrupt(uint32_t reg) { return (reg >> 3) & 0x1; }
constexpr uint32_t end_of_render_tsp(uint32_t reg) { return (reg >> 2) & 0x1; }
constexpr uint32_t end_of_render_isp(uint32_t reg) { return (reg >> 1) & 0x1; }
constexpr uint32_t end_of_render_video(uint32_t reg) { return (reg >> 0) & 0x1; }
constexpr uint32_t end_of_transferring_punch_through_list = 1 << 21;
constexpr uint32_t end_of_dma_sort_dma = 1 << 20;
constexpr uint32_t end_of_dma_ch2_dma = 1 << 19;
constexpr uint32_t end_of_dma_dev_dma = 1 << 18;
constexpr uint32_t end_of_dma_ext_dma2 = 1 << 17;
constexpr uint32_t end_of_dma_ext_dma1 = 1 << 16;
constexpr uint32_t end_of_dma_aica_dma = 1 << 15;
constexpr uint32_t end_of_dma_gd_dma = 1 << 14;
constexpr uint32_t maple_v_blank_over_interrupt = 1 << 13;
constexpr uint32_t end_of_dma_maple_dma = 1 << 12;
constexpr uint32_t end_of_dma_pvr_dma = 1 << 11;
constexpr uint32_t end_of_transferring_translucent_modifier_volume_list = 1 << 10;
constexpr uint32_t end_of_transferring_translucent_list = 1 << 9;
constexpr uint32_t end_of_transferring_opaque_modifier_volume_list = 1 << 8;
constexpr uint32_t end_of_transferring_opaque_list = 1 << 7;
constexpr uint32_t end_of_transferring_yuv = 1 << 6;
constexpr uint32_t h_blank_in_interrupt = 1 << 5;
constexpr uint32_t v_blank_out_interrupt = 1 << 4;
constexpr uint32_t v_blank_in_interrupt = 1 << 3;
constexpr uint32_t end_of_render_tsp = 1 << 2;
constexpr uint32_t end_of_render_isp = 1 << 1;
constexpr uint32_t end_of_render_video = 1 << 0;
}
namespace isterr {
constexpr uint32_t sh4__if_access_inhibited_area(uint32_t reg) { return (reg >> 31) & 0x1; }
constexpr uint32_t ddt__if_sort_dma_command_error(uint32_t reg) { return (reg >> 28) & 0x1; }
constexpr uint32_t g2__time_out_in_cpu_access(uint32_t reg) { return (reg >> 27) & 0x1; }
constexpr uint32_t g2__dev_dma_time_out(uint32_t reg) { return (reg >> 26) & 0x1; }
constexpr uint32_t g2__ext_dma2_time_out(uint32_t reg) { return (reg >> 25) & 0x1; }
constexpr uint32_t g2__ext_dma1_time_out(uint32_t reg) { return (reg >> 24) & 0x1; }
constexpr uint32_t g2__aica_dma_time_out(uint32_t reg) { return (reg >> 23) & 0x1; }
constexpr uint32_t g2__dev_dma_over_run(uint32_t reg) { return (reg >> 22) & 0x1; }
constexpr uint32_t g2__ext_dma2_over_run(uint32_t reg) { return (reg >> 21) & 0x1; }
constexpr uint32_t g2__ext_dma1_over_run(uint32_t reg) { return (reg >> 20) & 0x1; }
constexpr uint32_t g2__aica_dma_over_run(uint32_t reg) { return (reg >> 19) & 0x1; }
constexpr uint32_t g2__dev_dma_illegal_address_set(uint32_t reg) { return (reg >> 18) & 0x1; }
constexpr uint32_t g2__ext_dma2_illegal_address_set(uint32_t reg) { return (reg >> 17) & 0x1; }
constexpr uint32_t g2__ext_dma1_illegal_address_set(uint32_t reg) { return (reg >> 16) & 0x1; }
constexpr uint32_t g2__aica_dma_illegal_address_set(uint32_t reg) { return (reg >> 15) & 0x1; }
constexpr uint32_t g1__rom_flash_access_at_gd_dma(uint32_t reg) { return (reg >> 14) & 0x1; }
constexpr uint32_t g1__gd_dma_over_run(uint32_t reg) { return (reg >> 13) & 0x1; }
constexpr uint32_t g1__illegal_address_set(uint32_t reg) { return (reg >> 12) & 0x1; }
constexpr uint32_t maple__illegal_command(uint32_t reg) { return (reg >> 11) & 0x1; }
constexpr uint32_t maple__write_fifo_over_flow(uint32_t reg) { return (reg >> 10) & 0x1; }
constexpr uint32_t maple__dma_over_run(uint32_t reg) { return (reg >> 9) & 0x1; }
constexpr uint32_t maple__illegal_address_set(uint32_t reg) { return (reg >> 8) & 0x1; }
constexpr uint32_t pvrif__dma_over_run(uint32_t reg) { return (reg >> 7) & 0x1; }
constexpr uint32_t pvrif__illegal_address_set(uint32_t reg) { return (reg >> 6) & 0x1; }
constexpr uint32_t ta__fifo_overflow(uint32_t reg) { return (reg >> 5) & 0x1; }
constexpr uint32_t ta__illegal_parameter(uint32_t reg) { return (reg >> 4) & 0x1; }
constexpr uint32_t ta__object_list_pointer_overflow(uint32_t reg) { return (reg >> 3) & 0x1; }
constexpr uint32_t ta__isp_tsp_parameter_overflow(uint32_t reg) { return (reg >> 2) & 0x1; }
constexpr uint32_t render__hazard_processing_of_strip_buffer(uint32_t reg) { return (reg >> 1) & 0x1; }
constexpr uint32_t render__isp_out_of_cache(uint32_t reg) { return (reg >> 0) & 0x1; }
constexpr uint32_t sh4__if_access_inhibited_area = 1 << 31;
constexpr uint32_t ddt__if_sort_dma_command_error = 1 << 28;
constexpr uint32_t g2__time_out_in_cpu_access = 1 << 27;
constexpr uint32_t g2__dev_dma_time_out = 1 << 26;
constexpr uint32_t g2__ext_dma2_time_out = 1 << 25;
constexpr uint32_t g2__ext_dma1_time_out = 1 << 24;
constexpr uint32_t g2__aica_dma_time_out = 1 << 23;
constexpr uint32_t g2__dev_dma_over_run = 1 << 22;
constexpr uint32_t g2__ext_dma2_over_run = 1 << 21;
constexpr uint32_t g2__ext_dma1_over_run = 1 << 20;
constexpr uint32_t g2__aica_dma_over_run = 1 << 19;
constexpr uint32_t g2__dev_dma_illegal_address_set = 1 << 18;
constexpr uint32_t g2__ext_dma2_illegal_address_set = 1 << 17;
constexpr uint32_t g2__ext_dma1_illegal_address_set = 1 << 16;
constexpr uint32_t g2__aica_dma_illegal_address_set = 1 << 15;
constexpr uint32_t g1__rom_flash_access_at_gd_dma = 1 << 14;
constexpr uint32_t g1__gd_dma_over_run = 1 << 13;
constexpr uint32_t g1__illegal_address_set = 1 << 12;
constexpr uint32_t maple__illegal_command = 1 << 11;
constexpr uint32_t maple__write_fifo_over_flow = 1 << 10;
constexpr uint32_t maple__dma_over_run = 1 << 9;
constexpr uint32_t maple__illegal_address_set = 1 << 8;
constexpr uint32_t pvrif__dma_over_run = 1 << 7;
constexpr uint32_t pvrif__illegal_address_set = 1 << 6;
constexpr uint32_t ta__fifo_overflow = 1 << 5;
constexpr uint32_t ta__illegal_parameter = 1 << 4;
constexpr uint32_t ta__object_list_pointer_overflow = 1 << 3;
constexpr uint32_t ta__isp_tsp_parameter_overflow = 1 << 2;
constexpr uint32_t render__hazard_processing_of_strip_buffer = 1 << 1;
constexpr uint32_t render__isp_out_of_cache = 1 << 0;
}
namespace ffst {

147
vga.cpp
View File

@ -1,147 +0,0 @@
#include <cstdint>
#include "sh7091/sh7091.hpp"
#include "sh7091/sh7091_bits.hpp"
#include "holly/holly.hpp"
#include "holly/core_bits.hpp"
#include "aica/aica.hpp"
#include "memorymap.hpp"
#include "vga.hpp"
#include "rgb.hpp"
/*
uint32_t get_cable_type()
{
// set all pins to input
sh7091.BSC.PCTRA = 0;
// get cable type from pins 9 + 8
return sh7091.BSC.PDTRA & PDTRA__MASK;
}
*/
void vga1()
{
holly.FB_R_CTRL = holly.FB_R_CTRL & ~fb_r_ctrl::fb_enable;
holly.VO_CONTROL |= vo_control::blank_video;
holly.FB_R_SIZE = 0;
holly.SPG_VBLANK_INT = spg_vblank_int::vblank_out_interrupt_line_number(0x0015)
| spg_vblank_int::vblank_in_interrupt_line_number(0x0208);
holly.SPG_CONTROL = spg_control::sync_direction::output;
constexpr uint32_t hbstart = 0x0345;
holly.SPG_HBLANK = spg_hblank::hbend(0x007e) // default
| spg_hblank::hbstart(hbstart); // default
holly.SPG_LOAD = spg_load::vcount(0x020c) // default
| spg_load::hcount(0x0359); // non-default
holly.SPG_VBLANK = spg_vblank::vbend(0x0028) // non-default
| spg_vblank::vbstart(0x0208); // non-default
holly.SPG_WIDTH = spg_width::eqwidth(0x000f)
| spg_width::bpwidth(0x0319)
| spg_width::vswidth(0x0003)
| spg_width::hswidth(0x003f);
constexpr uint32_t starty = 0x028;
holly.VO_STARTX = vo_startx::horizontal_start_position(0x0a8);
holly.VO_STARTY = vo_starty::vertical_start_position_on_field_2(starty)
| vo_starty::vertical_start_position_on_field_1(starty);
holly.SPG_HBLANK_INT = spg_hblank_int::line_comp_val(hbstart);
}
void vga2()
{
holly.FB_BURSTCTRL = fb_burstctrl::wr_burst(0x09)
| fb_burstctrl::vid_lat(0x3f)
| fb_burstctrl::vid_burst(0x39);
constexpr uint32_t x_size = 640;
constexpr uint32_t y_size = 480;
holly.FB_X_CLIP = fb_x_clip::fb_x_clip_max(x_size - 1)
| fb_x_clip::fb_x_clip_min(0);
holly.FB_Y_CLIP = fb_y_clip::fb_y_clip_max(y_size - 1)
| fb_y_clip::fb_y_clip_min(0);
holly.FB_R_SIZE = fb_r_size::fb_modulus(1)
| fb_r_size::fb_y_size(y_size - 3)
| fb_r_size::fb_x_size((x_size * 16) / 32 - 1);
holly.Y_COEFF = y_coeff::coefficient_1(0x80)
| y_coeff::coefficient_0_2(0x40);
// in 6.10 fixed point; 0x0400 is 1x vertical scale
holly.SCALER_CTL = scaler_ctl::vertical_scale_factor(0x0400);
holly.FB_W_SOF1 = fb_w_sof1::frame_buffer_write_address_frame_1(0);
holly.FB_W_SOF2 = fb_w_sof2::frame_buffer_write_address_frame_2(0);
holly.FB_R_SOF1 = fb_r_sof1::frame_buffer_read_address_frame_1(0);
holly.FB_R_SOF2 = fb_r_sof2::frame_buffer_read_address_frame_2(0);
holly.FB_R_CTRL = fb_r_ctrl::vclk_div::pclk_vclk_1
| fb_r_ctrl::fb_depth::_0565_rgb_16bit
| fb_r_ctrl::fb_enable;
#define DVE_OUTPUT_MODE__VGA (0b00 << 0)
aica.common.VREG(DVE_OUTPUT_MODE__VGA);
#undef DVE_OUTPUT_MODE__VGA
}
void v_sync_in()
{
while (!spg_status::vsync(holly.SPG_STATUS)) {
}
while (spg_status::vsync(holly.SPG_STATUS)) {
}
}
void v_sync_out()
{
while (spg_status::vsync(holly.SPG_STATUS)) {
}
while (!spg_status::vsync(holly.SPG_STATUS)) {
}
}
void vga()
{
holly.SOFTRESET = softreset::sdram_if_soft_reset
| softreset::pipeline_soft_reset
| softreset::ta_soft_reset;
holly.TEXT_CONTROL = text_control::stride(3);
vga1();
vga2();
holly.VO_BORDER_COL = vo_border_col::red(0x00)
| vo_border_col::green(0xff)
| vo_border_col::blue(0x00);
holly.VO_CONTROL = vo_control::pclk_delay(0x16);
holly.SDRAM_CFG = 0x15D1C951;
holly.SDRAM_REFRESH = 0x00000020;
v_sync_in();
holly.SOFTRESET = 0;
}
void vga_fill_framebuffer()
{
volatile uint16_t * vram = reinterpret_cast<volatile uint16_t *>(texture_memory32);
for (int y = 0; y < 480; y++) {
for (int x = 0; x < 640; x++) {
struct hsv hsv = {(y * 255) / 480, 255, 255};
struct rgb rgb = hsv_to_rgb(hsv);
vram[y * 640 + x] = ((rgb.r >> 3) << 11) | ((rgb.g >> 2) << 5) | ((rgb.b >> 3) << 0);
}
}
}

View File

@ -1,6 +0,0 @@
#pragma once
void vga();
void v_sync_in();
void v_sync_out();
void vga_fill_framebuffer();