Support setting sync polarity (#553)

Include sync polarities in the UIO_SET_VIDEO command.  Polarities are
specified in the high bits of the hsync and vsync values.  0 is
negative, 1 is positive.

Horizontal and vertical polarities can optionally be included as two
numbers at the end of custom modes.  Again, 0 is negative, 1 is
positive.
This commit is contained in:
Thomas Sowell
2022-02-25 21:26:51 -09:00
committed by GitHub
parent fa7690d335
commit badc9953e7
2 changed files with 14 additions and 4 deletions

View File

@@ -72,8 +72,8 @@ dvi_mode=0
;12 - 1920x1440@60
;13 - 2048x1536@60
;
; custom mode: hact,hfp,hs,hbp,vact,vfp,vs,vbp,Fpix_in_KHz
; video_mode=1280,110,40,220,720,5,5,20,74250
; custom mode: hact,hfp,hs,hbp,vact,vfp,vs,vbp,Fpix_in_KHz[,hsyncp,vsyncp]
; video_mode=1280,110,40,220,720,5,5,20,74250,0,0
video_mode=0
; set to 1-10 (seconds) to display video info on startup/change

View File

@@ -912,10 +912,16 @@ static void set_video(vmode_custom_t *v, double Fpix)
printf("video: ");
for (int i = 1; i <= 8; i++)
{
spi_w(v_fix.item[i]);
//hsync polarity
if (i == 3) spi_w((!!v_cur.item[21] << 15) | v_fix.item[i]);
//vsync polarity
else if (i == 7) spi_w((!!v_cur.item[22] << 15) | v_fix.item[i]);
else spi_w(v_fix.item[i]);
printf("%d(%d), ", v_cur.item[i], v_fix.item[i]);
}
printf("%chsync, %cvsync", !!v_cur.item[21]?'+':'-', !!v_cur.item[22]?'+':'-');
if(Fpix) setPLL(Fpix, &v_cur);
printf("\nPLL: ");
@@ -970,7 +976,11 @@ static int parse_custom_video_mode(char* vcfg, vmode_custom_t *v)
}
setPLL(Fpix, v);
break;
//read sync polarities if present
if (*next == ',') next++;
vcfg = next;
cnt = 21;
continue;
}
uint32_t val = strtoul(vcfg, &next, 0);