#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <sys/select.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stddef.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <stdbool.h>
#include <semaphore.h>
#include <linux/rpmsg.h>
#include <ti_rpmsg_char.h>
#include <rpmsg_char_simple.h>
#define NUM_ITERATIONS 100
#define REMOTE_ENDPT 14
int rpmsg_char_ping(int rproc_id, char *dev_name, unsigned int local_endpt, unsigned int remote_endpt,
int num_msgs)
{
int ret = 0;
int i = 0;
int packet_len;
char eptdev_name[32] = { 0 };
char packet_buf[512] = { 0 };
rpmsg_char_dev_t *rcdev;
int flags = 0;
/*
* Open the remote rpmsg device identified by dev_name and bind the
* device to a local end-point used for receiving messages from
* remote processor
*/
// sprintf(eptdev_name, "rpmsg-char-%d-%d", rproc_id, getpid());
rcdev = rpmsg_char_open(rproc_id, dev_name, local_endpt, remote_endpt, 编译出错 .c .h 文件都拷贝进工程
eptdev_name, flags);
if (!rcdev) {
// perror("Can't create an endpoint device");
return -EPERM;
}
// printf("Created endpt device %s, fd = %d port = %d\n", eptdev_name,
// rcdev->fd, rcdev->endpt);
// printf("Exchanging %d messages with rpmsg device %s on rproc id %d ...\n\n",
// num_msgs, eptdev_name, rproc_id);