Tda4-am62ax-IPC驱动

IPC器件等地址分配表

ti-processor-sdk-rtos-j721s2-evm-08_06_00_11/vision_apps/platform/j721s2/rtos/system_memory_map.html
在这里插入图片描述

ti-rpmsg-char 中与处理器相关
在这里插入图片描述
通讯主要点:CPU ID+端口

index : rpmsg/ti-rpmsg-char

 git clone https://git.ti.com/git/rpmsg/ti-rpmsg-char.git

AM5728 IPC机制解析

8.5. Developing IPC applications

【TDA4系列】 IPC applications应用举例

在这里插入图片描述

./board-support/linux-kernel/drivers/virtio/virtio.c

register_virtio_device
在这里插入图片描述

virtio_dev_probe

在这里插入图片描述
在这里插入图片描述
驱动probe标记接口

static inline
void virtio_device_ready(struct virtio_device *dev)
{
	unsigned status = dev->config->get_status(dev);

	BUG_ON(status & VIRTIO_CONFIG_S_DRIVER_OK);
	dev->config->set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK);
}

驱动probe标记

./board-support/linux-kernel/drivers/rpmsg/virtio_rpmsg_bus.c:1048:     virtio_device_ready(vdev);

./board-support/linux-kernel/include/uapi/linux/virtio_config.h

/* Status byte for guest to report progress, and synchronize features. */
/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
#define VIRTIO_CONFIG_S_ACKNOWLEDGE     1
/* We have found a driver for the device. */
#define VIRTIO_CONFIG_S_DRIVER          2
/* Driver has used its parts of the config, and is happy */
#define VIRTIO_CONFIG_S_DRIVER_OK       4
/* Driver has finished configuring features */
#define VIRTIO_CONFIG_S_FEATURES_OK     8
/* Device entered invalid state, driver must reset it */
#define VIRTIO_CONFIG_S_NEEDS_RESET     0x40
/* We've given up on this device. */
#define VIRTIO_CONFIG_S_FAILED          0x80

Wait for Linux VDev ready successfully.
Initialize Virtio successfully.
IPCDevice_Init RPMessage announce localendpoint(14), service(rpmsg_chrdev)
Initialize RPMessage successfully.

Z:\ti_sdk_8.4\ti-processor-sdk-rtos-j721e-evm-08_04_00_02\mcusw\mcuss_demos\profiling\can\ipcclient\ipc_device.c

int32_t IPCDevice_Init(const char* serviceChrDev, uint32_t localEndpoint)

   /* Step2 : Wait for Linux VDev ready... */
    for(i = 0; i < procNum; i++)
    {
        while(!Ipc_isRemoteReady(procs[i]))
        {
            TaskP_sleep(10);
        }
    }

    UART_printf("Wait for Linux VDev ready successfully.\n");
Y:\tisdk8.4\ti-processor-sdk-rtos-j721e-evm-08_04_00_02\mcusw\mcuss_demos\profiling\can\main_tirtos.c

mcu1-0 打印

enter MCU IPC RX task
Set local device proc id(1) successfully.
Add device(MPU1_0) successfully.
Get an actived device proc(0).
Get all active devices number(1) successfully.
Initialize the multiproc (1) successfully.
Wait for Linux VDev ready successfully.
Initialize Virtio successfully.
IPCDevice_Init RPMessage announce localendpoint(14), service(rpmsg_chrdev)
Initialize RPMessage successfully.
#if defined(IPC_COMM)//defined(IPC_ENABLE)
		TaskP_Params_init(&taskParams);
		/* Set the task priority higher than the default priority (1) */
		taskParams.name = "IPC RX task";
		taskParams.priority = 6;
		taskParams.stack        = ipcdevice_RXStack;
		taskParams.stacksize    = sizeof (ipcdevice_RXStack);

		task = TaskP_create(IPCdemo_taskFxn, &taskParams);
		if(NULL == task)
		{
			OS_stop();
		}		
//
		
		/* Step 5: Start receive task */
		TaskP_Params_init(&taskParams);
		taskParams.name = "IPC TX task";
		taskParams.priority   = 7;
		taskParams.stack      = ipcdevice_TXStack;
		taskParams.stacksize  = sizeof(ipcdevice_TXStack);
		task = TaskP_create(IPCDevice_SendProc, &taskParams);
		if(NULL == task)
		{
			OS_stop();
		}
