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.

AM625: 找不到 函数 rpmsg_char_open(rproc_id, dev_name, local_endpt, remote_endpt, eptdev_name, flags)

Part Number: AM625

#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);

  • 原型函数是这样的:

    rpmsg_char_dev_t *rpmsg_char_open(enum rproc_id id, char *dev_name,      <----    函数名前带 * 号,rproc_id id 数据类型不同
    unsigned int local_endpt,
    unsigned int remote_endpt,
    char *eptdev_name, int flags)
    {
    struct rpmsg_char_endpt *ept = NULL;
    char *def_dev_name = "rpmsg_chrdev";
    int ret;

    pthread_mutex_lock(&mutex);

    if (!inited) {
    fprintf(stderr, "%s cannot be invoked without initialization\n",
    __func__);
    goto unlock;
    }

    if (remote_endpt == RPMSG_ADDR_ANY) {
    fprintf(stderr, "%s: remote_endpt cannot be RPMSG_ADDR_ANY\n",
    __func__);
    goto unlock;
    }

    if (!eptdev_name || strlen(eptdev_name) >= 32) {
    fprintf(stderr, "%s: invalid eptdev_name\n", __func__);
    goto unlock;
    }

    if (!dev_name)
    dev_name = def_dev_name;

    ept = _rpmsg_char_endpt_alloc();
    if (!ept)
    goto unlock;

    ret = _rpmsg_char_find_rproc(ept, id);
    if (ret)
    goto out;

    ret = _rpmsg_char_find_ctrldev(ept, dev_name, remote_endpt);
    if (ret)
    goto out;

    ret = _rpmsg_char_create_eptdev(ept, eptdev_name, local_endpt, remote_endpt);
    if (ret)
    goto out;

    ret = _rpmsg_char_open_eptdev(ept, eptdev_name, flags);
    if (ret < 0)
    goto out;

    _list_add(ept);
    goto unlock;

    out:
    _rpmsg_char_endpt_free(ept);
    ept = NULL;
    unlock:
    pthread_mutex_unlock(&mutex);
    return ept ? &ept->rcdev : NULL;
    }

  • ubuntu@ubuntu1804:~/Downloads/ti-rpmsg-char-55a6f4032246631a309f8608af5e822024664b59$ ls
    Makefile.am TI_RPMsg_Char_0.1.0_manifest.html examples src
    README configure.ac include
    ubuntu@ubuntu1804:~/Downloads/ti-rpmsg-char-55a6f4032246631a309f8608af5e822024664b59$ autoreconf -i
    Can't locate Autom4te/ChannelDefs.pm in @INC (you may need to install the Autom4te::ChannelDefs module) (@INC contains: /home/book/buildroot_100ask_t113-pro/buildroot/output/host/share/autoconf /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /home/ubuntu/100ask_t113-pro/arm-buildroot-linux-gnueabi_sdk-buildroot/bin/autoreconf line 52.
    BEGIN failed--compilation aborted at /home/ubuntu/100ask_t113-pro/arm-buildroot-linux-gnueabi_sdk-buildroot/bin/autoreconf line 52.
    ubuntu@ubuntu1804:~/Downloads/ti-rpmsg-char-55a6f4032246631a309f8608af5e822024664b59$

    用命令行编译也不行   autoreconf -i 命令出错,是 AM62 Linux 工具链的问题吗?

  • sudo apt-get update
    sudo apt-get install autoconf automake libtool
    

    确保你的系统中安装了所有必要的自动工具(auto tools),包括 Autoconf、Automake 和 Libtool