Skip to content

Commit e20d5d1

Browse files
authored
Merge pull request #708 from uyjulian/boardinf_impl
Implementation of boardinf module
2 parents adcc04a + 5ae0298 commit e20d5d1

File tree

6 files changed

+115
-0
lines changed

6 files changed

+115
-0
lines changed

iop/system/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
SUBDIRS = \
1010
alloc \
11+
boardinf \
1112
dmacman \
1213
eeconf \
1314
eesync \

iop/system/boardinf/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# _____ ___ ____ ___ ____
2+
# ____| | ____| | | |____|
3+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
4+
#-----------------------------------------------------------------------
5+
# Copyright ps2dev - http://www.ps2dev.org
6+
# Licenced under Academic Free License version 2.0
7+
# Review ps2sdk README & LICENSE files for further details.
8+
9+
IOP_INCS += \
10+
-I$(PS2SDKSRC)/iop/system/loadcore/include
11+
12+
IOP_OBJS = \
13+
boardinf.o \
14+
imports.o
15+
16+
include $(PS2SDKSRC)/Defs.make
17+
include $(PS2SDKSRC)/iop/Rules.bin.make
18+
include $(PS2SDKSRC)/iop/Rules.make
19+
include $(PS2SDKSRC)/iop/Rules.release

iop/system/boardinf/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Board information module
2+
3+
This module registers boot modes 6 and 7 to values related to DTL-T boards.
4+
5+
## Configurations
6+
7+
There are multiple configurations of this library, allowing the choice of
8+
balancing between size, speed, and features.
9+
10+
* `boardinf` -> The recommended version.
11+
12+
## How to use this module in your program
13+
14+
In order to use this module in your program, you must integrate the module into
15+
an IOPRP image, then load the image with `UDNL`.\
16+
Using `LoadModule` or `LoadModuleBuffer` directly will not work, because the
17+
module is already loaded at IOP boot.

iop/system/boardinf/src/boardinf.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
*/
10+
11+
#include "irx_imports.h"
12+
13+
#include "iop_mmio_hwport.h"
14+
15+
// Based on the module from SDK 3.1.0.
16+
17+
int _start(int ac, char **av)
18+
{
19+
u16 bootmode_7_val;
20+
USE_IOP_MMIO_HWPORT();
21+
22+
(void)av;
23+
if ( ac > 0 )
24+
{
25+
return 1;
26+
}
27+
{
28+
u32 bootmode_tmp[1];
29+
30+
bootmode_tmp[0] = (iop_mmio_hwport->exp2_r2[4612] & 0xFFFF) | 0x60000;
31+
RegisterBootMode((iop_bootmode_t *)bootmode_tmp);
32+
}
33+
switch ( iop_mmio_hwport->exp2_r2[4612] & 0xF8 )
34+
{
35+
case 0:
36+
case 16:
37+
case 32:
38+
case 48:
39+
bootmode_7_val = 0x00C8;
40+
break;
41+
case 64:
42+
case 80:
43+
bootmode_7_val = 0x012C;
44+
break;
45+
default:
46+
bootmode_7_val = 0x0126;
47+
break;
48+
}
49+
{
50+
u32 bootmode_tmp[1];
51+
52+
bootmode_tmp[0] = (bootmode_7_val & 0xFFFF) | 0x70000;
53+
RegisterBootMode((iop_bootmode_t *)bootmode_tmp);
54+
}
55+
return 1;
56+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
loadcore_IMPORTS_start
3+
I_RegisterBootMode
4+
loadcore_IMPORTS_end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
*/
10+
11+
#ifndef IOP_IRX_IMPORTS_H
12+
#define IOP_IRX_IMPORTS_H
13+
14+
#include <irx.h>
15+
16+
#include <loadcore.h>
17+
18+
#endif /* IOP_IRX_IMPORTS_H */

0 commit comments

Comments
 (0)