#endif	
static void IPCdemo_taskFxn(void* a0, void* a1)
{
	Boot_wait();
	
	//AppUtils_Printf(MSG_NORMAL, "enter taskFxn Started !!!\n");
	AppUtils_Printf(2, "enter MCU IPC RX task\r\n");
	//Boot_post_10();
	IPCDevice_SetLocalDevice(IPC_DEVICE_NAME_MCU1_0);
	IPCDevice_AddDevice(IPC_DEVICE_NAME_MPU1_0, IPCDevice_MsgProcessProc);
	IPCDevice_Init(NULL, 0);
	Boot_post_0();
	IPCDevice_RecvProc();
	//IPCDevice_PrintPacket(1);
}
int32_t IPCDevice_Init(const char* serviceChrDev, uint32_t localEndpoint)
{
    //TaskP_Params       params;
    RPMessage_Params  rpmsgParams;
    RPMessage_Params  cntrlParam;
    Ipc_VirtIoParams  vqParam;
    uint32_t          procs[IPC_INVALID_PROCID];
    int32_t           procNum = 0;
    int32_t           i = 0;
    int32_t           iRet = IPC_SOK;

    if (localEndpoint != 0)
    {
        ipcDeviceLocalEndpoint = localEndpoint;
    }

    if (serviceChrDev == NULL)
    {
        sprintf(ipcDeviceServerChrDev, "%s", IPC_DEVICE_SERVICE_CHRDEV);
    }
    else
    {
        sprintf(ipcDeviceServerChrDev, "%s", serviceChrDev);
    }

    /* Step0 : Get all active devices */
    procNum = IPCDevice_GetActiveProc(procs);
    if (procNum == 0)
    {
        UART_printf("Active devices number is 0.\n");
        return -1;
    }

    UART_printf("Get all active devices number(%d) successfully.\n", procNum);

    /* Step1 : Initialize the multiproc */
    iRet = Ipc_mpSetConfig(ipcDeviceLocalProc, procNum, procs);
    if (iRet != IPC_SOK)
    {
        UART_printf("Ipc_mpSetConfig failed with error(%d).\n", iRet);
        return -1;
    }

    iRet = Ipc_init(NULL);
    if (iRet != IPC_SOK)
    {
        UART_printf("Ipc_init failed with error(%d).\n", iRet);
        return -1;
    }

    iRet = Ipc_loadResourceTable((void*)&ti_ipc_remoteproc_ResourceTable);
    if (iRet != IPC_SOK)
    {
        UART_printf("Ipc_loadResourceTable failed with error(%d).\n", iRet);
        return -1;
    }

    UART_printf("Initialize the multiproc (%d) successfully.\n", procNum);

    /* Step2 : Wait for Linux VDev ready... */
    for(i = 0; i < procNum; i++)
    {
        while(!Ipc_isRemoteReady(procs[i]))
        {
            TaskP_sleep(10);
        }
    }

    UART_printf("Wait for Linux VDev ready successfully.\n");

    /* Step3 : Initialize Virtio */
    vqParam.vqObjBaseAddr = (void*)ipcdevice_sysVqBuf;
    vqParam.vqBufSize     = procNum * Ipc_getVqObjMemoryRequiredPerCore();
    vqParam.vringBaseAddr = (void*)IPC_DEVICE_VRING_BASE_ADDR;
    vqParam.vringBufSize  = IPC_VRING_BUFFER_SIZE;
    vqParam.timeoutCnt    = 100;  /* Wait for counts */
    iRet = Ipc_initVirtIO(&vqParam);
    if (iRet != IPC_SOK)
    {
        UART_printf("Ipc_initVirtIO failed with error(%d).\n", iRet);
        return -1;
    }

    UART_printf("Initialize Virtio successfully.\n");

    /* Step 4: Initialize RPMessage */
    iRet = RPMessageParams_init(&cntrlParam);
    if (iRet != IPC_SOK)
    {
        UART_printf("RPMessageParams_init_1 failed with error(%d).\n", iRet);
        return -1;
    }

    cntrlParam.buf         = ipcdevice_cntrlBuf;
    cntrlParam.bufSize     = RPMSG_DATA_SIZE;
    cntrlParam.stackBuffer = &ipcdevice_taskStackBufs[0];
    cntrlParam.stackSize   = IPC_TASK_STACKSIZE;
    iRet = RPMessage_init(&cntrlParam);
    if (iRet != IPC_SOK)
    {
        UART_printf("RPMessage_init failed with error(%d).\n", iRet);
        return -1;
    }

    iRet = RPMessageParams_init(&rpmsgParams);
    if (iRet != IPC_SOK)
    {
        UART_printf("RPMessageParams_init_2 failed with error(%d).\n", iRet);
        return -1;
    }

    rpmsgParams.requestedEndpt = ipcDeviceLocalEndpoint;
    rpmsgParams.buf = ipcdevice_recvBuf;
    rpmsgParams.bufSize = RPMSG_DATA_SIZE;
    ipcDeviceHandle = RPMessage_create(&rpmsgParams, &ipcDeviceLocalEndpoint);
    if(ipcDeviceHandle == NULL) 
    {
        UART_printf("RPMessage_create failed to create endpoint(%d).\n", ipcDeviceLocalEndpoint);
        return -1;
    }

	UART_printf("IPCDevice_Init RPMessage announce localendpoint(%d), service(%s)\n", 
        ipcDeviceLocalEndpoint, ipcDeviceServerChrDev);
    iRet = RPMessage_announce(RPMESSAGE_ALL, ipcDeviceLocalEndpoint, ipcDeviceServerChrDev);
    if (iRet != IPC_SOK) 
    {
        UART_printf("RPMessage_announce failed with error(%d).\n", iRet);
        return -1;
    }

    UART_printf("Initialize RPMessage successfully.\n");

    ///* Step 5: Start receive task */
    //TaskP_Params_init(&params);
	//params.instance->name = "IPC RX task";
    //params.priority   = IPC_DEVICE_SETUP_TASK_PRI;
    //params.stack      = &ipcdevice_RXStack;
    //params.stackSize  = sizeof(ipcdevice_RXStack);
    //TaskP_create(IPCDevice_RecvProc, &params, NULL);
	
	///* Step 5: Start receive task */
    //TaskP_Params_init(&params);
	//params.instance->name = "IPC TX task";
    //params.priority   = IPC_DEVICE_SETUP_TASK_PRI;
    //params.stack      = &ipcdevice_TXStack;
    //params.stackSize  = sizeof(ipcdevice_TXStack);
    //TaskP_create(IPCDevice_SendProc, &params, NULL);

    return 0;
}

