PS2SDK
PS2 Homebrew Libraries
sbus_priv.h
1 /*
2 
3 definitions for use inside the PS2 sbus project.
4 
5 */
6 
7 #ifndef __SBUS_PRIV
8 #define __SBUS_PRIV
9 
10 #include <tamtypes.h>
11 #include <ps2_reg_defs.h>
12 
13 #ifdef _EE
14 #define R_LOCAL_SBUS(__reg_no) R_EE_SBUS(__reg_no)
15 #define PS2_SBUS_LR_FLAG PS2_SBUS_MS_FLAG
16 #define PS2_SBUS_RL_FLAG PS2_SBUS_SM_FLAG
17 #else
18 #define R_LOCAL_SBUS(__reg_no) R_IOP_SBUS(__reg_no)
19 #define PS2_SBUS_LR_FLAG PS2_SBUS_SM_FLAG
20 #define PS2_SBUS_RL_FLAG PS2_SBUS_MS_FLAG
21 #endif
22 
23 #ifdef _EE
24 
25 #include <kernel.h>
26 #include <string.h>
27 #include <stdio.h>
28 
29 #ifdef _KMODE
30 #define M_SuspendIntr(__stat_ptr) \
31  do { \
32  (void)__stat_ptr; \
33  } while (0)
34 #define M_ResumeIntr(__stat) \
35  do { \
36  (void)__stat; \
37  } while (0)
38 #else
39 #define M_SuspendIntr(__stat_ptr) \
40  *(int *)(__stat_ptr) = DIntr(); \
41  *(int *)(__stat_ptr) |= ((((ee_kmode_enter() >> 3) & 3) != 0) << 1)
42 #define M_ResumeIntr(__stat) \
43  { \
44  if (__stat & 2) { \
45  ee_kmode_exit(); \
46  } \
47  if (__stat & 1) { \
48  EIntr(); \
49  } \
50  }
51 #endif
52 
53 #define M_DisableIrq(__irq, __stat_ptr) *(int *)(__stat_ptr) = DisableIntc(__irq)
54 #define M_EnableIrq(__irq) EnableIntc(__irq)
55 
56 // TODO: FIX ME!!!
57 #define M_ReleaseIrqHandler(__irq) \
58  do { \
59  } while (0)
60 
61 #define M_RegisterIrqHandler(__irq, __handler, __param) AddIntcHandler((__irq), (__handler), 0)
62 
63 #else
64 // #_IOP
65 
66 #include <intrman.h>
67 #include <sysclib.h>
68 
69 #define M_SuspendIntr(__old_state_ptr) CpuSuspendIntr(__old_state_ptr)
70 #define M_ResumeIntr(__old_state) CpuResumeIntr(__old_state)
71 
72 #define M_DisableIrq(__irq, __old_state_ptr) DisableIntr((__irq), (__old_state_ptr))
73 #define M_EnableIrq(__irq) EnableIntr(__irq)
74 
75 #define M_ReleaseIrqHandler(__irq) ReleaseIntrHandler(__irq)
76 #define M_RegisterIrqHandler(__irq, __handler, __param) RegisterIntrHandler((__irq), 1, (__handler), __param)
77 
78 #endif
79 
80 #define SIF2_MAX_CMD_HANDLERS (32)
81 
82 #define SIF2_XFER_CHUNK_SIZE (128)
83 
84 typedef void (*SIF2_TransferCbFunc)(void);
85 
86 #endif // #ifndef __SBUS_PRIV
kernel.h
sysclib.h
tamtypes.h
stdio.h
ps2_reg_defs.h
intrman.h