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.
工具/软件:Code Composer Studio
你好
我将 C6678 (TMDXEVM6678L v2.0)连接到 FPGA (Virtex6 ipcore 串行 RapidIO Gen2 v1.7)。
我正在尝试运行一个简单的读写测试:
1. C6678将数据写入 FPGA (NWRITE 或 NWRITE_R)
2. C6678回读数据(nread)
3.检查数据
结果:
写入操作:
FPGA:如果 FTYPE = NWRITE_R FPGA 发送响应、则成功接收数据并将其存储在存储器中
C6678:如果 FTYPE = NWRITE_R 完成代码= 1 (超时)
2.读取操作
FPGA:已成功接收到读取请求、FPGA 从存储器读取数据并发送数据响应
C6678:完成代码= 1 (超时)、未接收到数据
发送响应后、FPGA 接收到 PA 符号(接受数据包)
为什么 c6678不接受 FPGA 的响应?
Garrett、感谢您的回复。
我使用基于"loopbackDioIsr"示例的代码。
int32_t SrioDevice_init (void) { CSL_SrioHandle hSrio; int32_t i、j; SRIO_PE_特征特征; SRIO_OP_CAR opCar; Qms_QueueHnd queueHnd; Qms_QueuequeueInfo; BoolsameGarbageQ; uint8_t 等位; uint32_t garbageQueue[]={垃圾_LEN_queue、垃圾_tout_queue、 垃圾_重试_队列、垃圾_传输_ERR_queue、 垃圾_PROG_queue、垃圾_SSIZE_queue}; uint32_t srioIdMask =(srioDeviceConfig.isDeviceId16b? 0xFFFF:0xFF); uint32_t srioPrimaryId = srioDeviceConfig.ID1; uint32_t srioSecondaryId = srioDeviceConfig.ID2; //重置 SRIO */ #ifndef simoner_support /*禁用 SRIO 复位隔离*/ IF (CSL_PSC_isModuleResetIsolationEnabled (CSL_PSC_LPSC_SRIO)) CSL_PSC_disableModuleResetIsolation (CSL_PSC_LPSC_SRIO); /*重置 SRIO 模块并等待重置完成*/ CSL_PSC_setModuleLocalReset (CSL_PSC_LPSC_SRIO、PSC_MDLRST_Asserted); CSL_PSC_setModuleNextState (CSL_PSC_LPSC_SRIO、PSC_MODSTATE_ENABLE); System_printf ("调试:等待模块复位...\n"); system_flush(); while (!CSL_PSC_isModuleResetDone (CSL_PSC_LPSC_SRIO)); System_printf ("调试:等待模块本地复位...\n"); system_flush(); while (!CSL_PSC_isModuleLocalResetDone (CSL_PSC_LPSC_SRIO)); #endif /*获取 CSL SRIO 句柄。 * hSrio = CSL_SRIO_Open (0); if (hSrio ==空) 返回-1; /*启用数据包接收*/ hSrio->Rio_PCR =(hSrio->Rio_PCR & 0x7)| CSL_SRIO_Rio_PCR_RESTORE_MASK; /*禁用 SRIO 全局块*/ CSL_SRIO_GlobalDisable (hSrio); /*禁用每个单独的 SRIO 块。 // for (i = 0;i <= 9;i++) CSL_SRIO_DisableBlock (hSrio、i); /*将引导完成设置为0;我们没有完成初始化。 // CSL_SRIO_SetBootComplete (hSrio、0); CSL_SRIO_SetLSUShadowRegs (hSrio、0x19、0x19); /*现在也启用 SRIO 块和所有单独的块。 * CSL_SRIO_GlobalEnable (hSrio); for (i = 0;i <= 9;i++) CSL_SRIO_EnableBlock (hSrio、I); if (srioDeviceConfig.isLoopbackMode){ /*将 SRIO 端口配置为在环回模式下运行。 // CSL_SRIO_SetLoopbackMode (hSrio、0); CSL_SRIO_SetLoopbackMode (hSrio、1); CSL_SRIO_SetLoopbackMode (hSrio、 2); CSL_SRIO_SetLoopbackMode (hSrio、3); }否则{ /*将 SRIO 端口配置为在正常模式下运行。 * CSL_SRIO_SetNormalMode (hSrio、0); CSL_SRIO_SetNormalMode (hSrio、1); CSL_SRIO_SetNormalMode (hSrio、2); CSL_SRIO_SetNormalMode (hSrio、3); } /*启用响应数据包的自动优先级提升。 */ CSL_SRIO_EnableAutomaticPriorityPromotion (hSrio); //将 SRIO 预分频器选择设置为在44.7到89.5范围内运行*/ CSL_SRIO_SetPrescalarSelect (hSrio、0); /*解锁引导配置 Kicker */ CSL_BootCfgUnlockKicker (); if (setEnableSrioPllRxTx (hSrio、srioDeviceConfig.refclock、srioDeviceConfig.laneRate、srioDeviceConfig.isLoopbackMode)< 0) 返回-1; #ifndef simeler_support /*循环、直至 SERDES PLL 未锁定。 * while (1) { uint32_t status; /*获取 SRIO SERDES 状态*/ CSL_BootCfgGetSRIOSERDESStatus (status); IF (STATUS & 0x1) 中断; } #endif /*清除 LSU 挂起中断。 * CSL_SRIO_ClearLSUPendingInterrupt (hSrio、0xFFFFFFFF、0xFFFFFFFF); /*设置设备信息*/ CSL_SRIO_SetDeviceInfo (hSrio、srioPrimaryId、device_fender_ID、device_revision); /*设置装配体信息*/ CSL_SRIO_SetAssemblyInfo (hSrio、device_Assembly_ID、device_Assembly_vender_ID、 DEVICE_Assembly_revision、DEVICE_Assembly_info); /* TODO:配置处理元素功能 * SRIO RL 文件缺少重新发送抑制支持(Bit6)字段定义*/ PEFeatures.isBridge = 0; PEFeatures.isEndpoint = 0; peFeatures.isProcessor = 1; PEFeatures.isSwitch = 0; peFeatures.isMultiport = 0; peFeatures.isFlowArbiterationSupported = 0; peFeatures.isMulticastSupported = 0; peFeatures.isExtendedRouteConfigSupported = 0; peFeatures.isStandardRouteConfigSupported = 1; peFeatures.isFlowControlSupported = 1; peFeatures.isCRF 支持 = 0; peFeatures.isCTLSSupported = 1; peFeatures.isExtendedFeaturePtrValid = 1; peFeatures.numAddressBitSupported = 1; CSL_SRIO_SetProcessingElementFeatures (hSrio、&peFeatures); /*配置源代码操作 CAR */ memset ((void *)&opCar、0、sizeof (opCar)); opCar.portWriteOperationSupport = 1; opCar.atomicClearSupport = 1; opCar.atomicSetSupport = 1; opCar.atomicDecSupport = 1; opCar.atomicIncSupport = 1; opCar.atomicTestSwapSupport = 1; OPCar.DoorbellSupport = 1; opCar.dataMessageSupport = 1; opCar.writeResponse 支持 = 1; opCar.streamWriteSupport = 1; opCar.writeSupport = 1; opCar.readSupport = 1; opCar.dataStreamingSupport = 1; CSL_SRIO_SetSourceOperationCAR (hSrio、&opCar); /*配置目标操作 CAR */ memset ((void *)&opCar、0、sizeof (opCar)); opCar.portWriteOperationSupport = 1; OPCar.DoorbellSupport = 1; opCar.dataMessageSupport = 1; opCar.writeResponse 支持 = 1; opCar.streamWriteSupport = 1; opCar.writeSupport = 1; opCar.readSupport = 1; CSL_SRIO_SetDestOperationCAR (hSrio、&opCar); /*设置 SRIO 器件的16位和8位标识符。 * CSL_SRIO_SetDeviceIDCSR (hSrio、DEVICE_ID1_8位、DEVICE_ID1_16BIT); /*为维护请求启用 TLM 基本路由信息并确保这样做 *所有端口都可以使用 BRR。 * CSL_SRIO_SetLMPortBaseRoutingInfo (hSrio、0、1、1、1、1、 0); if (srioDeviceConfig.isLoopbackMode) CSL_SRIO_SetLMPortBaseRoutingInfo (hSrio、0、2、1、1、 0); /*配置基本路由寄存器以确保所有数据包与匹配 *设备标识符和辅助设备 ID 被允许。 * CSL_SRIO_SetLMPortBaseRoutingPatternMatch (hSrio、0、1、srioPrimaryId、srioIdMask); if (srioDeviceConfig.isLoopbackMode) CSL_SRIO_SetLMPortBaseRoutingPatternMatch (hSrio、0、2、srioSecondaryId、srioIdMask); //我们需要在 QMSS 中打开垃圾收集队列。 这样做是为了确保这一点 *这些队列不是由另一个系统实体打开的。 * 对于(I = 0;I < 6;I++) { /*打开车库队列*/ queueHnd = Qmss_queueOpen (Qms_QueueType_General_Purpe_queue、garbageQueue[i]、isAllocated); 如果(队列 Hnd < 0) 返回-1; /*确保队列尚未打开;我们不会让其他人共享队列 系统中的*实体。 * 如果(等距> 1){ sameGarbageQ = false; queueInfo = Qms_getQueueNumber (queueHnd); 对于(j = 0;j < I;j++){ if (queueInfo.qNum =garbageQueue[j]) sameGarbageQ = true; } if (!sameGarbageQ) 返回-1; } } /*设置发送垃圾收集信息。 * CSL_SRIO_SetTxGarbageCollectionInfo (hSrio、垃圾桶 LEN_queue、垃圾_tout_queue、 垃圾_重试_队列、垃圾_传输_ERR_queue、 垃圾_PROG_queue、垃圾_SSIZE_queue); /*设置主机设备标识符。 * CSL_SRIO_SetHostDeviceID (hSrio、srioPrimaryId); /*配置组件标签 CSR */ CSL_SRIO_SetCompTagCSR (hSrio、0x00000000); SRIO_PLM_Vmin_Exponent vminExponentConfig; /*为所有端口配置 PLM。 对于 (i = 0;i < 4;i++) { /*设置 PLM 端口静音计时器。 * CSL_SRIO_SetPLMPortSilenceTimer (hSrio、I、0x2); /* TODO:我们需要确保端口0配置为同时支持这两个端口 * 2x 和4x 模式。 端口宽度字段为只读。 那么、在这里、我们简单地说 *确保已启用输入和输出端口。 * CSL_SRIO_EnableInputPort (hSrio、I); CSL_SRIO_EnableOutputPort (hSrio、I); /*设置 PLM 端口发现计时器。 * CSL_SRIO_SetPLMPortDiscoveryTimer (hSrio、I、0x2); /*重置端口写入接收捕获。 * CSL_SRIO_SetPortWriteRecectionCapture (hSrio、I、0x0); /* Vmin 补丁*/ CSL_SRIO_GetPLMPortVMinExponentConfig (hSrio、i、&vminExponentConfig); vminExponentConfig.vminExp=15; CSL_SRIO_SetPLMPortVMinExponConfig (hSrio、i、&vminExponentConfig); } /*设置端口链接超时 CSR */ CSL_SRIO_SetPortLinkTimeoutCSR (hSrio、0xFF0FFF); CSL_SRIO_SetPortResponseTimeoutCSR (hSrio、0xFF0FFF); /*设置端口常规 CSR:仅作为主设备启用执行*/ CSL_SRIO_SetPortGeneralCSR (hSrio、0、1、0); /*清除粘滞寄存器位。 * CSL_SRIO_SetLMResetControl (hSrio、1); 对于维护端口写入操作,/*将设备 ID 设置为0 *向系统主机报告错误。 * CSL_SRIO_SetPortWriteDeviceId (hSrio、0x0、0x0、0x0); //设置数据流 MTU */ CSL_SRIO_SetDataStreamingMTU (hSrio、64); /*为端口配置路径模式。 * if (setSrioLanes (hSrio、srioDeviceConfig.laneMode)< 0) 返回-1; /*设置 LLM 端口 IP 预分频器。 * //CSL_SRIO_SetLMPortIPPrescalar (hSrio、0x21); CSL_SRIO_SetLMPortIPPrescalar (hSrio、0x1F); //? ( i = 0;i < 4;i++) { CSL_SRIO_SetPBMPortIngresPriorityWatermark (hSrio、i、0、0x24、0x24); CSL_SRIO_SetPBMPortIngresPriorityWatermark (hSrio、I、1、0x1B、0x1B); CSL_SRIO_SetPBMPortIngresPriorityWatermark (hSrio、I、2、0x12、0x12); CSL_SRIO_SetPBMPortIngresPriorityWatermark (hSrio、i、3、0x9、0x9); } 对于(i = 0;i < 24;i++) CSL_SRIO_DisableInterruptPacing (hSrio、i); 对于(i = 0; I < 16;I++) CSL_SRIO_SetTxQueueTPZInfo (hSrio、I、0、0); CSL_SRIO_SetDoorbellRoute (hSrio、1); for (i = 0;i < 16;i++) { CSL_SRIO_RouteDoorbellInterrupts (hSrio、 0、I、0); CSL_SRIO_RouteDoorbellInterrupts (hSrio、1、 I、1); CSL_SRIO_RouteDoorbellInterrupts (hSrio、2、I、 2); CSL_SRIO_RouteDoorbellInterrupts (hSrio、3、I、3); } /*启用外设。 * CSL_SRIO_EnablePeripheral (hSrio); /*配置已完成。 * CSL_SRIO_SetBootComplete (hSrio、1); #ifndef simpler_support /*此代码检查端口是否正常工作。 不支持该功能 *。 * if (waitAllSrioPortsOperational (hSrio、srioDeviceConfig.laneMode)< 0) 返回-1; #endif if (displaySrioLanesStatus (hSrio)< 0) 返回-1; /*初始化已完成。 * 返回0; }
驱动程序配置
int32 _configDrvSrioDrv (SRIO_DrvConfig* config) { uint32 coreNum = platformGetCoreNum(); uint8 isAllocated; //初始化 SRIO 驱动程序配置。 // memset (((void *) config、0、sizeof (SRIO_DrvConfig)); //初始化 OSAL */ if (OSAL_dataBufferInitMemory (SRIO_MAX_MTU)< 0) { System_printf ("错误:无法初始化 OSAL。 \n"); 返回-1; }/********* *将使用以下属性创建 SRIO 驱动程序实例: *-驱动程序管理 *-中断支持(将 Rx 完成队列传递为 NULL //* 设置 SRIO 驱动程序管理的配置。 */ config->bAppManagedConfig = false; //驱动程序管理:接收配置*/ config->U.drvManagedCfg.bIsRxCfgValid = 1; config->U.drvManagedCfg.rxCfg.rxMemRegion = Qmss_MemRegion_memory_REGION0; config->U.drvManagedCfg.rxCfg.numRxBuffers = 4; config->U.drvManagedCfg.rxCfg.rxMTU = SRIO_MAX_MTU; /*累加器配置。 // { int32_t coreToQueueSelector [4]; //这是将内核映射到特定接收队列的表。 // coreToQueueSelector [0]= 704; coreToQueueSelector [1]= 705; coreToQueueSelector [2]= 706; coreToQueueSelector [3]= 707; //由于我们要对累加器进行编程,因此我们希望该队列成为高优先级队 列*/ config->U.drvManagedCpriority.Clection.rxeQfg_r&rqeQ&g = rqeQueueQ&rg.rg.&r&cqeQtudeQ&rg_rqeQtudeQ&rg_rg.r&r&r&r&r&cqeQt&rg_r&rg_rg.eQtudeQt&r&r&r&cqeQt&r&r&r 无法打开 SRIO 接收完成队列\n"); 返回-1; }/* 累加器配置有效。 */ config->U.drvManagedCfg.rxCfg.bIs累 加器 latorCfgValid = 1;//如果是中断模式,则为0;如果是轮询模式 ,则为0;//配置为调制器。 */ config->u.drvManagedCfg.rxCfg.accCfg.channel = coreNum; config->u.drvManagedCfg.rxCfg.accCfg.command = Qms_AccCmd_enable_channel; config->U.drvManagedCfg.rxCfg.accCfg.queueEnMask = 0; config->U.drvManagedCfg.rxCfg.accCfg.queMgrIndex = coreToQueueSelector [coreNum]; config->U.drvManagedCfg.rxCfg.accCfg.maxPageEntry = 2; config->U.drvManagedCfg.rxCfg.accCfg.timerLoadCount = 0; config->u.drvManagedCfg.rxCfg.accCfg.interruptPacingMode = Qmss_AccPacingMode_Last_interrupt; config->U.drvManagedCfg.rxCfg.accCfg.listEntrySize = Qmss_AccEntrySize_REG_D; config->U.drvManagedCfg.rxCfg.accCfg.listCountMode = Qmss_AccCountMode_entry_count; config->U.drvManagedCfg.rxCfg.accCfg.multiQueueMode = Qmss_AccQueueMode_Single_queue; //初始化累加器列表内存*/ memset (((void *)&gHiManagPriList[0]、0、sizeof (gHiPriAccumList); config->U.drvManagedCfg.rxCfg.accumlistAddress = L2_global_address (gHiRovaccumListList);config->U.TxId=32 * Transmit .UvruditedCfet (xCfg.r&g) = 1; config->U.drvManagedCfg.txCfg.txMemRegion = Qmss_MemRegion_memory_REGION0; config->U.drvManagedCfg.txCfg.numTxBuffers = 4; config->U.drvManagedCfg.txCfg.txMTU = SRIO_MAX_MTU; 返回0; }
要求
int32_t sendDIO (SrioModule_t*模块、SRIO_SockAddrInfo*更改为、uint32_t localAddress、uint32_t size) { SRIO_SockHandle socket; SRIO_SockBindAddrInfo bindInfo; // open sio_sockOpen (module-suppet = 0);sockindidio = 0sockpit = socknidio ;sble.fit = 0=0sockpit = 0socknidio;socknidio = ble.fet = 0socknidio = 0sockpit = ble.b;ble.fet = ble.idio = ble.fet = 0b = ble.fet ble.idio;ble.idio = 0 bindInfo.dio.intrRequest bindInfo.dio.outPortID = 0; bindInfo.dio.idSize =(module->deviceconfig ->isDeviceId16b? 1:0); bindInfo.dio.srcIDMap = 0; bindInfo.dio.hopCount = 0; bindInfo.dio.DoorbellBit = 0; bindInfo.dio.DoorbellReg = 0; if (SRIO_sockBind (socket、&bindInfo)){ return -1; } //清除中断标志 模块->DioIntr = 0; //发送数据包 if (SRIO_sockSend (socket、(SRIO_DrvBuffer) localAddress、Size、To)<0) { return -1; } //等待完成 while (sio_sockpit = 0*= 0xintr = 0);* compett 代码填充 if (SRIO_getSockOpt (socket、SRIO_Opt_DIO_READ_SOCK_COMP_CODE、&compCode、sizeof (uint8_t))< 0) { //System_printf ("错误:无法读取 sockpit 中的完成代码\n"); return -1; } //关闭 socket SRIO_32_remote_remote.t = 0x32* to s/soctodio_remote_remote_remote_remote_remote.t; to.dio.dstID = module->deviceconfig; to.dio.ttype = SRIO_Ttype_Write_NWRIT_R;//或 SRIO_Ttype_Write_NWRITE to.dio.ftype = SRIO_Ftype_write; return sendDIO (module、&to、localAddress);localsize } int32_t srioSendNRead (SrioModule_t*模块、uint32_t remoteAddress、uint32_t localAddress、uint32_t size) { SRIO_SockAddrInfo to; //将数据包标头 配置为.dio.rapidio.apidio.ldisb = 0x0;TO.dio.rapidio.ldiso.drId=n =要求 类型 ;tidio.mdio.remote.type =要求为 tidio.mdio.mdio.mdio.mdio.mdio.type = 0x2; 返回 sendDIO (module、&to、localAddress、size); }