IPC demo

ti-processor-sdk-rtos-j721e-evm-08_04_00_02\vision_apps\utils\iss\src\app_iss.c
status = appRemoteServiceRun(
        APP_IPC_CPU_MCU2_0 ,
        IMAGE_SENSOR_REMOTE_SERVICE_NAME,
        IM_SENSOR_CMD_QUERY,
        (void*)g_cmdPrm,
        CMD_PARAM_SIZE,
        0
    );
appRemoteServiceRun

=》RPMessage_send
=》RPMessage_recv
在这里插入图片描述

          /* send to destination */
            status = RPMessage_send(
                        obj->rpmsg_tx_handle,
                        dst_ipc_cpu_id,
                        obj->prm.rpmsg_rx_endpt,
                        obj->rpmsg_tx_endpt,
                        obj->rpmsg_tx_msg_buf,
                        tx_payload_size
                        );

RPMessage_send=》

Virtio_getAvailBuf(vq, (void **)&msg, &length);
Virtio_addUsedBuf(vq, token, bufSize);
Virtio_kick(vq);

Virtio_kick=》

        if (IPC_SOK != Ipc_mailboxSend(selfId, vq->procId, vq->id, vq->timeoutCnt))

RPMessage_recv=》

                payload = (RPMessage_MsgElem *)IpcUtils_QgetHead(&obj->queue);

处理:

ti-processor-sdk-rtos-j721e-evm-08_04_00_02\imaging\sensor_drv\src\iss_sensors.c

