Line 47:
Line 47:
== Detailed Description ==
== Detailed Description ==
−
/dev/net/kd/time is used to get and set utc and rtc offsets. this is used by things like nwc24's scheduler and the module handles reading and editing of /shared2/nwc24/misc.bin
+
/dev/net/kd/time is used to get and set utc and rtc offsets. this is used by things like nwc24's scheduler and the module handles reading and editing of /shared2/wc24/misc.bin
=== KD_GetUTCTime ===
=== KD_GetUTCTime ===
−
<nowiki>
no inbuffer
no inbuffer
+
outbuffer must be >= 0xC bytes and must be 0x4 aligned
outbuffer must be >= 0xC bytes and must be 0x4 aligned
+
if outbuffer is not >= 0xC bytes or outbuffer == NULL the IOS_Ioctl will return -4, else it returns 0
if outbuffer is not >= 0xC bytes or outbuffer == NULL the IOS_Ioctl will return -4, else it returns 0
+
checks if a word is set in the module's memory that indicates the Universal time is ready and returns -30 in outbuffer->retval if not
checks if a word is set in the module's memory that indicates the Universal time is ready and returns -30 in outbuffer->retval if not
+
outbuffer->time is set to the stored utc otherwise
outbuffer->time is set to the stored utc otherwise
−
</nowiki>
=== KD_SetUTCTime ===
=== KD_SetUTCTime ===
−
<nowiki>
inbuffer must be >= 0xC bytes and must be 0x4 aligned
inbuffer must be >= 0xC bytes and must be 0x4 aligned
+
outbuffer must be >= 0x4 bytes and must be 0x4 aligned
outbuffer must be >= 0x4 bytes and must be 0x4 aligned
+
if outbuffer or inbuffer is NULL or are not aligned the IOS_Ioctl will return -4, else it returns 0
if outbuffer or inbuffer is NULL or are not aligned the IOS_Ioctl will return -4, else it returns 0
+
struct inbuffer { u64 utc, u32 other_value };
struct inbuffer { u64 utc, u32 other_value };
+
checks that 0x30df3b00 <= utc <= 0xdfaef080 else it sets outbuffer->retval to -3
checks that 0x30df3b00 <= utc <= 0xdfaef080 else it sets outbuffer->retval to -3
+
if utc is ok, it sets the module's struct containing the utc and the other_value
if utc is ok, it sets the module's struct containing the utc and the other_value
−
</nowiki>
=== Undefined ===
=== Undefined ===
−
<nowiki>
no buffers checked
no buffers checked
+
always returns -9 from IOS_Ioctl
always returns -9 from IOS_Ioctl
−
</nowiki>
=== NWC24iSetRtcCounter ===
=== NWC24iSetRtcCounter ===
−
<nowiki>
inbuffer must be >= 0x8 bytes and must be 0x4 aligned
inbuffer must be >= 0x8 bytes and must be 0x4 aligned
+
outbuffer must be >= 0x4 bytes and must be 0x4 aligned
outbuffer must be >= 0x4 bytes and must be 0x4 aligned
+
if outbuffer or inbuffer is NULL or not aligned the IOS_Ioctl will return -4, else it returns 0
if outbuffer or inbuffer is NULL or not aligned the IOS_Ioctl will return -4, else it returns 0
+
struct inbuffer { u32 rtc_value, u32 other_value };
struct inbuffer { u32 rtc_value, u32 other_value };
+
other_value is checked for the lowest bit to be either 0 or 1 which sets a word in memory
other_value is checked for the lowest bit to be either 0 or 1 which sets a word in memory
−
this function messes with the /shared2/nwc24/misc.bin file and by reading and writing utc data to/from it
+
+
this function messes with the /shared2/wc24/misc.bin file and by reading and writing utc data to/from it
+
it also sets utc when it needs to be synchronized due to offset
it also sets utc when it needs to be synchronized due to offset
+
outbuffer->retval will always hold 0 if the IOS_Ioctl doesn't return -4
outbuffer->retval will always hold 0 if the IOS_Ioctl doesn't return -4
−
</nowiki>
=== NWC24iGetTimeDifference ===
=== NWC24iGetTimeDifference ===
−
<nowiki>inbuffer is not checked
+
inbuffer is not checked
+
outbuffer must be >= 0xC bytes and must be 0x4 aligned
outbuffer must be >= 0xC bytes and must be 0x4 aligned
+
if outbuffer is NULL or not aligned the IOS_Ioctl will return -4
if outbuffer is NULL or not aligned the IOS_Ioctl will return -4
+
if the module's memory indicates no time difference the IOS_Ioctl will return -30
if the module's memory indicates no time difference the IOS_Ioctl will return -30
+
else it returns 0
else it returns 0
+
outbuffer->retval could hold the outbuffer address & 3 if:
outbuffer->retval could hold the outbuffer address & 3 if:
+
a) it wasn't doing a 32bit write to an unaligned address
a) it wasn't doing a 32bit write to an unaligned address
+
b) it didn't jump to return -4 from the Ioctl when it was unaligned
b) it didn't jump to return -4 from the Ioctl when it was unaligned
+
so it'll always hold 0
so it'll always hold 0
−
outbuffer->time will hold the timedifference</nowiki>
+
+
outbuffer->time will hold the timedifference
+
+
[[Category:Wii Filesystem]]