mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-02-06 02:54:32 +08:00
change all \n to \r\n
make the line ending consistent in the whole project Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -28,14 +28,14 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
|
||||
/* On reception of a shutdown we signal the application to terminate */
|
||||
if ((*(unsigned int *)data) == SHUTDOWN_MSG) {
|
||||
LPRINTF("shutdown message is received.\n");
|
||||
LPRINTF("shutdown message is received.\r\n");
|
||||
shutdown_req = 1;
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
|
||||
/* Send data back to master */
|
||||
if (rpmsg_send(ept, data, len) < 0) {
|
||||
LPERROR("rpmsg_send failed\n");
|
||||
LPERROR("rpmsg_send failed\r\n");
|
||||
}
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
LPRINTF("unexpected Remote endpoint destroy\n");
|
||||
LPRINTF("unexpected Remote endpoint destroy\r\n");
|
||||
shutdown_req = 1;
|
||||
}
|
||||
|
||||
@@ -55,17 +55,17 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
int ret;
|
||||
|
||||
/* Initialize RPMSG framework */
|
||||
LPRINTF("Try to create rpmsg endpoint.\n");
|
||||
LPRINTF("Try to create rpmsg endpoint.\r\n");
|
||||
|
||||
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
|
||||
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
|
||||
rpmsg_service_unbind);
|
||||
if (ret) {
|
||||
LPERROR("Failed to create endpoint.\n");
|
||||
LPERROR("Failed to create endpoint.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LPRINTF("Successfully created rpmsg endpoint.\n");
|
||||
LPRINTF("Successfully created rpmsg endpoint.\r\n");
|
||||
while(1) {
|
||||
platform_poll(priv);
|
||||
/* we got a shutdown request, exit */
|
||||
@@ -87,19 +87,19 @@ int main(int argc, char *argv[])
|
||||
struct rpmsg_device *rpdev;
|
||||
int ret;
|
||||
|
||||
LPRINTF("Starting application...\n");
|
||||
LPRINTF("Starting application...\r\n");
|
||||
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
VIRTIO_DEV_SLAVE,
|
||||
NULL, NULL);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -48,14 +48,14 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
r_payload->num, (unsigned long)len);
|
||||
|
||||
if (r_payload->size == 0) {
|
||||
LPERROR(" Invalid size of package is received.\n");
|
||||
LPERROR(" Invalid size of package is received.\r\n");
|
||||
err_cnt++;
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
/* Validate data buffer integrity. */
|
||||
for (i = 0; i < (int)r_payload->size; i++) {
|
||||
if (r_payload->data[i] != 0xA5) {
|
||||
LPRINTF("Data corruption at index %d\n", i);
|
||||
LPRINTF("Data corruption at index %d\r\n", i);
|
||||
err_cnt++;
|
||||
break;
|
||||
}
|
||||
@@ -68,16 +68,16 @@ static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("echo test: service is destroyed\n");
|
||||
LPRINTF("echo test: service is destroyed\r\n");
|
||||
ept_deleted = 1;
|
||||
}
|
||||
|
||||
static void rpmsg_name_service_bind_cb(struct rpmsg_device *rdev,
|
||||
const char *name, uint32_t dest)
|
||||
{
|
||||
LPRINTF("new endpoint notification is received.\n");
|
||||
LPRINTF("new endpoint notification is received.\r\n");
|
||||
if (strcmp(name, RPMSG_SERVICE_NAME))
|
||||
LPERROR("Unexpected name service %s.\n", name);
|
||||
LPERROR("Unexpected name service %s.\r\n", name);
|
||||
else
|
||||
(void)rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
|
||||
APP_EPT_ADDR, dest,
|
||||
@@ -97,11 +97,11 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
int expect_rnum = 0;
|
||||
|
||||
LPRINTF(" 1 - Send data to remote core, retrieve the echo");
|
||||
LPRINTF(" and validate its integrity ..\n");
|
||||
LPRINTF(" and validate its integrity ..\r\n");
|
||||
|
||||
max_size = rpmsg_virtio_get_buffer_size(rdev);
|
||||
if (max_size < 0) {
|
||||
LPERROR("No avaiable buffer size.\n");
|
||||
LPERROR("No avaiable buffer size.\r\n");
|
||||
return -1;
|
||||
}
|
||||
max_size -= sizeof(struct _payload);
|
||||
@@ -111,7 +111,7 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
max_size);
|
||||
|
||||
if (!i_payload) {
|
||||
LPERROR("memory allocation failed.\n");
|
||||
LPERROR("memory allocation failed.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -121,14 +121,14 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
rpmsg_endpoint_cb, rpmsg_service_unbind);
|
||||
|
||||
if (ret) {
|
||||
LPERROR("Failed to create RPMsg endpoint.\n");
|
||||
LPERROR("Failed to create RPMsg endpoint.\r\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (!is_rpmsg_ept_ready(&lept))
|
||||
platform_poll(priv);
|
||||
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\n");
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\r\n");
|
||||
for (i = 0, size = PAYLOAD_MIN_SIZE; i < num_payloads; i++, size++) {
|
||||
i_payload->num = i;
|
||||
i_payload->size = size;
|
||||
@@ -136,7 +136,7 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
/* Mark the data buffer. */
|
||||
memset(&(i_payload->data[0]), 0xA5, size);
|
||||
|
||||
LPRINTF("sending payload number %lu of size %lu\n",
|
||||
LPRINTF("sending payload number %lu of size %lu\r\n",
|
||||
i_payload->num,
|
||||
(unsigned long)(2 * sizeof(unsigned long)) + size);
|
||||
|
||||
@@ -144,10 +144,10 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
(2 * sizeof(unsigned long)) + size);
|
||||
|
||||
if (ret < 0) {
|
||||
LPERROR("Failed to send data...\n");
|
||||
LPERROR("Failed to send data...\r\n");
|
||||
break;
|
||||
}
|
||||
LPRINTF("echo test: sent : %lu\n",
|
||||
LPRINTF("echo test: sent : %lu\r\n",
|
||||
(unsigned long)(2 * sizeof(unsigned long)) + size);
|
||||
|
||||
expect_rnum++;
|
||||
@@ -157,12 +157,12 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
|
||||
}
|
||||
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF(" Test Results: Error count = %d \n", err_cnt);
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF("**********************************\r\n");
|
||||
LPRINTF(" Test Results: Error count = %d \r\n", err_cnt);
|
||||
LPRINTF("**********************************\r\n");
|
||||
/* Destroy the RPMsg endpoint */
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("Quitting application .. Echo test end\n");
|
||||
LPRINTF("Quitting application .. Echo test end\r\n");
|
||||
|
||||
metal_free_memory(i_payload);
|
||||
return 0;
|
||||
@@ -177,7 +177,7 @@ int main(int argc, char *argv[])
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
@@ -185,7 +185,7 @@ int main(int argc, char *argv[])
|
||||
NULL,
|
||||
rpmsg_name_service_bind_cb);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -194,7 +194,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -44,7 +44,7 @@ static XStatus IpiConfigure(XIpiPsu *const IpiInstPtr)
|
||||
IpiCfgPtr = XIpiPsu_LookupConfig(XPAR_XIPIPSU_0_DEVICE_ID);
|
||||
if (NULL == IpiCfgPtr) {
|
||||
Status = XST_FAILURE;
|
||||
LPERROR("%s ERROR in getting CfgPtr\n", __func__);
|
||||
LPERROR("%s ERROR in getting CfgPtr\r\n", __func__);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ static XStatus IpiConfigure(XIpiPsu *const IpiInstPtr)
|
||||
Status = XIpiPsu_CfgInitialize(IpiInstPtr, IpiCfgPtr,
|
||||
IpiCfgPtr->BaseAddress);
|
||||
if (XST_SUCCESS != Status) {
|
||||
LPERROR("%s ERROR #%d in configuring IPI\n", __func__, Status);
|
||||
LPERROR("%s ERROR #%d in configuring IPI\r\n", __func__, Status);
|
||||
return Status;
|
||||
}
|
||||
return Status;
|
||||
@@ -219,7 +219,7 @@ int main(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
LPRINTF("Loading Exectuable Demo\n");
|
||||
LPRINTF("Loading Exectuable Demo\r\n");
|
||||
/* Initialize libmetal evironment */
|
||||
metal_init(&metal_param);
|
||||
/* Initialize remoteproc instance */
|
||||
|
||||
@@ -56,7 +56,7 @@ int mem_image_load(void *store, size_t offset, size_t size,
|
||||
|
||||
(void)is_blocking;
|
||||
|
||||
LPRINTF("%s: offset=0x%x, size=0x%x\n\r",
|
||||
LPRINTF("%s: offset=0x%x, size=0x%x\r\n",
|
||||
__func__, offset, size);
|
||||
if (pa == METAL_BAD_PHYS) {
|
||||
if (data == NULL) {
|
||||
|
||||
@@ -59,7 +59,7 @@ static uint32_t r5_rproc_boot_addr_config(struct r5_rproc_priv *priv,
|
||||
{
|
||||
uint32_t rpu_resetaddr;
|
||||
|
||||
LPRINTF("%s: R5 ID: %d, boot_addr 0x%x\n",
|
||||
LPRINTF("%s: R5 ID: %d, boot_addr 0x%x\r\n",
|
||||
__func__, priv->cpu_id, bootaddr);
|
||||
|
||||
if (bootaddr < 0x40000)
|
||||
@@ -80,7 +80,7 @@ static void r5_rproc_mode_config(struct r5_rproc_priv *priv)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
LPRINTF("%s: mode: %d\n", __func__, priv->cpu_id);
|
||||
LPRINTF("%s: mode: %d\r\n", __func__, priv->cpu_id);
|
||||
tmp = metal_io_read32(&priv->rpu_io, RPU_GLBL_CNTL_OFFSET);
|
||||
if (priv->cpu_id == NODE_RPU) {
|
||||
/* RPU lock step mode */
|
||||
@@ -103,11 +103,11 @@ struct remoteproc *r5_rproc_init(struct remoteproc *rproc,
|
||||
unsigned int cpu_id = *((unsigned int *)arg);
|
||||
|
||||
if (cpu_id < NODE_RPU_0 || cpu_id > NODE_RPU_1) {
|
||||
xil_printf("rproc init: invalide node id: %d\n\r", cpu_id);
|
||||
xil_printf("rproc init: invalide node id: %d\r\n", cpu_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xil_printf("rproc init: node id: %d\n\r", cpu_id);
|
||||
xil_printf("rproc init: node id: %d\r\n", cpu_id);
|
||||
priv = metal_allocate_memory(sizeof(*priv));
|
||||
if (!priv)
|
||||
return NULL;
|
||||
@@ -150,7 +150,7 @@ void *r5_rproc_mmap(struct remoteproc *rproc,
|
||||
|
||||
if (!da || !pa)
|
||||
return NULL;
|
||||
LPRINTF("%s: pa=0x%x, da=0x%x, size=0x%x, atrribute=0x%x\n\r",
|
||||
LPRINTF("%s: pa=0x%x, da=0x%x, size=0x%x, atrribute=0x%x\r\n",
|
||||
__func__, *pa, *da, size, attribute);
|
||||
lda = *da;
|
||||
lpa = *pa;
|
||||
@@ -189,7 +189,7 @@ void *r5_rproc_mmap(struct remoteproc *rproc,
|
||||
PM_CAP_ACCESS, 0,
|
||||
REQUEST_ACK_BLOCKING);
|
||||
} else {
|
||||
LPERROR("mmap failed: invalid cpu node: %d\n",
|
||||
LPERROR("mmap failed: invalid cpu node: %d\r\n",
|
||||
priv->cpu_id);
|
||||
return NULL;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ int r5_rproc_start(struct remoteproc *rproc)
|
||||
ret = XPm_RequestWakeUp(priv->cpu_id, true, resetaddr,
|
||||
REQUEST_ACK_BLOCKING);
|
||||
if (ret != XST_SUCCESS) {
|
||||
LPRINTF("%s: Failed to start RPU 0x%x, ret=0x%x\n\r",
|
||||
LPRINTF("%s: Failed to start RPU 0x%x, ret=0x%x\r\n",
|
||||
__func__, priv->cpu_id, ret);
|
||||
return -1;
|
||||
} else {
|
||||
|
||||
@@ -50,12 +50,12 @@ static void matrix_print(struct _matrix *m)
|
||||
unsigned int i, j;
|
||||
|
||||
/* Generate two random matrices */
|
||||
LPRINTF("Printing matrix... \n");
|
||||
LPRINTF("Printing matrix... \r\n");
|
||||
|
||||
for (i = 0; i < m->size; ++i) {
|
||||
for (j = 0; j < m->size; ++j)
|
||||
raw_printf(" %u ", m->elements[i][j]);
|
||||
raw_printf("\n");
|
||||
raw_printf("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,9 @@ static void generate_matrices(int num_matrices,
|
||||
/* Initialize workload */
|
||||
p_matrix[i].size = matrix_size;
|
||||
|
||||
LPRINTF("Input matrix %d \n", i);
|
||||
LPRINTF("Input matrix %d \r\n", i);
|
||||
for (j = 0; j < matrix_size; j++) {
|
||||
raw_printf("\n");
|
||||
raw_printf("\r\n");
|
||||
for (k = 0; k < matrix_size; k++) {
|
||||
|
||||
value = (rand() & 0x7F);
|
||||
@@ -82,7 +82,7 @@ static void generate_matrices(int num_matrices,
|
||||
raw_printf(" %u ", p_matrix[i].elements[j][k]);
|
||||
}
|
||||
}
|
||||
raw_printf("\n");
|
||||
raw_printf("\r\n");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -117,7 +117,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data,
|
||||
(void)priv;
|
||||
(void)src;
|
||||
if (len != sizeof(struct _matrix)) {
|
||||
LPERROR("Received matrix is of invalid len: %d:%lu\n",
|
||||
LPERROR("Received matrix is of invalid len: %d:%lu\r\n",
|
||||
(int)sizeof(struct _matrix), (unsigned long)len);
|
||||
err_cnt++;
|
||||
return RPMSG_SUCCESS;
|
||||
@@ -132,10 +132,10 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data,
|
||||
}
|
||||
}
|
||||
if (err_cnt) {
|
||||
LPERROR("Result mismatched...\n");
|
||||
LPERROR("Expected matrix:\n");
|
||||
LPERROR("Result mismatched...\r\n");
|
||||
LPERROR("Expected matrix:\r\n");
|
||||
matrix_print(&e_matrix);
|
||||
LPERROR("Actual matrix:\n");
|
||||
LPERROR("Actual matrix:\r\n");
|
||||
matrix_print(r_matrix);
|
||||
} else {
|
||||
result_returned = 1;
|
||||
@@ -147,7 +147,7 @@ static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("echo test: service is destroyed\n");
|
||||
LPRINTF("echo test: service is destroyed\r\n");
|
||||
ept_deleted = 1;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ static void rpmsg_name_service_bind_cb(struct rpmsg_device *rdev,
|
||||
const char *name, uint32_t dest)
|
||||
{
|
||||
if (strcmp(name, RPMSG_SERVICE_NAME))
|
||||
LPERROR("Unexpected name service %s.\n", name);
|
||||
LPERROR("Unexpected name service %s.\r\n", name);
|
||||
else
|
||||
(void)rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
|
||||
APP_EPT_ADDR, dest,
|
||||
@@ -172,24 +172,24 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
int c;
|
||||
int ret;
|
||||
|
||||
LPRINTF("Compute thread unblocked ..\n");
|
||||
LPRINTF("It will generate two random matrices.\n");
|
||||
LPRINTF("Send to the remote and get the computation result back.\n");
|
||||
LPRINTF("It will then check if the result is expected.\n");
|
||||
LPRINTF("Compute thread unblocked ..\r\n");
|
||||
LPRINTF("It will generate two random matrices.\r\n");
|
||||
LPRINTF("Send to the remote and get the computation result back.\r\n");
|
||||
LPRINTF("It will then check if the result is expected.\r\n");
|
||||
|
||||
/* Create RPMsg endpoint */
|
||||
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME, APP_EPT_ADDR,
|
||||
RPMSG_ADDR_ANY,
|
||||
rpmsg_endpoint_cb, rpmsg_service_unbind);
|
||||
if (ret) {
|
||||
LPERROR("Failed to create RPMsg endpoint.\n");
|
||||
LPERROR("Failed to create RPMsg endpoint.\r\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (!is_rpmsg_ept_ready(&lept))
|
||||
platform_poll(priv);
|
||||
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\n");
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\r\n");
|
||||
err_cnt = 0;
|
||||
srand(time(NULL));
|
||||
for (c = 0; c < 200; c++) {
|
||||
@@ -200,10 +200,10 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
ret = rpmsg_send(&lept, i_matrix, sizeof(i_matrix));
|
||||
|
||||
if (ret < 0) {
|
||||
LPRINTF("Error sending data...\n");
|
||||
LPRINTF("Error sending data...\r\n");
|
||||
break;
|
||||
}
|
||||
LPRINTF("Matrix multiply: sent : %lu\n",
|
||||
LPRINTF("Matrix multiply: sent : %lu\r\n",
|
||||
(unsigned long)sizeof(i_matrix));
|
||||
do {
|
||||
platform_poll(priv);
|
||||
@@ -213,13 +213,13 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
break;
|
||||
}
|
||||
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF(" Test Results: Error count = %d \n", err_cnt);
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF("**********************************\r\n");
|
||||
LPRINTF(" Test Results: Error count = %d \r\n", err_cnt);
|
||||
LPRINTF("**********************************\r\n");
|
||||
|
||||
/* Detroy RPMsg endpoint */
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("Quitting application .. Matrix multiplication end\n");
|
||||
LPRINTF("Quitting application .. Matrix multiplication end\r\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ int main(int argc, char *argv[])
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
@@ -241,7 +241,7 @@ int main(int argc, char *argv[])
|
||||
NULL,
|
||||
rpmsg_name_service_bind_cb);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -250,7 +250,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -61,7 +61,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
(void)src;
|
||||
|
||||
if ((*(unsigned int *)data) == SHUTDOWN_MSG) {
|
||||
LPRINTF("shutdown message is received.\n");
|
||||
LPRINTF("shutdown message is received.\r\n");
|
||||
shutdown_req = 1;
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
|
||||
/* Send the result of matrix multiplication back to master. */
|
||||
if (rpmsg_send(ept, &matrix_result, sizeof(matrix)) < 0) {
|
||||
LPERROR("rpmsg_send failed\n");
|
||||
LPERROR("rpmsg_send failed\r\n");
|
||||
}
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
LPERROR("Endpoint is destroyed\n");
|
||||
LPERROR("Endpoint is destroyed\r\n");
|
||||
shutdown_req = 1;
|
||||
}
|
||||
|
||||
@@ -95,11 +95,11 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
|
||||
rpmsg_service_unbind);
|
||||
if (ret) {
|
||||
LPERROR("Failed to create endpoint.\n");
|
||||
LPERROR("Failed to create endpoint.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LPRINTF("Waiting for events...\n");
|
||||
LPRINTF("Waiting for events...\r\n");
|
||||
while(1) {
|
||||
platform_poll(priv);
|
||||
/* we got a shutdown request, exit */
|
||||
@@ -121,19 +121,19 @@ int main(int argc, char *argv[])
|
||||
struct rpmsg_device *rpdev;
|
||||
int ret;
|
||||
|
||||
LPRINTF("Starting application...\n");
|
||||
LPRINTF("Starting application...\r\n");
|
||||
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
VIRTIO_DEV_SLAVE,
|
||||
NULL, NULL);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
64
apps/examples/rpc_demo/rpc_demo.c
Executable file → Normal file
64
apps/examples/rpc_demo/rpc_demo.c
Executable file → Normal file
@@ -28,7 +28,7 @@
|
||||
static void rpmsg_rpc_shutdown(struct rpmsg_rpc_data *rpc)
|
||||
{
|
||||
(void)rpc;
|
||||
LPRINTF("RPMSG RPC is shutting down.\n");
|
||||
LPRINTF("RPMSG RPC is shutting down.\r\n");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*
|
||||
@@ -48,63 +48,63 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
int ret;
|
||||
|
||||
/* redirect I/Os */
|
||||
LPRINTF("Initializating I/Os redirection...\n");
|
||||
LPRINTF("Initializating I/Os redirection...\r\n");
|
||||
ret = rpmsg_rpc_init(&rpc, rdev, RPMSG_SERVICE_NAME,
|
||||
RPMSG_ADDR_ANY, RPMSG_ADDR_ANY,
|
||||
priv, platform_poll, rpmsg_rpc_shutdown);
|
||||
rpmsg_set_default_rpc(&rpc);
|
||||
if (ret) {
|
||||
LPRINTF("Failed to intialize rpmsg rpc\n");
|
||||
LPRINTF("Failed to intialize rpmsg rpc\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("\r\nRemote>Baremetal Remote Procedure Call (RPC) Demonstration\r\n");
|
||||
printf("\r\nRemote>***************************************************\r\n");
|
||||
printf("\nRemote>Baremetal Remote Procedure Call (RPC) Demonstration\r\n");
|
||||
printf("\nRemote>***************************************************\r\n");
|
||||
|
||||
printf("\r\nRemote>Rpmsg based retargetting to proxy initialized..\r\n");
|
||||
printf("\nRemote>Rpmsg based retargetting to proxy initialized..\r\n");
|
||||
|
||||
/* Remote performing file IO on Master */
|
||||
printf("\r\nRemote>FileIO demo ..\r\n");
|
||||
printf("\nRemote>FileIO demo ..\r\n");
|
||||
|
||||
printf("\r\nRemote>Creating a file on master and writing to it..\r\n");
|
||||
printf("\nRemote>Creating a file on master and writing to it..\r\n");
|
||||
fd = open(fname, REDEF_O_CREAT | REDEF_O_WRONLY | REDEF_O_APPEND,
|
||||
S_IRUSR | S_IWUSR);
|
||||
printf("\r\nRemote>Opened file '%s' with fd = %d\r\n", fname, fd);
|
||||
printf("\nRemote>Opened file '%s' with fd = %d\r\n", fname, fd);
|
||||
|
||||
sprintf(wbuff, "This is a test string being written to file..");
|
||||
bytes_written = write(fd, wbuff, strlen(wbuff));
|
||||
printf("\r\nRemote>Wrote to fd = %d, size = %d, content = %s\r\n", fd,
|
||||
printf("\nRemote>Wrote to fd = %d, size = %d, content = %s\r\n", fd,
|
||||
bytes_written, wbuff);
|
||||
close(fd);
|
||||
printf("\r\nRemote>Closed fd = %d\r\n", fd);
|
||||
printf("\nRemote>Closed fd = %d\r\n", fd);
|
||||
|
||||
/* Remote performing file IO on Master */
|
||||
printf("\r\nRemote>Reading a file on master and displaying its contents..\r\n");
|
||||
printf("\nRemote>Reading a file on master and displaying its contents..\r\n");
|
||||
fd = open(fname, REDEF_O_RDONLY, S_IRUSR | S_IWUSR);
|
||||
printf("\r\nRemote>Opened file '%s' with fd = %d\r\n", fname, fd);
|
||||
printf("\nRemote>Opened file '%s' with fd = %d\r\n", fname, fd);
|
||||
bytes_read = read(fd, rbuff, 1024);
|
||||
*(char *)(&rbuff[0] + bytes_read + 1) = 0;
|
||||
printf("\r\nRemote>Read from fd = %d, size = %d, printing contents below .. %s\r\n",
|
||||
printf("\nRemote>Read from fd = %d, size = %d, printing contents below .. %s\r\n",
|
||||
fd, bytes_read, rbuff);
|
||||
close(fd);
|
||||
printf("\r\nRemote>Closed fd = %d\r\n", fd);
|
||||
printf("\nRemote>Closed fd = %d\r\n", fd);
|
||||
|
||||
while (1) {
|
||||
/* Remote performing STDIO on Master */
|
||||
printf("\r\nRemote>Remote firmware using scanf and printf ..\r\n");
|
||||
printf("\r\nRemote>Scanning user input from master..\r\n");
|
||||
printf("\r\nRemote>Enter name\r\n");
|
||||
printf("\nRemote>Remote firmware using scanf and printf ..\r\n");
|
||||
printf("\nRemote>Scanning user input from master..\r\n");
|
||||
printf("\nRemote>Enter name\r\n");
|
||||
ret = scanf("%s", ubuff);
|
||||
if (ret) {
|
||||
printf("\r\nRemote>Enter age\r\n");
|
||||
printf("\nRemote>Enter age\r\n");
|
||||
ret = scanf("%d", &idata);
|
||||
if (ret) {
|
||||
printf("\r\nRemote>Enter value for pi\r\n");
|
||||
printf("\nRemote>Enter value for pi\r\n");
|
||||
ret = scanf("%f", &fdata);
|
||||
if (ret) {
|
||||
printf("\r\nRemote>User name = '%s'\r\n", ubuff);
|
||||
printf("\r\nRemote>User age = '%d'\r\n", idata);
|
||||
printf("\r\nRemote>User entered value of pi = '%f'\r\n", fdata);
|
||||
printf("\nRemote>User name = '%s'\r\n", ubuff);
|
||||
printf("\nRemote>User age = '%d'\r\n", idata);
|
||||
printf("\nRemote>User entered value of pi = '%f'\r\n", fdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,22 +112,22 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
scanf("%s", ubuff);
|
||||
printf("Remote> Invalid value. Starting again....");
|
||||
} else {
|
||||
printf("\r\nRemote>Repeat demo ? (enter yes or no) \r\n");
|
||||
printf("\nRemote>Repeat demo ? (enter yes or no) \r\n");
|
||||
scanf("%s", ubuff);
|
||||
if ((strcmp(ubuff, "no")) && (strcmp(ubuff, "yes"))) {
|
||||
printf("\r\nRemote>Invalid option. Starting again....\r\n");
|
||||
printf("\nRemote>Invalid option. Starting again....\r\n");
|
||||
} else if ((!strcmp(ubuff, "no"))) {
|
||||
printf("\r\nRemote>RPC retargetting quitting ...\r\n");
|
||||
printf("\nRemote>RPC retargetting quitting ...\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("\r\nRemote> Firmware's rpmsg-rpc-channel going down! \r\n");
|
||||
printf("\nRemote> Firmware's rpmsg-rpc-channel going down! \r\n");
|
||||
rpccall.id = TERM_SYSCALL_ID;
|
||||
(void)rpmsg_rpc_send(&rpc, &rpccall, sizeof(rpccall), NULL, 0);
|
||||
|
||||
LPRINTF("Release remoteproc procedure call\n");
|
||||
LPRINTF("Release remoteproc procedure call\r\n");
|
||||
rpmsg_rpc_release(&rpc);
|
||||
return 0;
|
||||
}
|
||||
@@ -141,19 +141,19 @@ int main(int argc, char *argv[])
|
||||
struct rpmsg_device *rpdev;
|
||||
int ret;
|
||||
|
||||
LPRINTF("Starting application...\n");
|
||||
LPRINTF("Starting application...\r\n");
|
||||
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
VIRTIO_DEV_SLAVE,
|
||||
NULL, NULL);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
38
apps/examples/rpc_demo/rpc_demod.c
Executable file → Normal file
38
apps/examples/rpc_demo/rpc_demod.c
Executable file → Normal file
@@ -204,7 +204,7 @@ static int handle_rpc(struct rpmsg_rpc_syscall *syscall,
|
||||
}
|
||||
case TERM_SYSCALL_ID:
|
||||
{
|
||||
LPRINTF("Received termination request\n");
|
||||
LPRINTF("Received termination request\r\n");
|
||||
request_termination = 1;
|
||||
retval = 0;
|
||||
break;
|
||||
@@ -212,7 +212,7 @@ static int handle_rpc(struct rpmsg_rpc_syscall *syscall,
|
||||
default:
|
||||
{
|
||||
LPERROR
|
||||
("Invalid RPC sys call ID: %d:%d!\n",
|
||||
("Invalid RPC sys call ID: %d:%d!\r\n",
|
||||
(int)syscall->id, (int)WRITE_SYSCALL_ID);
|
||||
retval = -1;
|
||||
break;
|
||||
@@ -225,7 +225,7 @@ static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
rpmsg_destroy_ept(&app_ept);
|
||||
LPRINTF("Endpoint is destroyed\n");
|
||||
LPRINTF("Endpoint is destroyed\r\n");
|
||||
ept_deleted = 1;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
(void)src;
|
||||
|
||||
if (len < (int)sizeof(*syscall)) {
|
||||
LPERROR("Received data is less than the rpc structure: %d\n",
|
||||
LPERROR("Received data is less than the rpc structure: %d\r\n",
|
||||
len);
|
||||
err_cnt++;
|
||||
return RPMSG_SUCCESS;
|
||||
@@ -253,11 +253,11 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
copy_from_shbuf(buf, data, len);
|
||||
syscall = (struct rpmsg_rpc_syscall *)buf;
|
||||
if (handle_rpc(syscall, ept)) {
|
||||
LPRINTF("\nHandling remote procedure call errors:\n");
|
||||
raw_printf("rpc id %d\n", syscall->id);
|
||||
raw_printf("rpc int field1 %d\n",
|
||||
LPRINTF("\nHandling remote procedure call errors:\r\n");
|
||||
raw_printf("rpc id %d\r\n", syscall->id);
|
||||
raw_printf("rpc int field1 %d\r\n",
|
||||
syscall->args.int_field1);
|
||||
raw_printf("\nrpc int field2 %d\n",
|
||||
raw_printf("\nrpc int field2 %d\r\n",
|
||||
syscall->args.int_field2);
|
||||
err_cnt++;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
|
||||
void terminate_rpc_app()
|
||||
{
|
||||
LPRINTF("Destroying endpoint.\n");
|
||||
LPRINTF("Destroying endpoint.\r\n");
|
||||
if (!ept_deleted)
|
||||
rpmsg_destroy_ept(&app_ept);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ void exit_action_handler(int signum)
|
||||
void kill_action_handler(int signum)
|
||||
{
|
||||
(void)signum;
|
||||
LPRINTF("RPC service killed !!\n");
|
||||
LPRINTF("RPC service killed !!\r\n");
|
||||
|
||||
terminate_rpc_app();
|
||||
|
||||
@@ -309,21 +309,21 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
sigaction(SIGHUP, &kill_action, NULL);
|
||||
|
||||
/* Initialize RPMSG framework */
|
||||
LPRINTF("Try to create rpmsg endpoint.\n");
|
||||
LPRINTF("Try to create rpmsg endpoint.\r\n");
|
||||
|
||||
ret = rpmsg_create_ept(&app_ept, rdev, RPMSG_SERVICE_NAME,
|
||||
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
|
||||
rpmsg_service_unbind);
|
||||
if (ret) {
|
||||
LPERROR("Failed to create endpoint.\n");
|
||||
LPERROR("Failed to create endpoint.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
LPRINTF("Successfully created rpmsg endpoint.\n");
|
||||
LPRINTF("Successfully created rpmsg endpoint.\r\n");
|
||||
while(1) {
|
||||
platform_poll(priv);
|
||||
if (err_cnt) {
|
||||
LPERROR("Got error!\n");
|
||||
LPERROR("Got error!\r\n");
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
break;
|
||||
}
|
||||
}
|
||||
LPRINTF("\nRPC service exiting !!\n");
|
||||
LPRINTF("\nRPC service exiting !!\r\n");
|
||||
|
||||
terminate_rpc_app();
|
||||
return ret;
|
||||
@@ -342,19 +342,19 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
|
||||
LPRINTF("Starting application...\n");
|
||||
LPRINTF("Starting application...\r\n");
|
||||
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
VIRTIO_DEV_MASTER,
|
||||
NULL, NULL);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -363,7 +363,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -36,10 +36,10 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
memset(payload, 0, RPMSG_BUFFER_SIZE);
|
||||
memcpy(payload, data, len);
|
||||
if (++count <= MSG_LIMIT) {
|
||||
LPRINTF("echo message number %u: %s\n",
|
||||
LPRINTF("echo message number %u: %s\r\n",
|
||||
(unsigned int)count, payload);
|
||||
if (rpmsg_send(ept, (char *)data, len) < 0) {
|
||||
LPERROR("rpmsg_send failed\n");
|
||||
LPERROR("rpmsg_send failed\r\n");
|
||||
goto destroy_ept;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ destroy_ept:
|
||||
static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
LPRINTF("unexpected Remote endpoint destroy\n");
|
||||
LPRINTF("unexpected Remote endpoint destroy\r\n");
|
||||
shutdown_req = 1;
|
||||
}
|
||||
|
||||
@@ -69,16 +69,16 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
int ret;
|
||||
|
||||
/* Initialize RPMSG framework */
|
||||
LPRINTF("Try to create rpmsg endpoint.\n");
|
||||
LPRINTF("Try to create rpmsg endpoint.\r\n");
|
||||
|
||||
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERV_NAME, 0, RPMSG_ADDR_ANY,
|
||||
rpmsg_endpoint_cb, rpmsg_service_unbind);
|
||||
if (ret) {
|
||||
LPERROR("Failed to create endpoint.\n");
|
||||
LPERROR("Failed to create endpoint.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LPRINTF("Successfully created rpmsg endpoint.\n");
|
||||
LPRINTF("Successfully created rpmsg endpoint.\r\n");
|
||||
while (1) {
|
||||
platform_poll(priv);
|
||||
/* we got a shutdown request, exit */
|
||||
@@ -100,19 +100,19 @@ int main(int argc, char *argv[])
|
||||
struct rpmsg_device *rpdev;
|
||||
int ret;
|
||||
|
||||
LPRINTF("Starting application...\n");
|
||||
LPRINTF("Starting application...\r\n");
|
||||
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
VIRTIO_DEV_SLAVE,
|
||||
NULL, NULL);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -59,7 +59,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
LPRINTF(" seed %s: \r\n", seed);
|
||||
|
||||
if (strncmp(payload, seed, len)) {
|
||||
LPERROR(" Invalid message is received.\n");
|
||||
LPERROR(" Invalid message is received.\r\n");
|
||||
err_cnt++;
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
@@ -73,16 +73,16 @@ static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("echo test: service is destroyed\n");
|
||||
LPRINTF("echo test: service is destroyed\r\n");
|
||||
ept_deleted = 1;
|
||||
}
|
||||
|
||||
static void rpmsg_name_service_bind_cb(struct rpmsg_device *rdev,
|
||||
const char *name, uint32_t dest)
|
||||
{
|
||||
LPRINTF("new endpoint notification is received.\n");
|
||||
LPRINTF("new endpoint notification is received.\r\n");
|
||||
if (strcmp(name, RPMSG_SERV_NAME))
|
||||
LPERROR("Unexpected name service %s.\n", name);
|
||||
LPERROR("Unexpected name service %s.\r\n", name);
|
||||
else
|
||||
(void)rpmsg_create_ept(&lept, rdev, RPMSG_SERV_NAME,
|
||||
APP_EPT_ADDR, dest,
|
||||
@@ -100,7 +100,7 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
int i;
|
||||
|
||||
LPRINTF(" 1 - Send data to remote core, retrieve the echo");
|
||||
LPRINTF(" and validate its integrity ..\n");
|
||||
LPRINTF(" and validate its integrity ..\r\n");
|
||||
|
||||
/* Create RPMsg endpoint */
|
||||
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERV_NAME, APP_EPT_ADDR,
|
||||
@@ -108,14 +108,14 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
rpmsg_endpoint_cb, rpmsg_service_unbind);
|
||||
|
||||
if (ret) {
|
||||
LPERROR("Failed to create RPMsg endpoint.\n");
|
||||
LPERROR("Failed to create RPMsg endpoint.\r\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (!is_rpmsg_ept_ready(&lept))
|
||||
platform_poll(priv);
|
||||
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\n");
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\r\n");
|
||||
for (i = 1; i <= MSG_LIMIT; i++) {
|
||||
|
||||
|
||||
@@ -125,10 +125,10 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
ret = rpmsg_send(&lept, BYE_MSG, strlen(BYE_MSG));
|
||||
|
||||
if (ret < 0) {
|
||||
LPERROR("Failed to send data...\n");
|
||||
LPERROR("Failed to send data...\r\n");
|
||||
break;
|
||||
}
|
||||
LPRINTF("rpmsg sample test: message %d sent\n", i);
|
||||
LPRINTF("rpmsg sample test: message %d sent\r\n", i);
|
||||
|
||||
do {
|
||||
platform_poll(priv);
|
||||
@@ -136,12 +136,12 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
|
||||
}
|
||||
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF(" Test Results: Error count = %d\n", err_cnt);
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF("**********************************\r\n");
|
||||
LPRINTF(" Test Results: Error count = %d\r\n", err_cnt);
|
||||
LPRINTF("**********************************\r\n");
|
||||
while (!ept_deleted)
|
||||
platform_poll(priv);
|
||||
LPRINTF("Quitting application .. rpmsg sample test end\n");
|
||||
LPRINTF("Quitting application .. rpmsg sample test end\r\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ int main(int argc, char *argv[])
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
||||
NULL,
|
||||
rpmsg_name_service_bind_cb);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -139,7 +139,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
if (!platform) {
|
||||
xil_printf("Failed to initialize platform,"
|
||||
"NULL pointer to store platform data.\n");
|
||||
"NULL pointer to store platform data.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Initialize HW system components */
|
||||
@@ -155,7 +155,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
rproc = platform_create_proc(proc_id, rsc_id);
|
||||
if (!rproc) {
|
||||
xil_printf("Failed to create remoteproc device.\n");
|
||||
xil_printf("Failed to create remoteproc device.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
*platform = rproc;
|
||||
|
||||
@@ -92,26 +92,26 @@ platform_create_proc(int proc_index, int rsc_index)
|
||||
if (!remoteproc_init(&rproc_inst, &zynqmp_linux_r5_proc_ops,
|
||||
&rproc_priv))
|
||||
return NULL;
|
||||
printf("Successfully initialized remoteproc\n");
|
||||
printf("Successfully initialized remoteproc\r\n");
|
||||
|
||||
/* Mmap resource table */
|
||||
pa = RSC_MEM_PA;
|
||||
printf("Calling mmap resource table.\n");
|
||||
printf("Calling mmap resource table.\r\n");
|
||||
rsc_table = remoteproc_mmap(&rproc_inst, &pa, NULL, rsc_size,
|
||||
0, NULL);
|
||||
if (!rsc_table) {
|
||||
fprintf(stderr, "ERROR: Failed to mmap resource table.\n");
|
||||
fprintf(stderr, "ERROR: Failed to mmap resource table.\r\n");
|
||||
return NULL;
|
||||
}
|
||||
printf("Successfully mmap resource table.\n");
|
||||
printf("Successfully mmap resource table.\r\n");
|
||||
/* parse resource table to remoteproc */
|
||||
ret = remoteproc_set_rsc_table(&rproc_inst, rsc_table, rsc_size);
|
||||
if (ret) {
|
||||
printf("Failed to intialize remoteproc\n");
|
||||
printf("Failed to intialize remoteproc\r\n");
|
||||
remoteproc_remove(&rproc_inst);
|
||||
return NULL;
|
||||
}
|
||||
printf("Successfully set resource table to remoteproc.\n");
|
||||
printf("Successfully set resource table to remoteproc.\r\n");
|
||||
|
||||
return &rproc_inst;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
if (!platform) {
|
||||
fprintf(stderr, "Failed to initialize platform, NULL pointer"
|
||||
"to store platform data.\n");
|
||||
"to store platform data.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Initialize HW system components */
|
||||
@@ -140,7 +140,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
rproc = platform_create_proc(proc_id, rsc_id);
|
||||
if (!rproc) {
|
||||
fprintf(stderr, "Failed to create remoteproc device.\n");
|
||||
fprintf(stderr, "Failed to create remoteproc device.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
*platform = rproc;
|
||||
@@ -169,14 +169,14 @@ platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
|
||||
shbuf = metal_io_phys_to_virt(shbuf_io,
|
||||
SHARED_BUF_PA);
|
||||
|
||||
printf("Creating virtio...\n");
|
||||
printf("Creating virtio...\r\n");
|
||||
/* TODO: can we have a wrapper for the following two functions? */
|
||||
vdev = remoteproc_create_virtio(rproc, vdev_index, role, rst_cb);
|
||||
if (!vdev) {
|
||||
printf("failed remoteproc_create_virtio\n");
|
||||
printf("failed remoteproc_create_virtio\r\n");
|
||||
goto err1;
|
||||
}
|
||||
printf("Successfully created virtio device.\n");
|
||||
printf("Successfully created virtio device.\r\n");
|
||||
|
||||
/* Only RPMsg virtio master needs to initialize the shared buffers pool */
|
||||
rpmsg_virtio_init_shm_pool(&shpool, shbuf, SHARED_BUF_SIZE);
|
||||
|
||||
@@ -80,10 +80,10 @@ zynqmp_linux_r5_proc_init(struct remoteproc *rproc,
|
||||
ret = metal_device_open(prproc->shm_bus_name, prproc->shm_name,
|
||||
&dev);
|
||||
if (ret) {
|
||||
fprintf(stderr, "ERROR: failed to open shm device: %d.\n", ret);
|
||||
fprintf(stderr, "ERROR: failed to open shm device: %d.\r\n", ret);
|
||||
goto err1;
|
||||
}
|
||||
printf("Successfully open shm device.\n");
|
||||
printf("Successfully open shm device.\r\n");
|
||||
prproc->shm_dev = dev;
|
||||
prproc->shm_io = metal_device_io_region(dev, 0);
|
||||
if (!prproc->shm_io)
|
||||
@@ -93,19 +93,19 @@ zynqmp_linux_r5_proc_init(struct remoteproc *rproc,
|
||||
metal_io_region_size(prproc->shm_io),
|
||||
prproc->shm_io);
|
||||
remoteproc_add_mem(rproc, &prproc->shm_mem);
|
||||
printf("Successfully added shared memory\n");
|
||||
printf("Successfully added shared memory\r\n");
|
||||
/* Get IPI device */
|
||||
ret = metal_device_open(prproc->ipi_bus_name, prproc->ipi_name,
|
||||
&dev);
|
||||
if (ret) {
|
||||
printf("failed to open ipi device: %d.\n", ret);
|
||||
printf("failed to open ipi device: %d.\r\n", ret);
|
||||
goto err2;
|
||||
}
|
||||
prproc->ipi_dev = dev;
|
||||
prproc->ipi_io = metal_device_io_region(dev, 0);
|
||||
if (!prproc->ipi_io)
|
||||
goto err3;
|
||||
printf("Successfully probed IPI device\n");
|
||||
printf("Successfully probed IPI device\r\n");
|
||||
atomic_store(&prproc->ipi_nokick, 1);
|
||||
|
||||
/* Register interrupt handler and enable interrupt */
|
||||
@@ -114,7 +114,7 @@ zynqmp_linux_r5_proc_init(struct remoteproc *rproc,
|
||||
metal_irq_enable(irq_vect);
|
||||
metal_io_write32(prproc->ipi_io, IPI_IER_OFFSET,
|
||||
prproc->ipi_chn_mask);
|
||||
printf("Successfully initialized Linux r5 remoteproc.\n");
|
||||
printf("Successfully initialized Linux r5 remoteproc.\r\n");
|
||||
return rproc;
|
||||
err3:
|
||||
metal_device_close(prproc->ipi_dev);
|
||||
|
||||
@@ -148,7 +148,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
if (!platform) {
|
||||
xil_printf("Failed to initialize platform,"
|
||||
"NULL pointer to store platform data.\n");
|
||||
"NULL pointer to store platform data.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Initialize HW system components */
|
||||
@@ -164,7 +164,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
rproc = platform_create_proc(proc_id, rsc_id);
|
||||
if (!rproc) {
|
||||
xil_printf("Failed to create remoteproc device.\n");
|
||||
xil_printf("Failed to create remoteproc device.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
*platform = rproc;
|
||||
|
||||
@@ -82,7 +82,7 @@ int init_system(void)
|
||||
/* Initialize metal Xilinx IRQ controller */
|
||||
ret = metal_xlnx_irq_init();
|
||||
if (ret) {
|
||||
xil_printf("%s: Xilinx metal IRQ controller init failed.\n",
|
||||
xil_printf("%s: Xilinx metal IRQ controller init failed.\r\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ int init_system(void)
|
||||
/* Initialize metal Xilinx IRQ controller */
|
||||
ret = metal_xlnx_irq_init();
|
||||
if (ret) {
|
||||
xil_printf("%s: Xilinx metal IRQ controller init failed.\n",
|
||||
xil_printf("%s: Xilinx metal IRQ controller init failed.\r\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ static int sk_unix_client(const char *descr)
|
||||
strncpy(addr.sun_path, descr + strlen(UNIX_PREFIX),
|
||||
sizeof addr.sun_path);
|
||||
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) >= 0) {
|
||||
printf("connected to %s\n", descr + strlen(UNIX_PREFIX));
|
||||
printf("connected to %s\r\n", descr + strlen(UNIX_PREFIX));
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ static int sk_unix_server(const char *descr)
|
||||
}
|
||||
|
||||
listen(fd, 5);
|
||||
printf("Waiting for connection on %s\n", addr.sun_path);
|
||||
printf("Waiting for connection on %s\r\n", addr.sun_path);
|
||||
nfd = accept(fd, NULL, NULL);
|
||||
close(fd);
|
||||
return nfd;
|
||||
@@ -207,7 +207,7 @@ static int event_open(const char *descr)
|
||||
/* UNIX server. */
|
||||
fd = sk_unix_server(descr);
|
||||
}
|
||||
printf("Open IPI: %s\n", descr);
|
||||
printf("Open IPI: %s\r\n", descr);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ linux_proc_init(struct remoteproc *rproc,
|
||||
/* Create shared memory io */
|
||||
ret = metal_shmem_open(prproc->shm_file, prproc->shm_size, &io);
|
||||
if (ret) {
|
||||
printf("Failed to init rproc, failed to open shm %s.\n",
|
||||
printf("Failed to init rproc, failed to open shm %s.\r\n",
|
||||
prproc->shm_file);
|
||||
return NULL;
|
||||
}
|
||||
@@ -254,13 +254,13 @@ linux_proc_init(struct remoteproc *rproc,
|
||||
ipi = &prproc->ipi;
|
||||
if (!ipi->path) {
|
||||
fprintf(stderr,
|
||||
"ERROR: No IPI sock path specified.\n");
|
||||
"ERROR: No IPI sock path specified.\r\n");
|
||||
goto err;
|
||||
}
|
||||
ipi->fd = event_open(ipi->path);
|
||||
if (ipi->fd < 0) {
|
||||
fprintf(stderr,
|
||||
"ERROR: Failed to open sock %s for IPI.\n",
|
||||
"ERROR: Failed to open sock %s for IPI.\r\n",
|
||||
ipi->path);
|
||||
goto err;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ static int platform_slave_setup_resource_table(const char *shm_file,
|
||||
|
||||
ret = metal_shmem_open(shm_file, shm_size, &io);
|
||||
if (ret) {
|
||||
printf("Failed to init rproc, failed to open shm %s.\n",
|
||||
printf("Failed to init rproc, failed to open shm %s.\r\n",
|
||||
shm_file);
|
||||
return -1;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ platform_create_proc(int proc_index, int rsc_index)
|
||||
rsc_table, rsc_size,
|
||||
RSC_MEM_PA);
|
||||
if (ret) {
|
||||
printf("Failed to initialize resource table\n");
|
||||
printf("Failed to initialize resource table\r\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -442,7 +442,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
if (!platform) {
|
||||
fprintf(stderr, "Failed to initialize platform, NULL pointer"
|
||||
"to store platform data.\n");
|
||||
"to store platform data.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Initialize HW system components */
|
||||
@@ -458,7 +458,7 @@ int platform_init(int argc, char *argv[], void **platform)
|
||||
|
||||
rproc = platform_create_proc(proc_id, rsc_id);
|
||||
if (!rproc) {
|
||||
fprintf(stderr, "Failed to create remoteproc device.\n");
|
||||
fprintf(stderr, "Failed to create remoteproc device.\r\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
*platform = rproc;
|
||||
|
||||
@@ -54,7 +54,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
(void)len;
|
||||
|
||||
if (r_payload->size == 0 || r_payload->size > 496) {
|
||||
LPERROR(" Invalid size of package is received 0x%x.\n",
|
||||
LPERROR(" Invalid size of package is received 0x%x.\r\n",
|
||||
(unsigned int)r_payload->size);
|
||||
err_cnt++;
|
||||
return RPMSG_SUCCESS;
|
||||
@@ -64,7 +64,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
i_buf = (unsigned char*)i_payload->data;
|
||||
for (i = 0; i < (unsigned int)r_payload->size; i++) {
|
||||
if (*r_buf != *i_buf) {
|
||||
LPERROR("Data corruption %lu, size %lu\n",
|
||||
LPERROR("Data corruption %lu, size %lu\r\n",
|
||||
r_payload->num, r_payload->size);
|
||||
err_cnt++;
|
||||
break;
|
||||
@@ -80,16 +80,16 @@ static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("echo test: service is destroyed\n");
|
||||
LPRINTF("echo test: service is destroyed\r\n");
|
||||
ept_deleted = 1;
|
||||
}
|
||||
|
||||
static void rpmsg_name_service_bind_cb(struct rpmsg_device *rdev,
|
||||
const char *name, uint32_t dest)
|
||||
{
|
||||
LPRINTF("new endpoint notification is received.\n");
|
||||
LPRINTF("new endpoint notification is received.\r\n");
|
||||
if (strcmp(name, RPMSG_SERVICE_NAME))
|
||||
LPERROR("Unexpected name service %s.\n", name);
|
||||
LPERROR("Unexpected name service %s.\r\n", name);
|
||||
else
|
||||
(void)rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
|
||||
APP_EPT_ADDR, dest,
|
||||
@@ -108,18 +108,18 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
int num_pkgs;
|
||||
|
||||
LPRINTF(" 1 - Send data to remote core, retrieve the echo");
|
||||
LPRINTF(" and validate its integrity ..\n");
|
||||
LPRINTF(" and validate its integrity ..\r\n");
|
||||
|
||||
num_pkgs = NUMS_PACKAGES;
|
||||
max_size = rpmsg_virtio_get_buffer_size(rdev);
|
||||
if (max_size < 0) {
|
||||
LPERROR("No avaiable buffer size.\n");
|
||||
LPERROR("No avaiable buffer size.\r\n");
|
||||
return -1;
|
||||
}
|
||||
i_payload = (struct _payload *)metal_allocate_memory(max_size);
|
||||
|
||||
if (!i_payload) {
|
||||
LPERROR("memory allocation failed.\n");
|
||||
LPERROR("memory allocation failed.\r\n");
|
||||
return -1;
|
||||
}
|
||||
max_size -= sizeof(struct _payload);
|
||||
@@ -129,13 +129,13 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
RPMSG_ADDR_ANY,
|
||||
rpmsg_endpoint_cb, rpmsg_service_unbind);
|
||||
if (ret) {
|
||||
LPERROR("Failed to create RPMsg endpoint.\n");
|
||||
LPERROR("Failed to create RPMsg endpoint.\r\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (!is_rpmsg_ept_ready(&lept))
|
||||
platform_poll(priv);
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\n");
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\r\n");
|
||||
|
||||
memset(&(i_payload->data[0]), 0xA5, max_size);
|
||||
for (s = PAYLOAD_MIN_SIZE; s <= max_size; s++) {
|
||||
@@ -143,7 +143,7 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
|
||||
i_payload->size = s;
|
||||
size = sizeof(struct _payload) + s;
|
||||
LPRINTF("echo test: package size %d, num of packages: %d\n",
|
||||
LPRINTF("echo test: package size %d, num of packages: %d\r\n",
|
||||
size, num_pkgs);
|
||||
rnum = 0;
|
||||
for (i = 0; i < num_pkgs; i++) {
|
||||
@@ -153,7 +153,7 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
if (ret == RPMSG_ERR_NO_BUFF) {
|
||||
platform_poll(priv);
|
||||
} else if (ret < 0) {
|
||||
LPERROR("Failed to send data...\n");
|
||||
LPERROR("Failed to send data...\r\n");
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
@@ -174,12 +174,12 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
if (ept_deleted)
|
||||
LPRINTF("Remote RPMsg endpoint is destroyed unexpected.\r\n");
|
||||
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF(" Test Results: Error count = %d \n", err_cnt);
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF("**********************************\r\n");
|
||||
LPRINTF(" Test Results: Error count = %d \r\n", err_cnt);
|
||||
LPRINTF("**********************************\r\n");
|
||||
/* Destroy the RPMsg endpoint */
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("Quitting application .. Echo test end\n");
|
||||
LPRINTF("Quitting application .. Echo test end\r\n");
|
||||
|
||||
metal_free_memory(i_payload);
|
||||
return 0;
|
||||
@@ -194,7 +194,7 @@ int main(int argc, char *argv[])
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
@@ -202,7 +202,7 @@ int main(int argc, char *argv[])
|
||||
NULL,
|
||||
rpmsg_name_service_bind_cb);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -211,7 +211,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -52,14 +52,14 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
r_payload->num, (unsigned long)len);
|
||||
|
||||
if (r_payload->size == 0) {
|
||||
LPERROR(" Invalid size of package is received.\n");
|
||||
LPERROR(" Invalid size of package is received.\r\n");
|
||||
err_cnt++;
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
/* Validate data buffer integrity. */
|
||||
for (i = 0; i < (int)r_payload->size; i++) {
|
||||
if (r_payload->data[i] != 0xA5) {
|
||||
LPRINTF("Data corruption at index %d\n", i);
|
||||
LPRINTF("Data corruption at index %d\r\n", i);
|
||||
err_cnt++;
|
||||
break;
|
||||
}
|
||||
@@ -72,16 +72,16 @@ static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("echo test: service is destroyed\n");
|
||||
LPRINTF("echo test: service is destroyed\r\n");
|
||||
ept_deleted = 1;
|
||||
}
|
||||
|
||||
static void rpmsg_name_service_bind_cb(struct rpmsg_device *rdev,
|
||||
const char *name, uint32_t dest)
|
||||
{
|
||||
LPRINTF("new endpoint notification is received.\n");
|
||||
LPRINTF("new endpoint notification is received.\r\n");
|
||||
if (strcmp(name, RPMSG_SERVICE_NAME))
|
||||
LPERROR("Unexpected name service %s.\n", name);
|
||||
LPERROR("Unexpected name service %s.\r\n", name);
|
||||
else
|
||||
(void)rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
|
||||
APP_EPT_ADDR, dest,
|
||||
@@ -101,11 +101,11 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
int expect_rnum = 0;
|
||||
|
||||
LPRINTF(" 1 - Send data to remote core, retrieve the echo");
|
||||
LPRINTF(" and validate its integrity ..\n");
|
||||
LPRINTF(" and validate its integrity ..\r\n");
|
||||
|
||||
max_size = rpmsg_virtio_get_buffer_size(rdev);
|
||||
if (max_size < 0) {
|
||||
LPERROR("No avaiable buffer size.\n");
|
||||
LPERROR("No avaiable buffer size.\r\n");
|
||||
return -1;
|
||||
}
|
||||
max_size -= sizeof(struct _payload);
|
||||
@@ -115,7 +115,7 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
max_size);
|
||||
|
||||
if (!i_payload) {
|
||||
LPERROR("memory allocation failed.\n");
|
||||
LPERROR("memory allocation failed.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -125,14 +125,14 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
rpmsg_endpoint_cb, rpmsg_service_unbind);
|
||||
|
||||
if (ret) {
|
||||
LPERROR("Failed to create RPMsg endpoint.\n");
|
||||
LPERROR("Failed to create RPMsg endpoint.\r\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (!is_rpmsg_ept_ready(&lept))
|
||||
platform_poll(priv);
|
||||
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\n");
|
||||
LPRINTF("RPMSG endpoint is binded with remote.\r\n");
|
||||
for (i = 0, size = PAYLOAD_MIN_SIZE; i < num_payloads; i++, size++) {
|
||||
i_payload->num = i;
|
||||
i_payload->size = size;
|
||||
@@ -140,7 +140,7 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
/* Mark the data buffer. */
|
||||
memset(&(i_payload->data[0]), 0xA5, size);
|
||||
|
||||
LPRINTF("sending payload number %lu of size %lu\n",
|
||||
LPRINTF("sending payload number %lu of size %lu\r\n",
|
||||
i_payload->num,
|
||||
(unsigned long)(2 * sizeof(unsigned long)) + size);
|
||||
|
||||
@@ -148,10 +148,10 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
(2 * sizeof(unsigned long)) + size);
|
||||
|
||||
if (ret < 0) {
|
||||
LPERROR("Failed to send data...\n");
|
||||
LPERROR("Failed to send data...\r\n");
|
||||
break;
|
||||
}
|
||||
LPRINTF("echo test: sent : %lu\n",
|
||||
LPRINTF("echo test: sent : %lu\r\n",
|
||||
(unsigned long)(2 * sizeof(unsigned long)) + size);
|
||||
|
||||
expect_rnum++;
|
||||
@@ -161,12 +161,12 @@ int app (struct rpmsg_device *rdev, void *priv)
|
||||
|
||||
}
|
||||
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF(" Test Results: Error count = %d \n", err_cnt);
|
||||
LPRINTF("**********************************\n");
|
||||
LPRINTF("**********************************\r\n");
|
||||
LPRINTF(" Test Results: Error count = %d \r\n", err_cnt);
|
||||
LPRINTF("**********************************\r\n");
|
||||
/* Destroy the RPMsg endpoint */
|
||||
rpmsg_destroy_ept(&lept);
|
||||
LPRINTF("Quitting application .. Echo test end\n");
|
||||
LPRINTF("Quitting application .. Echo test end\r\n");
|
||||
|
||||
metal_free_memory(i_payload);
|
||||
return 0;
|
||||
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
||||
NULL,
|
||||
rpmsg_name_service_bind_cb);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -198,7 +198,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -32,7 +32,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
|
||||
/* On reception of a shutdown we signal the application to terminate */
|
||||
if ((*(unsigned int *)data) == SHUTDOWN_MSG) {
|
||||
LPRINTF("shutdown message is received.\n");
|
||||
LPRINTF("shutdown message is received.\r\n");
|
||||
shutdown_req = 1;
|
||||
return RPMSG_SUCCESS;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
|
||||
ret = rpmsg_send(ept, data, len);
|
||||
if (ret == RPMSG_ERR_NO_BUFF) {
|
||||
LPRINTF("%s, wait for buffer\n", __func__);
|
||||
LPRINTF("%s, wait for buffer\r\n", __func__);
|
||||
continue;
|
||||
} else {
|
||||
if (ret < 0)
|
||||
@@ -58,7 +58,7 @@ static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
|
||||
static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
|
||||
{
|
||||
(void)ept;
|
||||
LPRINTF("unexpected Remote endpoint destroy\n");
|
||||
LPRINTF("unexpected Remote endpoint destroy\r\n");
|
||||
shutdown_req = 1;
|
||||
}
|
||||
|
||||
@@ -70,17 +70,17 @@ int app(struct rpmsg_device *rdev, void *priv)
|
||||
int ret;
|
||||
|
||||
/* Initialize RPMSG framework */
|
||||
LPRINTF("Try to create rpmsg endpoint.\n");
|
||||
LPRINTF("Try to create rpmsg endpoint.\r\n");
|
||||
|
||||
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME,
|
||||
0, RPMSG_ADDR_ANY, rpmsg_endpoint_cb,
|
||||
rpmsg_service_unbind);
|
||||
if (ret) {
|
||||
LPERROR("Failed to create endpoint.\n");
|
||||
LPERROR("Failed to create endpoint.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LPRINTF("Successfully created rpmsg endpoint.\n");
|
||||
LPRINTF("Successfully created rpmsg endpoint.\r\n");
|
||||
while(1) {
|
||||
platform_poll(priv);
|
||||
/* we got a shutdown request, exit */
|
||||
@@ -102,19 +102,19 @@ int main(int argc, char *argv[])
|
||||
struct rpmsg_device *rpdev;
|
||||
int ret;
|
||||
|
||||
LPRINTF("Starting application...\n");
|
||||
LPRINTF("Starting application...\r\n");
|
||||
|
||||
/* Initialize platform */
|
||||
ret = platform_init(argc, argv, &platform);
|
||||
if (ret) {
|
||||
LPERROR("Failed to initialize platform.\n");
|
||||
LPERROR("Failed to initialize platform.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
rpdev = platform_create_rpmsg_vdev(platform, 0,
|
||||
VIRTIO_DEV_SLAVE,
|
||||
NULL, NULL);
|
||||
if (!rpdev) {
|
||||
LPERROR("Failed to create rpmsg virtio device.\n");
|
||||
LPERROR("Failed to create rpmsg virtio device.\r\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
app(rpdev, platform);
|
||||
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
LPRINTF("Stopping application...\n");
|
||||
LPRINTF("Stopping application...\r\n");
|
||||
platform_cleanup(platform);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -412,7 +412,7 @@ int remoteproc_load(struct remoteproc *rproc, const char *path,
|
||||
ret = store_ops->open(store, path, &img_data);
|
||||
if (ret <= 0) {
|
||||
metal_log(METAL_LOG_ERROR,
|
||||
"load failure: failed to open firmware %d.\n",
|
||||
"load failure: failed to open firmware %d.\r\n",
|
||||
ret);
|
||||
metal_mutex_release(&rproc->lock);
|
||||
return -RPROC_EINVAL;
|
||||
@@ -427,7 +427,7 @@ int remoteproc_load(struct remoteproc *rproc, const char *path,
|
||||
loader = remoteproc_check_fw_format(img_data, len);
|
||||
if (!loader) {
|
||||
metal_log(METAL_LOG_ERROR,
|
||||
"load failure: failed to get store ops.\n");
|
||||
"load failure: failed to get store ops.\r\n");
|
||||
ret = -RPROC_EINVAL;
|
||||
goto error1;
|
||||
}
|
||||
@@ -608,7 +608,7 @@ int remoteproc_load(struct remoteproc *rproc, const char *path,
|
||||
rproc->rsc_len = rsc_size;
|
||||
} else {
|
||||
metal_log(METAL_LOG_WARNING,
|
||||
"load: not able to update rsc table.\n");
|
||||
"load: not able to update rsc table.\r\n");
|
||||
}
|
||||
metal_free_memory(rsc_table_cp);
|
||||
/* So that the rsc_table will not get released */
|
||||
@@ -689,7 +689,7 @@ int remoteproc_load_noblock(struct remoteproc *rproc,
|
||||
loader = remoteproc_check_fw_format(img_data, len);
|
||||
if (!loader) {
|
||||
metal_log(METAL_LOG_ERROR,
|
||||
"load failure: failed to identify image.\n");
|
||||
"load failure: failed to identify image.\r\n");
|
||||
ret = -RPROC_EINVAL;
|
||||
metal_mutex_release(&rproc->lock);
|
||||
return -RPROC_EINVAL;
|
||||
@@ -723,7 +723,6 @@ int remoteproc_load_noblock(struct remoteproc *rproc,
|
||||
metal_log(METAL_LOG_ERROR,
|
||||
"load header failed 0x%lx,%d.\r\n",
|
||||
offset, len);
|
||||
|
||||
goto error1;
|
||||
}
|
||||
last_load_state = ret;
|
||||
|
||||
@@ -334,18 +334,18 @@ static int rpmsg_virtio_send_offchannel_raw(struct rpmsg_device *rdev,
|
||||
io = rvdev->shbuf_io;
|
||||
status = metal_io_block_write(io, metal_io_virt_to_offset(io, buffer),
|
||||
&rp_hdr, sizeof(rp_hdr));
|
||||
RPMSG_ASSERT(status == sizeof(rp_hdr), "failed to write header\n");
|
||||
RPMSG_ASSERT(status == sizeof(rp_hdr), "failed to write header\r\n");
|
||||
|
||||
status = metal_io_block_write(io,
|
||||
metal_io_virt_to_offset(io,
|
||||
RPMSG_LOCATE_DATA(buffer)),
|
||||
data, size);
|
||||
RPMSG_ASSERT(status == size, "failed to write buffer\n");
|
||||
RPMSG_ASSERT(status == size, "failed to write buffer\r\n");
|
||||
metal_mutex_acquire(&rdev->lock);
|
||||
|
||||
/* Enqueue buffer on virtqueue. */
|
||||
status = rpmsg_virtio_enqueue_buffer(rvdev, buffer, buff_len, idx);
|
||||
RPMSG_ASSERT(status == VQUEUE_SUCCESS, "failed to enqueue buffer\n");
|
||||
RPMSG_ASSERT(status == VQUEUE_SUCCESS, "failed to enqueue buffer\r\n");
|
||||
/* Let the other side know that there is a job to process. */
|
||||
virtqueue_kick(rvdev->svq);
|
||||
|
||||
@@ -412,7 +412,7 @@ static void rpmsg_virtio_rx_callback(struct virtqueue *vq)
|
||||
rp_hdr->len, rp_hdr->src, ept->priv);
|
||||
|
||||
RPMSG_ASSERT(status == RPMSG_SUCCESS,
|
||||
"unexpected callback status\n");
|
||||
"unexpected callback status\r\n");
|
||||
}
|
||||
|
||||
metal_mutex_acquire(&rdev->lock);
|
||||
|
||||
Reference in New Issue
Block a user