Skip to content

Commit b347d90

Browse files
committed
hexagonrpcd: interfaces: switch adsp_listener to interp4
1 parent 61fc668 commit b347d90

File tree

6 files changed

+106
-63
lines changed

6 files changed

+106
-63
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* FastRPC reverse tunnel main interface - method definitions
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+
#include <stdint.h>
23+
#include <libhexagonrpc/hexagonrpc.h>
24+
25+
struct hrpc_method_def_interp4 adsp_listener_init2_def = {
26+
.msg_id = 3,
27+
.n_args = 0,
28+
.args = NULL,
29+
.n_inner_types = 0,
30+
.inner_types = NULL,
31+
};
32+
33+
struct hrpc_arg_def_interp4 adsp_listener_next2_args[] = {
34+
{ HRPC_ARG_WORD, sizeof(uint32_t) },
35+
{ HRPC_ARG_WORD, sizeof(uint32_t) },
36+
{ HRPC_ARG_BLOB_SEQ, sizeof(char) },
37+
{ HRPC_ARG_OUT_BLOB, sizeof(uint32_t) },
38+
{ HRPC_ARG_OUT_BLOB, sizeof(uint32_t) },
39+
{ HRPC_ARG_OUT_BLOB, sizeof(uint32_t) },
40+
{ HRPC_ARG_OUT_BLOB, sizeof(uint32_t) },
41+
{ HRPC_ARG_OUT_BLOB_SEQ, sizeof(char) },
42+
};
43+
44+
struct hrpc_method_def_interp4 adsp_listener_next2_def = {
45+
.msg_id = 4,
46+
.n_args = HRPC_ARRAY_SIZE(adsp_listener_next2_args),
47+
.args = adsp_listener_next2_args,
48+
.n_inner_types = 0,
49+
.inner_types = NULL,
50+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* FastRPC reverse tunnel main 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_LISTENER_H
23+
#define INTERFACE_ADSP_LISTENER_H
24+
25+
#include <stdint.h>
26+
#include <libhexagonrpc/hexagonrpc.h>
27+
#include <libhexagonrpc/session.h>
28+
29+
#define ADSP_LISTENER 3
30+
31+
extern struct hrpc_method_def_interp4 adsp_listener_init2_def;
32+
static inline int adsp_listener_init2(void)
33+
{
34+
return hexagonrpc(&adsp_listener_init2_def, hexagonrpc_fd, ADSP_LISTENER);
35+
}
36+
37+
extern struct hrpc_method_def_interp4 adsp_listener_next2_def;
38+
static inline int adsp_listener_next2(uint32_t ret_rctx,
39+
uint32_t ret_res,
40+
uint32_t ret_outbufs_len, const void *ret_outbufs,
41+
uint32_t *rctx,
42+
uint32_t *handle,
43+
uint32_t *sc,
44+
uint32_t *inbufs_len,
45+
uint32_t inbufs_size, void *inbufs)
46+
{
47+
return hexagonrpc(&adsp_listener_next2_def, hexagonrpc_fd, ADSP_LISTENER,
48+
ret_rctx, ret_res, ret_outbufs_len, ret_outbufs,
49+
rctx, handle, sc, inbufs_len, inbufs_size, inbufs);
50+
}
51+
52+
#endif /* INTERFACE_ADSP_LISTENER_H */

hexagonrpcd/interfaces.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@
2222
#define HEXAGONRPC_BUILD_METHOD_DEFINITIONS 1
2323

2424
#include "interfaces/adsp_default_listener.def"
25-
#include "interfaces/adsp_listener.def"

hexagonrpcd/interfaces/adsp_listener.def

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

hexagonrpcd/listener.c

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,10 @@
2727
#include <stdint.h>
2828
#include <stdio.h>
2929

30-
#include "interfaces/adsp_listener.def"
30+
#include "interface/adsp_listener.h"
3131
#include "iobuffer.h"
3232
#include "listener.h"
3333

34-
static int adsp_listener_init2(int fd)
35-
{
36-
return fastrpc2(&adsp_listener_init2_def, fd, ADSP_LISTENER_HANDLE);
37-
}
38-
39-
static int adsp_listener_next2(int fd,
40-
uint32_t ret_rctx,
41-
uint32_t ret_res,
42-
uint32_t ret_outbuf_len, void *ret_outbuf,
43-
uint32_t *rctx,
44-
uint32_t *handle,
45-
uint32_t *sc,
46-
uint32_t *inbufs_len,
47-
uint32_t inbufs_size, void *inbufs)
48-
{
49-
return fastrpc2(&adsp_listener_next2_def, fd, ADSP_LISTENER_HANDLE,
50-
ret_rctx,
51-
ret_res,
52-
ret_outbuf_len, ret_outbuf,
53-
rctx,
54-
handle,
55-
sc,
56-
inbufs_len,
57-
inbufs_size, inbufs);
58-
}
59-
6034
static int count_sizes_in_type4(const struct hrpc_inner_type_def_interp4 *type,
6135
const struct fastrpc_io_buffer **curr_inbuf,
6236
const struct fastrpc_io_buffer *inbufs_end,
@@ -555,8 +529,7 @@ static int return_for_next_invoke(int fd,
555529
outbufs_encode(REMOTE_SCALARS_OUTBUFS(*sc), returned, outbufs);
556530
}
557531

558-
ret = adsp_listener_next2(fd,
559-
*rctx, result,
532+
ret = adsp_listener_next2(*rctx, result,
560533
outbufs_len, outbufs,
561534
rctx, handle, sc,
562535
&inbufs_len, 256, inbufs);
@@ -710,7 +683,7 @@ int run_fastrpc_listener(int fd,
710683
uint32_t n_outbufs = 0;
711684
int ret;
712685

713-
ret = adsp_listener_init2(fd);
686+
ret = adsp_listener_init2();
714687
if (ret) {
715688
fprintf(stderr, "Could not initialize the listener: %u\n", ret);
716689
return ret;

hexagonrpcd/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ executable('hexagonrpcd',
22
'apps_mem.c',
33
'apps_std.c',
44
'interfaces.c',
5+
'interface/adsp_listener.c',
56
'interface/apps_mem.c',
67
'interface/apps_std.c',
78
'hexagonfs.c',

0 commit comments

Comments
 (0)