ImageSensor_RemoteServiceHandler->

        case IM_SENSOR_CMD_QUERY:
            issLogPrintf("ImageSensor_RemoteServiceHandler: IM_SENSOR_CMD_QUERY \n");
            sensor_name = (char*)(cmd_param);
            issLogPrintf("Received Query for %s \n", sensor_name);

            /*Copy sensor properties at prm, after sensor name*/
            pSenParams = (IssSensor_CreateParams * )(cmd_param+ISS_SENSORS_MAX_NAME);
            status = IssSensor_GetSensorInfo(sensor_name, pSenParams);
            break;

在这里插入图片描述

ti-processor-sdk-rtos-j721e-evm-08_04_00_02\imaging\sensor_drv\src\iss_sensors.c
camera注册
IssSensor_Init

/*
    Call init function of all supported sensors.
    This will register the sensors with the framework
*/
    status |= IssSensor_IMX390_Init();
    status |= IssSensor_AR0233_Init();
    status |= IssSensor_AR0820_Init();
   // status |= IssSensor_rawtestpat_Init();
   // status |= IssSensor_testpat_Init();
   // status |= IssSensor_gw_ar0233_Init();
   status |= IssSensor_max96701joc_yuv_Init();
	status |= IssSensor_max9295_yuv3840x2160_Init(); 
    status |= IssSensor_max9295_yuv_Init();	
	status |= IssSensor_ub933yuv_joc_a20_Init();
	status |= IssSensor_ub933yuv_h002_Init();
int32_t IssSensor_IMX390_Init()
{
    int32_t status;
    int32_t chId;
    status = IssSensor_Register(&imx390SensorHandle);
    if(0 != status)
    {
        printf("IssSensor_IMX390_Init failed \n");
    }
	for(chId=0;chId<ISS_SENSORS_MAX_CHANNEL;chId++)
	{
        sp1hGainRegValueOld[chId] = 0;
        redGain_prev[chId] = greenGain_prev[chId] = blueGain_prev[chId] = 512;
    }

    return status;
}

在这里插入图片描述

服务注册

ti-processor-sdk-rtos-j721e-evm-08_04_00_02\imaging\sensor_drv\src\iss_sensors.c

IssSensor_Init=》

    status = appRemoteServiceRegister(
        IMAGE_SENSOR_REMOTE_SERVICE_NAME,
        ImageSensor_RemoteServiceHandler
    );
 ls /sys/kernel/debug/remoteproc/ -al
total 0
drwxr-xr-x   22 root     root             0 Jan  1  1970 .
drwx------   37 root     root             0 Jan  1  1970 ..
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc0
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc1
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc10
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc11
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc12
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc13
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc14
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc15
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc16
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc17
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc18
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc19
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc2
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc3
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc4
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc5
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc6
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc7
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc8
drwxr-xr-x    2 root     root             0 Mar 15 12:30 remoteproc9
 ls /sys/bus/virtio/devices/    -al
total 0
drwxr-xr-x    2 root     root             0 Mar 15 12:33 .
drwxr-xr-x    4 root     root             0 Mar 15 12:33 ..
lrwxrwxrwx    1 root     root             0 Mar 15 12:48 virtio0 -> ../../../devices/platform/bus@100000/bus@100000:bus@28380000/bus@100000:bus@28380000:r5fss@41000000/41000000.r5f/remoteproc/remoteproc3/remoteproc3#vdev0buffer/virtio0
lrwxrwxrwx    1 root     root             0 Mar 15 12:33 virtio1 -> ../../../devices/platform/bus@100000/4d81800000.dsp/remoteproc/remoteproc1/remoteproc1#vdev0buffer/virtio1
lrwxrwxrwx    1 root     root             0 Mar 15 12:33 virtio2 -> ../../../devices/platform/bus@100000/bus@100000:r5fss@5c00000/5d00000.r5f/remoteproc/remoteproc5/remoteproc5#vdev0buffer/virtio2
lrwxrwxrwx    1 root     root             0 Mar 15 12:33 virtio3 -> ../../../devices/platform/bus@100000/4d80800000.dsp/remoteproc/remoteproc0/remoteproc0#vdev0buffer/virtio3
lrwxrwxrwx    1 root     root             0 Mar 15 12:33 virtio4 -> ../../../devices/platform/bus@100000/bus@100000:r5fss@5c00000/5c00000.r5f/remoteproc/remoteproc4/remoteproc4#vdev0buffer/virtio4
lrwxrwxrwx    1 root     root             0 Mar 15 12:33 virtio5 -> ../../../devices/platform/bus@100000/64800000.dsp/remoteproc/remoteproc2/remoteproc2#vdev0buffer/virtio5
/opt/vision_apps# ls /dev/rp* -al

