From 08b06a07ff9c8e859064afd67ef6932866e615de Mon Sep 17 00:00:00 2001 From: Ling Xu Date: Thu, 3 Jul 2025 14:11:39 +0530 Subject: [PATCH] Add instructions for adsprpcd and cdsprpcd Add instructions for adsprpcd and cdsprpcd Signed-off-by: Ling Xu --- src/adsprpcd.c | 36 ++++++++++++++++++++++++++++++++++++ src/cdsprpcd.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/src/adsprpcd.c b/src/adsprpcd.c index 452c6451..e38c2d02 100644 --- a/src/adsprpcd.c +++ b/src/adsprpcd.c @@ -12,6 +12,7 @@ #include "verify.h" #include "HAP_farf.h" #include "AEEStdErr.h" +#include #ifndef ADSP_DEFAULT_LISTENER_NAME @@ -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[]) { @@ -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))) { diff --git a/src/cdsprpcd.c b/src/cdsprpcd.c index bb01ad8c..bb99124c 100644 --- a/src/cdsprpcd.c +++ b/src/cdsprpcd.c @@ -12,6 +12,7 @@ #include #include #include +#include #ifndef CDSP_DEFAULT_LISTENER_NAME #define CDSP_DEFAULT_LISTENER_NAME "libcdsp_default_listener.so" @@ -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[]) { @@ -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))) {