Skip to content

Commit b1af124

Browse files
rpmsg: shouldn't allocate 0-1023 address in rpmsg_create_ept
since this region is reserved for predefined services(e.g. NS use 0x35) Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
1 parent dd919df commit b1af124

11 files changed

Lines changed: 30 additions & 26 deletions

File tree

apps/examples/echo/rpmsg-echo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int app(struct rpmsg_device *rdev, void *priv)
5858
LPRINTF("Try to create rpmsg endpoint.\r\n");
5959

6060
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
61-
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
61+
1024, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
6262
rpmsg_service_unbind);
6363
if (ret) {
6464
LPERROR("Failed to create endpoint.\r\n");

apps/examples/echo/rpmsg-ping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This application echoes back data that was sent to it by the master core. */
1111
#include "platform_info.h"
1212
#include "rpmsg-echo.h"
1313

14-
#define APP_EPT_ADDR 0
14+
#define APP_EPT_ADDR 1024
1515
#define LPRINTF(format, ...) printf(format, ##__VA_ARGS__)
1616
#define LPERROR(format, ...) LPRINTF("ERROR: " format, ##__VA_ARGS__)
1717

apps/examples/matrix_multiply/matrix_multiply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ multiplies them and returns the result to the master core. */
1414

1515
#define MAX_SIZE 6
1616
#define NUM_MATRIX 2
17-
#define APP_EPT_ADDR 0
17+
#define APP_EPT_ADDR 1024
1818

1919
#define raw_printf(format, ...) printf(format, ##__VA_ARGS__)
2020
#define LPRINTF(format, ...) raw_printf("CLIENT> " format, ##__VA_ARGS__)

apps/examples/matrix_multiply/matrix_multiplyd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ int app(struct rpmsg_device *rdev, void *priv)
9292
int ret;
9393

9494
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
95-
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
95+
1024, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
9696
rpmsg_service_unbind);
9797
if (ret) {
9898
LPERROR("Failed to create endpoint.\r\n");

apps/examples/rpc_demo/rpc_demod.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ int app(struct rpmsg_device *rdev, void *priv)
312312
LPRINTF("Try to create rpmsg endpoint.\r\n");
313313

314314
ret = rpmsg_create_ept(&app_ept, rdev, RPMSG_SERVICE_NAME,
315-
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
315+
1024, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
316316
rpmsg_service_unbind);
317317
if (ret) {
318318
LPERROR("Failed to create endpoint.\r\n");

apps/examples/rpmsg_sample_echo/rpmsg-sample-ping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#define BYE_MSG "goodbye!"
2121
#define MSG_LIMIT 100
2222

23-
#define APP_EPT_ADDR 0
23+
#define APP_EPT_ADDR 1024
2424
#define LPRINTF(format, ...) printf(format, ##__VA_ARGS__)
2525
#define LPERROR(format, ...) LPRINTF("ERROR: " format, ##__VA_ARGS__)
2626

apps/tests/msg/rpmsg-flood-ping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "platform_info.h"
1313
#include "rpmsg-ping.h"
1414

15-
#define APP_EPT_ADDR 0
15+
#define APP_EPT_ADDR 1024
1616
#define LPRINTF(format, ...) printf(format, ##__VA_ARGS__)
1717
#define LPERROR(format, ...) LPRINTF("ERROR: " format, ##__VA_ARGS__)
1818

apps/tests/msg/rpmsg-ping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This application echoes back data that was sent to it by the master core. */
1111
#include "platform_info.h"
1212
#include "rpmsg-ping.h"
1313

14-
#define APP_EPT_ADDR 0
14+
#define APP_EPT_ADDR 1024
1515
#define LPRINTF(format, ...) printf(format, ##__VA_ARGS__)
1616
#define LPERROR(format, ...) LPRINTF("ERROR: " format, ##__VA_ARGS__)
1717

apps/tests/msg/rpmsg-update.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int app(struct rpmsg_device *rdev, void *priv)
7373
LPRINTF("Try to create rpmsg endpoint.\r\n");
7474

7575
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
76-
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
76+
1024, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
7777
rpmsg_service_unbind);
7878
if (ret) {
7979
LPERROR("Failed to create endpoint.\r\n");

lib/include/openamp/rpmsg.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,23 @@ extern "C" {
2525
#endif
2626

2727
/* Configurable parameters */
28-
#define RPMSG_NAME_SIZE (32)
29-
#define RPMSG_ADDR_BMP_SIZE (128)
28+
#define RPMSG_NAME_SIZE (32)
29+
#define RPMSG_ADDR_BMP_SIZE (128)
3030

31-
#define RPMSG_NS_EPT_ADDR (0x35)
32-
#define RPMSG_ADDR_ANY 0xFFFFFFFF
31+
#define RPMSG_NS_EPT_ADDR (0x35)
32+
#define RPMSG_RESERVED_ADDRESSES (1024)
33+
#define RPMSG_ADDR_ANY 0xFFFFFFFF
3334

3435
/* Error macros. */
35-
#define RPMSG_SUCCESS 0
36-
#define RPMSG_ERROR_BASE -2000
37-
#define RPMSG_ERR_NO_MEM (RPMSG_ERROR_BASE - 1)
38-
#define RPMSG_ERR_NO_BUFF (RPMSG_ERROR_BASE - 2)
39-
#define RPMSG_ERR_PARAM (RPMSG_ERROR_BASE - 3)
40-
#define RPMSG_ERR_DEV_STATE (RPMSG_ERROR_BASE - 4)
41-
#define RPMSG_ERR_BUFF_SIZE (RPMSG_ERROR_BASE - 5)
42-
#define RPMSG_ERR_INIT (RPMSG_ERROR_BASE - 6)
43-
#define RPMSG_ERR_ADDR (RPMSG_ERROR_BASE - 7)
36+
#define RPMSG_SUCCESS 0
37+
#define RPMSG_ERROR_BASE -2000
38+
#define RPMSG_ERR_NO_MEM (RPMSG_ERROR_BASE - 1)
39+
#define RPMSG_ERR_NO_BUFF (RPMSG_ERROR_BASE - 2)
40+
#define RPMSG_ERR_PARAM (RPMSG_ERROR_BASE - 3)
41+
#define RPMSG_ERR_DEV_STATE (RPMSG_ERROR_BASE - 4)
42+
#define RPMSG_ERR_BUFF_SIZE (RPMSG_ERROR_BASE - 5)
43+
#define RPMSG_ERR_INIT (RPMSG_ERROR_BASE - 6)
44+
#define RPMSG_ERR_ADDR (RPMSG_ERROR_BASE - 7)
4445

4546
struct rpmsg_endpoint;
4647
struct rpmsg_device;

0 commit comments

Comments
 (0)