crw-------    1 root     root      236,   0 Mar 15 12:30 /dev/rpmsg_ctrl0
crw-------    1 root     root      236,   1 Mar 15 12:30 /dev/rpmsg_ctrl1
crw-------    1 root     root      236,  10 Mar 15 12:30 /dev/rpmsg_ctrl10
crw-------    1 root     root      236,   2 Mar 15 12:30 /dev/rpmsg_ctrl2
crw-------    1 root     root      236,   3 Mar 15 12:30 /dev/rpmsg_ctrl3
crw-------    1 root     root      236,   4 Mar 15 12:30 /dev/rpmsg_ctrl4
crw-------    1 root     root      236,   5 Mar 15 12:30 /dev/rpmsg_ctrl5
crw-------    1 root     root      236,   6 Mar 15 12:30 /dev/rpmsg_ctrl6
crw-------    1 root     root      236,   7 Mar 15 12:30 /dev/rpmsg_ctrl7
crw-------    1 root     root      236,   8 Mar 15 12:30 /dev/rpmsg_ctrl8
crw-------    1 root     root      236,   9 Mar 15 12:30 /dev/rpmsg_ctrl9
root@j7-evm:/opt/vision_apps# 

am62ax ipc测试

3.6. IPC for AM62ax¶

linux 用 rpmsg_char_simple
mcu1-0用sdk0806\mcu_plus_sdk_am62ax_08_06_00_18\examples\drivers\ipc\ipc_rpmsg_echo_linux中的

sdk0806\mcu_plus_sdk_am62ax_08_06_00_18\examples\drivers\ipc\ipc_rpmsg_echo_linux\am62ax-sk\mcu-r5fss0-0_freertos\ti-arm-clang\am62a-mcu-r5f0_0-fw
测试中需要确认CPUID与端口(确保端口存在,如ping/pong中使用,以下patch)

diff --git a/mcu_plus_sdk_am62ax_08_06_00_18/examples/drivers/ipc/ipc_rpmsg_echo_linux/ipc_rpmsg_echo.c b/mcu_plus_sdk_am62ax_08_06_00_18/examples/drivers/ipc/ipc_rpmsg_echo_linux/ipc_rpmsg_echo.c
index 986a1771d..c66d8a202 100755
--- a/mcu_plus_sdk_am62ax_08_06_00_18/examples/drivers/ipc/ipc_rpmsg_echo_linux/ipc_rpmsg_echo.c
+++ b/mcu_plus_sdk_am62ax_08_06_00_18/examples/drivers/ipc/ipc_rpmsg_echo_linux/ipc_rpmsg_echo.c
@@ -72,7 +72,19 @@
 /* This is used to run the echo test with user space kernel */
 #define IPC_RPMESSAGE_SERVICE_CHRDEV      "rpmsg_chrdev"
 #define IPC_RPMESSAGE_ENDPT_CHRDEV_PING   (14U)
+/* This is used to run the 2nd echo test with user space kernel */
+/*
+ * Additional endpoints for communication with userspace should all use the
+ * same IPC_RPMESSAGE_SERVICE_CHRDEV      "rpmsg_chrdev"
+ */
+#define IPC_RPMESSAGE_ENDPT_CHRDEV_PING2   (15U)

+/* This is used to run the 3rd echo test with user space kernel */
+/*
+ * Additional endpoints for communication with userspace should all use the
+ * same IPC_RPMESSAGE_SERVICE_CHRDEV      "rpmsg_chrdev"
+ */
+#define IPC_RPMESSAGE_ENDPT_CHRDEV_PING3   (16U)
 /* Use by this to receive ACK messages that it sends to other RTOS cores */
 #define IPC_RPMESSAGE_RNDPT_ACK_REPLY     (11U)

