hi all
how can i switch a buffered port from an output to an input.
with a non buffered port it's possible.
example
port sda : XS1_PORT1A;
sda <: 1; // output
sda :> v; // input
joost
Switch bufferen ports from output to input
-
- Member
- Posts: 8
- Joined: Mon Nov 08, 2010 8:31 pm
-
- Member++
- Posts: 22
- Joined: Sun Nov 07, 2010 6:33 pm
You're not supposed to because the port can mess up in the turnaround period.
You've got to basically turn off and on the port like this
You've got to basically turn off and on the port like this
Code: Select all
#define set_port_on(p) __asm__("setc res[%0], 0x8": : "r"(p));
#define set_port_buffered(p) __asm__("setc res[%0], 0x200f": : "r"(p));
#define set_port_tw(p, v) __asm__("settw res[%0], %1": : "r"(p), "r"(v));
#define resetBufPort(p, w) { \
set_port_on(p); \
set_port_buffered(p); \
set_port_tw(p, w); \
}
Last edited by waluigi on Fri Nov 12, 2010 10:47 pm, edited 1 time in total.
-
- Member
- Posts: 8
- Joined: Mon Nov 08, 2010 8:31 pm
i need a p 1 bit ported with 32bit buffering to be at startup be set to either input or output.
joost
joost
-
- Member++
- Posts: 22
- Joined: Sun Nov 07, 2010 6:33 pm
A port is input at startup until you output.vaneenbergen wrote:i need a p 1 bit ported with 32bit buffering to be at startup be set to either input or output.
joost
-
- XCore Expert
- Posts: 844
- Joined: Sun Jul 11, 2010 1:31 am
You don't need to turn the port off/on; stop/start (setc 7 and setc f) are enough.waluigi wrote:You're not supposed to because the port can mess up in the turnaround period.
You've got to basically turn off and on the port like this