Merge branch 'flash_imem' into dmi_jtag

This commit is contained in:
marqs 2025-04-19 12:34:03 +03:00
commit 8df255d545
58 changed files with 1732 additions and 157 deletions

5
.gitignore vendored
View File

@ -23,3 +23,8 @@ software/sys_controller/sys_controller.map
software/sys_controller/sys_controller.elf
.qsys_edit/*
PLLJ_PLLSPE_INFO.txt
tools/bin2hex
software/sys_controller_bsp/bsp_timestamp
*.a
software/sys_controller/mem_init/sys_onchip_memory2_0.bin
software/sys_controller/mem_init/sys_onchip_memory2_0.hex

View File

@ -67,7 +67,6 @@ make [OPTIONS] [TARGET]
~~~~
OPTIONS may include following definitions:
* OSDLANG=JP (Japanese language menu)
* ENABLE_AUDIO=y (Includes audio setup code for v1.6 PCB / DIY audio add-on board)
TARGET is typically one of the following:
* all (Default target. Compiles an ELF file)

View File

@ -79,13 +79,11 @@ for {set i 0} {$i<$chunks} {incr i} {
#master_read_to_file $claim_path mem_init/flash_readback.bin $flash_imem_base $bin_size
#master_read_to_file $claim_path mem_init/ram_readback.bin 0x010000 65536
close_service master $claim_path
set jtag_debug_list [get_service_paths jtag_debug]
set jd [ lindex $jtag_debug_list 0 ]
open_service jtag_debug $jd
puts "Resetting system"
jtag_debug_reset_system $jd
close_service jtag_debug $jd
puts "Done"
master_write_32 $claim_path 0x40 0x00000003
after 1
master_write_32 $claim_path 0x40 0x00000001
master_write_32 $claim_path 0x40 0x00000000
close_service master $claim_path
puts "Done"

View File

@ -1,5 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="ossc_sw" InternalType="" Version="11000">
<VirtualDirectory Name="sys_controller">
<File Name="sys_controller/av_controller.c"/>
<VirtualDirectory Name="src">
<File Name="sys_controller/src/sdcard.c"/>
<File Name="sys_controller/src/firmware.c"/>
<File Name="sys_controller/src/controls.c"/>
<File Name="sys_controller/src/avconfig.c"/>
<File Name="sys_controller/src/userdata.c"/>
<File Name="sys_controller/src/flash.c"/>
<File Name="sys_controller/src/menu.c"/>
<File Name="sys_controller/src/utils.c"/>
<File Name="sys_controller/src/video_modes_list.c"/>
<File Name="sys_controller/src/video_modes.c"/>
<File Name="sys_controller/src/fat16_export.c"/>
<File Name="sys_controller/src/lcd.c"/>
</VirtualDirectory>
<VirtualDirectory Name="ic_drivers">
<VirtualDirectory Name="pcm1862">
<File Name="sys_controller/ic_drivers/pcm1862/pcm1862_regs.h"/>
<File Name="sys_controller/ic_drivers/pcm1862/pcm1862.c"/>
<File Name="sys_controller/ic_drivers/pcm1862/pcm1862.h"/>
</VirtualDirectory>
<VirtualDirectory Name="st7032">
<File Name="sys_controller/ic_drivers/st7032/st7032.c"/>
<File Name="sys_controller/ic_drivers/st7032/st7032.h"/>
</VirtualDirectory>
<VirtualDirectory Name="tvp7002">
<File Name="sys_controller/ic_drivers/tvp7002/tvp7002.c"/>
<File Name="sys_controller/ic_drivers/tvp7002/tvp7002.h"/>
<File Name="sys_controller/ic_drivers/tvp7002/tvp7002_regs.h"/>
</VirtualDirectory>
<VirtualDirectory Name="it6613">
<File Name="sys_controller/ic_drivers/it6613/typedef.h"/>
<File Name="sys_controller/ic_drivers/it6613/edid.h"/>
<File Name="sys_controller/ic_drivers/it6613/it6613_sys.c"/>
<File Name="sys_controller/ic_drivers/it6613/it6613.h"/>
<File Name="sys_controller/ic_drivers/it6613/hdmitx.h"/>
<File Name="sys_controller/ic_drivers/it6613/HDMI_COMMON.h"/>
<File Name="sys_controller/ic_drivers/it6613/it6613_sys.h"/>
<File Name="sys_controller/ic_drivers/it6613/EDID.c"/>
<File Name="sys_controller/ic_drivers/it6613/hdmitx_nios2.c"/>
<File Name="sys_controller/ic_drivers/it6613/it6613_drv.h"/>
<File Name="sys_controller/ic_drivers/it6613/it6613.c"/>
<File Name="sys_controller/ic_drivers/it6613/HDMI_TX.h"/>
<File Name="sys_controller/ic_drivers/it6613/HDMI_TX.c"/>
<File Name="sys_controller/ic_drivers/it6613/it6613_drv.c"/>
</VirtualDirectory>
<VirtualDirectory Name="sh1107">
<File Name="sys_controller/ic_drivers/sh1107/font12.h"/>
<File Name="sys_controller/ic_drivers/sh1107/sh1107.h"/>
<File Name="sys_controller/ic_drivers/sh1107/sh1107.c"/>
</VirtualDirectory>
<VirtualDirectory Name="ths7353">
<File Name="sys_controller/ic_drivers/ths7353/ths7353.c"/>
<File Name="sys_controller/ic_drivers/ths7353/ths7353.h"/>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="ulibSD">
<File Name="sys_controller/ulibSD/sd_io.c"/>
<File Name="sys_controller/ulibSD/integer.h"/>
<File Name="sys_controller/ulibSD/spi_io.c"/>
<File Name="sys_controller/ulibSD/sd_io.h"/>
<File Name="sys_controller/ulibSD/spi_io.h"/>
</VirtualDirectory>
<VirtualDirectory Name="inc">
<File Name="sys_controller/inc/firmware.h"/>
<File Name="sys_controller/inc/controls.h"/>
<File Name="sys_controller/inc/av_controller.h"/>
<File Name="sys_controller/inc/menu.h"/>
<File Name="sys_controller/inc/sdcard.h"/>
<File Name="sys_controller/inc/utils.h"/>
<File Name="sys_controller/inc/avconfig.h"/>
<File Name="sys_controller/inc/video_modes.h"/>
<File Name="sys_controller/inc/fat16_export.h"/>
<File Name="sys_controller/inc/flash.h"/>
<File Name="sys_controller/inc/userdata.h"/>
<File Name="sys_controller/inc/lcd.h"/>
</VirtualDirectory>
<VirtualDirectory Name="config">
<File Name="sys_controller/config/sysconfig.h"/>
</VirtualDirectory>
</VirtualDirectory>
<Plugins>
<Plugin Name="qmake">
<![CDATA[00020001N0005Debug0000000000000001N0007Release000000000000]]>
@ -33,77 +115,8 @@
<Extensions>
<![CDATA[*.cpp;*.c;*.h;*.hpp;*.xrc;*.wxcp;*.fbp]]>
</Extensions>
<Topleveldir>./</Topleveldir>
<Topleveldir>/home/markus/Code/ossc/software/</Topleveldir>
</Reconciliation>
<VirtualDirectory Name="sys_controller">
<VirtualDirectory Name="ths7353">
<File Name="sys_controller/ths7353/ths7353.h"/>
<File Name="sys_controller/ths7353/ths7353.c"/>
</VirtualDirectory>
<VirtualDirectory Name="it6613">
<File Name="sys_controller/it6613/it6613_drv.c"/>
<File Name="sys_controller/it6613/HDMI_TX.c"/>
<File Name="sys_controller/it6613/HDMI_TX.h"/>
<File Name="sys_controller/it6613/it6613.c"/>
<File Name="sys_controller/it6613/it6613_drv.h"/>
<File Name="sys_controller/it6613/hdmitx_nios2.c"/>
<File Name="sys_controller/it6613/EDID.c"/>
<File Name="sys_controller/it6613/it6613_sys.h"/>
<File Name="sys_controller/it6613/HDMI_COMMON.h"/>
<File Name="sys_controller/it6613/hdmitx.h"/>
<File Name="sys_controller/it6613/it6613.h"/>
<File Name="sys_controller/it6613/it6613_sys.c"/>
<File Name="sys_controller/it6613/edid.h"/>
<File Name="sys_controller/it6613/typedef.h"/>
</VirtualDirectory>
<VirtualDirectory Name="spi_charlcd">
<File Name="sys_controller/spi_charlcd/lcd.c"/>
<File Name="sys_controller/spi_charlcd/lcd.h"/>
</VirtualDirectory>
<VirtualDirectory Name="tvp7002">
<File Name="sys_controller/tvp7002/tvp7002_regs.h"/>
<File Name="sys_controller/tvp7002/tvp7002.h"/>
<File Name="sys_controller/tvp7002/tvp7002.c"/>
</VirtualDirectory>
<VirtualDirectory Name="memory">
<File Name="sys_controller/memory/flash.h"/>
<File Name="sys_controller/memory/flash.c"/>
<File Name="sys_controller/memory/sdcard.h"/>
<File Name="sys_controller/memory/sdcard.c"/>
</VirtualDirectory>
<VirtualDirectory Name="ossc">
<File Name="sys_controller/ossc/utils.h"/>
<File Name="sys_controller/ossc/utils.c"/>
<File Name="sys_controller/ossc/menu.c"/>
<File Name="sys_controller/ossc/menu.h"/>
<File Name="sys_controller/ossc/sysconfig.h"/>
<File Name="sys_controller/ossc/controls.h"/>
<File Name="sys_controller/ossc/controls.c"/>
<File Name="sys_controller/ossc/avconfig.h"/>
<File Name="sys_controller/ossc/avconfig.c"/>
<File Name="sys_controller/ossc/av_controller.c"/>
<File Name="sys_controller/ossc/av_controller.h"/>
<File Name="sys_controller/ossc/firmware.h"/>
<File Name="sys_controller/ossc/firmware.c"/>
<File Name="sys_controller/ossc/userdata.h"/>
<File Name="sys_controller/ossc/userdata.c"/>
<File Name="sys_controller/ossc/video_modes.h"/>
<File Name="sys_controller/ossc/video_modes.c"/>
<File Name="sys_controller/ossc/video_modes_list.c"/>
</VirtualDirectory>
<VirtualDirectory Name="ulibSD">
<File Name="sys_controller/ulibSD/integer.h"/>
<File Name="sys_controller/ulibSD/sd_io.c"/>
<File Name="sys_controller/ulibSD/sd_io.h"/>
<File Name="sys_controller/ulibSD/spi_io.h"/>
<File Name="sys_controller/ulibSD/spi_io.c"/>
</VirtualDirectory>
<VirtualDirectory Name="pcm1862">
<File Name="sys_controller/pcm1862/pcm1862.c"/>
<File Name="sys_controller/pcm1862/pcm1862.h"/>
<File Name="sys_controller/pcm1862/pcm1862_regs.h"/>
</VirtualDirectory>
</VirtualDirectory>
<Description/>
<Dependencies/>
<Dependencies Name="Debug"/>

View File

@ -142,35 +142,37 @@ ACDS_VERSION := 14.1
ELF := sys_controller.elf
# Paths to C, C++, and assembly source files.
C_SRCS += it6613/EDID.c
C_SRCS += it6613/HDMI_TX.c
C_SRCS += it6613/hdmitx_nios2.c
C_SRCS += it6613/it6613.c
C_SRCS += it6613/it6613_drv.c
C_SRCS += it6613/it6613_sys.c
C_SRCS += tvp7002/tvp7002.c
C_SRCS += ths7353/ths7353.c
C_SRCS += pcm1862/pcm1862.c
C_SRCS += spi_charlcd/lcd.c
C_SRCS += memory/flash.c
C_SRCS += memory/sdcard.c
C_SRCS += ossc/av_controller.c
C_SRCS += ossc/avconfig.c
C_SRCS += ossc/controls.c
C_SRCS += ossc/firmware.c
C_SRCS += ossc/fat16_export.c
C_SRCS += av_controller.c
C_SRCS += src/avconfig.c
C_SRCS += src/utils.c
C_SRCS += src/controls.c
ifeq ($(OSDLANG),JP)
C_SRCS += ossc/menu_sjis.c
C_SRCS += src/menu_sjis.c
else
C_SRCS += ossc/menu.c
C_SRCS += src/menu.c
endif
C_SRCS += src/video_modes.c
C_SRCS += src/flash.c
C_SRCS += src/firmware.c
ifeq ($(OSDLANG),JP)
C_SRCS += ossc/userdata_sjis.c
C_SRCS += src/userdata_sjis.c
else
C_SRCS += ossc/userdata.c
C_SRCS += src/userdata.c
endif
C_SRCS += ossc/utils.c
C_SRCS += ossc/video_modes.c
C_SRCS += src/sdcard.c
C_SRCS += src/fat16_export.c
C_SRCS += src/lcd.c
C_SRCS += ic_drivers/it6613/EDID.c
C_SRCS += ic_drivers/it6613/HDMI_TX.c
C_SRCS += ic_drivers/it6613/hdmitx_nios2.c
C_SRCS += ic_drivers/it6613/it6613.c
C_SRCS += ic_drivers/it6613/it6613_drv.c
C_SRCS += ic_drivers/it6613/it6613_sys.c
C_SRCS += ic_drivers/tvp7002/tvp7002.c
C_SRCS += ic_drivers/ths7353/ths7353.c
C_SRCS += ic_drivers/pcm1862/pcm1862.c
C_SRCS += ic_drivers/st7032/st7032.c
C_SRCS += ic_drivers/sh1107/sh1107.c
C_SRCS += ulibSD/sd_io.c
C_SRCS += ulibSD/spi_io.c
CXX_SRCS :=
@ -191,12 +193,12 @@ CREATE_LINKER_MAP := 1
# Common arguments for ALT_CFLAGSs
APP_CFLAGS_DEFINED_SYMBOLS := -DPICOLIBC_INTEGER_PRINTF_SCANF
ifeq ($(ENABLE_AUDIO),y)
APP_CFLAGS_DEFINED_SYMBOLS += -DENABLE_AUDIO
endif
ifeq ($(OSDLANG),JP)
APP_CFLAGS_DEFINED_SYMBOLS += -DOSDLANG_JP
endif
ifeq ($(HAS_SH1107),y)
APP_CFLAGS_DEFINED_SYMBOLS += -DHAS_SH1107
endif
APP_CFLAGS_UNDEFINED_SYMBOLS :=
APP_CFLAGS_OPTIMIZATION := -Os
APP_CFLAGS_DEBUG_LEVEL :=
@ -217,14 +219,16 @@ BSP_ROOT_DIR := ../sys_controller_bsp/
# List of application specific include directories, library directories and library names
APP_INCLUDE_DIRS += /usr/lib/picolibc/riscv64-unknown-elf/include
APP_INCLUDE_DIRS += it6613
APP_INCLUDE_DIRS += tvp7002
APP_INCLUDE_DIRS += ths7353
APP_INCLUDE_DIRS += pcm1862
APP_INCLUDE_DIRS += spi_charlcd
APP_INCLUDE_DIRS += config
APP_INCLUDE_DIRS += inc
APP_INCLUDE_DIRS += ic_drivers/it6613
APP_INCLUDE_DIRS += ic_drivers/tvp7002
APP_INCLUDE_DIRS += ic_drivers/ths7353
APP_INCLUDE_DIRS += ic_drivers/pcm1862
APP_INCLUDE_DIRS += ic_drivers/st7032
APP_INCLUDE_DIRS += ic_drivers/sh1107
APP_INCLUDE_DIRS += memory
APP_INCLUDE_DIRS += ulibSD
APP_INCLUDE_DIRS += ossc
APP_LIBRARY_DIRS :=
APP_LIBRARY_NAMES :=
@ -976,7 +980,7 @@ clean : clean_elf_derived_files
endif
clean :
@$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(RUNTIME_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST) ossc/menu_sjis.c ossc/userdata_sjis.c
@$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(RUNTIME_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST) src/menu_sjis.c src/userdata_sjis.c
@$(ECHO) [$(APP_NAME) clean complete]
# Clean just the BSP.
@ -1133,11 +1137,11 @@ print-elf-name:
#------------------------------------------------------------------------------
# CUSTOM TARGETS
#------------------------------------------------------------------------------
ossc/menu_sjis.c: ossc/menu.c
iconv -f UTF-8 -t SHIFT-JIS ossc/menu.c > ossc/menu_sjis.c
src/menu_sjis.c: src/menu.c
iconv -f UTF-8 -t SHIFT-JIS src/menu.c > src/menu_sjis.c
ossc/userdata_sjis.c: ossc/userdata.c
iconv -f UTF-8 -t SHIFT-JIS ossc/userdata.c > ossc/userdata_sjis.c
src/userdata_sjis.c: src/userdata.c
iconv -f UTF-8 -t SHIFT-JIS src/userdata.c > src/userdata_sjis.c
mem_init/flash.hex: sys_controller.elf
$(RV_OBJCOPY) --change-addresses -0x02080000 -O binary --gap-fill 0 $< mem_init/flash.bin

View File

@ -155,7 +155,6 @@ void ui_disp_status(alt_u8 refresh_osd_timer) {
}
}
#ifdef ENABLE_AUDIO
inline void SetupAudio(tx_mode_t mode)
{
// shut down audio-tx before setting new config (recommended for changing audio-tx config)
@ -177,7 +176,6 @@ inline void SetupAudio(tx_mode_t mode)
#endif
}
}
#endif
inline void TX_enable(tx_mode_t mode)
{
@ -202,9 +200,7 @@ inline void TX_enable(tx_mode_t mode)
cm.cc.hdmi_vrr = tc.hdmi_vrr;
}
#ifdef ENABLE_AUDIO
SetupAudio(mode);
#endif
// start TX
SetAVMute(FALSE);
@ -418,7 +414,6 @@ status_t get_status(tvp_sync_input_t syncinput)
if (tc.full_vs_bypass != cm.cc.full_vs_bypass)
tvp_set_full_vs_bypass(tc.full_vs_bypass);
#ifdef ENABLE_AUDIO
if ((tc.audio_dw_sampl != cm.cc.audio_dw_sampl) ||
#ifdef MANUAL_CTS
update_cur_vm ||
@ -434,7 +429,6 @@ status_t get_status(tvp_sync_input_t syncinput)
pcm_set_stereo_mode(tc.audio_mono);
SetupAudio(cm.cc.tx_mode);
}
#endif
cm.cc = tc;
update_cur_vm = 0;
@ -685,10 +679,8 @@ void program_mode()
TX_enable(cm.cc.tx_mode);
} else if (cm.cc.tx_mode!=TX_DVI) {
HDMITX_SetAVIInfoFrame(vmode_out.vic, (cm.cc.tx_mode == TX_HDMI_RGB) ? F_MODE_RGB444 : F_MODE_YUV444, 0, 0, cm.cc.hdmi_itc, vm_conf.hdmitx_pixr_ifr);
#ifdef ENABLE_AUDIO
#ifdef MANUAL_CTS
SetupAudio(cm.cc.tx_mode);
#endif
#endif
}
}
@ -807,12 +799,10 @@ int init_hw()
InitIT6613();
#ifdef ENABLE_AUDIO
if (pcm1862_init()) {
printf("PCM1862 found\n");
pcm1862_active = 1;
}
#endif
/*if (init_flash() != 0) {
printf("Error: could not find flash\n");
@ -869,7 +859,7 @@ void print_vm_stats() {
sniprintf((char*)osd->osd_array.data[++row][0], OSD_CHAR_COLS, "Profile:");
sniprintf((char*)osd->osd_array.data[row][1], OSD_CHAR_COLS, "%u: %s", profile_sel, (target_profile_name[0] == 0) ? "<empty>" : target_profile_name);
sniprintf((char*)osd->osd_array.data[++row][0], OSD_CHAR_COLS, "FW:");
sniprintf((char*)osd->osd_array.data[row][1], OSD_CHAR_COLS, "%u.%.2u" FW_SUFFIX1 FW_SUFFIX2 " @ " __DATE__, FW_VER_MAJOR, FW_VER_MINOR);
sniprintf((char*)osd->osd_array.data[row][1], OSD_CHAR_COLS, "%u.%.2u" FW_SUFFIX " @ " __DATE__, FW_VER_MAJOR, FW_VER_MINOR);
osd->osd_config.status_refresh = 1;
osd->osd_row_color.mask = 0;
@ -965,7 +955,7 @@ int main()
if (init_stat >= 0) {
printf("### DIY VIDEO DIGITIZER / SCANCONVERTER INIT OK ###\n\n");
sniprintf(row1, LCD_ROW_LEN+1, "OSSC fw. %u.%.2u" FW_SUFFIX1 FW_SUFFIX2, FW_VER_MAJOR, FW_VER_MINOR);
sniprintf(row1, LCD_ROW_LEN+1, " OSSC fw. %u.%.2u" FW_SUFFIX, FW_VER_MAJOR, FW_VER_MINOR);
#ifndef DEBUG
strncpy(row2, "2014-2025 marqs", LCD_ROW_LEN+1);
#else
@ -1127,11 +1117,9 @@ int main()
cm.sync_active = 0;
ths_source_sel(target_ths, (cm.cc.video_lpf > 1) ? (VIDEO_LPF_MAX-cm.cc.video_lpf) : THS_LPF_BYPASS);
tvp_powerdown();
#ifdef ENABLE_AUDIO
DisableAudioOutput();
if (pcm1862_active)
pcm_source_sel(target_pcm);
#endif
tvp_source_sel(target_tvp, target_tvp_sync, target_format);
cm.clkcnt = 0; //TODO: proper invalidate
sys_ctrl &= ~VSYNC_I_TYPE;
@ -1204,9 +1192,7 @@ int main()
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
tvp_powerup();
program_mode();
#ifdef ENABLE_AUDIO
SetupAudio(cm.cc.tx_mode);
#endif
} else {
printf("Sync lost\n");
cm.clkcnt = 0; //TODO: proper invalidate

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
//
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
//
// This file is part of Open Source Scan Converter project.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#include <unistd.h>
#include <string.h>
#include "lcd.h"
#include "sh1107.h"
#include "alt_types.h"
#include "altera_avalon_pio_regs.h"
#include "i2c_opencores.h"
#include "av_controller.h"
#include "font12.h"
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
extern alt_u32 sys_ctrl;
static void OLED_Write(uint8_t value)
{
SPI_write(I2CA_BASE, &value, 1);
}
void sh1107_init()
{
sys_ctrl &= ~(LCD_CS_N | LCD_RS);
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
alt_u8 init[] = {
0xae, /*turn off OLED display*/
0x00, /*set lower column address*/
0x10, /*set higher column address*/
0xb0, /*set page address*/
0xdc, 0x00, /*set display start line*/
0x81, /*contract control*/
0x6f, /*128*/
0x21, /* Set Memory addressing mode (0x20/0x21) */
0xa1, /*set segment remap*/
0xc0, /*Com scan direction*/
0xa4, /*Disable Entire Display On (0xA4/0xA5)*/
0xa6, /*normal / reverse*/
0xa8, /*multiplex ratio*/
0x3f, /*duty = 1/64*/
0xd3, 0x60, /*set display offset*/
0xd5, 0x41, /*set osc division*/
0xd9, 0x22, /*set pre-charge period*/
0xdb, 0x35, /*set vcomh*/
0xad, /*set charge pump enable*/
0x8a /*Set DC-DC enable (a=0:disable; a=1:enable) */
};
SPI_write(I2CA_BASE, init, sizeof(init));
// Clear the screen
OLED_Write(0xb0);
for (alt_u8 i = 0; i < OLED_HEIGHT; i++)
{
sys_ctrl &= ~LCD_RS;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
OLED_Write(0x00 + (i & 0x0f));
OLED_Write(0x10 + (i >> 4));
sys_ctrl |= LCD_RS;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
for (alt_u8 i = 0; i < OLED_WIDTH / 8; i++)
OLED_Write(0);
}
sys_ctrl &= ~LCD_RS;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
// Turn on
OLED_Write(0xaf);
sys_ctrl |= LCD_CS_N;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
}
void sh1107_write(char *row1, char *row2)
{
sys_ctrl &= ~(LCD_CS_N | LCD_RS);
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
alt_u8 row1len = strnlen(row1, LCD_ROW_LEN);
for (alt_u8 i = 0; i < 12; i++)
{
sys_ctrl &= ~LCD_RS;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
OLED_Write(0xb0);
OLED_Write(0x00 + ((i + 13) & 0x0f));
OLED_Write(0x10 + ((i + 13) >> 4));
sys_ctrl |= LCD_RS;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
for (alt_u8 j = 0; j < row1len; j++)
OLED_Write(Font12_Table[(row1[j] - 0x20) * 12 + i]);
for (alt_u8 j = row1len; j < LCD_ROW_LEN; j++)
OLED_Write(Font12_Table[i]);
}
alt_u8 row2len = strnlen(row2, LCD_ROW_LEN);
for (alt_u8 i = 0; i < 12; i++)
{
sys_ctrl &= ~LCD_RS;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
OLED_Write(0xb0);
OLED_Write(0x00 + ((i + 39) & 0x0f));
OLED_Write(0x10 + ((i + 39) >> 4));
sys_ctrl |= LCD_RS;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
for (alt_u8 j = 0; j < row2len; j++)
OLED_Write(Font12_Table[(row2[j] - 0x20) * 12 + i]);
for (alt_u8 j = row2len; j < LCD_ROW_LEN; j++)
OLED_Write(Font12_Table[i]);
}
sys_ctrl |= LCD_CS_N;
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
}