@@ -82,9 +94,9 @@
 /*
  * Number of RP Message ping "servers" we will start,
  * - one for ping messages for linux kernel "sample ping" client
- * - and another for ping messages from linux "user space" client using "rpmsg char"
+ * - and another three for ping messages from linux "user space" client using "rpmsg char"
  */
-#define IPC_RPMESSAGE_NUM_RECV_TASKS         (2u)
+#define IPC_RPMESSAGE_NUM_RECV_TASKS         (4u)

 /* RPMessage object used to recvice messages */
 RPMessage_Object gIpcRecvMsgObject[IPC_RPMESSAGE_NUM_RECV_TASKS];
@@ -168,8 +180,8 @@ void ipc_recv_task_main(void *args)
         DebugP_assert(status==SystemP_SUCCESS);

         /* echo the same message string as reply */
-        #if 0 /* not logging this so that this does not add to the latency of message exchange */
-        recvMsg[recvMsgSize] = 0; /* add a NULL char at the end of message */
+        #if 1 /* not logging this so that this does not add to the latency of message exchange */
+        // recvMsg[recvMsgSize] = 0; /* add a NULL char at the end of message */
         DebugP_log("%s\r\n", recvMsg);
         #endif

@@ -304,7 +316,15 @@ void ipc_rpmsg_create_recv_tasks()
     createParams.localEndPt = IPC_RPMESSAGE_ENDPT_CHRDEV_PING;
     status = RPMessage_construct(&gIpcRecvMsgObject[1], &createParams);
     DebugP_assert(status==SystemP_SUCCESS);
-
+    RPMessage_CreateParams_init(&createParams);
+    createParams.localEndPt = IPC_RPMESSAGE_ENDPT_CHRDEV_PING2;
+    status = RPMessage_construct(&gIpcRecvMsgObject[2], &createParams);
+    DebugP_assert(status==SystemP_SUCCESS);
+
+    RPMessage_CreateParams_init(&createParams);
+    createParams.localEndPt = IPC_RPMESSAGE_ENDPT_CHRDEV_PING3;
+    status = RPMessage_construct(&gIpcRecvMsgObject[3], &createParams);
+    DebugP_assert(status==SystemP_SUCCESS);
     /* We need to "announce" to Linux client else Linux does not know a service exists on this CPU
      * This is not mandatory to do for RTOS clients
      */
@@ -313,6 +333,11 @@ void ipc_rpmsg_create_recv_tasks()

     status = RPMessage_announce(CSL_CORE_ID_A53SS0_0, IPC_RPMESSAGE_ENDPT_CHRDEV_PING, IPC_RPMESSAGE_SERVICE_CHRDEV);
     DebugP_assert(status==SystemP_SUCCESS);
+    status = RPMessage_announce(CSL_CORE_ID_A53SS0_0, IPC_RPMESSAGE_ENDPT_CHRDEV_PING2, IPC_RPMESSAGE_SERVICE_CHRDEV);
+    DebugP_assert(status==SystemP_SUCCESS);
+
+    status = RPMessage_announce(CSL_CORE_ID_A53SS0_0, IPC_RPMESSAGE_ENDPT_CHRDEV_PING3, IPC_RPMESSAGE_SERVICE_CHRDEV);
+    DebugP_assert(status==SystemP_SUCCESS);

     /* Create the tasks which will handle the ping service */
     TaskP_Params_init(&taskParams);
@@ -338,6 +363,30 @@ void ipc_rpmsg_create_recv_tasks()

     status = TaskP_construct(&gIpcTask[1], &taskParams);
     DebugP_assert(status == SystemP_SUCCESS);
