Dears,
Do you have a sample code which used GPIOs simulate 16bit EMIF? Or could you please advise how to improve the simulate EMIF R/W speed? thanks a lot!
According to the datasheet, GPIO toggling frequency is 22.5MHz. unfortunately, It takes me 102 CPU cycles for a 16bit data read and write cycle by using below codes. Could you advise how to improve the efficiency?
#define DATA_EN_H GpioDataRegs.GPADAT.all |= 0x01000000
#define DATA_EN_L GpioDataRegs.GPADAT.all &= 0xfeffffff
#define DATA_CLK_H GpioDataRegs.GPADAT.all |= 0x00800000
#define DATA_CLK_L GpioDataRegs.GPADAT.all &= 0xFF7FFFFF
for(i=0;i<len;i++)
{
//setup data
tmp= ( ((Uint32)(*(pdata_in+i))&0xf000)<<6 ) + (((Uint32)(*(pdata_in+i))&0x0fff)<<4);
GpioDataRegs.GPADAT.all &= 0xffc3000f; //clear 16bit data;
GpioDataRegs.GPADAT.all |= tmp ; //set 16bit data;
//HOLD CLK HIGH
DATA_CLK_H; // clk high ;
GpioCtrlRegs.GPADIR.all &= 0xffc3000f; // dir=input
//HOLD CLK LOW
DATA_CLK_L; // clk low;
//read data
tmp=GpioDataRegs.GPADAT.all;
*(pdata_out+i)= ( (tmp>>6) & 0xf000) + ((tmp & 0x0ffff) >> 4);
// dir=output
GpioCtrlRegs.GPADIR.all |= 0x003cfff0;
}