Re: sio i/o

2002-11-07 Thread Julien Mabillard
actually, i will code that as a pseudo device to manage
a small box over serial line that manages some external
devices.

and i was also curious to know how to do it in userland,
but i know i/o feels better in kernel

:-)

On Thu, Nov 07, 2002 at 10:23:16AM -0800, Julian Elischer wrote:
> 
> 
> On Thu, 7 Nov 2002, John Baldwin wrote:
> 
> > 
> > On 07-Nov-2002 Julien Mabillard wrote:
> > > hi,
> > > can anyone tell me where inb(), outb() are defined
> > > in the sources (FreeBSD RELENG_4_7 or CURRENT)?
> > > on linux systems this is defined in 
> > 
> > For FreeBSD should be using bus_space_read_1() and bus_space_write_1()
> > instead.  However, you can find inb() and outb() in
> >  on i386 and compatibility macros for some other
> > arch's in 
> > 
> 
> it depends if he wants to do it in or out of the kernel..
> He doesn't specify..
> :-/
> 
> 
> 
> > -- 
> > 
> > John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
> > "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> > 
> > To Unsubscribe: send mail to [EMAIL PROTECTED]
> > with "unsubscribe freebsd-hackers" in the body of the message
> > 
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message

-- 

Key fingerprint = D34A 577C 869B 28A2 3886  4298 50CB DC18 31A4 ACAD

email: [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: sio i/o

2002-11-07 Thread Terry Lambert
Christoph Hellwig wrote:
> Umm,  ispurely a userland header on linux, so he's probably
> referring to the userland versions of those that are provided by the
> linux ports with PC-like hardware..

Then the answer is even easier: Don't do it from userland, since you
should not be using sys header files that came from /sys//include
from user space, at all.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



RE: sio i/o

2002-11-07 Thread Julian Elischer


On Thu, 7 Nov 2002, John Baldwin wrote:

> 
> On 07-Nov-2002 Julien Mabillard wrote:
> > hi,
> > can anyone tell me where inb(), outb() are defined
> > in the sources (FreeBSD RELENG_4_7 or CURRENT)?
> > on linux systems this is defined in 
> 
> For FreeBSD should be using bus_space_read_1() and bus_space_write_1()
> instead.  However, you can find inb() and outb() in
>  on i386 and compatibility macros for some other
> arch's in 
> 

it depends if he wants to do it in or out of the kernel..
He doesn't specify..
:-/



> -- 
> 
> John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: sio i/o

2002-11-07 Thread Julian Elischer
 from memory, however note that outb has the
arguments in the opposite order.


On Thu, 7 Nov 2002, Julien Mabillard wrote:

> hi,
> can anyone tell me where inb(), outb() are defined
> in the sources (FreeBSD RELENG_4_7 or CURRENT)?
> on linux systems this is defined in 
> 
> thank you.
> 
> 
> Key fingerprint = D34A 577C 869B 28A2 3886  4298 50CB DC18 31A4 ACAD
> 
> email: [EMAIL PROTECTED]
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: sio i/o

2002-11-07 Thread Bruce R. Montague

 FWIW, regarding direct user application access
to I/O space, (a technique to be avoided if at all
possible, but sometimes useful for those "1-hour 
emergency" projects, see the question

 "How do I directly access I/O devices from an application 
  program (use in and out instructions)?"

 In the picobsd FAQ at:

 http://alumni.cse.ucsc.edu/~brucem/pico_notes.htm
 http://www.cse.ucsc.edu/~brucem/pico_notes.htm

 It has an example program for FreeBSD 4.3.
In short, open ``/dev/io''. Hold the handle for as
short a period as possible. Include


- bruce

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: sio i/o

2002-11-07 Thread Christoph Hellwig
On Thu, Nov 07, 2002 at 10:51:31AM -0500, John Baldwin wrote:
> Doing I/O from userland generally isn't supported.  A header with 
> is a kernel header though, not a userland one. :)

Only on traditional Unix systems.  On Linux it never is.

> For i386-only, if
> you do the right calls to obtain permission to do I/O, the functions
> in machine/cpufunc.h should work however.

Of course you need the permission on linux aswell, and again only a
small number of ports actually supports it.  It's generally discuraged.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: sio i/o

2002-11-07 Thread John Baldwin

On 07-Nov-2002 Christoph Hellwig wrote:
> On Thu, Nov 07, 2002 at 09:33:29AM -0500, John Baldwin wrote:
>> 
>> On 07-Nov-2002 Julien Mabillard wrote:
>> > hi,
>> > can anyone tell me where inb(), outb() are defined
>> > in the sources (FreeBSD RELENG_4_7 or CURRENT)?
>> > on linux systems this is defined in 
>> 
>> For FreeBSD should be using bus_space_read_1() and bus_space_write_1()
>> instead.  However, you can find inb() and outb() in
>>  on i386 and compatibility macros for some other
>> arch's in 
> 
> Umm,  ispurely a userland header on linux, so he's probably
> referring to the userland versions of those that are provided by the
> linux ports with PC-like hardware..

Doing I/O from userland generally isn't supported.  A header with 
is a kernel header though, not a userland one. :)  For i386-only, if
you do the right calls to obtain permission to do I/O, the functions
in machine/cpufunc.h should work however.

-- 

John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: sio i/o

2002-11-07 Thread Christoph Hellwig
On Thu, Nov 07, 2002 at 09:33:29AM -0500, John Baldwin wrote:
> 
> On 07-Nov-2002 Julien Mabillard wrote:
> > hi,
> > can anyone tell me where inb(), outb() are defined
> > in the sources (FreeBSD RELENG_4_7 or CURRENT)?
> > on linux systems this is defined in 
> 
> For FreeBSD should be using bus_space_read_1() and bus_space_write_1()
> instead.  However, you can find inb() and outb() in
>  on i386 and compatibility macros for some other
> arch's in 

Umm,  ispurely a userland header on linux, so he's probably
referring to the userland versions of those that are provided by the
linux ports with PC-like hardware..

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: sio i/o

2002-11-07 Thread Julien Mabillard
great, thanks :-)

On Thu, Nov 07, 2002 at 09:33:29AM -0500, John Baldwin wrote:
> 
> On 07-Nov-2002 Julien Mabillard wrote:
> > hi,
> > can anyone tell me where inb(), outb() are defined
> > in the sources (FreeBSD RELENG_4_7 or CURRENT)?
> > on linux systems this is defined in 
> 
> For FreeBSD should be using bus_space_read_1() and bus_space_write_1()
> instead.  However, you can find inb() and outb() in
>  on i386 and compatibility macros for some other
> arch's in 
> 
> -- 
> 
> John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message

-- 

Key fingerprint = D34A 577C 869B 28A2 3886  4298 50CB DC18 31A4 ACAD

email: [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



RE: sio i/o

2002-11-07 Thread John Baldwin

On 07-Nov-2002 Julien Mabillard wrote:
> hi,
> can anyone tell me where inb(), outb() are defined
> in the sources (FreeBSD RELENG_4_7 or CURRENT)?
> on linux systems this is defined in 

For FreeBSD should be using bus_space_read_1() and bus_space_write_1()
instead.  However, you can find inb() and outb() in
 on i386 and compatibility macros for some other
arch's in 

-- 

John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



sio i/o

2002-11-07 Thread Julien Mabillard
hi,
can anyone tell me where inb(), outb() are defined
in the sources (FreeBSD RELENG_4_7 or CURRENT)?
on linux systems this is defined in 

thank you.


Key fingerprint = D34A 577C 869B 28A2 3886  4298 50CB DC18 31A4 ACAD

email: [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message