git: 9front

Download patch

ref: 010fd07a7fd2484fc6a4d6586803f836b182fa3b
parent: d9f5e134ec90e14bb395214023ef08c79897ef6b
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 */
 }
--