PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
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.

Macro Definition Documentation

◆ BANNER

#define BANNER   "FREESD %s\n"

Definition at line 23 of file freesd.c.

◆ VERSION

#define VERSION   "v1.01"

Definition at line 24 of file freesd.c.

◆ MODNAME

#define MODNAME   "freesd"

Definition at line 26 of file freesd.c.

◆ M_PRINTF

#define M_PRINTF (   format,
  args... 
)    printf(MODNAME ": " format, ## args)

Definition at line 34 of file freesd.c.

Function Documentation

◆ SetESA()

void SetESA ( s32  core,
u32  value 
)
extern

Definition at line 77 of file effect.c.

◆ nopdelay()

void nopdelay ( void  )

Definition at line 105 of file freesd.c.

◆ InitSpu2()

void InitSpu2 ( )

Definition at line 113 of file freesd.c.

◆ _start()

int _start ( int  argc,
char *  argv[] 
)

Definition at line 125 of file freesd.c.

◆ TransInterrupt()

int TransInterrupt ( void *  data)

Definition at line 139 of file freesd.c.

◆ Spu2Interrupt()

int Spu2Interrupt ( void *  data)

Definition at line 204 of file freesd.c.

◆ RegisterInterrupts()

void RegisterInterrupts ( )

Definition at line 232 of file freesd.c.

◆ ResetAll()

void ResetAll ( )

Definition at line 253 of file freesd.c.

◆ Reset()

void Reset ( s32  flag)

Definition at line 293 of file freesd.c.

◆ sceSdSetSpu2IntrHandler()

sceSdSpu2IntrHandler sceSdSetSpu2IntrHandler ( sceSdSpu2IntrHandler  handler,
void *  data 
)

Definition at line 337 of file freesd.c.

◆ InitVoices()

void InitVoices ( )

Definition at line 351 of file freesd.c.

◆ InitCoreVolume()

void InitCoreVolume ( s32  flag)

Definition at line 422 of file freesd.c.

◆ InitSpdif()

void InitSpdif ( )

Definition at line 490 of file freesd.c.

◆ sceSdInit()

int sceSdInit ( int  flag)

Definition at line 497 of file freesd.c.

◆ sceSdSetParam()

void sceSdSetParam ( u16  reg,
u16  val 
)

Definition at line 516 of file freesd.c.

◆ sceSdGetParam()

u16 sceSdGetParam ( u16  reg)

Definition at line 539 of file freesd.c.

◆ sceSdSetSwitch()

void sceSdSetSwitch ( u16  reg,
u32  val 
)

Definition at line 562 of file freesd.c.

◆ sceSdGetSwitch()

u32 sceSdGetSwitch ( u16  reg)

Definition at line 574 of file freesd.c.

◆ DmaStop()

u32 DmaStop ( u32  core)

Definition at line 590 of file freesd.c.

◆ SetDmaWrite()

void SetDmaWrite ( s32  chan)

Definition at line 609 of file freesd.c.

◆ SetDmaRead()

void SetDmaRead ( s32  chan)

Definition at line 615 of file freesd.c.

◆ sceSdNote2Pitch()

u16 sceSdNote2Pitch ( u16  center_note,
u16  center_fine,
u16  note,
short  fine 
)

Definition at line 621 of file freesd.c.

◆ sceSdPitch2Note()

u16 sceSdPitch2Note ( u16  center_note,
u16  center_fine,
u16  pitch 
)

Definition at line 671 of file freesd.c.

◆ SetSpdifMode()

void SetSpdifMode ( u16  val)

Definition at line 730 of file freesd.c.

◆ sceSdSetCoreAttr()

void sceSdSetCoreAttr ( u16  entry,
u16  val 
)

Definition at line 786 of file freesd.c.

◆ sceSdGetCoreAttr()

u16 sceSdGetCoreAttr ( u16  entry)

Definition at line 810 of file freesd.c.

◆ sceSdSetTransIntrHandler()

sceSdTransIntrHandler sceSdSetTransIntrHandler ( int  chan,
sceSdTransIntrHandler  func,
void *  data 
)

Definition at line 828 of file freesd.c.

◆ sceSdQuit()

int sceSdQuit ( )

Definition at line 841 of file freesd.c.

◆ sceSdSetAddr()

void sceSdSetAddr ( u16  reg,
u32  val 
)

Definition at line 858 of file freesd.c.

◆ sceSdGetAddr()

u32 sceSdGetAddr ( u16  reg)

Definition at line 876 of file freesd.c.

◆ sceSdSetTransCallback()

SdIntrCallback sceSdSetTransCallback ( s32  core,
SdIntrCallback  cb 
)

Definition at line 913 of file freesd.c.

◆ sceSdSetIRQCallback()

SdIntrCallback sceSdSetIRQCallback ( SdIntrCallback  cb)

Definition at line 923 of file freesd.c.

Variable Documentation

◆ BlockTransBuff

u32 BlockTransBuff[2]
extern

Definition at line 24 of file spu2.c.

◆ BlockTransAddr

u32 BlockTransAddr[2]
extern

Definition at line 25 of file spu2.c.

◆ BlockTransSize

u32 BlockTransSize[2]
extern

Definition at line 26 of file spu2.c.

◆ EffectSizes

u32 EffectSizes[10]
extern

Definition at line 27 of file effect.c.

◆ EffectAttr

sceSdEffectAttr EffectAttr[2]
extern

Definition at line 23 of file effect.c.

◆ EffectAddr

u32 EffectAddr[2]
extern

Definition at line 24 of file effect.c.

◆ VoiceTransStatus

u32 VoiceTransStatus[2]
extern

Definition at line 30 of file spu2.c.

◆ VoiceTransComplete

volatile u16 VoiceTransComplete[2]
extern

Definition at line 31 of file spu2.c.

◆ VoiceTransIoMode

u32 VoiceTransIoMode[2]
extern

Definition at line 32 of file spu2.c.

◆ SpdifSettings

u16 SpdifSettings

Definition at line 54 of file freesd.c.

◆ Spu2IntrData

void* Spu2IntrData

Definition at line 55 of file freesd.c.

◆ TransIntrHandlers

sceSdTransIntrHandler TransIntrHandlers[2]

Definition at line 56 of file freesd.c.

◆ TransIntrCallbacks

SdIntrCallback TransIntrCallbacks[2]

Definition at line 57 of file freesd.c.

◆ Spu2IntrHandler

sceSdSpu2IntrHandler Spu2IntrHandler

Definition at line 58 of file freesd.c.

◆ Spu2IrqCallback

SdIntrCallback Spu2IrqCallback

Definition at line 59 of file freesd.c.

◆ TransIntrData

IntrData TransIntrData[2]

Definition at line 60 of file freesd.c.

◆ 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.

◆ CoreAttrShifts

u8 CoreAttrShifts[4] = {7, 6, 14, 8}

Definition at line 784 of file freesd.c.