Date: Sat, 03 May 2003 18:08:58 +0000 From: stef <stef-listes@wanadoo.fr> To: freebsd-questions@freebsd.org Subject: Trouble using EPP mode with /dev/ppi0 (freebsd 5.0) Message-ID: <3EB405BA.2080407@wanadoo.fr>
next in thread | raw e-mail | index | archive | help
    Hello,
    it seems I can't write to the paraller port in EPP mode. All reads 
(DATA or ADR) return 0xFF.
Accesses DATA, CONTROL and STATUS registers are working fine. I have the 
feeling that
the /dev/ppi0 is stuck in COMPAT mode.
The ppc device detects correctly the parallel port settings, and uses 
EPP mode.
I have the feeling that the /dev/ppi0 is stuck COMPAT mode.
The test program below gives:
to be written=0x58
written=0x58
read=0xFF
Strangely, when using PPISEPPA to set and read address, 'val' is zeroed:
to be written=0x58
written=0x0
read=0xFF
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <dev/ppbus/ppi.h>
#include <dev/ppbus/ppbconf.h>
int main(int argc,char **argv)
{
int fd=-1;
int rc;
u_int8_t val,control;
    fd=open("/dev/ppi0",O_RDONLY);
    if(fd<0)
    {
        perror("/dev/ppi0");
        return 1;
    }
    val=0x58;
    printf("to be written=0x%0X\n",val);
    rc = ioctl (fd, PPISEPPD, &val);
    if(rc)
    {
        perror("/dev/ppi0");
        return 1;
    }
    printf("written=0x%0X\n",val);
    /* set to data reverse */
    rc = ioctl (fd, PPIGCTRL, &control);
    if(rc)
    {
        perror("/dev/ppi0");
        return 1;
    }
      control = (control & 0x1F) | 0x20;
    rc = ioctl (fd, PPISCTRL, &control);
    if(rc)
    {
        perror("/dev/ppi0");
        return 1;
    }
    rc = ioctl (fd, PPIGEPPD, &val);
    if(rc)
    {
        perror("/dev/ppi0");
        return 1;
    }
    printf("read=0x%0X\n",val);
    close(fd);
    return 0;
}
    Any suggestion or idea ?
Regards,
    Stef
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EB405BA.2080407>
