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.

TDA4AL-Q1: [TDA4] IPC implement server on Linux side example

Part Number: TDA4AL-Q1


Tool/software:

Hi:

      I have run the tool rpmsg_char_simple on linux side. And It could worked on my build environment.

      And Use the FreeRTOS firmware ipc_echo_test on R5F CPU. The IPC could be workable. 

     Above test example is the server on the R5F side. Linux OS was client side. I would like to know how can I create a IPC server on linux side and R5F as client side. Because we want R5F got some data from CAN bus and then transfer data from R5F side to A72 linux side. So we want the IPC server on A72 linux side.

     Could you please provide an example demo code? Thanks you!

  • I use the SDK version was 10.01.00.04

  • Hi:

         Above comment about ehe server on the linux side. That's mean I want create endpoint on linux side. How can I do that?

  • Hi Sheng-Shun,

         Above comment about ehe server on the linux side. That's mean I want create endpoint on linux side. How can I do that?

    You can create new end-points on Linux, but any created end-point is always created as a child rpmsg device of the corresponding rpmsg_ctrl device (an end-point previously published from firmware side).

    The Linux application would have to exchange the end-point address to the firmware-side to make it known. So, they are always deemed as secondary server end-points. You cannot create a stand-alone server end-point on Linux-side. 

    regards

    Suman

  • Hi Suman:

          Thanks you reply!

           From your comment, the endpoint address was create on RTOS only. And the linux rpmsg device will create a endpoint node on the /dev/rpmsgx. So I can't create it on the linux side and let RTOS know it.

          As I know the ipc_echo_test rtos firmware code, it will create a task with a specific endpoint number. And also let linux kernel know it. Then create a /dev/rpmsgx device node. Linux side can use this /dev/rpmsgx device  node to IPC to rtos side.

    The Linux application would have to exchange the end-point address to the firmware-side to make it known. So, they are always deemed as secondary server end-points. You cannot create a stand-alone server end-point on Linux-side. 

        As you say, let me to understand you ideal:

          1. In the rtos side, I created a task for endpoint number 20. This 

          2. In the linux side, There have run a process. The local endpoint set as 25. Use the IPC to rtos side to exchange the endpoint to rtos side.

          3. I will keep the linux side run this process as background process.

          4. If rtos side will send the message to linux side. It will know the endpoint number of linux side. RTOS side can send the IPC to linux side.

         Does that's correctly? Please let me know if I was wrong.

     

         Can I predefine the endpoint number of linux side if I don't want use IPC to exchange the endpoint number of linux side? I mean hard code define the endpoint number of linux-side.

        As I know the max. endpoint number was 256. What that mean 256? Is it mean /dev/rpmsg0 ~ /dev/rpmsg255? Total of R5F(core 0, 1), C7X 1 and C7X 2 can create the endpoint max. was 256, right?

  • Hi Sheng-Shun,

           From your comment, the endpoint address was create on RTOS only. And the linux rpmsg device will create a endpoint node on the /dev/rpmsgx. So I can't create it on the linux side and let RTOS know it.

    Correct.

    As I know the ipc_echo_test rtos firmware code, it will create a task with a specific endpoint number. And also let linux kernel know it.

    Yes, please note that this creates a /dev/rpmsg_ctrlX node. The /dev/rpmsgX nodes are associated with the Linux end-points.

         Does that's correctly? Please let me know if I was wrong.

    Yes. RTOS can always inhererently know the end-point of Linux when a message is sent from Linux-side to the RTOS end-point.

         Can I predefine the endpoint number of linux side if I don't want use IPC to exchange the endpoint number of linux side? I mean hard code define the endpoint number of linux-side.

    No, this is not supported. The userspace end-points were always assigned by the kernel.

        As I know the max. endpoint number was 256. What that mean 256? Is it mean /dev/rpmsg0 ~ /dev/rpmsg255? Total of R5F(core 0, 1), C7X 1 and C7X 2 can create the endpoint max. was 256, right?

    Are you referring to the macro used on the RTOS-side? The endpoint numbers are local to each processor.

    The Linux endpoints are not bound by this macro on the RTOS-side.

    regards

    Suman

  • Hi Suman:

    Are you referring to the macro used on the RTOS-side? The endpoint numbers are local to each processor.

    The Linux endpoints are not bound by this macro on the RTOS-side.

          From your comment, the endpoint only can create on the RTOS-side. So Does the RTOS-side have upper bound? How many endpoint can create on the RTOS-side?

         In the linux-side, there have no create endpoint. But there have local endpoint when want to IPC to RTOS-side. Let is auto assign in kernel-side. Does the linux have max local endpoint limit?

  • Hi Sheng-Shun,

    From your comment, the endpoint only can create on the RTOS-side

    If your comment is about creating an endpoint with a known endpoint number, then the above statement is accurate. Linux userspace applications cannot create end-points with a pre-determined number.

    So Does the RTOS-side have upper bound? How many endpoint can create on the RTOS-side?

    Yes, the RTOS IPC driver is written for Safety, so memory needs to be accounted for all storage space. This is dictated by MAXENDPOINTS macro in <PDK>/packages/ti/drv/ipc/src/ipc_priv.h file, and is set to 256 currently. This should be more than enough typically. You can always rebuild the driver to increase this if needed for your product deployment.

    Does the linux have max local endpoint limit?

    The Linux driver uses the idr_alloc() API to allocate the end-points, and so are bound by the usage. The virtio rpmsg driver usage can allocate the local end-points from 1024 onwards until INT_MAX, which is quite a lot.

    regards

    Suman