SSBM Decomp
Loading...
Searching...
No Matches
OSSerial.h
Go to the documentation of this file.
1#ifndef _DOLPHIN_OSSERIAL_H
2#define _DOLPHIN_OSSERIAL_H
3
4#include <dolphin/hw_regs.h>
5
6#define CHAN_NONE -1
7
8#define SI_MAX_CHAN 4
9
10#define SI_COMCSR_IDX 13
11#define SI_STATUS_IDX 14
12
13#define SI_COMCSR_TCINT_MASK (1 << 31)
14#define SI_COMCSR_TCINTMSK_MASK (1 << 30)
15#define SI_COMCSR_COMERR_MASK (1 << 29)
16#define SI_COMCSR_RDSTINT_MASK (1 << 28)
17#define SI_COMCSR_RDSTINTMSK_MASK (1 << 27)
18// 4 bits of padding
19#define SI_COMCSR_OUTLNGTH_MASK \
20 (1 << 22) | (1 << 21) | (1 << 20) | (1 << 19) | (1 << 18) | (1 << 17) | \
21 (1 << 16)
22// 1 bit of padding
23#define SI_COMCSR_INLNGTH_MASK \
24 (1 << 14) | (1 << 13) | (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | \
25 (1 << 8)
26// 5 bits of padding
27#define SI_COMCSR_CHANNEL_MASK (1 << 2) | (1 << 1)
28#define SI_COMCSR_TSTART_MASK (1 << 0)
29
30typedef void (*SITypeAndStatusCallback)(long chan, unsigned long type);
31
32struct SIControl {
33 long chan;
34 unsigned long poll;
35 unsigned long inputBytes;
36 void* input;
37 void (*callback)(long, unsigned long, struct OSContext*);
38};
39
40struct SIPacket {
41 long chan;
42 void* output;
43 unsigned long outputBytes;
44 void* input;
45 unsigned long inputBytes;
46 void (*callback)(long, unsigned long, struct OSContext*);
47 long long time;
48};
49
50int SIBusy();
54void SIInit();
55unsigned long SISync();
56unsigned long SIGetStatus(int);
57void SISetCommand(long chan, unsigned long command);
58unsigned long SIGetCommand(long chan);
60unsigned long SISetXY(unsigned long x, unsigned long y);
61unsigned long SIEnablePolling(unsigned long poll);
62unsigned long SIDisablePolling(unsigned long poll);
63int SIGetResponse(long chan, void* data);
64int SITransfer(long chan, void* output, unsigned long outputBytes, void* input,
65 unsigned long inputBytes,
66 void (*callback)(long, unsigned long, struct OSContext*),
67 OSTime delay);
68unsigned long SIGetType(long chan);
70
71#endif // _DOLPHIN_OSSERIAL_H
void SITransferCommands()
void SIInit()
unsigned long SIGetStatus(int)
BOOL SIUnregisterPollingHandler(__OSInterruptHandler)
void(* SITypeAndStatusCallback)(long chan, unsigned long type)
Definition OSSerial.h:30
unsigned long SISetXY(unsigned long x, unsigned long y)
void SISetCommand(long chan, unsigned long command)
BOOL SIIsChanBusy(int chan)
unsigned long SIDisablePolling(unsigned long poll)
unsigned long SIGetCommand(long chan)
int SIBusy()
BOOL SIRegisterPollingHandler(__OSInterruptHandler)
unsigned long SIGetTypeAsync(long chan, SITypeAndStatusCallback callback)
int SITransfer(long chan, void *output, unsigned long outputBytes, void *input, unsigned long inputBytes, void(*callback)(long, unsigned long, struct OSContext *), OSTime delay)
unsigned long SISync()
unsigned long SIGetType(long chan)
unsigned long SIEnablePolling(unsigned long poll)
int SIGetResponse(long chan, void *data)
int BOOL
Definition types.h:20
static void callback(HSD_GObj *gobj)
Definition ftDk_SpecialLw.c:90
void(* __OSInterruptHandler)(__OSInterrupt interrupt, OSContext *context)
Definition os.h:18
s64 OSTime
Definition os.h:10
Definition OSContext.h:138
Definition OSSerial.h:32
void(* callback)(long, unsigned long, struct OSContext *)
Definition OSSerial.h:37
void * input
Definition OSSerial.h:36
unsigned long inputBytes
Definition OSSerial.h:35
long chan
Definition OSSerial.h:33
unsigned long poll
Definition OSSerial.h:34
Definition OSSerial.h:40
void * input
Definition OSSerial.h:44
void(* callback)(long, unsigned long, struct OSContext *)
Definition OSSerial.h:46
unsigned long inputBytes
Definition OSSerial.h:45
long long time
Definition OSSerial.h:47
unsigned long outputBytes
Definition OSSerial.h:43
void * output
Definition OSSerial.h:42
long chan
Definition OSSerial.h:41