libdragon
Macros | Enumerations | Functions | Variables

N64 System Interface. More...

Go to the source code of this file.

Macros

#define RCP_FREQUENCY   (__bbplayer ? 96000000 : 62500000)
 Frequency of the RCP.
 
#define CPU_FREQUENCY   (__bbplayer ? 144000000 : 93750000)
 Frequency of the MIPS R4300 CPU.
 
#define KSEG0_START_ADDR   ((void*)0x80000000)
 void pointer to cached and non-mapped memory start address
 
#define UncachedAddr(_addr)   ((void *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address. More...
 
#define UncachedShortAddr(_addr)   ((short *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address. More...
 
#define UncachedUShortAddr(_addr)   ((unsigned short *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address. More...
 
#define UncachedLongAddr(_addr)   ((long *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address. More...
 
#define UncachedULongAddr(_addr)   ((unsigned long *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address. More...
 
#define CachedAddr(_addr)   ((void *)(((unsigned long)(_addr))&~0x20000000))
 Return the cached memory address for a given address. More...
 
#define PhysicalAddr(_addr)
 Return the physical memory address for a given address. More...
 
#define HEAP_START_ADDR   ((void*)__bss_end)
 Void pointer to the start of heap memory.
 
#define MEMORY_BARRIER()   asm volatile ("" : : : "memory")
 Memory barrier to ensure in-order execution. More...
 
#define TICKS_READ()   C0_COUNT()
 Returns the 32-bit hardware tick counter. More...
 
#define TICKS_PER_SECOND   (CPU_FREQUENCY/2)
 Number of updates to the count register per second. More...
 
#define TICKS_DISTANCE(from, to)   ((int32_t)((uint32_t)(to) - (uint32_t)(from)))
 Calculate the time passed between two ticks. More...
 
#define TICKS_SINCE(t0)   TICKS_DISTANCE(t0, TICKS_READ())
 Return how much time has passed since the instant t0.
 
#define TICKS_BEFORE(t1, t2)   ({ TICKS_DISTANCE(t1, t2) > 0; })
 Returns true if "t1" is before "t2". More...
 
#define TICKS_FROM_MS(val)   (((val) * (TICKS_PER_SECOND / 1000)))
 Returns equivalent count ticks for the given milliseconds.
 
#define TICKS_FROM_US(val)   (((val) * (8 * TICKS_PER_SECOND / 1000000) / 8))
 Returns equivalent count ticks for the given microseconds.
 
#define TICKS_TO_US(val)   (((val) * 8 / (8 * TICKS_PER_SECOND / 1000000)))
 Returns equivalent count ticks for the given microseconds.
 
#define TICKS_TO_MS(val)   (((val) / (TICKS_PER_SECOND / 1000)))
 Returns equivalent count ticks for the given microseconds.
 
#define data_cache_hit_invalidate(addr_, sz_)
 Force a data cache invalidate over a memory region. More...
 

Enumerations

enum  tv_type_t { TV_PAL = 0 , TV_NTSC = 1 , TV_MPAL = 2 }
 Type of TV video output. More...
 

Functions

bool sys_bbplayer (void)
 Return true if we are running on a iQue player.
 
int sys_get_boot_cic ()
 Return the boot CIC. More...
 
void sys_set_boot_cic (int bc)
 Set the boot CIC. More...
 
uint64_t get_ticks (void)
 Read the number of ticks since system startup. More...
 
uint64_t get_ticks_us (void)
 Read the number of microseconds since system startup. More...
 
uint64_t get_ticks_ms (void)
 Read the number of millisecounds since system startup. More...
 
void wait_ticks (unsigned long wait)
 Spin wait until the number of ticks have elapsed. More...
 
void wait_ms (unsigned long wait_ms)
 Spin wait until the number of milliseconds have elapsed. More...
 
void __data_cache_hit_invalidate (volatile void *addr, unsigned long length)
 Underlying implementation of data_cache_hit_invalidate.
 
void data_cache_hit_writeback (volatile const void *addr, unsigned long length)
 Force a data cache writeback over a memory region. More...
 
void data_cache_hit_writeback_invalidate (volatile void *addr, unsigned long length)
 Force a data cache writeback invalidate over a memory region. More...
 
void data_cache_index_writeback_invalidate (volatile void *addr, unsigned long length)
 Force a data cache index writeback invalidate over a memory region. More...
 
void data_cache_writeback_invalidate_all (void)
 Force a data cache writeback invalidate over whole memory. More...
 
void inst_cache_hit_writeback (volatile const void *addr, unsigned long length)
 Force an instruction cache writeback over a memory region. More...
 
void inst_cache_hit_invalidate (volatile void *addr, unsigned long length)
 Force an instruction cache invalidate over a memory region. More...
 
void inst_cache_index_invalidate (volatile void *addr, unsigned long length)
 Force an instruction cache index invalidate over a memory region. More...
 
void inst_cache_invalidate_all (void)
 Force an instruction cache invalidate over whole memory. More...
 
int get_memory_size ()
 Get amount of available memory. More...
 
bool is_memory_expanded ()
 Is expansion pak in use. More...
 
void * malloc_uncached (size_t size)
 Allocate a buffer that will be accessed as uncached memory. More...
 
void * malloc_uncached_aligned (int align, size_t size)
 Allocate a buffer that will be accessed as uncached memory, specifying alignment. More...
 
void free_uncached (void *buf)
 Free an uncached memory buffer. More...
 
tv_type_t get_tv_type ()
 Is system NTSC/PAL/MPAL. More...
 

Variables

int __bbplayer
 Indicates whether we are running on a vanilla N64 or a iQue player.
 
char __libdragon_text_start []
 Symbol at the start of code (start of ROM contents after header)
 
char __rom_end []
 Symbol at the end of code, data, and sdata (set by the linker)
 
char __bss_end []
 Symbol at the end of code, data, sdata, and bss (set by the linker)
 

Detailed Description

N64 System Interface.