MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / CompleteTransfer

Function CompleteTransfer

src/dolphin/src/si/SIBios.c:85–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85static u32 CompleteTransfer()
86{
87 u32 sr;
88 u32 i;
89 u32 rLen;
90 u8* input;
91
92 sr = __SIRegs[14];
93
94 SIClearTCInterrupt();
95
96 if (Si.chan != -1)
97 {
98 XferTime[Si.chan] = __OSGetSystemTime();
99
100 input = Si.input;
101
102 rLen = Si.inputBytes / 4;
103 for (i = 0; i < rLen; i++)
104 {
105 *(u32*)input = __SIRegs[32 + i];
106 input += 4;
107 }
108
109 rLen = Si.inputBytes & 3;
110 if (rLen)
111 {
112 u32 temp = __SIRegs[32 + i];
113 for (i = 0; i < rLen; i++)
114 {
115 *input++ = (u8)((temp >> ((3 - i) * 8)) & 0xff);
116 }
117 }
118
119 if (__SIRegs[13] & 0x20000000)
120 {
121 sr >>= 8 * (3 - Si.chan);
122 sr &= 0xf;
123
124 if ((sr & SI_ERROR_NO_RESPONSE) && !(Type[Si.chan] & SI_ERROR_BUSY))
125 {
126 Type[Si.chan] = SI_ERROR_NO_RESPONSE;
127 }
128 if (sr == 0)
129 {
130 sr = SI_ERROR_COLLISION;
131 }
132 }
133 else
134 {
135 TypeTime[Si.chan] = __OSGetSystemTime();
136 sr = 0;
137 }
138
139 Si.chan = -1;
140 }
141 return sr;
142}

Callers 1

SIInterruptHandlerFunction · 0.70

Calls 1

SIClearTCInterruptFunction · 0.85

Tested by

no test coverage detected