[coreboot] Paraflasher Project Update

Joseph Smith joe at settoplinux.org
Wed Dec 17 04:31:28 CET 2008


Hello,
I finally just got my SOIC to DIP adapter for the 10-Bit FET Bus Switch, so
I will get it together in the next day or two. I came up with this simple
ppdev driver (attached) to test LED's connected to the data lines, But if
all goes well it will be a good base for a Paraflasher->flashrom driver.
Comments, suggestions?

-- 
Thanks,
Joseph Smith
Set-Top-Linux
www.settoplinux.org
-------------- next part --------------
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2008 Joseph Smith <joe at settoplinux.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */

/* This is a simple program that tests the data lines by turning on
 * LED's attached to it starting at 0 and ending at 7.
 * 
 * build test program with:
 * gcc -O2 -o para_led para_led.c
 */

#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>
#include <linux/ioctl.h>
#include <linux/parport.h>
#include <linux/ppdev.h>

int main()
{
  int fd, mode, i;
  unsigned char status, data;

/* Get the file descriptor for the parallel port */
  fd = open("/dev/parport0",O_RDWR);
  if (fd == -1)
  {
    perror("open");
    exit(1);
  }

/* Request access to the port */
  if (ioctl(fd,PPCLAIM))
  {
    perror("PPCLAIM");
    close(fd);
    exit(1);
  }

/* Configure the port for SPP mode */
  mode = IEEE1284_MODE_COMPAT;
  if (ioctl(fd, PPNEGOT, &mode))
  {
    perror ("PPNEGOT");
    close (fd);
    return 1;
  }

/* Clear the data lines just in case */
  ioctl (fd, PPWDATA, 0);

/* Set the data lines */
  for (i = 0; i < 7; i++)
  {
    data = i + 1;
    ioctl (fd, PPWDATA, &data);
    sleep(2);
    data = 0;
    ioctl (fd, PPWDATA, &data);
  }

/* Release the port */
  ioctl (fd, PPRELEASE);

/* Close the device file */
  close(fd);
}


More information about the coreboot mailing list