Kaynağa Gözat

projects/boot_stub: Add support for special Vio feature of some board

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Sylvain Munaut 4 yıl önce
ebeveyn
işleme
1d57cbe16f

+ 3 - 0
projects/boot_stub/data/top-e1tracer.pcf

@@ -10,3 +10,6 @@ set_io -nowarn -pullup yes btn 25
 set_io -nowarn rgb[0] 39
 set_io -nowarn rgb[1] 40
 set_io -nowarn rgb[2] 41
+
+# Vio
+set_io -nowarn vio_pdm 19

+ 3 - 0
projects/boot_stub/data/top-icepick.pcf

@@ -10,3 +10,6 @@ set_io -nowarn -pullup yes btn 25
 set_io -nowarn rgb[0] 39
 set_io -nowarn rgb[1] 40
 set_io -nowarn rgb[2] 41
+
+# Vio
+set_io -nowarn vio_pdm 19

+ 3 - 1
projects/boot_stub/rtl/boards.vh

@@ -55,8 +55,9 @@
 //	`define RGB_MAP 12'h120		// 41=Green, 40=Blue, 39=Red (Hacked v1.0b)
 `elsif BOARD_ICEPICK
 	// iCEpick
-	`define HAS_RGB
+	`define HAS_VIO
 	`define HAS_USB
+	`define HAS_RGB
 	`define RGB_MAP 12'h012		// 41=Red, 40=Green, 39=Blue
 //	`define RGB_MAP 12'h210		// 41=Blue, 40=Green, 39=Red (Alt RGB LED)
 `elsif BOARD_ICE1USB
@@ -66,6 +67,7 @@
 	`define RGB_MAP 12'h012		// 41=Red, 40=Green, 39=Blue
 `elsif BOARD_E1TRACER
 	// osmocom E1 tracer
+	`define HAS_VIO				// Compatibility with icepick proto
 	`define HAS_USB
 	`define HAS_RGB
 	`define RGB_MAP 12'h012		// 41=Red, 40=Green, 39=Blue

+ 16 - 0
projects/boot_stub/rtl/top.v

@@ -35,6 +35,11 @@
 `include "boards.vh"
 
 module top (
+	// Special features
+`ifdef HAS_VIO
+	output reg vio_pdm,
+`endif
+
 	// Button
 	input  wire btn,
 
@@ -275,6 +280,17 @@ module top (
 `endif
 
 
+	// Special features
+	// ----------------
+
+	// Output a 50% duty cycle VIO which should be ~ 1.65v, enough to
+	// read the button state
+`ifdef HAS_VIO
+	always @(posedge clk)
+		vio_pdm <= ~vio_pdm;
+`endif
+
+
 	// Clock / Reset
 	// -------------