I want to use StartKIT to simulate a SRAM, so I will use input OE, input WE, input Clock, and bi-direction Data pin.
Diagrammatic Sketch as below:
i.MX6 (MCU)<----->StartKIT (SRAM)
Now, I can simulate SRAM Reception and SRAM Transmission respectively, mean that there are two programs,
one is SRAM Reception, the other is SRAM Transmission.
And then, I use configure_in_port_strobed_slave() to do SRAM Reception, and use configure_out_port_strobed_slave()
to do SRAM Transmission.
Now I have a problem, is there any way to switch between configure_in_port_strobed_slave() setting and configure_out_port_strobed_slave setting in the run time?
My Reception and Transmission Function as below:
void Reception Function(in port p_WE_Valid, buffered port:32 p_Data, clock clk, in port p_In_Clock, unsigned short * DataBuf)
{
configure_clock_src(clk, p_In_Clock);
configure_in_port_strobed_slave(p_Data, p_WE_Valid, clk);
set_port_inv(p_WE_Valid);
clearbuf(p_Data);
start_clock(clk);
for (int i = 0; i < MAX_DATA_SIZE; i++)
{
p_Data :> value;
DataBuf[inidx] = value;
inidx++;
}
inidx *= (inidx < MAX_DATA_SIZE);
}
void Transmission Function(in port p_OE_Valid, buffered port:32 p_Data, clock clk, in port p_In_Clock, unsigned short * DataBuf)
{
configure_clock_src(clk, p_In_Clock);
configure_in_port(p_OE_Valid , clk);
configure_out_port_strobed_slave(p_Data, p_OE_Valid, clk, 1);
set_port_inv(p_OE_Valid);
set_port_inv(p_In_Clock);
clearbuf(p_Data);
start_clock(clk);
for (int i = 0; i < MAX_DATA_SIZE; i++)
{
p_Data <: DataBuf;
}
}
Any help is appreciated,
Best Regards,
Bruce Kuo