audio_driver: Drop audio_driver in favour of kuKernelCall

This commit is contained in:
Joel16 2022-09-19 23:27:34 -04:00
parent 3fa4844501
commit e084512afd
8 changed files with 23 additions and 67 deletions

1
.gitignore vendored
View File

@ -54,7 +54,6 @@ Mkfile.old
dkms.conf
# CMFileManager PSP Specific objects
app/drivers/audio_driver.S
app/drivers/display_driver.S
app/drivers/fs_driver.S
app/drivers/module_driver.S

View File

@ -1,4 +1,4 @@
SUBDIRS = audio_driver display_driver fs_driver module_driver app launcher
SUBDIRS = display_driver fs_driver module_driver app launcher
all:
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir; done

View File

@ -12,7 +12,7 @@ extern "C" {
// Kernel function prototypes
// audio_driver functions
extern int pspAudioSetFrequency(int frequency);
int pspAudioSetFrequency(int frequency);
// display_driver functions
extern int pspDisplayEnable(void);

View File

@ -1,7 +1,25 @@
#include <pspaudio_kernel.h>
#include "kernel_functions.h"
#include "kubridge.h"
#include "log.h"
#include "systemctrl.h"
#include "utils.h"
// audio_driver functions
int pspAudioSetFrequency(int frequency);
int pspAudioSetFrequency(int frequency) {
struct KernelCallArg args = { 0 };
void *func_addr = nullptr;
int ret = 0;
func_addr = (void*)sctrlHENFindFunction("sceAudio_driver", "sceAudio_driver", 0xA2BEAA6C);
args.arg1 = static_cast<u32>(frequency);
if (R_FAILED(ret = kuKernelCall(func_addr, &args)))
Log::Error("%s: pspAudioSetFrequency returns 0x%08X\n", __func__, args.ret1);
return args.ret1;
}
// display driver functions
int pspDisplayEnable(void);

View File

@ -21,8 +21,8 @@ enum PspCtrlButtons PSP_CTRL_ENTER, PSP_CTRL_CANCEL;
BROWSE_STATE device = BROWSE_STATE_EXTERNAL;
int g_psp_language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
extern unsigned char audio_driver_prx_start[], display_driver_prx_start[], fs_driver_prx_start[], module_driver_prx_start[];
extern unsigned int audio_driver_prx_size, display_driver_prx_size, fs_driver_prx_size, module_driver_prx_size;
extern unsigned char display_driver_prx_start[], fs_driver_prx_start[], module_driver_prx_start[];
extern unsigned int display_driver_prx_size, fs_driver_prx_size, module_driver_prx_size;
namespace Utils {
constexpr unsigned int CTRL_DEADZONE_DELAY = 500000;
@ -43,7 +43,6 @@ namespace Utils {
} Module;
static std::vector<Module> kernel_modules {
{ "audio_driver.prx", -1, audio_driver_prx_start, audio_driver_prx_size },
{ "display_driver.prx", -1, display_driver_prx_start, display_driver_prx_size },
{ "fs_driver.prx", -1, fs_driver_prx_start, fs_driver_prx_size }
};

View File

@ -1,24 +0,0 @@
TARGET = audio_driver
OBJS = audio_driver.o exports.o
PRX_EXPORTS = exports.exp
# Use the kernel's small inbuilt libc
USE_KERNEL_LIBC = 1
# Use only kernel libraries
USE_KERNEL_LIBS = 1
CFLAGS = -Os -G0 -Wall -fno-builtin-printf
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LDFLAGS = -nostartfiles
LIBS = -lpspaudio_driver
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
all:
psp-build-exports -s $(PRX_EXPORTS)
mv audio_driver.S "../app/drivers/"
mv audio_driver.prx "../app/data/"

View File

@ -1,20 +0,0 @@
#include <pspsdk.h>
#include <pspaudio_kernel.h>
PSP_MODULE_INFO("audio_driver", PSP_MODULE_KERNEL, 1, 4);
PSP_NO_CREATE_MAIN_THREAD();
int pspAudioSetFrequency(int frequency) {
u32 k1 = pspSdkSetK1(0);
int ret = sceAudioSetFrequency(frequency);
pspSdkSetK1(k1);
return ret;
}
int module_start(SceSize args, void *argp) {
return 0;
}
int module_stop(void) {
return 0;
}

View File

@ -1,16 +0,0 @@
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC(module_start)
PSP_EXPORT_FUNC(module_stop)
PSP_EXPORT_VAR(module_info)
PSP_EXPORT_END
PSP_EXPORT_START(audio_driver, 0, 0x4001)
PSP_EXPORT_FUNC(pspAudioSetFrequency)
PSP_EXPORT_END
PSP_END_EXPORTS