中断服务程序ISR:
Void FpgaDioTxCompletionIsr
(
UArg argument
//UArg arg0, UArg arg1
)
{
//使主机中断失效
//CpIntc_disableHostInt(1,8);
//清除系中断
//CpIntc_clearSysInt(1,112);
//使能主机中断
//CpIntc_enableHostInt(1,8);
g_InterruptCount++;
Uint16 doorbellStatus;
DEVICE_REG32_W(0x10800080,g_InterruptCount);
//FPGA中断足够快的话是否会丢失中断?
// gpCGEM_regs->EVTCLR[0] = 0x00100000;
CSL_SRIO_GetDoorbellPendingInterrupt (hSrioCSL, 0, &doorbellStatus);
//CSL_SRIO_SetInterruptPacing (hSrio, 2, 0xFFFFFFFF);
//UInt32 uiSegNum;
// switch(doorbellStatus)
// {
// case 1:
// DEVICE_REG32_W(0x10800084,0xABAB4141);
// //printf("doorbell 1 ok!");
// break;
// default:
// DEVICE_REG32_W(0x108000A4,0XABAB4154);
// //printf("doorbell not ok!");
// break;
//// }
DEVICE_REG32_W(0x10800090,DSP_GPS_Data_Addr);
// DEVICE_REG32_W(0x10800094,&GPS_SRIO_DATA[0][0]);
// count = WriteFpgaByDioSockets_nwrite_mk(0x00000000,(Uint8*) DSP_GPS_Data_Addr,1024); //传输
/* Pass the control to the driver DIO Tx Completion ISR handler */
Srio_dioTxCompletionIsr ((Srio_DrvHandle)argument, hSrioCSL);//该行代码DSP应用程序通过直接io方式发送数据时,由中断ISR调用
DEVICE_REG32_W(0x1080008C,count);
if(fifo_flag>9){
DEVICE_REG32_W(0x10800100,fifo_flag);
GPS_CalculateFW();
}
else{
GPS_Navfifo();
fifo_flag++;
DEVICE_REG32_W(0x10800104,fifo_flag);
}
TransmitGPSDataBuffer((Uint64*)DSP_GPS_Data_Addr, PROTOCOL_DATA_LEN, CHANNEL);
// System_printf("waiting for doorbell!\n");
CSL_SRIO_ClearDoorbellPendingInterrupt(hSrioCSL, 0, doorbellStatus);
return;
}
传输文件:
Int32 WriteFpgaByDioSockets_nwrite_mk (Uint32 uiAddr,Void* hBuffer,Uint32 uiSize)
{
Srio_SockHandle srioSocket;
Srio_SockBindAddrInfo bindInfo;
Srio_SockAddrInfo to;
//UInt8 *srcDataBufPtr = NULL;
/* Open DIO SRIO Non-Blocking Socket */
srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, FALSE);
if (srioSocket == NULL)
{
System_printf ("Error: Unable to open the DIO socket \n");
return -1;
}
/* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id.
* and we are using 16 bit device identifiers. */
bindInfo.dio.doorbellValid = 0;
bindInfo.dio.intrRequest = 0;
bindInfo.dio.supInt = 0;
bindInfo.dio.xambs = 0;
bindInfo.dio.priority = 0;
bindInfo.dio.outPortID = 0;
bindInfo.dio.idSize = 1;
bindInfo.dio.srcIDMap = 0;
bindInfo.dio.hopCount = 0;
bindInfo.dio.doorbellReg = 0;
bindInfo.dio.doorbellBit = 0;
/* Bind the SRIO socket: DIO sockets do not need any binding information. */
if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0)
{
System_printf ("Error: Binding the SIO socket failed.\n");
return -1;
}
to.dio.rapidIOMSB = 0x0;
to.dio.rapidIOLSB = uiAddr;
to.dio.dstID = srioDeviceInfo.uiDeviceID4_16Bit;
to.dio.ttype = Srio_Ttype_Write_NWRITE;
to.dio.ftype = Srio_Ftype_WRITE;
UInt8 *srcBuf = hBuffer;
/* Send the DIO Information. */
if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)srcBuf, uiSize, (Srio_SockAddrInfo*)&to) < 0)
{
return -1;
}
if(Srio_sockClose (srioSocket) < 0)
{
return -1;
}
return 0;
/* * SrioInterface.c * * Created on: 2017-07-22 * Author: maokai */ //#include <stdio.h> #include <ti/sysbios/family/c66/Cache.h> #include "SrioDioIsr_osal.h" #include "SrioInterface.h" #include "GlobalVar.h" #include "KeyStone_DDR_init.h" #include "KeyStone_common.h" #include "Gpio.h" #include "DspAndHostInterface.h" #include "MemInterface.h" #include "PcieInterface.h" #include "DspAndFpgaInterface.h" #include "Memory.h" #include "GNSSSignal.h" #include "GNSS_MainTest.h" #include "GPSSignal.h" UInt32 g_InterruptCount = 0; int count = 1; UInt32 g_InterruptCountTest = 0; UInt32 g_InterruptCountSeg0 = 0; UInt32 g_InterruptCountK = 0; UInt32 g_ValidInterruptCount[8] = {0}; UInt32 DSP_GPS_Data_Addr = (UInt32)&GPS_SRIO_DATA[0][0]; //dsp Դ��ַ���ã� SRIO_DEVICE_INFO srioDeviceInfo = { DEVICE_ID1_16BIT, DEVICE_ID1_8BIT, DEVICE_ID2_16BIT, DEVICE_ID2_8BIT, DEVICE_ID3_16BIT, DEVICE_ID3_8BIT, DEVICE_ID4_16BIT, DEVICE_ID4_8BIT }; /* Global variable to indicate completion of ISR processing */ volatile UInt32 srioLsuIsrServiced = 0; void RevertByteOrder64(void *pSrcBuffer, void *pDstBuffer, UInt32 uiDWords) { Int32 i = 0; char *pSrc, *pDst; if (pDstBuffer) { pSrc = (char *)pSrcBuffer; pDst = (char *)pDstBuffer; } else { pSrc = (char *)pSrcBuffer; pDst = (char *)pSrcBuffer; } char t0, t1, t2, t3, t4, t5, t6, t7; for (i = 0; i < 64; i++) { t0 = pSrc[i*8 + 7]; t1 = pSrc[i*8 + 6]; t2 = pSrc[i*8 + 5]; t3 = pSrc[i*8 + 4]; t4 = pSrc[i*8 + 3]; t5 = pSrc[i*8 + 2]; t6 = pSrc[i*8 + 1]; t7 = pSrc[i*8 + 0]; pDst[i*8 + 0] = t0; pDst[i*8 + 1] = t1; pDst[i*8 + 2] = t2; pDst[i*8 + 3] = t3; pDst[i*8 + 4] = t4; pDst[i*8 + 5] = t5; pDst[i*8 + 6] = t6; pDst[i*8 + 7] = t7; } } Int32 SrioInit (Void) { UInt32 coreNum = 0; /* Get the core number. */ coreNum = CSL_chipReadReg (CSL_CHIP_DNUM); if (coreNum == CORE_SYS_INIT) { if (SystemInit() < 0) { return -1; } // CPPI and Queue Manager are initialized. System_printf ("Debug(Core %d): Queue Manager and CPPI are initialized.\n", coreNum); // Power on SRIO peripheral before using it if (EnableSrio () < 0) { System_printf ("Error: SRIO PSC Initialization Failed\n"); return -1; } // Device Specific SRIO Initializations: This should always be called before // initializing the SRIO Driver. if (SrioDeviceInit(&srioDeviceInfo, //SRIO_REF_CLOCK_250P00MHZ, //SRIO_REF_CLOCK_125P00MHZ, SRIO_REF_CLOCK_312P50MHZ, //SRIO_LANE_RATE_5P000GBPS, //SRIO_LANE_RATE_3P125GBPS, //SRIO_LANE_RATE_2P500GBPS, SRIO_LANE_RATE_1P250GBPS, //SRIO_TEST_MODE_LOOPBACK, SRIO_TEST_MODE_NORMAL, SRIO_LANES_FORM_ONE_4X_PORTS, //SRIO_LANES_FORM_FOUR_1X_PORTS, SRIO_DOORBELL_INTERRUPT_TYPE_DEDICATED) < 0) { return -1; } } printf("SRIO_init complete!\n"); return 0; } Void HostIntSwiFxn(UArg arg0, UArg arg1) { DEVICE_REG32_W(0x10800080,0x13456789); Semaphore_post(semHostInt); } Void FpgaDioTxCompletionIsr ( UArg argument //UArg arg0, UArg arg1 ) { //ʹ�����ж�ʧЧ //CpIntc_disableHostInt(1,8); //���ϵ�ж� //CpIntc_clearSysInt(1,112); //ʹ�������ж� //CpIntc_enableHostInt(1,8); g_InterruptCount++; Uint16 doorbellStatus; DEVICE_REG32_W(0x10800080,g_InterruptCount); //FPGA�ж��㹻��Ļ��Ƿ�ᶪʧ�ж�? // gpCGEM_regs->EVTCLR[0] = 0x00100000; CSL_SRIO_GetDoorbellPendingInterrupt (hSrioCSL, 0, &doorbellStatus); //CSL_SRIO_SetInterruptPacing (hSrio, 2, 0xFFFFFFFF); //UInt32 uiSegNum; // switch(doorbellStatus) // { // case 1: // DEVICE_REG32_W(0x10800084,0xABAB4141); // //printf("doorbell 1 ok!"); // break; // default: // DEVICE_REG32_W(0x108000A4,0XABAB4154); // //printf("doorbell not ok!"); // break; //// } DEVICE_REG32_W(0x10800090,DSP_GPS_Data_Addr); // DEVICE_REG32_W(0x10800094,&GPS_SRIO_DATA[0][0]); // count = WriteFpgaByDioSockets_nwrite_mk(0x00000000,(Uint8*) DSP_GPS_Data_Addr,1024); /* Pass the control to the driver DIO Tx Completion ISR handler */ Srio_dioTxCompletionIsr ((Srio_DrvHandle)argument, hSrioCSL);//���д���DSPӦ�ó���ͨ��ֱ��io��ʽ��������ʱ�����ж�ISR���� DEVICE_REG32_W(0x1080008C,count); if(fifo_flag>9){ DEVICE_REG32_W(0x10800100,fifo_flag); GPS_CalculateFW(); } else{ GPS_Navfifo(); fifo_flag++; DEVICE_REG32_W(0x10800104,fifo_flag); } TransmitGPSDataBuffer((Uint64*)DSP_GPS_Data_Addr, PROTOCOL_DATA_LEN, CHANNEL); // System_printf("waiting for doorbell!\n"); CSL_SRIO_ClearDoorbellPendingInterrupt(hSrioCSL, 0, doorbellStatus); return; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //����˵����ͨ��Direct IO��ʽ��Fpga�������� //���������Uint32 uiAddr д���ݵ�ַ // Srio_DrvBuffer hBuffer д���ݻ����� // Uint32 uiSize д���ݴ�С,��λΪ�ֽ� //����������� //�� �� ֵ�� �ɹ�����ֵ����0��ʧ�ܷ���ֵС��0 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Int32 WriteFpgaByDioSocketsBlocking (Uint32 uiAddr,Void* hBuffer,Uint32 uiSize) { Srio_SockHandle srioSocket; Srio_SockBindAddrInfo bindInfo; Srio_SockAddrInfo to; UInt8 *srcDataBufPtr = NULL; /* Open DIO SRIO Non-Blocking Socket */ srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, TRUE); if (srioSocket == NULL) { System_printf ("Error: Unable to open the DIO socket \n"); return -1; } /* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id. * and we are using 16 bit device identifiers. */ bindInfo.dio.doorbellValid = 0; bindInfo.dio.intrRequest = 0; bindInfo.dio.supInt = 0; bindInfo.dio.xambs = 0; bindInfo.dio.priority = 0; bindInfo.dio.outPortID = 0; bindInfo.dio.idSize = 1; bindInfo.dio.srcIDMap = 0; bindInfo.dio.hopCount = 0; bindInfo.dio.doorbellReg = 0; bindInfo.dio.doorbellBit = 0; /* Bind the SRIO socket: DIO sockets do not need any binding information. */ if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0) { System_printf ("Error: Binding the SIO socket failed.\n"); return -1; } to.dio.rapidIOMSB = 0x0; to.dio.rapidIOLSB = uiAddr; to.dio.dstID = srioDeviceInfo.uiDeviceID4_16Bit; to.dio.ttype = Srio_Ttype_Write_NWRITE; to.dio.ftype = Srio_Ftype_WRITE; srcDataBufPtr = (UInt8*)Osal_srioDataBufferMalloc(uiSize); if (srcDataBufPtr == NULL) { System_printf ("Error: Source Buffer Memory Allocation Failed\n"); return -1; } RevertByteOrder64(hBuffer,srcDataBufPtr,uiSize/8); /* Send the DIO Information. */ if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)srcDataBufPtr, uiSize, (Srio_SockAddrInfo*)&to) < 0) { return -1; } Osal_srioDataBufferFree ((Void*)srcDataBufPtr, uiSize); if(Srio_sockClose (srioSocket) < 0) { return -1; } return 0; } Int32 WriteFpgaByDioSockets_nwrite (Uint32 uiAddr,Void* hBuffer,Uint32 uiSize) { Srio_SockHandle srioSocket; Srio_SockBindAddrInfo bindInfo; Srio_SockAddrInfo to; UInt8 *srcDataBufPtr = NULL; /* Open DIO SRIO Non-Blocking Socket */ srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, FALSE); if (srioSocket == NULL) { System_printf ("Error: Unable to open the DIO socket \n"); return -1; } /* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id. * and we are using 16 bit device identifiers. */ bindInfo.dio.doorbellValid = 0; bindInfo.dio.intrRequest = 0; bindInfo.dio.supInt = 0; bindInfo.dio.xambs = 0; bindInfo.dio.priority = 0; bindInfo.dio.outPortID = 0; bindInfo.dio.idSize = 1; bindInfo.dio.srcIDMap = 0; bindInfo.dio.hopCount = 0; bindInfo.dio.doorbellReg = 0; bindInfo.dio.doorbellBit = 0; /* Bind the SRIO socket: DIO sockets do not need any binding information. */ if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0) { System_printf ("Error: Binding the SIO socket failed.\n"); return -1; } to.dio.rapidIOMSB = 0x0; to.dio.rapidIOLSB = uiAddr; to.dio.dstID = srioDeviceInfo.uiDeviceID4_16Bit; to.dio.ttype = Srio_Ttype_Write_NWRITE; to.dio.ftype = Srio_Ftype_WRITE; srcDataBufPtr = (UInt8*)Osal_srioDataBufferMalloc(uiSize); if (srcDataBufPtr == NULL) { System_printf ("Error: Source Buffer Memory Allocation Failed\n"); return -1; } RevertByteOrder64(hBuffer,srcDataBufPtr,uiSize/8); /* Send the DIO Information. */ if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)srcDataBufPtr, uiSize, (Srio_SockAddrInfo*)&to) < 0) { return -1; } Osal_srioDataBufferFree ((Void*)srcDataBufPtr, uiSize); if(Srio_sockClose (srioSocket) < 0) { return -1; } return 0; } Int32 WriteFpgaByDioSockets_nwrite_mk (Uint32 uiAddr,Void* hBuffer,Uint32 uiSize) { Srio_SockHandle srioSocket; Srio_SockBindAddrInfo bindInfo; Srio_SockAddrInfo to; //UInt8 *srcDataBufPtr = NULL; /* Open DIO SRIO Non-Blocking Socket */ srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, FALSE); if (srioSocket == NULL) { System_printf ("Error: Unable to open the DIO socket \n"); return -1; } /* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id. * and we are using 16 bit device identifiers. */ bindInfo.dio.doorbellValid = 0; bindInfo.dio.intrRequest = 0; bindInfo.dio.supInt = 0; bindInfo.dio.xambs = 0; bindInfo.dio.priority = 0; bindInfo.dio.outPortID = 0; bindInfo.dio.idSize = 1; bindInfo.dio.srcIDMap = 0; bindInfo.dio.hopCount = 0; bindInfo.dio.doorbellReg = 0; bindInfo.dio.doorbellBit = 0; /* Bind the SRIO socket: DIO sockets do not need any binding information. */ if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0) { System_printf ("Error: Binding the SIO socket failed.\n"); return -1; } to.dio.rapidIOMSB = 0x0; to.dio.rapidIOLSB = uiAddr; to.dio.dstID = srioDeviceInfo.uiDeviceID4_16Bit; to.dio.ttype = Srio_Ttype_Write_NWRITE; to.dio.ftype = Srio_Ftype_WRITE; UInt8 *srcBuf = hBuffer; /* Send the DIO Information. */ if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)srcBuf, uiSize, (Srio_SockAddrInfo*)&to) < 0) { return -1; } if(Srio_sockClose (srioSocket) < 0) { return -1; } return 0; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //����˵����ͨ��Direct IO��ʽ��Fpga�������� //���������Uint32 uiAddr д���ݵ�ַ // Srio_DrvBuffer hBuffer д���ݻ����� // Uint32 uiSize д���ݴ�С,��λΪ�ֽ� //����������� //�� �� ֵ�� �ɹ�����ֵ����0��ʧ�ܷ���ֵС��0 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Int32 WriteFpgaByDioSockets (Uint32 uiAddr,Void* hBuffer,Uint32 uiSize) { Srio_SockHandle srioSocket; Srio_SockBindAddrInfo bindInfo; Srio_SockAddrInfo to; // UInt8 *srcDataBufPtr = NULL; /* Open DIO SRIO Non-Blocking Socket */ srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, FALSE); if (srioSocket == NULL) { System_printf ("Error: Unable to open the DIO socket \n"); return -1; } /* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id. * and we are using 16 bit device identifiers. */ bindInfo.dio.doorbellValid = 0; bindInfo.dio.intrRequest = 0; bindInfo.dio.supInt = 0; bindInfo.dio.xambs = 0; bindInfo.dio.priority = 0; bindInfo.dio.outPortID = 0; bindInfo.dio.idSize = 1; bindInfo.dio.srcIDMap = 0; bindInfo.dio.hopCount = 0; bindInfo.dio.doorbellReg = 0; bindInfo.dio.doorbellBit = 0; /* Bind the SRIO socket: DIO sockets do not need any binding information. */ if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0) { System_printf ("Error: Binding the SIO socket failed.\n"); return -1; } to.dio.rapidIOMSB = 0x0; to.dio.rapidIOLSB = uiAddr; to.dio.dstID = srioDeviceInfo.uiDeviceID4_16Bit; to.dio.ttype = Srio_Ttype_Swrite_DEFAULT;//Srio_Ttype_Write_NWRITE; to.dio.ftype = Srio_Ftype_SWRITE;//Srio_Ftype_WRITE; // srcDataBufPtr = (UInt8*)Osal_srioDataBufferMalloc(uiSize); // if (srcDataBufPtr == NULL) // { // System_printf ("Error: Source Buffer Memory Allocation Failed\n"); // return -1; // } // // RevertByteOrder64(hBuffer,srcDataBufPtr,uiSize/8); UInt8 *srcBuf = hBuffer; UInt32 srio_size = uiSize; UInt32 j,sendcount; /* Send the DIO Information. */ while(1) { if(srio_size > 0x100000) { sendcount = srio_size / 0x100000; srio_size -= (sendcount * 0x100000); for(j=0;j<sendcount;j++) { if(Srio_sockSend_DIO ( srioSocket, (Srio_DrvBuffer)srcBuf, 0x100000, (Srio_SockAddrInfo*)&to ) <0) { printf("SRIO transfer failed!"); return -1; } srcBuf += 0x100000; to.dio.rapidIOLSB = uiAddr + (j+1)*0x100000; } } else { if(Srio_sockSend_DIO ( srioSocket, (Srio_DrvBuffer)srcBuf, srio_size, (Srio_SockAddrInfo*)&to ) < 0) { printf("SRIO transfer failed!"); return -1; } srio_size = 0; } if(!srio_size) { break; } } // if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)hBuffer, uiSize, (Srio_SockAddrInfo*)&to) < 0) // { // return -1; // } // Osal_srioDataBufferFree ((Void*)srcDataBufPtr, uiSize); if(Srio_sockClose (srioSocket) < 0) { return -1; } return 0; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //����˵����ͨ��Direct IO��ʽ��Fpga��ȡ���� //���������Uint32 uiAddr �����ݵ�ַ // Srio_DrvBuffer hBuffer �����ݻ����� // Uint32 uiSize ����������С,��λΪ�ֽ� //����������� //�� �� ֵ�� �ɹ�����ֵ����0��ʧ�ܷ���ֵС��0 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Int32 ReadFpgaByDioSockets (Uint32 uiAddr,Void* hBuffer,Uint32 uiSize) { Srio_SockHandle srioSocket; Srio_SockBindAddrInfo bindInfo; Srio_SockAddrInfo to; /* Open DIO SRIO Non-Blocking Socket */ srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, FALSE); if (srioSocket == NULL) { System_printf ("Error: Unable to open the DIO socket \n"); return -1; } /* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id. * and we are using 16 bit device identifiers. */ bindInfo.dio.doorbellValid = 0; bindInfo.dio.intrRequest = 0; bindInfo.dio.supInt = 0; bindInfo.dio.xambs = 0; bindInfo.dio.priority = 0; bindInfo.dio.outPortID = 0; bindInfo.dio.idSize = 1; bindInfo.dio.srcIDMap = 0; bindInfo.dio.hopCount = 0; bindInfo.dio.doorbellReg = 0; bindInfo.dio.doorbellBit = 0; /* Bind the SRIO socket: DIO sockets do not need any binding information. */ if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0) { System_printf ("Error: Binding the SIO socket failed.\n"); return -1; } to.dio.rapidIOMSB = 0x0; to.dio.rapidIOLSB = uiAddr; to.dio.dstID = 0x5678;//srioDeviceInfo.uiDeviceID4_16Bit; to.dio.ttype = Srio_Ttype_Request_NREAD; to.dio.ftype = Srio_Ftype_REQUEST; /* Send the DIO Information. */ if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)hBuffer, uiSize, (Srio_SockAddrInfo*)&to) < 0) { return -1; } if(Srio_sockClose (srioSocket) < 0) { return -1; } return 0; } Int32 SendDoorbellByDioSockets (Void* doorbellInfo) { Srio_SockHandle srioSocket; Srio_SockBindAddrInfo bindInfo; Srio_SockAddrInfo to; /* Open DIO SRIO Non-Blocking Socket */ srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, FALSE); if (srioSocket == NULL) { System_printf ("Error: Unable to open the DIO socket \n"); return -1; } /* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id. * and we are using 16 bit device identifiers. */ bindInfo.dio.doorbellValid = 0; bindInfo.dio.intrRequest = 0; bindInfo.dio.supInt = 0; bindInfo.dio.xambs = 0; bindInfo.dio.priority = 0; bindInfo.dio.outPortID = 0; bindInfo.dio.idSize = 1; bindInfo.dio.srcIDMap = 0; bindInfo.dio.hopCount = 0; bindInfo.dio.doorbellReg = 0; bindInfo.dio.doorbellBit = 0; /* Bind the SRIO socket: DIO sockets do not need any binding information. */ if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0) { System_printf ("Error: Binding the SIO socket failed.\n"); return -1; } to.dio.rapidIOMSB = 0x0; to.dio.rapidIOLSB = 0x0; to.dio.dstID = srioDeviceInfo.uiDeviceID4_16Bit; //to.dio.ttype = Srio_Ttype_Write_NWRITE; to.dio.ftype = Srio_Ftype_DOORBELL; /* Send the DIO Information. */ if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)doorbellInfo, 0, (Srio_SockAddrInfo*)&to) < 0) { return -1; } Srio_sockClose_DIO (srioSocket); return 0; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //����˵�����ú�����������SRIO��������װSRIO�жϡ� //����������� //����������� //�� �� ֵ���� /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Void InitSrioDriver(Void) { //UInt8 *srcDataBuffer = NULL; UInt32 coreNum = 0; hSrioCSL = CSL_SRIO_Open (0); if (hSrioCSL == NULL) { printf("hsrioCSL is NULL!\n"); return; } coreNum = CSL_chipReadReg (CSL_CHIP_DNUM); //SRIO Driver Configuration����ÿ�����ж���Ҫ����SrioDriver,�Ƿ�ֻ��Core0���̳�ʼ�� //if(SrioDriverCfg(coreNum) < 0) //{ // return; //} //srio������ʼ�����ں�0��ɣ�����Ϊ���к�0��FPGAͨ�ţ��˼�ͨ�Ų�ʹ��srio // if (coreNum == CORE_SYS_INIT) // { // //if(SrioDriverCfg(coreNum) < 0) // //{ // //return; // //} // ConfigDoorbellGeneralInterrupt(hDrvManagedSrioDrv,CSL_INTC0_INTDST0,CSL_INTC_VECTID_8,FpgaDioTxCompletionIsr); // //ConfigDoorbellDedicatedInterrupt(hDrvManagedSrioDrv,FpgaDioTxCompletionIsr,); // // // //�˴���������Srio��FPGAij��ַ�ռ�д����������Ŀ����Ϊ�˱�֤�����ֽ���д������ʹ������SRIO����������SRIO�������ڴ棩 // //��������ܹ��ڿ�����һ�ν��յ�FPGA�ж� // UInt64 uiData = 0XFFFF; // WriteFpgaByDioSocketsBlocking(NOISE_MEAS_STATUS_CONTROL_REG_ADDR, &uiData, sizeof(UInt64)); // } if (coreNum == CORE_SYS_INIT){ //����srio��doorbell�ж� srioinit��ʹ�õ���ר���ж� ͨ���ж�û�е�ͨ ����������pcie�ж��е�dispatch�й�ϵ ���岻��� ConfigDoorbellDedicatedInterrupt(hDrvManagedSrioDrv,FpgaDioTxCompletionIsr,CSL_INTC_VECTID_6); } //WaitAllCoreInitOpc(DRIVER_SYNC_FLAG); printf("srio driver init complete!\n"); // }