View File

@ -0,0 +1,31 @@
//
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
//
// This file is part of Open Source Scan Converter project.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef SH1107_H_
#define SH1107_H_
#include "system.h"
#include <stdio.h>
#include "sysconfig.h"
void sh1107_init();
void sh1107_write(char *row1, char *row2);
#endif /* sh1107_H_ */

View File

@ -1,5 +1,6 @@
//
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
//
// This file is part of Open Source Scan Converter project.
//
@ -20,14 +21,12 @@
#include <unistd.h>
#include <string.h>
#include "lcd.h"
#include "st7032.h"
#include "alt_types.h"
#include "altera_avalon_pio_regs.h"
#include "i2c_opencores.h"
#include "av_controller.h"
#define LCD_CMD 0x00
#define LCD_DATA 0x40
#define WRDELAY 20
#define CLEARDELAY 800
@ -38,7 +37,7 @@ static void lcd_cmd(alt_u8 cmd, alt_u16 postdelay) {
usleep(postdelay);
}
void lcd_init()
void st7032_init()
{
sys_ctrl &= ~(LCD_CS_N|LCD_RS);
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
@ -59,7 +58,7 @@ void lcd_init()
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
}
void lcd_write(char *row1, char *row2)
void st7032_write(char *row1, char *row2)
{
alt_u8 i, rowlen;

View File

@ -0,0 +1,32 @@
//
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
//
// This file is part of Open Source Scan Converter project.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef ST7032_H_
#define ST7032_H_
#include "system.h"
#include <stdio.h>
#include "sysconfig.h"
void st7032_init();
void st7032_write(char *row1, char *row2);
#endif /* st7032_H_ */

View File

@ -32,16 +32,10 @@
#define INITCFG_VER_MAJOR 1
#define INITCFG_VER_MINOR 0
#ifdef ENABLE_AUDIO
#define FW_SUFFIX1 "a"
#else
#define FW_SUFFIX1 ""
#endif
#ifdef OSDLANG_JP
#define FW_SUFFIX2 "j"
#define FW_SUFFIX "j"
#else
#define FW_SUFFIX2 ""
#define FW_SUFFIX ""
#endif
#define FW_UPDATE_RETRIES 3

View File

@ -1,5 +1,6 @@
//
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
//
// This file is part of Open Source Scan Converter project.
//
@ -20,14 +21,10 @@
#ifndef LCD_H_
#define LCD_H_
#include "system.h"
#include <stdio.h>
#include "sysconfig.h"
#define LCD_ROW_LEN 16
void lcd_init();
void lcd_write(char *row1, char *row2);
#endif /* LCD_H_ */
#endif /* LCD_H_ */

View File

@ -59,10 +59,8 @@ const avconfig_t tc_default = {
.c_gain = DEFAULT_COARSE_GAIN,
},
.mask_br = 8,
#ifdef ENABLE_AUDIO
.audio_dw_sampl = DEFAULT_ON,
.audio_gain = AUDIO_GAIN_0DB,
#endif
.link_av = AV_LAST,
};

