forked from lewurm/mini
-
Notifications
You must be signed in to change notification settings - Fork 2
/
panic.c
50 lines (38 loc) · 979 Bytes
/
panic.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
mini - a Free Software replacement for the Nintendo/BroadOn IOS.
panic flash codes
Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
# This code is licensed to you under the terms of the GNU GPL, version 2;
# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/
#include "types.h"
#include "utils.h"
#include "start.h"
#include "hollywood.h"
#include <stdarg.h>
#define PANIC_ON 200000
#define PANIC_OFF 300000
#define PANIC_INTER 1000000
// figure out a use for mode...
void panic2(int mode, ...)
{
int arg;
va_list ap;
clear32(HW_GPIO1OUT, HW_GPIO1_SLOT);
clear32(HW_GPIO1DIR, HW_GPIO1_SLOT);
clear32(HW_GPIO1OWNER, HW_GPIO1_SLOT);
while(1) {
va_start(ap, mode);
while(1) {
arg = va_arg(ap, int);
if(arg < 0)
break;
set32(HW_GPIO1OUT, HW_GPIO1_SLOT);
udelay(arg * PANIC_ON);
clear32(HW_GPIO1OUT, HW_GPIO1_SLOT);
udelay(PANIC_OFF);
}
va_end(ap);
udelay(PANIC_INTER);
}
}