Compare commits
448 Commits
0.16.0
...
thermosphe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
020cfb89c6 | ||
|
|
f40c064e80 | ||
|
|
6bcb5aca60 | ||
|
|
548367453b | ||
|
|
6790895487 | ||
|
|
41d98b5e48 | ||
|
|
b6dbdfe82d | ||
|
|
30b79c2fe7 | ||
|
|
3a79a7a961 | ||
|
|
cefd66e7af | ||
|
|
a8f28ab96d | ||
|
|
2986967f2a | ||
|
|
fc8a596409 | ||
|
|
36f48748a4 | ||
|
|
6f423fcfab | ||
|
|
fccadfdbf6 | ||
|
|
47f343cda6 | ||
|
|
987731ea43 | ||
|
|
d4bbb78a27 | ||
|
|
0126a6417f | ||
|
|
7ecb3a4aaf | ||
|
|
56d764d09c | ||
|
|
0cb5eab933 | ||
|
|
d15154f668 | ||
|
|
ea830bb5ab | ||
|
|
e8435784a7 | ||
|
|
0437867449 | ||
|
|
797cea0ac8 | ||
|
|
874d1432be | ||
|
|
e8bfe8a311 | ||
|
|
036883c30f | ||
|
|
5b56d05e11 | ||
|
|
4adb675072 | ||
|
|
77fbbb4c68 | ||
|
|
f6793139c1 | ||
|
|
37a889ccb2 | ||
|
|
ea7d161755 | ||
|
|
d72fc3e8b9 | ||
|
|
c7eaf71896 | ||
|
|
5a445e9394 | ||
|
|
613402121a | ||
|
|
2574f68484 | ||
|
|
1ee289f5f1 | ||
|
|
31e5ff7c1d | ||
|
|
02bbe1bb40 | ||
|
|
b21c75b22b | ||
|
|
c99a77a0c3 | ||
|
|
dd9b3ddb0d | ||
|
|
785b7e1a37 | ||
|
|
1eda049ada | ||
|
|
493a3c92e2 | ||
|
|
dad84ac017 | ||
|
|
eab46ab1b6 | ||
|
|
192d2db4a9 | ||
|
|
ff2c835b0a | ||
|
|
dd7f0b805b | ||
|
|
fdd5481f63 | ||
|
|
0b8d0035b9 | ||
|
|
bfa917edf5 | ||
|
|
61a972abf3 | ||
|
|
697e61850f | ||
|
|
2077062b79 | ||
|
|
b445fe1bf4 | ||
|
|
b65f11d205 | ||
|
|
5de560be30 | ||
|
|
be6253d6ad | ||
|
|
78eea8a373 | ||
|
|
53850a5976 | ||
|
|
788f331de0 | ||
|
|
edf2bbc30e | ||
|
|
e4d189eee3 | ||
|
|
e6fdd6bc98 | ||
|
|
3556c12960 | ||
|
|
67daf5a73e | ||
|
|
f1a241ffef | ||
|
|
bf7f077432 | ||
|
|
ebf8053b42 | ||
|
|
914790be01 | ||
|
|
036882f162 | ||
|
|
b0ae19a6f9 | ||
|
|
0b7efc0501 | ||
|
|
c67ff366ea | ||
|
|
63e3f40fa5 | ||
|
|
3fe7c7537e | ||
|
|
256201922b | ||
|
|
46c82e2d77 | ||
|
|
cb4d898579 | ||
|
|
7acd5a9ec7 | ||
|
|
7f7e4e8310 | ||
|
|
8f25d4f77f | ||
|
|
e1a8bdd495 | ||
|
|
ef23db21e6 | ||
|
|
46954a5359 | ||
|
|
6499d36722 | ||
|
|
66ba05b302 | ||
|
|
7a774adbc3 | ||
|
|
ce1df0ac23 | ||
|
|
fc5d81dca3 | ||
|
|
23ef4b94d6 | ||
|
|
e4de512e6f | ||
|
|
cf0b052590 | ||
|
|
0509fa57ca | ||
|
|
175f16627b | ||
|
|
f0b9162d5e | ||
|
|
02e2a1efa2 | ||
|
|
ed5736e8d2 | ||
|
|
b0ca29d18e | ||
|
|
36ca87491d | ||
|
|
9ef2532b9d | ||
|
|
cbf3b305ca | ||
|
|
c0252e07f6 | ||
|
|
71401b0731 | ||
|
|
ff1aac0ab5 | ||
|
|
984f6776c6 | ||
|
|
0e47f7f46b | ||
|
|
c00672654a | ||
|
|
8538fed043 | ||
|
|
1f2b8e7918 | ||
|
|
30a4a0d4c1 | ||
|
|
97c4595a3a | ||
|
|
5b545f89f5 | ||
|
|
310048a32c | ||
|
|
5473443057 | ||
|
|
78723164c1 | ||
|
|
58d52675cd | ||
|
|
bd36796d5f | ||
|
|
779aeaa538 | ||
|
|
5de05ed8a8 | ||
|
|
abeaa72f94 | ||
|
|
c89ce085a6 | ||
|
|
418cabbd53 | ||
|
|
744491ca33 | ||
|
|
9ebf3c9580 | ||
|
|
f23fb45956 | ||
|
|
61fec56c6e | ||
|
|
a665f49b93 | ||
|
|
3e8bd764d5 | ||
|
|
c64ccd86ee | ||
|
|
217c1ad054 | ||
|
|
0f0228e240 | ||
|
|
3ca3e094fe | ||
|
|
d1cd17a9df | ||
|
|
626f0ecb98 | ||
|
|
92a291cd41 | ||
|
|
906d6a4f20 | ||
|
|
6b8a843ffb | ||
|
|
72d1992eec | ||
|
|
1369697058 | ||
|
|
b6a130547a | ||
|
|
067770334e | ||
|
|
a7741c8576 | ||
|
|
dd96c8b32b | ||
|
|
68a1ce6dd2 | ||
|
|
388c245ce4 | ||
|
|
1086c0612c | ||
|
|
8dc9be9f8e | ||
|
|
018260645a | ||
|
|
a6d191bf4b | ||
|
|
1eb60a2a52 | ||
|
|
3d3a9925b9 | ||
|
|
501472324f | ||
|
|
b9d07fccd6 | ||
|
|
d42d9e60b9 | ||
|
|
28552da099 | ||
|
|
d56185e432 | ||
|
|
c42aef6ba7 | ||
|
|
03fe744bc4 | ||
|
|
e49a035455 | ||
|
|
0811572889 | ||
|
|
76a5e745e4 | ||
|
|
7130b6efd1 | ||
|
|
37b14bc4b8 | ||
|
|
13174e7458 | ||
|
|
ef79908594 | ||
|
|
3a13ab2e46 | ||
|
|
676a895cca | ||
|
|
cdf3bc6942 | ||
|
|
fe0662a75d | ||
|
|
f3ad62d1b8 | ||
|
|
27859a7541 | ||
|
|
e3b6d64f1b | ||
|
|
c17b81aaf6 | ||
|
|
176be2386d | ||
|
|
f9ec21e99e | ||
|
|
1775d59977 | ||
|
|
b2c5ef2611 | ||
|
|
0b69407f8e | ||
|
|
0a9a8c2f15 | ||
|
|
271d2a0ddb | ||
|
|
6289d2e398 | ||
|
|
f8266775f6 | ||
|
|
83c6e2f0e7 | ||
|
|
9bc0ed2f70 | ||
|
|
dc3f87a715 | ||
|
|
3649b94b5d | ||
|
|
a3da478089 | ||
|
|
ff9714d4f6 | ||
|
|
cc232ef4f8 | ||
|
|
b742b861ab | ||
|
|
eb27c36709 | ||
|
|
e0339049b3 | ||
|
|
e6c5eb3928 | ||
|
|
045f556f80 | ||
|
|
a11b0b6e0e | ||
|
|
3fa9133814 | ||
|
|
ecb4857cbb | ||
|
|
6d33ebceef | ||
|
|
4a5d05f32b | ||
|
|
b686af2008 | ||
|
|
a291bddcc1 | ||
|
|
ad6db14526 | ||
|
|
61b6f06766 | ||
|
|
16cfa1305d | ||
|
|
af8e0f2519 | ||
|
|
a560de8465 | ||
|
|
3009438e54 | ||
|
|
9af9408feb | ||
|
|
68469ea862 | ||
|
|
ffa216c8c7 | ||
|
|
1db0502b35 | ||
|
|
6665245640 | ||
|
|
9d6089dc86 | ||
|
|
70a9caa7e9 | ||
|
|
4952b3c9bf | ||
|
|
bcc72896fd | ||
|
|
b5c6b06dad | ||
|
|
4e0eef2784 | ||
|
|
ada6b180cc | ||
|
|
e6adccce6e | ||
|
|
f6e1cff5f8 | ||
|
|
88382f4fc3 | ||
|
|
66b047255b | ||
|
|
076c988796 | ||
|
|
4e6108839d | ||
|
|
1d58ba8d52 | ||
|
|
bd9152215f | ||
|
|
1f7a1f71d6 | ||
|
|
1545fa9d44 | ||
|
|
71add1add8 | ||
|
|
a96786fd2c | ||
|
|
74e4e70053 | ||
|
|
26b6216fa0 | ||
|
|
fe5c850e69 | ||
|
|
2b825d56dc | ||
|
|
13b17a5848 | ||
|
|
621520c30b | ||
|
|
846cc0b47a | ||
|
|
e82ad1cdc5 | ||
|
|
b40da8f445 | ||
|
|
a9c6476416 | ||
|
|
c1d93a9495 | ||
|
|
201b17f100 | ||
|
|
c0e3cee657 | ||
|
|
26d8db74f8 | ||
|
|
ee2e9d50fd | ||
|
|
fd1a39996e | ||
|
|
8eb65ab401 | ||
|
|
bcda834980 | ||
|
|
408b81b881 | ||
|
|
d854b94382 | ||
|
|
63440cab18 | ||
|
|
4fa585a23f | ||
|
|
e521ae805d | ||
|
|
6950989552 | ||
|
|
ffbdf29c10 | ||
|
|
135d42ffee | ||
|
|
1306d03136 | ||
|
|
97aa209c43 | ||
|
|
4ce2a6deb3 | ||
|
|
e45d8cd7d8 | ||
|
|
79211e1159 | ||
|
|
ca8e8ce487 | ||
|
|
b30311be65 | ||
|
|
6694d8c2d9 | ||
|
|
658389fc60 | ||
|
|
d6477cf024 | ||
|
|
400f5142ee | ||
|
|
8bf8df43e2 | ||
|
|
a28c60970f | ||
|
|
b5f72b9f20 | ||
|
|
8d10584a51 | ||
|
|
366c265ab2 | ||
|
|
42964992d1 | ||
|
|
4a82d9bf28 | ||
|
|
4190281b2f | ||
|
|
48830d190f | ||
|
|
3389aaefc3 | ||
|
|
f8f987aa8d | ||
|
|
e87e146112 | ||
|
|
5751bcc117 | ||
|
|
eb1e979257 | ||
|
|
204539664b | ||
|
|
f5c6736431 | ||
|
|
d00ebaa28a | ||
|
|
402e4d1adb | ||
|
|
ed7c0605f9 | ||
|
|
c848a830ee | ||
|
|
dbe8add4f4 | ||
|
|
e4e278bb3d | ||
|
|
3761f80592 | ||
|
|
9878c18e47 | ||
|
|
3bb94aa146 | ||
|
|
83c04fa5d7 | ||
|
|
dc4ee1a5bc | ||
|
|
5191f0e305 | ||
|
|
170034aed3 | ||
|
|
21236020cb | ||
|
|
f06de12bea | ||
|
|
8314d015f3 | ||
|
|
49f07b065a | ||
|
|
9e104bb83f | ||
|
|
33457d61da | ||
|
|
b5816b4a91 | ||
|
|
af7233d84c | ||
|
|
8ac8abf295 | ||
|
|
b26ebc12e1 | ||
|
|
b4122da6ad | ||
|
|
6a2ee02409 | ||
|
|
094cede39e | ||
|
|
9cfd259c5c | ||
|
|
4f7f37fae6 | ||
|
|
d2f81d2ca2 | ||
|
|
b8072b1398 | ||
|
|
a6e3a93c07 | ||
|
|
1e643f7ab0 | ||
|
|
4aa18b06e8 | ||
|
|
f051f707ed | ||
|
|
1c9d6b4d90 | ||
|
|
b21f8a5043 | ||
|
|
e53b9cc518 | ||
|
|
99e4920d9d | ||
|
|
428b5b266c | ||
|
|
2b48743265 | ||
|
|
a0769844f4 | ||
|
|
e0fe29743d | ||
|
|
9ace85a4aa | ||
|
|
e53b171693 | ||
|
|
8b1835368a | ||
|
|
cf7ae775e8 | ||
|
|
07202f7c88 | ||
|
|
97157577ab | ||
|
|
6d65aa7e72 | ||
|
|
601c4516bf | ||
|
|
192ea926f6 | ||
|
|
f1d320b6b6 | ||
|
|
6b3a3ecb44 | ||
|
|
dcfd01cf59 | ||
|
|
4b09b5d5ce | ||
|
|
f6833a794a | ||
|
|
b7895ff2a7 | ||
|
|
f7898f3519 | ||
|
|
96f3c0c387 | ||
|
|
f4e763ce40 | ||
|
|
a05e87f78a | ||
|
|
4809ced64d | ||
|
|
222300d03c | ||
|
|
b918d4b2aa | ||
|
|
53c684a17a | ||
|
|
4ffdf8d525 | ||
|
|
7480b6bb80 | ||
|
|
3e8688e19e | ||
|
|
3b05315616 | ||
|
|
2b81ed7315 | ||
|
|
ff7e52a1c1 | ||
|
|
e391f593de | ||
|
|
f600dff961 | ||
|
|
8104beb2e0 | ||
|
|
4cd56f8423 | ||
|
|
198bdacaf4 | ||
|
|
35ab0939fa | ||
|
|
4958d01153 | ||
|
|
b625fd324e | ||
|
|
5e342d8c52 | ||
|
|
d233b482fb | ||
|
|
3e2f776184 | ||
|
|
7a9018dc7a | ||
|
|
f768e3c8f9 | ||
|
|
d42f2e4d1b | ||
|
|
24111d46a1 | ||
|
|
f2a6a4a6e6 | ||
|
|
6633af769e | ||
|
|
131c8609c8 | ||
|
|
30e70e20d8 | ||
|
|
a26e8ac54f | ||
|
|
8bfda27e0e | ||
|
|
0c9cb830f7 | ||
|
|
ee1b638dde | ||
|
|
9826358533 | ||
|
|
113ab8439d | ||
|
|
60c888126b | ||
|
|
d7b14f48d2 | ||
|
|
1085ccbe60 | ||
|
|
8b61537aa3 | ||
|
|
968f50bc07 | ||
|
|
0bf2ade76f | ||
|
|
35a6705d55 | ||
|
|
b8471bcd4e | ||
|
|
f7e83a72a9 | ||
|
|
f6b847177a | ||
|
|
a6d40e85f1 | ||
|
|
6a81206373 | ||
|
|
4be5733c8e | ||
|
|
8dcb07152e | ||
|
|
3b5dff0f83 | ||
|
|
1ca373cd71 | ||
|
|
4ff026224e | ||
|
|
2c39efea4c | ||
|
|
16cd1141d1 | ||
|
|
4b71e3a87e | ||
|
|
d090a7886d | ||
|
|
9a6cca7499 | ||
|
|
1ec2c0c2cb | ||
|
|
569e1bc650 | ||
|
|
652e9bf9e8 | ||
|
|
ca2cc5e179 | ||
|
|
17c8c390fc | ||
|
|
d8ae1d873c | ||
|
|
63e3c02688 | ||
|
|
14a415c4b2 | ||
|
|
734122f20a | ||
|
|
7fb902d8fb | ||
|
|
be8473cf65 | ||
|
|
6df26d674c | ||
|
|
1a6e003a5d | ||
|
|
0acd79c8c2 | ||
|
|
8a4bf6a0a8 | ||
|
|
af259eabda | ||
|
|
16e2f46aed | ||
|
|
bcc7eed037 | ||
|
|
abd7ad2720 | ||
|
|
58c3c8c19a | ||
|
|
f62330c73b | ||
|
|
2de85c633a | ||
|
|
121c981bb4 | ||
|
|
15396dbbc2 | ||
|
|
9ca1d3a7f7 | ||
|
|
32803d9920 | ||
|
|
5ef93778f6 | ||
|
|
7548940efa | ||
|
|
bf55776241 | ||
|
|
73167448cc | ||
|
|
c45088d1cd | ||
|
|
7336dc2b7a | ||
|
|
d2f48d5e36 | ||
|
|
422e9434d8 | ||
|
|
2b93bbd9ee | ||
|
|
021b29d2db | ||
|
|
6da28f4a27 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -95,3 +95,5 @@ sept/sept-secondary/KEYS.py
|
||||
**/build_nintendo_nx_arm
|
||||
**/build_nintendo_nx_x64
|
||||
**/build_nintendo_nx_x86
|
||||
|
||||
stratosphere/test/
|
||||
|
||||
9
Makefile
9
Makefile
@@ -78,7 +78,7 @@ dist-no-debug: all
|
||||
cp sept/sept-secondary/sept-secondary_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_01.enc
|
||||
cp sept/sept-secondary/sept-secondary_dev_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_dev_00.enc
|
||||
cp sept/sept-secondary/sept-secondary_dev_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_dev_01.enc
|
||||
cp config_templates/BCT.ini atmosphere-$(AMSVER)/atmosphere/config/BCT.ini
|
||||
cp config_templates/BCT.ini atmosphere-$(AMSVER)/atmosphere/config_templates/BCT.ini
|
||||
cp config_templates/override_config.ini atmosphere-$(AMSVER)/atmosphere/config_templates/override_config.ini
|
||||
cp config_templates/system_settings.ini atmosphere-$(AMSVER)/atmosphere/config_templates/system_settings.ini
|
||||
cp config_templates/exosphere.ini atmosphere-$(AMSVER)/atmosphere/config_templates/exosphere.ini
|
||||
@@ -99,14 +99,14 @@ dist-no-debug: all
|
||||
touch atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037/flags/boot2.flag
|
||||
cp troposphere/reboot_to_payload/reboot_to_payload.nro atmosphere-$(AMSVER)/switch/reboot_to_payload.nro
|
||||
cp troposphere/daybreak/daybreak.nro atmosphere-$(AMSVER)/switch/daybreak.nro
|
||||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-EXPERIMENTAL-$(AMSVER).zip ./*; cd ../;
|
||||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-$(AMSVER).zip ./*; cd ../;
|
||||
cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/atmosphere/fusee-secondary.bin
|
||||
cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/sept/payload.bin
|
||||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-$(AMSVER).zip ./*; cd ../;
|
||||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-$(AMSVER)-WITHOUT_MESOSPHERE.zip ./*; cd ../;
|
||||
rm -r atmosphere-$(AMSVER)
|
||||
mkdir out
|
||||
mv atmosphere-EXPERIMENTAL-$(AMSVER).zip out/atmosphere-EXPERIMENTAL-$(AMSVER).zip
|
||||
mv atmosphere-$(AMSVER).zip out/atmosphere-$(AMSVER).zip
|
||||
mv atmosphere-$(AMSVER)-WITHOUT_MESOSPHERE.zip out/atmosphere-$(AMSVER)-WITHOUT_MESOSPHERE.zip
|
||||
cp fusee/fusee-primary/fusee-primary.bin out/fusee-primary.bin
|
||||
|
||||
dist: dist-no-debug
|
||||
@@ -135,6 +135,7 @@ dist: dist-no-debug
|
||||
cp exosphere/program/sc7fw/sc7fw.elf atmosphere-$(AMSVER)-debug/exosphere-sc7fw.elf
|
||||
cp exosphere/program/rebootstub/rebootstub.elf atmosphere-$(AMSVER)-debug/exosphere-rebootstub.elf
|
||||
cp mesosphere/kernel_ldr/kernel_ldr.elf atmosphere-$(AMSVER)-debug/kernel_ldr.elf
|
||||
cp mesosphere/kernel/kernel.elf atmosphere-$(AMSVER)-debug/kernel.elf
|
||||
cp stratosphere/ams_mitm/ams_mitm.elf atmosphere-$(AMSVER)-debug/ams_mitm.elf
|
||||
cp stratosphere/boot/boot.elf atmosphere-$(AMSVER)-debug/boot.elf
|
||||
cp stratosphere/boot2/boot2.elf atmosphere-$(AMSVER)-debug/boot2.elf
|
||||
|
||||
@@ -35,6 +35,17 @@
|
||||
# mmc space, encrypted to prevent detection. This backup can be used
|
||||
# to prevent unrecoverable edits in emergencies.
|
||||
|
||||
# Key: log_port, default: 0.
|
||||
# Desc: Controls what uart port exosphere will set up for logging.
|
||||
# NOTE: 0 = UART-A, 1 = UART-B, 2 = UART-C, 3 = UART-D
|
||||
|
||||
# Key: log_baud_rate, default: 115200
|
||||
# Desc: Controls the baud rate exosphere will set up for logging.
|
||||
# NOTE: 0 is treated as equivalent to 115200.
|
||||
|
||||
# Key: log_inverted, default: 0.
|
||||
# Desc: Controls whether the logging uart port is inverted.
|
||||
|
||||
[exosphere]
|
||||
debugmode=1
|
||||
debugmode_user=0
|
||||
@@ -43,3 +54,6 @@ enable_user_pmu_access=0
|
||||
blank_prodinfo_sysmmc=0
|
||||
blank_prodinfo_emummc=0
|
||||
allow_writing_to_cal_sysmmc=0
|
||||
log_port=0
|
||||
log_baud_rate=115200
|
||||
log_inverted=0
|
||||
|
||||
@@ -38,6 +38,20 @@
|
||||
; Please note this setting may be removed in a
|
||||
; future release of Atmosphere.
|
||||
; enable_deprecated_hid_mitm = u8!0x0
|
||||
; Controls whether am sees system settings "DebugModeFlag" as
|
||||
; enabled or disabled.
|
||||
; 0 = Disabled (not debug mode), 1 = Enabled (debug mode)
|
||||
; enable_am_debug_mode = u8!0x0
|
||||
; Controls whether dns.mitm is enabled
|
||||
; 0 = Disabled, 1 = Enabled
|
||||
; enable_dns_mitm = u8!0x1
|
||||
; Controls whether dns.mitm uses the default redirections in addition to
|
||||
; whatever is specified in the user's hosts file.
|
||||
; 0 = Disabled (use hosts file contents), 1 = Enabled (use defaults and hosts file contents)
|
||||
; add_defaults_to_dns_hosts = u8!0x1
|
||||
; Controls whether dns.mitm logs to the sd card for debugging
|
||||
; 0 = Disabled, 1 = Enabled
|
||||
; enable_dns_mitm_debug_log = u8!0x0
|
||||
[hbloader]
|
||||
; Controls the size of the homebrew heap when running as applet.
|
||||
; If set to zero, all available applet memory is used as heap.
|
||||
|
||||
@@ -5,6 +5,7 @@ Building Atmosphère is a very straightforward process that relies almost exclus
|
||||
+ [devkitA64](https://devkitpro.org)
|
||||
+ [devkitARM](https://devkitpro.org)
|
||||
+ [Python 2](https://www.python.org) (Python 3 may work as well, but this is not guaranteed)
|
||||
+ [LZ4](https://pypi.org/project/lz4)
|
||||
+ [PyCryptodome](https://pypi.org/project/pycryptodome) (optional)
|
||||
|
||||
## Instructions
|
||||
@@ -17,12 +18,15 @@ Building Atmosphère is a very straightforward process that relies almost exclus
|
||||
+ `devkitARM`
|
||||
+ `devkitarm-rules`
|
||||
|
||||
3. (Optional) In order to build [sept](components/sept.md) the pycryptodome PyPi package is required, which can be installed by running `pip install pycryptodome` under the installed Python environment of your choice or by installing the complete zip package to support the `make dist` recipe. This is an optional step included for advanced users who have the ability to provide the necessary encryption/signing keys themselves.
|
||||
3. Install the following library via python's package manager `pip`, required by [exosphere](components/exosphere.md):
|
||||
+ `lz4`
|
||||
|
||||
4. It is, instead, possible to build [sept](components/sept.md) by providing previously encrypted/signed binaries distributed by official Atmosphère release packages. In order to do so, export the following variables in your current environment:
|
||||
4. (Optional) In order to build [sept](components/sept.md) the pycryptodome PyPi package is required, which can be installed by running `pip install pycryptodome` under the installed Python environment of your choice or by installing the complete zip package to support the `make dist` recipe. This is an optional step included for advanced users who have the ability to provide the necessary encryption/signing keys themselves.
|
||||
|
||||
5. It is, instead, possible to build [sept](components/sept.md) by providing previously encrypted/signed binaries distributed by official Atmosphère release packages. In order to do so, export the following variables in your current environment:
|
||||
+ `SEPT_00_ENC_PATH` (must point to the `sept-secondary_00.enc` file)
|
||||
+ `SEPT_01_ENC_PATH` (must point to the `sept-secondary_01.enc` file)
|
||||
+ `SEPT_DEV_00_ENC_PATH` (must point to the `sept-secondary_dev_00.enc` file)
|
||||
+ `SEPT_DEV_01_ENC_PATH` (must point to the `sept-secondary_dev_01.enc` file)
|
||||
|
||||
5. Finally, clone the Atmosphère repository and run `make` under its root directory.
|
||||
6. Finally, clone the Atmosphère repository and run `make` under its root directory.
|
||||
|
||||
@@ -1,4 +1,80 @@
|
||||
# Changelog
|
||||
## 0.18.1
|
||||
+ A number of minor issues were fixed, including:
|
||||
+ The new `dns.mitm` module added in 0.18.0 no longer fatal errors when receiving port=nullptr.
|
||||
+ This fixes youtube ad-blocking, and possibly other usecases.
|
||||
+ A bug was fixed that caused ams.mitm to incorrectly cache data storages.
|
||||
+ This potentially broke DLC when using romfs mods, and could have caused other issues (e.g. with custom themes, and maybe other cases).
|
||||
+ A bug was fixed in power state control module registration.
|
||||
+ This might fix a weird edge case with system module dependencies on sleep/wake, but probably nobody should notice any differences.
|
||||
+ A bug was fixed where mesosphere sometimes treated virtual core IDs as though they were physical core IDs.
|
||||
+ This had zero impact, because for Switch virtual core == physical core, but it could have affected future platforms if it had remained unresolved.
|
||||
+ Several issues were fixed, and usability and stability were improved.
|
||||
## 0.18.0
|
||||
+ A new mitm module was added (`dns.mitm`).
|
||||
+ This provides a highly configurable mechanism for redirecting DNS resolution requests.
|
||||
+ By default atmosphère redirects resolution requests for official telemetry servers to a loopback address.
|
||||
+ Documentation on how to configure `dns.mitm` to meet your more specific needs may be found [here](https://github.com/Atmosphere-NX/Atmosphere/blob/master/docs/features/dns_mitm.md).
|
||||
+ The service framework API (`sf`) was refactored to be more accurate to official logic and greatly reduce memory requirements.
|
||||
+ The comparison of atmosphère module memory usage versus Nintendo's found [here](https://github.com/Atmosphere-NX/Atmosphere/wiki/Memory-Comparisons) was updated to reflect this.
|
||||
+ **Please Note**: If you are a developer using the libstratosphere service APIs, some updating may be required. Contact SciresM#0524 on discord for assistance if required.
|
||||
+ A number of deprecations were removed, following a general codebase cleanup:
|
||||
+ The `sm` extension to not unregister services on connection close was superseded by official opt-in logic in 11.0.0, and has been removed in favor of official logic.
|
||||
+ This should have zero impact on users.
|
||||
+ The temporary `hid-mitm` added in 0.9.0 has finally been removed, following over a year of deprecation.
|
||||
+ There shouldn't be any homebrew in use still affected by this, but the situation will be monitored.
|
||||
+ If this is somehow still a real issue, an unaffiliated hid mitm sysmodule providing the same functionality can be created and released, separate from atmosphère itself.
|
||||
+ Several issues were fixed, and usability and stability were improved.
|
||||
## 0.17.1
|
||||
+ A number of atmosphère's modules were using more memory than their Nintendo equivalent's in 0.17.0; a number of code generatio tweaks have been applied to fix this across the board.
|
||||
+ A detailed comparison of atmosphère module memory usage versus Nintendo's was made and can be found [here](https://github.com/Atmosphere-NX/Atmosphere/wiki/Memory-Comparisons).
|
||||
+ Several minor bugs were fixed, including:
|
||||
+ A bug was fixed in mesosphère that caused games which attempt to map more memory than the Switch has to fail.
|
||||
+ This affected "Piczle Lines DX 500 More Puzzles!", and possibly other games.
|
||||
+ Enabling configuration to "blank" PRODINFO no longer causes a hang on Mariko devices (or any devices with newer format).
|
||||
+ Several issues were fixed, and usability and stability were improved.
|
||||
## 0.17.0
|
||||
+ fusee was heavily rewritten in order to add support for Mariko hardware.
|
||||
+ **Please Note**: Mariko hardware currently has no (and may not ever have any) software exploits; fusee works when loaded from bootloader context with the right keys in the security engine. No means of getting the system into this state is provided.
|
||||
+ An issue was fixed in the way shutdown was performed on Erista hardware.
|
||||
+ This fixes an issue that caused OFW to black screen on boot after power off from atmosphere without first doing a reboot.
|
||||
+ This also substantially improves power drain when the system is shut off; consoles powered off from Atmosphere should now drain battery at the same reduced rate as original firmware.
|
||||
+ A number of minor changes were made, including:
|
||||
+ A number of inconsistencies in the build system were fixed.
|
||||
+ Fow those building atmosphère at home, the `boot` sysmodule will no longer rebuild every time make is invoked.
|
||||
+ This substantially improves build times during development iteration.
|
||||
+ `sm` was updated to more accurately reflect how official code manages request deferral.
|
||||
+ `mesosphère` was updated to more accurately reflect official kernel management of the trace buffer.
|
||||
+ `mesosphère` was updated to improve kernel loader's logic by taking advantage of the assumption that we only boot our kernel, not Nintendo's.
|
||||
+ As it has been a few months with zero reported issues, `mesosphère` is now opt-out.
|
||||
+ Users who wish to begin using or continue using mesosphere should use the standard/cool kids zip ("atmosphere-").
|
||||
+ Users who wish to opt-out of mesosphere should download and extract the opt-out zip ("atmosphere-WITHOUT_MESOSPHERE-").
|
||||
+ Several issues were fixed, and usability and stability were improved.
|
||||
## 0.16.2
|
||||
+ Atmosphère release zips no longer bundle BCT.ini, instead relying on defaults in code.
|
||||
+ This means atmosphere updates should no longer overwrite any user configuration at all.
|
||||
+ If you wish to modify BCT.ini config, copy the template from /config_templates/ as with other configuration.
|
||||
+ `pgl` and `creport` were further updated to reflect differences in official behavior in 11.0.0.
|
||||
+ An issue was fixed that caused creport to be launched multiple times on process crash.
|
||||
+ This fixes the "duplicate reports" issue that sometimes plagued people.
|
||||
+ A new system setting (`atmosphere!enable_am_debug_mode`) configuring am to use debug mode.
|
||||
+ If you are not a developer or don't see a clear use for this, leave it configured to the default (off).
|
||||
+ Reboot to payload NRO was updated to fix support with certain payloads.
|
||||
+ Support was fixed for atmosphere's extension to support homebrew use of new (8.0.0+) kernel mappings.
|
||||
+ In particular, when running tracing debug builds of `mesosphère`, hbloader now has access to the kernel trace buffer.
|
||||
+ Several issues were fixed, and usability and stability were improved.
|
||||
## 0.16.1
|
||||
+ Support was added for 11.0.1.
|
||||
+ `mesosphère` was updated to reflect the latest official kernel behavior.
|
||||
+ A new svc::InfoType added in 11.0.0 was implemented (it wasn't discovered before 0.16.0 released).
|
||||
+ The new Control Flow Integrity (CFI) logic added in 11.0.0 kernel was implemented.
|
||||
+ `fs` logic was refactored and cleaned up to reflect some newer sysmodule behavioral and structural changes.
|
||||
+ `exosphère` was updated to allow dynamic control of what uart port is used for logging.
|
||||
+ This can be controlled by editing the `log_port`, `log_baud_rate`, and `log_inverted` fields in `exosphere.ini`.
|
||||
+ `mesosphère` was updated to improve debugging capabilities.
|
||||
+ This is still a work in progress, but developers may be interested.
|
||||
+ A bug was fixed that caused `fatal` to fatal error if the fatal process was already being debugged.
|
||||
+ Several issues were fixed, and usability and stability were improved.
|
||||
## 0.16.0
|
||||
+ Support was added for 11.0.0.
|
||||
+ `exosphère` was updated to reflect the latest official secure monitor behavior.
|
||||
|
||||
@@ -33,3 +33,8 @@ in settings as `#.#.#|AMS #.#.#|?` with `? = S` when running under system eMMC o
|
||||
### System Settings
|
||||
set_mitm intercepts the `GetSettingsItemValueSize` and `GetSettingsItemValue` commands for all requesters.
|
||||
It does so in order to enable user configuration of system settings, which are parsed from `/atmosphere/system_settings.ini` on boot. See [here](../../features/configurations.md) for more information on the system settings format.
|
||||
|
||||
## dns_mitm
|
||||
dns_mitm enables intercepting requests to dns resolution services, to enable redirecting requests for specified hostnames.
|
||||
|
||||
For documentation, see [here](../../features/dns_mitm.md).
|
||||
|
||||
53
docs/features/dns_mitm.md
Normal file
53
docs/features/dns_mitm.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# DNS.mitm
|
||||
As of 0.18.0, atmosphère provides a mechanism for redirecting DNS resolution requests.
|
||||
|
||||
By default, atmosphère redirects resolution requests for official telemetry servers, redirecting them to a loopback address.
|
||||
|
||||
## Hosts files
|
||||
|
||||
DNS.mitm can be configured through the usage of a slightly-extended `hosts` file format, which is parsed only once on system startup.
|
||||
|
||||
In particular, hosts files parsed by DNS.mitm have the following extensions to the usual format:
|
||||
+ `*` is treated as a wildcard character, matching any collection of 0 or more characters wherever it occurs in a hostname.
|
||||
+ `%` is treated as a stand-in for the value of `nsd!environment_identifier`. This is always `lp1`, on production devices.
|
||||
|
||||
If multiple entries in a host file match a domain, the last-defined match is used.
|
||||
|
||||
Please note that homebrew may trigger a hosts file re-parse by sending the extension IPC command 65000 ("AtmosphereReloadHostsFile") to a connected `sfdnsres` session.
|
||||
|
||||
### Hosts file selection
|
||||
|
||||
Atmosphère will try to read hosts from the following file paths, in order, stopping once it successfully performs a file read:
|
||||
|
||||
+ (emummc only) `/atmosphere/hosts/emummc_%04lx.txt`, formatted with the emummc's id number (see `emummc.ini`).
|
||||
+ (emummc only) `/atmosphere/hosts/emummc.txt`.
|
||||
+ (sysmmc only) `/atmosphere/hosts/sysmmc.txt`.
|
||||
+ `/atmosphere/hosts/default.txt`
|
||||
|
||||
If `/atmosphere/hosts/default.txt` does not exist, atmosphère will create it to contain the defaults.
|
||||
|
||||
### Atmosphère defaults
|
||||
|
||||
By default, atmosphère's default redirections are parsed **in addition to** the contents of the loaded hosts file.
|
||||
|
||||
This is equivalent to thinking of the loaded hosts file as having the atmosphère defaults prepended to it.
|
||||
|
||||
This setting is considered desirable, because it minimizes the telemetry risks if a user forgets to update a custom hosts file on a system update which changes the telemetry servers.
|
||||
|
||||
This behavior can be opted-out from by setting `atmosphere!add_defaults_to_dns_hosts = u8!0x0` in `system_settings.ini`.
|
||||
|
||||
The current default redirections are:
|
||||
|
||||
```
|
||||
# Nintendo telemetry servers
|
||||
127.0.0.1 receive-%.dg.srv.nintendo.net receive-%.er.srv.nintendo.net
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
On startup (or on hosts file re-parse), DNS.mitm will log both what hosts file it selected and the contents of all redirections it parses to `/atmosphere/logs/dns_mitm_startup.log`.
|
||||
|
||||
In addition, if the user sets `atmosphere!enable_dns_mitm_debug_log = u8!0x1` in `system_settings.ini`, DNS.mitm will log all requests to GetHostByName/GetAddrInfo to `/atmosphere/logs/dns_mitm_debug.log`. All redirections will be noted when they occur.
|
||||
|
||||
## Opting-out of DNS.mitm entirely
|
||||
If you wish to disable DNS.mitm entirely, `system_settings.ini` can be edited to set `atmosphere!enable_dns_mitm = u8!0x0`.
|
||||
@@ -1,42 +1,32 @@
|
||||
# Planned Features
|
||||
atmosphère has a number of features that are either works-in-progress or planned. Please note that while time-estimates are given, they are loose, and things may be completed sooner or later than advertised.
|
||||
|
||||
The following descriptions were last updated on July 7th, 2020.
|
||||
|
||||
## ams-on-mariko
|
||||
* **Description**: Atmosphere cannot run as-is on Mariko hardware. A large number of changes are needed in many components. Although secure monitor support is complete in exosphere, additional work is needed on the bootloader and stratosphere sides as well. Mariko support will also require further design thought; atmosphere's debugging design heavily relies on reboot-to-payload and (more generally) the ability to perform warmboot bootrom hax at will. This is not possible on Mariko, and will require a new design/software support for whatever solution is chosen.
|
||||
* **Development Status**: Planned.
|
||||
* **Estimated Time**: Summer 2020
|
||||
|
||||
## settings reimplementation
|
||||
* **Description**: A planned reimplementation of the settings system module, and with it a removal of the settings mitm. This will greatly simplify atmosphère's boot process, and will allow much more flexible control over the various system settings.
|
||||
* **Development Status**: Undergoing research/initial development by Adubbz.
|
||||
* **Estimated Time**: Mid 2020
|
||||
|
||||
## mesosphere
|
||||
* **Description**: mesosphère is a reimplementation of the Horizon operating system's Kernel. It aims to provide an open-source reference for Nintendo's code.
|
||||
* **Development Status**: Under active development by SciresM.
|
||||
* **Estimated Time**: Mid-to-Late 2020
|
||||
The following descriptions were last updated on January 14th, 2021
|
||||
|
||||
## tma reimplementation
|
||||
* **Description** tma ("target manager agent") is a system module that manages communication between the Switch and a client PC. Atmosphere's implementation will allow homebrew on the switch to communicate with a connected PC to do various operations such as exchanging data or interacting with files. It will also serve as the communicator for Atmosphère's planned debugger. This will also include PC-side software for interacting with the Switch.
|
||||
* **Development Status**: Planned. Switch-side code is fully implemented but needs heavy refactoring/rebasing, as the code was originally authored in 2018.
|
||||
* **Estimated Time**: Late 2020-2021.
|
||||
* **Estimated Time**: 2021-2022.
|
||||
|
||||
## dmnt.gen2 reimplementation
|
||||
* **Description**: A reimplementation of the Switch's debug monitor, dmnt will provide an interface for debugging applications or system modules running on the Switch. This will include a gdbstub for debugging actively-running system components or applications.
|
||||
* **Development Status**: Planned
|
||||
* **Estimated Time**: 2021
|
||||
* **Estimated Time**: 2021-2022
|
||||
|
||||
## fs reimplementation
|
||||
* **Description**: Following mesosphère's completion, atmosphère will have reimplemented all components of the BootImagePackage firmware except for the filesystem services system module. Reimplementing fs will allow for fixing Nintendo bugs (such as corruption when using exFAT filesystems and encoding inconsistencies with UTF-8 and Shift-JIS).
|
||||
* **Development Status**: Planned.
|
||||
* **Estimated Time**: 2021-2022.
|
||||
|
||||
## settings reimplementation
|
||||
* **Description**: A planned reimplementation of the settings system module, and with it a removal of the settings mitm. This will greatly simplify atmosphère's boot process, and will allow much more flexible control over the various system settings.
|
||||
* **Development Status**: Pending development by Adubbz.
|
||||
* **Estimated Time**: Unclear, pending developer availability.
|
||||
|
||||
## thermosphère
|
||||
* **Description**: A general-purpose hypervisor, thermosphère will enable the virtualization of the Switch's operating system; this is planned to enable debugging of the Switch's kernel.
|
||||
* **Development Status**: Under semi-active development by TuxSH.
|
||||
* **Estimated Time**: 2020-2021.
|
||||
* **Development Status**: Pending development by TuxSH.
|
||||
* **Estimated Time**: Unclear, pending developer availability.
|
||||
|
||||
## other planned features
|
||||
* **Description**: General system stability improvements to enhance the user's experience.
|
||||
@@ -60,3 +50,11 @@ Please note that this is not an exhaustive list of features present in atmosphè
|
||||
## exosphere re-write
|
||||
* **Description**: exosphère, atmosphère's reimplementation of Horizon's Secure Monitor, was the first component authored for the project in early 2018. It is written in C, and in a style very different from the rest of atmosphère's code. In addition, exosphère was written to conform to constraints that no longer apply in an environment where it is not launched from the web browser, and where using a custom firmware image to orchestrate wake-from-sleep is possible. exosphère currently uses all but 1 KB of the space available to it, putting it at risk of breaking as future firmware updates are supported. A re-write will solve these issues.
|
||||
* **Completion Time**: June 2020
|
||||
|
||||
## mesosphere
|
||||
* **Description**: mesosphère is a reimplementation of the Horizon operating system's Kernel. It aims to provide an open-source reference for Nintendo's code.
|
||||
* **Estimated Time**: September 2020
|
||||
|
||||
## ams-on-mariko
|
||||
* **Description**: Atmosphere cannot run as-is on Mariko hardware. A large number of changes are needed in many components. Although secure monitor support is complete in exosphere, additional work is needed on the bootloader and stratosphere sides as well. Mariko support will also require further design thought; atmosphere's debugging design heavily relies on reboot-to-payload and (more generally) the ability to perform warmboot bootrom hax at will. This is not possible on Mariko, and will require a new design/software support for whatever solution is chosen.
|
||||
* **Completion Time**: January 2021
|
||||
@@ -6,7 +6,7 @@
|
||||
[subrepo]
|
||||
remote = https://github.com/m4xw/emuMMC
|
||||
branch = develop
|
||||
commit = 6fd752dad13c02d482a5d89c24f4e8ce8b9d8f56
|
||||
parent = 4f1a4e74992aa84b8ab84bccacc720e2d5823791
|
||||
commit = 5eed18eb527bbaa63aee5323c26de5b0cca6d28e
|
||||
parent = 021b29d2dbc8ed0469bc822393e58c9f0d174d57
|
||||
method = rebase
|
||||
cmdver = 0.4.1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw***
|
||||
|
||||
### Supported Horizon Versions
|
||||
**1.0.0 - 10.0.0**
|
||||
**1.0.0 - 11.0.0**
|
||||
|
||||
## Features
|
||||
* Arbitrary SDMMC backend selection
|
||||
|
||||
@@ -71,6 +71,7 @@ static const fs_offsets_t GET_OFFSET_STRUCT_NAME(vers) = { \
|
||||
.nand_mutex = FS_OFFSET##vers##_NAND_MUTEX, \
|
||||
.active_partition = FS_OFFSET##vers##_ACTIVE_PARTITION, \
|
||||
.sdmmc_das_handle = FS_OFFSET##vers##_SDMMC_DAS_HANDLE, \
|
||||
.sdmmc_accessor_controller_open = FS_OFFSET##vers##_SDMMC_WRAPPER_CONTROLLER_OPEN, \
|
||||
.sdmmc_accessor_controller_close = FS_OFFSET##vers##_SDMMC_WRAPPER_CONTROLLER_CLOSE, \
|
||||
.sd_das_init = FS_OFFSET##vers##_SD_DAS_INIT, \
|
||||
.nintendo_paths = FS_OFFSET##vers##_NINTENDO_PATHS, \
|
||||
|
||||
@@ -41,6 +41,7 @@ typedef struct {
|
||||
// Misc funcs
|
||||
uintptr_t lock_mutex;
|
||||
uintptr_t unlock_mutex;
|
||||
uintptr_t sdmmc_accessor_controller_open;
|
||||
uintptr_t sdmmc_accessor_controller_close;
|
||||
// Misc data
|
||||
uintptr_t sd_mutex;
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef struct sdmmc_accessor_vt
|
||||
void *dtor;
|
||||
void *map_device_addr_space;
|
||||
void *unmap_device_addr_space;
|
||||
void *controller_open;
|
||||
uint64_t (*sdmmc_accessor_controller_open)(void *);
|
||||
uint64_t (*sdmmc_accessor_controller_close)(void *);
|
||||
uint64_t (*read_write)(void *, uint64_t, uint64_t, void *, uint64_t, uint64_t);
|
||||
// More not included because we don't use it.
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_100_LOCK_MUTEX 0x2884
|
||||
#define FS_OFFSET_100_UNLOCK_MUTEX 0x28F0
|
||||
|
||||
#define FS_OFFSET_100_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_100_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x6A8AC
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_1000_LOCK_MUTEX 0x28910
|
||||
#define FS_OFFSET_1000_UNLOCK_MUTEX 0x28960
|
||||
|
||||
#define FS_OFFSET_1000_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_1000_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1422E0
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_1000_EXFAT_LOCK_MUTEX 0x28910
|
||||
#define FS_OFFSET_1000_EXFAT_UNLOCK_MUTEX 0x28960
|
||||
|
||||
#define FS_OFFSET_1000_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_1000_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1422E0
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_1020_LOCK_MUTEX 0x28910
|
||||
#define FS_OFFSET_1020_UNLOCK_MUTEX 0x28960
|
||||
|
||||
#define FS_OFFSET_1020_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_1020_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x142740
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_1020_EXFAT_LOCK_MUTEX 0x28910
|
||||
#define FS_OFFSET_1020_EXFAT_UNLOCK_MUTEX 0x28960
|
||||
|
||||
#define FS_OFFSET_1020_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_1020_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x142740
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_1100_LOCK_MUTEX 0x28FF0
|
||||
#define FS_OFFSET_1100_UNLOCK_MUTEX 0x29040
|
||||
|
||||
#define FS_OFFSET_1100_SDMMC_WRAPPER_CONTROLLER_OPEN 0x14B840
|
||||
#define FS_OFFSET_1100_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x14B8F0
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_1100_EXFAT_LOCK_MUTEX 0x28FF0
|
||||
#define FS_OFFSET_1100_EXFAT_UNLOCK_MUTEX 0x29040
|
||||
|
||||
#define FS_OFFSET_1100_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x14B840
|
||||
#define FS_OFFSET_1100_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x14B8F0
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_200_LOCK_MUTEX 0x3264
|
||||
#define FS_OFFSET_200_UNLOCK_MUTEX 0x32D0
|
||||
|
||||
#define FS_OFFSET_200_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_200_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x733F4
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_200_EXFAT_LOCK_MUTEX 0x3264
|
||||
#define FS_OFFSET_200_EXFAT_UNLOCK_MUTEX 0x32D0
|
||||
|
||||
#define FS_OFFSET_200_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_200_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x733F4
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_210_LOCK_MUTEX 0x3264
|
||||
#define FS_OFFSET_210_UNLOCK_MUTEX 0x32D0
|
||||
|
||||
#define FS_OFFSET_210_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_210_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x737D4
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_210_EXFAT_LOCK_MUTEX 0x3264
|
||||
#define FS_OFFSET_210_EXFAT_UNLOCK_MUTEX 0x32D0
|
||||
|
||||
#define FS_OFFSET_210_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_210_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x737D4
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_300_LOCK_MUTEX 0x35CC
|
||||
#define FS_OFFSET_300_UNLOCK_MUTEX 0x3638
|
||||
|
||||
#define FS_OFFSET_300_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_300_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x8A270
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_300_EXFAT_LOCK_MUTEX 0x35CC
|
||||
#define FS_OFFSET_300_EXFAT_UNLOCK_MUTEX 0x3638
|
||||
|
||||
#define FS_OFFSET_300_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_300_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x8A270
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_301_LOCK_MUTEX 0x3638
|
||||
#define FS_OFFSET_301_UNLOCK_MUTEX 0x36A4
|
||||
|
||||
#define FS_OFFSET_301_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_301_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x8A32C
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_301_EXFAT_LOCK_MUTEX 0x3638
|
||||
#define FS_OFFSET_301_EXFAT_UNLOCK_MUTEX 0x36A4
|
||||
|
||||
#define FS_OFFSET_301_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_301_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x8A32C
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_400_LOCK_MUTEX 0x39A0
|
||||
#define FS_OFFSET_400_UNLOCK_MUTEX 0x3A0C
|
||||
|
||||
#define FS_OFFSET_400_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_400_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x9DB48
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_400_EXFAT_LOCK_MUTEX 0x39A0
|
||||
#define FS_OFFSET_400_EXFAT_UNLOCK_MUTEX 0x3A0C
|
||||
|
||||
#define FS_OFFSET_400_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_400_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x9DB48
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
#define FS_OFFSET_410_LOCK_MUTEX 0x39A0
|
||||
#define FS_OFFSET_410_UNLOCK_MUTEX 0x3A0C
|
||||
|
||||
#define FS_OFFSET_410_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x9DBAC
|
||||
#define FS_OFFSET_410_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_410_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x9DBAC
|
||||
|
||||
// Misc Data
|
||||
#define FS_OFFSET_410_SD_MUTEX 0xE80268
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_410_EXFAT_LOCK_MUTEX 0x39A0
|
||||
#define FS_OFFSET_410_EXFAT_UNLOCK_MUTEX 0x3A0C
|
||||
|
||||
#define FS_OFFSET_410_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_410_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x9DBAC
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_500_LOCK_MUTEX 0x4080
|
||||
#define FS_OFFSET_500_UNLOCK_MUTEX 0x40D0
|
||||
|
||||
#define FS_OFFSET_500_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_500_SDMMC_WRAPPER_CONTROLLER_CLOSE 0xC9380
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_500_EXFAT_LOCK_MUTEX 0x4080
|
||||
#define FS_OFFSET_500_EXFAT_UNLOCK_MUTEX 0x40D0
|
||||
|
||||
#define FS_OFFSET_500_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_500_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0xC9380
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_510_LOCK_MUTEX 0x4080
|
||||
#define FS_OFFSET_510_UNLOCK_MUTEX 0x40D0
|
||||
|
||||
#define FS_OFFSET_510_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_510_SDMMC_WRAPPER_CONTROLLER_CLOSE 0xC9750
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_510_EXFAT_LOCK_MUTEX 0x4080
|
||||
#define FS_OFFSET_510_EXFAT_UNLOCK_MUTEX 0x40D0
|
||||
|
||||
#define FS_OFFSET_510_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_510_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0xC9750
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_600_LOCK_MUTEX 0x1412C0
|
||||
#define FS_OFFSET_600_UNLOCK_MUTEX 0x141310
|
||||
|
||||
#define FS_OFFSET_600_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_600_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x148500
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_600_EXFAT_LOCK_MUTEX 0x14C9C0
|
||||
#define FS_OFFSET_600_EXFAT_UNLOCK_MUTEX 0x14CA10
|
||||
|
||||
#define FS_OFFSET_600_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_600_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x153C00
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_700_LOCK_MUTEX 0x148A90
|
||||
#define FS_OFFSET_700_UNLOCK_MUTEX 0x148AE0
|
||||
|
||||
#define FS_OFFSET_700_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_700_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x14FD50
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_700_EXFAT_LOCK_MUTEX 0x154040
|
||||
#define FS_OFFSET_700_EXFAT_UNLOCK_MUTEX 0x154090
|
||||
|
||||
#define FS_OFFSET_700_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_700_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x15B300
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_800_LOCK_MUTEX 0x14B6D0
|
||||
#define FS_OFFSET_800_UNLOCK_MUTEX 0x14B720
|
||||
|
||||
#define FS_OFFSET_800_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_800_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1529E0
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_800_EXFAT_LOCK_MUTEX 0x156C80
|
||||
#define FS_OFFSET_800_EXFAT_UNLOCK_MUTEX 0x156CD0
|
||||
|
||||
#define FS_OFFSET_800_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_800_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x15DF90
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_810_LOCK_MUTEX 0x14B6D0
|
||||
#define FS_OFFSET_810_UNLOCK_MUTEX 0x14B720
|
||||
|
||||
#define FS_OFFSET_810_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_810_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1529E0
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_810_EXFAT_LOCK_MUTEX 0x156C80
|
||||
#define FS_OFFSET_810_EXFAT_UNLOCK_MUTEX 0x156CD0
|
||||
|
||||
#define FS_OFFSET_810_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_810_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x15DF90
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_900_LOCK_MUTEX 0x25280
|
||||
#define FS_OFFSET_900_UNLOCK_MUTEX 0x252D0
|
||||
|
||||
#define FS_OFFSET_900_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_900_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x137740
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_900_EXFAT_LOCK_MUTEX 0x25280
|
||||
#define FS_OFFSET_900_EXFAT_UNLOCK_MUTEX 0x252D0
|
||||
|
||||
#define FS_OFFSET_900_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_900_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x137740
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_910_LOCK_MUTEX 0x25280
|
||||
#define FS_OFFSET_910_UNLOCK_MUTEX 0x252D0
|
||||
|
||||
#define FS_OFFSET_910_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_910_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x137750
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define FS_OFFSET_910_EXFAT_LOCK_MUTEX 0x25280
|
||||
#define FS_OFFSET_910_EXFAT_UNLOCK_MUTEX 0x252D0
|
||||
|
||||
#define FS_OFFSET_910_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0
|
||||
#define FS_OFFSET_910_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x137750
|
||||
|
||||
// Misc Data
|
||||
|
||||
@@ -271,7 +271,7 @@ int sdmmc_nand_get_active_partition_index()
|
||||
|
||||
static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned int num_sectors, bool is_write)
|
||||
{
|
||||
if ((emuMMC_ctx.EMMC_Type == emuMMC_SD))
|
||||
if ((emuMMC_ctx.EMMC_Type == emuMMC_SD_Raw))
|
||||
{
|
||||
// raw partition sector offset: emuMMC_ctx.EMMC_StoragePartitionOffset.
|
||||
sector += emuMMC_ctx.EMMC_StoragePartitionOffset;
|
||||
@@ -318,6 +318,31 @@ static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned
|
||||
return res;
|
||||
}
|
||||
|
||||
// Controller open wrapper
|
||||
uint64_t sdmmc_wrapper_controller_open(int mmc_id)
|
||||
{
|
||||
uint64_t result;
|
||||
sdmmc_accessor_t *_this;
|
||||
_this = sdmmc_accessor_get(mmc_id);
|
||||
|
||||
if (_this != NULL)
|
||||
{
|
||||
// Lock eMMC xfer while SD card is being initialized by FS.
|
||||
if (_this == sdmmc_accessor_get(FS_SDMMC_SD))
|
||||
mutex_lock_handler(FS_SDMMC_EMMC); // Recursive Mutex, handler will lock SD as well if custom_driver
|
||||
|
||||
result = _this->vtab->sdmmc_accessor_controller_open(_this);
|
||||
|
||||
// Unlock eMMC.
|
||||
if (_this == sdmmc_accessor_get(FS_SDMMC_SD))
|
||||
mutex_unlock_handler(FS_SDMMC_EMMC);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
fatal_abort(Fatal_OpenAccessor);
|
||||
}
|
||||
|
||||
// Controller close wrapper
|
||||
uint64_t sdmmc_wrapper_controller_close(int mmc_id)
|
||||
{
|
||||
@@ -389,7 +414,7 @@ uint64_t sdmmc_wrapper_read(void *buf, uint64_t bufSize, int mmc_id, unsigned in
|
||||
if (first_sd_read)
|
||||
{
|
||||
first_sd_read = false;
|
||||
if (emuMMC_ctx.EMMC_Type == emuMMC_SD)
|
||||
if (emuMMC_ctx.EMMC_Type == emuMMC_SD_Raw)
|
||||
{
|
||||
// Because some SD cards have issues with emuMMC's driver
|
||||
// we currently swap to FS's driver after first SD read
|
||||
@@ -400,7 +425,7 @@ uint64_t sdmmc_wrapper_read(void *buf, uint64_t bufSize, int mmc_id, unsigned in
|
||||
}
|
||||
}
|
||||
|
||||
// Call hekates driver.
|
||||
// Call hekate's driver.
|
||||
if (sdmmc_storage_read(&sd_storage, sector, num_sectors, buf))
|
||||
{
|
||||
mutex_unlock_handler(mmc_id);
|
||||
|
||||
@@ -52,6 +52,7 @@ void mutex_lock_handler(int mmc_id);
|
||||
void mutex_unlock_handler(int mmc_id);
|
||||
|
||||
// Hooks
|
||||
uint64_t sdmmc_wrapper_controller_open(int mmc_id);
|
||||
uint64_t sdmmc_wrapper_controller_close(int mmc_id);
|
||||
uint64_t sdmmc_wrapper_read(void *buf, uint64_t bufSize, int mmc_id, unsigned int sector, unsigned int num_sectors);
|
||||
uint64_t sdmmc_wrapper_write(int mmc_id, unsigned int sector, unsigned int num_sectors, void *buf, uint64_t bufSize);
|
||||
|
||||
@@ -30,7 +30,7 @@ enum emuMMC_Type
|
||||
emuMMC_EMMC = 0,
|
||||
|
||||
// SD Device raw
|
||||
emuMMC_SD,
|
||||
emuMMC_SD_Raw,
|
||||
// SD Device File
|
||||
emuMMC_SD_File,
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ volatile __attribute__((aligned(0x1000))) emuMMC_ctx_t emuMMC_ctx = {
|
||||
.fs_ver = FS_VER_MAX,
|
||||
|
||||
// SD Default Metadata
|
||||
.SD_Type = emuMMC_SD,
|
||||
.SD_Type = emuMMC_SD_Raw,
|
||||
.SD_StoragePartitionOffset = 0,
|
||||
|
||||
// EMMC Default Metadata
|
||||
@@ -285,6 +285,9 @@ void setup_hooks(void)
|
||||
INJECT_HOOK(fs_offsets->sdmmc_wrapper_read, sdmmc_wrapper_read);
|
||||
// sdmmc_wrapper_write hook
|
||||
INJECT_HOOK(fs_offsets->sdmmc_wrapper_write, sdmmc_wrapper_write);
|
||||
// sdmmc_wrapper_controller_open hook
|
||||
if (fs_offsets->sdmmc_accessor_controller_open)
|
||||
INJECT_HOOK(fs_offsets->sdmmc_accessor_controller_open, sdmmc_wrapper_controller_open);
|
||||
// sdmmc_wrapper_controller_close hook
|
||||
INJECT_HOOK(fs_offsets->sdmmc_accessor_controller_close, sdmmc_wrapper_controller_close);
|
||||
|
||||
@@ -346,7 +349,7 @@ static void load_emummc_ctx(void)
|
||||
emuMMC_ctx.id = config.base_cfg.id;
|
||||
emuMMC_ctx.EMMC_Type = (enum emuMMC_Type)config.base_cfg.type;
|
||||
emuMMC_ctx.fs_ver = (enum FS_VER)config.base_cfg.fs_version;
|
||||
if (emuMMC_ctx.EMMC_Type == emuMMC_SD)
|
||||
if (emuMMC_ctx.EMMC_Type == emuMMC_SD_Raw)
|
||||
{
|
||||
emuMMC_ctx.EMMC_StoragePartitionOffset = config.partition_cfg.start_sector;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ $(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/l
|
||||
|
||||
program.lz4.o: program_lz4.h
|
||||
|
||||
program.lz4.o program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
||||
program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
||||
@echo $(notdir $<)
|
||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
||||
@mkdir -p tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace ams::secmon::fatal {
|
||||
}
|
||||
}
|
||||
|
||||
void EnableBacklightForVendor2050ForHardwareTypeFive(int brightness) {
|
||||
void EnableBacklightForVendor2050ForAula(int brightness) {
|
||||
/* Enable FRAME_END_INT */
|
||||
reg::Write(g_disp1_regs + sizeof(u32) * DC_CMD_INT_ENABLE, 2);
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace ams::secmon::fatal {
|
||||
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_BL_EN, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
|
||||
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_RST, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
|
||||
|
||||
if (fuse::GetHardwareType() == fuse::HardwareType_Five) {
|
||||
if (fuse::GetHardwareType() == fuse::HardwareType_Aula) {
|
||||
/* Configure LCD backlight. */
|
||||
reg::SetBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x4);
|
||||
reg::SetBits(g_gpio_regs + GPIO_PORT6_OE_1, 0x4);
|
||||
@@ -384,7 +384,7 @@ namespace ams::secmon::fatal {
|
||||
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_BL_EN, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
|
||||
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_RST, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
|
||||
|
||||
if (hw_type == fuse::HardwareType_Five) {
|
||||
if (hw_type == fuse::HardwareType_Aula) {
|
||||
/* Configure LCD backlight. */
|
||||
reg::SetBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x4);
|
||||
reg::SetBits(g_gpio_regs + GPIO_PORT6_OE_1, 0x4);
|
||||
@@ -429,7 +429,7 @@ namespace ams::secmon::fatal {
|
||||
reg::SetBits(g_gpio_regs + GPIO_PORT6_OUT_1, 0x4);
|
||||
util::WaitMicroSeconds(60'000ul);
|
||||
|
||||
if (hw_type == fuse::HardwareType_Five) {
|
||||
if (hw_type == fuse::HardwareType_Aula) {
|
||||
reg::Write(g_dsi_regs + sizeof(u32) * DSI_BTA_TIMING, 0x40103);
|
||||
} else {
|
||||
reg::Write(g_dsi_regs + sizeof(u32) * DSI_BTA_TIMING, 0x50204);
|
||||
@@ -593,7 +593,7 @@ namespace ams::secmon::fatal {
|
||||
/* Enable backlight. */
|
||||
constexpr auto DisplayBrightness = 100;
|
||||
if (GetLcdVendor() == 0x2050) {
|
||||
EnableBacklightForVendor2050ForHardwareTypeFive(DisplayBrightness);
|
||||
EnableBacklightForVendor2050ForAula(DisplayBrightness);
|
||||
} else {
|
||||
EnableBacklightForGeneric(DisplayBrightness);
|
||||
}
|
||||
|
||||
@@ -64,17 +64,9 @@ namespace ams::secmon::boot {
|
||||
/* Configure warmboot to set Set FUSE_PRIVATEKEYDISABLE to KEY_INVISIBLE. */
|
||||
reg::ReadWrite(pmc + APBDEV_PMC_SECURE_SCRATCH21, REG_BITS_VALUE(4, 1, 1));
|
||||
|
||||
/* Write the warmboot key. */
|
||||
/* TODO: This is necessary for mariko. We should decide how to handle this. */
|
||||
/* In particular, mariko will need to support loading older-than-expected warmboot firmware. */
|
||||
/* We could hash the warmboot firmware and use a lookup table, or require bootloader to provide */
|
||||
/* The warmboot key as a parameter. The latter is a better solution, but it would be nice to take */
|
||||
/* care of it here. Perhaps we should read the number of anti-downgrade fuses burnt, and translate that */
|
||||
/* to the warmboot key? To be decided during the process of implementing ams-on-mariko support. */
|
||||
reg::Write(pmc + APBDEV_PMC_SECURE_SCRATCH32, 0x129);
|
||||
|
||||
/* TODO: Fix to ensure correct scratch contents on mariko, as otherwise wb is broken. */
|
||||
AMS_ABORT_UNLESS(fuse::GetSocType() != fuse::SocType_Mariko);
|
||||
/* NOTE: Here, Nintendo writes the warmboot key. */
|
||||
/* However, we rely on the bootloader (e.g. fusee/hekate) having already done this. */
|
||||
/* reg::Write(pmc + APBDEV_PMC_SECURE_SCRATCH32, ...); */
|
||||
}
|
||||
|
||||
/* This function derives the master kek and device keys using the tsec root key. */
|
||||
|
||||
@@ -409,8 +409,8 @@ namespace ams::secmon {
|
||||
reg0 |= reg::Encode(SLAVE_SECURITY_REG_BITS_ENUM(0, CEC, ENABLE));
|
||||
}
|
||||
|
||||
/* Icosa, Iowa, and Five all set I2C4 to be secure. */
|
||||
if (hw_type == fuse::HardwareType_Icosa && hw_type == fuse::HardwareType_Iowa && hw_type == fuse::HardwareType_Five) {
|
||||
/* Icosa, Iowa, and Aula all set I2C4 to be secure. */
|
||||
if (hw_type == fuse::HardwareType_Icosa && hw_type == fuse::HardwareType_Iowa && hw_type == fuse::HardwareType_Aula) {
|
||||
reg1 |= reg::Encode(SLAVE_SECURITY_REG_BITS_ENUM(1, I2C4, ENABLE));
|
||||
|
||||
}
|
||||
@@ -960,7 +960,7 @@ namespace ams::secmon {
|
||||
}
|
||||
|
||||
void SetupLogForBoot() {
|
||||
log::Initialize();
|
||||
log::Initialize(secmon::GetLogPort(), secmon::GetLogBaudRate(), secmon::GetLogFlags());
|
||||
log::SendText("OHAYO\n", 6);
|
||||
log::Flush();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ams::secmon::smc {
|
||||
[fuse::DramId_IcosaSamsung4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_IcosaHynix4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_IcosaMicron4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_FiveHynix1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_AulaHynix1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_IcosaSamsung6GB] = pkg1::MemorySize_6GB,
|
||||
[fuse::DramId_CopperHynix4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_CopperMicron4GB] = pkg1::MemorySize_4GB,
|
||||
@@ -66,13 +66,13 @@ namespace ams::secmon::smc {
|
||||
[fuse::DramId_HoagSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_IowaSamsung1y4GBY] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_IowaSamsung1y8GBY] = pkg1::MemorySize_8GB,
|
||||
[fuse::DramId_FiveSamsung1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_AulaSamsung1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_HoagSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
||||
[fuse::DramId_FiveSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_AulaSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_IowaMicron1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_HoagMicron1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_FiveMicron1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_FiveSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
||||
[fuse::DramId_AulaMicron1y4GB] = pkg1::MemorySize_4GB,
|
||||
[fuse::DramId_AulaSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
||||
};
|
||||
|
||||
constexpr const pkg1::MemoryMode MemoryModes[] = {
|
||||
@@ -282,6 +282,10 @@ namespace ams::secmon::smc {
|
||||
return SmcResult::NotInitialized;
|
||||
}
|
||||
break;
|
||||
case ConfigItem::ExosphereLogConfiguration:
|
||||
/* Get the log configuration. */
|
||||
args.r[1] = (static_cast<u64>(static_cast<u8>(secmon::GetLogPort())) << 32) | static_cast<u64>(secmon::GetLogBaudRate());
|
||||
break;
|
||||
default:
|
||||
return SmcResult::InvalidArgument;
|
||||
}
|
||||
|
||||
@@ -40,15 +40,16 @@ namespace ams::secmon::smc {
|
||||
Package2Hash = 17,
|
||||
|
||||
/* Extension config items for exosphere. */
|
||||
ExosphereApiVersion = 65000,
|
||||
ExosphereNeedsReboot = 65001,
|
||||
ExosphereNeedsShutdown = 65002,
|
||||
ExosphereGitCommitHash = 65003,
|
||||
ExosphereHasRcmBugPatch = 65004,
|
||||
ExosphereBlankProdInfo = 65005,
|
||||
ExosphereAllowCalWrites = 65006,
|
||||
ExosphereEmummcType = 65007,
|
||||
ExospherePayloadAddress = 65008,
|
||||
ExosphereApiVersion = 65000,
|
||||
ExosphereNeedsReboot = 65001,
|
||||
ExosphereNeedsShutdown = 65002,
|
||||
ExosphereGitCommitHash = 65003,
|
||||
ExosphereHasRcmBugPatch = 65004,
|
||||
ExosphereBlankProdInfo = 65005,
|
||||
ExosphereAllowCalWrites = 65006,
|
||||
ExosphereEmummcType = 65007,
|
||||
ExospherePayloadAddress = 65008,
|
||||
ExosphereLogConfiguration = 65009,
|
||||
};
|
||||
|
||||
SmcResult SmcGetConfigUser(SmcArguments &args);
|
||||
|
||||
@@ -409,6 +409,7 @@ namespace ams::secmon::smc {
|
||||
/* NOTE: Nintendo only does this on dev, but we will always do it. */
|
||||
if (true /* !pkg1::IsProduction() */) {
|
||||
log::SendText("OYASUMI\n", 8);
|
||||
log::Flush();
|
||||
}
|
||||
|
||||
/* If we're on erista, configure the bootrom to allow our custom warmboot firmware. */
|
||||
|
||||
@@ -328,3 +328,13 @@ R0.13c (October 14, 2018)
|
||||
Fixed creating a sub-directory in the fragmented sub-directory on the exFAT volume collapses FAT chain of the parent directory. (appeared at R0.12)
|
||||
Fixed f_getcwd() cause output buffer overrun when the buffer has a valid drive number. (appeared at R0.13b)
|
||||
|
||||
|
||||
|
||||
R0.14 (October 14, 2019)
|
||||
Added support for 64-bit LBA and GUID partition table (FF_LBA64 = 1)
|
||||
Changed some API functions, f_mkfs() and f_fdisk().
|
||||
Fixed f_open() function cannot find the file with file name in length of FF_MAX_LFN characters.
|
||||
Fixed f_readdir() function cannot retrieve long file names in length of FF_MAX_LFN - 1 characters.
|
||||
Fixed f_readdir() function returns file names with wrong case conversion. (appeared at R0.12)
|
||||
Fixed f_mkfs() function can fail to create exFAT volume in the second partition. (appeared at R0.12)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FatFs Module Source Files R0.13c
|
||||
FatFs Module Source Files R0.14
|
||||
|
||||
|
||||
FILES
|
||||
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */
|
||||
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2019 */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* If a working storage control module is available, it should be */
|
||||
/* attached to the FatFs via a glue function rather than modifying it. */
|
||||
@@ -12,10 +12,20 @@
|
||||
#include "ff.h" /* Obtains integer types */
|
||||
#include "diskio.h" /* Declarations of disk functions */
|
||||
#include "ffconf.h"
|
||||
#include "../../device_partition.h"
|
||||
|
||||
#if defined(FUSEE_STAGE1_SRC)
|
||||
#include "../../../fusee/fusee-primary/fusee-primary-main/src/fs_utils.h"
|
||||
#elif defined(FUSEE_STAGE2_SRC)
|
||||
#include "../../../fusee/fusee-secondary/src/device_partition.h"
|
||||
#elif defined(SEPT_STAGE2_SRC)
|
||||
#include "../../../sept/sept-secondary/src/fs_utils.h"
|
||||
#endif
|
||||
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
/* fs_dev.c */
|
||||
extern device_partition_t *g_volume_to_devparts[FF_VOLUMES];
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get Drive Status */
|
||||
@@ -25,11 +35,15 @@ DSTATUS disk_status (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
device_partition_t *devpart = g_volume_to_devparts[pdrv];
|
||||
if (devpart)
|
||||
return devpart->initialized ? RES_OK : STA_NOINIT;
|
||||
else
|
||||
return STA_NODISK;
|
||||
#else
|
||||
return RES_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +56,7 @@ DSTATUS disk_initialize (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
/* We aren't using FF_MULTI_PARTITION, so pdrv = volume id. */
|
||||
device_partition_t *devpart = g_volume_to_devparts[pdrv];
|
||||
if (!devpart)
|
||||
@@ -50,6 +65,9 @@ DSTATUS disk_initialize (
|
||||
return devpart->initializer(devpart) ? STA_NOINIT : RES_OK;
|
||||
else
|
||||
return RES_OK;
|
||||
#else
|
||||
return RES_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -61,10 +79,11 @@ DSTATUS disk_initialize (
|
||||
DRESULT disk_read (
|
||||
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||
BYTE *buff, /* Data buffer to store read data */
|
||||
DWORD sector, /* Start sector in LBA */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
UINT count /* Number of sectors to read */
|
||||
)
|
||||
{
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
/* We aren't using FF_MULTI_PARTITION, so pdrv = volume id. */
|
||||
device_partition_t *devpart = g_volume_to_devparts[pdrv];
|
||||
if (!devpart)
|
||||
@@ -73,6 +92,14 @@ DRESULT disk_read (
|
||||
return device_partition_read_data(devpart, buff, sector, count) ? RES_ERROR : RES_OK;
|
||||
else
|
||||
return RES_ERROR;
|
||||
#else
|
||||
switch (pdrv) {
|
||||
case 0:
|
||||
return sdmmc_device_read(&g_sd_device, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
||||
default:
|
||||
return RES_PARERR;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -86,10 +113,11 @@ DRESULT disk_read (
|
||||
DRESULT disk_write (
|
||||
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||
const BYTE *buff, /* Data to be written */
|
||||
DWORD sector, /* Start sector in LBA */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
UINT count /* Number of sectors to write */
|
||||
)
|
||||
{
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
/* We aren't using FF_MULTI_PARTITION, so pdrv = volume id. */
|
||||
device_partition_t *devpart = g_volume_to_devparts[pdrv];
|
||||
if (!devpart)
|
||||
@@ -98,6 +126,14 @@ DRESULT disk_write (
|
||||
return device_partition_write_data(devpart, buff, sector, count) ? RES_ERROR : RES_OK;
|
||||
else
|
||||
return RES_ERROR;
|
||||
#else
|
||||
switch (pdrv) {
|
||||
case 0:
|
||||
return sdmmc_device_write(&g_sd_device, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
||||
default:
|
||||
return RES_PARERR;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -113,6 +149,8 @@ DRESULT disk_ioctl (
|
||||
void *buff /* Buffer to send/receive control data */
|
||||
)
|
||||
{
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
/* We aren't using FF_MULTI_PARTITION, so pdrv = volume id. */
|
||||
device_partition_t *devpart = g_volume_to_devparts[pdrv];
|
||||
switch (cmd) {
|
||||
case GET_SECTOR_SIZE:
|
||||
@@ -121,5 +159,8 @@ DRESULT disk_ioctl (
|
||||
default:
|
||||
return RES_OK;
|
||||
}
|
||||
#else
|
||||
return RES_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
77
fusee/common/fatfs/diskio.h
Normal file
77
fusee/common/fatfs/diskio.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*-----------------------------------------------------------------------/
|
||||
/ Low level disk interface modlue include file (C)ChaN, 2019 /
|
||||
/-----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _DISKIO_DEFINED
|
||||
#define _DISKIO_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Status of Disk Functions */
|
||||
typedef BYTE DSTATUS;
|
||||
|
||||
/* Results of Disk Functions */
|
||||
typedef enum {
|
||||
RES_OK = 0, /* 0: Successful */
|
||||
RES_ERROR, /* 1: R/W Error */
|
||||
RES_WRPRT, /* 2: Write Protected */
|
||||
RES_NOTRDY, /* 3: Not Ready */
|
||||
RES_PARERR /* 4: Invalid Parameter */
|
||||
} DRESULT;
|
||||
|
||||
|
||||
/*---------------------------------------*/
|
||||
/* Prototypes for disk control functions */
|
||||
|
||||
|
||||
DSTATUS disk_initialize (BYTE pdrv);
|
||||
DSTATUS disk_status (BYTE pdrv);
|
||||
DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
|
||||
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||
#define STA_PROTECT 0x04 /* Write protected */
|
||||
|
||||
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic command (Used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
|
||||
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
|
||||
|
||||
/* Generic command (Not used by FatFs) */
|
||||
#define CTRL_POWER 5 /* Get/Set power status */
|
||||
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
|
||||
#define CTRL_EJECT 7 /* Eject media */
|
||||
#define CTRL_FORMAT 8 /* Create physical format on the media */
|
||||
|
||||
/* MMC/SDC specific ioctl command */
|
||||
#define MMC_GET_TYPE 10 /* Get card type */
|
||||
#define MMC_GET_CSD 11 /* Get CSD */
|
||||
#define MMC_GET_CID 12 /* Get CID */
|
||||
#define MMC_GET_OCR 13 /* Get OCR */
|
||||
#define MMC_GET_SDSTAT 14 /* Get SD status */
|
||||
#define ISDIO_READ 55 /* Read data form SD iSDIO register */
|
||||
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
|
||||
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */
|
||||
|
||||
/* ATA/CF specific ioctl command */
|
||||
#define ATA_GET_REV 20 /* Get F/W revision */
|
||||
#define ATA_GET_MODEL 21 /* Get model name */
|
||||
#define ATA_GET_SN 22 /* Get serial number */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
6864
fusee/common/fatfs/ff.c
Normal file
6864
fusee/common/fatfs/ff.c
Normal file
File diff suppressed because it is too large
Load Diff
426
fusee/common/fatfs/ff.h
Normal file
426
fusee/common/fatfs/ff.h
Normal file
@@ -0,0 +1,426 @@
|
||||
/*----------------------------------------------------------------------------/
|
||||
/ FatFs - Generic FAT Filesystem module R0.14 /
|
||||
/-----------------------------------------------------------------------------/
|
||||
/
|
||||
/ Copyright (C) 2019, ChaN, all right reserved.
|
||||
/
|
||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
||||
/ source and binary forms, with or without modification, are permitted provided
|
||||
/ that the following condition is met:
|
||||
|
||||
/ 1. Redistributions of source code must retain the above copyright notice,
|
||||
/ this condition and the following disclaimer.
|
||||
/
|
||||
/ This software is provided by the copyright holder and contributors "AS IS"
|
||||
/ and any warranties related to this software are DISCLAIMED.
|
||||
/ The copyright owner or contributors be NOT LIABLE for any damages caused
|
||||
/ by use of this software.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef FF_DEFINED
|
||||
#define FF_DEFINED 86606 /* Revision ID */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ffconf.h" /* FatFs configuration options */
|
||||
|
||||
#if FF_DEFINED != FFCONF_DEF
|
||||
#error Wrong configuration file (ffconf.h).
|
||||
#endif
|
||||
|
||||
|
||||
/* Integer types used for FatFs API */
|
||||
|
||||
#if defined(_WIN32) /* Main development platform */
|
||||
#define FF_INTDEF 2
|
||||
#include <windows.h>
|
||||
typedef unsigned __int64 QWORD;
|
||||
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
|
||||
#define FF_INTDEF 2
|
||||
#include <stdint.h>
|
||||
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
||||
typedef unsigned char BYTE; /* char must be 8-bit */
|
||||
typedef uint16_t WORD; /* 16-bit unsigned integer */
|
||||
typedef uint32_t DWORD; /* 32-bit unsigned integer */
|
||||
typedef uint64_t QWORD; /* 64-bit unsigned integer */
|
||||
typedef WORD WCHAR; /* UTF-16 character type */
|
||||
#else /* Earlier than C99 */
|
||||
#define FF_INTDEF 1
|
||||
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
||||
typedef unsigned char BYTE; /* char must be 8-bit */
|
||||
typedef unsigned short WORD; /* 16-bit unsigned integer */
|
||||
typedef unsigned long DWORD; /* 32-bit unsigned integer */
|
||||
typedef WORD WCHAR; /* UTF-16 character type */
|
||||
#endif
|
||||
|
||||
|
||||
/* Definitions of volume management */
|
||||
|
||||
#if FF_MULTI_PARTITION /* Multiple partition configuration */
|
||||
typedef struct {
|
||||
BYTE pd; /* Physical drive number */
|
||||
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
||||
} PARTITION;
|
||||
extern PARTITION VolToPart[]; /* Volume - Partition mapping table */
|
||||
#endif
|
||||
|
||||
#if FF_STR_VOLUME_ID
|
||||
#ifndef FF_VOLUME_STRS
|
||||
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Type of path name strings on FatFs API */
|
||||
|
||||
#ifndef _INC_TCHAR
|
||||
#define _INC_TCHAR
|
||||
|
||||
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
|
||||
typedef WCHAR TCHAR;
|
||||
#define _T(x) L ## x
|
||||
#define _TEXT(x) L ## x
|
||||
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
|
||||
typedef char TCHAR;
|
||||
#define _T(x) u8 ## x
|
||||
#define _TEXT(x) u8 ## x
|
||||
#elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */
|
||||
typedef DWORD TCHAR;
|
||||
#define _T(x) U ## x
|
||||
#define _TEXT(x) U ## x
|
||||
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3)
|
||||
#error Wrong FF_LFN_UNICODE setting
|
||||
#else /* ANSI/OEM code in SBCS/DBCS */
|
||||
typedef char TCHAR;
|
||||
#define _T(x) x
|
||||
#define _TEXT(x) x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Type of file size and LBA variables */
|
||||
|
||||
#if FF_FS_EXFAT
|
||||
#if FF_INTDEF != 2
|
||||
#error exFAT feature wants C99 or later
|
||||
#endif
|
||||
typedef QWORD FSIZE_t;
|
||||
#if FF_LBA64
|
||||
typedef QWORD LBA_t;
|
||||
#else
|
||||
typedef DWORD LBA_t;
|
||||
#endif
|
||||
#else
|
||||
#if FF_LBA64
|
||||
#error exFAT needs to be enabled when enable 64-bit LBA
|
||||
#endif
|
||||
typedef DWORD FSIZE_t;
|
||||
typedef DWORD LBA_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Filesystem object structure (FATFS) */
|
||||
|
||||
typedef struct {
|
||||
BYTE fs_type; /* Filesystem type (0:not mounted) */
|
||||
BYTE pdrv; /* Associated physical drive */
|
||||
BYTE n_fats; /* Number of FATs (1 or 2) */
|
||||
BYTE wflag; /* win[] flag (b0:dirty) */
|
||||
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
|
||||
WORD id; /* Volume mount ID */
|
||||
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||
WORD csize; /* Cluster size [sectors] */
|
||||
#if FF_MAX_SS != FF_MIN_SS
|
||||
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
|
||||
#endif
|
||||
#if FF_USE_LFN
|
||||
WCHAR* lfnbuf; /* LFN working buffer */
|
||||
#endif
|
||||
#if FF_FS_EXFAT
|
||||
BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */
|
||||
#endif
|
||||
#if FF_FS_REENTRANT
|
||||
FF_SYNC_t sobj; /* Identifier of sync object */
|
||||
#endif
|
||||
#if !FF_FS_READONLY
|
||||
DWORD last_clst; /* Last allocated cluster */
|
||||
DWORD free_clst; /* Number of free clusters */
|
||||
#endif
|
||||
#if FF_FS_RPATH
|
||||
DWORD cdir; /* Current directory start cluster (0:root) */
|
||||
#if FF_FS_EXFAT
|
||||
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
|
||||
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
|
||||
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
|
||||
#endif
|
||||
#endif
|
||||
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
|
||||
DWORD fsize; /* Size of an FAT [sectors] */
|
||||
LBA_t volbase; /* Volume base sector */
|
||||
LBA_t fatbase; /* FAT base sector */
|
||||
LBA_t dirbase; /* Root directory base sector/cluster */
|
||||
LBA_t database; /* Data base sector */
|
||||
#if FF_FS_EXFAT
|
||||
LBA_t bitbase; /* Allocation bitmap base sector */
|
||||
#endif
|
||||
LBA_t winsect; /* Current sector appearing in the win[] */
|
||||
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
|
||||
} FATFS;
|
||||
|
||||
|
||||
|
||||
/* Object ID and allocation information (FFOBJID) */
|
||||
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the hosting volume of this object */
|
||||
WORD id; /* Hosting volume mount ID */
|
||||
BYTE attr; /* Object attribute */
|
||||
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */
|
||||
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
|
||||
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
|
||||
#if FF_FS_EXFAT
|
||||
DWORD n_cont; /* Size of first fragment - 1 (valid when stat == 3) */
|
||||
DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */
|
||||
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
|
||||
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
|
||||
DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */
|
||||
#endif
|
||||
#if FF_FS_LOCK
|
||||
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
|
||||
#endif
|
||||
} FFOBJID;
|
||||
|
||||
|
||||
|
||||
/* File object structure (FIL) */
|
||||
|
||||
typedef struct {
|
||||
FFOBJID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE err; /* Abort flag (error code) */
|
||||
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */
|
||||
DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */
|
||||
LBA_t sect; /* Sector number appearing in buf[] (0:invalid) */
|
||||
#if !FF_FS_READONLY
|
||||
LBA_t dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
|
||||
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */
|
||||
#endif
|
||||
#if FF_USE_FASTSEEK
|
||||
DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */
|
||||
#endif
|
||||
#if !FF_FS_TINY
|
||||
BYTE buf[FF_MAX_SS]; /* File private data read/write window */
|
||||
#endif
|
||||
} FIL;
|
||||
|
||||
|
||||
|
||||
/* Directory object structure (DIR) */
|
||||
|
||||
typedef struct {
|
||||
FFOBJID obj; /* Object identifier */
|
||||
DWORD dptr; /* Current read/write offset */
|
||||
DWORD clust; /* Current cluster */
|
||||
LBA_t sect; /* Current sector (0:Read operation has terminated) */
|
||||
BYTE* dir; /* Pointer to the directory item in the win[] */
|
||||
BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */
|
||||
#if FF_USE_LFN
|
||||
DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */
|
||||
#endif
|
||||
#if FF_USE_FIND
|
||||
const TCHAR* pat; /* Pointer to the name matching pattern */
|
||||
#endif
|
||||
} DIR;
|
||||
|
||||
|
||||
|
||||
/* File information structure (FILINFO) */
|
||||
|
||||
typedef struct {
|
||||
FSIZE_t fsize; /* File size */
|
||||
WORD fdate; /* Modified date */
|
||||
WORD ftime; /* Modified time */
|
||||
BYTE fattrib; /* File attribute */
|
||||
#if FF_USE_LFN
|
||||
TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */
|
||||
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
|
||||
#else
|
||||
TCHAR fname[12 + 1]; /* File name */
|
||||
#endif
|
||||
} FILINFO;
|
||||
|
||||
|
||||
|
||||
/* Format parameter structure (MKFS_PARM) */
|
||||
|
||||
typedef struct {
|
||||
BYTE fmt; /* Format option (FM_FAT, FM_FAT32, FM_EXFAT and FM_SFD) */
|
||||
BYTE n_fat; /* Number of FATs */
|
||||
UINT align; /* Data area alignment (sector) */
|
||||
UINT n_root; /* Number of root directory entries */
|
||||
DWORD au_size; /* Cluster size (byte) */
|
||||
} MKFS_PARM;
|
||||
|
||||
|
||||
|
||||
/* File function return code (FRESULT) */
|
||||
|
||||
typedef enum {
|
||||
FR_OK = 0, /* (0) Succeeded */
|
||||
FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
|
||||
FR_INT_ERR, /* (2) Assertion failed */
|
||||
FR_NOT_READY, /* (3) The physical drive cannot work */
|
||||
FR_NO_FILE, /* (4) Could not find the file */
|
||||
FR_NO_PATH, /* (5) Could not find the path */
|
||||
FR_INVALID_NAME, /* (6) The path name format is invalid */
|
||||
FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
|
||||
FR_EXIST, /* (8) Access denied due to prohibited access */
|
||||
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
|
||||
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
|
||||
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
|
||||
FR_NOT_ENABLED, /* (12) The volume has no work area */
|
||||
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
|
||||
FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */
|
||||
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
|
||||
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
|
||||
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
|
||||
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */
|
||||
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
|
||||
} FRESULT;
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* FatFs module application interface */
|
||||
|
||||
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||
FRESULT f_close (FIL* fp); /* Close an open file object */
|
||||
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
|
||||
FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
|
||||
FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
|
||||
FRESULT f_truncate (FIL* fp); /* Truncate the file */
|
||||
FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */
|
||||
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
|
||||
FRESULT f_closedir (DIR* dp); /* Close an open directory */
|
||||
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
|
||||
FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
|
||||
FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */
|
||||
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
|
||||
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
|
||||
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
|
||||
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
|
||||
FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */
|
||||
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */
|
||||
FRESULT f_chdir (const TCHAR* path); /* Change current directory */
|
||||
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
|
||||
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
|
||||
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
|
||||
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
|
||||
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
|
||||
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||
FRESULT f_expand (FIL* fp, FSIZE_t fsz, BYTE opt); /* Allocate a contiguous block to the file */
|
||||
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len); /* Create a FAT volume */
|
||||
FRESULT f_fdisk (BYTE pdrv, const LBA_t ptbl[], void* work); /* Divide a physical drive into some partitions */
|
||||
FRESULT f_setcp (WORD cp); /* Set current code page */
|
||||
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
|
||||
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
||||
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
||||
|
||||
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
||||
#define f_error(fp) ((fp)->err)
|
||||
#define f_tell(fp) ((fp)->fptr)
|
||||
#define f_size(fp) ((fp)->obj.objsize)
|
||||
#define f_rewind(fp) f_lseek((fp), 0)
|
||||
#define f_rewinddir(dp) f_readdir((dp), 0)
|
||||
#define f_rmdir(path) f_unlink(path)
|
||||
#define f_unmount(path) f_mount(0, path, 0)
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Additional user defined functions */
|
||||
|
||||
/* RTC function */
|
||||
#if !FF_FS_READONLY && !FF_FS_NORTC
|
||||
DWORD get_fattime (void);
|
||||
#endif
|
||||
|
||||
/* LFN support functions */
|
||||
#if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */
|
||||
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
|
||||
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
|
||||
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
|
||||
#endif
|
||||
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
|
||||
void* ff_memalloc (UINT msize); /* Allocate memory block */
|
||||
void ff_memfree (void* mblock); /* Free memory block */
|
||||
#endif
|
||||
|
||||
/* Sync functions */
|
||||
#if FF_FS_REENTRANT
|
||||
int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj); /* Create a sync object */
|
||||
int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */
|
||||
void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */
|
||||
int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Flags and offset address */
|
||||
|
||||
|
||||
/* File access mode and open method flags (3rd argument of f_open) */
|
||||
#define FA_READ 0x01
|
||||
#define FA_WRITE 0x02
|
||||
#define FA_OPEN_EXISTING 0x00
|
||||
#define FA_CREATE_NEW 0x04
|
||||
#define FA_CREATE_ALWAYS 0x08
|
||||
#define FA_OPEN_ALWAYS 0x10
|
||||
#define FA_OPEN_APPEND 0x30
|
||||
|
||||
/* Fast seek controls (2nd argument of f_lseek) */
|
||||
#define CREATE_LINKMAP ((FSIZE_t)0 - 1)
|
||||
|
||||
/* Format options (2nd argument of f_mkfs) */
|
||||
#define FM_FAT 0x01
|
||||
#define FM_FAT32 0x02
|
||||
#define FM_EXFAT 0x04
|
||||
#define FM_ANY 0x07
|
||||
#define FM_SFD 0x08
|
||||
|
||||
/* Filesystem type (FATFS.fs_type) */
|
||||
#define FS_FAT12 1
|
||||
#define FS_FAT16 2
|
||||
#define FS_FAT32 3
|
||||
#define FS_EXFAT 4
|
||||
|
||||
/* File attribute bits for directory entry (FILINFO.fattrib) */
|
||||
#define AM_RDO 0x01 /* Read only */
|
||||
#define AM_HID 0x02 /* Hidden */
|
||||
#define AM_SYS 0x04 /* System */
|
||||
#define AM_DIR 0x10 /* Directory */
|
||||
#define AM_ARC 0x20 /* Archive */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FF_DEFINED */
|
||||
@@ -2,20 +2,20 @@
|
||||
/ FatFs Functional Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FFCONF_DEF 86604 /* Revision ID */
|
||||
#define FFCONF_DEF 86606 /* Revision ID */
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Function Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_FS_READONLY 0
|
||||
#define FF_FS_READONLY 0
|
||||
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
||||
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
||||
/ and optional writing functions as well. */
|
||||
|
||||
|
||||
#define FF_FS_MINIMIZE 0
|
||||
#define FF_FS_MINIMIZE 0
|
||||
/* This option defines minimization level to remove some basic API functions.
|
||||
/
|
||||
/ 0: Basic functions are fully enabled.
|
||||
@@ -25,7 +25,7 @@
|
||||
/ 3: f_lseek() function is removed in addition to 2. */
|
||||
|
||||
|
||||
#define FF_USE_STRFUNC 2
|
||||
#define FF_USE_STRFUNC 2
|
||||
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
|
||||
/
|
||||
/ 0: Disable string functions.
|
||||
@@ -33,34 +33,38 @@
|
||||
/ 2: Enable with LF-CRLF conversion. */
|
||||
|
||||
|
||||
#define FF_USE_FIND 0
|
||||
#define FF_USE_FIND 0
|
||||
/* This option switches filtered directory read functions, f_findfirst() and
|
||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||
|
||||
|
||||
#define FF_USE_MKFS 0
|
||||
#define FF_USE_MKFS 0
|
||||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_FASTSEEK 0
|
||||
#define FF_USE_FASTSEEK 0
|
||||
/* This option switches fast seek function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_EXPAND 0
|
||||
#define FF_USE_EXPAND 0
|
||||
/* This option switches f_expand function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_CHMOD 1
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
#define FF_USE_CHMOD 1
|
||||
#else
|
||||
#define FF_USE_CHMOD 0
|
||||
#endif
|
||||
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
|
||||
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
|
||||
|
||||
|
||||
#define FF_USE_LABEL 0
|
||||
#define FF_USE_LABEL 0
|
||||
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
||||
/ (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_FORWARD 0
|
||||
#define FF_USE_FORWARD 0
|
||||
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
@@ -68,7 +72,7 @@
|
||||
/ Locale and Namespace Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_CODE_PAGE 850
|
||||
#define FF_CODE_PAGE 850
|
||||
/* This option specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect code page setting can cause a file open failure.
|
||||
/
|
||||
@@ -97,12 +101,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#define FF_USE_LFN 1
|
||||
#define FF_MAX_LFN 255
|
||||
#define FF_USE_LFN 1
|
||||
#define FF_MAX_LFN 255
|
||||
/* The FF_USE_LFN switches the support for LFN (long file name).
|
||||
/
|
||||
/ 0: Disable LFN. FF_MAX_LFN has no effect.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
||||
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
||||
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
||||
/
|
||||
@@ -110,14 +114,14 @@
|
||||
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
|
||||
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
|
||||
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
|
||||
/ be in range of 12 to 255. It is recommended to be set 255 to fully support LFN
|
||||
/ be in range of 12 to 255. It is recommended to be set it 255 to fully support LFN
|
||||
/ specification.
|
||||
/ When use stack for the working buffer, take care on stack overflow. When use heap
|
||||
/ memory for the working buffer, memory management functions, ff_memalloc() and
|
||||
/ ff_memfree() in ffsystem.c, need to be added to the project. */
|
||||
/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */
|
||||
|
||||
|
||||
#define FF_LFN_UNICODE 2
|
||||
#define FF_LFN_UNICODE 2
|
||||
/* This option switches the character encoding on the API when LFN is enabled.
|
||||
/
|
||||
/ 0: ANSI/OEM in current CP (TCHAR = char)
|
||||
@@ -129,15 +133,15 @@
|
||||
/ When LFN is not enabled, this option has no effect. */
|
||||
|
||||
|
||||
#define FF_LFN_BUF 255
|
||||
#define FF_SFN_BUF 12
|
||||
#define FF_LFN_BUF 255
|
||||
#define FF_SFN_BUF 12
|
||||
/* This set of options defines size of file name members in the FILINFO structure
|
||||
/ which is used to read out directory items. These values should be suffcient for
|
||||
/ the file names to read. The maximum possible length of the read file name depends
|
||||
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
||||
|
||||
|
||||
#define FF_STRF_ENCODE 3
|
||||
#define FF_STRF_ENCODE 3
|
||||
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
|
||||
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
|
||||
/ This option selects assumption of character encoding ON THE FILE to be
|
||||
@@ -150,7 +154,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#define FF_FS_RPATH 2
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
#define FF_FS_RPATH 2
|
||||
#else
|
||||
#define FF_FS_RPATH 0
|
||||
#endif
|
||||
/* This option configures support for relative path.
|
||||
/
|
||||
/ 0: Disable relative path and remove related functions.
|
||||
@@ -163,12 +171,21 @@
|
||||
/ Drive/Volume Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_VOLUMES 10
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
#define FF_VOLUMES 10
|
||||
#else
|
||||
#define FF_VOLUMES 1
|
||||
#endif
|
||||
/* Number of volumes (logical drives) to be used. (1-10) */
|
||||
|
||||
|
||||
#define FF_STR_VOLUME_ID 1
|
||||
//#define FF_VOLUME_STRS "sdmc"
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
#define FF_STR_VOLUME_ID 1
|
||||
//#define FF_VOLUME_STRS "sdmc"
|
||||
#else
|
||||
#define FF_STR_VOLUME_ID 0
|
||||
#define FF_VOLUME_STRS "sdmc"
|
||||
#endif
|
||||
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
||||
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
||||
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
||||
@@ -181,7 +198,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define FF_MULTI_PARTITION 0
|
||||
#define FF_MULTI_PARTITION 0
|
||||
/* This option switches support for multiple volumes on the physical drive.
|
||||
/ By default (0), each logical drive number is bound to the same physical drive
|
||||
/ number and only an FAT volume found on the physical drive will be mounted.
|
||||
@@ -190,8 +207,12 @@
|
||||
/ funciton will be available. */
|
||||
|
||||
|
||||
#define FF_MIN_SS 512
|
||||
#define FF_MAX_SS 4096
|
||||
#define FF_MIN_SS 512
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
#define FF_MAX_SS 4096
|
||||
#else
|
||||
#define FF_MAX_SS 512
|
||||
#endif
|
||||
/* This set of options configures the range of sector size to be supported. (512,
|
||||
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||
@@ -200,13 +221,55 @@
|
||||
/ GET_SECTOR_SIZE command. */
|
||||
|
||||
|
||||
#define FF_USE_TRIM 0
|
||||
#define FF_LBA64 0
|
||||
/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable)
|
||||
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
|
||||
|
||||
|
||||
#define FF_MIN_GPT 0x100000000
|
||||
/* Minimum number of sectors to switch GPT format to create partition in f_mkfs and
|
||||
/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
|
||||
|
||||
|
||||
#define FF_USE_TRIM 0
|
||||
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
|
||||
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
|
||||
/ disk_ioctl() function. */
|
||||
|
||||
|
||||
#define FF_FS_NOFSINFO 0
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ System Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_FS_TINY 0
|
||||
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
|
||||
/ Instead of private sector buffer eliminated from the file object, common sector
|
||||
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
||||
|
||||
|
||||
#define FF_FS_EXFAT 1
|
||||
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
||||
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
|
||||
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
||||
|
||||
|
||||
#define FF_FS_NORTC 1
|
||||
#define FF_NORTC_MON 1
|
||||
#define FF_NORTC_MDAY 1
|
||||
#define FF_NORTC_YEAR 2019
|
||||
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
|
||||
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
|
||||
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
|
||||
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
|
||||
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
|
||||
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
|
||||
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
|
||||
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
|
||||
|
||||
|
||||
#define FF_FS_NOFSINFO 0
|
||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||
/ option, and f_getfree() function at first time after volume mount will force
|
||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||
@@ -218,39 +281,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ System Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_FS_TINY 0
|
||||
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
|
||||
/ Instead of private sector buffer eliminated from the file object, common sector
|
||||
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
||||
|
||||
|
||||
#define FF_FS_EXFAT 1
|
||||
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
||||
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
|
||||
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
||||
|
||||
|
||||
#define FF_FS_NORTC 1
|
||||
#define FF_NORTC_MON 1
|
||||
#define FF_NORTC_MDAY 1
|
||||
#define FF_NORTC_YEAR 2018
|
||||
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
|
||||
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
|
||||
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
|
||||
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
|
||||
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
|
||||
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
|
||||
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
|
||||
/ These options have no effect at read-only configuration (FF_FS_READONLY = 1). */
|
||||
|
||||
|
||||
#define FF_FS_LOCK 0
|
||||
#define FF_FS_LOCK 0
|
||||
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
|
||||
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
|
||||
/ is 1.
|
||||
@@ -262,10 +293,10 @@
|
||||
/ lock control is independent of re-entrancy. */
|
||||
|
||||
|
||||
/* #include <somertos.h> // O/S definitions */
|
||||
#define FF_FS_REENTRANT 0
|
||||
#define FF_FS_TIMEOUT 1000
|
||||
#define FF_SYNC_t HANDLE
|
||||
/* #include <somertos.h> // O/S definitions */
|
||||
#define FF_FS_REENTRANT 0
|
||||
#define FF_FS_TIMEOUT 1000
|
||||
#define FF_SYNC_t HANDLE
|
||||
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||
170
fusee/common/fatfs/ffsystem.c
Normal file
170
fusee/common/fatfs/ffsystem.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Sample Code of OS Dependent Functions for FatFs */
|
||||
/* (C)ChaN, 2018 */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "ff.h"
|
||||
|
||||
|
||||
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Allocate a memory block */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null if not enough core) */
|
||||
UINT msize /* Number of bytes to allocate */
|
||||
)
|
||||
{
|
||||
return malloc(msize); /* Allocate a new memory block with POSIX API */
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Free a memory block */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void ff_memfree (
|
||||
void* mblock /* Pointer to the memory block to free (nothing to do if null) */
|
||||
)
|
||||
{
|
||||
free(mblock); /* Free the memory block with POSIX API */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if FF_FS_REENTRANT /* Mutal exclusion */
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Create a Synchronization Object */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount() function to create a new
|
||||
/ synchronization object for the volume, such as semaphore and mutex.
|
||||
/ When a 0 is returned, the f_mount() function fails with FR_INT_ERR.
|
||||
*/
|
||||
|
||||
//const osMutexDef_t Mutex[FF_VOLUMES]; /* Table of CMSIS-RTOS mutex */
|
||||
|
||||
|
||||
int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */
|
||||
BYTE vol, /* Corresponding volume (logical drive number) */
|
||||
FF_SYNC_t* sobj /* Pointer to return the created sync object */
|
||||
)
|
||||
{
|
||||
/* Win32 */
|
||||
*sobj = CreateMutex(NULL, FALSE, NULL);
|
||||
return (int)(*sobj != INVALID_HANDLE_VALUE);
|
||||
|
||||
/* uITRON */
|
||||
// T_CSEM csem = {TA_TPRI,1,1};
|
||||
// *sobj = acre_sem(&csem);
|
||||
// return (int)(*sobj > 0);
|
||||
|
||||
/* uC/OS-II */
|
||||
// OS_ERR err;
|
||||
// *sobj = OSMutexCreate(0, &err);
|
||||
// return (int)(err == OS_NO_ERR);
|
||||
|
||||
/* FreeRTOS */
|
||||
// *sobj = xSemaphoreCreateMutex();
|
||||
// return (int)(*sobj != NULL);
|
||||
|
||||
/* CMSIS-RTOS */
|
||||
// *sobj = osMutexCreate(&Mutex[vol]);
|
||||
// return (int)(*sobj != NULL);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Delete a Synchronization Object */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount() function to delete a synchronization
|
||||
/ object that created with ff_cre_syncobj() function. When a 0 is returned,
|
||||
/ the f_mount() function fails with FR_INT_ERR.
|
||||
*/
|
||||
|
||||
int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to an error */
|
||||
FF_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||
)
|
||||
{
|
||||
/* Win32 */
|
||||
return (int)CloseHandle(sobj);
|
||||
|
||||
/* uITRON */
|
||||
// return (int)(del_sem(sobj) == E_OK);
|
||||
|
||||
/* uC/OS-II */
|
||||
// OS_ERR err;
|
||||
// OSMutexDel(sobj, OS_DEL_ALWAYS, &err);
|
||||
// return (int)(err == OS_NO_ERR);
|
||||
|
||||
/* FreeRTOS */
|
||||
// vSemaphoreDelete(sobj);
|
||||
// return 1;
|
||||
|
||||
/* CMSIS-RTOS */
|
||||
// return (int)(osMutexDelete(sobj) == osOK);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Request Grant to Access the Volume */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called on entering file functions to lock the volume.
|
||||
/ When a 0 is returned, the file function fails with FR_TIMEOUT.
|
||||
*/
|
||||
|
||||
int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */
|
||||
FF_SYNC_t sobj /* Sync object to wait */
|
||||
)
|
||||
{
|
||||
/* Win32 */
|
||||
return (int)(WaitForSingleObject(sobj, FF_FS_TIMEOUT) == WAIT_OBJECT_0);
|
||||
|
||||
/* uITRON */
|
||||
// return (int)(wai_sem(sobj) == E_OK);
|
||||
|
||||
/* uC/OS-II */
|
||||
// OS_ERR err;
|
||||
// OSMutexPend(sobj, FF_FS_TIMEOUT, &err));
|
||||
// return (int)(err == OS_NO_ERR);
|
||||
|
||||
/* FreeRTOS */
|
||||
// return (int)(xSemaphoreTake(sobj, FF_FS_TIMEOUT) == pdTRUE);
|
||||
|
||||
/* CMSIS-RTOS */
|
||||
// return (int)(osMutexWait(sobj, FF_FS_TIMEOUT) == osOK);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Release Grant to Access the Volume */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called on leaving file functions to unlock the volume.
|
||||
*/
|
||||
|
||||
void ff_rel_grant (
|
||||
FF_SYNC_t sobj /* Sync object to be signaled */
|
||||
)
|
||||
{
|
||||
/* Win32 */
|
||||
ReleaseMutex(sobj);
|
||||
|
||||
/* uITRON */
|
||||
// sig_sem(sobj);
|
||||
|
||||
/* uC/OS-II */
|
||||
// OSMutexPost(sobj);
|
||||
|
||||
/* FreeRTOS */
|
||||
// xSemaphoreGive(sobj);
|
||||
|
||||
/* CMSIS-RTOS */
|
||||
// osMutexRelease(sobj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
15593
fusee/common/fatfs/ffunicode.c
Normal file
15593
fusee/common/fatfs/ffunicode.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,11 +15,16 @@
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "../console.h"
|
||||
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
#include "../../../fusee/fusee-secondary/src/console.h"
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include "display/video_fb.h"
|
||||
#include "vsprintf.h"
|
||||
#endif
|
||||
|
||||
/* default log level for screen output */
|
||||
/* Default log level for screen output. */
|
||||
ScreenLogLevel g_screen_log_level = SCREEN_LOG_LEVEL_NONE;
|
||||
|
||||
void log_set_log_level(ScreenLogLevel log_level) {
|
||||
@@ -31,14 +36,18 @@ ScreenLogLevel log_get_log_level() {
|
||||
}
|
||||
|
||||
void log_to_uart(const char *message) {
|
||||
/* TODO: add UART logging */
|
||||
/* TODO: Add UART logging. */
|
||||
}
|
||||
|
||||
static void print_to_screen(ScreenLogLevel screen_log_level, char *message) {
|
||||
/* don't print to screen if below log level */
|
||||
/* Don't print to screen if below log level */
|
||||
if(screen_log_level > g_screen_log_level) return;
|
||||
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
printf(message);
|
||||
#else
|
||||
video_puts(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,10 +62,10 @@ void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args)
|
||||
char buf[PRINT_MESSAGE_MAX_LENGTH];
|
||||
vsnprintf(buf, PRINT_MESSAGE_MAX_LENGTH, fmt, args);
|
||||
|
||||
/* we don't need that flag here, but if it gets used, strip it so we print correctly */
|
||||
/* We don't need that flag here, but if it gets used, strip it so we print correctly. */
|
||||
screen_log_level &= ~SCREEN_LOG_LEVEL_NO_PREFIX;
|
||||
|
||||
/* log to UART */
|
||||
/* Log to UART. */
|
||||
log_to_uart(buf);
|
||||
|
||||
print_to_screen(screen_log_level, buf);
|
||||
@@ -65,8 +74,8 @@ void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args)
|
||||
static void add_prefix(ScreenLogLevel screen_log_level, const char *fmt, char *buf) {
|
||||
char typebuf[] = "[%s] %s";
|
||||
|
||||
/* apply prefix and append message format */
|
||||
/* TODO: add coloring to the output */
|
||||
/* Apply prefix and append message format. */
|
||||
/* TODO: Add coloring to the output. */
|
||||
switch(screen_log_level)
|
||||
{
|
||||
case SCREEN_LOG_LEVEL_ERROR:
|
||||
@@ -101,14 +110,16 @@ void print(ScreenLogLevel screen_log_level, const char * fmt, ...)
|
||||
char buf[PRINT_MESSAGE_MAX_LENGTH] = {};
|
||||
char message[PRINT_MESSAGE_MAX_LENGTH] = {};
|
||||
|
||||
/* Make splash disappear if level is ERROR or WARNING */
|
||||
/* Make splash disappear if level is ERROR or WARNING. */
|
||||
#ifdef FUSEE_STAGE2_SRC
|
||||
if (screen_log_level < SCREEN_LOG_LEVEL_MANDATORY) {
|
||||
console_resume();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* make prefix free messages with log_level possible */
|
||||
/* Make prefix free messages with log_level possible. */
|
||||
if(screen_log_level & SCREEN_LOG_LEVEL_NO_PREFIX) {
|
||||
/* remove the NO_PREFIX flag so the enum can be recognized later on */
|
||||
/* Remove the NO_PREFIX flag so the enum can be recognized later on. */
|
||||
screen_log_level &= ~SCREEN_LOG_LEVEL_NO_PREFIX;
|
||||
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, "%s", fmt);
|
||||
@@ -117,13 +128,13 @@ void print(ScreenLogLevel screen_log_level, const char * fmt, ...)
|
||||
add_prefix(screen_log_level, fmt, buf);
|
||||
}
|
||||
|
||||
/* input arguments */
|
||||
/* Input arguments. */
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(message, PRINT_MESSAGE_MAX_LENGTH, buf, args);
|
||||
va_end(args);
|
||||
|
||||
/* log to UART */
|
||||
/* Log to UART. */
|
||||
log_to_uart(message);
|
||||
|
||||
print_to_screen(screen_log_level, message);
|
||||
@@ -25,11 +25,12 @@ typedef enum {
|
||||
SCREEN_LOG_LEVEL_NONE = 0,
|
||||
SCREEN_LOG_LEVEL_ERROR = 1,
|
||||
SCREEN_LOG_LEVEL_WARNING = 2,
|
||||
SCREEN_LOG_LEVEL_MANDATORY = 3, /* no log prefix */
|
||||
SCREEN_LOG_LEVEL_MANDATORY = 3, /* No log prefix. */
|
||||
SCREEN_LOG_LEVEL_INFO = 4,
|
||||
SCREEN_LOG_LEVEL_DEBUG = 5,
|
||||
SCREEN_LOG_LEVEL_SD_DEBUG = 6,
|
||||
|
||||
SCREEN_LOG_LEVEL_NO_PREFIX = 0x100 /* OR this to your LOG_LEVEL to prevent prefix creation */
|
||||
SCREEN_LOG_LEVEL_NO_PREFIX = 0x100 /* OR this to your LOG_LEVEL to prevent prefix creation. */
|
||||
} ScreenLogLevel;
|
||||
|
||||
extern ScreenLogLevel g_screen_log_level;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -103,16 +103,22 @@
|
||||
#define SDMMC_CLOCK_TAP_SDMMC3 (0x03 << 16)
|
||||
#define SDMMC_CLOCK_TAP_SDMMC4 (0x00 << 16)
|
||||
#define SDMMC_CLOCK_TRIM_MASK (0xFF << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC1 (0x02 << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC2 (0x08 << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC1_ERISTA (0x02 << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC1_MARIKO (0x0E << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC2_ERISTA (0x08 << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC2_MARIKO (0x0D << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC3 (0x03 << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC4 (0x08 << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC4_ERISTA (0x08 << 24)
|
||||
#define SDMMC_CLOCK_TRIM_SDMMC4_MARIKO (0x0D << 24)
|
||||
#define SDMMC_CLOCK_SPI_MODE_CLKEN_OVERRIDE (1 << 2)
|
||||
#define SDMMC_CLOCK_PADPIPE_CLKEN_OVERRIDE (1 << 3)
|
||||
|
||||
/* Autocal configuration */
|
||||
#define SDMMC_AUTOCAL_PDPU_CONFIG_MASK 0x7F7F
|
||||
#define SDMMC_AUTOCAL_PDPU_SDMMC1_1V8 0x7B7B
|
||||
#define SDMMC_AUTOCAL_PDPU_SDMMC1_3V3 0x7D00
|
||||
#define SDMMC_AUTOCAL_PDPU_SDMMC1_1V8_ERISTA 0x7B7B
|
||||
#define SDMMC_AUTOCAL_PDPU_SDMMC1_1V8_MARIKO 0x0606
|
||||
#define SDMMC_AUTOCAL_PDPU_SDMMC1_3V3_ERISTA 0x7D00
|
||||
#define SDMMC_AUTOCAL_PDPU_SDMMC1_3V3_MARIKO 0x0000
|
||||
#define SDMMC_AUTOCAL_PDPU_SDMMC4_1V8 0x0505
|
||||
#define SDMMC_AUTOCAL_START (1 << 31)
|
||||
#define SDMMC_AUTOCAL_ENABLE (1 << 29)
|
||||
@@ -190,53 +196,53 @@ typedef enum {
|
||||
} SdmmcControllerNum;
|
||||
|
||||
typedef enum {
|
||||
SDMMC_PARTITION_INVALID = -1,
|
||||
SDMMC_PARTITION_USER = 0,
|
||||
SDMMC_PARTITION_BOOT0 = 1,
|
||||
SDMMC_PARTITION_BOOT1 = 2,
|
||||
SDMMC_PARTITION_RPMB = 3
|
||||
SDMMC_PARTITION_INVALID = -1,
|
||||
SDMMC_PARTITION_USER = 0,
|
||||
SDMMC_PARTITION_BOOT0 = 1,
|
||||
SDMMC_PARTITION_BOOT1 = 2,
|
||||
SDMMC_PARTITION_RPMB = 3
|
||||
} SdmmcPartitionNum;
|
||||
|
||||
typedef enum {
|
||||
SDMMC_VOLTAGE_NONE = 0,
|
||||
SDMMC_VOLTAGE_1V8 = 1,
|
||||
SDMMC_VOLTAGE_3V3 = 2
|
||||
SDMMC_VOLTAGE_NONE = 0,
|
||||
SDMMC_VOLTAGE_1V8 = 1,
|
||||
SDMMC_VOLTAGE_3V3 = 2
|
||||
} SdmmcBusVoltage;
|
||||
|
||||
typedef enum {
|
||||
SDMMC_BUS_WIDTH_1BIT = 0,
|
||||
SDMMC_BUS_WIDTH_4BIT = 1,
|
||||
SDMMC_BUS_WIDTH_8BIT = 2
|
||||
SDMMC_BUS_WIDTH_1BIT = 0,
|
||||
SDMMC_BUS_WIDTH_4BIT = 1,
|
||||
SDMMC_BUS_WIDTH_8BIT = 2
|
||||
} SdmmcBusWidth;
|
||||
|
||||
typedef enum {
|
||||
SDMMC_SPEED_MMC_INIT = 0,
|
||||
SDMMC_SPEED_MMC_IDENT = 0,
|
||||
SDMMC_SPEED_MMC_LEGACY = 1,
|
||||
SDMMC_SPEED_MMC_HS = 2,
|
||||
SDMMC_SPEED_MMC_HS200 = 3,
|
||||
SDMMC_SPEED_MMC_HS400 = 4,
|
||||
SDMMC_SPEED_SD_INIT = 5,
|
||||
SDMMC_SPEED_SD_LEGACY = 6,
|
||||
SDMMC_SPEED_SD_IDENT = 5,
|
||||
SDMMC_SPEED_SD_DS = 6,
|
||||
SDMMC_SPEED_SD_HS = 7,
|
||||
SDMMC_SPEED_UHS_SDR12 = 8,
|
||||
SDMMC_SPEED_UHS_SDR25 = 9,
|
||||
SDMMC_SPEED_UHS_SDR50 = 10,
|
||||
SDMMC_SPEED_UHS_SDR104 = 11,
|
||||
SDMMC_SPEED_UHS_RESERVED = 12,
|
||||
SDMMC_SPEED_UHS_DDR50 = 13,
|
||||
SDMMC_SPEED_MMC_DDR52 = 14,
|
||||
SDMMC_SPEED_SD_SDR12 = 8,
|
||||
SDMMC_SPEED_SD_SDR25 = 9,
|
||||
SDMMC_SPEED_SD_SDR50 = 10,
|
||||
SDMMC_SPEED_SD_SDR104 = 11,
|
||||
SDMMC_SPEED_SD_DDR50 = 12,
|
||||
SDMMC_SPEED_GC_ASIC_FPGA = 13,
|
||||
SDMMC_SPEED_GC_ASIC = 14,
|
||||
SDMMC_SPEED_EMU_SDR104 = 255, /* Custom speed mode. Prevents low voltage switch in MMC emulation. */
|
||||
} SdmmcBusSpeed;
|
||||
|
||||
typedef enum {
|
||||
SDMMC_CAR_DIVIDER_UHS_SDR12 = 31, /* (16.5 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_UHS_SDR25 = 15, /* (8.5 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_UHS_SDR50 = 7, /* (4.5 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_UHS_SDR104 = 2, /* (2 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_UHS_DDR50 = 18, /* (5 * 2 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_MMC_LEGACY = 30, /* (16 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_MMC_HS = 14, /* (8 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_MMC_HS200 = 3, /* (2.5 * 2) - 2 (for PLLP_OUT0, same as HS400) */
|
||||
SDMMC_CAR_DIVIDER_MMC_LEGACY = 30, /* (16 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_MMC_HS = 14, /* (8 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_MMC_HS200 = 3, /* (2.5 * 2) - 2 (for PLLP_OUT0, same as HS400) */
|
||||
SDMMC_CAR_DIVIDER_SD_SDR12 = 31, /* (16.5 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_SD_SDR25 = 15, /* (8.5 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_SD_SDR50 = 7, /* (4.5 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_SD_SDR104 = 2, /* (2 * 2) - 2 */
|
||||
SDMMC_CAR_DIVIDER_GC_ASIC_FPGA = 18, /* (5 * 2 * 2) - 2 */
|
||||
} SdmmcCarDivider;
|
||||
|
||||
/* Structure for describing a SDMMC device. */
|
||||
@@ -27,7 +27,7 @@ endif
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := src src/lib src/display
|
||||
SOURCES := src ../../fusee/common ../../fusee/common/display
|
||||
DATA := data
|
||||
INCLUDES := include ../../libraries/libvapours/include
|
||||
|
||||
@@ -35,7 +35,7 @@ INCLUDES := include ../../libraries/libvapours/include
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
||||
DEFINES := -D__BPMP__ -DFUSEE_STAGE1_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AMSREV)\"
|
||||
DEFINES := -D__BPMP__ -DFUSEE_MTC_SRC -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AMSREV)\"
|
||||
|
||||
CFLAGS := \
|
||||
-g \
|
||||
|
||||
@@ -35,6 +35,7 @@ static inline uint32_t get_clk_source_reg(CarDevice dev) {
|
||||
case CARDEVICE_KFUSE: return 0;
|
||||
case CARDEVICE_CL_DVFS: return 0;
|
||||
case CARDEVICE_CORESIGHT: return 0x1D4;
|
||||
case CARDEVICE_MSELECT: return 0x3B4;
|
||||
case CARDEVICE_ACTMON: return 0x3E8;
|
||||
case CARDEVICE_BPMP: return 0;
|
||||
default: generic_panic();
|
||||
@@ -58,6 +59,7 @@ static inline uint32_t get_clk_source_val(CarDevice dev) {
|
||||
case CARDEVICE_KFUSE: return 0;
|
||||
case CARDEVICE_CL_DVFS: return 0;
|
||||
case CARDEVICE_CORESIGHT: return 0;
|
||||
case CARDEVICE_MSELECT: return 0;
|
||||
case CARDEVICE_ACTMON: return 6;
|
||||
case CARDEVICE_BPMP: return 0;
|
||||
default: generic_panic();
|
||||
@@ -81,6 +83,7 @@ static inline uint32_t get_clk_source_div(CarDevice dev) {
|
||||
case CARDEVICE_KFUSE: return 0;
|
||||
case CARDEVICE_CL_DVFS: return 0;
|
||||
case CARDEVICE_CORESIGHT: return 4;
|
||||
case CARDEVICE_MSELECT: return 6;
|
||||
case CARDEVICE_ACTMON: return 0;
|
||||
case CARDEVICE_BPMP: return 0;
|
||||
default: generic_panic();
|
||||
|
||||
@@ -37,23 +37,28 @@
|
||||
|
||||
/* Clock and reset devices. */
|
||||
typedef enum {
|
||||
CARDEVICE_UARTA = ((0 << 5) | 0x6),
|
||||
CARDEVICE_UARTB = ((0 << 5) | 0x7),
|
||||
CARDEVICE_UARTC = ((1 << 5) | 0x17),
|
||||
CARDEVICE_I2C1 = ((0 << 5) | 0xC),
|
||||
CARDEVICE_I2C5 = ((1 << 5) | 0xF),
|
||||
CARDEVICE_TZRAM = ((3 << 5) | 0x1E),
|
||||
CARDEVICE_SE = ((3 << 5) | 0x1F),
|
||||
CARDEVICE_HOST1X = ((0 << 5) | 0x1C),
|
||||
CARDEVICE_TSEC = ((2 << 5) | 0x13),
|
||||
CARDEVICE_SOR_SAFE = ((6 << 5) | 0x1E),
|
||||
CARDEVICE_SOR0 = ((5 << 5) | 0x16),
|
||||
CARDEVICE_SOR1 = ((5 << 5) | 0x17),
|
||||
CARDEVICE_KFUSE = ((1 << 5) | 0x8),
|
||||
CARDEVICE_CL_DVFS = ((4 << 5) | 0x1B),
|
||||
CARDEVICE_BPMP = ((0 << 5) | 0x1),
|
||||
CARDEVICE_UARTA = ((0 << 5) | 0x6),
|
||||
CARDEVICE_UARTB = ((0 << 5) | 0x7),
|
||||
CARDEVICE_I2C1 = ((0 << 5) | 0xC),
|
||||
CARDEVICE_USBD = ((0 << 5) | 0x16),
|
||||
CARDEVICE_HOST1X = ((0 << 5) | 0x1C),
|
||||
CARDEVICE_AHBDMA = ((1 << 5) | 0x1),
|
||||
CARDEVICE_APBDMA = ((1 << 5) | 0x2),
|
||||
CARDEVICE_KFUSE = ((1 << 5) | 0x8),
|
||||
CARDEVICE_I2C5 = ((1 << 5) | 0xF),
|
||||
CARDEVICE_UARTC = ((1 << 5) | 0x17),
|
||||
CARDEVICE_USB2 = ((1 << 5) | 0x1A),
|
||||
CARDEVICE_CORESIGHT = ((2 << 5) | 0x9),
|
||||
CARDEVICE_ACTMON = ((3 << 5) | 0x17),
|
||||
CARDEVICE_BPMP = ((0 << 5) | 0x1)
|
||||
CARDEVICE_TSEC = ((2 << 5) | 0x13),
|
||||
CARDEVICE_MSELECT = ((3 << 5) | 0x8),
|
||||
CARDEVICE_ACTMON = ((3 << 5) | 0x17),
|
||||
CARDEVICE_TZRAM = ((3 << 5) | 0x1E),
|
||||
CARDEVICE_SE = ((3 << 5) | 0x1F),
|
||||
CARDEVICE_CL_DVFS = ((4 << 5) | 0x1B),
|
||||
CARDEVICE_SOR0 = ((5 << 5) | 0x16),
|
||||
CARDEVICE_SOR1 = ((5 << 5) | 0x17),
|
||||
CARDEVICE_SOR_SAFE = ((6 << 5) | 0x1E),
|
||||
} CarDevice;
|
||||
|
||||
/* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */
|
||||
@@ -283,7 +288,7 @@ typedef struct {
|
||||
uint32_t clk_source_sata_oob; /* _CLK_SOURCE_SATA_OOB_0, 0x420 */
|
||||
uint32_t clk_source_sata; /* _CLK_SOURCE_SATA_0, 0x424 */
|
||||
uint32_t clk_source_hda; /* _CLK_SOURCE_HDA_0, 0x428 */
|
||||
uint32_t _0x42c;
|
||||
uint32_t clk_source_se; /* _CLK_SOURCE_SE_0, 0x42c */
|
||||
|
||||
/* _RST_DEV_V/W_SET_0 0x430-0x43c */
|
||||
uint32_t rst_dev_v_set;
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 1997-2002 ELTEC Elektronik AG
|
||||
* Frank Gottschling <fgottschling@eltec.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _VIDEO_FB_H_
|
||||
#define _VIDEO_FB_H_
|
||||
|
||||
#define CONSOLE_BG_COL 0x00
|
||||
#define CONSOLE_FG_COL 0xa0
|
||||
|
||||
/* Try using the small font */
|
||||
#define CONFIG_VIDEO_FONT_SMALL
|
||||
|
||||
/*
|
||||
* Graphic Data Format (GDF) bits for VIDEO_DATA_FORMAT
|
||||
*/
|
||||
#define GDF__8BIT_INDEX 0
|
||||
#define GDF_15BIT_555RGB 1
|
||||
#define GDF_16BIT_565RGB 2
|
||||
#define GDF_32BIT_X888RGB 3
|
||||
#define GDF_24BIT_888RGB 4
|
||||
#define GDF__8BIT_332RGB 5
|
||||
|
||||
#define CONFIG_VIDEO_FB_LITTLE_ENDIAN
|
||||
#define CONFIG_VIDEO_VISIBLE_COLS 720
|
||||
#define CONFIG_VIDEO_VISIBLE_ROWS 1280
|
||||
#define CONFIG_VIDEO_COLS 768
|
||||
#define CONFIG_VIDEO_PIXEL_SIZE 4
|
||||
#define CONFIG_VIDEO_DATA_FORMAT GDF_32BIT_X888RGB /* BGR actually, but w/e */
|
||||
|
||||
int video_get_col(void);
|
||||
int video_get_row(void);
|
||||
|
||||
int video_init(void *fb);
|
||||
int video_resume(void *fb, int row, int col);
|
||||
void video_puts(const char *s);
|
||||
|
||||
#endif /*_VIDEO_FB_H_ */
|
||||
@@ -1086,4 +1086,44 @@
|
||||
#define EMC_PMC_SCRATCH2 0x444
|
||||
#define EMC_PMC_SCRATCH3 0x448
|
||||
|
||||
#define EMC_PMACRO_PERBIT_FGCG_CTRL_0 0xd40
|
||||
#define EMC_PMACRO_PERBIT_FGCG_CTRL_1 0xd44
|
||||
#define EMC_PMACRO_PERBIT_FGCG_CTRL_2 0xd48
|
||||
#define EMC_PMACRO_PERBIT_FGCG_CTRL_3 0xd4c
|
||||
#define EMC_PMACRO_PERBIT_FGCG_CTRL_4 0xd50
|
||||
#define EMC_PMACRO_PERBIT_FGCG_CTRL_5 0xd54
|
||||
#define EMC_PMACRO_PERBIT_RFU_CTRL_0 0xd60
|
||||
#define EMC_PMACRO_PERBIT_RFU_CTRL_1 0xd64
|
||||
#define EMC_PMACRO_PERBIT_RFU_CTRL_2 0xd68
|
||||
#define EMC_PMACRO_PERBIT_RFU_CTRL_3 0xd6c
|
||||
#define EMC_PMACRO_PERBIT_RFU_CTRL_4 0xd70
|
||||
#define EMC_PMACRO_PERBIT_RFU_CTRL_5 0xd74
|
||||
#define EMC_PMACRO_PERBIT_RFU1_CTRL_0 0xd80
|
||||
#define EMC_PMACRO_PERBIT_RFU1_CTRL_1 0xd84
|
||||
#define EMC_PMACRO_PERBIT_RFU1_CTRL_2 0xd88
|
||||
#define EMC_PMACRO_PERBIT_RFU1_CTRL_3 0xd8c
|
||||
#define EMC_PMACRO_PERBIT_RFU1_CTRL_4 0xd90
|
||||
#define EMC_PMACRO_PERBIT_RFU1_CTRL_5 0xd94
|
||||
|
||||
#define EMC_PMACRO_PMU_OUT_EOFF1_0 0xda0
|
||||
#define EMC_PMACRO_PMU_OUT_EOFF1_1 0xda4
|
||||
#define EMC_PMACRO_PMU_OUT_EOFF1_2 0xda8
|
||||
#define EMC_PMACRO_PMU_OUT_EOFF1_3 0xdac
|
||||
#define EMC_PMACRO_PMU_OUT_EOFF1_4 0xdb0
|
||||
#define EMC_PMACRO_PMU_OUT_EOFF1_5 0xdb4
|
||||
|
||||
#define EMC_PMACRO_COMP_PMU_OUT 0xdc0
|
||||
#define EMC_PMACRO_DATA_PI_CTRL 0x110
|
||||
#define EMC_PMACRO_CMD_PI_CTRL 0x114
|
||||
|
||||
#define EMC_AUTO_CAL_CONFIG9 0x42c
|
||||
|
||||
#define EMC_TRTM 0xbc
|
||||
#define EMC_TWTM 0xf8
|
||||
#define EMC_TRATM 0xfc
|
||||
#define EMC_TWATM 0x108
|
||||
#define EMC_TR2REF 0x10c
|
||||
|
||||
#define EMC_PMACRO_DSR_VTTGEN_CTRL_0 0xc6c
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,11 +24,6 @@
|
||||
#include "pmc.h"
|
||||
#include "timers.h"
|
||||
|
||||
/* Prototypes for internal commands. */
|
||||
void fuse_enable_power(void);
|
||||
void fuse_disable_power(void);
|
||||
void fuse_wait_idle(void);
|
||||
|
||||
/* Initialize the fuse driver */
|
||||
void fuse_init(void) {
|
||||
/* Make all fuse registers visible, disable the private key and disable programming. */
|
||||
@@ -43,7 +38,7 @@ void fuse_disable_private_key(void) {
|
||||
fuse->FUSE_PRIVATEKEYDISABLE = 0x10;
|
||||
}
|
||||
|
||||
/* Disables all fuse programming. */
|
||||
/* Disable all fuse programming. */
|
||||
void fuse_disable_programming(void) {
|
||||
volatile tegra_fuse_t *fuse = fuse_get_regs();
|
||||
fuse->FUSE_DISABLEREGPROGRAM = 1;
|
||||
@@ -68,13 +63,14 @@ void fuse_disable_power(void) {
|
||||
}
|
||||
|
||||
/* Wait for the fuse driver to go idle. */
|
||||
void fuse_wait_idle(void) {
|
||||
static void fuse_wait_idle(void) {
|
||||
volatile tegra_fuse_t *fuse = fuse_get_regs();
|
||||
uint32_t ctrl_val = 0;
|
||||
|
||||
/* Wait for STATE_IDLE */
|
||||
while ((ctrl_val & (0xF0000)) != 0x40000)
|
||||
while ((ctrl_val & (0xF0000)) != 0x40000) {
|
||||
ctrl_val = fuse->FUSE_FUSECTRL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read a fuse from the hardware array. */
|
||||
@@ -120,7 +116,7 @@ void fuse_hw_write(uint32_t value, uint32_t addr) {
|
||||
fuse_wait_idle();
|
||||
}
|
||||
|
||||
/* Sense the fuse hardware array into the shadow cache. */
|
||||
/* Sense the fuse hardware array into the fuse cache. */
|
||||
void fuse_hw_sense(void) {
|
||||
volatile tegra_fuse_t *fuse = fuse_get_regs();
|
||||
|
||||
@@ -137,46 +133,68 @@ void fuse_hw_sense(void) {
|
||||
fuse_wait_idle();
|
||||
}
|
||||
|
||||
/* Read the SKU info register from the shadow cache. */
|
||||
/* Read the SKU info register. */
|
||||
uint32_t fuse_get_sku_info(void) {
|
||||
volatile tegra_fuse_chip_t *fuse_chip = fuse_chip_get_regs();
|
||||
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
|
||||
return fuse_chip->FUSE_SKU_INFO;
|
||||
}
|
||||
|
||||
/* Read the bootrom patch version from a register in the shadow cache. */
|
||||
/* Read the bootrom patch version. */
|
||||
uint32_t fuse_get_bootrom_patch_version(void) {
|
||||
volatile tegra_fuse_chip_t *fuse_chip = fuse_chip_get_regs();
|
||||
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
|
||||
return fuse_chip->FUSE_SOC_SPEEDO_1_CALIB;
|
||||
}
|
||||
|
||||
/* Read a spare bit register from the shadow cache */
|
||||
uint32_t fuse_get_spare_bit(uint32_t idx) {
|
||||
if (idx < 32) {
|
||||
volatile tegra_fuse_chip_t *fuse_chip = fuse_chip_get_regs();
|
||||
return fuse_chip->FUSE_SPARE_BIT[idx];
|
||||
} else {
|
||||
return 0;
|
||||
/* Read a spare bit register. */
|
||||
uint32_t fuse_get_spare_bit(uint32_t index) {
|
||||
uint32_t soc_type = fuse_get_soc_type();
|
||||
if (soc_type == 0) {
|
||||
if (index < 32) {
|
||||
volatile tegra_fuse_chip_erista_t *fuse_chip = fuse_chip_erista_get_regs();
|
||||
return fuse_chip->FUSE_SPARE_BIT[index];
|
||||
}
|
||||
} else if (soc_type == 1) {
|
||||
if (index < 30) {
|
||||
volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs();
|
||||
return fuse_chip->FUSE_SPARE_BIT[index];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read a reserved ODM register from the shadow cache. */
|
||||
uint32_t fuse_get_reserved_odm(uint32_t idx) {
|
||||
if (idx < 8) {
|
||||
volatile tegra_fuse_chip_t *fuse_chip = fuse_chip_get_regs();
|
||||
return fuse_chip->FUSE_RESERVED_ODM[idx];
|
||||
/* Read a reserved ODM register. */
|
||||
uint32_t fuse_get_reserved_odm(uint32_t index) {
|
||||
if (index < 8) {
|
||||
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
|
||||
return fuse_chip->FUSE_RESERVED_ODM0[index];
|
||||
} else {
|
||||
return 0;
|
||||
uint32_t soc_type = fuse_get_soc_type();
|
||||
if (soc_type == 1) {
|
||||
volatile tegra_fuse_chip_mariko_t *fuse_chip = fuse_chip_mariko_get_regs();
|
||||
if (index < 22) {
|
||||
return fuse_chip->FUSE_RESERVED_ODM8[index - 8];
|
||||
} else if (index < 25) {
|
||||
return fuse_chip->FUSE_RESERVED_ODM22[index - 22];
|
||||
} else if (index < 26) {
|
||||
return fuse_chip->FUSE_RESERVED_ODM25;
|
||||
} else if (index < 29) {
|
||||
return fuse_chip->FUSE_RESERVED_ODM26[index - 26];
|
||||
} else if (index < 30) {
|
||||
return fuse_chip->FUSE_RESERVED_ODM29;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the DRAM ID using values in the shadow cache. */
|
||||
/* Get the DramId. */
|
||||
uint32_t fuse_get_dram_id(void) {
|
||||
return ((fuse_get_reserved_odm(4) >> 3) & 0x7);
|
||||
return ((fuse_get_reserved_odm(4) >> 3) & 0x1F);
|
||||
}
|
||||
|
||||
/* Derive the Device ID using values in the shadow cache. */
|
||||
/* Derive the DeviceId. */
|
||||
uint64_t fuse_get_device_id(void) {
|
||||
volatile tegra_fuse_chip_t *fuse_chip = fuse_chip_get_regs();
|
||||
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
|
||||
|
||||
uint64_t device_id = 0;
|
||||
uint64_t y_coord = fuse_chip->FUSE_OPT_Y_COORDINATE & 0x1FF;
|
||||
@@ -200,48 +218,74 @@ uint64_t fuse_get_device_id(void) {
|
||||
return device_id;
|
||||
}
|
||||
|
||||
/* Derive the Hardware Type using values in the shadow cache. */
|
||||
uint32_t fuse_get_hardware_type(uint32_t target_firmware) {
|
||||
/* Derive the HardwareType with firmware specific checks. */
|
||||
uint32_t fuse_get_hardware_type_with_firmware_check(uint32_t target_firmware) {
|
||||
uint32_t fuse_reserved_odm4 = fuse_get_reserved_odm(4);
|
||||
uint32_t hardware_type = (((fuse_reserved_odm4 >> 7) & 2) | ((fuse_reserved_odm4 >> 2) & 1));
|
||||
|
||||
/* Firmware from versions 1.0.0 to 3.0.2. */
|
||||
if (target_firmware < ATMOSPHERE_TARGET_FIRMWARE_4_0_0) {
|
||||
volatile tegra_fuse_chip_t *fuse_chip = fuse_chip_get_regs();
|
||||
if (hardware_type >= 1) {
|
||||
return (hardware_type > 2) ? 3 : hardware_type - 1;
|
||||
} else if ((fuse_chip->FUSE_SPARE_BIT[9] & 1) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return 3;
|
||||
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
|
||||
uint32_t fuse_spare_bit9 = (fuse_chip->FUSE_SPARE_BIT[9] & 1);
|
||||
|
||||
switch (hardware_type) {
|
||||
case 0x00: return (fuse_spare_bit9 == 0) ? 0 : 3;
|
||||
case 0x01: return 0; /* HardwareType_Icosa */
|
||||
case 0x02: return 1; /* HardwareType_Copper */
|
||||
default: return 3; /* HardwareType_Undefined */
|
||||
}
|
||||
} else if (target_firmware < ATMOSPHERE_TARGET_FIRMWARE_7_0_0) { /* Firmware versions from 4.0.0 to 6.2.0. */
|
||||
static const uint32_t types[] = {0,1,4,3};
|
||||
} else {
|
||||
hardware_type |= ((fuse_reserved_odm4 >> 14) & 0x3C);
|
||||
hardware_type--;
|
||||
return (hardware_type > 3) ? 4 : types[hardware_type];
|
||||
} else { /* Firmware versions from 7.0.0 onwards. */
|
||||
/* Always return 0 in retail. */
|
||||
return 0;
|
||||
|
||||
if (target_firmware < ATMOSPHERE_TARGET_FIRMWARE_7_0_0) {
|
||||
switch (hardware_type) {
|
||||
case 0x01: return 0; /* HardwareType_Icosa */
|
||||
case 0x02: return 1; /* HardwareType_Copper */
|
||||
case 0x04: return 3; /* HardwareType_Iowa */
|
||||
default: return 4; /* HardwareType_Undefined */
|
||||
}
|
||||
} else {
|
||||
if (target_firmware < ATMOSPHERE_TARGET_FIRMWARE_10_0_0) {
|
||||
switch (hardware_type) {
|
||||
case 0x01: return 0; /* HardwareType_Icosa */
|
||||
case 0x02: return 4; /* HardwareType_Calcio */
|
||||
case 0x04: return 3; /* HardwareType_Iowa */
|
||||
case 0x08: return 2; /* HardwareType_Hoag */
|
||||
default: return 0xF; /* HardwareType_Undefined */
|
||||
}
|
||||
} else {
|
||||
switch (hardware_type) {
|
||||
case 0x01: return 0; /* HardwareType_Icosa */
|
||||
case 0x02: return 4; /* HardwareType_Calcio */
|
||||
case 0x04: return 3; /* HardwareType_Iowa */
|
||||
case 0x08: return 2; /* HardwareType_Hoag */
|
||||
case 0x10: return 5; /* HardwareType_Five */
|
||||
default: return 0xF; /* HardwareType_Undefined */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Derive the Retail Type using values in the shadow cache. */
|
||||
uint32_t fuse_get_retail_type(void) {
|
||||
/* Retail Type = IS_RETAIL | UNIT_TYPE. */
|
||||
/* Derive the HardwareType. */
|
||||
uint32_t fuse_get_hardware_type(void) {
|
||||
return fuse_get_hardware_type_with_firmware_check(ATMOSPHERE_TARGET_FIRMWARE_CURRENT);
|
||||
}
|
||||
|
||||
/* Derive the HardwareState. */
|
||||
uint32_t fuse_get_hardware_state(void) {
|
||||
uint32_t fuse_reserved_odm4 = fuse_get_reserved_odm(4);
|
||||
uint32_t retail_type = (((fuse_reserved_odm4 >> 7) & 4) | (fuse_reserved_odm4 & 3));
|
||||
if (retail_type == 4) { /* Standard retail unit, IS_RETAIL | 0. */
|
||||
return 1;
|
||||
} else if (retail_type == 3) { /* Standard dev unit, 0 | DEV_UNIT. */
|
||||
return 0;
|
||||
uint32_t hardware_state = (((fuse_reserved_odm4 >> 7) & 4) | (fuse_reserved_odm4 & 3));
|
||||
|
||||
switch (hardware_state) {
|
||||
case 0x03: return 0; /* HardwareState_Development */
|
||||
case 0x04: return 1; /* HardwareState_Production */
|
||||
default: return 2; /* HardwareState_Undefined */
|
||||
}
|
||||
return 2; /* IS_RETAIL | DEV_UNIT */
|
||||
}
|
||||
|
||||
/* Derive the 16-byte Hardware Info using values in the shadow cache, and copy to output buffer. */
|
||||
/* Derive the 16-byte HardwareInfo and copy to output buffer. */
|
||||
void fuse_get_hardware_info(void *dst) {
|
||||
volatile tegra_fuse_chip_t *fuse_chip = fuse_chip_get_regs();
|
||||
volatile tegra_fuse_chip_common_t *fuse_chip = fuse_chip_common_get_regs();
|
||||
uint32_t hw_info[0x4];
|
||||
|
||||
uint32_t ops_reserved = fuse_chip->FUSE_OPT_OPS_RESERVED & 0x3F;
|
||||
@@ -261,3 +305,42 @@ void fuse_get_hardware_info(void *dst) {
|
||||
|
||||
memcpy(dst, hw_info, 0x10);
|
||||
}
|
||||
|
||||
/* Check if have a new ODM fuse format. */
|
||||
bool fuse_is_new_format(void) {
|
||||
return ((fuse_get_reserved_odm(4) & 0x800) && (fuse_get_reserved_odm(0) == 0x8E61ECAE) && (fuse_get_reserved_odm(1) == 0xF2BA3BB2));
|
||||
}
|
||||
|
||||
/* Get the DeviceUniqueKeyGeneration. */
|
||||
uint32_t fuse_get_device_unique_key_generation(void) {
|
||||
if (fuse_is_new_format()) {
|
||||
return (fuse_get_reserved_odm(2) & 0x1F);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the SocType from the HardwareType. */
|
||||
uint32_t fuse_get_soc_type(void) {
|
||||
switch (fuse_get_hardware_type()) {
|
||||
case 0:
|
||||
case 1:
|
||||
return 0; /* SocType_Erista */
|
||||
case 3:
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
return 1; /* SocType_Mariko */
|
||||
default:
|
||||
return 0xF; /* SocType_Undefined */
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the Regulator type. */
|
||||
uint32_t fuse_get_regulator(void) {
|
||||
if (fuse_get_soc_type() == 1) {
|
||||
return ((fuse_get_reserved_odm(28) & 1) + 1); /* Regulator_Mariko_Max77812_A or Regulator_Mariko_Max77812_B */
|
||||
} else {
|
||||
return 0; /* Regulator_Erista_Max77621 */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#define FUSEE_FUSE_H
|
||||
|
||||
#define FUSE_BASE 0x7000F800
|
||||
#define FUSE_CHIP_BASE (FUSE_BASE + 0x100)
|
||||
#define FUSE_CHIP_BASE (FUSE_BASE + 0x98)
|
||||
#define MAKE_FUSE_REG(n) MAKE_REG32(FUSE_BASE + n)
|
||||
#define MAKE_FUSE_CHIP_REG(n) MAKE_REG32(FUSE_CHIP_BASE + n)
|
||||
|
||||
@@ -47,10 +47,11 @@ typedef struct {
|
||||
uint32_t FUSE_PRIVATE_KEY2_NONZERO;
|
||||
uint32_t FUSE_PRIVATE_KEY3_NONZERO;
|
||||
uint32_t FUSE_PRIVATE_KEY4_NONZERO;
|
||||
uint32_t _0x90[0x1C];
|
||||
uint32_t _0x94;
|
||||
} tegra_fuse_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t _0x98[0x1A];
|
||||
uint32_t FUSE_PRODUCTION_MODE;
|
||||
uint32_t FUSE_JTAG_SECUREID_VALID;
|
||||
uint32_t FUSE_ODM_LOCK;
|
||||
@@ -58,9 +59,7 @@ typedef struct {
|
||||
uint32_t FUSE_SKU_INFO;
|
||||
uint32_t FUSE_CPU_SPEEDO_0_CALIB;
|
||||
uint32_t FUSE_CPU_IDDQ_CALIB;
|
||||
uint32_t FUSE_DAC_CRT_CALIB;
|
||||
uint32_t FUSE_DAC_HDTV_CALIB;
|
||||
uint32_t FUSE_DAC_SDTV_CALIB;
|
||||
uint32_t _0x11C[0x3];
|
||||
uint32_t FUSE_OPT_FT_REV;
|
||||
uint32_t FUSE_CPU_SPEEDO_1_CALIB;
|
||||
uint32_t FUSE_CPU_SPEEDO_2_CALIB;
|
||||
@@ -68,7 +67,7 @@ typedef struct {
|
||||
uint32_t FUSE_SOC_SPEEDO_1_CALIB;
|
||||
uint32_t FUSE_SOC_SPEEDO_2_CALIB;
|
||||
uint32_t FUSE_SOC_IDDQ_CALIB;
|
||||
uint32_t FUSE_RESERVED_PRODUCTION_WP;
|
||||
uint32_t _0x144;
|
||||
uint32_t FUSE_FA;
|
||||
uint32_t FUSE_RESERVED_PRODUCTION;
|
||||
uint32_t FUSE_HDMI_LANE0_CALIB;
|
||||
@@ -79,7 +78,7 @@ typedef struct {
|
||||
uint32_t FUSE_PUBLIC_KEY[0x8];
|
||||
uint32_t FUSE_TSENSOR1_CALIB;
|
||||
uint32_t FUSE_TSENSOR2_CALIB;
|
||||
uint32_t FUSE_VSENSOR_CALIB;
|
||||
uint32_t _0x18C;
|
||||
uint32_t FUSE_OPT_CP_REV;
|
||||
uint32_t FUSE_OPT_PFG;
|
||||
uint32_t FUSE_TSENSOR0_CALIB;
|
||||
@@ -90,9 +89,9 @@ typedef struct {
|
||||
uint32_t FUSE_BOOT_DEVICE_INFO;
|
||||
uint32_t FUSE_RESERVED_SW;
|
||||
uint32_t FUSE_OPT_VP9_DISABLE;
|
||||
uint32_t FUSE_RESERVED_ODM[0x8];
|
||||
uint32_t FUSE_RESERVED_ODM0[0x8];
|
||||
uint32_t FUSE_OBS_DIS;
|
||||
uint32_t FUSE_NOR_INFO;
|
||||
uint32_t _0x1EC;
|
||||
uint32_t FUSE_USB_CALIB;
|
||||
uint32_t FUSE_SKU_DIRECT_CONFIG;
|
||||
uint32_t FUSE_KFUSE_PRIVKEY_CTRL;
|
||||
@@ -106,14 +105,12 @@ typedef struct {
|
||||
uint32_t FUSE_OPT_Y_COORDINATE;
|
||||
uint32_t FUSE_OPT_SEC_DEBUG_EN;
|
||||
uint32_t FUSE_OPT_OPS_RESERVED;
|
||||
uint32_t FUSE_SATA_CALIB;
|
||||
uint32_t _0x224;
|
||||
uint32_t FUSE_GPU_IDDQ_CALIB;
|
||||
uint32_t FUSE_TSENSOR3_CALIB;
|
||||
uint32_t FUSE_SKU_BOND_OUT_L;
|
||||
uint32_t FUSE_SKU_BOND_OUT_H;
|
||||
uint32_t FUSE_SKU_BOND_OUT_U;
|
||||
uint32_t FUSE_SKU_BOND_OUT_V;
|
||||
uint32_t FUSE_SKU_BOND_OUT_W;
|
||||
uint32_t FUSE_CLOCK_BOUNDOUT0;
|
||||
uint32_t FUSE_CLOCK_BOUNDOUT1;
|
||||
uint32_t _0x238[0x3];
|
||||
uint32_t FUSE_OPT_SAMPLE_TYPE;
|
||||
uint32_t FUSE_OPT_SUBREVISION;
|
||||
uint32_t FUSE_OPT_SW_RESERVED_0;
|
||||
@@ -123,35 +120,26 @@ typedef struct {
|
||||
uint32_t FUSE_TSENSOR6_CALIB;
|
||||
uint32_t FUSE_TSENSOR7_CALIB;
|
||||
uint32_t FUSE_OPT_PRIV_SEC_EN;
|
||||
uint32_t FUSE_PKC_DISABLE;
|
||||
uint32_t _0x16C;
|
||||
uint32_t _0x170;
|
||||
uint32_t _0x174;
|
||||
uint32_t _0x178;
|
||||
uint32_t _0x268[0x5];
|
||||
uint32_t FUSE_FUSE2TSEC_DEBUG_DISABLE;
|
||||
uint32_t FUSE_TSENSOR_COMMON;
|
||||
uint32_t FUSE_OPT_CP_BIN;
|
||||
uint32_t FUSE_OPT_GPU_DISABLE;
|
||||
uint32_t FUSE_OPT_FT_BIN;
|
||||
uint32_t FUSE_OPT_DONE_MAP;
|
||||
uint32_t _0x194;
|
||||
uint32_t _0x294;
|
||||
uint32_t FUSE_APB2JTAG_DISABLE;
|
||||
uint32_t FUSE_ODM_INFO;
|
||||
uint32_t _0x1A0;
|
||||
uint32_t _0x1A4;
|
||||
uint32_t _0x2A0[0x2];
|
||||
uint32_t FUSE_ARM_CRYPT_DE_FEATURE;
|
||||
uint32_t _0x1AC;
|
||||
uint32_t _0x1B0;
|
||||
uint32_t _0x1B4;
|
||||
uint32_t _0x1B8;
|
||||
uint32_t _0x1BC;
|
||||
uint32_t _0x2AC[0x5];
|
||||
uint32_t FUSE_WOA_SKU_FLAG;
|
||||
uint32_t FUSE_ECO_RESERVE_1;
|
||||
uint32_t FUSE_GCPLEX_CONFIG_FUSE;
|
||||
uint32_t FUSE_PRODUCTION_MONTH;
|
||||
uint32_t FUSE_RAM_REPAIR_INDICATOR;
|
||||
uint32_t FUSE_TSENSOR9_CALIB;
|
||||
uint32_t _0x1D8;
|
||||
uint32_t _0x2D8;
|
||||
uint32_t FUSE_VMIN_CALIBRATION;
|
||||
uint32_t FUSE_AGING_SENSOR_CALIBRATION;
|
||||
uint32_t FUSE_DEBUG_AUTHENTICATION;
|
||||
@@ -160,8 +148,7 @@ typedef struct {
|
||||
uint32_t FUSE_OPT_GPU_DISABLE_CP1;
|
||||
uint32_t FUSE_SPARE_ENDIS;
|
||||
uint32_t FUSE_ECO_RESERVE_0;
|
||||
uint32_t _0x1FC;
|
||||
uint32_t _0x200;
|
||||
uint32_t _0x2FC[0x2];
|
||||
uint32_t FUSE_RESERVED_CALIB0;
|
||||
uint32_t FUSE_RESERVED_CALIB1;
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE;
|
||||
@@ -170,11 +157,7 @@ typedef struct {
|
||||
uint32_t FUSE_OPT_CPU_DISABLE_CP1;
|
||||
uint32_t FUSE_TSENSOR10_CALIB;
|
||||
uint32_t FUSE_TSENSOR10_CALIB_AUX;
|
||||
uint32_t FUSE_OPT_RAM_SVOP_DP;
|
||||
uint32_t FUSE_OPT_RAM_SVOP_PDP;
|
||||
uint32_t FUSE_OPT_RAM_SVOP_REG;
|
||||
uint32_t FUSE_OPT_RAM_SVOP_SP;
|
||||
uint32_t FUSE_OPT_RAM_SVOP_SMPDP;
|
||||
uint32_t _0x324[0x5];
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE_CP2;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE_CP1;
|
||||
@@ -183,42 +166,316 @@ typedef struct {
|
||||
uint32_t FUSE_OPT_GPU_DISABLE_CP2;
|
||||
uint32_t FUSE_USB_CALIB_EXT;
|
||||
uint32_t FUSE_RESERVED_FIELD;
|
||||
uint32_t FUSE_OPT_ECC_EN;
|
||||
uint32_t _0x25C;
|
||||
uint32_t _0x260;
|
||||
uint32_t _0x264;
|
||||
uint32_t _0x268;
|
||||
uint32_t _0x26C;
|
||||
uint32_t _0x270;
|
||||
uint32_t _0x274;
|
||||
uint32_t _0x278;
|
||||
uint32_t _0x358[0x9];
|
||||
uint32_t FUSE_SPARE_REALIGNMENT_REG;
|
||||
uint32_t FUSE_SPARE_BIT[0x20];
|
||||
} tegra_fuse_chip_t;
|
||||
} tegra_fuse_chip_common_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t _0x98[0x1A];
|
||||
uint32_t FUSE_PRODUCTION_MODE;
|
||||
uint32_t FUSE_JTAG_SECUREID_VALID;
|
||||
uint32_t FUSE_ODM_LOCK;
|
||||
uint32_t FUSE_OPT_OPENGL_EN;
|
||||
uint32_t FUSE_SKU_INFO;
|
||||
uint32_t FUSE_CPU_SPEEDO_0_CALIB;
|
||||
uint32_t FUSE_CPU_IDDQ_CALIB;
|
||||
uint32_t _0x11C[0x3];
|
||||
uint32_t FUSE_OPT_FT_REV;
|
||||
uint32_t FUSE_CPU_SPEEDO_1_CALIB;
|
||||
uint32_t FUSE_CPU_SPEEDO_2_CALIB;
|
||||
uint32_t FUSE_SOC_SPEEDO_0_CALIB;
|
||||
uint32_t FUSE_SOC_SPEEDO_1_CALIB;
|
||||
uint32_t FUSE_SOC_SPEEDO_2_CALIB;
|
||||
uint32_t FUSE_SOC_IDDQ_CALIB;
|
||||
uint32_t _0x144;
|
||||
uint32_t FUSE_FA;
|
||||
uint32_t FUSE_RESERVED_PRODUCTION;
|
||||
uint32_t FUSE_HDMI_LANE0_CALIB;
|
||||
uint32_t FUSE_HDMI_LANE1_CALIB;
|
||||
uint32_t FUSE_HDMI_LANE2_CALIB;
|
||||
uint32_t FUSE_HDMI_LANE3_CALIB;
|
||||
uint32_t FUSE_ENCRYPTION_RATE;
|
||||
uint32_t FUSE_PUBLIC_KEY[0x8];
|
||||
uint32_t FUSE_TSENSOR1_CALIB;
|
||||
uint32_t FUSE_TSENSOR2_CALIB;
|
||||
uint32_t _0x18C;
|
||||
uint32_t FUSE_OPT_CP_REV;
|
||||
uint32_t FUSE_OPT_PFG;
|
||||
uint32_t FUSE_TSENSOR0_CALIB;
|
||||
uint32_t FUSE_FIRST_BOOTROM_PATCH_SIZE;
|
||||
uint32_t FUSE_SECURITY_MODE;
|
||||
uint32_t FUSE_PRIVATE_KEY[0x5];
|
||||
uint32_t FUSE_ARM_JTAG_DIS;
|
||||
uint32_t FUSE_BOOT_DEVICE_INFO;
|
||||
uint32_t FUSE_RESERVED_SW;
|
||||
uint32_t FUSE_OPT_VP9_DISABLE;
|
||||
uint32_t FUSE_RESERVED_ODM0[0x8];
|
||||
uint32_t FUSE_OBS_DIS;
|
||||
uint32_t _0x1EC;
|
||||
uint32_t FUSE_USB_CALIB;
|
||||
uint32_t FUSE_SKU_DIRECT_CONFIG;
|
||||
uint32_t FUSE_KFUSE_PRIVKEY_CTRL;
|
||||
uint32_t FUSE_PACKAGE_INFO;
|
||||
uint32_t FUSE_OPT_VENDOR_CODE;
|
||||
uint32_t FUSE_OPT_FAB_CODE;
|
||||
uint32_t FUSE_OPT_LOT_CODE_0;
|
||||
uint32_t FUSE_OPT_LOT_CODE_1;
|
||||
uint32_t FUSE_OPT_WAFER_ID;
|
||||
uint32_t FUSE_OPT_X_COORDINATE;
|
||||
uint32_t FUSE_OPT_Y_COORDINATE;
|
||||
uint32_t FUSE_OPT_SEC_DEBUG_EN;
|
||||
uint32_t FUSE_OPT_OPS_RESERVED;
|
||||
uint32_t FUSE_SATA_CALIB; /* Erista only. */
|
||||
uint32_t FUSE_GPU_IDDQ_CALIB;
|
||||
uint32_t FUSE_TSENSOR3_CALIB;
|
||||
uint32_t FUSE_CLOCK_BOUNDOUT0;
|
||||
uint32_t FUSE_CLOCK_BOUNDOUT1;
|
||||
uint32_t _0x238[0x3];
|
||||
uint32_t FUSE_OPT_SAMPLE_TYPE;
|
||||
uint32_t FUSE_OPT_SUBREVISION;
|
||||
uint32_t FUSE_OPT_SW_RESERVED_0;
|
||||
uint32_t FUSE_OPT_SW_RESERVED_1;
|
||||
uint32_t FUSE_TSENSOR4_CALIB;
|
||||
uint32_t FUSE_TSENSOR5_CALIB;
|
||||
uint32_t FUSE_TSENSOR6_CALIB;
|
||||
uint32_t FUSE_TSENSOR7_CALIB;
|
||||
uint32_t FUSE_OPT_PRIV_SEC_EN;
|
||||
uint32_t FUSE_PKC_DISABLE; /* Erista only. */
|
||||
uint32_t _0x26C[0x4];
|
||||
uint32_t FUSE_FUSE2TSEC_DEBUG_DISABLE;
|
||||
uint32_t FUSE_TSENSOR_COMMON;
|
||||
uint32_t FUSE_OPT_CP_BIN;
|
||||
uint32_t FUSE_OPT_GPU_DISABLE;
|
||||
uint32_t FUSE_OPT_FT_BIN;
|
||||
uint32_t FUSE_OPT_DONE_MAP;
|
||||
uint32_t _0x294;
|
||||
uint32_t FUSE_APB2JTAG_DISABLE;
|
||||
uint32_t FUSE_ODM_INFO;
|
||||
uint32_t _0x2A0[0x2];
|
||||
uint32_t FUSE_ARM_CRYPT_DE_FEATURE;
|
||||
uint32_t _0x2AC[0x5];
|
||||
uint32_t FUSE_WOA_SKU_FLAG;
|
||||
uint32_t FUSE_ECO_RESERVE_1;
|
||||
uint32_t FUSE_GCPLEX_CONFIG_FUSE;
|
||||
uint32_t FUSE_PRODUCTION_MONTH;
|
||||
uint32_t FUSE_RAM_REPAIR_INDICATOR;
|
||||
uint32_t FUSE_TSENSOR9_CALIB;
|
||||
uint32_t _0x2D8;
|
||||
uint32_t FUSE_VMIN_CALIBRATION;
|
||||
uint32_t FUSE_AGING_SENSOR_CALIBRATION;
|
||||
uint32_t FUSE_DEBUG_AUTHENTICATION;
|
||||
uint32_t FUSE_SECURE_PROVISION_INDEX;
|
||||
uint32_t FUSE_SECURE_PROVISION_INFO;
|
||||
uint32_t FUSE_OPT_GPU_DISABLE_CP1;
|
||||
uint32_t FUSE_SPARE_ENDIS;
|
||||
uint32_t FUSE_ECO_RESERVE_0;
|
||||
uint32_t _0x2FC[0x2];
|
||||
uint32_t FUSE_RESERVED_CALIB0;
|
||||
uint32_t FUSE_RESERVED_CALIB1;
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE;
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE_CP1;
|
||||
uint32_t FUSE_OPT_CPU_DISABLE;
|
||||
uint32_t FUSE_OPT_CPU_DISABLE_CP1;
|
||||
uint32_t FUSE_TSENSOR10_CALIB;
|
||||
uint32_t FUSE_TSENSOR10_CALIB_AUX;
|
||||
uint32_t FUSE_OPT_RAM_SVOP_DP; /* Erista only. */
|
||||
uint32_t FUSE_OPT_RAM_SVOP_PDP; /* Erista only. */
|
||||
uint32_t FUSE_OPT_RAM_SVOP_REG; /* Erista only. */
|
||||
uint32_t FUSE_OPT_RAM_SVOP_SP; /* Erista only. */
|
||||
uint32_t FUSE_OPT_RAM_SVOP_SMPDP; /* Erista only. */
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE_CP2;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE_CP1;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE_CP2;
|
||||
uint32_t FUSE_OPT_CPU_DISABLE_CP2;
|
||||
uint32_t FUSE_OPT_GPU_DISABLE_CP2;
|
||||
uint32_t FUSE_USB_CALIB_EXT;
|
||||
uint32_t FUSE_RESERVED_FIELD;
|
||||
uint32_t _0x358[0x9];
|
||||
uint32_t FUSE_SPARE_REALIGNMENT_REG;
|
||||
uint32_t FUSE_SPARE_BIT[0x20];
|
||||
} tegra_fuse_chip_erista_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t FUSE_RESERVED_ODM8[0xE]; /* Mariko only. */
|
||||
uint32_t FUSE_KEK[0x4]; /* Mariko only. */
|
||||
uint32_t FUSE_BEK[0x4]; /* Mariko only. */
|
||||
uint32_t _0xF0; /* Mariko only. */
|
||||
uint32_t _0xF4; /* Mariko only. */
|
||||
uint32_t _0xF8; /* Mariko only. */
|
||||
uint32_t _0xFC; /* Mariko only. */
|
||||
uint32_t FUSE_PRODUCTION_MODE;
|
||||
uint32_t FUSE_JTAG_SECUREID_VALID;
|
||||
uint32_t FUSE_ODM_LOCK;
|
||||
uint32_t FUSE_OPT_OPENGL_EN;
|
||||
uint32_t FUSE_SKU_INFO;
|
||||
uint32_t FUSE_CPU_SPEEDO_0_CALIB;
|
||||
uint32_t FUSE_CPU_IDDQ_CALIB;
|
||||
uint32_t FUSE_RESERVED_ODM22[0x3]; /* Mariko only. */
|
||||
uint32_t FUSE_OPT_FT_REV;
|
||||
uint32_t FUSE_CPU_SPEEDO_1_CALIB;
|
||||
uint32_t FUSE_CPU_SPEEDO_2_CALIB;
|
||||
uint32_t FUSE_SOC_SPEEDO_0_CALIB;
|
||||
uint32_t FUSE_SOC_SPEEDO_1_CALIB;
|
||||
uint32_t FUSE_SOC_SPEEDO_2_CALIB;
|
||||
uint32_t FUSE_SOC_IDDQ_CALIB;
|
||||
uint32_t FUSE_RESERVED_ODM25; /* Mariko only. */
|
||||
uint32_t FUSE_FA;
|
||||
uint32_t FUSE_RESERVED_PRODUCTION;
|
||||
uint32_t FUSE_HDMI_LANE0_CALIB;
|
||||
uint32_t FUSE_HDMI_LANE1_CALIB;
|
||||
uint32_t FUSE_HDMI_LANE2_CALIB;
|
||||
uint32_t FUSE_HDMI_LANE3_CALIB;
|
||||
uint32_t FUSE_ENCRYPTION_RATE;
|
||||
uint32_t FUSE_PUBLIC_KEY[0x8];
|
||||
uint32_t FUSE_TSENSOR1_CALIB;
|
||||
uint32_t FUSE_TSENSOR2_CALIB;
|
||||
uint32_t FUSE_OPT_SECURE_SCC_DIS; /* Mariko only. */
|
||||
uint32_t FUSE_OPT_CP_REV;
|
||||
uint32_t FUSE_OPT_PFG;
|
||||
uint32_t FUSE_TSENSOR0_CALIB;
|
||||
uint32_t FUSE_FIRST_BOOTROM_PATCH_SIZE;
|
||||
uint32_t FUSE_SECURITY_MODE;
|
||||
uint32_t FUSE_PRIVATE_KEY[0x5];
|
||||
uint32_t FUSE_ARM_JTAG_DIS;
|
||||
uint32_t FUSE_BOOT_DEVICE_INFO;
|
||||
uint32_t FUSE_RESERVED_SW;
|
||||
uint32_t FUSE_OPT_VP9_DISABLE;
|
||||
uint32_t FUSE_RESERVED_ODM0[0x8];
|
||||
uint32_t FUSE_OBS_DIS;
|
||||
uint32_t _0x1EC; /* Mariko only. */
|
||||
uint32_t FUSE_USB_CALIB;
|
||||
uint32_t FUSE_SKU_DIRECT_CONFIG;
|
||||
uint32_t FUSE_KFUSE_PRIVKEY_CTRL;
|
||||
uint32_t FUSE_PACKAGE_INFO;
|
||||
uint32_t FUSE_OPT_VENDOR_CODE;
|
||||
uint32_t FUSE_OPT_FAB_CODE;
|
||||
uint32_t FUSE_OPT_LOT_CODE_0;
|
||||
uint32_t FUSE_OPT_LOT_CODE_1;
|
||||
uint32_t FUSE_OPT_WAFER_ID;
|
||||
uint32_t FUSE_OPT_X_COORDINATE;
|
||||
uint32_t FUSE_OPT_Y_COORDINATE;
|
||||
uint32_t FUSE_OPT_SEC_DEBUG_EN;
|
||||
uint32_t FUSE_OPT_OPS_RESERVED;
|
||||
uint32_t _0x224; /* Mariko only. */
|
||||
uint32_t FUSE_GPU_IDDQ_CALIB;
|
||||
uint32_t FUSE_TSENSOR3_CALIB;
|
||||
uint32_t FUSE_CLOCK_BOUNDOUT0;
|
||||
uint32_t FUSE_CLOCK_BOUNDOUT1;
|
||||
uint32_t FUSE_RESERVED_ODM26[0x3]; /* Mariko only. */
|
||||
uint32_t FUSE_OPT_SAMPLE_TYPE;
|
||||
uint32_t FUSE_OPT_SUBREVISION;
|
||||
uint32_t FUSE_OPT_SW_RESERVED_0;
|
||||
uint32_t FUSE_OPT_SW_RESERVED_1;
|
||||
uint32_t FUSE_TSENSOR4_CALIB;
|
||||
uint32_t FUSE_TSENSOR5_CALIB;
|
||||
uint32_t FUSE_TSENSOR6_CALIB;
|
||||
uint32_t FUSE_TSENSOR7_CALIB;
|
||||
uint32_t FUSE_OPT_PRIV_SEC_EN;
|
||||
uint32_t FUSE_BOOT_SECURITY_INFO; /* Mariko only. */
|
||||
uint32_t _0x26C; /* Mariko only. */
|
||||
uint32_t _0x270; /* Mariko only. */
|
||||
uint32_t _0x274; /* Mariko only. */
|
||||
uint32_t _0x278; /* Mariko only. */
|
||||
uint32_t FUSE_FUSE2TSEC_DEBUG_DISABLE;
|
||||
uint32_t FUSE_TSENSOR_COMMON;
|
||||
uint32_t FUSE_OPT_CP_BIN;
|
||||
uint32_t FUSE_OPT_GPU_DISABLE;
|
||||
uint32_t FUSE_OPT_FT_BIN;
|
||||
uint32_t FUSE_OPT_DONE_MAP;
|
||||
uint32_t FUSE_RESERVED_ODM29; /* Mariko only. */
|
||||
uint32_t FUSE_APB2JTAG_DISABLE;
|
||||
uint32_t FUSE_ODM_INFO;
|
||||
uint32_t _0x2A0[0x2];
|
||||
uint32_t FUSE_ARM_CRYPT_DE_FEATURE;
|
||||
uint32_t _0x2AC;
|
||||
uint32_t _0x2B0; /* Mariko only. */
|
||||
uint32_t _0x2B4; /* Mariko only. */
|
||||
uint32_t _0x2B8; /* Mariko only. */
|
||||
uint32_t _0x2BC; /* Mariko only. */
|
||||
uint32_t FUSE_WOA_SKU_FLAG;
|
||||
uint32_t FUSE_ECO_RESERVE_1;
|
||||
uint32_t FUSE_GCPLEX_CONFIG_FUSE;
|
||||
uint32_t FUSE_PRODUCTION_MONTH;
|
||||
uint32_t FUSE_RAM_REPAIR_INDICATOR;
|
||||
uint32_t FUSE_TSENSOR9_CALIB;
|
||||
uint32_t _0x2D8;
|
||||
uint32_t FUSE_VMIN_CALIBRATION;
|
||||
uint32_t FUSE_AGING_SENSOR_CALIBRATION;
|
||||
uint32_t FUSE_DEBUG_AUTHENTICATION;
|
||||
uint32_t FUSE_SECURE_PROVISION_INDEX;
|
||||
uint32_t FUSE_SECURE_PROVISION_INFO;
|
||||
uint32_t FUSE_OPT_GPU_DISABLE_CP1;
|
||||
uint32_t FUSE_SPARE_ENDIS;
|
||||
uint32_t FUSE_ECO_RESERVE_0;
|
||||
uint32_t _0x2FC[0x2];
|
||||
uint32_t FUSE_RESERVED_CALIB0;
|
||||
uint32_t FUSE_RESERVED_CALIB1;
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE;
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE_CP1;
|
||||
uint32_t FUSE_OPT_CPU_DISABLE;
|
||||
uint32_t FUSE_OPT_CPU_DISABLE_CP1;
|
||||
uint32_t FUSE_TSENSOR10_CALIB;
|
||||
uint32_t FUSE_TSENSOR10_CALIB_AUX;
|
||||
uint32_t _0x324; /* Mariko only. */
|
||||
uint32_t _0x328; /* Mariko only. */
|
||||
uint32_t _0x32C; /* Mariko only. */
|
||||
uint32_t _0x330; /* Mariko only. */
|
||||
uint32_t _0x334; /* Mariko only. */
|
||||
uint32_t FUSE_OPT_GPU_TPC0_DISABLE_CP2;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE_CP1;
|
||||
uint32_t FUSE_OPT_GPU_TPC1_DISABLE_CP2;
|
||||
uint32_t FUSE_OPT_CPU_DISABLE_CP2;
|
||||
uint32_t FUSE_OPT_GPU_DISABLE_CP2;
|
||||
uint32_t FUSE_USB_CALIB_EXT;
|
||||
uint32_t FUSE_RESERVED_FIELD;
|
||||
uint32_t _0x358[0x9];
|
||||
uint32_t FUSE_SPARE_REALIGNMENT_REG;
|
||||
uint32_t FUSE_SPARE_BIT[0x1E];
|
||||
} tegra_fuse_chip_mariko_t;
|
||||
|
||||
static inline volatile tegra_fuse_t *fuse_get_regs(void)
|
||||
{
|
||||
return (volatile tegra_fuse_t *)FUSE_BASE;
|
||||
}
|
||||
|
||||
static inline volatile tegra_fuse_chip_t *fuse_chip_get_regs(void)
|
||||
static inline volatile tegra_fuse_chip_common_t *fuse_chip_common_get_regs(void)
|
||||
{
|
||||
return (volatile tegra_fuse_chip_t *)FUSE_CHIP_BASE;
|
||||
return (volatile tegra_fuse_chip_common_t *)FUSE_CHIP_BASE;
|
||||
}
|
||||
|
||||
static inline volatile tegra_fuse_chip_erista_t *fuse_chip_erista_get_regs(void)
|
||||
{
|
||||
return (volatile tegra_fuse_chip_erista_t *)FUSE_CHIP_BASE;
|
||||
}
|
||||
|
||||
static inline volatile tegra_fuse_chip_mariko_t *fuse_chip_mariko_get_regs(void)
|
||||
{
|
||||
return (volatile tegra_fuse_chip_mariko_t *)FUSE_CHIP_BASE;
|
||||
}
|
||||
|
||||
void fuse_init(void);
|
||||
void fuse_disable_programming(void);
|
||||
void fuse_disable_private_key(void);
|
||||
void fuse_enable_power(void);
|
||||
void fuse_disable_power(void);
|
||||
|
||||
uint32_t fuse_get_sku_info(void);
|
||||
uint32_t fuse_get_spare_bit(uint32_t idx);
|
||||
uint32_t fuse_get_reserved_odm(uint32_t idx);
|
||||
uint32_t fuse_get_spare_bit(uint32_t index);
|
||||
uint32_t fuse_get_reserved_odm(uint32_t index);
|
||||
uint32_t fuse_get_bootrom_patch_version(void);
|
||||
uint64_t fuse_get_device_id(void);
|
||||
uint32_t fuse_get_dram_id(void);
|
||||
uint32_t fuse_get_hardware_type(uint32_t target_firmware);
|
||||
uint32_t fuse_get_hardware_type_with_firmware_check(uint32_t target_firmware);
|
||||
uint32_t fuse_get_hardware_type(void);
|
||||
uint32_t fuse_get_retail_type(void);
|
||||
void fuse_get_hardware_info(void *dst);
|
||||
bool fuse_is_new_format(void);
|
||||
uint32_t fuse_get_device_unique_key_generation(void);
|
||||
uint32_t fuse_get_soc_type(void);
|
||||
uint32_t fuse_get_regulator(void);
|
||||
|
||||
uint32_t fuse_hw_read(uint32_t addr);
|
||||
void fuse_hw_write(uint32_t value, uint32_t addr);
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#include "../display/video_fb.h"
|
||||
#include "vsprintf.h"
|
||||
|
||||
/* default log level for screen output */
|
||||
ScreenLogLevel g_screen_log_level = SCREEN_LOG_LEVEL_NONE;
|
||||
|
||||
void log_set_log_level(ScreenLogLevel log_level) {
|
||||
g_screen_log_level = log_level;
|
||||
}
|
||||
|
||||
ScreenLogLevel log_get_log_level() {
|
||||
return g_screen_log_level;
|
||||
}
|
||||
|
||||
void log_to_uart(const char *message) {
|
||||
/* TODO: add UART logging */
|
||||
}
|
||||
|
||||
static void print_to_screen(ScreenLogLevel screen_log_level, char *message) {
|
||||
/* don't print to screen if below log level */
|
||||
if(screen_log_level > g_screen_log_level) return;
|
||||
|
||||
video_puts(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* vprintk - logs a message and prints it to screen based on its screen_log_level
|
||||
*
|
||||
* If the level is below g_screen_log_level it will not be shown but logged to UART
|
||||
* This text will not be colored or prefixed
|
||||
* UART is TODO
|
||||
*/
|
||||
void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args)
|
||||
{
|
||||
char buf[PRINT_MESSAGE_MAX_LENGTH];
|
||||
vsnprintf(buf, PRINT_MESSAGE_MAX_LENGTH, fmt, args);
|
||||
|
||||
/* we don't need that flag here, but if it gets used, strip it so we print correctly */
|
||||
screen_log_level &= ~SCREEN_LOG_LEVEL_NO_PREFIX;
|
||||
|
||||
/* log to UART */
|
||||
log_to_uart(buf);
|
||||
|
||||
print_to_screen(screen_log_level, buf);
|
||||
}
|
||||
|
||||
static void add_prefix(ScreenLogLevel screen_log_level, const char *fmt, char *buf) {
|
||||
char typebuf[] = "[%s] %s";
|
||||
|
||||
/* apply prefix and append message format */
|
||||
/* TODO: add coloring to the output */
|
||||
switch(screen_log_level)
|
||||
{
|
||||
case SCREEN_LOG_LEVEL_ERROR:
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, typebuf, "ERROR", fmt);
|
||||
break;
|
||||
case SCREEN_LOG_LEVEL_WARNING:
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, typebuf, "WARNING", fmt);
|
||||
break;
|
||||
case SCREEN_LOG_LEVEL_MANDATORY:
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, "%s", fmt);
|
||||
break;
|
||||
case SCREEN_LOG_LEVEL_INFO:
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, typebuf, "INFO", fmt);
|
||||
break;
|
||||
case SCREEN_LOG_LEVEL_DEBUG:
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, typebuf, "DEBUG", fmt);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* print - logs a message and prints it to screen based on its screen_log_level
|
||||
*
|
||||
* If the level is below g_screen_log_level it will not be shown but logged to UART
|
||||
* Use SCREEN_LOG_LEVEL_NO_PREFIX if you don't want a prefix to be added
|
||||
* UART is TODO
|
||||
*/
|
||||
void print(ScreenLogLevel screen_log_level, const char * fmt, ...)
|
||||
{
|
||||
char buf[PRINT_MESSAGE_MAX_LENGTH] = {};
|
||||
char message[PRINT_MESSAGE_MAX_LENGTH] = {};
|
||||
|
||||
/* TODO: make splash disappear if level > MANDATORY */
|
||||
|
||||
/* make prefix free messages with log_level possible */
|
||||
if(screen_log_level & SCREEN_LOG_LEVEL_NO_PREFIX) {
|
||||
/* remove the NO_PREFIX flag so the enum can be recognized later on */
|
||||
screen_log_level &= ~SCREEN_LOG_LEVEL_NO_PREFIX;
|
||||
|
||||
snprintf(buf, PRINT_MESSAGE_MAX_LENGTH, "%s", fmt);
|
||||
}
|
||||
else {
|
||||
add_prefix(screen_log_level, fmt, buf);
|
||||
}
|
||||
|
||||
/* input arguments */
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(message, PRINT_MESSAGE_MAX_LENGTH, buf, args);
|
||||
va_end(args);
|
||||
|
||||
/* log to UART */
|
||||
log_to_uart(message);
|
||||
|
||||
print_to_screen(screen_log_level, message);
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef FUSEE_LOG_H
|
||||
#define FUSEE_LOG_H
|
||||
|
||||
#define PRINT_MESSAGE_MAX_LENGTH 1024
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef enum {
|
||||
SCREEN_LOG_LEVEL_NONE = 0,
|
||||
SCREEN_LOG_LEVEL_ERROR = 1,
|
||||
SCREEN_LOG_LEVEL_WARNING = 2,
|
||||
SCREEN_LOG_LEVEL_MANDATORY = 3, /* no log prefix */
|
||||
SCREEN_LOG_LEVEL_INFO = 4,
|
||||
SCREEN_LOG_LEVEL_DEBUG = 5,
|
||||
|
||||
SCREEN_LOG_LEVEL_NO_PREFIX = 0x100 /* OR this to your LOG_LEVEL to prevent prefix creation */
|
||||
} ScreenLogLevel;
|
||||
|
||||
extern ScreenLogLevel g_screen_log_level;
|
||||
|
||||
void log_set_log_level(ScreenLogLevel screen_log_level);
|
||||
ScreenLogLevel log_get_log_level();
|
||||
void log_to_uart(const char *message);
|
||||
void vprint(ScreenLogLevel screen_log_level, const char *fmt, va_list args);
|
||||
void print(ScreenLogLevel screen_log_level, const char* fmt, ...);
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
#include "mtc.h"
|
||||
#include "stage2.h"
|
||||
#include "display/video_fb.h"
|
||||
#include "../../../fusee/common/display/video_fb.h"
|
||||
|
||||
static void *g_framebuffer;
|
||||
static __attribute__((__aligned__(0x200))) stage2_mtc_args_t g_mtc_args_store;
|
||||
|
||||
@@ -497,6 +497,7 @@
|
||||
#define MC_SECURITY_CARVEOUT4_CLIENT_ACCESS0 0xd08
|
||||
#define MC_ERR_APB_ASID_UPDATE_STATUS 0x9d0
|
||||
#define MC_DA_CONFIG0 0x9dc
|
||||
#define MC_UNTRANSLATED_REGION_CHECK 0x948
|
||||
|
||||
/* Memory Controller clients */
|
||||
#define CLIENT_ACCESS_NUM_CLIENTS 32
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "car.h"
|
||||
#include "fuse.h"
|
||||
#include "timers.h"
|
||||
#include "lib/log.h"
|
||||
#include "../../../fusee/common/log.h"
|
||||
|
||||
/*
|
||||
* Macros.
|
||||
@@ -590,9 +590,12 @@ static const uint32_t g_ram_pattern_dmi[0x500] = {
|
||||
0xA, 0x5, 0xC, 0x3, 0xA, 0x5, 0xC, 0x3
|
||||
};
|
||||
|
||||
/*
|
||||
* Register read/write helpers.
|
||||
*/
|
||||
/* Determine the current SoC for Mariko specific code. */
|
||||
static bool is_soc_mariko() {
|
||||
return (fuse_get_soc_type() == 1);
|
||||
}
|
||||
|
||||
/* Register read/write helpers. */
|
||||
static inline void emc_write(uint32_t val, uint32_t offset) {
|
||||
MAKE_EMC_REG(offset) = val;
|
||||
}
|
||||
@@ -664,10 +667,10 @@ static void ccfifo_write(uint32_t ccfifo_addr, uint32_t ccfifo_data, uint32_t cc
|
||||
static void start_periodic_compensation() {
|
||||
uint32_t mpc_req = 0x4B;
|
||||
|
||||
// Write to EMC_MPC_0
|
||||
/* Write to EMC_MPC_0. */
|
||||
emc_write(mpc_req, EMC_MPC);
|
||||
|
||||
// Dummy read
|
||||
/* Dummy read. */
|
||||
mpc_req = emc_read(EMC_MPC);
|
||||
}
|
||||
|
||||
@@ -704,7 +707,7 @@ static uint32_t wait_for_update(uint32_t status_reg, uint32_t bit_mask, bool upd
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
// Timeout
|
||||
/* Timeout. */
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -1114,9 +1117,7 @@ static uint32_t update_clock_tree_delay(tegra_emc_timing_t* current_timing, tegr
|
||||
bool training_update = (type == TRAINING_UPDATE);
|
||||
bool periodic_training_update = (type == PERIODIC_TRAINING_UPDATE);
|
||||
|
||||
/*
|
||||
* Dev0 MSB.
|
||||
*/
|
||||
/* Dev0 MSB. */
|
||||
if (dvfs_pt1 || training_pt1 || periodic_training_update) {
|
||||
mrr_req = ((2 << EMC_MRR_DEV_SEL_SHIFT) | (19 << EMC_MRR_MA_SHIFT));
|
||||
emc_write(mrr_req, EMC_MRR);
|
||||
@@ -1136,9 +1137,7 @@ static uint32_t update_clock_tree_delay(tegra_emc_timing_t* current_timing, tegr
|
||||
temp1_1 = (mrr_data & 0xff00);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dev0 LSB.
|
||||
*/
|
||||
/* Dev0 LSB. */
|
||||
mrr_req = ((mrr_req & ~EMC_MRR_MA_MASK) | (18 << EMC_MRR_MA_SHIFT));
|
||||
emc_write(mrr_req, EMC_MRR);
|
||||
|
||||
@@ -1249,9 +1248,7 @@ static uint32_t update_clock_tree_delay(tegra_emc_timing_t* current_timing, tegr
|
||||
if (dram_dev_num != TWO_RANK)
|
||||
return adel;
|
||||
|
||||
/*
|
||||
* Dev1 MSB.
|
||||
*/
|
||||
/* Dev1 MSB. */
|
||||
if (dvfs_pt1 || training_pt1 || periodic_training_update) {
|
||||
mrr_req = ((1 << EMC_MRR_DEV_SEL_SHIFT) | (19 << EMC_MRR_MA_SHIFT));
|
||||
emc_write(mrr_req, EMC_MRR);
|
||||
@@ -1271,9 +1268,7 @@ static uint32_t update_clock_tree_delay(tegra_emc_timing_t* current_timing, tegr
|
||||
temp1_1 = (mrr_data & 0xff00);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dev1 LSB.
|
||||
*/
|
||||
/* Dev1 LSB. */
|
||||
mrr_req = ((mrr_req & ~EMC_MRR_MA_MASK) | (18 << EMC_MRR_MA_SHIFT));
|
||||
emc_write(mrr_req, EMC_MRR);
|
||||
|
||||
@@ -1454,9 +1449,7 @@ static uint32_t periodic_compensation_handler(tegra_emc_timing_t *current_timing
|
||||
start_periodic_compensation();
|
||||
udelay(delay);
|
||||
|
||||
/*
|
||||
* Generate next sample of data.
|
||||
*/
|
||||
/* Generate next sample of data. */
|
||||
adel = update_clock_tree_delay(current_timing, next_timing, dram_dev_num, channel_mode, DVFS_PT1);
|
||||
}
|
||||
}
|
||||
@@ -1477,9 +1470,7 @@ static uint32_t periodic_compensation_handler(tegra_emc_timing_t *current_timing
|
||||
start_periodic_compensation();
|
||||
udelay(delay);
|
||||
|
||||
/*
|
||||
* Generate next sample of data.
|
||||
*/
|
||||
/* Generate next sample of data. */
|
||||
update_clock_tree_delay(current_timing, next_timing, dram_dev_num, channel_mode, TRAINING_PT1);
|
||||
}
|
||||
|
||||
@@ -3706,7 +3697,7 @@ static int train_one(int z_val, uint32_t next_rate, uint32_t current_rate, tegra
|
||||
return 0;
|
||||
}
|
||||
|
||||
void train_dram(void) {
|
||||
static void train_dram_erista(void) {
|
||||
volatile tegra_car_t *car = car_get_regs();
|
||||
|
||||
tegra_emc_timing_t *timing_tables;
|
||||
@@ -3748,3 +3739,11 @@ void train_dram(void) {
|
||||
|
||||
print(SCREEN_LOG_LEVEL_DEBUG, "[MTC]: Done!\n");
|
||||
}
|
||||
|
||||
void train_dram(void) {
|
||||
if (is_soc_mariko()) {
|
||||
/* TODO */
|
||||
} else {
|
||||
train_dram_erista();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user