1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 12:54:51 +00:00
oot/include/ultra64/convert.h
Tharo c8f4d66b00
Documentation for fault.c and fault_drawer.c (#1106)
* Mostly document fault and fault_drawer

* FaultDrawer printf functions return s32

* Review Suggestions for comments

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>

* Some further review suggestions

* Further changes from suggestions

* Fix Fault_AddClient doc comment

* Bug comment for memdump overrun, add more to Fault_PadCallback bug comment

* mb -> MB, comment about bss above externs

* Fix color codes

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
2022-02-02 16:43:34 -05:00

21 lines
859 B
C

#ifndef ULTRA64_CONVERT_H
#define ULTRA64_CONVERT_H
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL))
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL))
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL))
#define OS_K0_TO_PHYSICAL(x) (u32)(((char*)(x)-0x80000000))
#define OS_K1_TO_PHYSICAL(x) (u32)(((char*)(x)-0xA0000000))
#define OS_PHYSICAL_TO_K0(x) (void*)(((u32)(x)+0x80000000))
#define OS_PHYSICAL_TO_K1(x) (void*)(((u32)(x)+0xA0000000))
#define OS_SEC_TO_CYCLES(n) OS_USEC_TO_CYCLES((n) * 1000 * 1000)
#endif