Switch bufferen ports from output to input

Non-technical related questions should go here.
vaneenbergen
Member
Posts: 8
Joined: Mon Nov 08, 2010 8:31 pm

Switch bufferen ports from output to input

Postby vaneenbergen » Fri Nov 12, 2010 9:59 pm

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
User avatar
waluigi
Member++
Posts: 22
Joined: Sun Nov 07, 2010 6:33 pm

Postby waluigi » Fri Nov 12, 2010 10:21 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

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.
vaneenbergen
Member
Posts: 8
Joined: Mon Nov 08, 2010 8:31 pm

Postby vaneenbergen » Fri Nov 12, 2010 10:28 pm

i need a p 1 bit ported with 32bit buffering to be at startup be set to either input or output.

joost
User avatar
waluigi
Member++
Posts: 22
Joined: Sun Nov 07, 2010 6:33 pm

Postby waluigi » Fri Nov 12, 2010 10:47 pm

vaneenbergen wrote:i need a p 1 bit ported with 32bit buffering to be at startup be set to either input or output.

joost
A port is input at startup until you output.
User avatar
segher
XCore Expert
Posts: 843
Joined: Sun Jul 11, 2010 1:31 am

Postby segher » Fri Nov 12, 2010 11:17 pm

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
You don't need to turn the port off/on; stop/start (setc 7 and setc f) are enough.

Who is online

Users browsing this forum: No registered users and 0 guests