mirror of
https://github.com/marqs85/ossc
synced 2025-04-18 19:12:40 +03:00
* L3 optimized mode scanlines fixed
* Advanced timing tweaker implemented
This commit is contained in:
parent
a488422089
commit
827df7930f
2
ossc.sdc
2
ossc.sdc
@ -77,7 +77,7 @@ set_false_path -from pclk_3x_M1 -through $clkmuxnodes -to pclk_4x_M1
|
||||
set_false_path -from [get_cells {scanconverter_inst|H_* scanconverter_inst|V_* scanconverter:scanconverter_inst|lines_*}]
|
||||
|
||||
# Ignore paths from registers which are updated only at the end of hsync
|
||||
set_false_path -from [get_cells {scanconverter:scanconverter_inst|vcnt_* scanconverter:scanconverter_inst|line_idx}]
|
||||
set_false_path -from [get_cells {scanconverter:scanconverter_inst|vcnt_* scanconverter:scanconverter_inst|line_idx scanconverter:scanconverter_inst|line_out_idx*}]
|
||||
|
||||
# Ignore following clock transfers
|
||||
set_false_path -from [get_clocks pclk_2x] -to [get_clocks pclk_sdtv]
|
||||
|
27
rtl/ossc.v
27
rtl/ossc.v
@ -18,6 +18,7 @@
|
||||
//
|
||||
|
||||
//`define DEBUG
|
||||
//`define INPUTLATCH
|
||||
`define VIDEOGEN
|
||||
|
||||
module ossc (
|
||||
@ -83,6 +84,21 @@ wire [7:0] lcd_ctrl;
|
||||
reg [3:0] reset_n_ctr;
|
||||
reg reset_n_reg = 1'b1;
|
||||
|
||||
`ifdef INPUTLATCH
|
||||
reg HSYNC_in_l, VSYNC_in_l, FID_in_l;
|
||||
reg [7:0] R_in_l, G_in_l, B_in_l;
|
||||
|
||||
always @(posedge PCLK_in)
|
||||
begin
|
||||
HSYNC_in_l <= HSYNC_in;
|
||||
VSYNC_in_l <= VSYNC_in;
|
||||
FID_in_l <= FID_in;
|
||||
R_in_l <= R_in;
|
||||
G_in_l <= G_in;
|
||||
B_in_l <= B_in;
|
||||
end
|
||||
`endif
|
||||
|
||||
`ifdef DEBUG
|
||||
assign LED_R = HSYNC_in;
|
||||
assign LED_G = VSYNC_in;
|
||||
@ -149,13 +165,22 @@ sys sys_inst(
|
||||
|
||||
scanconverter scanconverter_inst (
|
||||
.reset_n (reset_n),
|
||||
.PCLK_in (PCLK_in),
|
||||
`ifdef INPUTLATCH
|
||||
.HSYNC_in (HSYNC_in_l),
|
||||
.VSYNC_in (VSYNC_in_l),
|
||||
.FID_in (FID_in_l),
|
||||
.R_in (R_in_l),
|
||||
.G_in (G_in_l),
|
||||
.B_in (B_in_l),
|
||||
`else
|
||||
.HSYNC_in (HSYNC_in),
|
||||
.VSYNC_in (VSYNC_in),
|
||||
.PCLK_in (PCLK_in),
|
||||
.FID_in (FID_in),
|
||||
.R_in (R_in),
|
||||
.G_in (G_in),
|
||||
.B_in (B_in),
|
||||
`endif
|
||||
.h_info (h_info),
|
||||
.v_info (v_info),
|
||||
.R_out (R_out),
|
||||
|
@ -120,7 +120,7 @@ reg h_enable_3x, h_enable_3x_h1x, v_enable_3x, v_enable_3x_h1x;
|
||||
reg prev_hs, prev_vs;
|
||||
reg [11:0] hmax[0:1];
|
||||
reg line_idx;
|
||||
reg [1:0] line_out_idx_2x, line_out_idx_3x;
|
||||
reg [1:0] line_out_idx_2x, line_out_idx_3x, line_out_idx_3x_h1x;
|
||||
|
||||
reg [23:0] warn_h_unstable, warn_pll_lock_lost, warn_pll_lock_lost_3x, warn_pll_lock_lost_3x_lowfreq;
|
||||
|
||||
@ -141,7 +141,6 @@ reg [7:0] R_1x, G_1x, B_1x, R_pp1, G_pp1, B_pp1;
|
||||
wire [7:0] R_lbuf, G_lbuf, B_lbuf;
|
||||
wire [7:0] R_act, G_act, B_act;
|
||||
|
||||
|
||||
assign pclk_1x = PCLK_in;
|
||||
assign pclk_lock = {pclk_2x_lock, pclk_3x_lock, pclk_3x_lowfreq_lock};
|
||||
|
||||
@ -246,7 +245,6 @@ begin
|
||||
G_act = G_lbuf;
|
||||
B_act = B_lbuf;
|
||||
VSYNC_act = VSYNC_1x;
|
||||
slid_act = line_out_idx_3x;
|
||||
case (H_L3MODE)
|
||||
`LINETRIPLE_M0: begin
|
||||
DATA_enable_act = (h_enable_3x & v_enable_3x);
|
||||
@ -256,6 +254,7 @@ begin
|
||||
linebuf_rdclock = pclk_3x;
|
||||
linebuf_hoffset = hcnt_3x;
|
||||
pclk_act = pclk_3x;
|
||||
slid_act = line_out_idx_3x;
|
||||
hcnt_act = hcnt_3x;
|
||||
vcnt_act = vcnt_3x/2'h3; //divider generated
|
||||
end
|
||||
@ -267,6 +266,7 @@ begin
|
||||
linebuf_rdclock = pclk_4x;
|
||||
linebuf_hoffset = hcnt_4x;
|
||||
pclk_act = pclk_4x;
|
||||
slid_act = line_out_idx_3x;
|
||||
hcnt_act = hcnt_4x;
|
||||
vcnt_act = vcnt_3x/2'h3; //divider generated
|
||||
end
|
||||
@ -278,6 +278,7 @@ begin
|
||||
linebuf_rdclock = pclk_3x_h4x;
|
||||
linebuf_hoffset = hcnt_3x_h4x;
|
||||
pclk_act = pclk_3x_h4x;
|
||||
slid_act = line_out_idx_3x_h1x;
|
||||
hcnt_act = hcnt_3x_h4x;
|
||||
vcnt_act = vcnt_3x_h1x/2'h3; //divider generated
|
||||
end
|
||||
@ -289,6 +290,7 @@ begin
|
||||
linebuf_rdclock = pclk_3x_h5x;
|
||||
linebuf_hoffset = hcnt_3x_h5x;
|
||||
pclk_act = pclk_3x_h5x;
|
||||
slid_act = line_out_idx_3x_h1x;
|
||||
hcnt_act = hcnt_3x_h5x;
|
||||
vcnt_act = vcnt_3x_h1x/2'h3; //divider generated
|
||||
end
|
||||
@ -682,13 +684,20 @@ begin
|
||||
v_enable_3x_h1x <= 0;
|
||||
pclk_3x_h1x_cnt <= 0;
|
||||
pclk_1x_prev3x_h1x <= 0;
|
||||
line_out_idx_3x_h1x <= 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if ((pclk_3x_h1x_cnt == 0) & `HSYNC_TRAILING_EDGE) //sync with posedge of pclk_1x
|
||||
hcnt_3x_h1x <= 0;
|
||||
begin
|
||||
hcnt_3x_h1x <= 0;
|
||||
line_out_idx_3x_h1x <= 0;
|
||||
end
|
||||
else if (hcnt_3x_h1x == hmax[~line_idx]) //line_idx_prev?
|
||||
hcnt_3x_h1x <= 0;
|
||||
begin
|
||||
hcnt_3x_h1x <= 0;
|
||||
line_out_idx_3x_h1x <= line_out_idx_3x_h1x + 1'b1;
|
||||
end
|
||||
else
|
||||
hcnt_3x_h1x <= hcnt_3x_h1x + 1'b1;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -57,11 +57,15 @@ extern alt_u32 remote_code;
|
||||
extern alt_u32 btn_code, btn_code_prev;
|
||||
extern alt_u8 remote_rpt, remote_rpt_prev;
|
||||
extern avconfig_t tc;
|
||||
extern alt_u8 video_mode_cnt;
|
||||
|
||||
alt_u8 target_typemask;
|
||||
alt_u8 target_type;
|
||||
alt_u8 stable_frames;
|
||||
|
||||
alt_u8 vm_sel, vm_edit;
|
||||
alt_u16 tc_h_samplerate, tc_h_synclen, tc_h_active, tc_v_active, tc_h_bporch, tc_v_bporch;
|
||||
|
||||
char row1[LCD_ROW_LEN+1], row2[LCD_ROW_LEN+1], menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1];
|
||||
|
||||
extern alt_u8 menu_active;
|
||||
@ -360,6 +364,7 @@ void program_mode()
|
||||
printf ("Error: no suitable mode found, defaulting to 240p\n");
|
||||
cm.id = 4;
|
||||
}
|
||||
vm_sel = cm.id;
|
||||
|
||||
target_type = target_typemask & video_modes[cm.id].type;
|
||||
|
||||
@ -370,6 +375,61 @@ void program_mode()
|
||||
set_videoinfo();
|
||||
}
|
||||
|
||||
void vm_display(alt_u8 code) {
|
||||
switch ((menucode_id)code) {
|
||||
case VAL_MINUS:
|
||||
vm_sel = (vm_sel > 0) ? vm_sel-1 : vm_sel;
|
||||
break;
|
||||
case VAL_PLUS:
|
||||
vm_sel = (vm_sel < video_mode_cnt-1) ? vm_sel+1 : vm_sel;
|
||||
break;
|
||||
case OPT_SELECT:
|
||||
vm_edit = vm_sel;
|
||||
tc_h_samplerate = video_modes[vm_edit].h_total;
|
||||
tc_h_synclen = (alt_u16)video_modes[vm_edit].h_synclen;
|
||||
tc_h_active = video_modes[vm_edit].h_active;
|
||||
tc_v_active = video_modes[vm_edit].v_active;
|
||||
tc_h_bporch = (alt_u16)video_modes[vm_edit].h_backporch;
|
||||
tc_v_bporch = (alt_u16)video_modes[vm_edit].v_backporch;
|
||||
break;
|
||||
case NO_ACTION:
|
||||
default:
|
||||
strncpy(menu_row2, video_modes[vm_sel].name, LCD_ROW_LEN+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void vm_tweak(alt_u16 v) {
|
||||
alt_u16 h_samplerate;
|
||||
|
||||
if (cm.id == vm_edit) {
|
||||
if (video_modes[cm.id].h_total != tc_h_samplerate) {
|
||||
if (video_modes[cm.id].flags & MODE_PLLDIVBY2)
|
||||
h_samplerate = 2*video_modes[cm.id].h_total;
|
||||
else
|
||||
h_samplerate = video_modes[cm.id].h_total;
|
||||
|
||||
tvp_writereg(TVP_HPLLDIV_LSB, ((h_samplerate & 0xf) << 4));
|
||||
tvp_writereg(TVP_HPLLDIV_MSB, (h_samplerate >> 4));
|
||||
}
|
||||
if (video_modes[cm.id].h_synclen != tc_h_synclen)
|
||||
tvp_writereg(TVP_HSOUTWIDTH, video_modes[cm.id].h_synclen);
|
||||
if ((video_modes[cm.id].h_active != tc_h_active) ||
|
||||
(video_modes[cm.id].v_active != tc_v_active) ||
|
||||
(video_modes[cm.id].h_backporch != (alt_u8)tc_h_bporch) ||
|
||||
(video_modes[cm.id].v_backporch != (alt_u8)tc_v_bporch))
|
||||
set_videoinfo();
|
||||
}
|
||||
video_modes[vm_edit].h_total = tc_h_samplerate;
|
||||
video_modes[vm_edit].h_synclen = (alt_u8)tc_h_synclen;
|
||||
video_modes[vm_edit].h_active = tc_h_active;
|
||||
video_modes[vm_edit].v_active = tc_v_active;
|
||||
video_modes[vm_edit].h_backporch = (alt_u8)tc_h_bporch;
|
||||
video_modes[vm_edit].v_backporch = (alt_u8)tc_v_bporch;
|
||||
|
||||
sniprintf(menu_row2, LCD_ROW_LEN+1, "%u", v);
|
||||
}
|
||||
|
||||
// Initialize hardware
|
||||
int init_hw()
|
||||
{
|
||||
|
@ -70,4 +70,7 @@ typedef struct {
|
||||
inline void lcd_write_menu();
|
||||
inline void lcd_write_status();
|
||||
|
||||
void vm_display(alt_u8 code);
|
||||
void vm_tweak(alt_u16 v);
|
||||
|
||||
#endif
|
||||
|
@ -29,6 +29,9 @@
|
||||
#define DEFAULT_SAMPLER_PHASE 16
|
||||
#define DEFAULT_SYNC_VTH 11
|
||||
|
||||
extern mode_data_t video_modes[], video_modes_def[];
|
||||
extern alt_u8 video_mode_cnt;
|
||||
|
||||
// Target configuration
|
||||
avconfig_t tc;
|
||||
|
||||
@ -48,5 +51,7 @@ int set_default_avconfig()
|
||||
memcpy(&tc, &tc_default, sizeof(avconfig_t));
|
||||
tc.tx_mode = !!(IORD_ALTERA_AVALON_PIO_DATA(PIO_1_BASE) & HDMITX_MODE_MASK);
|
||||
|
||||
memcpy(video_modes, video_modes_def, video_mode_cnt*sizeof(mode_data_t));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
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 avconfig_t tc;
|
||||
extern alt_u16 tc_h_samplerate, tc_h_synclen, tc_h_active, tc_v_active, tc_h_bporch, tc_v_bporch;
|
||||
extern alt_u32 remote_code;
|
||||
extern alt_u16 rc_keymap[REMOTE_MAX_KEYS];
|
||||
|
||||
@ -55,6 +56,16 @@ static void sl_str_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u%%",
|
||||
static void lines_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u lines", v); }
|
||||
static void pixels_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u pixels", v); }
|
||||
|
||||
MENU(menu_advtiming, P99_PROTECT({ \
|
||||
{ "H. samplerate", OPT_AVCONFIG_NUMVAL_U16,{ .num_u16 = { &tc_h_samplerate, H_TOTAL_MIN, H_TOTAL_MAX, vm_tweak } } },
|
||||
{ "H. synclen", OPT_AVCONFIG_NUMVAL_U16,{ .num_u16 = { &tc_h_synclen, H_SYNCLEN_MIN, H_SYNCLEN_MAX, vm_tweak } } },
|
||||
{ "H. active", OPT_AVCONFIG_NUMVAL_U16,{ .num_u16 = { &tc_h_active, H_ACTIVE_MIN, H_ACTIVE_MAX, vm_tweak } } },
|
||||
{ "V. active", OPT_AVCONFIG_NUMVAL_U16,{ .num_u16 = { &tc_v_active, V_ACTIVE_MIN, V_ACTIVE_MAX, vm_tweak } } },
|
||||
{ "H. backporch", OPT_AVCONFIG_NUMVAL_U16,{ .num_u16 = { &tc_h_bporch, H_BPORCH_MIN, H_BPORCH_MAX, vm_tweak } } },
|
||||
{ "V. backporch", OPT_AVCONFIG_NUMVAL_U16,{ .num_u16 = { &tc_v_bporch, V_BPORCH_MIN, V_BPORCH_MAX, vm_tweak } } },
|
||||
}))
|
||||
|
||||
|
||||
MENU(menu_vinputproc, P99_PROTECT({ \
|
||||
{ "Video LPF", OPT_AVCONFIG_SELECTION, { .sel = { &tc.video_lpf, OPT_WRAP, SETTING_ITEM(video_lpf_desc) } } },
|
||||
{ "YPbPr in ColSpa", OPT_AVCONFIG_SELECTION, { .sel = { &tc.ypbpr_cs, OPT_WRAP, SETTING_ITEM(ypbpr_cs_desc) } } },
|
||||
@ -64,14 +75,14 @@ MENU(menu_vinputproc, P99_PROTECT({ \
|
||||
MENU(menu_sampling, P99_PROTECT({ \
|
||||
{ "Sampling phase", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sampler_phase, OPT_NOWRAP, 0, SAMPLER_PHASE_MAX, sampler_phase_disp } } },
|
||||
{ "480p in sampler", OPT_AVCONFIG_SELECTION, { .sel = { &tc.s480p_mode, OPT_WRAP, SETTING_ITEM(s480p_mode_desc) } } },
|
||||
//{ "Modeparam editor", OPT_SUBMENU, { .sub = NULL } },
|
||||
{ "<Adv. timing >", OPT_SUBMENU, { .sub = { &menu_advtiming, vm_display } } }, \
|
||||
}))
|
||||
|
||||
MENU(menu_sync, P99_PROTECT({ \
|
||||
{ "Analog sync LPF", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sync_lpf, OPT_WRAP, SETTING_ITEM(sync_lpf_desc) } } },
|
||||
{ "Analog sync Vth", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sync_vth, OPT_NOWRAP, 0, SYNC_VTH_MAX, sync_vth_disp } } },
|
||||
{ "Hsync window len", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sd_sync_win, OPT_NOWRAP, 0, SD_SYNC_WIN_MAX, extclks_to_time_disp } } },
|
||||
{ "Vsync threshold", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.vsync_thold, OPT_NOWRAP, VSYNC_THOLD_MIN, VSYNC_THOLD_MAX, intclks_to_time_disp } } },
|
||||
{ "GlitchFilter len", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sd_sync_win, OPT_NOWRAP, 0, SD_SYNC_WIN_MAX, extclks_to_time_disp } } },
|
||||
{ "H-PLL Pre-Coast", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.pre_coast, OPT_NOWRAP, 0, PLL_COAST_MAX, lines_disp } } },
|
||||
{ "H-PLL Post-Coast", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.post_coast, OPT_NOWRAP, 0, PLL_COAST_MAX, lines_disp } } },
|
||||
}))
|
||||
@ -89,24 +100,25 @@ MENU(menu_postproc, P99_PROTECT({ \
|
||||
{ "Scanlines", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_mode, OPT_WRAP, SETTING_ITEM(sl_mode_desc) } } },
|
||||
{ "Scanline str.", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sl_str, OPT_NOWRAP, 0, SCANLINESTR_MAX, sl_str_disp } } },
|
||||
{ "Scanline type", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_type, OPT_WRAP, SETTING_ITEM(sl_type_desc) } } },
|
||||
{ "Scanline id.", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_id, OPT_WRAP, SETTING_ITEM(sl_id_desc) } } },
|
||||
{ "Scanline alignm.", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_id, OPT_WRAP, SETTING_ITEM(sl_id_desc) } } },
|
||||
{ "Horizontal mask", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.h_mask, OPT_NOWRAP, 0, HV_MASK_MAX, pixels_disp } } },
|
||||
{ "Vertical mask", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.v_mask, OPT_NOWRAP, 0, HV_MASK_MAX, pixels_disp } } },
|
||||
}))
|
||||
|
||||
|
||||
MENU(menu_main, P99_PROTECT({ \
|
||||
{ "Video in proc >", OPT_SUBMENU, { .sub = &menu_vinputproc } }, \
|
||||
{ "Sampling opt. >", OPT_SUBMENU, { .sub = &menu_sampling } }, \
|
||||
{ "Sync opt. >", OPT_SUBMENU, { .sub = &menu_sync } }, \
|
||||
{ "Output opt. >", OPT_SUBMENU, { .sub = &menu_output } }, \
|
||||
{ "Post-proc. >", OPT_SUBMENU, { .sub = &menu_postproc } }, \
|
||||
{ "Fw. update >", OPT_FUNC_CALL, { .fun = { fw_update, "OK - pls restart" } } }, \
|
||||
{ "Video in proc >", OPT_SUBMENU, { .sub = { &menu_vinputproc, NULL } } }, \
|
||||
{ "Sampling opt. >", OPT_SUBMENU, { .sub = { &menu_sampling, NULL } } }, \
|
||||
{ "Sync opt. >", OPT_SUBMENU, { .sub = { &menu_sync, NULL } } }, \
|
||||
{ "Output opt. >", OPT_SUBMENU, { .sub = { &menu_output, NULL } } }, \
|
||||
{ "Post-proc. >", OPT_SUBMENU, { .sub = { &menu_postproc, NULL } } }, \
|
||||
{ "<Fw. update >", OPT_FUNC_CALL, { .fun = { fw_update, "OK - pls restart" } } }, \
|
||||
{ "<Reset settings>", OPT_FUNC_CALL, { .fun = { set_default_avconfig, "Reset done" } } }, \
|
||||
{ "<Save settings >", OPT_FUNC_CALL, { .fun = { write_userdata, "Saved" } } }, \
|
||||
}))
|
||||
|
||||
// Max 2 levels currently
|
||||
menunavi navi[] = {{&menu_main, 0}, {NULL, 0}};
|
||||
// Max 3 levels currently
|
||||
menunavi navi[] = {{&menu_main, 0}, {NULL, 0}, {NULL, 0}};
|
||||
alt_u8 navlvl = 0;
|
||||
|
||||
|
||||
@ -115,6 +127,7 @@ void display_menu(alt_u8 forcedisp)
|
||||
menucode_id code = NO_ACTION;
|
||||
menuitem_type type;
|
||||
alt_u8 *val, val_wrap, val_min, val_max;
|
||||
alt_u16 *val_u16;
|
||||
int i, retval = 0;
|
||||
|
||||
for (i=RC_OK; i < RC_INFO; i++) {
|
||||
@ -149,9 +162,11 @@ void display_menu(alt_u8 forcedisp)
|
||||
case OPT_SELECT:
|
||||
switch (navi[navlvl].m->items[navi[navlvl].mp].type) {
|
||||
case OPT_SUBMENU:
|
||||
if (navi[navlvl+1].m != navi[navlvl].m->items[navi[navlvl].mp].sub)
|
||||
if (navi[navlvl+1].m != navi[navlvl].m->items[navi[navlvl].mp].sub.menu)
|
||||
navi[navlvl+1].mp = 0;
|
||||
navi[navlvl+1].m = navi[navlvl].m->items[navi[navlvl].mp].sub;
|
||||
navi[navlvl+1].m = navi[navlvl].m->items[navi[navlvl].mp].sub.menu;
|
||||
if (navi[navlvl].m->items[navi[navlvl].mp].sub.arg_f)
|
||||
navi[navlvl].m->items[navi[navlvl].mp].sub.arg_f(code);
|
||||
navlvl++;
|
||||
break;
|
||||
case OPT_FUNC_CALL:
|
||||
@ -163,16 +178,32 @@ void display_menu(alt_u8 forcedisp)
|
||||
break;
|
||||
case VAL_MINUS:
|
||||
case VAL_PLUS:
|
||||
if ((type == OPT_AVCONFIG_SELECTION) || (type == OPT_AVCONFIG_NUMVALUE)) {
|
||||
val = navi[navlvl].m->items[navi[navlvl].mp].sel.data;
|
||||
val_wrap = navi[navlvl].m->items[navi[navlvl].mp].sel.wrap_cfg;
|
||||
val_min = navi[navlvl].m->items[navi[navlvl].mp].sel.min;
|
||||
val_max = navi[navlvl].m->items[navi[navlvl].mp].sel.max;
|
||||
switch (navi[navlvl].m->items[navi[navlvl].mp].type) {
|
||||
case OPT_AVCONFIG_SELECTION:
|
||||
case OPT_AVCONFIG_NUMVALUE:
|
||||
val = navi[navlvl].m->items[navi[navlvl].mp].sel.data;
|
||||
val_wrap = navi[navlvl].m->items[navi[navlvl].mp].sel.wrap_cfg;
|
||||
val_min = navi[navlvl].m->items[navi[navlvl].mp].sel.min;
|
||||
val_max = navi[navlvl].m->items[navi[navlvl].mp].sel.max;
|
||||
|
||||
if (code == VAL_MINUS)
|
||||
*val = (*val > val_min) ? (*val-1) : (val_wrap ? val_max : val_min);
|
||||
else
|
||||
*val = (*val < val_max) ? (*val+1) : (val_wrap ? val_min : val_max);
|
||||
if (code == VAL_MINUS)
|
||||
*val = (*val > val_min) ? (*val-1) : (val_wrap ? val_max : val_min);
|
||||
else
|
||||
*val = (*val < val_max) ? (*val+1) : (val_wrap ? val_min : val_max);
|
||||
break;
|
||||
case OPT_AVCONFIG_NUMVAL_U16:
|
||||
val_u16 = navi[navlvl].m->items[navi[navlvl].mp].num_u16.data;
|
||||
if (code == VAL_MINUS)
|
||||
*val_u16 = (*val_u16 > navi[navlvl].m->items[navi[navlvl].mp].num_u16.min) ? (*val_u16-1) : *val_u16;
|
||||
else
|
||||
*val_u16 = (*val_u16 < navi[navlvl].m->items[navi[navlvl].mp].num_u16.max) ? (*val_u16+1) : *val_u16;
|
||||
break;
|
||||
case OPT_SUBMENU:
|
||||
if (navi[navlvl].m->items[navi[navlvl].mp].sub.arg_f)
|
||||
navi[navlvl].m->items[navi[navlvl].mp].sub.arg_f(code);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -187,22 +218,26 @@ void display_menu(alt_u8 forcedisp)
|
||||
strncpy(menu_row2, navi[navlvl].m->items[navi[navlvl].mp].sel.setting_str[*(navi[navlvl].m->items[navi[navlvl].mp].sel.data)], LCD_ROW_LEN+1);
|
||||
break;
|
||||
case OPT_AVCONFIG_NUMVALUE:
|
||||
navi[navlvl].m->items[navi[navlvl].mp].num.f(*(navi[navlvl].m->items[navi[navlvl].mp].num.data));
|
||||
navi[navlvl].m->items[navi[navlvl].mp].num.df(*(navi[navlvl].m->items[navi[navlvl].mp].num.data));
|
||||
break;
|
||||
case OPT_AVCONFIG_NUMVAL_U16:
|
||||
navi[navlvl].m->items[navi[navlvl].mp].num_u16.df(*(navi[navlvl].m->items[navi[navlvl].mp].num_u16.data));
|
||||
break;
|
||||
case OPT_SUBMENU:
|
||||
menu_row2[0] = 0;
|
||||
if (navi[navlvl].m->items[navi[navlvl].mp].sub.arg_f)
|
||||
navi[navlvl].m->items[navi[navlvl].mp].sub.arg_f(NO_ACTION);
|
||||
else
|
||||
menu_row2[0] = 0;
|
||||
break;
|
||||
case OPT_FUNC_CALL:
|
||||
if (code == OPT_SELECT)
|
||||
sniprintf(menu_row2, LCD_ROW_LEN+1, "%s", (retval==0) ? navi[navlvl].m->items[navi[navlvl].mp].fun.text_success : "failed");
|
||||
else
|
||||
menu_row2[0] = 0;
|
||||
menu_row2[0] = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lcd_write_menu();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -26,12 +26,14 @@
|
||||
typedef enum {
|
||||
OPT_AVCONFIG_SELECTION,
|
||||
OPT_AVCONFIG_NUMVALUE,
|
||||
OPT_AVCONFIG_NUMVAL_U16,
|
||||
OPT_SUBMENU,
|
||||
OPT_FUNC_CALL,
|
||||
} menuitem_type;
|
||||
|
||||
typedef int (*func_call)(void);
|
||||
typedef void (*disp_func)(alt_u8);
|
||||
typedef void (*disp_func_u16)(alt_u16);
|
||||
|
||||
|
||||
typedef struct {
|
||||
@ -47,9 +49,16 @@ typedef struct {
|
||||
alt_u8 wrap_cfg;
|
||||
alt_u8 min;
|
||||
alt_u8 max;
|
||||
disp_func f;
|
||||
disp_func df;
|
||||
} opt_avconfig_numvalue;
|
||||
|
||||
typedef struct {
|
||||
alt_u16 *data;
|
||||
alt_u16 min;
|
||||
alt_u16 max;
|
||||
disp_func_u16 df;
|
||||
} opt_avconfig_numvalue_u16;
|
||||
|
||||
typedef struct {
|
||||
func_call f;
|
||||
char *text_success;
|
||||
@ -57,13 +66,19 @@ typedef struct {
|
||||
|
||||
typedef struct menustruct menu_t;
|
||||
|
||||
typedef struct {
|
||||
const menu_t *menu;
|
||||
disp_func arg_f;
|
||||
} opt_submenu;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
menuitem_type type;
|
||||
union {
|
||||
opt_avconfig_selection sel;
|
||||
opt_avconfig_numvalue num;
|
||||
const menu_t *sub;
|
||||
opt_avconfig_numvalue_u16 num_u16;
|
||||
opt_submenu sub;
|
||||
opt_func_call fun;
|
||||
};
|
||||
} menuitem_t;
|
||||
@ -73,10 +88,6 @@ struct menustruct {
|
||||
menuitem_t *items;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
menu_t *menu;
|
||||
} opt_submenu;
|
||||
|
||||
#define SETTING_ITEM(x) 0, sizeof(x)/sizeof(char*)-1, x
|
||||
#define MENU(X, Y) menuitem_t X##_items[] = Y; const menu_t X = { sizeof(X##_items)/sizeof(menuitem_t), X##_items };
|
||||
#define P99_PROTECT(...) __VA_ARGS__
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#define LINECNT_MAX_TOLERANCE 30
|
||||
|
||||
const mode_data_t video_modes[] = {
|
||||
const mode_data_t video_modes_def[] = {
|
||||
{ "240p_L3M0", 1280, 240, 6000, 1560, 262, 170, 16, 72, 3, (VIDEO_SDTV|VIDEO_PC), (MODE_L3_MODE0|MODE_PLLDIVBY2) },
|
||||
{ "240p_L3M1", 960, 240, 6000, 1170, 262, 128, 16, 54, 3, (VIDEO_SDTV|VIDEO_PC), (MODE_L3_MODE1|MODE_PLLDIVBY2) },
|
||||
//{ "240p_L3M2", 384, 240, 6000, 512, 262, 66, 16, 31, 3, (VIDEO_LDTV|VIDEO_PC), (MODE_L3_MODE2|MODE_PLLDIVBY2) }, //CPS2
|
||||
@ -54,6 +54,11 @@ const mode_data_t video_modes[] = {
|
||||
{ "1920x1080", 1920, 1080, 6000, 2200, 1125, 148, 36, 44, 5, VIDEO_PC, 0 },
|
||||
};
|
||||
|
||||
mode_data_t video_modes[sizeof(video_modes_def)/sizeof(mode_data_t)];
|
||||
|
||||
const alt_u8 video_mode_cnt = sizeof(video_modes_def)/sizeof(mode_data_t);
|
||||
|
||||
|
||||
/* TODO: rewrite, check hz etc. */
|
||||
alt_8 get_mode_id(alt_u32 totlines, alt_u8 progressive, alt_u32 hz, video_type typemask, alt_u8 linemult_target, alt_u8 l3_mode, alt_u8 s480p_mode)
|
||||
{
|
||||
|
@ -23,6 +23,19 @@
|
||||
#include <alt_types.h>
|
||||
#include "sysconfig.h"
|
||||
|
||||
#define H_ACTIVE_MIN 200
|
||||
#define H_ACTIVE_MAX 1920
|
||||
#define V_ACTIVE_MIN 200
|
||||
#define V_ACTIVE_MAX 1200
|
||||
#define H_TOTAL_MIN 300
|
||||
#define H_TOTAL_MAX 2300
|
||||
#define H_SYNCLEN_MIN 10
|
||||
#define H_SYNCLEN_MAX 200
|
||||
#define H_BPORCH_MIN 1
|
||||
#define H_BPORCH_MAX 255
|
||||
#define V_BPORCH_MIN 1
|
||||
#define V_BPORCH_MAX 255
|
||||
|
||||
typedef enum {
|
||||
FORMAT_RGBS = 0,
|
||||
FORMAT_RGBHV = 1,
|
||||
|
@ -2,9 +2,9 @@
|
||||
<sch:Settings xmlns:sch="http://www.altera.com/embeddedsw/bsp/schema">
|
||||
<BspType>hal</BspType>
|
||||
<BspVersion>default</BspVersion>
|
||||
<BspGeneratedTimeStamp>Aug 11, 2016 10:54:37 PM</BspGeneratedTimeStamp>
|
||||
<BspGeneratedUnixTimeStamp>1470945277261</BspGeneratedUnixTimeStamp>
|
||||
<BspGeneratedLocation>/home/markus/Code/ossc/software/sys_controller_bsp</BspGeneratedLocation>
|
||||
<BspGeneratedTimeStamp>Aug 16, 2016 7:41:30 PM</BspGeneratedTimeStamp>
|
||||
<BspGeneratedUnixTimeStamp>1471365690097</BspGeneratedUnixTimeStamp>
|
||||
<BspGeneratedLocation>./</BspGeneratedLocation>
|
||||
<BspSettingsFile>settings.bsp</BspSettingsFile>
|
||||
<SopcDesignFile>../../sys.sopcinfo</SopcDesignFile>
|
||||
<JdiFile>default</JdiFile>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EnsembleReport name="sys" kind="sys" version="1.0" fabric="QSYS">
|
||||
<!-- Format version 15.1 185 (Future versions may contain additional information.) -->
|
||||
<!-- 2016.08.11.01:11:42 -->
|
||||
<!-- 2016.08.16.22:35:30 -->
|
||||
<!-- A collection of modules and connections -->
|
||||
<parameter name="AUTO_GENERATION_ID">
|
||||
<type>java.lang.Integer</type>
|
||||
<value>1470867102</value>
|
||||
<value>1471376130</value>
|
||||
<derived>false</derived>
|
||||
<enabled>true</enabled>
|
||||
<visible>false</visible>
|
||||
|
Loading…
Reference in New Issue
Block a user