mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-24 07:10:44 -04:00
c72b5788a3
* OK, data imported, document * spec * Match cosf, document sinf and cosf * Some more documentation, switch fu back * Format * Little more documentation * Document coss too * Move macros * Review, add some .s * Fix headers, review
27 lines
935 B
C
27 lines
935 B
C
#ifndef _ULTRA64_CONVERT_H_
|
|
#define _ULTRA64_CONVERT_H_
|
|
|
|
#include "stdint.h"
|
|
|
|
#define OS_CLOCK_RATE 62500000LL
|
|
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
|
|
|
|
/* Macros */
|
|
#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))
|
|
|
|
/* Functions */
|
|
|
|
extern uintptr_t osVirtualToPhysical(void*);
|
|
extern void* osPhysicalToVirtual(uintptr_t);
|
|
|
|
#endif
|