Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
dma-priority.c File Reference
#include <stdint.h>
#include "common/hardware/dma.h"
#include "common/hardware/hwregs.h"
#include "common/syscalls/syscalls.h"
Include dependency graph for dma-priority.c:

Classes

struct  DmaResult
 
struct  CpuRow
 

Macros

#define T2_VALUE   (*(volatile uint32_t *)0xbf801120)
 
#define T2_MODE   (*(volatile uint32_t *)0xbf801124)
 
#define BUSY   0x01000000u
 
#define DPCR_BASE   0x07654321u
 
#define NWORDS   1024
 
#define FILLWORD   0x001f001fu
 
#define POISON   0xdeadbeefu
 
#define DEF_RACE(N)
 

Typedefs

typedef uint32_t(* workFn) (volatile uint32_t *)
 
typedef void(* raceFn) (volatile uint32_t *, uint32_t, volatile uint32_t *, uint32_t *)
 

Enumerations

enum  {
  M_BURST6 , M_BURST6_ALU , M_BURST6_SPAD , M_CHOP6 ,
  M_SYNC1_2 , M_COUNT , M_SYNC0_2
}
 

Functions

int main (void)
 

Macro Definition Documentation

◆ BUSY

#define BUSY   0x01000000u

◆ DEF_RACE

#define DEF_RACE (   N)
Value:
static __attribute__((noinline)) void race##N(volatile uint32_t *chcr, uint32_t v, \
volatile uint32_t *p, uint32_t *out) { \
uint32_t t0, t1, t2; \
__asm__ volatile(".set push\n.set noreorder\n" \
"lw %0, 0(%3)\n" \
"sw %5, 0(%4)\n" \
".rept " #N "\nnop\n.endr\n" \
"lw %1, 0(%3)\n" \
".rept 256\nlw $t8, 0(%6)\n.endr\n" \
"lw %2, 0(%3)\n" \
".set pop\n" \
: "=&r"(t0), "=&r"(t1), "=&r"(t2) \
: "r"(&T2_VALUE), "r"(chcr), "r"(v), "r"(p) \
: "t8", "memory"); \
out[0] = (t1 - t0) & 0xffff; \
out[1] = (t2 - t1) & 0xffff; \
out[2] = t0; \
}
__attribute__((weak))
Definition clz.c:56
uint32_t out
Definition cpu.c:62
#define T2_VALUE
Definition dma-priority.c:58
uint32_t chcr
Definition dma.c:131
#define N
Definition main.c:37
__asm__(" .section .text.monitorSlotEntry, \"ax\", @progbits\n" " .align 2\n" " .global monitorSlotEntry\n" " .type monitorSlotEntry, @function\n" " .set push\n" " .set noreorder\n" " .set noat\n" "monitorSlotEntry:\n" " mfc0 $v0, $13\n" " nop\n" " andi $v0, $v0, 0x7c\n" " beqz $v0, 1f\n" " srl $v0, $v0, 2\n" " li $v1, " MON_STR(MON_SLOT_EXCMASK) "\n" " srlv $v1, $v1, $v0\n" " andi $v1, $v1, 1\n" " bnez $v1, 2f\n" " nop\n" " jr $ra\n" " nop\n" "1:\n" MON_SLOT_RX_TEST " jr $ra\n" " nop\n" "2:\n" " sw $a0, 0x10($k0)\n" " sw $a1, 0x14($k0)\n" " sw $a2, 0x18($k0)\n" " sw $a3, 0x1c($k0)\n" " mfc0 $a0, $12\n" " nop\n" " sw $a0, 0x8c($k0)\n" " mfc0 $a1, $13\n" " nop\n" " sw $a1, 0x90($k0)\n" " sw $k1, 0x6c($k0)\n" " sw $s0, 0x40($k0)\n" " sw $s1, 0x44($k0)\n" " sw $s2, 0x48($k0)\n" " sw $s3, 0x4c($k0)\n" " sw $s4, 0x50($k0)\n" " sw $s5, 0x54($k0)\n" " sw $s6, 0x58($k0)\n" " sw $s7, 0x5c($k0)\n" " sw $t0, 0x20($k0)\n" " sw $t1, 0x24($k0)\n" " sw $t2, 0x28($k0)\n" " sw $t3, 0x2c($k0)\n" " sw $t4, 0x30($k0)\n" " sw $t5, 0x34($k0)\n" " sw $t6, 0x38($k0)\n" " sw $t7, 0x3c($k0)\n" " sw $t8, 0x60($k0)\n" " sw $t9, 0x64($k0)\n" " sw $gp, 0x70($k0)\n" " sw $sp, 0x74($k0)\n" " sw $fp, 0x78($k0)\n" " mfhi $a0\n" " nop\n" " sw $a0, 0x84($k0)\n" " mflo $a0\n" " nop\n" " sw $a0, 0x88($k0)\n" " move $s0, $ra\n" " la $sp, monitorSlotStack + " MON_STR(MONITOR_SLOT_STACK_WORDS) " * 4 - 16\n" " jal monitorSlotDispatch\n" " nop\n" " lw $k0, 0x108($zero)\n" " move $ra, $s0\n" " lw $k0, 0($k0)\n" " nop\n" " addiu $k0, $k0, 8\n" " lw $a0, 0x84($k0)\n" " lw $a1, 0x88($k0)\n" " mthi $a0\n" " mtlo $a1\n" " lw $a0, 0x10($k0)\n" " lw $a1, 0x14($k0)\n" " lw $a2, 0x18($k0)\n" " lw $a3, 0x1c($k0)\n" " lw $t0, 0x20($k0)\n" " lw $t1, 0x24($k0)\n" " lw $t2, 0x28($k0)\n" " lw $t3, 0x2c($k0)\n" " lw $t4, 0x30($k0)\n" " lw $t5, 0x34($k0)\n" " lw $t6, 0x38($k0)\n" " lw $t7, 0x3c($k0)\n" " lw $t8, 0x60($k0)\n" " lw $t9, 0x64($k0)\n" " lw $s0, 0x40($k0)\n" " lw $sp, 0x74($k0)\n" " jr $ra\n" " nop\n" " .set pop\n" " .size monitorSlotEntry, . - monitorSlotEntry\n" " .previous\n")
void uint32_t(classId, spec)

◆ DPCR_BASE

#define DPCR_BASE   0x07654321u

◆ FILLWORD

#define FILLWORD   0x001f001fu

◆ NWORDS

#define NWORDS   1024

◆ POISON

#define POISON   0xdeadbeefu

◆ T2_MODE

#define T2_MODE   (*(volatile uint32_t *)0xbf801124)

◆ T2_VALUE

#define T2_VALUE   (*(volatile uint32_t *)0xbf801120)

Typedef Documentation

◆ raceFn

typedef void(* raceFn) (volatile uint32_t *, uint32_t, volatile uint32_t *, uint32_t *)

◆ workFn

typedef uint32_t(* workFn) (volatile uint32_t *)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M_BURST6 
M_BURST6_ALU 
M_BURST6_SPAD 
M_CHOP6 
M_SYNC1_2 
M_COUNT 
M_SYNC0_2 

Function Documentation

◆ main()

int main ( void  )