工具/软件:
您好、
Im 处理的工程使用了 rpmsg/ti-rpmsg-char。 此选项在运行时投影单个。 但我想说明如何实现与我自己的工程相同的功能、即我自己的工程具有更多功能、并且使用 rpmsg 与 MCU 进行通信、这是该工程包含的特性之一。 我在努力实现它。
此致、
Bawantha.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具/软件:
您好、
Im 处理的工程使用了 rpmsg/ti-rpmsg-char。 此选项在运行时投影单个。 但我想说明如何实现与我自己的工程相同的功能、即我自己的工程具有更多功能、并且使用 rpmsg 与 MCU 进行通信、这是该工程包含的特性之一。 我在努力实现它。
此致、
Bawantha.
您好、
很抱歉、我忘了提及它。 正在 Linux Processor SDK 上进行开发。 我做了一些挖掘,并找到了一种方法来做到这一点。 您能确认这是否是最好的方法吗
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#define RPMSG_DEVICE "/dev/rpmsg0"
#define GET_COMMAND "GET_DATA\n"
#define BUFFER_SIZE 128
#define POLL_INTERVAL_SEC 4000 // Delay between requests in microseconds
void rpmsg_poll_loop(void) {
int fd;
char buffer[BUFFER_SIZE];
ssize_t bytes_written, bytes_read;
// Open RPMsg device
fd = open(RPMSG_DEVICE, O_RDWR);
if (fd < 0) {
perror("Error opening RPMsg device");
return;
}
printf("Starting continuous RPMsg polling...\n");
while (1) {
// Send "GET DATA\n" to MCU
bytes_written = write(fd, GET_COMMAND, strlen(GET_COMMAND));
if (bytes_written < 0) {
perror("Error writing to RPMsg device");
break;
}
printf("Sent: %s", GET_COMMAND);
// Read response from MCU
bytes_read = read(fd, buffer, BUFFER_SIZE - 1);
if (bytes_read < 0) {
perror("Error reading from RPMsg device");
break;
}
buffer[bytes_read] = '\0'; // Null-terminate the string
printf("Received: %s\n", buffer);
usleep(POLL_INTERVAL_SEC); // Wait before next request
}
close(fd);
}
谢谢、
Bawantha.
您好、Bawantha、
如果您想查看任何其他注释、可以向我提供有关您的用例的更多信息。
例如:
您发送的数据是什么? 数据流向哪个方向?
一次发送多少数据?
是否有吞吐量要求?
有延迟要求吗?
等
此致、
Nick