PS2SDK
PS2 Homebrew Libraries
freesd.c File Reference
#include "types.h"
#include "irx.h"
#include "loadcore.h"
#include "stdio.h"
#include "intrman.h"
#include "freesd.h"
#include "spu2regs.h"
+ Include dependency graph for freesd.c:

Go to the source code of this file.

Macros

#define BANNER   "FREESD %s\n"
 
#define VERSION   "v1.01"
 
#define MODNAME   "freesd"
 
#define M_PRINTF(format, args...)   printf(MODNAME ": " format, ## args)
 

Functions

 IRX_ID (MODNAME, 1, 1)
 
void SetESA (s32 core, u32 value)
 
u32 GetEEA (int chan)
 
void nopdelay ()
 
void InitSpu2 ()
 
int _start (int argc, char *argv[])
 
int TransInterrupt (void *data)
 
int Spu2Interrupt (void *data)
 
void RegisterInterrupts ()
 
void ResetAll ()
 
void Reset (s32 flag)
 
sceSdSpu2IntrHandler sceSdSetSpu2IntrHandler (sceSdSpu2IntrHandler handler, void *data)
 
void InitVoices ()
 
void InitCoreVolume (s32 flag)
 
void InitSpdif ()
 
int sceSdInit (int flag)
 
void sceSdSetParam (u16 reg, u16 val)
 
u16 sceSdGetParam (u16 reg)
 
void sceSdSetSwitch (u16 reg, u32 val)
 
u32 sceSdGetSwitch (u16 reg)
 
u32 DmaStop (u32 core)
 
void SetDmaWrite (s32 chan)
 
void SetDmaRead (s32 chan)
 
u16 sceSdNote2Pitch (u16 center_note, u16 center_fine, u16 note, short fine)
 
u16 sceSdPitch2Note (u16 center_note, u16 center_fine, u16 pitch)
 
void SetSpdifMode (u16 val)
 
void sceSdSetCoreAttr (u16 entry, u16 val)
 
u16 sceSdGetCoreAttr (u16 entry)
 
sceSdTransIntrHandler sceSdSetTransIntrHandler (int chan, sceSdTransIntrHandler func, void *data)
 
int sceSdQuit ()
 
void sceSdSetAddr (u16 reg, u32 val)
 
u32 sceSdGetAddr (u16 reg)
 
SdIntrCallback sceSdSetTransCallback (s32 core, SdIntrCallback cb)
 
SdIntrCallback sceSdSetIRQCallback (SdIntrCallback cb)
 

Variables

struct irx_export_table _exp_libsd
 
u32 BlockTransBuff [2]
 
u32 BlockTransAddr [2]
 
u32 BlockTransSize [2]
 
u32 EffectSizes [10]
 
sceSdEffectAttr EffectAttr [2]
 
u32 EffectAddr [2]
 
u32 VoiceTransStatus [2]
 
volatile u16 VoiceTransComplete [2]
 
u32 VoiceTransIoMode [2]
 
u16 SpdifSettings
 
void * Spu2IntrData
 
sceSdTransIntrHandler TransIntrHandlers [2]
 
SdIntrCallback TransIntrCallbacks [2]
 
sceSdSpu2IntrHandler Spu2IntrHandler
 
SdIntrCallback Spu2IrqCallback
 
IntrData TransIntrData [2]
 
volatile u16 * ParamRegList []
 
u16 NotePitchTable []
 
u16 VoiceDataInit [16]
 
u8 CoreAttrShifts [4] = {7, 6, 14, 8}
 

Detailed Description

Part of the IOP Sound Driver

Definition in file freesd.c.

Variable Documentation

◆ ParamRegList

