libdragon
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables

N64 System Interface. More...

Go to the source code of this file.

Data Structures

struct  heap_stats_t
 Heap statistics. More...
 

Macros

#define RCP_FREQUENCY   (__boot_consoletype ? 96000000 : 62500000)
 Frequency of the RCP.
 
#define CPU_FREQUENCY   (__boot_consoletype ? 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 PhysicalAddr(_addr)
 Return the physical memory address for a given virtual address (pointer)
 
#define VirtualCachedAddr(_addr)   ((void *)(((unsigned long)(_addr))|0x80000000))
 Create a virtual addresses in a cached segment to access a physical address.
 
#define VirtualUncachedAddr(_addr)   ((void *)(((unsigned long)(_addr))|0xA0000000))
 Create a virtual addresses in an uncached segment to access a physical address.
 
#define UncachedAddr(_addr)   ((void *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given virtual address.
 
#define UncachedShortAddr(_addr)   ((short *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address.
 
#define UncachedUShortAddr(_addr)   ((unsigned short *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address.
 
#define UncachedLongAddr(_addr)   ((long *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address.
 
#define UncachedULongAddr(_addr)   ((unsigned long *)(((unsigned long)(_addr))|0x20000000))
 Return the uncached memory address for a given address.
 
#define CachedAddr(_addr)   ((void *)(((unsigned long)(_addr))&~0x20000000))
 Return the cached memory address for a given address.
 
#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.
 
#define TICKS_READ()   C0_COUNT()
 Returns the 32-bit hardware tick counter.
 
#define TICKS_PER_SECOND   (CPU_FREQUENCY/2)
 Number of updates to the count register per second.
 
#define TICKS_DISTANCE(from, to)   ((int32_t)((uint32_t)(to) - (uint32_t)(from)))
 Calculate the time passed between two ticks.
 
#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".
 
#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.
 

Typedefs

typedef uint32_t phys_addr_t
 A physical address on the MIPS bus.
 

Enumerations

enum  tv_type_t { TV_PAL = 0 , TV_NTSC = 1 , TV_MPAL = 2 }
 Type of TV video output. More...
 
enum  reset_type_t { RESET_COLD = 0 , RESET_WARM = 1 }
 Reset types. More...
 

Functions

bool sys_bbplayer (void)
 Return true if we are running on a iQue player.
 
uint64_t get_ticks (void)
 Read the number of ticks since system startup.
 
uint64_t get_ticks_us (void)
 Read the number of microseconds since system startup.
 
uint64_t get_ticks_ms (void)
 Read the number of millisecounds since system startup.
 
void wait_ticks (unsigned long wait)
 Spin wait until the number of ticks have elapsed.
 
void wait_ms (unsigned long wait_ms)
 Spin wait until the number of milliseconds have elapsed.
 
void die (void)
 Force a complete halt of all processors.
 
void data_cache_hit_invalidate (volatile void *addr, unsigned long length)
 Force a data cache invalidate over a memory region.
 
void data_cache_hit_writeback (volatile const void *, unsigned long)
 Force a data cache writeback over a memory region.
 
void data_cache_hit_writeback_invalidate (volatile void *, unsigned long)
 Force a data cache writeback invalidate over a memory region.
 
void data_cache_index_writeback_invalidate (volatile void *, unsigned long)
 Force a data cache index writeback invalidate over a memory region.
 
void data_cache_writeback_invalidate_all (void)
 Force a data cache writeback invalidate over whole memory.
 
void inst_cache_hit_writeback (volatile const void *, unsigned long)
 Force an instruction cache writeback over a memory region.
 
void inst_cache_hit_invalidate (volatile void *, unsigned long)
 Force an instruction cache invalidate over a memory region.
 
void inst_cache_index_invalidate (volatile void *, unsigned long)
 Force an instruction cache index invalidate over a memory region.
 
void inst_cache_invalidate_all (void)
 Force an instruction cache invalidate over whole memory.
 
int get_memory_size (void)
 Get amount of available memory.
 
bool is_memory_expanded (void)
 Is expansion pak in use.
 
void assert_memory_expanded (void)
 Assert that the expansion pak is present.
 
void sys_get_heap_stats (heap_stats_t *stats)
 Return information about memory usage of the heap.
 
void * malloc_uncached (size_t size)
 Allocate a buffer that will be accessed as uncached memory.
 
void * malloc_uncached_aligned (int align, size_t size)
 Allocate a buffer that will be accessed as uncached memory, specifying alignment.
 
void free_uncached (void *buf)
 Free an uncached memory buffer.
 
tv_type_t get_tv_type (void)
 Is system NTSC/PAL/MPAL.
 
reset_type_t sys_reset_type (void)
 Get reset type.
 

Variables

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.

Author
Jennifer Taylor drago.nosp@m.nmin.nosp@m.ded@d.nosp@m.rago.nosp@m.nmind.nosp@m.ed.c.nosp@m.om
Giovanni Bajo giova.nosp@m.nnib.nosp@m.ajo@g.nosp@m.mail.nosp@m..com
thekovic https://github.com/thekovic