mirror of
https://github.com/joel16/uofw.git
synced 2024-11-23 11:39:50 +00:00
Fixed codec (building & working), some work on ctrl debugging
This commit is contained in:
parent
bfc58f3b0c
commit
afdcd2bedd
9
include/lowio_gpio.h
Normal file
9
include/lowio_gpio.h
Normal file
@ -0,0 +1,9 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
int sceGpioPortSet(int);
|
||||
int sceGpioPortClear(int);
|
||||
int sceGpioSetPortMode(int, int);
|
||||
int sceGpioDisableTimerCapture(int, int);
|
||||
|
6
include/lowio_i2c.h
Normal file
6
include/lowio_i2c.h
Normal file
@ -0,0 +1,6 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
int sceI2cMasterTransmit(int reg, void *buf, int bufSize);
|
||||
|
@ -47,6 +47,8 @@ int sceSysregAudioClkSelect(int, int);
|
||||
int sceSysregAudioBusClockEnable(int);
|
||||
int sceSysregAudioIoEnable(int);
|
||||
int sceSysregAudioIoDisable(int);
|
||||
int sceSysregAudioClkoutClkEnable(void);
|
||||
int sceSysregAudioClkoutClkDisable(void);
|
||||
int sceSysregAudioClkoutClkSelect(int);
|
||||
int sceSysregAudioClkoutIoEnable(void);
|
||||
int sceSysregAudioClkoutIoDisable(void);
|
||||
|
@ -56,6 +56,7 @@ int sceKernelCreateMutex(char *, int, int, int);
|
||||
int sceKernelTryLockMutex(int, int);
|
||||
int sceKernelLockMutex(int, int, int);
|
||||
int sceKernelUnlockMutex(int, int);
|
||||
int sceKernelDeleteMutex(int);
|
||||
|
||||
/* Event flags */
|
||||
|
||||
|
@ -16,7 +16,7 @@ EXPORT_OBJ=$(patsubst %.exp,%.o,$(PRX_EXPORTS))
|
||||
|
||||
ifdef DEBUG
|
||||
CFLAGS += -DDEBUG
|
||||
LIBS := -ldebug -lpspdebug $(LIBS) -lSysclibForKernel -lsceDisplay -lsceGe_user -lIoFileMgrForUser -lsceSyscon_driver
|
||||
LIBS := -ldebug -lpspdebug $(LIBS) -lSysclibForKernel -lsceDisplay -lsceGe_user -lIoFileMgrForKernel -lsceSyscon_driver
|
||||
endif
|
||||
|
||||
MODULE_STUBS=$(foreach mod,$(MODULES), $($(mod)_STUBS))
|
||||
|
Binary file not shown.
BIN
lib/libsceDmac.a
BIN
lib/libsceDmac.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -855,7 +855,7 @@ int sceAudioInit()
|
||||
{
|
||||
//dbg_init(1, FB_AFTER_DISPLAY, FAT_AFTER_FATMS);
|
||||
//dbg_init(1, FB_NONE, FAT_AFTER_FATMS);
|
||||
dbg_init(1, FB_NONE, FAT_HARDWARE);
|
||||
dbg_init(1, FB_NONE, FAT_AFTER_FATMS);
|
||||
dbg_printf("Running %s\n", __FUNCTION__);
|
||||
memset(&g_audio, 0, sizeof(g_audio));
|
||||
// 1558
|
||||
|
@ -4,5 +4,7 @@
|
||||
TARGET = codec
|
||||
OBJS = codec.o
|
||||
|
||||
LIBS = -lThreadManForKernel -lsceSysEventForKernel -lsceI2c_driver -lsceSysreg_driver -lsceGpio_driver
|
||||
|
||||
include ../../lib/build.mak
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "codec.h"
|
||||
#include "lowio_gpio.h"
|
||||
#include "lowio_i2c.h"
|
||||
#include "lowio_sysreg.h"
|
||||
#include "sysmem_sysevent.h"
|
||||
#include "threadman_kernel.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -66,6 +71,8 @@ SceSysEventHandler g_sysEv = {
|
||||
};
|
||||
|
||||
PSP_MODULE_INFO("sceWM8750_Driver", PSP_MODULE_NO_STOP | PSP_MODULE_SINGLE_LOAD | PSP_MODULE_SINGLE_START | PSP_MODULE_KERNEL, 1, 7);
|
||||
PSP_MODULE_BOOTSTART("sceCodecInitEntry");
|
||||
PSP_MODULE_REBOOT_BEFORE("sceCodecStopEntry");
|
||||
PSP_SDK_VERSION(0x06060010);
|
||||
|
||||
int sub_0000(int reg, int set)
|
||||
@ -466,8 +473,10 @@ void sceCodec_driver_376399B6(int enable)
|
||||
sceSysregAudioClkoutClkEnable();
|
||||
}
|
||||
|
||||
int module_start()
|
||||
int sceCodecInitEntry()
|
||||
{
|
||||
for (;;)
|
||||
;
|
||||
sub_0110();
|
||||
sub_0150(1);
|
||||
g_codec.mutexId = sceKernelCreateMutex("SceCodec", 1, 0, 0);
|
||||
@ -496,7 +505,7 @@ int sceCodec_driver_FC355DE0()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int module_reboot_before()
|
||||
int sceCodecStopEntry()
|
||||
{
|
||||
sub_01FC(-1, -1, -1, -1);
|
||||
sceKernelUnregisterSysEventHandler(&g_sysEv);
|
||||
|
@ -5,7 +5,7 @@ PSP_EXPORT_START(syslib, 0x0000, 0x8000)
|
||||
PSP_EXPORT_FUNC_HASH(module_start)
|
||||
PSP_EXPORT_FUNC_HASH(module_reboot_before)
|
||||
PSP_EXPORT_VAR_HASH(module_info)
|
||||
PSP_EXPORT_VAR_NID(syslib_11B97506, 0x11B97506)
|
||||
PSP_EXPORT_VAR_HASH(module_sdk_version)
|
||||
PSP_EXPORT_END
|
||||
|
||||
PSP_EXPORT_START(sceCodec_driver, 0x0011, 0x0001)
|
||||
@ -22,7 +22,7 @@ PSP_EXPORT_FUNC_HASH(sceCodecInitEntry)
|
||||
PSP_EXPORT_FUNC_NID(sceCodecSetVolumeOffset, 0xD27707A8)
|
||||
PSP_EXPORT_FUNC_NID(sceCodecSelectVolumeTable, 0xE4456BC3)
|
||||
PSP_EXPORT_FUNC_NID(sceCodec_driver_E61A4623, 0xE61A4623)
|
||||
PSP_EXPORT_FUNC_NID(sceCodec_driver_EACF7284, 0xEACF7284)
|
||||
PSP_EXPORT_FUNC_NID(sceCodecSetSpeakerVolume, 0xEACF7284)
|
||||
PSP_EXPORT_FUNC_NID(sceCodec_driver_FC355DE0, 0xFC355DE0)
|
||||
PSP_EXPORT_FUNC_NID(sceCodec_driver_FCA6D35B, 0xFCA6D35B)
|
||||
PSP_EXPORT_END
|
||||
|
@ -1214,17 +1214,17 @@ static int _sceCtrlVblankIntr(int subIntNm __attribute__((unused)), void *arg __
|
||||
int suspendFlag;
|
||||
int retVal;
|
||||
|
||||
dbg_printf("In function: %s\n", __FUNCTION__);
|
||||
//dbg_printf("In function: %s\n", __FUNCTION__);
|
||||
|
||||
suspendFlag = sceKernelCpuSuspendIntr(); //0x00000454
|
||||
|
||||
if (ctrl.btnCycle == 0) { //0x00000464
|
||||
dbg_printf("sysconHwDataTransferBusy VALUE: %d in function: %s\n", ctrl.sysconHwDataTransferBusy, __FUNCTION__);
|
||||
//dbg_printf("sysconHwDataTransferBusy VALUE: %d in function: %s\n", ctrl.sysconHwDataTransferBusy, __FUNCTION__);
|
||||
if (ctrl.sysconHwDataTransferBusy == FALSE) { //0x00000470
|
||||
if (ctrl.pollMode != PSP_CTRL_POLL_NO_POLLING) { //0x0000047C
|
||||
ctrl.sysconHwDataTransferBusy = TRUE; //0x000004E0
|
||||
|
||||
dbg_printf("receiving SYSCON data: %s\n", __FUNCTION__);
|
||||
//dbg_printf("receiving SYSCON data: %s\n", __FUNCTION__);
|
||||
if ((ctrl.samplingMode[USER_MODE] | ctrl.samplingMode[KERNEL_MODE]) == PSP_CTRL_INPUT_DIGITAL_ONLY) { //0x000004E4
|
||||
ctrl.sysPacket[0].tx_cmd = SYSCON_CTRL_TRANSFER_DATA_DIGITAL_ONLY; //0x000004E8
|
||||
}
|
||||
@ -1233,35 +1233,35 @@ static int _sceCtrlVblankIntr(int subIntNm __attribute__((unused)), void *arg __
|
||||
}
|
||||
ctrl.sysPacket[0].tx_len = 2; //0x00000514
|
||||
|
||||
dbg_printf("calling sceSysconCmdExecAsync: %s\n", __FUNCTION__);
|
||||
//dbg_printf("calling sceSysconCmdExecAsync: %s\n", __FUNCTION__);
|
||||
retVal = sceSysconCmdExecAsync(&ctrl.sysPacket[0], 1, _sceCtrlSysconCmdIntr1, 0); //0x00000510
|
||||
dbg_printf("called sceSysconCmdExecAsync returns: 0x%08X in function: %s\n", retVal, __FUNCTION__);
|
||||
//dbg_printf("called sceSysconCmdExecAsync returns: 0x%08X in function: %s\n", retVal, __FUNCTION__);
|
||||
if (retVal < 0) { //0x00000518
|
||||
ctrl.sysconHwDataTransferBusy = FALSE; //0x0000051C
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbg_printf("set alarm handler_1: %s\n", __FUNCTION__);
|
||||
//dbg_printf("set alarm handler_1: %s\n", __FUNCTION__);
|
||||
|
||||
//register an alarm occurring every 700 micro seconds
|
||||
sceKernelSetAlarm(700, _sceCtrlDummyAlarm, NULL); //0x00000490
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbg_printf("set alarm handler_2: %s\n", __FUNCTION__);
|
||||
//dbg_printf("set alarm handler_2: %s\n", __FUNCTION__);
|
||||
sceKernelSetAlarm(700, _sceCtrlDummyAlarm, NULL); //0x00000490
|
||||
}
|
||||
}
|
||||
if (ctrl.unk_Byte_2 != 0) { //0x000004A0
|
||||
dbg_printf("calling sceKernelPowerTick: %s\n", __FUNCTION__);
|
||||
//dbg_printf("calling sceKernelPowerTick: %s\n", __FUNCTION__);
|
||||
ctrl.unk_Byte_2 = 0; //0x000004A4
|
||||
sceKernelPowerTick(SCE_KERNEL_POWER_TICK_DEFAULT); //0x000004CC
|
||||
}
|
||||
|
||||
dbg_printf("resuming all interrupts: %s\n", __FUNCTION__);
|
||||
//dbg_printf("resuming all interrupts: %s\n", __FUNCTION__);
|
||||
sceKernelCpuResumeIntr(suspendFlag); //0x000004A8
|
||||
|
||||
dbg_printf("returning from %s.\n", __FUNCTION__);
|
||||
//dbg_printf("returning from %s.\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1964,6 +1964,7 @@ static int _sceCtrlReadBuf(SceCtrlDataExt *pad, u8 reqBufReads, int arg3, u8 mod
|
||||
return SCE_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
oldK1 = pspShiftK1();
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
|
||||
if (!pspK1PtrOk(pad)) { //0x00001EF0 -- protect kernel address from user mode
|
||||
pspSetK1(oldK1);
|
||||
@ -1980,9 +1981,12 @@ static int _sceCtrlReadBuf(SceCtrlDataExt *pad, u8 reqBufReads, int arg3, u8 mod
|
||||
return SCE_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
//waiting for the VSYNC callback when using the "read" functions.
|
||||
if (mode & 2) { //0x00001F10 && 0x00001F28
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
res = sceKernelWaitEventFlag(ctrl.eventFlag, 1, SCE_EVENT_WAITOR, NULL, NULL); //0x00001F44
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
if (res < 0) { //0x00001F4C
|
||||
pspSetK1(oldK1); //0x00001F50
|
||||
return res;
|
||||
@ -1992,30 +1996,37 @@ static int _sceCtrlReadBuf(SceCtrlDataExt *pad, u8 reqBufReads, int arg3, u8 mod
|
||||
|
||||
/* Clear the event flag to wait for the VBlank interrupt the next call. */
|
||||
sceKernelClearEventFlag(ctrl.eventFlag, 0xFFFFFFFE); //0x00001F64
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
|
||||
startBufIndex = intDataPtr->ctrlBufStartIndex; //0x00001F70
|
||||
readIntBufs = intDataPtr->ctrlBufIndex - startBufIndex; //0x00001F74
|
||||
if (readIntBufs < 0) { //0x00001F7C
|
||||
readIntBufs += 64; //0x00001F78 & 0x00001F80
|
||||
}
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
intDataPtr->ctrlBufStartIndex = intDataPtr->ctrlBufIndex; //0x00001F8C
|
||||
if (reqBufReads < readIntBufs) { //0x00001F88
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
startBufIndex = intDataPtr->ctrlBufIndex - reqBufReads; //0x00001F90
|
||||
startBufIndex = (startBufIndex < 0) ? startBufIndex + CTRL_INTERNAL_CONTROLLER_BUFFERS : startBufIndex; //0x00001F98 & 0x00001F9C
|
||||
readIntBufs = reqBufReads;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
suspendFlag = sceKernelCpuSuspendIntr(); //0x0000216C
|
||||
bufIndex = intDataPtr->ctrlBufIndex; //0x00002174
|
||||
|
||||
startBufIndex = bufIndex; //0x00002184
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
if (reqBufReads < 64) { //0x00002178
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
startBufIndex = bufIndex - reqBufReads; //0x0000218C
|
||||
startBufIndex = (startBufIndex < 0) ? startBufIndex + CTRL_INTERNAL_CONTROLLER_BUFFERS : startBufIndex; //0x00001F98 & 0x00001F9C
|
||||
readIntBufs = reqBufReads; //0x00001FA0
|
||||
}
|
||||
}
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
if (arg3 != 0) { //0x00001FA4
|
||||
ctrlBuf = (SceCtrlDataExt *)intDataPtr->sceCtrlBuf[arg3] + startBufIndex; //0x00002160
|
||||
}
|
||||
@ -2027,6 +2038,7 @@ static int _sceCtrlReadBuf(SceCtrlDataExt *pad, u8 reqBufReads, int arg3, u8 mod
|
||||
pspSetK1(oldK1); //0x000020B0
|
||||
return readIntBufs;
|
||||
}
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
/* read internal data buffers. */
|
||||
while (reqBufReads-- > 0) { //0x0000209C & 0x000020A0
|
||||
pad->activeTime = ctrlBuf->activeTime; //0x00001FE4 & 0x00001FF0
|
||||
@ -2099,6 +2111,7 @@ static int _sceCtrlReadBuf(SceCtrlDataExt *pad, u8 reqBufReads, int arg3, u8 mod
|
||||
}
|
||||
}
|
||||
}
|
||||
dbg_printf("%d\n", __LINE__);
|
||||
|
||||
sceKernelCpuResumeIntr(suspendFlag); //0x000020A8
|
||||
pspSetK1(oldK1); //0x000020B0
|
||||
@ -2110,11 +2123,11 @@ static int _sceCtrlReadBuf(SceCtrlDataExt *pad, u8 reqBufReads, int arg3, u8 mod
|
||||
* Exported in syslib
|
||||
*/
|
||||
int CtrlInit(void) {
|
||||
dbg_init(1, FB_NONE, FAT_AFTER_SYSCON);
|
||||
dbg_init(1, FB_AFTER_DISPLAY, FAT_NONE);
|
||||
|
||||
dbg_printf("Ctrl_Start: %s\n", __FUNCTION__);
|
||||
|
||||
sceCtrlInit();
|
||||
//sceCtrlInit();
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -2121,7 +2121,7 @@ static int _sceCtrlReadBuf(SceCtrlDataExt *pad, u8 reqBufReads, int arg3, u8 mod
|
||||
* Exported in syslib
|
||||
*/
|
||||
int CtrlInit(void) {
|
||||
dbg_init(1, FB_NONE, FAT_AFTER_SYSCON);
|
||||
dbg_init(1, FB_AFTER_DISPLAY, FAT_NONE);
|
||||
|
||||
dbg_printf("Ctrl_Start: %s\n", __FUNCTION__);
|
||||
|
||||
|
@ -727,6 +727,19 @@ int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void
|
||||
|
||||
int sceIoAssign(const char *dev, const char *blockDev, const char *fs, int mode, void* unk1, int unk2)
|
||||
{
|
||||
int oldIntr;
|
||||
asm("mfic %0, $0" : "=r" (oldIntr));
|
||||
asm("mtic $zero, $0");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
dbg_printf("Calling %s\n", __FUNCTION__);
|
||||
dbg_printf("Calling %s\n", __FUNCTION__);
|
||||
dbg_printf("Calling %s\n", __FUNCTION__);
|
||||
@ -739,6 +752,7 @@ int sceIoAssign(const char *dev, const char *blockDev, const char *fs, int mode,
|
||||
dbg_printf("Calling %s\n", __FUNCTION__);
|
||||
dbg_printf("Calling %s\n", __FUNCTION__);
|
||||
dbg_printf("Calling %s\n", __FUNCTION__);
|
||||
asm("mtic %0, $0" : : "r" (oldIntr));
|
||||
return 0;
|
||||
char outDev[32];
|
||||
char blkAliasName[32];
|
||||
|
Loading…
Reference in New Issue
Block a user