Fix random input detection issue.

This commit is contained in:
marqs 2016-06-22 23:22:59 +03:00
parent bab00679df
commit a2e10637bd
6 changed files with 901 additions and 902 deletions

File diff suppressed because it is too large Load Diff

View File

@ -132,9 +132,9 @@ void set_lpf(alt_u8 lpf)
inline int check_linecnt(alt_u8 progressive, alt_u32 totlines) {
if (progressive)
return (totlines > MIN_LINES_PROGRESSIVE);
return (totlines >= MIN_LINES_PROGRESSIVE);
else
return (totlines > MIN_LINES_INTERLACED);
return (totlines >= MIN_LINES_INTERLACED);
}
// Check if input video status / target configuration has changed
@ -173,8 +173,8 @@ status_t get_status(tvp_input_t input, video_format format)
fpga_totlines = IORD_ALTERA_AVALON_PIO_DATA(PIO_4_BASE) & 0xffff;
//TODO: check flags instead
if (vsyncmode == 0x2) {
// NOTE: "progressive" may not have correct value if H-PLL is not locked (!cm.sync_active)
if ((vsyncmode == 0x2) || (!cm.sync_active && (totlines < MIN_LINES_INTERLACED))) {
progressive = 1;
} else if ((vsyncmode == 0x1) && fpga_totlines > ((totlines-1)*2)) {
progressive = 0;

View File

@ -55,7 +55,7 @@ typedef struct {
alt_u8 en_alc;
alt_u8 pre_coast;
alt_u8 post_coast;
} avconfig_t;
} __attribute__((packed)) avconfig_t;
int set_default_avconfig();

View File

@ -20,6 +20,8 @@
#include <string.h>
#include "menu.h"
#include "av_controller.h"
#include "firmware.h"
#include "userdata.h"
#include "controls.h"
#include "lcd.h"
#include "tvp7002.h"
@ -188,7 +190,7 @@ void display_menu(alt_u8 forcedisp)
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 : "Error");
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;
break;

View File

@ -98,9 +98,4 @@ typedef struct {
void display_menu(alt_u8 forcedisp);
//TODO: move all below to separate header(s)
int write_userdata();
int fw_update();
#endif

View File

@ -388,6 +388,7 @@ void tvp_source_sel(tvp_input_t input, video_format fmt)
else // RGBS
tvp_writereg(TVP_SYNCCTRL1, 0x53);
usleep(1000);
sync_status = tvp_readreg(TVP_SYNCSTAT);
if (sync_status & (1<<7))
printf("%s detected, %s polarity\n", (sync_status & (1<<3)) ? "Csync" : "Hsync", (sync_status & (1<<5)) ? "pos" : "neg");
@ -395,6 +396,7 @@ void tvp_source_sel(tvp_input_t input, video_format fmt)
printf("Vsync detected, %s polarity\n", (sync_status & (1<<2)) ? "pos" : "neg");
} else {
tvp_writereg(TVP_SYNCCTRL1, 0x5B);
usleep(1000);
sync_status = tvp_readreg(TVP_SYNCSTAT);
if (sync_status & (1<<1))
printf("SOG detected\n");