ref: fe34e52d19aeeb04bc34114fda928b6afeb62253
parent: f00aa6b92a7a6d186cbfe8ca7d045e32f597bffa
author: cinap_lenrek <[email protected]>
date: Wed Apr 10 11:06:56 EDT 2019
bcm: move okay() from uartmini.c to devarch.c
--- a/sys/src/9/bcm/devarch.c
+++ b/sys/src/9/bcm/devarch.c
@@ -172,3 +172,31 @@
addarchfile("cputype", 0444, cputyperead, nil);
addarchfile("cputemp", 0444, cputempread, nil);
}
+
+void
+okay(int on)
+{
+ static int first;
+ static int okled, polarity;
+ char *p;
+
+ if(!first++){
+ p = getconf("bcm2709.disk_led_gpio");
+ if(p == nil)
+ p = getconf("bcm2708.disk_led_gpio");
+ if(p != nil)
+ okled = strtol(p, 0, 0);
+ else
+ okled = 'v';
+ p = getconf("bcm2709.disk_led_active_low");
+ if(p == nil)
+ p = getconf("bcm2708.disk_led_active_low");
+ polarity = (p == nil || *p == '1');
+ if(okled != 'v')
+ gpiosel(okled, Output);
+ }
+ if(okled == 'v')
+ vgpset(0, on);
+ else if(okled != 0)
+ gpioout(okled, on^polarity);
+}
--- a/sys/src/9/bcm/uartmini.c
+++ b/sys/src/9/bcm/uartmini.c
@@ -332,31 +332,3 @@
.getc = getc,
.putc = putc,
};
-
-void
-okay(int on)
-{
- static int first;
- static int okled, polarity;
- char *p;
-
- if(!first++){
- p = getconf("bcm2709.disk_led_gpio");
- if(p == nil)
- p = getconf("bcm2708.disk_led_gpio");
- if(p != nil)
- okled = strtol(p, 0, 0);
- else
- okled = 'v';
- p = getconf("bcm2709.disk_led_active_low");
- if(p == nil)
- p = getconf("bcm2708.disk_led_active_low");
- polarity = (p == nil || *p == '1');
- if(okled != 'v')
- gpiosel(okled, Output);
- }
- if(okled == 'v')
- vgpset(0, on);
- else if(okled != 0)
- gpioout(okled, on^polarity);
-}