26 #define MIN(a,b) ((a) <= (b)) ? (a) : (b)
29 static struct t_SifRpcClientData
cd0;
30 static unsigned int sbuff[4096] __attribute__((aligned (64)));
31 static struct t_SifRpcDataQueue
cb_queue;
32 static struct t_SifRpcServerData
cb_srv;
51 0x0000, 0x0096, 0x0190, 0x0230, 0x0320,
52 0x042E, 0x0532, 0x05FA, 0x06C2, 0x088E,
53 0x09F6, 0x0BC2, 0x0DC0, 0x0FF0, 0x118A,
54 0x1482, 0x1752, 0x1B4E, 0x1F40, 0x2378,
55 0x28D2, 0x2EFE, 0x34F8, 0x3A5C, 0x3FFF
230 int copy, maxcopy, copied;
235 maxcopy =
sizeof(
sbuff) -
sizeof(
int);
240 copy =
MIN(bytes, maxcopy);
242 memcpy(&
sbuff[1], chunk, copy);
243 packet_size = copy +
sizeof(int);
256 chunk = chunk + copy;
257 bytes = bytes - copy;
258 sent = sent + copied;
289 static unsigned char cb_rpc_buffer[64] __attribute__((aligned(64)));
308 memset(&
cd0,
'\0',
sizeof(
cd0));
394 sifdma.
dest = iop_addr;
399 while((
id =
SifSetDma(&sifdma, 1)) == 0);
404 sbuff[0] = (int)iop_addr;
406 sbuff[2] = (int)adpcm;
446 return "Not initialized";
449 return "Out of IOP memory";
452 return "RPC operation failed";
455 return "Format not supported";
458 return "No disc in drive";
461 return "Unknown error";
#define AUDSRV_ERR_FORMAT_NOT_SUPPORTED
#define AUDSRV_ERR_OUT_OF_MEMORY
#define AUDSRV_ERR_NOT_INITIALIZED
#define AUDSRV_ERR_FAILED_TO_CREATE_SEMA
#define AUDSRV_ERR_NOERROR
#define AUDSRV_ERR_RPC_FAILED
#define AUDSRV_ERR_NO_DISC
int(* audsrv_callback_t)(void *arg)
int audsrv_play_sectors(int start, int end)
static struct t_SifRpcClientData cd0
int audsrv_get_numtracks()
static int call_rpc_2(int func, int arg1, int arg2)
static void * on_cdda_stop_arg
static void rpc_server_thread(void *arg)
static void * on_fillbuf_arg
const char * audsrv_get_error_string()
int audsrv_adpcm_set_volume(int ch, int volume)
static void * audsrv_ee_rpc_handler(int fnum, void *buffer, int len)
static audsrv_callback_t on_fillbuf
static int call_rpc_1(int func, int arg)
static int completion_sema
int audsrv_play_audio(const char *chunk, int bytes)
int audsrv_on_cdda_stop(audsrv_callback_t cb, void *arg)
static unsigned char rpc_server_stack[0x1800]
int audsrv_ch_play_adpcm(int ch, audsrv_adpcm_t *adpcm)
int audsrv_play_cd(int track)
static int rpc_server_thread_id
int audsrv_get_trackpos()
int audsrv_load_adpcm(audsrv_adpcm_t *adpcm, void *buffer, int size)
static audsrv_callback_t on_cdda_stop
static struct t_SifRpcServerData cb_srv
static struct t_SifRpcDataQueue cb_queue
int audsrv_set_volume(int volume)
static unsigned int sbuff[4096]
int audsrv_on_fillbuf(int amount, audsrv_callback_t cb, void *arg)
int audsrv_wait_audio(int bytes)
static const unsigned short vol_values[26]
static void set_error(int err)
int audsrv_get_track_offset(int track)
int audsrv_set_format(struct audsrv_fmt_t *fmt)
int audsrv_get_cd_status()
#define AUDSRV_WAIT_AUDIO
#define AUDSRV_SET_FORMAT
#define AUDSRV_SET_THRESHOLD
#define AUDSRV_STOP_AUDIO
#define AUDSRV_GET_NUMTRACKS
#define AUDSRV_GET_CD_STATUS
#define AUDSRV_GET_TRACKPOS
#define AUDSRV_PLAY_ADPCM
#define AUDSRV_LOAD_ADPCM
#define AUDSRV_GET_CD_TYPE
#define AUDSRV_ADPCM_SET_VOLUME
#define AUDSRV_CDDA_CALLBACK
#define AUDSRV_PLAY_SECTORS
#define AUDSRV_SET_VOLUME
#define AUDSRV_INIT_ADPCM
#define AUDSRV_FILLBUF_CALLBACK
#define AUDSRV_GET_TRACKOFFSET
#define AUDSRV_PLAY_AUDIO
void * SifAllocIopHeap(int size)
int SifFreeIopHeap(void *addr)
s32 CreateSema(ee_sema_t *sema)
s32 SignalSema(s32 sema_id)
s32 DeleteSema(s32 sema_id)
u32 SifSetDma(SifDmaTransfer_t *sdd, s32 len)
static void nopdelay(void)
s32 CreateThread(ee_thread_t *thread)
s32 WaitSema(s32 sema_id)
s32 StartThread(s32 thread_id, void *args)
s32 TerminateThread(s32 thread_id)
s32 DeleteThread(s32 thread_id)
SifRpcServerData_t * SifRegisterRpc(SifRpcServerData_t *srv, int sid, SifRpcFunc_t func, void *buff, SifRpcFunc_t cfunc, void *cbuff, SifRpcDataQueue_t *qd)
SifRpcDataQueue_t * SifSetRpcQueue(SifRpcDataQueue_t *q, int thread_id)
SifRpcServerData_t * SifRemoveRpc(SifRpcServerData_t *sd, SifRpcDataQueue_t *queue)
void SifRpcLoop(SifRpcDataQueue_t *q)
SifRpcDataQueue_t * SifRemoveRpcQueue(SifRpcDataQueue_t *qd)
int SifBindRpc(SifRpcClientData_t *client, int rpc_number, int mode)
int SifCallRpc(SifRpcClientData_t *client, int rpc_number, int mode, void *send, int ssize, void *receive, int rsize, SifRpcEndFunc_t end_function, void *end_param)