View File

@ -19,6 +19,8 @@
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include "system.h"
#include "alt_types.h"
#include "controls.h"
#include "menu.h"

View File

@ -19,6 +19,8 @@
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include "system.h"
#include "firmware.h"
#include "sdcard.h"
#include "flash.h"

View File

@ -0,0 +1,40 @@
//
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
//
// This file is part of Open Source Scan Converter project.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#include "lcd.h"
#include "st7032.h"
#include "sh1107.h"
void lcd_init()
{
#ifndef HAS_SH1107
st7032_init();
#else
sh1107_init();
#endif
}
void lcd_write(char *row1, char *row2)
{
#ifndef HAS_SH1107
st7032_write(row1, row2);
#else
sh1107_write(row1, row2);
#endif
}

View File

@ -18,6 +18,7 @@
//
#include <string.h>
#include <stdio.h>
#include "menu.h"
#include "av_controller.h"
#include "firmware.h"
@ -227,7 +228,6 @@ MENU(menu_compatibility, P99_PROTECT({ \
{ "Default HDMI VIC", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.default_vic, OPT_NOWRAP, 0, HDMI_1080p50, value_disp } } },
}))
#ifdef ENABLE_AUDIO
MENU(menu_audio, P99_PROTECT({ \
{ LNG("Down-sampling","ダウンサンプリング"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.audio_dw_sampl, OPT_WRAP, SETTING_ITEM(audio_dw_sampl_desc) } } },
{ LNG("Swap left/right","ヒダリ/ミギスワップ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.audio_swap_lr, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
@ -235,9 +235,6 @@ MENU(menu_audio, P99_PROTECT({ \
{ "Pre-ADC gain", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.audio_gain, OPT_NOWRAP, 0, AUDIO_GAIN_MAX, aud_db_disp } } },
}))
#define AUDIO_MENU { LNG("Audio options >","オーディオオプション >"), OPT_SUBMENU, { .sub = { &menu_audio, NULL, NULL } } },
#else
#define AUDIO_MENU
#endif
MENU(menu_settings, P99_PROTECT({ \
{ LNG("Link prof->input","Link prof->input"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.link_av, OPT_WRAP, AV1_RGBs, AV_LAST, link_av_desc } } },

View File

@ -20,6 +20,8 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include "system.h"
#include "userdata.h"
#include "fat16_export.h"
#include "flash.h"