Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 2 → Rev 35

/shark/tags/rel_0_2/drivers/net/ne.c
227,12 → 227,12
}
if (!pdev)
continue;
printk(KERN_INFO "ne.c: PCI BIOS reports %s at i/o %#x, irq %d.\n",
printk(KERN_INFO "ne.c: PCI BIOS reports %s at i/o %x, irq %d.\n",
pci_clone_list[i].name,
pci_ioaddr, pci_irq_line);
printk("*\n* Use of the PCI-NE2000 driver with this card is recommended!\n*\n");
if (ne_probe1(dev, pci_ioaddr) != 0) { /* Shouldn't happen. */
printk(KERN_ERR "ne.c: Probe of PCI card at %#x failed.\n", pci_ioaddr);
printk(KERN_ERR "ne.c: Probe of PCI card at %x failed.\n", pci_ioaddr);
pci_irq_line = 0;
return -ENXIO;
}
285,7 → 285,7
if (ei_debug && version_printed++ == 0)
printk(version);
 
printk(KERN_INFO "NE*000 ethercard probe at %#3x:", ioaddr);
printk(KERN_INFO "NE*000 ethercard probe at %3x:", ioaddr);
 
/* A user with a poor card that fails to ack the reset, or that
does not have a valid 0x57,0x57 signature can still use this
473,7 → 473,7
dev->dev_addr[i] = SA_prom[i];
}
 
printk("\n%s: %s found at %#x, using IRQ %d.\n",
printk("\n%s: %s found at %x, using IRQ %d.\n",
dev->name, name, ioaddr, dev->irq);
 
ei_status.name = name;
638,7 → 638,7
} while (--tries > 0);
if (tries <= 0)
printk(KERN_WARNING "%s: RX transfer address mismatch,"
"%#4.4x (expected) vs. %#4.4x (actual).\n",
"%4.4x (expected) vs. %4.4x (actual).\n",
dev->name, ring_offset + xfer_count, addr);
}
#endif
/shark/tags/rel_0_2/drivers/net/eth.c
20,11 → 20,11
 
/**
------------
CVS : $Id: eth.c,v 1.1.1.1 2002-03-29 14:12:50 pj Exp $
CVS : $Id: eth.c,v 1.3 2002-11-11 08:41:31 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:50 $
Revision: $Revision: 1.3 $
Last update: $Date: 2002-11-11 08:41:31 $
------------
**/
 
74,6 → 74,8
/*#include "lowlev.h"
//#include "3com.h" */
 
//#define DEBUG_ETH
 
#define ETH_PAGE 5
 
struct eth_service{
131,7 → 133,7
 
void dev_tint(struct device *dev)
{
cprintf("Warning!!!! dev_tint called!!! (Why???)\n");
printk(KERN_WARNING "Warning!!!! dev_tint called!!! (Why?)\n");
sys_abort(201);
}
145,7 → 147,7
{
//cprintf("DENTRO netif_rx, skbuf=%p\n",skb->data);
if (nettask_pid == NIL) {
cprintf("Net receives packets, but the driver doesn't exist!!!\n");
printk(KERN_CRIT "Net receives packets, but the driver doesn't exist!!!\n");
sys_abort(300);
}
200,7 → 202,7
/* formatted print of an ethernet header */
void eth_printHeader(struct eth_header *p)
{
cprintf("Dest : %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n",p->dest.ad[0],
cprintf("Dest : %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n",p->dest.ad[0],
p->dest.ad[1],
p->dest.ad[2],
p->dest.ad[3],
338,27 → 340,27
{
int p;
 
if (err != ETH_BUFFERS_FULL) cprintf("Ethernet : ");
if (err != ETH_BUFFERS_FULL) printk(KERN_ERR "Ethernet : ");
switch (err) {
case ETH_DRIVER_NOT_FOUND :
cprintf("NET PANIC --> Etherlink not found.\n");
printk(KERN_ERR "NET PANIC --> Etherlink not found.\n");
return 0;
case ETH_RXERROR :
cprintf("Receive error (vero dramma!!!).\n");
printk(KERN_ERR "Receive error (vero dramma!!!).\n");
return 0;
case ETH_TXERROR :
cprintf("Transimit error: N. Max Retry.\n");
printk(KERN_ERR "Transimit error: N. Max Retry.\n");
return 0;
case ETH_PROTOCOL_ERROR :
cprintf("Too much protocols.\n");
printk(KERN_ERR "Too much protocols.\n");
return 0;
case ETH_BUFFERS_FULL:
cprintf("Buffers full: frame lost!\n");
printk(KERN_ERR "Buffers full: frame lost!\n");
return 1;
case ETH_NULLPROTOCOL_EXC:
cprintf("Null protocol called!!!\n");
printk(KERN_ERR "Null protocol called!!!\n");
for (p = 0; p < ETH_MAX_PROTOCOLS; p++) {
cprintf("%d: %d\n", p, eth_table[p].type);
printk(KERN_ERR "%d: %d\n", p, eth_table[p].type);
}
return 0;
default :
377,7 → 379,7
int linux_found = 0;
 
if (!ethIsInstalled) {
cprintf(" Hartik Net lib\n\n");
printk(KERN_INFO "Hartik/Shark Net lib");
/* Scan the devices connected to the PCI bus */
cardtype = NONE;
 
391,24 → 393,30
soft_task_def_aperiodic(m_soft);
soft_task_def_system(m_soft);
soft_task_def_nokill(m_soft);
m = &m_soft;
m = (TASK_MODEL *)&m_soft;
}
 
nettask_pid = task_create("rxProc", net_extern_driver, m, NULL);
if (nettask_pid == NIL) {
cprintf("Can't create extern driver!!!\n");
return 0;
printk(KERN_ERR "Can't create extern driver!!!\n");
return 0;
}
task_activate(nettask_pid);
if (pci_init() == 1) {
linuxpci_init();
// pci_show();
cprintf("LF %d\n", linux_found);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
linux_found += (rtl8139_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
linux_found += (tc59x_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
#if 0
ndev = pci_scan_bus(pci_devs);
#ifdef __ETH_DBG__
434,7 → 442,7
} else {
lowlev_send = vortex_send_mem;
}
cprintf("PCI Ethlink card found:\n");
printk(KERN_INFO "PCI Ethlink card found:\n");
lowlev_info(r);
cardtype = VORTEX;
}
460,10 → 468,14
#else
}
if (linux_found == 0) {
linux_found += (el3_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
linux_found += (ne_probe(&device0) == 0);
cprintf("LF %d\n", linux_found);
linux_found += (el3_probe(&device0) == 0);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
linux_found += (ne_probe(&device0) == 0);
#ifdef DEBUG_ETH
printk(KERN_DEBUG "LF %d\n", linux_found);
#endif
}
 
/*
474,9 → 486,9
*/
if (linux_found) {
device0.open(&device0);
cprintf("Net card found!!!\n");
printk(KERN_INFO "Net card found!!!\n");
} else {
cprintf("No card found... \n");
printk(KERN_INFO "No card found... \n");
/* cprintf("No card found... Installing loopback device\n");
loopback_init(&device0);
device0.open(&device0);*/
497,7 → 509,7
sys_atrunlevel(eth_close,NULL,RUNLEVEL_BEFORE_EXIT);
 
} else {
cprintf("Ethernet already installed!!!\n");
printk(KERN_INFO "Ethernet already installed!!!\n");
return 0;
}
return 1;
505,10 → 517,12
 
void eth_close(void *a)
{
kern_printf("CLOSE!!!!\n");
if (ethIsInstalled == TRUE) {
device0.stop(&device0); /*This seems to break everithing...
// lowlev_close(eth_dev.BaseAddress);*/
ethIsInstalled = FALSE;
}
#ifdef DEBUG_ETH
printk(KERN_DEBUG "CLOSE!!!!\n");
#endif
if (ethIsInstalled == TRUE) {
device0.stop(&device0); /*This seems to break everithing...
// lowlev_close(eth_dev.BaseAddress);*/
ethIsInstalled = FALSE;
}
}
/shark/tags/rel_0_2/drivers/net/net.c
20,11 → 20,11
 
/**
------------
CVS : $Id: net.c,v 1.1.1.1 2002-03-29 14:12:50 pj Exp $
CVS : $Id: net.c,v 1.2 2002-10-28 08:01:36 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:50 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-10-28 08:01:36 $
------------
**/
 
63,6 → 63,8
#include <drivers/net.h>
#include "eth_priv.h"
 
//#define DEBUG_NET
 
/* OKKIO!!!!! net_base must change if you change NET_MAX_PROTOCOLS!!!! */
struct net_model net_base = {0, 0, {NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
88,8 → 90,10
}
/* Then, the high level layers */
for(i = 0; i < m->numprotocol; i++) {
cprintf("Protocol %d init \n", i);
m->protocol[i].initfun(m->protocol[i].initparms);
#ifdef DEBUG_NET
printk(KERN_DEBUG "Protocol %d init \n", i);
#endif
m->protocol[i].initfun(m->protocol[i].initparms);
}
 
return 1;
/shark/tags/rel_0_2/drivers/parport/ppnrtdrv.c
0,0 → 1,295
/*
*
* Project:
* Parallel Port S.Ha.R.K. Project
*
* Module:
* ppNRTDrv.c
*
* Description:
* file contents description
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors:
* Andrea Battistotti <btandrea@libero.it>
* Armando Leggio <a_leggio@hotmail.com>
*
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*
*/
/*************************************************************************
* Module : ppNRTDrv.c
* Author : Andrea Battistotti , Armando Leggio
* Description: Set On/Off single pin of LPT1...
* 2002 @ Pavia - GNU Copyrights
*******************************************************************************************/
 
/*
* Copyright (C) 2002 Andrea Battistotti , Armando Leggio
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* CVS : $Id: ppnrtdrv.c,v 1.1 2002-10-28 08:03:54 pj Exp $
*/
 
 
/*******************************************************************************************
* A standard PC provides for three printer ports, at the following base addresses:
*
* LPT1 = 0x0378 or 0x03BC
* LPT2 = 0x0278 or 0x0378
* LPT3 = 0x0278
*
* This module assumes that LPT1 is at 0x0378.
*
* The printer port has three 8-bit registers:
*
* Data Register (base + 0) ........ outputs
*
* 7 6 5 4 3 2 1 0
* . . . . . . . * D0 ........... (pin 2), 1=High, 0=Low (true)
* . . . . . . * . D1 ........... (pin 3), 1=High, 0=Low (true)
* . . . . . * . . D2 ........... (pin 4), 1=High, 0=Low (true)
* . . . . * . . . D3 ........... (pin 5), 1=High, 0=Low (true)
* . . . * . . . . D4 ........... (pin 6), 1=High, 0=Low (true)
* . . * . . . . . D5 ........... (pin 7), 1=High, 0=Low (true)
* . * . . . . . . D6 ........... (pin 8), 1=High, 0=Low (true)
* * . . . . . . . D7 ........... (pin 9), 1=High, 0=Low (true)
*
* Status Register (base + 1) ...... inputs
*
* 7 6 5 4 3 2 1 0
* . . . . . * * * Undefined
* . . . . * . . . Error ........ (pin 15), high=1, low=0 (true)
* . . . * . . . . Selected ..... (pin 13), high=1, low=0 (true)
* . . * . . . . . No paper ..... (pin 12), high=1, low=0 (true)
* . * . . . . . . Ack .......... (pin 10), high=1, low=0 (true)
* * . . . . . . . Busy ......... (pin 11), high=0, low=1 (inverted)
*
* Control Register (base + 2) ..... outputs
*
* 7 6 5 4 3 2 1 0
* . . . . . . . * Strobe ....... (pin 1), 1=low, 0=high (inverted)
* . . . . . . * . Auto Feed .... (pin 14), 1=low, 0=high (inverted)
* . . . . . * . . Initialize ... (pin 16), 1=high, 0=low (true)
* . . . . * . . . Select ....... (pin 17), 1=low, 0=high (inverted)
* * * * * . . . . Unused
*
* Pins 18-25 are ground.
********************************************************************************************/
 
#include <drivers/parport.h>
 
 
/*************************************************************************/
BOOL ppNRTWaitRTS(void)
{
BYTE port;
TIME start = clock();
do
{
port = ~inp(RX_PORT); /* port status */
port = port & RX_CTR; /* test cntr read bit*/
if(clock() > start + CLK_TIMEOUT) return TIMEOUT;
} while(port == 0);
return TRUE;
}
 
/*************************************************************************/
BOOL ppNRTWaitDR(void)
{
BYTE port;
TIME start = clock(); /* start */
do {
port = (~inp(RX_PORT)) | (~RX_CTR); /* test cntr read bit*/
if(clock() > start + CLK_TIMEOUT) return TIMEOUT;
} while(port != 0x7F); /* 0111 1111 */
 
return TRUE;
}
 
/*************************************************************************/
BOOL ppNRTWaitOTS(void)
{
BYTE port;
TIME start = clock(); /* start time */
do
{
port = ~inp(RX_PORT); /* read port status */
port = port & RX_CTR; /* test cntr read bit*/
if(clock() > start + CLK_TIMEOUT) return TIMEOUT;
} while(port == 0);
return TRUE;
}
 
/*************************************************************************/
BOOL ppNRTWaitER(void)
{
BYTE port;
TIME start = clock(); /* start */
do
{
port = ~inp(RX_PORT); /* read port status */
port = port | (~RX_CTR); /* test cntr read bit*/
if(clock() > start + CLK_TIMEOUT) return TIMEOUT;
} while(port != 0x7F); /* 0111 1111 */
return TRUE;
}
 
 
/**************************************************************************/
BOOL ppNRTTxOneByte(BYTE c)
{
BYTE port;
/*------------------------- Least Significative Nibble */
ppSendRTS(); /* Request To Send */
 
port = inp(TX_PORT); /* read port status */
port = port & (~TX_DATA); /* set tx bits == 0 */
port = port | (c & LSN); /* set bit 0..3 with LSN */
 
#if PP_DEBUG == 1
kern_printf("ppNRTTxOneByte: SendRTS, before WaitOTS\n");
#endif
 
if(ppNRTWaitOTS()!=TRUE) return TIMEOUT;
outp(TX_PORT,port);
ppSendDR(); /* Data Ready */
 
#if PP_DEBUG == 1
kern_printf("ppNRTTxOneByte: SendDR, before WaitER\n");
#endif
 
 
if(ppNRTWaitER() !=TRUE) return TIMEOUT;
 
/*------------------------- More Significative Nibble */
ppSendRTS(); /* Request To Send */
 
port = inp(TX_PORT); /* read port status */
port = port & (~TX_DATA); /* set off trasmission bits... */
port = port | (c >> 4); /* set bit 0..3 with MSN */
 
#if PP_DEBUG == 1
kern_printf("ppNRTTxOneByte: SendRTS, before WaitOTS\n");
#endif
 
if(ppNRTWaitOTS()!=TRUE) return TIMEOUT;
outp(TX_PORT,port); /* send data nibble... */
ppSendDR(); /* Data Ready */
 
#if PP_DEBUG == 1
kern_printf("ppNRTTxOneByte: SendDR, before WaitER\n");
#endif
 
if(ppNRTWaitER() !=TRUE) return TIMEOUT;
 
return TRUE;
}
 
/**************************************************************************/
BOOL ppNRTRxOneByte(BYTE *c)
{
BYTE port;
 
if(ppIsRTS() == FALSE) return FALSE;
 
 
ppSendOTS(); /* Ok To Send */
 
#if PP_DEBUG == 1
kern_printf("ppNRTRxOneByte: IsRTS, SendOTS, before WaitDR\n");
#endif
 
if(ppNRTWaitDR() != TRUE) return TIMEOUT;
port = inp(RX_PORT); /* read nibble */
ppSendER(); /* End Read */
*c = (port >> 3); /* read LSN */
 
#if PP_DEBUG == 1
kern_printf("ppNRTRxOneByte: SendER, before WaitRTS\n");
#endif
 
if(ppNRTWaitRTS() != TRUE) return TIMEOUT;
ppSendOTS();
 
#if PP_DEBUG == 1
kern_printf("ppNRTRxOneByte: SendOTS, before WaitDR\n");
#endif
 
if(ppNRTWaitDR() != TRUE) return TIMEOUT;
 
#if PP_DEBUG == 1
kern_printf("ppNRTRxOneByte: DR received, send ER\n");
#endif
 
port = inp(RX_PORT); /* read nibble */
ppSendER(); /* End Read */
*c = (*c & ~MSN); /* set 0 c MSN nibble... */
*c = (*c | ((port >> 3) << 4)); /* read MSN */
 
return TRUE;
}
 
 
/*************************************************************************
------------------------------------------------------------------------*/
BOOL ppNRTOpenComm(void)
{
BYTE c,port,rx,tx;
TIME start = clock();
 
outp(TX_PORT,0);
outp(TX_CTR,0);
 
do
{
port = inp(RX_PORT); /* read nibble */
/* x4321x xx */
c = (port >> 3); /* xxxx 4321 */
c = c & 0xF; /* 0000 4321 */
if(clock() > start + CLK_TIMEOUT*20) return TIMEOUT;
} while (c != 0); /* test nibble 4321 == 0000 */
 
/* the other also is laying down his TX_PORT (==my RX_PORT...) */
 
rx = FALSE; tx = FALSE; start = clock();
do /* try if it also on line... */
{
 
if((rx == FALSE) && (ppNRTRxOneByte(&c)==TRUE) && (c == BYTE_CTR)) rx = TRUE;
if((tx == FALSE) && (ppNRTTxOneByte(BYTE_CTR) == TRUE)) tx = TRUE;
 
if(clock() > start + CLK_TIMEOUT*20) return TIMEOUT;
 
} while(tx==FALSE || rx==FALSE);
 
ppSendER();
ppNRTWaitER();
 
return TRUE;
 
}
 
/shark/tags/rel_0_2/drivers/parport/pppindrv.c
0,0 → 1,127
/*
*
* Project:
* Parallel Port S.Ha.R.K. Project
*
* Module:
* ppPinDrv.c
*
* Description:
* file contents description
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors:
* Andrea Battistotti <btandrea@libero.it>
* Armando Leggio <a_leggio@hotmail.com>
*
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*
*/
/*******************************************************************************************
* Module : ppPinDrv.c
* Author : Andrea Battistotti , Armando Leggio
* Description: Set On/Off single pin of LPT1...
* 2002 @ Pavia - GNU Copyrights
*******************************************************************************************/
 
/*
* Copyright (C) 2002 Andrea Battistotti , Armando Leggio
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* CVS : $Id: pppindrv.c,v 1.1 2002-10-28 08:03:55 pj Exp $
*/
 
 
/*******************************************************************************************
* A standard PC provides for three printer ports, at the following base addresses:
*
* LPT1 = 0x0378 or 0x03BC
* LPT2 = 0x0278 or 0x0378
* LPT3 = 0x0278
*
* This module assumes that LPT1 is at 0x0378.
*
* The printer port has three 8-bit registers:
*
* Data Register (base + 0) ........ outputs
*
* 7 6 5 4 3 2 1 0
* . . . . . . . * D0 ........... (pin 2), 1=High, 0=Low (true)
* . . . . . . * . D1 ........... (pin 3), 1=High, 0=Low (true)
* . . . . . * . . D2 ........... (pin 4), 1=High, 0=Low (true)
* . . . . * . . . D3 ........... (pin 5), 1=High, 0=Low (true)
* . . . * . . . . D4 ........... (pin 6), 1=High, 0=Low (true)
* . . * . . . . . D5 ........... (pin 7), 1=High, 0=Low (true)
* . * . . . . . . D6 ........... (pin 8), 1=High, 0=Low (true)
* * . . . . . . . D7 ........... (pin 9), 1=High, 0=Low (true)
*
* Status Register (base + 1) ...... inputs
*
* 7 6 5 4 3 2 1 0
* . . . . . * * * Undefined
* . . . . * . . . Error ........ (pin 15), high=1, low=0 (true)
* . . . * . . . . Selected ..... (pin 13), high=1, low=0 (true)
* . . * . . . . . No paper ..... (pin 12), high=1, low=0 (true)
* . * . . . . . . Ack .......... (pin 10), high=1, low=0 (true)
* * . . . . . . . Busy ......... (pin 11), high=0, low=1 (inverted)
*
* Control Register (base + 2) ..... outputs
*
* 7 6 5 4 3 2 1 0
* . . . . . . . * Strobe ....... (pin 1), 1=low, 0=high (inverted)
* . . . . . . * . Auto Feed .... (pin 14), 1=low, 0=high (inverted)
* . . . . . * . . Initialize ... (pin 16), 1=high, 0=low (true)
* . . . . * . . . Select ....... (pin 17), 1=low, 0=high (inverted)
* * * * * . . . . Unused
*
* Pins 18-25 are ground.
********************************************************************************************/
 
#include <drivers/parport.h>
 
 
void ppSetDataPin(int state, PIN_MASK pin)
{
BYTE port;
port=ppReadDataByte();
switch (state)
{
case PIN_OFF: port &= ~pin;
case PIN_ON: port |= pin;
}
ppSetDataByte(port);
}
 
 
void ppSetCtrlPin(int state, PIN_MASK pin)
{
BYTE port;
port=ppReadCtrlByte();
switch (state)
{
case PIN_OFF: port &= ~pin;
case PIN_ON: port |= pin;
}
ppSetCtrlByte(port);
}
 
/shark/tags/rel_0_2/drivers/parport/ppdrv.c
0,0 → 1,543
/*
* Project:
* Parallel Port S.Ha.R.K. Project
*
* Module:
* ppDrv.c
*
* Description:
* file contents description
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors:
* Andrea Battistotti <btandrea@libero.it>
* Armando Leggio <a_leggio@hotmail.com>
*
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*
*/
 
/**********************************************************************************************************
* Module : ppDrv.c Author : Andrea Battistotti , Armando Leggio
* Description: Tranfer Byte via LPT1 laplink cable... 2002 @ Pavia -
* GNU Copyrights */
 
/*
* Copyright (C) 2002 Andrea Battistotti , Armando Leggio
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* CVS : $Id: ppdrv.c,v 1.1 2002-10-28 08:03:54 pj Exp $
*/
 
 
#include <drivers/parport.h>
 
 
/* internal */
BYTE RxBuf[PP_BUF_LEN]; /* Received bytes buffer */
BYTE TxBuf[PP_BUF_LEN]; /* To transmit bytes buffer */
 
unsigned int nextByteReadyToRx; /* pointer to first byte to read by ppOneByteRx(BYTE *c) ... */
unsigned int nextByteReadyToTx; /* when ppbTransmit had to send a byte, send this...*/
unsigned int nextByteFreeRx; /* when polling complete reading a byte, will save it in this loc...*/
unsigned int nextByteFreeTx; /* when ppbTransmit had to write a byte, write it here...*/
 
/* define inline macro */
/* these are for cicle buffer mamagement */
#define RxPointerGap (nextByteFreeRx-nextByteReadyToRx)
#define bytesReadyToRx ((RxPointerGap)>=0? (RxPointerGap):PP_BUF_LEN+(RxPointerGap))
#define TxPointerGap (nextByteFreeTx-nextByteReadyToTx)
#define bytesReadyToTx ((TxPointerGap)>=0? (TxPointerGap):PP_BUF_LEN+(TxPointerGap))
#define freeBytesInRxBuffer (PP_BUF_LEN-bytesReadyToRx)
#define freeBytesInTxBuffer (PP_BUF_LEN-bytesReadyToTx)
 
 
/* for pp sys msg */
char SysMsg[SYS_MSG_COLS+1][SYS_MSG_LINS+1]; /* space for sys msgs... */
char bufMsg[SYS_MSG_COLS+1]; /* to build msgs... */
 
unsigned int nextMsgToRead;
unsigned int nextMsgFreeToWrite;
 
/* define inline macro */
/* these are for cicle buffer mamagement */
#define msgPointerGap (nextMsgFreeToWrite-nextMsgToRead)
#define msgReadyToRead ((msgPointerGap)>=0? (msgPointerGap):SYS_MSG_LINS+(msgPointerGap))
#define freeMsgInBuffer (SYS_MSG_LINS-msgReadyToRead)
 
 
 
 
/* status ... */
enum ppReadingAvailableStates
{
ppNoAllowReading, /* writing is on...*/
ppNoReading,
ppWaitingDR_Nibble1,
ppWaitingRTS_Nibble2,
ppWaitingDR_Nibble2,
};
 
enum ppWritingAvailableStates
{
ppNoAllowWriting, /* reading is on...*/
ppNoWriting,
ppWaitingOTS_Nibble1,
ppWaitingER_Nibble1,
ppWaitingOTS_Nibble2,
ppWaitingER_Nibble2
};
 
 
int ppStatusReading;
int ppStatusWriting;
BYTE ppReceivingByte;
BYTE ppTransmittingByte;
 
 
#if PP_STATS == 1
/* for internal statistic ...if activate...*/
long statReading[ppWaitingDR_Nibble2+1];
long statWriting[ppWaitingER_Nibble2+1];
#endif
 
 
 
/*********************************************/
/* sys msg managment */
/*********************************************/
 
int ppReadSysMsg(char * buf)
{
if (!msgReadyToRead) /* there is nothing to read...*/
{
return (PP_NOSYSMSG_EXC);
}
else
{int i=0;
while (i<SYS_MSG_COLS && SysMsg[nextMsgToRead][i]) /* !='\0'...*/
*buf++=SysMsg[nextMsgToRead][i++]; /* read char */
*buf='\0';
nextMsgToRead=++nextMsgToRead%SYS_MSG_LINS; /* circular buffer increment */
return (PP_SYSMSG_OK);
}
}
 
 
 
int ppWriteSysMsg(char * buf, ...)
{
char * pbufMsg=bufMsg;
va_list args;
bufMsg[0]='\0';
va_start(args, buf);
vsprintf(bufMsg,buf,args); /* Not garatee msg len... */
va_end(args);
 
if (freeMsgInBuffer < 1)
{
return (PP_NOFREEMSG_EXC);
}
else
{int i=0;
while ((i<SYS_MSG_COLS) && (*pbufMsg) ) /* !='\0'...*/
SysMsg[nextMsgFreeToWrite][i++]=*pbufMsg++;
SysMsg[nextMsgFreeToWrite][i-1]='\n';
SysMsg[nextMsgFreeToWrite][i]='\0';
nextMsgFreeToWrite=++nextMsgFreeToWrite%SYS_MSG_LINS; /* circular buffer pointer increment */
return (PP_SYSMSG_OK);
}
}
 
 
/******************************************/
/* Inizialization: this is NRT task... */
/******************************************/
 
void ppInitDrv(void (*pf)(char *))
{
/* set to zero all pointer & buffer & status... */
 
 
while(ppNRTOpenComm()!=TRUE) // not real-time....
{
if (pf!=NULL) (*pf)("Waiting Open Communcation...\n");
ppSendER();
}
if (pf!=NULL) (*pf)("Open Communcation OK!\n");
}
 
 
/******************************************/
/* TX RX funtions... */
/******************************************/
 
int ppRxOneByte(BYTE *c)
{
if (!bytesReadyToRx) /* there is nothing to read...*/
{
return (PP_COMM_NOREADYBYTES_EXC);
}
else
{
*c=RxBuf[nextByteReadyToRx]; /* read byte */
nextByteReadyToRx=++nextByteReadyToRx%PP_BUF_LEN; /* circular buffer increment */
return (PP_COMM_OK);
}
}
 
 
int ppTxOneByte(BYTE c)
{
if (freeBytesInTxBuffer < 1)
{
return (PP_COMM_NOFREEBYTES_EXC);
}
else
{
TxBuf[nextByteFreeTx]=c;
nextByteFreeTx=++nextByteFreeTx%PP_BUF_LEN; /* circular buffer pointer increment */
 
return (PP_COMM_OK);
}
}
 
int ppTxBytes(BYTE * c, unsigned int nbyte)
{
if (freeBytesInTxBuffer<nbyte) /* if there are less than nbyte return nothing...*/
{
return (PP_COMM_NOFREEBYTES_EXC);
}
else
{ unsigned int i;
for (i=0;i<nbyte;i++)
{
TxBuf[nextByteFreeTx]=*c++;
nextByteFreeTx=++nextByteFreeTx%PP_BUF_LEN; /* circular buffer pointer increment */
}
 
return (PP_COMM_OK);
}
}
 
 
 
int ppRxBytes(BYTE * c, unsigned int nbyte)
{
if (bytesReadyToRx<nbyte) /* if there are less than nbyte return nothing...*/
{
return (PP_COMM_NOREADYBYTES_EXC);
}
else
{ unsigned int i;
 
for (i=0;i<nbyte;i++)
{
*c++=RxBuf[nextByteReadyToRx]; /* read byte */
#if PP_DEBUG == 1
ppWriteSysMsg("Received value: %i %i of %i \n",RxBuf[nextByteReadyToRx],i,nbyte);
#endif
nextByteReadyToRx=++nextByteReadyToRx%PP_BUF_LEN; /* circular buffer increment */
}
 
return (PP_COMM_OK);
}
}
 
 
 
 
/* polling server ... */
TASK ppPollingSvr(void *arg)
{
BYTE port;
nextByteReadyToRx=0;
nextByteReadyToTx=0;
nextByteFreeRx=0;
nextByteFreeTx=0;
 
nextMsgToRead=0;
nextMsgFreeToWrite=0;
 
 
ppStatusReading=ppNoReading;
ppStatusWriting=ppNoWriting;
 
ppWriteSysMsg("Polling Server started...\n");
 
task_endcycle();
 
while (1)
{
/* case ppReading: read ... */
switch (ppStatusReading)
{
case ppNoAllowReading: break;
case ppNoReading:
 
ppStatusWriting=ppNoWriting;
if(!ppIsRTS()) break;
ppSendOTS(); /* Set Ok To Send - the other one can send... */
#if PP_DEBUG == 1
ppWriteSysMsg(" %i : Received RTS...\n", ppStatusReading);
#endif
 
ppStatusWriting=ppNoAllowWriting;
ppStatusReading=ppWaitingDR_Nibble1;
case ppWaitingDR_Nibble1:
#if PP_STATS == 1 /* for internal statistic ...*/
statReading[ppStatusReading]++;
#endif
 
#if PP_DEBUG == 1
ppWriteSysMsg("Send OTS\n");
ppWriteSysMsg("Waiting DR Nibble1\n");
#endif
 
if(!ppIsDR()) break; /* data no ready: read it next period...*/
port = inp(RX_PORT); /* read nibble */
ppSendER(); /* send a End Read */
 
ppReceivingByte = (port >> 3); /* read LSN */
ppStatusReading=ppWaitingRTS_Nibble2;
case ppWaitingRTS_Nibble2:
#if PP_STATS == 1 /* for internal statistic ...*/
statReading[ppStatusReading]++;
#endif
#if PP_DEBUG == 1
 
ppWriteSysMsg("Received DR Nibble1\n");
ppWriteSysMsg("Send ER Nibble1\n");
ppWriteSysMsg("Waiting RTS Nibble2\n");
#endif
if(!ppIsRTS()) break; /* */
ppSendOTS(); /* Ok To Send - the other one can send... */
 
ppStatusReading=ppWaitingDR_Nibble2;
case ppWaitingDR_Nibble2:
#if PP_STATS == 1 /* for internal statistic ...*/
statReading[ppStatusReading]++;
#endif
#if PP_DEBUG == 1
ppWriteSysMsg("Received RTS Nibble2\n");
ppWriteSysMsg("Send OTS Nibble2\n");
ppWriteSysMsg("Waiting DR Nibble2\n");
#endif
 
if(!ppIsDR()) break;
port = inp(RX_PORT); /* read nibble */
ppSendER(); /* send a End Read */
 
 
#if PP_DEBUG == 1
ppWriteSysMsg("Received DR Nibble2\n");
ppWriteSysMsg("Read Nibble2\n");
ppWriteSysMsg("Send ER Nibble2\n");
#endif
 
 
 
ppReceivingByte = (ppReceivingByte & ~MSN); /* set to zero c MSN */
ppReceivingByte = (ppReceivingByte | ((port >> 3) << 4)); /* read MSN */
 
 
/* here is possible insert some ctrl ... */
/* byte is ok, so now make it available to ppRxOneByte() */
RxBuf[nextByteFreeRx]=ppReceivingByte;
nextByteFreeRx=++nextByteFreeRx%PP_BUF_LEN; /* circular buffer pointer increment */
#if PP_STATS == 1
ppWriteSysMsg("Trasmission :\n");
ppWriteSysMsg("W_DR_1 : %d\n",statReading[ppWaitingDR_Nibble1]);
ppWriteSysMsg("W_RTS_2 : %d\n",statReading[ppWaitingRTS_Nibble2]);
ppWriteSysMsg("W_DR_2 : %d\n",statReading[ppWaitingDR_Nibble2]);
ppWriteSysMsg("Received byte : %i\n",ppReceivingByte);
statReading[ppWaitingDR_Nibble1]=0;
statReading[ppWaitingRTS_Nibble2]=0;
statReading[ppWaitingDR_Nibble2]=0;
#endif
/* end reading so reset status... */
ppStatusReading=ppNoReading;
//ppStatusWriting=ppNoWriting;
break;
}
/* case Writing: can only if this cycle not is reading... */
switch (ppStatusWriting)
{
case ppNoAllowWriting: break;
case ppNoWriting:
 
ppStatusReading=ppNoReading;
 
if(!bytesReadyToTx)
{
break;
#if PP_DEBUG == 1
ppWriteSysMsg("Writin break\n");
#endif
}
else
{
#if PP_DEBUG == 1
ppWriteSysMsg("NO Writin break\n");
ppWriteSysMsg("TX Gap: %i \n",TxPointerGap);
ppWriteSysMsg("nextByteFreeTx: %i\n",nextByteFreeTx);
ppWriteSysMsg("nextByteReadyToTx: %i\n",nextByteReadyToTx);
#endif
}
 
ppSendRTS(); /* Set On RequestToSend bit */
 
ppTransmittingByte=TxBuf[nextByteReadyToTx];
#if PP_DEBUG == 1
ppWriteSysMsg("pllsvr: ppTransmittingByte : %i %c \n",ppTransmittingByte,ppTransmittingByte);
#endif
port = inp(TX_PORT) & (~TX_DATA); /* set to zero trasmission bits */
port = port | (ppTransmittingByte & LSN); /* set bits 0..3 with LSN */
ppStatusWriting=ppWaitingOTS_Nibble1;
ppStatusReading=ppNoAllowWriting;
case ppWaitingOTS_Nibble1:
#if PP_STATS == 1
statWriting[ppStatusWriting]++;
#endif
#if PP_DEBUG == 1
ppWriteSysMsg(" Send RTS Nibble1\n");
ppWriteSysMsg(" Waiting OTS Nibble1\n");
#endif
if(!ppIsOTS()) break;
outp(TX_PORT,port); /* send nibble 1 */
ppSendDR(); /* set on Data Ready bit */
 
 
ppStatusWriting=ppWaitingER_Nibble1;
 
 
case ppWaitingER_Nibble1:
#if PP_STATS == 1
statWriting[ppStatusWriting]++;
#endif
#if PP_DEBUG == 1
ppWriteSysMsg(" Send Nibble1\n");
ppWriteSysMsg(" Send DR Nibble1\n");
ppWriteSysMsg(" Waiting ER Nibble1\n");
#endif
 
if(!ppIsER()) break;
 
ppSendRTS(); /* send trasmission request */
 
port = inp(TX_PORT) & (~TX_DATA); /* set to zero bit trasmission bits */
port = port | (ppTransmittingByte >> 4); /* set bits 0..3 with MSN */
ppStatusWriting=ppWaitingOTS_Nibble2;
case ppWaitingOTS_Nibble2:
 
#if PP_STATS == 1
statWriting[ppStatusWriting]++;
#endif
 
#if PP_DEBUG == 1
ppWriteSysMsg(" Received ER Nibble1\n");
ppWriteSysMsg(" Send RTS Nibble2\n");
ppWriteSysMsg(" Waiting OTS Nibble2\n");
#endif
 
if(!ppIsOTS()) break;
outp(TX_PORT,port); /* send nibble 2 */
ppSendDR(); /* set on Data Ready bit */
 
ppStatusWriting=ppWaitingER_Nibble2;
 
case ppWaitingER_Nibble2:
#if PP_STATS == 1
statWriting[ppStatusWriting]++;
#endif
#if PP_DEBUG == 1
ppWriteSysMsg(" Received OTS Nibble2\n");
ppWriteSysMsg(" Write Nibble2\n");
ppWriteSysMsg(" Send DR Nibble2\n");
ppWriteSysMsg(" Waiting ER Nibble2\n");
#endif
 
if(!ppIsER()) break;
/* byte is ok, so move pointer to next byte to be send... */
nextByteReadyToTx=++nextByteReadyToTx%PP_BUF_LEN; /* circular buffer pointer increment */
#if PP_STATS == 1
ppWriteSysMsg("Reception :\n");
ppWriteSysMsg("W_OTS_1 : %ld\n",statWriting[ppWaitingOTS_Nibble1]);
ppWriteSysMsg("W_ER_2 : %ld\n",statWriting[ppWaitingER_Nibble2]);
ppWriteSysMsg("W_OTS_2 : %ld\n",statWriting[ppWaitingOTS_Nibble2]);
statWriting[ppWaitingOTS_Nibble1]=0;
statWriting[ppWaitingER_Nibble2]=0;
statWriting[ppWaitingOTS_Nibble2]=0;
#endif
 
/* end writing. so reset status... */
ppStatusReading=ppNoReading;
ppStatusWriting=ppNoWriting;
}
task_endcycle();
}
return (0);
}
 
 
 
/shark/tags/rel_0_2/drivers/parport/makefile
0,0 → 1,15
# The Parallel Port Library, by Andrea Battistotti & Armando Leggio
 
ifndef BASE
BASE=../..
endif
include $(BASE)/config/config.mk
 
LIBRARY = pport
 
OBJS_PATH = $(BASE)/drivers/parport
 
OBJS = ppdrv.o ppnrtdrv.o pppindrv.o
 
include $(BASE)/config/lib.mk
 
/shark/tags/rel_0_2/drivers/pci/pci_scan.c
3,17 → 3,15
#include <ll/i386/hw-arch.h>
#include <ll/i386/hw-io.h>
#include <ll/i386/cons.h>
#include <ll/i386/error.h>
#include <ll/i386/mem.h>
 
#include <ll/stdlib.h>
 
 
 
#include <drivers/llpci.h>
#include <drivers/pci.h>
#include <drivers/linuxpci.h>
#include <kernel/log.h>
 
//#define DEBUG_PCISCAN
 
static struct pci_dev pci_devs[N_MAX_DEVS];
 
static struct pci_bus pci_root;
146,7 → 144,9
*/
child = kmalloc(sizeof(*child), GFP_ATOMIC);
if(child==NULL) {
error(KERN_ERR "pci: out of memory for bridge.\n");
#ifdef DEBUG_PCISCAN
printk(KERN_ERR "pci: out of memory for bridge.\n");
#endif
continue;
}
memset(child, 0, sizeof(*child));
221,11 → 221,15
pcibios_init();
 
if (!pci_present()) {
error("PCI: No PCI bus detected\n");
#ifdef DEBUG_PCISCAN
printk("PCI: No PCI bus detected\n");
#endif
return;
}
 
error("PCI: Probing PCI hardware\n");
#ifdef DEBUG_PCISCAN
printk("PCI: Probing PCI hardware\n");
#endif
memset(&pci_root, 0, sizeof(pci_root));
pci_root.subordinate = pci_scan_bus(&pci_root);
}
/shark/tags/rel_0_2/drivers/pci/pci.c
3,15 → 3,13
#include <ll/i386/hw-arch.h>
#include <ll/i386/hw-io.h>
#include <ll/i386/cons.h>
 
#include <ll/stdlib.h>
 
 
 
#include <drivers/llpci.h>
#include <drivers/pci.h>
#include <drivers/linuxpci.h>
 
#include <kernel/log.h>
 
static int ndev = 0;
static struct pci_des pci_devs[N_MAX_DEVS];
 
108,7 → 106,10
{
 
if (pci_class(class_code, index, bus, dev) != NULL) {
cprintf("PCIBIOS_FIND_CLASS: found at bus %d, dev %d\n", *bus, *dev);
#ifdef DEBUG_PCI
printk(KERN_DEBUG "PCIBIOS_FIND_CLASS:"
"found at bus %d, dev %d\n", *bus, *dev);
#endif
return PCIBIOS_SUCCESSFUL;
} else {
return PCIBIOS_DEVICE_NOT_FOUND;
122,14 → 123,15
int i;
struct pci_regs *r;
 
cprintf(" DevLib PCI support\n\n");
cprintf(" PCI config type %d\n", pcibios_present());
cprintf(" %d PCI devices found:\n\n", ndev);
printk(KERN_INFO "DevLib PCI support\n\n");
printk(KERN_INFO "PCI config type %d\n", pcibios_present());
printk(KERN_INFO "%d PCI devices found:\n\n", ndev);
for(i = 0; i < ndev; i++) {
cprintf(" %d: bus %d dev %d\n",i , pci_devs[i].bus, pci_devs[i].dev);
r = (struct pci_regs *) pci_devs[i].mem;
cprintf(" Vendor: %s", pci_strvendor(r->VendorId));
cprintf(" Class: %s\n", pci_strclass(r->ClassCode << 8));
printk(KERN_INFO "%d: bus %d dev %d\n",
i, pci_devs[i].bus, pci_devs[i].dev);
printk(KERN_INFO "Vendor: %s", pci_strvendor(r->VendorId));
printk(KERN_INFO "Class: %s\n", pci_strclass(r->ClassCode << 8));
}
}
 
/shark/tags/rel_0_2/drivers/char/sermouse.c
20,11 → 20,11
 
/**
------------
CVS : $Id: sermouse.c,v 1.1.1.1 2002-03-29 14:12:49 pj Exp $
CVS : $Id: sermouse.c,v 1.2 2002-11-11 08:41:31 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:49 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:41:31 $
------------
 
Author: Gerardo Lamastra
84,6 → 84,7
//#include <cons.h>
 
#include <kernel/kern.h>
#include <time.h>
//#include "sys/sys.h"
//#include "vm.h"
//#include "kern.h"
405,15 → 406,19
int port;
int ret;
int found;
struct timespec delay;
 
delay.tv_sec = 0;
delay.tv_nsec = 500000000;
 
found=0;
for (port=COM1;port<=COM4;port++) {
ret=com_open(port,1200,NONE,7,1);
if (ret==1) {
com_write(port,MCR,0x0e);
task_delay(500000l); /* necessary? */
nanosleep(&delay,NULL); /* necessary? */
com_write(port,MCR,0x0f);
task_delay(500000l); /* necessary? */
nanosleep(&delay,NULL); /* necessary? */
ret=sem_wait(&com_link[mouse_port].rx_sem);
if (ret==TRUE) {
if (*(com_link[mouse_port].rx_buf)=='M') found=1;
/shark/tags/rel_0_2/drivers/char/rtc.c
20,11 → 20,11
 
/**
------------
CVS : $Id: rtc.c,v 1.1.1.1 2002-03-29 14:12:49 pj Exp $
CVS : $Id: rtc.c,v 1.2 2002-11-11 08:41:31 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:49 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:41:31 $
------------
 
Author: Massimiliano Giorgi
183,7 → 183,7
SYS_FLAGS flags;
unsigned char ctrl;
unsigned retries=0;
unsigned delay;
struct timespec delay;
 
/*
* read RTC once any update in progress is done. The update
201,8 → 201,9
barrier();
*/
 
delay=1000;
while (rtc_is_updating()&&++retries<=5) task_delay(delay);
delay.tv_nsec = 1000000;
delay.tv_sec = 0;
while (rtc_is_updating()&&++retries<=5) nanosleep(&delay, NULL);
if (retries>5) return -1;
 
/*
/shark/tags/rel_0_2/drivers/char/8042.c
20,11 → 20,11
 
/**
------------
CVS : $Id: 8042.c,v 1.1.1.1 2002-03-29 14:12:49 pj Exp $
CVS : $Id: 8042.c,v 1.2 2002-11-11 08:41:31 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:49 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:41:31 $
------------
 
8042.h
348,7 → 348,7
static int C8042_reset(void)
{
int c;
int c=0;
int retries=16;
 
trace("8042 reset START");
/shark/tags/rel_0_2/drivers/makefile
1,5 → 1,5
 
dirs := $(filter-out CVS makefile, $(wildcard *))
dirs := $(filter-out CVS cvs makefile, $(wildcard *))
p_all := $(addprefix prefixall_, $(dirs))
p_install := $(addprefix prefixinstall_, $(dirs))
p_clean := $(addprefix prefixclean_, $(dirs))
/shark/tags/rel_0_2/drivers/linuxcom/include/linux/netdevice.h
8,12 → 8,21
 
#include <linux/skbuff.h>
#include <linux/notifier.h>
#include <time.h>
 
// for 3c59x.c (!!!)
#define le32_to_cpu(val) (val)
#define cpu_to_le32(val) (val)
#define test_and_set_bit(val, addr) set_bit(val, addr)
#define mdelay(x) task_delay((x)*1000)
 
static __inline__ void mdelay(int x)
{
struct timespec delay;
delay.tv_sec=x/1000;
delay.tv_nsec=(x%1000)*1000000;
nanosleep(&delay, NULL);
}
 
#define kfree(x) { }
#define ioremap(a,b) \
(((a)<0x100000) ? (void *)((u_long)(a)) : vremap(a,b))
/shark/tags/rel_0_2/drivers/linuxcom/include/linux/compatib.h
56,7 → 56,7
 
/* Linux kernel call emulation */
#define kmalloc(a,b) malloc(a)
#define printk cprintf
//#define printk cprintf I would like to use the kernel printk if possible...
#define check_region(a,b) 0
#define request_region(a,b,c)
 
/shark/tags/rel_0_2/drivers/linuxcom/auto_irq.c
1,5 → 1,6
#include<asm/bitops.h>
#include<kernel/kern.h>
#include <time.h>
 
struct device *irq2dev_map[16] = {0, 0, /* ... zeroed */};
 
17,6 → 18,7
int autoirq_setup(int waittime)
{
int i;
struct timespec delay;
 
handled = 0;
 
27,7 → 29,9
}
 
/* Hang out at least <waittime> jiffies waiting for bogus IRQ hits. */
task_delay(waittime);
delay.tv_sec = waittime/1000000;
delay.tv_nsec = (waittime%1000000)*1000;
nanosleep(&delay, NULL);
 
return handled;
}
34,10 → 38,13
 
int autoirq_report(int waittime)
{
struct timespec delay;
int i;
 
/* Hang out at least <waittime> jiffies waiting for the IRQ. */
task_delay(waittime);
delay.tv_sec=waittime/1000000;
delay.tv_nsec=(waittime%1000000)*1000;
nanosleep(&delay, NULL);
 
/* Retract the irq handlers that we installed. */
for (i = 0; i < 16; i++) {