shithub: riscv

Download patch

ref: aeb49aca9efeb5c2158a48941e042e1b05ee2370
parent: a5525457bdde5ac519859b0a8f72eba6144a0230
author: Matthew Veety <mveety@gmail.com>
date: Sun Jan 12 06:00:38 EST 2014

added a segment for segattach(2) that gives access to the raspberry pi's gpio header.

--- a/sys/src/9/bcm/main.c
+++ b/sys/src/9/bcm/main.c
@@ -216,6 +216,19 @@
 }
 
 void
+gpiomeminit(void)
+{
+	Physseg seg;
+	memset(&seg, 0, sizeof seg);
+	seg.attr = SG_PHYSICAL;
+	seg.name = "gpio";
+	seg.pa = (VIRTIO+0x200000);
+	seg.size = 1;
+	addphysseg(&seg);
+}
+
+
+void
 main(void)
 {
 	extern char edata[], end[];
@@ -259,6 +272,7 @@
 	pageinit();
 	swapinit();
 	userinit();
+	gpiomeminit();
 	schedinit();
 	assert(0);			/* shouldn't have returned */
 }
--