大家好、
这是 FAE Jayden、我的客户 O-NET 在使用 PCIe 输出16K 数据时遇到以下问题。 请帮助检查配置方法是否正确以及是否有参考演示。
请参阅下面的附件了解详情。 谢谢。
e2e.ti.com/.../PCIE-addressing-range-configuration-issues.docx
BRS
杰登
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.
大家好、
这是 FAE Jayden、我的客户 O-NET 在使用 PCIe 输出16K 数据时遇到以下问题。 请帮助检查配置方法是否正确以及是否有参考演示。
请参阅下面的附件了解详情。 谢谢。
e2e.ti.com/.../PCIE-addressing-range-configuration-issues.docx
BRS
杰登
您好、Jayden、
一般来说、EP (入站地址转换)上最多可以有六个不同大小的条形图、只要大小是2的幂、并且地址与大小对齐即可。 对于入站和出站映射、基地址和目标地址都需要对齐。
RC 只能有两个条、但另外会通过与条不匹配的任何事务。
我不是很清楚他们在这里做什么,但我第一个猜测他们的即时问题是 EP 的 esi é l é girl é n é Omap_Buffer n é n é n é n é n é n é n é n é n é n é n é n é n é n é n é n é n é n é 也许他们可以从检查 EP 本地内存中这个数组的地址开始。
此致、
多米尼克
尊敬的 Dominic:
感谢您的回复!
工程需要实现两个函数、因此您需要两个直条、第一个是0x0000~0x01000、另一个是0x4000~0x7000。
接收缓冲区与关键字__attribute__(aligned (4096))对齐、应已对齐。 但是、仍会出现地址范围为0x4000到0x7000的缓冲区、并且只能接收到部分数据。
3.附上测试代码。
//recieve
#include <string.h>
#include "ti_drivers_open_close.h"
#include "ti_board_open_close.h"
#include <kernel/dpl/DebugP.h>
#include <drivers/soc.h>
#include <drivers/pcie.h>
#include "IOmap_Post.h"
#include "IOmap_Buffer.h"
/******** Buffer *******/
#define BUF_SIZE (0x1000/4)
#define IOMAP_BUFFER_SIZE (0x3000/4)
/**********************************************************************
********************** PEIC MAP recv buffer**************************
*********************************************************************/
uint32_t IOmap_PostRecv[BUF_SIZE] __attribute__((aligned(4096)));
uint32_t IOmap_BufferRecv[IOMAP_BUFFER_SIZE] __attribute__((aligned(4096)));
/**********************************************************************
********************** PEIC MAP send buffer**************************
*********************************************************************/
uint32_t IOmap_PostSend[BUF_SIZE] __attribute__((aligned(4096)));
uint32_t IOmap_BufferSend[IOMAP_BUFFER_SIZE] __attribute__((aligned(4096)));
static void Pcie_getRemoteVendor(void)
{
uint32_t devId = 0;
uint32_t vndId = 0;
int32_t status = 0;
/* Get EP Device Id and Vendor Id */
status = Pcie_getVendorId(gPcieHandle[CONFIG_PCIE0], PCIE_LOCATION_REMOTE, &vndId, &devId);
if (SystemP_SUCCESS == status)
{
DebugP_log ("Endpoint Device ID: %XX\r\n", devId);
DebugP_log ("Endpoint Vendor ID: %XX\r\n", vndId);
}
else
{
DebugP_logError ("Unable to read Endpoint Device & Vendor ID\r\n");
}
}
static void Pcie_recvData(uint32_t *recvBuff, uint32_t recvLen)
{
CacheP_inv (recvBuff, recvLen, CacheP_TYPE_ALL);
}
static void Pcie_sendData(uint32_t *sendBuff, uint32_t sendLen)
{
void *transBufAddr = (void *)(CONFIG_PCIE0_OB_REGION0_LOWER);
memcpy(transBufAddr, sendBuff, sendLen);
CacheP_wbInv(transBufAddr, sendLen, CacheP_TYPE_ALL);
}
static void Pcie_sendData1(uint32_t *sendBuff, uint32_t sendLen)
{
void *transBufAddr = (void *)(CONFIG_PCIE0_OB_REGION1_LOWER);
memcpy(transBufAddr, sendBuff, sendLen);
CacheP_wbInv(transBufAddr, sendLen, CacheP_TYPE_ALL);
}
void pcie_Task(void *args)
{
rt_kprintf("Device in EP mode\r\n");
//Pcie_getRemoteVendor();
while(1)
{
Pcie_recvData(IOmap_PostRecv, sizeof(IOmap_PostRecv));
Pcie_recvData(IOmap_BufferRecv, sizeof(IOmap_BufferRecv));
rt_thread_delay(10);
}
}
int Pcie_taskCreateInit(void)
{
rt_kprintf("Pcie_taskCreateInit!\r\n");
if(pdTRUE != xTaskCreate((TaskFunction_t)pcie_Task, /* Pointer to the function that implements the task. */
(const char*)"pcieTask", /* Text name for the task. This is to facilitate debugging only. */
(uint32_t)1024, /* Stack depth in units of StackType_t typically uint32_t on 32b CPUs */
(void*)RT_NULL, /* We are not using the task parameter. */
(UBaseType_t)configMAX_PRIORITIES-3, /* task priority, 0 is lowest priority, configMAX_PRIORITIES-1 is highest */
(TaskHandle_t*)NULL) )
{
while(1);
}
return 0;
}
INIT_APP_EXPORT(Pcie_taskCreateInit);
//SEND
#include <string.h>
#include "ti_drivers_open_close.h"
#include "ti_board_open_close.h"
#include <kernel/dpl/DebugP.h>
#include <drivers/soc.h>
#include <drivers/pcie.h>
#include "IOmap_Post.h"
#include "IOmap_Buffer.h"
/******** Buffer *******/
#define BUF_SIZE (0x1000/4)
#define IOMAP_BUFFER_SIZE (0x3000/4)
/**********************************************************************
********************** PEIC MAP recv buffer**************************
*********************************************************************/
uint32_t IOmap_PostRecv[BUF_SIZE] __attribute__((aligned(4096)));
uint32_t IOmap_BufferRecv[IOMAP_BUFFER_SIZE] __attribute__((aligned(4096)));
/**********************************************************************
********************** PEIC MAP send buffer**************************
*********************************************************************/
uint32_t IOmap_PostSend[BUF_SIZE] __attribute__((aligned(4096)));
uint32_t IOmap_BufferSend[IOMAP_BUFFER_SIZE] __attribute__((aligned(4096)));
static void Pcie_getRemoteVendor(void)
{
uint32_t devId = 0;
uint32_t vndId = 0;
int32_t status = 0;
/* Get EP Device Id and Vendor Id */
status = Pcie_getVendorId(gPcieHandle[CONFIG_PCIE0], PCIE_LOCATION_REMOTE, &vndId, &devId);
if (SystemP_SUCCESS == status)
{
DebugP_log ("Endpoint Device ID: %XX\r\n", devId);
DebugP_log ("Endpoint Vendor ID: %XX\r\n", vndId);
}
else
{
DebugP_logError ("Unable to read Endpoint Device & Vendor ID\r\n");
}
}
static void Pcie_recvData(uint32_t *recvBuff, uint32_t recvLen)
{
CacheP_inv (recvBuff, recvLen, CacheP_TYPE_ALL);
}
static void Pcie_sendData(uint32_t *sendBuff, uint32_t sendLen)
{
void *transBufAddr = (void *)(CONFIG_PCIE0_OB_REGION0_LOWER);
memcpy(transBufAddr, sendBuff, sendLen);
CacheP_wbInv(transBufAddr, sendLen, CacheP_TYPE_ALL);
}
static void Pcie_sendData1(uint32_t *sendBuff, uint32_t sendLen)
{
void *transBufAddr = (void *)(CONFIG_PCIE0_OB_REGION1_LOWER);
memcpy(transBufAddr, sendBuff, sendLen);
CacheP_wbInv(transBufAddr, sendLen, CacheP_TYPE_ALL);
}
static void buffer_init(void)
{
uint32_t ui = 0;
for(ui = 0; ui < BUF_SIZE; ui++)
{
IOmap_PostSend[ui] = 0xA5A55A5A;
}
for(ui = 0; ui < IOMAP_BUFFER_SIZE; ui++)
{
IOmap_PostSend[ui] = 0xA5A55A5A;
}
}
void pcie_Task(void *args)
{
rt_kprintf("Device in RC mode\r\n");
Pcie_getRemoteVendor();
buffer_init();
while(1)
{
Pcie_sendData(IOmap_PostSend, sizeof(IOmap_PostSend));
Pcie_sendData(IOmap_BufferSend, sizeof(IOmap_BufferSend));
rt_thread_delay(10);
}
}
int Pcie_taskCreateInit(void)
{
rt_kprintf("Pcie_taskCreateInit!\r\n");
if(pdTRUE != xTaskCreate((TaskFunction_t)pcie_Task, /* Pointer to the function that implements the task. */
(const char*)"pcieTask", /* Text name for the task. This is to facilitate debugging only. */
(uint32_t)1024, /* Stack depth in units of StackType_t typically uint32_t on 32b CPUs */
(void*)RT_NULL, /* We are not using the task parameter. */
(UBaseType_t)configMAX_PRIORITIES-3, /* task priority, 0 is lowest priority, configMAX_PRIORITIES-1 is highest */
(TaskHandle_t*)NULL) )
{
while(1);
}
return 0;
}
INIT_APP_EXPORT(Pcie_taskCreateInit);您好、Jayden、
如果要将该值映射为16 KB 栏,则需要将 Omap_Buffer v 与16 KB 对齐。
当前地址模数16KB 应为0x1000、例如0x70005000 (您可以检查.map 文件以了解实际地址)。 尝试通过16KB 栏映射该地址实际上映射的起始地址为0x70004000。 如果 RC 随后向该存储栏写入16KB、它实际上会将存储器从0x70004000修改为0x70007fff。、但它们的缓冲区位于0x70005000或0x70008fff。 如果他们只查看缓冲区、看起来就像只修改了缓冲区的前12KB。 它们可能还会破坏该缓冲区前面的存储器。
此致、
多米尼克