Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2002 15:31:39 -0800 (PST)
From:      Mikko Tyolajarvi <mikko@dynas.se>
To:        jshamlet@hotmail.com
Cc:        questions@freebsd.org
Subject:   Re: Need help porting linux code to FreeBSD
Message-ID:  <200203182331.g2INVdM86443@mikko.rsa.com>
References:  <F164S2kUfbGRJvoYAMx00010cb1@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In local.freebsd.questions you write:

>Hello all,
>This is my first time doing any real "hardware" coding, but I have written a 
>lot of C code for other things.

>I am working on turning a Compaq IA-1 internet appliance into a useable 
>X-terminal. A great deal of work has gone into porting Linux to this device, 
>but less so on the FreeBSD side. Since I prefer FreeBSD, I thought I would 
>tackle customizing it to fit the hardware. The IA-1 has a number of 
>functions that are available through the VIA chipset by way of setting bits 
>in the chipset registers. A linux program exists to poke and prod this 
>register into turning these functions on and off (in this case, the panel 
>lights and the display backlight). It uses the io.h library, and calls outl, 
>outb, and inl.

>I would like to rewrite this code so that I can embed it in things like the 
>screen blanker (since the LCD doesn't respond to DPMS), and other user-land 
>programs to control the lights. (the power light alone would be nice).

>So, where would I need to start looking to translate this code from Linux to 
>FreeBSD? In particular, where can I dig up information on the equivalent to 
>io.h (or is there an io.h in FreeBSD?) I haven't installed all of the source 
>trees, but I did install the headers. However, I haven't found this file.

Try <machine/cpufunc.h>.  And you need to open /dev/io at the
beginning of the program, e.g.:

    if (open("/dev/io", O_RDWR, 0) < 0)
    {
        perror("/dev/io");
        return 1;
    }
 
Hmm... I think the arguments to some of the out*() functions may be
swapped, compared to Linux as well.  Check the header file.

  $.02,
  /Mikko
-- 
 Mikko Työläjärvi_______________________________________mikko@rsasecurity.com
 RSA Security

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203182331.g2INVdM86443>