diff --git a/software/sys_controller/ossc/av_controller.c b/software/sys_controller/ossc/av_controller.c index 6b37925..cc7bfd1 100644 --- a/software/sys_controller/ossc/av_controller.c +++ b/software/sys_controller/ossc/av_controller.c @@ -349,56 +349,19 @@ status_t get_status(tvp_sync_input_t syncinput) status = (status < MODE_CHANGE) ? MODE_CHANGE : status; } - if ((tc.pm_240p != cm.cc.pm_240p) || - (tc.pm_384p != cm.cc.pm_384p) || - (tc.pm_480i != cm.cc.pm_480i) || - (tc.pm_480p != cm.cc.pm_480p) || - (tc.pm_1080i != cm.cc.pm_1080i) || - (tc.l2_mode != cm.cc.l2_mode) || - (tc.l3_mode != cm.cc.l3_mode) || - (tc.l4_mode != cm.cc.l4_mode) || - (tc.l5_mode != cm.cc.l5_mode) || - (tc.l5_fmt != cm.cc.l5_fmt) || - (tc.upsample2x != cm.cc.upsample2x) || - (tc.ar_256col != cm.cc.ar_256col) || - (tc.default_vic != cm.cc.default_vic) || - (tc.clamp_offset != cm.cc.clamp_offset)) - status = (status < MODE_CHANGE) ? MODE_CHANGE : status; - - if ((tc.s480p_mode != cm.cc.s480p_mode) && (vmode_in.timings.v_total == 525)) - status = (status < MODE_CHANGE) ? MODE_CHANGE : status; - - if ((tc.s400p_mode != cm.cc.s400p_mode) && (vmode_in.timings.v_total == 449)) + if (memcmp(&tc, &cm.cc, offsetof(avconfig_t, sl_mode)) || (update_cur_vm == 1)) status = (status < MODE_CHANGE) ? MODE_CHANGE : status; if ((vm_conf.si_pclk_mult > 1) && (pll_reconfig->pll_config_status.c_config_id != 5) && (vm_conf.si_pclk_mult-1 != pll_reconfig->pll_config_status.c_config_id)) status = (status < MODE_CHANGE) ? MODE_CHANGE : status; - if (update_cur_vm) - status = (status < MODE_CHANGE) ? MODE_CHANGE : status; - cm.totlines = totlines; cm.clkcnt = clkcnt; cm.pcnt_frame = pcnt_frame; cm.progressive = progressive; } - if ((tc.sl_mode != cm.cc.sl_mode) || - (tc.sl_type != cm.cc.sl_type) || - (tc.sl_hybr_str != cm.cc.sl_hybr_str) || - (tc.sl_method != cm.cc.sl_method) || - (tc.sl_str != cm.cc.sl_str) || - (tc.sl_cust_iv_x != cm.cc.sl_cust_iv_x) || - (tc.sl_cust_iv_y != cm.cc.sl_cust_iv_y) || - memcmp(tc.sl_cust_l_str, cm.cc.sl_cust_l_str, 5) || - memcmp(tc.sl_cust_c_str, cm.cc.sl_cust_c_str, 6) || - (tc.sl_altern != cm.cc.sl_altern) || - (tc.sl_id != cm.cc.sl_id) || - (tc.h_mask != cm.cc.h_mask) || - (tc.v_mask != cm.cc.v_mask) || - (tc.mask_br != cm.cc.mask_br) || - (tc.mask_color != cm.cc.mask_color) || - (tc.reverse_lpf != cm.cc.reverse_lpf)) + if (memcmp(&tc.sl_mode, &cm.cc.sl_mode, offsetof(avconfig_t, sync_vth) - offsetof(avconfig_t, sl_mode))) status = (status < SC_CONFIG_CHANGE) ? SC_CONFIG_CHANGE : status; if (tc.sync_vth != cm.cc.sync_vth) @@ -580,6 +543,7 @@ void update_sc_config(mode_data_t *vm_in, mode_data_t *vm_out, vm_proc_config_t // Configure TVP7002 and scan converter logic based on the video mode void program_mode() { + int retval; alt_u8 h_syncinlen, v_syncinlen, macrovis, hdmitx_pclk_level, osd_x_size, osd_y_size; alt_u32 h_hz, h_synclen_px, pclk_i_hz, dotclk_hz, pll_h_total; @@ -605,13 +569,14 @@ void program_mode() sniprintf(row2, LCD_ROW_LEN+1, "%u.%.2ukHz %u.%.2uHz", (unsigned)(h_hz/1000), (unsigned)((h_hz%1000)/10), (unsigned)(vmode_in.timings.v_hz_x100/100), (unsigned)(vmode_in.timings.v_hz_x100%100)); ui_disp_status(1); - cm.id = get_pure_lm_mode(&cm.cc, &vmode_in, &vmode_out, &vm_conf); + retval = get_pure_lm_mode(&cm.cc, &vmode_in, &vmode_out, &vm_conf); - if (cm.id == -1) { + if (retval == -1) { printf ("ERROR: no suitable mode preset found\n"); vm_conf.si_pclk_mult = 0; return; } + cm.id = retval; vm_sel = cm.id; // Double TVP7002 PLL sampling rate when possible to minimize jitter diff --git a/software/sys_controller/ossc/av_controller.h b/software/sys_controller/ossc/av_controller.h index e1492be..b986f8d 100644 --- a/software/sys_controller/ossc/av_controller.h +++ b/software/sys_controller/ossc/av_controller.h @@ -93,6 +93,8 @@ typedef struct { void ui_disp_menu(alt_u8 osd_mode); void ui_disp_status(alt_u8 refresh_osd_timer); +void set_sampler_phase(uint8_t sampler_phase); + int load_profile(); int save_profile(); diff --git a/software/sys_controller/ossc/avconfig.c b/software/sys_controller/ossc/avconfig.c index 2b9fdd4..f588015 100644 --- a/software/sys_controller/ossc/avconfig.c +++ b/software/sys_controller/ossc/avconfig.c @@ -33,23 +33,21 @@ avconfig_t tc; // Default configuration const avconfig_t tc_default = { - .l3_mode = 1, .pm_240p = 1, .pm_384p = 1, .pm_480i = 1, .pm_1080i = 1, + .l3_mode = 1, + .clamp_offset = SIGNED_NUMVAL_ZERO, + .sl_altern = 1, .sync_vth = DEFAULT_SYNC_VTH, .linelen_tol = DEFAULT_LINELEN_TOL, .vsync_thold = DEFAULT_VSYNC_THOLD, - .sync_lpf = DEFAULT_SYNC_LPF, .pre_coast = DEFAULT_PRE_COAST, .post_coast = DEFAULT_POST_COAST, - .sl_altern = 1, -#ifdef ENABLE_AUDIO - .audio_dw_sampl = DEFAULT_ON, - .tx_mode = TX_HDMI_RGB, - .audio_gain = AUDIO_GAIN_0DB, -#endif + .sync_lpf = DEFAULT_SYNC_LPF, + .alc_h_filter = DEFAULT_ALC_H_FILTER, + .alc_v_filter = DEFAULT_ALC_V_FILTER, .col = { .r_f_gain = DEFAULT_FINE_GAIN, .g_f_gain = DEFAULT_FINE_GAIN, @@ -59,10 +57,11 @@ const avconfig_t tc_default = { .b_f_off = DEFAULT_FINE_OFFSET, .c_gain = DEFAULT_COARSE_GAIN, }, +#ifdef ENABLE_AUDIO + .audio_dw_sampl = DEFAULT_ON, + .audio_gain = AUDIO_GAIN_0DB, +#endif .link_av = AV_LAST, - .clamp_offset = SIGNED_NUMVAL_ZERO, - .alc_h_filter = DEFAULT_ALC_H_FILTER, - .alc_v_filter = DEFAULT_ALC_V_FILTER, }; int set_default_avconfig() diff --git a/software/sys_controller/ossc/avconfig.h b/software/sys_controller/ossc/avconfig.h index 6dc7e15..9413a99 100644 --- a/software/sys_controller/ossc/avconfig.h +++ b/software/sys_controller/ossc/avconfig.h @@ -83,6 +83,25 @@ typedef struct { } __attribute__((packed)) color_setup_t; typedef struct { + /* P-LM mode options */ + alt_u8 pm_240p; + alt_u8 pm_384p; + alt_u8 pm_480i; + alt_u8 pm_480p; + alt_u8 pm_1080i; + alt_u8 l2_mode; + alt_u8 l3_mode; + alt_u8 l4_mode; + alt_u8 l5_mode; + alt_u8 l5_fmt; + alt_u8 s480p_mode; + alt_u8 s400p_mode; + alt_u8 upsample2x; + alt_u8 ar_256col; + alt_u8 default_vic; + alt_u8 clamp_offset; + + /* Postprocessing settings */ alt_u8 sl_mode; alt_u8 sl_type; alt_u8 sl_hybr_str; @@ -94,47 +113,35 @@ typedef struct { alt_u8 sl_cust_c_str[6]; alt_u8 sl_cust_iv_x; alt_u8 sl_cust_iv_y; - alt_u8 l2_mode; - alt_u8 l3_mode; - alt_u8 l4_mode; - alt_u8 l5_mode; - alt_u8 l5_fmt; - alt_u8 pm_240p; - alt_u8 pm_384p; - alt_u8 pm_480i; - alt_u8 pm_480p; - alt_u8 pm_1080i; - alt_u8 ar_256col; - alt_u8 h_mask; - alt_u8 v_mask; alt_u8 mask_br; alt_u8 mask_color; - alt_u8 tx_mode; - alt_u8 hdmi_itc; - alt_u8 s480p_mode; - alt_u8 s400p_mode; - alt_u8 upsample2x; - alt_u8 ypbpr_cs; + alt_u8 reverse_lpf; + + /* AFE settings */ alt_u8 sync_vth; alt_u8 linelen_tol; alt_u8 vsync_thold; - alt_u8 sync_lpf; - alt_u8 stc_lpf; - alt_u8 video_lpf; alt_u8 pre_coast; alt_u8 post_coast; - alt_u8 full_tx_setup; - alt_u8 av3_alt_rgb; - alt_u8 reverse_lpf; + alt_u8 ypbpr_cs; + alt_u8 video_lpf; + alt_u8 sync_lpf; + alt_u8 stc_lpf; + alt_u8 alc_h_filter; + alt_u8 alc_v_filter; + color_setup_t col; + + /* Audio settings */ alt_u8 audio_dw_sampl; alt_u8 audio_swap_lr; alt_u8 audio_gain; alt_u8 audio_mono; - alt_u8 default_vic; - alt_u8 clamp_offset; - alt_u8 alc_h_filter; - alt_u8 alc_v_filter; - color_setup_t col; + + /* TX / extra settings */ + alt_u8 tx_mode; + alt_u8 hdmi_itc; + alt_u8 full_tx_setup; + alt_u8 av3_alt_rgb; avinput_t link_av; } __attribute__((packed)) avconfig_t; diff --git a/software/sys_controller/ossc/controls.c b/software/sys_controller/ossc/controls.c index 1ea34d3..e9a2ec6 100644 --- a/software/sys_controller/ossc/controls.c +++ b/software/sys_controller/ossc/controls.c @@ -1,5 +1,5 @@ // -// Copyright (C) 2015-2019 Markus Hiienkari +// Copyright (C) 2015-2023 Markus Hiienkari // // This file is part of Open Source Scan Converter project. // @@ -38,7 +38,7 @@ const alt_u16 rc_keymap_default[REMOTE_MAX_KEYS] = {0x3E29, 0x3EA9, 0x3E69, 0x3E alt_u16 rc_keymap[REMOTE_MAX_KEYS]; extern char menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1]; -extern mode_data_t video_modes[]; +extern mode_data_t video_modes_plm[]; extern avmode_t cm; extern avconfig_t tc; extern avinput_t target_input; @@ -47,16 +47,15 @@ extern alt_u32 sys_ctrl; extern alt_u16 tc_sampler_phase; extern alt_u8 profile_sel, profile_sel_menu; extern alt_u8 lcd_bl_timeout; -extern alt_u8 update_cur_vm, vm_edit; -extern volatile sc_regs *sc; +extern alt_u8 vm_edit; extern volatile osd_regs *osd; extern menu_t menu_scanlines, menu_advtiming; -extern char target_profile_name[PROFILE_NAME_LEN+1]; alt_u32 remote_code; alt_u8 remote_rpt, remote_rpt_prev; alt_u32 btn_code, btn_code_prev; +alt_u8 phase_hotkey_enable; void setup_rc() { @@ -122,13 +121,9 @@ int parse_control() alt_u8 pt_only = 0; avinput_t man_target_input = AV_LAST; - sc_status_reg sc_status; - sc_status2_reg sc_status2; - alt_u32 fpga_v_hz_x100; - // one for each video_group - alt_u8* pmcfg_ptr[] = { &pt_only, &tc.pm_240p, &tc.pm_384p, &tc.pm_480i, &tc.pm_480p, &tc.pm_480p, &tc.pm_1080i }; - alt_u8 valid_pm[] = { 0x1, 0x1f, 0x3, 0xf, 0x3, 0x3, 0x3 }; + alt_u8* pmcfg_ptr[] = { &pt_only, &tc.pm_240p, &tc.pm_240p, &tc.pm_384p, &tc.pm_480i, &tc.pm_480i, &tc.pm_480p, &tc.pm_480p, &pt_only, &tc.pm_1080i, &pt_only }; + alt_u8 valid_pm[] = { 0x1, 0x1f, 0x1f, 0x7, 0xf, 0xf, 0x3, 0x3, 0x1, 0x3, 0x1 }; avinput_t next_input = (cm.avinput == AV3_YPBPR) ? AV1_RGBs : (cm.avinput+1); @@ -169,34 +164,7 @@ int parse_control() break; case RC_INFO: - sc_status = sc->sc_status; - sc_status2 = sc->sc_status2; - fpga_v_hz_x100 = (100*TVP_EXTCLK_HZ)/sc_status2.pcnt_frame; - - if (!menu_active) { - memset((void*)osd->osd_array.data, 0, sizeof(osd_char_array)); - read_userdata(profile_sel, 1); - sniprintf((char*)osd->osd_array.data[0][0], OSD_CHAR_COLS, "Profile:"); - sniprintf((char*)osd->osd_array.data[0][1], OSD_CHAR_COLS, "%u: %s", profile_sel, (target_profile_name[0] == 0) ? "" : target_profile_name); - if (cm.sync_active) { - sniprintf((char*)osd->osd_array.data[1][0], OSD_CHAR_COLS, "Mode preset:"); - sniprintf((char*)osd->osd_array.data[1][1], OSD_CHAR_COLS, "%s", video_modes[cm.id].name); - sniprintf((char*)osd->osd_array.data[2][0], OSD_CHAR_COLS, "Imode (FPGA):"); - sniprintf((char*)osd->osd_array.data[2][1], OSD_CHAR_COLS, "%lu-%c%c %lu.%.2luHz", (unsigned long)sc_status.vmax, - sc_status.interlace_flag ? 'i' : 'p', - sc_status.fpga_vsyncgen ? '*' : ' ', - fpga_v_hz_x100/100, - fpga_v_hz_x100%100); - sniprintf((char*)osd->osd_array.data[3][0], OSD_CHAR_COLS, "Ccnt / frame:"); - sniprintf((char*)osd->osd_array.data[3][1], OSD_CHAR_COLS, "%lu", (unsigned long)sc_status2.pcnt_frame); - } - sniprintf((char*)osd->osd_array.data[4][0], OSD_CHAR_COLS, "Firmware:"); - sniprintf((char*)osd->osd_array.data[4][1], OSD_CHAR_COLS, "%u.%.2u" FW_SUFFIX1 FW_SUFFIX2, FW_VER_MAJOR, FW_VER_MINOR); - osd->osd_config.status_refresh = 1; - osd->osd_row_color.mask = 0; - osd->osd_sec_enable[0].mask = 0x1f; - osd->osd_sec_enable[1].mask = 0x1f; - } + print_vm_stats(); break; case RC_LCDBL: sys_ctrl ^= LCD_BL; @@ -217,8 +185,8 @@ int parse_control() case RC_SL_TYPE: tc.sl_type = (tc.sl_type < SL_TYPE_MAX) ? (tc.sl_type + 1) : 0; if (!menu_active) { - strncpy((char*)osd->osd_array.data[0][0], menu_scanlines.items[7].name, OSD_CHAR_COLS); - strncpy((char*)osd->osd_array.data[1][0], menu_scanlines.items[7].sel.setting_str[tc.sl_type], OSD_CHAR_COLS); + strncpy((char*)osd->osd_array.data[0][0], menu_scanlines.items[5].name, OSD_CHAR_COLS); + strncpy((char*)osd->osd_array.data[1][0], menu_scanlines.items[5].sel.setting_str[tc.sl_type], OSD_CHAR_COLS); osd->osd_config.status_refresh = 1; osd->osd_row_color.mask = 0; osd->osd_sec_enable[0].mask = 3; @@ -259,14 +227,14 @@ int parse_control() break; } - if (video_modes[cm.id].group > GROUP_1080I) { + if (video_modes_plm[cm.id].group > GROUP_1080P) { printf("WARNING: Corrupted mode (id %d)\n", cm.id); break; } if (i <= RC_BTN5) { - if ((1<osd_array.data[0][0], menu_advtiming.items[8].name, OSD_CHAR_COLS); - sniprintf(menu_row2, LCD_ROW_LEN+1, "%d deg", (video_modes[cm.id].sampler_phase*1125)/100); - strncpy((char*)osd->osd_array.data[1][0], menu_row2, OSD_CHAR_COLS); - osd->osd_config.status_refresh = 1; - osd->osd_row_color.mask = 0; - osd->osd_sec_enable[0].mask = 3; - osd->osd_sec_enable[1].mask = 0; - } else if (get_current_menunavi()->m == &menu_advtiming) { - render_osd_page(); + set_sampler_phase(video_modes_plm[cm.id].sampler_phase); + + if (!menu_active) { + strncpy((char*)osd->osd_array.data[0][0], menu_advtiming.items[8].name, OSD_CHAR_COLS); + sampler_phase_disp(video_modes_plm[cm.id].sampler_phase); + strncpy((char*)osd->osd_array.data[1][0], menu_row2, OSD_CHAR_COLS); + osd->osd_config.status_refresh = 1; + osd->osd_row_color.mask = 0; + osd->osd_sec_enable[0].mask = 3; + osd->osd_sec_enable[1].mask = 0; + } else if (get_current_menunavi()->m == &menu_advtiming) { + render_osd_page(); + } } break; case RC_PROF_HOTKEY: diff --git a/software/sys_controller/ossc/firmware.c b/software/sys_controller/ossc/firmware.c index 6be99ed..969700e 100644 --- a/software/sys_controller/ossc/firmware.c +++ b/software/sys_controller/ossc/firmware.c @@ -1,5 +1,5 @@ // -// Copyright (C) 2015-2018 Markus Hiienkari +// Copyright (C) 2015-2023 Markus Hiienkari // // This file is part of Open Source Scan Converter project. // @@ -146,7 +146,7 @@ int fw_update() } //disable video output - tvp_disable_output(); + tvp_powerdown(); sys_ctrl |= VIDGEN_OFF; IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl); usleep(10000); diff --git a/software/sys_controller/ossc/firmware.h b/software/sys_controller/ossc/firmware.h index 2e1389d..40a724f 100644 --- a/software/sys_controller/ossc/firmware.h +++ b/software/sys_controller/ossc/firmware.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2015-2022 Markus Hiienkari +// Copyright (C) 2015-2023 Markus Hiienkari // // This file is part of Open Source Scan Converter project. // @@ -23,14 +23,14 @@ #include "alt_types.h" #include "sysconfig.h" -#define FW_VER_MAJOR 0 -#define FW_VER_MINOR 90 +#define FW_VER_MAJOR 1 +#define FW_VER_MINOR 01 -#define PROFILE_VER_MAJOR 0 -#define PROFILE_VER_MINOR 88 +#define PROFILE_VER_MAJOR 1 +#define PROFILE_VER_MINOR 01 -#define INITCFG_VER_MAJOR 0 -#define INITCFG_VER_MINOR 85 +#define INITCFG_VER_MAJOR 1 +#define INITCFG_VER_MINOR 00 #ifdef ENABLE_AUDIO #define FW_SUFFIX1 "a" diff --git a/software/sys_controller/ossc/menu.c b/software/sys_controller/ossc/menu.c index cb5b90c..8e43cdd 100644 --- a/software/sys_controller/ossc/menu.c +++ b/software/sys_controller/ossc/menu.c @@ -1,5 +1,5 @@ // -// Copyright (C) 2015-2019 Markus Hiienkari +// Copyright (C) 2015-2023 Markus Hiienkari // // This file is part of Open Source Scan Converter project. // @@ -32,15 +32,17 @@ extern char row1[LCD_ROW_LEN+1], row2[LCD_ROW_LEN+1], menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1]; extern avmode_t cm; extern avconfig_t tc; -extern mode_data_t video_modes[]; +extern mode_data_t video_modes_plm[]; extern alt_u32 remote_code; extern alt_u16 rc_keymap[REMOTE_MAX_KEYS]; extern alt_u8 vm_sel, profile_sel_menu, lt_sel, def_input, profile_link, lcd_bl_timeout; extern alt_u8 auto_input, auto_av1_ypbpr, auto_av2_ypbpr, auto_av3_ypbpr; extern alt_u8 update_cur_vm; -extern alt_u8 osd_enable, osd_status_timeout; +extern alt_u8 osd_enable, osd_status_timeout, phase_hotkey_enable; +extern uint8_t sl_def_iv_x, sl_def_iv_y; extern char target_profile_name[PROFILE_NAME_LEN+1]; extern volatile osd_regs *osd; +extern const int num_video_modes_plm; alt_u16 tc_h_samplerate, tc_h_samplerate_adj, tc_h_synclen, tc_h_bporch, tc_h_active, tc_v_synclen, tc_v_bporch, tc_v_active, tc_sampler_phase; alt_u8 menu_active; @@ -58,7 +60,7 @@ static const char *l2l4l5_mode_desc[] = { LNG("Generic 4:3","ジェネリッ static const char *l5_fmt_desc[] = { "1920x1080", "1600x1200", "1920x1200" }; static const char *pm_240p_desc[] = { LNG("Passthru","パススルー"), "Line2x", "Line3x", "Line4x", "Line5x" }; static const char *pm_480i_desc[] = { LNG("Passthru","パススルー"), "Line2x (bob)", "Line3x (laced)", "Line4x (bob)" }; -static const char *pm_384p_desc[] = { LNG("Passthru","パススルー"), "Line2x", "Line2x 240x360", "Line3x 240x360", "Line3x Generic" }; +static const char *pm_384p_desc[] = { LNG("Passthru","パススルー"), "Line2x", "Line3x Generic", "Line2x 240x360", "Line3x 240x360" }; static const char *pm_480p_desc[] = { LNG("Passthru","パススルー"), "Line2x" }; static const char *pm_1080i_desc[] = { LNG("Passthru","パススルー"), "Line2x (bob)" }; static const char *ar_256col_desc[] = { "Pseudo 4:3 DAR", "1:1 PAR" }; @@ -82,6 +84,8 @@ static void intclks_to_time_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, static void extclks_to_time_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%.2u us", (unsigned)(((1000000U*v)/(TVP_EXTCLK_HZ/1000))/1000), (unsigned)((((1000000U*v)/(TVP_EXTCLK_HZ/1000))%1000)/10)); } static void sl_str_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u%%", ((v+1)*625)/100); } static void sl_cust_str_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u%%", ((v)*625)/100); } +static void sl_cust_iv_x_disp(uint8_t v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%s%u%s", (v ? "" : "Auto ("), (v ? v : sl_def_iv_x)+1, (v ? "" : ")")); } +static void sl_cust_iv_y_disp(uint8_t v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%s%u%s", (v ? "" : "Auto ("), (v ? v : sl_def_iv_y)+1, (v ? "" : ")")); } static void sl_hybr_str_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u%%", (v*625)/100); } static void lines_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u lines","%u ライン"), v); } static void pixels_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u pixels","%u ドット"), v); } @@ -89,14 +93,15 @@ static void value_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u", v); static void signed_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%d", (alt_8)(v-SIGNED_NUMVAL_ZERO)); } static void lt_disp(alt_u8 v) { strncpy(menu_row2, lt_desc[v], LCD_ROW_LEN+1); } static void aud_db_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%d dB", ((alt_8)v-AUDIO_GAIN_0DB)); } -static void vm_display_name (alt_u8 v) { strncpy(menu_row2, video_modes[v].name, LCD_ROW_LEN+1); } +static void vm_display_name (alt_u8 v) { strncpy(menu_row2, video_modes_plm[v].name, LCD_ROW_LEN+1); } static void link_av_desc (avinput_t v) { strncpy(menu_row2, v == AV_LAST ? "No link" : avinput_str[v], LCD_ROW_LEN+1); } static void profile_disp(alt_u8 v) { read_userdata(v, 1); sniprintf(menu_row2, LCD_ROW_LEN+1, "%u: %s", v, (target_profile_name[0] == 0) ? "" : target_profile_name); } static void alc_v_filter_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u lines","%u ライン"), (1<","<カクシュタイミング>"), OPT_SUBMENU, { .sub = { &menu_advtiming, &vm_arg_info, vm_select } } }, })) @@ -180,36 +186,34 @@ MENU(menu_output, P99_PROTECT({ \ MENU(menu_scanlines, P99_PROTECT({ \ { LNG("Scanlines","スキャンライン"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_mode, OPT_WRAP, SETTING_ITEM(sl_mode_desc) } } }, { LNG("Sl. strength","スキャンラインツヨサ"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sl_str, OPT_NOWRAP, 0, SCANLINESTR_MAX, sl_str_disp } } }, - { "Sl. hybrid str.", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sl_hybr_str, OPT_NOWRAP, 0, SL_HYBRIDSTR_MAX, sl_hybr_str_disp } } }, + //{ "Sl. hybrid str.", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sl_hybr_str, OPT_NOWRAP, 0, SL_HYBRIDSTR_MAX, sl_hybr_str_disp } } }, { "Sl. method", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_method, OPT_WRAP, SETTING_ITEM(sl_method_desc) } } }, { "Sl. alternating", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_altern, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { LNG("Sl. alignment","スキャンラインポジション"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_id, OPT_WRAP, SETTING_ITEM(sl_id_desc) } } }, - { "Sl. alt interval", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_altiv, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { LNG("Sl. type","スキャンラインルイ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_type, OPT_WRAP, SETTING_ITEM(sl_type_desc) } } }, { "< Custom Sl. >", OPT_SUBMENU, { .sub = { &menu_cust_sl, NULL, NULL } } }, })) MENU(menu_postproc, P99_PROTECT({ \ - { LNG("Horizontal mask","スイヘイマスク"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.h_mask, OPT_NOWRAP, 0, H_MASK_MAX, pixels_disp } } }, - { LNG("Vertical mask","スイチョクマスク"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.v_mask, OPT_NOWRAP, 0, V_MASK_MAX, pixels_disp } } }, + //{ LNG("Horizontal mask","スイヘイマスク"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.h_mask, OPT_NOWRAP, 0, H_MASK_MAX, pixels_disp } } }, + //{ LNG("Vertical mask","スイチョクマスク"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.v_mask, OPT_NOWRAP, 0, V_MASK_MAX, pixels_disp } } }, { "Mask color", OPT_AVCONFIG_SELECTION, { .sel = { &tc.mask_color, OPT_NOWRAP, SETTING_ITEM(mask_color_desc) } } }, { LNG("Mask brightness","マスクアカルサ"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.mask_br, OPT_NOWRAP, 0, HV_MASK_MAX_BR, value_disp } } }, - { LNG("Reverse LPF","ギャクLPF"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.reverse_lpf, OPT_NOWRAP, 0, REVERSE_LPF_MAX, value_disp } } }, - { LNG("","DIYチエンテスト"), OPT_FUNC_CALL, { .fun = { latency_test, <_arg_info } } }, + //{ LNG("Reverse LPF","ギャクLPF"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.reverse_lpf, OPT_NOWRAP, 0, REVERSE_LPF_MAX, value_disp } } }, + //{ LNG("","DIYチエンテスト"), OPT_FUNC_CALL, { .fun = { latency_test, <_arg_info } } }, })) MENU(menu_compatibility, P99_PROTECT({ \ { LNG("Full TX setup","フルTXセットアップ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.full_tx_setup, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, - { LNG("AV3 interlacefix","AV3インターレースシュウセイ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.vga_ilace_fix, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { "AV3 use alt. RGB", OPT_AVCONFIG_SELECTION, { .sel = { &tc.av3_alt_rgb, OPT_WRAP, SETTING_ITEM(av3_alt_rgb_desc) } } }, { "Default HDMI VIC", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.default_vic, OPT_NOWRAP, 0, HDMI_1080p50, value_disp } } }, - { "Panasonic hack", OPT_AVCONFIG_SELECTION, { .sel = { &tc.panasonic_hack, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, })) #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) } } }, + { "Mono mode", OPT_AVCONFIG_SELECTION, { .sel = { &tc.audio_mono, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { "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 } } }, @@ -218,9 +222,6 @@ MENU(menu_audio, P99_PROTECT({ \ #endif MENU(menu_settings, P99_PROTECT({ \ - { LNG("","<プロファイルロード >"), OPT_FUNC_CALL, { .fun = { load_profile, &profile_arg_info } } }, - { LNG("","<プロファイルセーブ >"), OPT_FUNC_CALL, { .fun = { save_profile, &profile_arg_info } } }, - { LNG("","<セッテイヲショキカ >"), OPT_FUNC_CALL, { .fun = { set_default_avconfig, NULL } } }, { LNG("Link prof->input","Link prof->input"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.link_av, OPT_WRAP, AV1_RGBs, AV_LAST, link_av_desc } } }, { LNG("Link input->prof","Link input->prof"), OPT_AVCONFIG_SELECTION, { .sel = { &profile_link, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { LNG("Initial input","ショキニュウリョク"), OPT_AVCONFIG_SELECTION, { .sel = { &def_input, OPT_WRAP, SETTING_ITEM(avinput_str) } } }, @@ -231,6 +232,10 @@ MENU(menu_settings, P99_PROTECT({ \ { "LCD BL timeout", OPT_AVCONFIG_SELECTION, { .sel = { &lcd_bl_timeout, OPT_WRAP, SETTING_ITEM(lcd_bl_timeout_desc) } } }, { "OSD", OPT_AVCONFIG_SELECTION, { .sel = { &osd_enable, OPT_WRAP, SETTING_ITEM(osd_enable_desc) } } }, { "OSD status disp.", OPT_AVCONFIG_SELECTION, { .sel = { &osd_status_timeout, OPT_WRAP, SETTING_ITEM(osd_status_desc) } } }, + { "Phase hotkey", OPT_AVCONFIG_SELECTION, { .sel = { &phase_hotkey_enable, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, + { LNG("","<プロファイルロード >"), OPT_FUNC_CALL, { .fun = { load_profile, &profile_arg_info } } }, + { LNG("","<プロファイルセーブ >"), OPT_FUNC_CALL, { .fun = { save_profile, &profile_arg_info } } }, + { LNG("","<セッテイヲショキカ >"), OPT_FUNC_CALL, { .fun = { set_default_avconfig, NULL } } }, #ifndef DEBUG { LNG("","<セッテイヨミコミ >"), OPT_FUNC_CALL, { .fun = { import_userdata, NULL } } }, { LNG("","<セッテイカキコミ >"), OPT_FUNC_CALL, { .fun = { export_userdata, NULL } } }, @@ -260,6 +265,21 @@ menunavi* get_current_menunavi() { return &navi[navlvl]; } +void init_menu() { + // Set max ids for adv timing + vm_arg_info.max = num_video_modes_plm-1; + + // Setup OSD + osd->osd_config.x_size = 0; + osd->osd_config.y_size = 0; + osd->osd_config.x_offset = 3; + osd->osd_config.y_offset = 3; + osd->osd_config.enable = 1; + osd->osd_config.status_timeout = 1; + osd->osd_config.border_color = 1; + +} + void write_option_value(menuitem_t *item, int func_called, int retval) { switch (item->type) { @@ -450,48 +470,68 @@ void display_menu(alt_u8 forcedisp) ui_disp_menu(0); } -static void vm_select() { - vm_edit = vm_sel; - tc_h_samplerate = video_modes[vm_edit].h_total; - tc_h_samplerate_adj = (alt_u16)video_modes[vm_edit].h_total_adj; - tc_h_synclen = (alt_u16)video_modes[vm_edit].h_synclen; - tc_h_bporch = (alt_u16)video_modes[vm_edit].h_backporch; - tc_h_active = video_modes[vm_edit].h_active; - tc_v_synclen = (alt_u16)video_modes[vm_edit].v_synclen; - tc_v_bporch = (alt_u16)video_modes[vm_edit].v_backporch; - tc_v_active = video_modes[vm_edit].v_active; - tc_sampler_phase = video_modes[vm_edit].sampler_phase; +void update_osd_size(mode_data_t *vm_out) { + uint8_t osd_size = vm_out->timings.v_active / 700; + uint8_t par = (((100*vm_out->timings.h_active*vm_out->ar.v)/((vm_out->timings.v_active<timings.interlaced)*vm_out->ar.h))+50)/100; + uint8_t par_log2 = 0; + + while (par > 1) { + par >>= 1; + par_log2++; + } + + osd->osd_config.x_size = osd_size + vm_out->timings.interlaced + par_log2; + osd->osd_config.y_size = osd_size; + + if (cm.hdmitx_pixr_ifr) + osd->osd_config.x_size += (cm.hdmitx_pixr_ifr+1)/2; + if (cm.tx_pixelrep) + osd->osd_config.x_size -= (cm.tx_pixelrep+1)/2; } -static void vm_tweak(alt_u16 *v) { - if (cm.sync_active && (cm.id == vm_edit)) { - if ((video_modes[cm.id].h_total != tc_h_samplerate) || - (video_modes[cm.id].h_total_adj != (alt_u8)tc_h_samplerate_adj) || - (video_modes[cm.id].h_synclen != tc_h_synclen) || - (video_modes[cm.id].h_backporch != (alt_u8)tc_h_bporch) || - (video_modes[cm.id].h_active != tc_h_active) || - (video_modes[cm.id].v_synclen != tc_v_synclen) || - (video_modes[cm.id].v_backporch != (alt_u8)tc_v_bporch) || - (video_modes[cm.id].v_active != tc_v_active) || - (video_modes[cm.id].sampler_phase != tc_sampler_phase)) +static void vm_select() { + vm_edit = vm_sel; + tc_h_samplerate = video_modes_plm[vm_edit].timings.h_total; + tc_h_samplerate_adj = (uint16_t)video_modes_plm[vm_edit].timings.h_total_adj; + tc_h_synclen = (uint16_t)video_modes_plm[vm_edit].timings.h_synclen; + tc_h_bporch = (uint16_t)video_modes_plm[vm_edit].timings.h_backporch; + tc_h_active = video_modes_plm[vm_edit].timings.h_active; + tc_v_synclen = (uint16_t)video_modes_plm[vm_edit].timings.v_synclen; + tc_v_bporch = (uint16_t)video_modes_plm[vm_edit].timings.v_backporch; + tc_v_active = video_modes_plm[vm_edit].timings.v_active; + tc_sampler_phase = video_modes_plm[vm_edit].sampler_phase; +} + +static void vm_tweak(uint16_t *v) { + int active_mode = (cm.sync_active && (cm.id == vm_edit)); + + if (active_mode) { + if ((video_modes_plm[cm.id].timings.h_total != tc_h_samplerate) || + (video_modes_plm[cm.id].timings.h_total_adj != (uint8_t)tc_h_samplerate_adj) || + (video_modes_plm[cm.id].timings.h_synclen != tc_h_synclen) || + (video_modes_plm[cm.id].timings.h_backporch != (uint8_t)tc_h_bporch) || + (video_modes_plm[cm.id].timings.h_active != tc_h_active) || + (video_modes_plm[cm.id].timings.v_synclen != tc_v_synclen) || + (video_modes_plm[cm.id].timings.v_backporch != (uint8_t)tc_v_bporch) || + (video_modes_plm[cm.id].timings.v_active != tc_v_active)) update_cur_vm = 1; + if (video_modes_plm[cm.id].sampler_phase != tc_sampler_phase) + set_sampler_phase(tc_sampler_phase); } - video_modes[vm_edit].h_total = tc_h_samplerate; - video_modes[vm_edit].h_total_adj = (alt_u8)tc_h_samplerate_adj; - video_modes[vm_edit].h_synclen = (alt_u8)tc_h_synclen; - video_modes[vm_edit].h_backporch = (alt_u8)tc_h_bporch; - video_modes[vm_edit].h_active = tc_h_active; - video_modes[vm_edit].v_synclen = (alt_u8)tc_v_synclen; - video_modes[vm_edit].v_backporch = (alt_u8)tc_v_bporch; - video_modes[vm_edit].v_active = tc_v_active; - video_modes[vm_edit].sampler_phase = tc_sampler_phase; + video_modes_plm[vm_edit].timings.h_total = tc_h_samplerate; + video_modes_plm[vm_edit].timings.h_total_adj = (uint8_t)tc_h_samplerate_adj; + video_modes_plm[vm_edit].timings.h_synclen = (uint8_t)tc_h_synclen; + video_modes_plm[vm_edit].timings.h_backporch = (uint8_t)tc_h_bporch; + video_modes_plm[vm_edit].timings.h_active = tc_h_active; + video_modes_plm[vm_edit].timings.v_synclen = (uint8_t)tc_v_synclen; + video_modes_plm[vm_edit].timings.v_backporch = (uint8_t)tc_v_bporch; + video_modes_plm[vm_edit].timings.v_active = tc_v_active; + video_modes_plm[vm_edit].sampler_phase = tc_sampler_phase; if (v == &tc_sampler_phase) - sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%d deg","%d ド"), ((*v)*1125)/100); - else if (v == &tc_h_samplerate) - sniprintf(menu_row2, LCD_ROW_LEN+1, "%u", video_modes[vm_edit].h_total); - else if (v == &tc_h_samplerate_adj) - sniprintf(menu_row2, LCD_ROW_LEN+1, ".%.2u", video_modes[vm_edit].h_total_adj*5); + sampler_phase_disp(*v); + else if ((v == &tc_h_samplerate) || (v == &tc_h_samplerate_adj)) + sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%.2u", video_modes_plm[vm_edit].timings.h_total, video_modes_plm[vm_edit].timings.h_total_adj*5); else sniprintf(menu_row2, LCD_ROW_LEN+1, "%u", *v); } diff --git a/software/sys_controller/ossc/menu.h b/software/sys_controller/ossc/menu.h index 2485449..5ff77ff 100644 --- a/software/sys_controller/ossc/menu.h +++ b/software/sys_controller/ossc/menu.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2015-2016 Markus Hiienkari +// Copyright (C) 2015-2023 Markus Hiienkari // // This file is part of Open Source Scan Converter project. // @@ -21,7 +21,9 @@ #define MENU_H_ #include "alt_types.h" +#include "sysconfig.h" #include "controls.h" +#include "video_modes.h" #ifdef OSDLANG_JP #define LNG(e, j) j @@ -121,10 +123,12 @@ typedef struct { } menunavi; menunavi* get_current_menunavi(); +void init_menu(); void render_osd_page(); void display_menu(alt_u8 forcedisp); +void sampler_phase_disp(alt_u8 v); +void update_osd_size(mode_data_t *vm_out); static void vm_select(); static void vm_tweak(alt_u16 *v); -static void sampler_phase_tweak(alt_u8 v); #endif diff --git a/software/sys_controller/ossc/userdata.c b/software/sys_controller/ossc/userdata.c index a42a99b..78e371f 100644 --- a/software/sys_controller/ossc/userdata.c +++ b/software/sys_controller/ossc/userdata.c @@ -1,5 +1,5 @@ // -// Copyright (C) 2015-2018 Markus Hiienkari +// Copyright (C) 2015-2023 Markus Hiienkari // // This file is part of Open Source Scan Converter project. // @@ -32,10 +32,15 @@ #include "utils.h" #include "altera_avalon_pio_regs.h" +// include mode array definitions so that sizeof() can be used +#define VM_STATIC_INCLUDE +#include "video_modes_list.c" +#undef VM_STATIC_INCLUDE + extern alt_u16 rc_keymap[REMOTE_MAX_KEYS]; extern avmode_t cm; extern avconfig_t tc; -extern mode_data_t video_modes[]; +extern mode_data_t video_modes_plm[]; extern avinput_t target_input; extern alt_u8 update_cur_vm; extern alt_u8 input_profiles[AV_LAST]; @@ -43,7 +48,7 @@ extern alt_u8 profile_sel; extern alt_u8 def_input, profile_link; extern alt_u8 lcd_bl_timeout; extern alt_u8 auto_input, auto_av1_ypbpr, auto_av2_ypbpr, auto_av3_ypbpr; -extern alt_u8 osd_enable, osd_status_timeout; +extern alt_u8 osd_enable, osd_status_timeout, phase_hotkey_enable; extern SD_DEV sdcard_dev; extern alt_flash_dev *epcq_dev; extern char menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1]; @@ -83,6 +88,7 @@ int write_userdata(alt_u8 entry) ((ude_initcfg*)databuf)->auto_av3_ypbpr = auto_av3_ypbpr; ((ude_initcfg*)databuf)->osd_enable = osd_enable; ((ude_initcfg*)databuf)->osd_status_timeout = osd_status_timeout; + ((ude_initcfg*)databuf)->phase_hotkey_enable = phase_hotkey_enable; memcpy(((ude_initcfg*)databuf)->keys, rc_keymap, sizeof(rc_keymap)); for (i=0; iversion_major = PROFILE_VER_MAJOR; ((ude_hdr*)databuf)->version_minor = PROFILE_VER_MINOR; - vm_to_write = VIDEO_MODES_SIZE; + vm_to_write = sizeof(video_modes_plm_default); ((ude_profile*)databuf)->avc_data_len = sizeof(avconfig_t); ((ude_profile*)databuf)->vm_data_len = vm_to_write; @@ -110,8 +116,8 @@ int write_userdata(alt_u8 entry) memcpy(databuf+pageoffset, &tc, sizeof(avconfig_t)); pageoffset += sizeof(avconfig_t); - // erase sector and write a full page first, assume sizeof(video_modes) >> PAGESIZE - memcpy(databuf+pageoffset, (char*)video_modes, PAGESIZE-pageoffset); + // erase sector and write a full page first, assume sizeof(video_modes_plm) >> PAGESIZE + memcpy(databuf+pageoffset, (char*)video_modes_plm, PAGESIZE-pageoffset); srcoffset = PAGESIZE-pageoffset; vm_to_write -= PAGESIZE-pageoffset; for (i=0; i 0) { - memcpy(databuf, (char*)video_modes+srcoffset, (vm_to_write > PAGESIZE) ? PAGESIZE : vm_to_write); + memcpy(databuf, (char*)video_modes_plm+srcoffset, (vm_to_write > PAGESIZE) ? PAGESIZE : vm_to_write); for (i=0; i PAGESIZE) ? PAGESIZE : vm_to_write); @@ -135,7 +141,7 @@ int write_userdata(alt_u8 entry) pageno++; } - printf("Profile %u data written (%u bytes)\n", entry, sizeof(avconfig_t)+VIDEO_MODES_SIZE); + printf("Profile %u data written (%u bytes)\n", entry, sizeof(avconfig_t)+sizeof(video_modes_plm_default)); break; default: break; @@ -197,6 +203,7 @@ int read_userdata(alt_u8 entry, int dry_run) profile_link = ((ude_initcfg*)databuf)->profile_link; profile_sel = input_profiles[AV_TESTPAT]; // Global profile lcd_bl_timeout = ((ude_initcfg*)databuf)->lcd_bl_timeout; + phase_hotkey_enable = ((ude_initcfg*)databuf)->phase_hotkey_enable; memcpy(rc_keymap, ((ude_initcfg*)databuf)->keys, sizeof(rc_keymap)); printf("RC data read (%u bytes)\n", sizeof(rc_keymap)); } @@ -206,7 +213,7 @@ int read_userdata(alt_u8 entry, int dry_run) printf("Profile version %u.%u does not match current one\n", ((ude_hdr*)databuf)->version_major, ((ude_hdr*)databuf)->version_minor); return 2; } - if ((((ude_profile*)databuf)->avc_data_len == sizeof(avconfig_t)) && (((ude_profile*)databuf)->vm_data_len == VIDEO_MODES_SIZE)) { + if ((((ude_profile*)databuf)->avc_data_len == sizeof(avconfig_t)) && (((ude_profile*)databuf)->vm_data_len == sizeof(video_modes_plm_default))) { strncpy(target_profile_name, ((ude_profile*)databuf)->name, PROFILE_NAME_LEN+1); if (dry_run) return 0; @@ -223,7 +230,7 @@ int read_userdata(alt_u8 entry, int dry_run) dstoffset = 0; while (vm_to_read > 0) { if (vm_to_read >= PAGESIZE-pageoffset) { - memcpy((char*)video_modes+dstoffset, databuf+pageoffset, PAGESIZE-pageoffset); + memcpy((char*)video_modes_plm+dstoffset, databuf+pageoffset, PAGESIZE-pageoffset); dstoffset += PAGESIZE-pageoffset; vm_to_read -= PAGESIZE-pageoffset; pageoffset = 0; @@ -235,14 +242,14 @@ int read_userdata(alt_u8 entry, int dry_run) if (retval != 0) return retval; } else { - memcpy((char*)video_modes+dstoffset, databuf+pageoffset, vm_to_read); + memcpy((char*)video_modes_plm+dstoffset, databuf+pageoffset, vm_to_read); pageoffset += vm_to_read; vm_to_read = 0; } } update_cur_vm = 1; - printf("Profile %u data read (%u bytes)\n", entry, sizeof(avconfig_t)+VIDEO_MODES_SIZE); + printf("Profile %u data read (%u bytes)\n", entry, sizeof(avconfig_t)+sizeof(video_modes_plm_default)); } break; default: diff --git a/software/sys_controller/ossc/userdata.h b/software/sys_controller/ossc/userdata.h index 9d9db0a..e1de9da 100644 --- a/software/sys_controller/ossc/userdata.h +++ b/software/sys_controller/ossc/userdata.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2015-2018 Markus Hiienkari +// Copyright (C) 2015-2023 Markus Hiienkari // // This file is part of Open Source Scan Converter project. // @@ -62,6 +62,7 @@ typedef struct { alt_u8 auto_av3_ypbpr; alt_u8 osd_enable; alt_u8 osd_status_timeout; + alt_u8 phase_hotkey_enable; alt_u16 keys[REMOTE_MAX_KEYS]; } __attribute__((packed, __may_alias__)) ude_initcfg; @@ -71,7 +72,7 @@ typedef struct { alt_u16 avc_data_len; alt_u16 vm_data_len; avconfig_t avc; - mode_data_t vm[VIDEO_MODES_CNT]; + //mode_data_t vm[VIDEO_MODES_CNT]; } __attribute__((packed, __may_alias__)) ude_profile; int write_userdata(alt_u8 entry);