Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 3 files changed
  • 0 comments
  • 2 contributors
2  milkymist/dvisampler/clocking.py
@@ -4,7 +4,7 @@
4 4
 
5 5
 class Clocking(Module, AutoCSR):
6 6
 	def __init__(self, pads):
7  
-		self._r_pll_reset = CSRStorage()
  7
+		self._r_pll_reset = CSRStorage(reset=1)
8 8
 		self._r_locked = CSRStatus()
9 9
 
10 10
 		self.locked = Signal()
4  milkymist/lasmicon/multiplexer.py
@@ -162,12 +162,12 @@ def steerer_sel(steerer, phy_settings, r_w_n):
162 162
 				if r_w_n == "read":
163 163
 					if i == phy_settings.rdphase:
164 164
 						s = steerer.sel[i].eq(STEER_REQ)
165  
-					elif i == phy_settings.wrcmdphase:
  165
+					elif i == phy_settings.rdcmdphase:
166 166
 						s = steerer.sel[i].eq(STEER_CMD)
167 167
 				elif r_w_n == "write":
168 168
 					if i == phy_settings.wrphase:
169 169
 						s = steerer.sel[i].eq(STEER_REQ)
170  
-					elif i == phy_settings.rdcmdphase:
  170
+					elif i == phy_settings.wrcmdphase:
171 171
 						s = steerer.sel[i].eq(STEER_CMD)
172 172
 				else:
173 173
 					raise ValueError
46  software/videomixer/dvisamplerX.c
@@ -44,6 +44,8 @@ void dvisamplerX_init_video(void)
44 44
 {
45 45
 	unsigned int mask;
46 46
 
  47
+	dvisamplerX_clocking_pll_reset_write(1);
  48
+
47 49
 	dvisamplerX_dma_ev_pending_write(dvisamplerX_dma_ev_pending_read());
48 50
 	dvisamplerX_dma_ev_enable_write(0x3);
49 51
 	mask = irq_getmask();
@@ -224,27 +226,45 @@ static void dvisamplerX_check_overflow(void)
224 226
 	}
225 227
 }
226 228
 
  229
+static int dvisamplerX_connected;
227 230
 static int dvisamplerX_locked;
228 231
 static int dvisamplerX_last_event;
229 232
 
230 233
 void dvisamplerX_service(void)
231 234
 {
232  
-	if(dvisamplerX_locked) {
233  
-		if(dvisamplerX_clocking_locked_read()) {
234  
-			if(elapsed(&dvisamplerX_last_event, identifier_frequency_read()/2)) {
235  
-				dvisamplerX_adjust_phase();
236  
-				dvisamplerX_print_status();
237  
-			}
238  
-		} else {
239  
-			printf("dvisamplerX: lost PLL lock\n");
  235
+	if(dvisamplerX_connected) {
  236
+		if(!dvisamplerX_edid_hpd_notif_read()) {
  237
+			printf("dvisamplerX: disconnected\n");
  238
+			dvisamplerX_connected = 0;
240 239
 			dvisamplerX_locked = 0;
  240
+			dvisamplerX_clocking_pll_reset_write(1);
  241
+			dvisamplerX_edid_hpd_en_write(0);
  242
+		} else {
  243
+			if(dvisamplerX_locked) {
  244
+				if(dvisamplerX_clocking_locked_read()) {
  245
+					if(elapsed(&dvisamplerX_last_event, identifier_frequency_read()/2)) {
  246
+						dvisamplerX_adjust_phase();
  247
+						dvisamplerX_print_status();
  248
+					}
  249
+				} else {
  250
+					printf("dvisamplerX: lost PLL lock\n");
  251
+					dvisamplerX_locked = 0;
  252
+				}
  253
+			} else {
  254
+				if(dvisamplerX_clocking_locked_read()) {
  255
+					printf("dvisamplerX: PLL locked\n");
  256
+					dvisamplerX_phase_startup();
  257
+					dvisamplerX_print_status();
  258
+					dvisamplerX_locked = 1;
  259
+				}
  260
+			}
241 261
 		}
242 262
 	} else {
243  
-		if(dvisamplerX_clocking_locked_read()) {
244  
-			printf("dvisamplerX: PLL locked\n");
245  
-			dvisamplerX_phase_startup();
246  
-			dvisamplerX_print_status();
247  
-			dvisamplerX_locked = 1;
  263
+		if(dvisamplerX_edid_hpd_notif_read()) {
  264
+			printf("dvisamplerX: connected\n");
  265
+			dvisamplerX_connected = 1;
  266
+			dvisamplerX_edid_hpd_en_write(1);
  267
+			dvisamplerX_clocking_pll_reset_write(0);
248 268
 		}
249 269
 	}
250 270
 	dvisamplerX_check_overflow();

No commit comments for this range

Something went wrong with that request. Please try again.