bcm: move okay() from uartmini.c to devarch.c
This commit is contained in:
parent
f00aa6b92a
commit
fe34e52d19
2 changed files with 28 additions and 28 deletions
|
@ -172,3 +172,31 @@ archinit(void)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -332,31 +332,3 @@ PhysUart miniphysuart = {
|
|||
.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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue