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.

problem about dm8168 pcie sample

Hi all:
I develop on dm8168 usind dvrrdk4.0 software.
I have a questions about pcie transfer demo Epdrv_sample_apps.
The problem is tells in follow:
In file ti81xx_ep_app.c, in fun main(), fun scan_mgmt_area(rm_info, muid, &ob) is called.
(muid =1 for RC,muid =2 for EP),

I think in this fun
        ep_info should point to a struct pci_sys_info {
            unsigned int res_value[7][2];
            struct pci_sys_info *next;
                };
        without *next elem,
        This struct is filled by rc for each detect ep devices
        when main calls propagate_system_info(start, fd, eps, start_addr.start_addr_phy) in main in file ti81xx_rc_app.c,
        main()-->propagate_system_info()-->dump_info_on_ep(),
        but i found that in fun scan_mgmt_area(rm_info, muid, &ob)
        bar_map = ep_info[j + 13],
        ob->ob_offset_idx = ep_info[j + bar_map * 2 + 1]
        it seems  not the same struct filled by rc propagate_system_info ?
                        
Follow are pieces of code,
        FILE ti81xx_ep_app.c
        int scan_mgmt_area(unsigned int *rm_info, unsigned int muid,struct ti81xx_outb_region *ob)
        {
                unsigned int *ep_info = rm_info + 2;
                int j = 0, i = 0;
                int bar_map;
                if (muid == 1)
                {
                        ob->ob_offset_hi = 0;
                        /*start address of management area on RC*/
                        ob->ob_offset_idx = rm_info[1];
                        return 0;
                }

                for (i = 1; i <= rm_info[0]; i++)
                {
                        if (ep_info[j] == muid)
                        {
                                bar_map = ep_info[j + 13];
                                ob->ob_offset_hi = 0;
                                ob->ob_offset_idx = ep_info[j + bar_map * 2 + 1];
                                return 0;
                        }
                        j += 14;
                }
                return -1;
        }
        
        FILE ti81xx_rc_app.c
        int dump_info_on_ep(struct pci_sys_info *start, unsigned int *mgmt_area,
        unsigned int eps, unsigned int startaddr)
        {
                char *temp = (char *)mgmt_area;
                void *index;
                unsigned int size_mgmt = 0;

        ACCESS_MGMT:
                if (access_mgmt_area(mgmt_area, 1) == 0)
                {
                        /*1 will be unique id of RC always.*/
                        size_mgmt = mgmt_area[4];
                        debug_print("size of management area on rmt EP is %u\n",size_mgmt);

                        *((unsigned int *) (temp + size_mgmt + sizeof(unsigned int))) = startaddr;
                        *((unsigned int *) (temp + size_mgmt)) = eps;/*no of ep in system*/

                        size_mgmt += 2 * sizeof(unsigned int);
                        index = temp + size_mgmt;
                        for (; start != NULL; start = start->next)
                        {
                                memcpy(index, temp,sizeof(struct pci_sys_info) - sizeof(void *));
                                index += sizeof(struct pci_sys_info) - sizeof(void *);
                                size_mgmt += sizeof(struct pci_sys_info) - sizeof(void *);
                        }
                        mgmt_area[4] = size_mgmt;/*update new size on EP.*/
                        debug_print("size of management area is updated to %u\n",mgmt_area[4]);
                        release_mgmt_area(mgmt_area);
                }
                else
                {
                        goto ACCESS_MGMT;
                }
                return 0;
        }