Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/adsprpcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "verify.h"
#include "HAP_farf.h"
#include "AEEStdErr.h"
#include <getopt.h>


#ifndef ADSP_DEFAULT_LISTENER_NAME
Expand All @@ -21,6 +22,24 @@
#define ADSP_LIBHIDL_NAME "libhidlbase.so"
#endif

void print_help() {
printf(
"The adsprpcd is a daemon that establishes a connection to the guest PD (Process Domain) on the ADSP (Audio Digital Signal Processor).\n"
"It uses the FastRPC framework to handle remote function calls from the CPU to the ADSP.\n"
"This allows applications to perform audio related tasks on the ADSP,\n"
"such as audio and video processing.\n"
"It is essential for the following functionalities:\n"
"1. DSP Process Exception Logs:\n"
" The daemon facilitates the transfer of ADSP process exception logs to the HLOS (High-Level Operating System) logging infrastructure.\n"
" This ensures that any exceptions occurring within ADSP processes are captured and logged in the HLOS, allowing for effective monitoring and debugging.\n"
"2. FastRPC Shell Files Execution:\n"
" The fastrpc_shell_0 file is an executable file that runs as a process on the ADSP.\n"
" This shell file resides in the HLOS file system. If an application attempts to offload tasks to the ADSP but cannot access the shell file directly,\n"
" the ADSP utilizes the adsprpcd daemon to read the shell file and create the necessary process on the ADSP.\n"
" This mechanism ensures that applications can leverage ADSP capabilities even when direct access to the shell file is restricted.\n"
);
}

typedef int (*adsp_default_listener_start_t)(int argc, char *argv[]);

int main(int argc, char *argv[]) {
Expand All @@ -32,6 +51,23 @@ int main(int argc, char *argv[]) {
#endif
adsp_default_listener_start_t listener_start;

static struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};

int opt;
while ((opt = getopt_long(argc, argv, "h", long_options, NULL)) != -1) {
switch (opt) {
case 'h':
print_help();
return 0;
default:
fprintf(stderr, "Try '%s --help' for more information.\n", argv[0]);
return 1;
}
}

VERIFY_EPRINTF("adsp daemon starting");
#ifndef NO_HAL
if(NULL != (libhidlbaseHandler = dlopen(ADSP_LIBHIDL_NAME, RTLD_NOW))) {
Expand Down
36 changes: 36 additions & 0 deletions src/cdsprpcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>

#ifndef CDSP_DEFAULT_LISTENER_NAME
#define CDSP_DEFAULT_LISTENER_NAME "libcdsp_default_listener.so"
Expand All @@ -20,6 +21,24 @@
#define CDSP_LIBHIDL_NAME "libhidlbase.so"
#endif

void print_help() {
printf(
"The cdsprpcd is a daemon that establishes a connection to the guest PD (Process Domain) on the CDSP (Compute Digital Signal Processor).\n"
"It uses the FastRPC framework to handle remote function calls from the CPU to the CDSP.\n"
"This allows applications to perform computationally intensive tasks on the CDSP,\n"
"such as image processing, computer vision, and neural network-related computation.\n"
"It is essential for the following functionalities:\n"
"1. DSP Process Exception Logs:\n"
" The daemon facilitates the transfer of CDSP process exception logs to the HLOS (High-Level Operating System) logging infrastructure.\n"
" This ensures that any exceptions occurring within CDSP processes are captured and logged in the HLOS, allowing for effective monitoring and debugging.\n"
"2. FastRPC Shell Files Execution:\n"
" The fastrpc_shell_3 or fastrpc_unsigned_shell_3 file is an executable file that runs as a process on the CDSP.\n"
" This shell file resides in the HLOS file system. If an application attempts to offload tasks to the CDSP but cannot access the shell file directly,\n"
" the CDSP utilizes the cdsprpcd daemon to read the shell file and create the necessary process on the CDSP.\n"
" This mechanism ensures that applications can leverage CDSP capabilities even when direct access to the shell file is restricted.\n"
);
}

typedef int (*adsp_default_listener_start_t)(int argc, char *argv[]);

int main(int argc, char *argv[]) {
Expand All @@ -31,6 +50,23 @@ int main(int argc, char *argv[]) {
#endif
adsp_default_listener_start_t listener_start;

static struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};

int opt;
while ((opt = getopt_long(argc, argv, "h", long_options, NULL)) != -1) {
switch (opt) {
case 'h':
print_help();
return 0;
default:
fprintf(stderr, "Try '%s --help' for more information.\n", argv[0]);
return 1;
}
}

VERIFY_EPRINTF("cdsp daemon starting");
#ifndef NO_HAL
if (NULL != (libhidlbaseHandler = dlopen(CDSP_LIBHIDL_NAME, RTLD_NOW))) {
Expand Down
Loading