+
+    TaskP_Params_init(&taskParams);
+    taskParams.name = "RPMESSAGE_CHAR_PING2";
+    taskParams.stackSize = IPC_RPMESSAFE_TASK_STACK_SIZE;
+    taskParams.stack = gIpcTaskStack[2];
+    taskParams.priority = IPC_RPMESSAFE_TASK_PRI;
+    /* we use the same task function for echo but pass the appropiate rpmsg handle to it, to echo messages */
+    taskParams.args = &gIpcRecvMsgObject[2];
+    taskParams.taskMain = ipc_recv_task_main;
+
+    status = TaskP_construct(&gIpcTask[2], &taskParams);
+    DebugP_assert(status == SystemP_SUCCESS);
+
+    TaskP_Params_init(&taskParams);
+    taskParams.name = "RPMESSAGE_CHAR_PING3";
+    taskParams.stackSize = IPC_RPMESSAFE_TASK_STACK_SIZE;
+    taskParams.stack = gIpcTaskStack[3];
+    taskParams.priority = IPC_RPMESSAFE_TASK_PRI;
+    /* we use the same task function for echo but pass the appropiate rpmsg handle to it, to echo messages */
+    taskParams.args = &gIpcRecvMsgObject[3];
+    taskParams.taskMain = ipc_recv_task_main;
+
+    status = TaskP_construct(&gIpcTask[3], &taskParams);
+    DebugP_assert(status == SystemP_SUCCESS);
 }


Understanding inter-processor communication (IPC)

MCU R5F<->A53_0 IPC
rpmsg_char_simple -r0 -n10
Created endpt device rpmsg-char-0-1069, fd = 3 port = 1024
Exchanging 10 messages with rpmsg device ti.ipc4.ping-pong on rproc id 0 ...

Sending message #0: hello there 0!
Receiving message #0: hello there 0!
Sending message #1: hello there 1!
Receiving message #1: hello there 1!
Sending message #2: hello there 2!
Receiving message #2: hello there 2!
Sending message #3: hello there 3!
Receiving message #3: hello there 3!
Sending message #4: hello there 4!
Receiving message #4: hello there 4!
Sending message #5: hello there 5!
Receiving message #5: hello there 5!
Sending message #6: hello there 6!
Receiving message #6: hello there 6!
Sending message #7: hello there 7!
Receiving message #7: hello there 7!
Sending message #8: hello there 8!
Receiving message #8: hello there 8!
Sending message #9: hello there 9!
Receiving message #9: hello there 9!

Communicated 10 messages successfully on rpmsg-char-0-1069

TEST STATUS: PASSED

for DM R5F<->A53 IPC, use the below command. For remote proc ids, please refer to : 'https://git.ti.com/cgit/rpmsg/ti-rpmsg-char/tree/include/rproc_id.h'
rpmsg_char_simple -r15 -p21 -n10
Created endpt device rpmsg-char-15-127176, fd = 3 port = 1024
Exchanging 10 messages with rpmsg device ti.ipc4.ping-pong on rproc id 15 ...

Sending message #0: hello there 0!
Receiving message #0: hello there 0!
Sending message #1: hello there 1!
Receiving message #1: hello there 1!
Sending message #2: hello there 2!
Receiving message #2: hello there 2!
Sending message #3: hello there 3!
Receiving message #3: hello there 3!
Sending message #4: hello there 4!
Receiving message #4: hello there 4!
Sending message #5: hello there 5!
Receiving message #5: hello there 5!
Sending message #6: hello there 6!
Receiving message #6: hello there 6!
Sending message #7: hello there 7!
Receiving message #7: hello there 7!
Sending message #8: hello there 8!
Receiving message #8: hello there 8!
Sending message #9: hello there 9!
Receiving message #9: hello there 9!

Communicated 10 messages successfully on rpmsg-char-15-127176

TEST STATUS: PASSED

C7x<->A53_0 IPC
rpmsg_char_simple -r8 -p21 -n10
Created endpt device rpmsg-char-8-127180, fd = 3 port = 1024
Exchanging 10 messages with rpmsg device ti.ipc4.ping-pong on rproc id 8 ...

Sending message #0: hello there 0!
Receiving message #0: hello there 0!
Sending message #1: hello there 1!
Receiving message #1: hello there 1!
Sending message #2: hello there 2!
Receiving message #2: hello there 2!
Sending message #3: hello there 3!
Receiving message #3: hello there 3!
Sending message #4: hello there 4!
Receiving message #4: hello there 4!
Sending message #5: hello there 5!
Receiving message #5: hello there 5!
Sending message #6: hello there 6!
Receiving message #6: hello there 6!
Sending message #7: hello there 7!
Receiving message #7: hello there 7!
Sending message #8: hello there 8!
Receiving message #8: hello there 8!
Sending message #9: hello there 9!
Receiving message #9: hello there 9!

