Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dreamcast
DCInfo
Commits
12ef0312
Commit
12ef0312
authored
Feb 20, 2024
by
Donald Haase
Browse files
Move more common functions to DCInfo.c. Add BIOSTest.
parent
d396bdc1
Changes
5
Hide whitespace changes
Inline
Side-by-side
BIOSTest.c
0 → 100644
View file @
12ef0312
/*
Part of DCInfo by Donald Haase.
I wrote this originally as part of an update to httpd-ack that
would give easy information to note if a BIOS was already known
to me, or if I should dump it for review as an unknown version.
*/
#include
<kos.h>
#include
"DCInfo.h"
#include
<kos/net.h>
/*
These are the three BIOSes I've been able to get from my own DCs and devkit,
there are definitely more devkit BIOS revisions, but I don't know of any other
regular DC model revisions (that allow for MIL-CDs)
*/
static
unsigned
int
bios_crc_32_known
[]
=
{
0x89F2B1A1
,
0x2186E0E5
,
0x5454841F
};
unsigned
int
BIOS_Test
(
void
)
{
unsigned
int
i
=
0
;
unsigned
int
bios_crc_32
=
0
;
printf
(
"Your CRC-32 of your DC's BIOS is: [%08X]
\n
"
,
bios_crc_32
=
net_crc32le
(
0
,
0x200000
));
printf
(
"It's version ID at 0x7C0 is: %.64s
\n
"
,
(
unsigned
char
*
)
0x7C0
);
for
(;
i
<
sizeof
(
bios_crc_32_known
);
i
++
)
if
(
bios_crc_32
==
bios_crc_32_known
[
i
])
break
;
if
(
i
==
sizeof
(
bios_crc_32_known
))
printf
(
"Your DC's BIOS doesn't match any I know of. Please let me know about it!
\n
"
);
return
bios_crc_32
;
}
\ No newline at end of file
DCInfo.c
View file @
12ef0312
...
...
@@ -18,6 +18,46 @@ typedef struct info_mod {
} info_mod_t;
*/
volatile
bool
__wdt_timeout_running
=
true
;
void
__wdt_timeout_callback
(
void
*
)
{
__wdt_timeout_running
=
false
;
wdt_disable
();
}
void
out32
(
unsigned
int
addr
,
unsigned
int
data
)
{
volatile
unsigned
int
*
p
=
(
volatile
unsigned
int
*
)
addr
;
*
p
=
data
;
}
void
out16
(
unsigned
int
addr
,
unsigned
short
data
)
{
volatile
unsigned
short
*
p
=
(
volatile
unsigned
short
*
)
addr
;
*
p
=
data
;
}
void
out8
(
unsigned
int
addr
,
unsigned
char
data
)
{
volatile
unsigned
char
*
p
=
(
volatile
unsigned
char
*
)
addr
;
*
p
=
data
;
}
unsigned
int
in32
(
unsigned
int
addr
)
{
volatile
unsigned
int
*
p
=
(
volatile
unsigned
int
*
)
addr
;
return
*
p
;
}
unsigned
short
in16
(
unsigned
int
addr
)
{
volatile
unsigned
short
*
p
=
(
volatile
unsigned
short
*
)
addr
;
return
*
p
;
}
unsigned
char
in8
(
unsigned
int
addr
)
{
volatile
unsigned
char
*
p
=
(
volatile
unsigned
char
*
)
addr
;
return
*
p
;
}
/* My patented awesome data output that I did for MapleTest */
void
awesome_data_print
(
unsigned
char
*
data
,
unsigned
int
size
)
{
...
...
@@ -51,7 +91,10 @@ int main (void)
printf
(
"REVISION : 0x%.4x
\n
"
,
in16
(
REVISION
));
gdinfo_print
();
print_all_device_allinfo
(
2
);
BIOS_Test
();
return
0
;
}
\ No newline at end of file
DCInfo.h
View file @
12ef0312
void
out32
(
unsigned
int
addr
,
unsigned
int
data
);
void
out16
(
unsigned
int
addr
,
unsigned
short
data
);
void
out8
(
unsigned
int
addr
,
unsigned
char
data
);
unsigned
int
in32
(
unsigned
int
addr
);
unsigned
short
in16
(
unsigned
int
addr
);
unsigned
char
in8
(
unsigned
int
addr
);
void
awesome_data_print
(
unsigned
char
*
data
,
unsigned
int
size
);
/*
Trying to set up a reusable simple way to protect a while loop that has
a risk of stalling. Replace a while(X) with wdt_timeout_while(X, time)
*/
static
volatile
bool
__wdt_timeout_running
=
true
;
static
void
__wdt_timeout_callback
(
void
*
)
{
__wdt_timeout_running
=
false
;
wdt_disable
();
}
extern
volatile
bool
__wdt_timeout_running
;
void
__wdt_timeout_callback
(
void
*
);
#define wdt_timeout_while(COND, WAIT) \
__wdt_timeout_running = true; \
...
...
gdinfo.c
View file @
12ef0312
...
...
@@ -17,38 +17,6 @@
#include
"gdinfo.h"
#include
"DCInfo.h"
void
out32
(
unsigned
int
addr
,
unsigned
int
data
)
{
volatile
unsigned
int
*
p
=
(
volatile
unsigned
int
*
)
addr
;
*
p
=
data
;
}
void
out16
(
unsigned
int
addr
,
unsigned
short
data
)
{
volatile
unsigned
short
*
p
=
(
volatile
unsigned
short
*
)
addr
;
*
p
=
data
;
}
void
out8
(
unsigned
int
addr
,
unsigned
char
data
)
{
volatile
unsigned
char
*
p
=
(
volatile
unsigned
char
*
)
addr
;
*
p
=
data
;
}
unsigned
int
in32
(
unsigned
int
addr
)
{
volatile
unsigned
int
*
p
=
(
volatile
unsigned
int
*
)
addr
;
return
*
p
;
}
unsigned
short
in16
(
unsigned
int
addr
)
{
volatile
unsigned
short
*
p
=
(
volatile
unsigned
short
*
)
addr
;
return
*
p
;
}
unsigned
char
in8
(
unsigned
int
addr
)
{
volatile
unsigned
char
*
p
=
(
volatile
unsigned
char
*
)
addr
;
return
*
p
;
}
unsigned
int
gd_error
(
void
)
{
return
in8
(
GD_ALTSTAT_Read
)
&
ST_CHECK
;
...
...
makefile
View file @
12ef0312
...
...
@@ -4,7 +4,7 @@ NAME = DCInfo
TARGET
=
$(NAME)
.elf
OBJS
=
MapleTest.o gdinfo.o DCInfo.o
OBJS
=
MapleTest.o gdinfo.o DCInfo.o
BIOSTest.o
all
:
rm-elf $(TARGET)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment