Hi,
What is the correct method to read a buffered/clocked port counter, and then block while waiting for X cycles of the clock to expire. Then Unblock and continue normal execution. Something like this.
----
buffered out port:32 p_bclk = XS1_PORT_1B;
in port inClock = XS1_PORT_1C;
clock clk = XS1_CLKBLK_1;
unsigned int count = 0;
int function_name(void)
{
...
configure_clock_src(clk, inClock);
configure_out_port_no_ready(p_bckl, clk, 0);
start_clock(clk);
// READ PORT count, but I don't want to write a 0 (or a 1) to the port, as part of the count read
p_bclk <: 0 @ count;
count += 3;
// Block for 3 clock cycles, then resume execution. Not sure of the best way to use XC to do this.
...
}
I appreciate the help,
Port Counter Event
-
- Experienced Member
- Posts: 64
- Joined: Fri Mar 25, 2011 12:36 am
-
Verified
- XCore Legend
- Posts: 1183
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
Code: Select all
p_bclk <: 0 @ count;
Code: Select all
asm volatile(" getts %0, res[%1]" : "=r" (time_stamp) : "r" (p_bclk));
Code: Select all
p_bclk @ time_stamp + 3 <: 0
Technical Director @ XMOS. Opinions expressed are my own
-
- Experienced Member
- Posts: 64
- Joined: Fri Mar 25, 2011 12:36 am
got it, thanks