Communicated 10 messages successfully on rpmsg-char-8-127180

TEST STATUS: PASSED

在这里插入图片描述
需求是只打开一个核心

如果dts只打开一个核心的话,另外一个核心没有打开


	mcu_r5fss0: r5fss@41000000 {
		compatible = "ti,j721s2-r5fss";
		ti,cluster-mode = <0>;
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0x41000000 0x00 0x41000000 0x20000>,
			 <0x41400000 0x00 0x41400000 0x20000>;
		power-domains = <&k3_pds 283 TI_SCI_PD_EXCLUSIVE>;

		mcu_r5fss0_core0: r5f@41000000 {
			compatible = "ti,j721s2-r5f";
			reg = <0x41000000 0x00010000>,
			      <0x41010000 0x00010000>;
			reg-names = "atcm", "btcm";
			ti,sci = <&sms>;
			ti,sci-dev-id = <284>;
			ti,sci-proc-ids = <0x01 0xff>;
			resets = <&k3_reset 284 1>;
			firmware-name = "j721s2-mcu-r5f0_0-fw";
			ti,atcm-enable = <1>;
			ti,btcm-enable = <1>;
			ti,loczrama = <1>;
		};

		// mcu_r5fss0_core1: r5f@41400000 {
		// 	compatible = "ti,j721s2-r5f";
		// 	reg = <0x41400000 0x00010000>,
		// 	      <0x41410000 0x00010000>;
		// 	reg-names = "atcm", "btcm";
		// 	ti,sci = <&sms>;
		// 	ti,sci-dev-id = <285>;
		// 	ti,sci-proc-ids = <0x02 0xff>;
		// 	resets = <&k3_reset 285 1>;
		// 	firmware-name = "j721s2-mcu-r5f0_1-fw";
		// 	ti,atcm-enable = <1>;
		// 	ti,btcm-enable = <1>;
		// 	ti,loczrama = <1>;
		// };
	};

需要修改代码,让这种情况通过
board-support/linux-kernel/drivers/remoteproc/ti_k3_r5_remoteproc.c
k3_r5_probe

	num_cores = of_get_available_child_count(np);
	if (num_cores != 2 && !data->is_single_core) {
		dev_err(dev, "MCU cluster requires both R5F cores to be enabled but num_cores is set to = %d\n",
			num_cores);
		// return -ENODEV;让其通过
	}
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
TDA4-VH是一款高级驾驶员辅助系统 (ADAS) 平台的芯片。该芯片是德州仪器 (TI) 公司推出的一款强大的处理器。TDA4-VH芯片集成了多核 ARM Cortex-A72 和 ARM Cortex-R5F 处理器,以及一块高性能的 3D 图像处理单元 (IMGPU)。该芯片的强大处理能力和功能架构使其成为实现先进驾驶员辅助功能的理想选择。 具体而言,TDA4-VH芯片具备以下主要特性: 1. 处理能力强大:芯片内部集成的多核 ARM Cortex-A72 和 Cortex-R5F 处理器可提供高性能和低延迟的计算能力,以满足实时辅助驾驶系统对于处理速度的需求。 2. 图像处理能力卓越:芯片内置的 3D 图像处理单元 (IMGPU) 可以进行实时的图像处理和计算,支持复杂的视觉算法和图像检测技术。这使得TDA4-VH芯片在感知和识别车辆和行人等目标方面具有出色的性能。 3. 多种外设接口:芯片还集成了多种外设接口,例如Ethernet、CAN和PCIe等,以便与其他系统组件进行高效连接和通信。 4. 安全和可靠性:TDA4-VH芯片具备先进的安全和可靠性功能,可以保护驾驶员和乘客的安全。它支持硬件加密和身份验证功能,以及故障检测和恢复机制,提供高度安全和可靠的ADAS解决方案。 综上所述,TDA4-VH芯片是一款功能强大、处理能力和图像处理性能卓越的ADAS平台芯片。它的优秀特性使其成为实现先进驾驶员辅助系统的首选,有助于提升驾驶安全性,并为汽车制造商和技术开发者带来更多的创新和应用机会。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值