1
0
mirror of https://github.com/marqs85/ossc.git synced 2024-11-16 00:05:01 +00:00

some desperate code size savings

This commit is contained in:
marqs 2018-04-16 20:08:11 +03:00
parent 183b0fa78f
commit c91988e5fb
3 changed files with 10 additions and 7 deletions

View File

@ -157,12 +157,16 @@ int parse_control()
fpga_ilace = !!(fpga_status & (1<<11)); fpga_ilace = !!(fpga_status & (1<<11));
sniprintf(menu_row1, LCD_ROW_LEN+1, "Prof.%u %9s", profile_sel, video_modes[cm.id].name); sniprintf(menu_row1, LCD_ROW_LEN+1, "Prof.%u %9s", profile_sel, video_modes[cm.id].name);
if (cm.sync_active) { if (cm.sync_active) {
fpga_v_hz_x100 = (100*TVP_EXTCLK_HZ)/IORD_ALTERA_AVALON_PIO_DATA(PIO_8_BASE); //fpga_v_hz_x100 = (100*TVP_EXTCLK_HZ)/IORD_ALTERA_AVALON_PIO_DATA(PIO_8_BASE);
sniprintf(menu_row2, LCD_ROW_LEN+1, "%4lu%c%c %3lu.%.2luHz", (((fpga_status & 0x7ff)+1)<<fpga_ilace)+fpga_ilace, /*sniprintf(menu_row2, LCD_ROW_LEN+1, "%4lu%c%c %3lu.%.2luHz", (((fpga_status & 0x7ff)+1)<<fpga_ilace)+fpga_ilace,
fpga_ilace ? 'i' : 'p', fpga_ilace ? 'i' : 'p',
((fpga_status >> 16) & 0x3) ? '*' : ' ', ((fpga_status >> 16) & 0x3) ? '*' : ' ',
fpga_v_hz_x100/100, fpga_v_hz_x100/100,
fpga_v_hz_x100%100); fpga_v_hz_x100%100);*/
sniprintf(menu_row2, LCD_ROW_LEN+1, "%4lu%c%c %u", (((fpga_status & 0x7ff)+1)<<fpga_ilace)+fpga_ilace,
fpga_ilace ? 'i' : 'p',
((fpga_status >> 16) & 0x3) ? '*' : ' ',
IORD_ALTERA_AVALON_PIO_DATA(PIO_8_BASE));
} }
lcd_write_menu(); lcd_write_menu();
break; break;

View File

@ -80,7 +80,7 @@ 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 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[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 link_av_desc (avinput_t v) { strncpy(menu_row2, v == AV_LAST ? "No link" : avinput_str[v], LCD_ROW_LEN+1); }
static void coarse_gain_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%u", ((v*10)+50)/100, (((v*10)+50)%100)/10); } //static void coarse_gain_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%u", ((v*10)+50)/100, (((v*10)+50)%100)/10); }
static const arg_info_t vm_arg_info = {&vm_sel, VIDEO_MODES_CNT-1, vm_display_name}; static const arg_info_t vm_arg_info = {&vm_sel, VIDEO_MODES_CNT-1, vm_display_name};
static const arg_info_t profile_arg_info = {&profile_sel_menu, MAX_PROFILE, value_disp}; static const arg_info_t profile_arg_info = {&profile_sel_menu, MAX_PROFILE, value_disp};
@ -107,7 +107,7 @@ MENU(menu_vinputproc, P99_PROTECT({ \
{ LNG("R/Pr gain","R/Pr ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.r_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } }, { LNG("R/Pr gain","R/Pr ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.r_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } },
{ LNG("G/Y gain","G/Y ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.g_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } }, { LNG("G/Y gain","G/Y ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.g_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } },
{ LNG("B/Pb gain","B/Pb ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.b_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } }, { LNG("B/Pb gain","B/Pb ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.b_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } },
{ LNG("Pre-ADC Gain","Pre-ADC Gain"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.c_gain, OPT_NOWRAP, 0, COARSE_GAIN_MAX, coarse_gain_disp } } }, { LNG("Pre-ADC Gain","Pre-ADC Gain"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.c_gain, OPT_NOWRAP, 0, COARSE_GAIN_MAX, value_disp } } },
})) }))
MENU(menu_sampling, P99_PROTECT({ \ MENU(menu_sampling, P99_PROTECT({ \

View File

@ -207,7 +207,7 @@ void tvp_init()
} }
void tvp_set_gain_offset(color_setup_t *col) { void tvp_set_gain_offset(color_setup_t *col) {
tvp_writereg(TVP_BG_CGAIN, ((col->c_gain << 4) | (col->c_gain & 0xF))); tvp_writereg(TVP_BG_CGAIN, ((col->c_gain << 4) | col->c_gain));
tvp_writereg(TVP_R_CGAIN, col->c_gain); tvp_writereg(TVP_R_CGAIN, col->c_gain);
tvp_writereg(TVP_R_FGAIN, col->r_f_gain); tvp_writereg(TVP_R_FGAIN, col->r_f_gain);
tvp_writereg(TVP_G_FGAIN, col->g_f_gain); tvp_writereg(TVP_G_FGAIN, col->g_f_gain);
@ -215,7 +215,6 @@ void tvp_set_gain_offset(color_setup_t *col) {
tvp_writereg(TVP_R_FOFFSET_MSB, col->r_f_off); tvp_writereg(TVP_R_FOFFSET_MSB, col->r_f_off);
tvp_writereg(TVP_G_FOFFSET_MSB, col->g_f_off); tvp_writereg(TVP_G_FOFFSET_MSB, col->g_f_off);
tvp_writereg(TVP_B_FOFFSET_MSB, col->b_f_off); tvp_writereg(TVP_B_FOFFSET_MSB, col->b_f_off);
} }
// Configure H-PLL (sampling rate, VCO gain and charge pump current) // Configure H-PLL (sampling rate, VCO gain and charge pump current)