volatile u16* ParamRegList[]
Initial value:
=
{
SD_VP_VOLL(0, 0), SD_VP_VOLR(0, 0), SD_VP_PITCH(0, 0), SD_VP_ADSR1(0, 0),
SD_VP_ADSR2(0, 0), SD_VP_ENVX(0, 0), SD_VP_VOLXL(0, 0), SD_VP_VOLXR(0, 0),
SD_P_MMIX(0), SD_P_MVOLL(0), SD_P_MVOLR(0), SD_P_EVOLL(0),
SD_P_EVOLR(0), SD_P_AVOLL(0), SD_P_AVOLR(0), SD_P_BVOLL(0),
SD_P_BVOLR(0), SD_P_MVOLXL(0), SD_P_MVOLXR(0), SD_S_PMON_HI(0),
SD_S_NON_HI(0), SD_A_KON_HI(0), SD_A_KOFF_HI(0), SD_S_ENDX_HI(0),
SD_S_VMIXL_HI(0), SD_S_VMIXEL_HI(0), SD_S_VMIXR_HI(0), SD_S_VMIXER_HI(0),
SD_A_ESA_HI(0), SD_A_EEA_HI(0), SD_A_TSA_HI(0), SD_CORE_IRQA(0),
SD_VA_SSA_HI(0, 0), SD_VA_LSAX(0,0), SD_VA_NAX(0, 0), SD_CORE_ATTR(0),
SD_A_TSA_HI(0), SD_A_STD(0),
U16_REGISTER(0x1AE), U16_REGISTER(0x1B0),
(u16*)0xBF900334
}

Definition at line 63 of file freesd.c.

◆ NotePitchTable

u16 NotePitchTable[]
Initial value:
=
{
0x8000, 0x879C, 0x8FAC, 0x9837, 0xA145, 0xAADC, 0xB504,
0xBFC8, 0xCB2F, 0xD744, 0xE411, 0xF1A1, 0x8000, 0x800E,
0x801D, 0x802C, 0x803B, 0x804A, 0x8058, 0x8067, 0x8076,
0x8085, 0x8094, 0x80A3, 0x80B1, 0x80C0, 0x80CF, 0x80DE,
0x80ED, 0x80FC, 0x810B, 0x811A, 0x8129, 0x8138, 0x8146,
0x8155, 0x8164, 0x8173, 0x8182, 0x8191, 0x81A0, 0x81AF,
0x81BE, 0x81CD, 0x81DC, 0x81EB, 0x81FA, 0x8209, 0x8218,
0x8227, 0x8236, 0x8245, 0x8254, 0x8263, 0x8272, 0x8282,
0x8291, 0x82A0, 0x82AF, 0x82BE, 0x82CD, 0x82DC, 0x82EB,
0x82FA, 0x830A, 0x8319, 0x8328, 0x8337, 0x8346, 0x8355,
0x8364, 0x8374, 0x8383, 0x8392, 0x83A1, 0x83B0, 0x83C0,
0x83CF, 0x83DE, 0x83ED, 0x83FD, 0x840C, 0x841B, 0x842A,
0x843A, 0x8449, 0x8458, 0x8468, 0x8477, 0x8486, 0x8495,
0x84A5, 0x84B4, 0x84C3, 0x84D3, 0x84E2, 0x84F1, 0x8501,
0x8510, 0x8520, 0x852F, 0x853E, 0x854E, 0x855D, 0x856D,
0x857C, 0x858B, 0x859B, 0x85AA, 0x85BA, 0x85C9, 0x85D9,
0x85E8, 0x85F8, 0x8607, 0x8617, 0x8626, 0x8636, 0x8645,
0x8655, 0x8664, 0x8674, 0x8683, 0x8693, 0x86A2, 0x86B2,
0x86C1, 0x86D1, 0x86E0, 0x86F0, 0x8700, 0x870F, 0x871F,
0x872E, 0x873E, 0x874E, 0x875D, 0x876D, 0x877D, 0x878C
}

Definition at line 81 of file freesd.c.

◆ VoiceDataInit

u16 VoiceDataInit[16]
Initial value:
= { 0x707, 0x707, 0x707, 0x707, 0x707, 0x707, 0x707, 0x707,
0, 0, 0, 0, 0, 0, 0, 0 }

Definition at line 348 of file freesd.c.