task
//clear PCIE interrupt MSI0 and INTA, because boot loader need interrupt to weak up DSP to run.
//Boot loader step :
//1. load section to memory
//2. write MAGIC_ADDR with boot entry address
//3. send interrupt to DSP(MSI0 or INTA etc)
DEVICE_REG32_W(MSI0_IRQ_STATUS, 0x1);
DEVICE_REG32_W(PCIE_LEGACY_A_IRQ_STATUS, 0x1);
DEVICE_REG32_W(PCIE_IRQ_EOI, 0x0);
//时钟初始化
TSC_init();
//unused
DEVICE_REG32_W(0x1087fffc, (uint32_t)&_c_int00);
write_boot_magic_number();
//安装主机中断………..
InitHostInt();
//Srio模块初始化(包括pll,qmss、pktdma、DDR3, TSC,Gpio)
EDMA_init();
//DSP core speed: 100*10/1=1000MHz,仅需主核初始化
//KeyStone_main_PLL_init(100, 10, 1);
KeyStone_main_PLL_init(312.5, 32, 10);
//该函数配置参数需要修改
KeyStone_DDR_init (1000,2, 2, NULL);
//KeyStone_DDR_init (66.66667, 16, 1, NULL);
if(SrioInit() < 0)
{
return -1;
}
/* Initialize the SRIO Driver */
if (Srio_init () < 0)
{
System_printf ("Error: SRIO Driver Initialization Failed\n");
return -1;
}
//maokai:动态加载GPIO初始化
GPIO_init_mk();
//初始化SRIO Socket驱动
InitSrioDriver();
//maokai:translate the BARs to local RAM
ConfigPcieInBound_mk();
//创建任务前必须先进行SRIO\PCIE\EDMA\DDR3等外围接口及设备初始化
CreateTask();
//通知主机DSP初始化完成
DEVICE_REG32_W(0x10800000, 0x0C11FC00);
BIOS_start();
return (0);
task
Void TaskMain(UArg arg0, UArg arg1)
{
Int32 i=0,j=0xABAB4145,k=0,h=0,q=0;
while (1)
{
//SendInterruptToHost();
// Get access to resource
Semaphore_pend(semHostInt, BIOS_WAIT_FOREVER);
Semaphore_reset(semHostInt,0);
//UInt32 Pcie_Mode = DEVICE_REG32_R(0x10800000);
UInt32 Pcie_Mode = DEVICE_REG32_R(0x10800008);//;
UInt32 Cpu_data_length = DEVICE_REG32_R(0x1080000C);//DEVICE_REG32_R(0x8200000C);
UInt32 Cpu_data_srcaddr = 0x82000100;
UInt32 Cpu_data_dstaddr = 0x00000000;
UInt32 DspReadFPGA_srcaddr = DEVICE_REG32_R(0x10800018);
UInt32 DspReadFPGA_dstaddr = 0x10800010;
if(Pcie_Mode == 1)
{
i = 0xABAB4141;
DEVICE_REG32_W(0x10800040,i);
Pciedma_Srio_mk();
ClearInterruptToHost();
DEVICE_REG32_W(0x10800044,PCIE_EP_IRQ_CLR);
//SendInterruptToHost();
}
else if(Pcie_Mode == 2)
{
if(Cpu_data_length != 0)
{
DEVICE_REG32_W(0x10800044,j);
WriteFpgaByDioSockets_nwrite_mk (Cpu_data_dstaddr,(Uint8*) Cpu_data_srcaddr,8*Cpu_data_length);
SendInterruptToHost();
}
else
{
j++;
DEVICE_REG32_W(0x10800050,j);
SendInterruptToHost();
}
}
else if(Pcie_Mode == 3)
{
k++;
DEVICE_REG32_W(0x10800048,k);
Dsp_config_fpga_mk();
TSC_delay_ms(1000);
//SrioInit();
SendInterruptToHost();
}
else if(Pcie_Mode == 4)
{
h++;
DEVICE_REG32_W(0x1080004C,h);
ReadFpgaByDioSockets(DspReadFPGA_srcaddr,(UInt8 *) DspReadFPGA_dstaddr,8);
SendInterruptToHost();
}
}
}
Void CreateTask(Void)
{
Task_Params taskParams;
UInt32 uiCoreNum = 0;
// Create two tasks that share a resource
uiCoreNum = CSL_chipReadReg (CSL_CHIP_DNUM);
if (uiCoreNum == CORE_SYS_INIT)
{
Task_Params_init(&taskParams);
taskParams.priority = 1;
taskParams.stackSize = 8192;
Task_create (TaskMain, &taskParams, NULL);
Shine:
HWI优先级最高,首先会执行HWI。PCIe与上位机中断不是通过HWI的?
user5301336:
回复 Shine:
pcie的hwi应该是这个函数实现的吧,DSP这边要怎么样控制一下srio的中断呢?srio的中断为8号,我想先执行完pcie 中的程序,因为要从上位机加载数据文件
Void InitPcieInterruptWithSysBios()
{printf("Debug: pcie interrupt BIOS Configuration…\n\r");
InstallInterruptWithSysBios(0,PCIEXpress_Legacy_INTA,Host_To_Dsp_isr_handler_SysBios,HOST_INT_NUM_CIC0_PCIE,CSL_INTC_VECTID_12);
printf("Debug: pcie interrupt BIOS Configuration Completed\n\r");
}
user5032060:
回复 user5301336:
您好,请问您解决这个问题了吗,我也遇到相似的问题了,可以请教一下吗
user5301336:
回复 user5032060:
解决了,qq1134705322