Skip to content

Commit faa9f71

Browse files
committed
hexagonrpcd: interfaces: switch adsp_default_listener to interp4
1 parent b347d90 commit faa9f71

File tree

5 files changed

+71
-48
lines changed

5 files changed

+71
-48
lines changed
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* FastRPC interface list for building method definitions
2+
* FastRPC reverse tunnel registration interface - method definitions
33
*
4-
* Copyright (C) 2023 The Sensor Shell Contributors
4+
* Copyright (C) 2025 HexagonRPC Contributors
55
*
6-
* This file is part of sensh.
6+
* This file is part of HexagonRPC.
77
*
8-
* Sensh is free software: you can redistribute it and/or modify
8+
* HexagonRPC is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License as published by
1010
* the Free Software Foundation, either version 3 of the License, or
1111
* (at your option) any later version.
@@ -19,6 +19,15 @@
1919
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2020
*/
2121

22-
#define HEXAGONRPC_BUILD_METHOD_DEFINITIONS 1
22+
#include <stdint.h>
23+
#include <libhexagonrpc/hexagonrpc.h>
2324

24-
#include "interfaces/adsp_default_listener.def"
25+
__thread uint32_t adsp_default_listener;
26+
27+
struct hrpc_method_def_interp4 adsp_default_listener_register_def = {
28+
.msg_id = 0,
29+
.n_args = 0,
30+
.args = NULL,
31+
.n_inner_types = 0,
32+
.inner_types = NULL,
33+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* FastRPC reverse tunnel registration interface - API
3+
*
4+
* Copyright (C) 2025 HexagonRPC Contributors
5+
*
6+
* This file is part of HexagonRPC.
7+
*
8+
* HexagonRPC is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*/
21+
22+
#ifndef INTERFACE_ADSP_DEFAULT_LISTENER_H
23+
#define INTERFACE_ADSP_DEFAULT_LISTENER_H
24+
25+
#include <stddef.h>
26+
#include <stdint.h>
27+
#include <libhexagonrpc/handle.h>
28+
#include <libhexagonrpc/hexagonrpc.h>
29+
#include <libhexagonrpc/session.h>
30+
31+
extern __thread uint32_t adsp_default_listener;
32+
static inline int hrpc_open_adsp_default_listener(size_t n_err, char *err)
33+
{
34+
return hexagonrpc_open("adsp_default_listener",
35+
&adsp_default_listener,
36+
n_err, err);
37+
}
38+
39+
static inline void hrpc_close_adsp_default_listener(void)
40+
{
41+
hexagonrpc_close(adsp_default_listener);
42+
}
43+
44+
extern struct hrpc_method_def_interp4 adsp_default_listener_register_def;
45+
static inline int adsp_default_listener_register(void)
46+
{
47+
return hexagonrpc(&adsp_default_listener_register_def,
48+
hexagonrpc_fd, adsp_default_listener);
49+
}
50+
51+
#endif /* INTERFACE_ADSP_DEFAULT_LISTENER_H */

hexagonrpcd/interfaces/adsp_default_listener.def

Lines changed: 0 additions & 29 deletions
This file was deleted.

hexagonrpcd/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
executable('hexagonrpcd',
22
'apps_mem.c',
33
'apps_std.c',
4-
'interfaces.c',
4+
'interface/adsp_default_listener.c',
55
'interface/adsp_listener.c',
66
'interface/apps_mem.c',
77
'interface/apps_std.c',

hexagonrpcd/rpcd.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include <errno.h>
2323
#include <fcntl.h>
2424
#include <libhexagonrpc/error.h>
25-
#include <libhexagonrpc/fastrpc.h>
26-
#include <libhexagonrpc/handle.h>
2725
#include <libhexagonrpc/interface/remotectl.h>
2826
#include <libhexagonrpc/session.h>
2927
#include <misc/fastrpc.h>
@@ -40,36 +38,30 @@
4038
#include "apps_mem.h"
4139
#include "apps_std.h"
4240
#include "hexagonfs.h"
43-
#include "interfaces/adsp_default_listener.def"
41+
#include "interface/adsp_default_listener.h"
4442
#include "listener.h"
4543
#include "localctl.h"
4644
#include "rpcd_builder.h"
4745

48-
static int adsp_default_listener_register(int fd, uint32_t handle)
49-
{
50-
return fastrpc2(&adsp_default_listener_register_def, fd, handle);
51-
}
52-
5346
static int register_fastrpc_listener(int fd)
5447
{
55-
uint32_t handle;
5648
char err[256];
5749
int ret;
5850

59-
ret = hexagonrpc_open("adsp_default_listener", &handle, 256, err);
51+
ret = hrpc_open_adsp_default_listener(256, err);
6052
if (ret) {
6153
fprintf(stderr, "Could not open remote interface: %s\n", err);
6254
return 1;
6355
}
6456

65-
ret = adsp_default_listener_register(fd, handle);
57+
ret = adsp_default_listener_register();
6658
if (ret) {
6759
fprintf(stderr, "Could not register ADSP default listener\n");
6860
goto err;
6961
}
7062

7163
err:
72-
hexagonrpc_close(handle);
64+
hrpc_close_adsp_default_listener();
7365
return ret;
7466
}
7567

0 commit comments

Comments
 (0)