fresh commit
This commit is contained in:
commit
e68c1ec8c6
20 files changed
+5802
No files matched your search
@@ -0,0 +1,31 @@
|
||||
# File: Makefile
|
||||
|
||||
CFLAGS = -msmall-code -O3 -ansi -Wall -Wno-uninitialized -Wno-parentheses
|
||||
CC = gcc $(CFLAGS)
|
||||
MAKEFILE = Makefile
|
||||
LINKER = ld -e _Main -s
|
||||
AMIGA_LIB = GG:lib/libamiga.a
|
||||
C_LIB = GG:lib/libnix/libnix13.a
|
||||
|
||||
DEV_NAME = 3c589.device
|
||||
OBJS = device.o unit.o request.o
|
||||
HDRS = device.h
|
||||
|
||||
.c.o :
|
||||
$(CC) -c $<
|
||||
|
||||
$(DEV_NAME): $(MAKEFILE) $(OBJS)
|
||||
$(LINKER) $(OBJS) $(AMIGA_LIB) $(C_LIB) -o $(DEV_NAME)
|
||||
Protect "$(DEV_NAME)" "-e"
|
||||
|
||||
$(OBJS): $(MAKEFILE) $(HDRS)
|
||||
|
||||
unit.o: etherlink3.h
|
||||
|
||||
install: $(DEV_NAME)
|
||||
Copy CLONE "$(DEV_NAME)" "DEVS:networks/"
|
||||
Flush "$(DEV_NAME)"
|
||||
|
||||
clean:
|
||||
Delete "$(DEV_NAME)" "#?.o"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
DESIGN NOTES:
|
||||
|
||||
- Type tracking has been implemented in an unusual way in order to make it
|
||||
more suitable for multiple users. Each client that tracks a particular
|
||||
packet type is given the impression that it is the only one doing so.
|
||||
When a client begins tracking a packet type that is already being
|
||||
tracked, the current packet statistics are recorded internally. These
|
||||
initial statistics are then subtracted from the figures returned from
|
||||
every S2_GETTYPESTATS call the client makes.
|
||||
- The cards' 8-bit statistics registers appear to be unreadable using the
|
||||
A1200's PCMCIA slot.
|
||||
- S2_CopyToBuff32 functions are not used because the non-raw portion of
|
||||
received packets is not 32-bit aligned.
|
||||
|
||||
|
||||
TCP/IP STACK BUGS TO CONSIDER:
|
||||
|
||||
- Miami(DX) doesn't like requests being aborted upon S2_OFFLINE.
|
||||
- MiamiDX's CopyFromBuff16/32 functions appear to be broken.
|
||||
- Genesis calls S2_ONLINE before S2_CONFIGINTERFACE?
|
||||
- When a device goes back online without Genesis's intervention, Genesis
|
||||
displays the message "eth0 is online again" or similar, but keeps the
|
||||
interface's indicator red and doesn't disable the "Online" button or
|
||||
enable the "Offline" button.
|
||||
|
||||
|
||||
+651
@@ -0,0 +1,651 @@
|
||||
/*
|
||||
|
||||
File: device.c
|
||||
Author: Neil Cafferkey
|
||||
Copyright (C) 2000-2010 Neil Cafferkey
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <exec/resident.h>
|
||||
#include <exec/errors.h>
|
||||
#include <utility/utility.h>
|
||||
#include "initializers.h"
|
||||
|
||||
#include <proto/exec.h>
|
||||
#include <proto/alib.h>
|
||||
#include <proto/utility.h>
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#include "unit_protos.h"
|
||||
#include "request_protos.h"
|
||||
|
||||
#define VERSION 1
|
||||
#define REVISION 5
|
||||
#define UNIT_COUNT 1
|
||||
#define UTILITY_VERSION 36
|
||||
#define PCCARD_VERSION 1
|
||||
|
||||
|
||||
/* Private prototypes */
|
||||
|
||||
static struct DevBase *DevInit(struct DevBase *dev_base REG("d0"),
|
||||
APTR seg_list REG("a0"),struct DevBase *base REG(BASE_REG));
|
||||
static BYTE DevOpen(ULONG unit_no REG("d0"),
|
||||
struct IOSana2Req *request REG("a1"),ULONG flags REG("d1"),
|
||||
struct DevBase *base REG(BASE_REG));
|
||||
static APTR DevClose(struct IOSana2Req *request REG("a1"),
|
||||
struct DevBase *base REG(BASE_REG));
|
||||
static APTR DevExpunge(struct DevBase *base REG(BASE_REG));
|
||||
static APTR DevReserved();
|
||||
static VOID DevBeginIO(struct IOSana2Req *request REG("a1"),
|
||||
struct DevBase *base REG(BASE_REG));
|
||||
static VOID DevAbortIO(struct IOSana2Req *request REG("a1"),
|
||||
struct DevBase *base REG(BASE_REG));
|
||||
VOID DeleteDevice(struct DevBase *base);
|
||||
|
||||
extern const APTR vectors[];
|
||||
extern const APTR init_table[];
|
||||
|
||||
|
||||
/* Return an error immediately if someone tries to run the device */
|
||||
|
||||
LONG Main()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define DEVICE_NAME "3c589.device"
|
||||
|
||||
const TEXT device_name[]=DEVICE_NAME;
|
||||
static const TEXT version_string[]=DEVICE_NAME " 1.5 (3.2.2010)\n";
|
||||
static const TEXT card_name[]=CARDRESNAME;
|
||||
static const TEXT utility_name[]=UTILITYNAME;
|
||||
static const TEXT pccard_name[]=PCCARDNAME;
|
||||
static const TEXT timer_name[]=TIMERNAME;
|
||||
|
||||
|
||||
const struct Resident device_rom_tag=
|
||||
{
|
||||
RTC_MATCHWORD,
|
||||
(struct Resident *)&device_rom_tag,
|
||||
(APTR)init_table,
|
||||
RTF_AUTOINIT,
|
||||
VERSION,
|
||||
NT_DEVICE,
|
||||
0,
|
||||
(STRPTR)device_name,
|
||||
(STRPTR)version_string,
|
||||
(APTR)init_table
|
||||
};
|
||||
|
||||
|
||||
static const APTR vectors[]=
|
||||
{
|
||||
(APTR)DevOpen,
|
||||
(APTR)DevClose,
|
||||
(APTR)DevExpunge,
|
||||
(APTR)DevReserved,
|
||||
(APTR)DevBeginIO,
|
||||
(APTR)DevAbortIO,
|
||||
(APTR)-1
|
||||
};
|
||||
|
||||
|
||||
static const struct
|
||||
{
|
||||
SMALLINITBYTEDEF(type);
|
||||
SMALLINITPINTDEF(name);
|
||||
SMALLINITBYTEDEF(flags);
|
||||
SMALLINITWORDDEF(version);
|
||||
SMALLINITWORDDEF(revision);
|
||||
SMALLINITPINTDEF(id_string);
|
||||
INITENDDEF;
|
||||
}
|
||||
init_data=
|
||||
{
|
||||
SMALLINITBYTE(OFFSET(Node,ln_Type),NT_DEVICE),
|
||||
SMALLINITPINT(OFFSET(Node,ln_Name),device_name),
|
||||
SMALLINITBYTE(OFFSET(Library,lib_Flags),LIBF_SUMUSED|LIBF_CHANGED),
|
||||
SMALLINITWORD(OFFSET(Library,lib_Version),VERSION),
|
||||
SMALLINITWORD(OFFSET(Library,lib_Revision),REVISION),
|
||||
SMALLINITPINT(OFFSET(Library,lib_IdString),version_string),
|
||||
INITEND
|
||||
};
|
||||
|
||||
|
||||
static const APTR init_table[]=
|
||||
{
|
||||
(APTR)sizeof(struct DevBase),
|
||||
(APTR)vectors,
|
||||
(APTR)&init_data,
|
||||
(APTR)DevInit
|
||||
};
|
||||
|
||||
|
||||
static const ULONG rx_tags[]=
|
||||
{
|
||||
S2_CopyToBuff,
|
||||
S2_CopyToBuff16
|
||||
};
|
||||
|
||||
|
||||
static const ULONG tx_tags[]=
|
||||
{
|
||||
S2_CopyFromBuff,
|
||||
S2_CopyFromBuff16,
|
||||
S2_CopyFromBuff32
|
||||
};
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DevInit ***********************************************
|
||||
*
|
||||
* NAME
|
||||
* DevInit -- .
|
||||
*
|
||||
* SYNOPSIS
|
||||
* dev_base = DevInit(dev_base,seg_list)
|
||||
*
|
||||
* struct DevBase *DevInit(struct DevBase *,APTR);
|
||||
*
|
||||
* FUNCTION
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
static struct DevBase *DevInit(struct DevBase *dev_base REG("d0"),
|
||||
APTR seg_list REG("a0"),struct DevBase *base REG(BASE_REG))
|
||||
{
|
||||
BOOL success=TRUE;
|
||||
|
||||
dev_base->sys_base=(APTR)base;
|
||||
base=dev_base;
|
||||
base->seg_list=seg_list;
|
||||
|
||||
base->card_base=OpenResource(card_name);
|
||||
base->utility_base=(APTR)OpenLibrary(utility_name,UTILITY_VERSION);
|
||||
base->pccard_base=OpenLibrary(pccard_name,PCCARD_VERSION);
|
||||
if((base->card_base==NULL)||(base->utility_base==NULL)||
|
||||
(base->pccard_base==NULL))
|
||||
success=FALSE;
|
||||
|
||||
if(OpenDevice(timer_name,UNIT_VBLANK,(APTR)&base->timer_request,0)!=0)
|
||||
success=FALSE;
|
||||
|
||||
NewList((APTR)(&dev_base->units));
|
||||
|
||||
if(!success)
|
||||
{
|
||||
DeleteDevice(base);
|
||||
base=NULL;
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DevOpen ***********************************************
|
||||
*
|
||||
* NAME
|
||||
* DevOpen -- .
|
||||
*
|
||||
* SYNOPSIS
|
||||
* error = DevOpen(unit_num,request,flags)
|
||||
*
|
||||
* BYTE DevOpen(ULONG,struct IOSana2Req *,ULONG);
|
||||
*
|
||||
* FUNCTION
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
static BYTE DevOpen(ULONG unit_num REG("d0"),
|
||||
struct IOSana2Req *request REG("a1"),ULONG flags REG("d1"),
|
||||
struct DevBase *base REG(BASE_REG))
|
||||
{
|
||||
struct DevUnit *unit;
|
||||
BYTE error=0;
|
||||
struct Opener *opener;
|
||||
struct TagItem *tag_list;
|
||||
UWORD i;
|
||||
|
||||
base->device.dd_Library.lib_OpenCnt++;
|
||||
base->device.dd_Library.lib_Flags&=~LIBF_DELEXP;
|
||||
|
||||
request->ios2_Req.io_Unit=NULL;
|
||||
tag_list=request->ios2_BufferManagement;
|
||||
request->ios2_BufferManagement=NULL;
|
||||
|
||||
/* Check request size and unit number */
|
||||
|
||||
if((request->ios2_Req.io_Message.mn_Length<sizeof(struct IOSana2Req))
|
||||
||(unit_num>=UNIT_COUNT))
|
||||
error=IOERR_OPENFAIL;
|
||||
|
||||
/* Get the requested unit */
|
||||
|
||||
if(error==0)
|
||||
{
|
||||
request->ios2_Req.io_Unit=(APTR)unit=GetUnit(unit_num,base);
|
||||
if(unit==NULL)
|
||||
error=IOERR_OPENFAIL;
|
||||
}
|
||||
|
||||
/* Handle device sharing */
|
||||
|
||||
if(error==0)
|
||||
{
|
||||
if((unit->open_count!=0)&&(((unit->flags&UNITF_SHARED)==0)||
|
||||
((flags&SANA2OPF_MINE)!=0)))
|
||||
error=IOERR_UNITBUSY;
|
||||
unit->open_count++;
|
||||
}
|
||||
|
||||
if(error==0)
|
||||
{
|
||||
if((flags&SANA2OPF_MINE)==0)
|
||||
unit->flags|=UNITF_SHARED;
|
||||
else if((flags&SANA2OPF_PROM)!=0)
|
||||
unit->flags|=UNITF_PROM;
|
||||
|
||||
/* Set up buffer-management structure and get hooks */
|
||||
|
||||
request->ios2_BufferManagement=opener=
|
||||
AllocVec(sizeof(struct Opener),MEMF_PUBLIC);
|
||||
if(opener==NULL)
|
||||
error=IOERR_OPENFAIL;
|
||||
}
|
||||
|
||||
if(error==0)
|
||||
{
|
||||
NewList(&opener->read_port.mp_MsgList);
|
||||
opener->read_port.mp_Flags=PA_IGNORE;
|
||||
NewList((APTR)&opener->initial_stats);
|
||||
|
||||
for(i=0;i<2;i++)
|
||||
opener->rx_function=(APTR)GetTagData(rx_tags[i],
|
||||
(UPINT)opener->rx_function,tag_list);
|
||||
for(i=0;i<3;i++)
|
||||
opener->tx_function=(APTR)GetTagData(tx_tags[i],
|
||||
(UPINT)opener->tx_function,tag_list);
|
||||
|
||||
opener->filter_hook=(APTR)GetTagData(S2_PacketFilter,NULL,tag_list);
|
||||
opener->dma_tx_function=
|
||||
(APTR)GetTagData(S2_DMACopyFromBuff32,NULL,tag_list);
|
||||
|
||||
Disable();
|
||||
AddTail((APTR)&unit->openers,(APTR)opener);
|
||||
Enable();
|
||||
}
|
||||
|
||||
/* Back out if anything went wrong */
|
||||
|
||||
if(error!=0)
|
||||
DevClose(request,base);
|
||||
|
||||
/* Return */
|
||||
|
||||
request->ios2_Req.io_Error=error;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DevClose **********************************************
|
||||
*
|
||||
* NAME
|
||||
* DevClose -- .
|
||||
*
|
||||
* SYNOPSIS
|
||||
* seg_list = DevClose(request)
|
||||
*
|
||||
* APTR DevClose(struct IOSana2Req *);
|
||||
*
|
||||
* FUNCTION
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
static APTR DevClose(struct IOSana2Req *request REG("a1"),
|
||||
struct DevBase *base REG(BASE_REG))
|
||||
{
|
||||
struct DevUnit *unit;
|
||||
APTR seg_list;
|
||||
struct Opener *opener;
|
||||
|
||||
/* Free buffer-management resources */
|
||||
|
||||
opener=(APTR)request->ios2_BufferManagement;
|
||||
if(opener!=NULL)
|
||||
{
|
||||
Disable();
|
||||
Remove((APTR)opener);
|
||||
Enable();
|
||||
FreeVec(opener);
|
||||
}
|
||||
|
||||
/* Delete the unit if it's no longer in use */
|
||||
|
||||
unit=(APTR)request->ios2_Req.io_Unit;
|
||||
if(unit!=NULL)
|
||||
{
|
||||
if((--unit->open_count)==0)
|
||||
{
|
||||
Remove((APTR)unit);
|
||||
DeleteUnit(unit,base);
|
||||
}
|
||||
}
|
||||
|
||||
/* Expunge the device if a delayed expunge is pending */
|
||||
|
||||
seg_list=NULL;
|
||||
|
||||
if((--base->device.dd_Library.lib_OpenCnt)==0)
|
||||
{
|
||||
if((base->device.dd_Library.lib_Flags&LIBF_DELEXP)!=0)
|
||||
seg_list=DevExpunge(base);
|
||||
}
|
||||
|
||||
return seg_list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DevExpunge ********************************************
|
||||
*
|
||||
* NAME
|
||||
* DevExpunge -- .
|
||||
*
|
||||
* SYNOPSIS
|
||||
* seg_list = DevExpunge()
|
||||
*
|
||||
* APTR DevExpunge(VOID);
|
||||
*
|
||||
* FUNCTION
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
static APTR DevExpunge(struct DevBase *base REG(BASE_REG))
|
||||
{
|
||||
APTR seg_list;
|
||||
|
||||
if(base->device.dd_Library.lib_OpenCnt==0)
|
||||
{
|
||||
seg_list=base->seg_list;
|
||||
Remove((APTR)base);
|
||||
DeleteDevice(base);
|
||||
}
|
||||
else
|
||||
{
|
||||
base->device.dd_Library.lib_Flags|=LIBF_DELEXP;
|
||||
seg_list=NULL;
|
||||
}
|
||||
|
||||
return seg_list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DevReserved *******************************************
|
||||
*
|
||||
* NAME
|
||||
* DevReserved -- .
|
||||
*
|
||||
* SYNOPSIS
|
||||
* result = DevReserved()
|
||||
*
|
||||
* APTR DevReserved(VOID);
|
||||
*
|
||||
* FUNCTION
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
static APTR DevReserved()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DevBeginIO ********************************************
|
||||
*
|
||||
* NAME
|
||||
* DevBeginIO -- .
|
||||
*
|
||||
* SYNOPSIS
|
||||
* DevBeginIO(request)
|
||||
*
|
||||
* VOID DevBeginIO(struct IORequest *);
|
||||
*
|
||||
* FUNCTION
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
static VOID DevBeginIO(struct IOSana2Req *request REG("a1"),
|
||||
struct DevBase *base REG(BASE_REG))
|
||||
{
|
||||
struct DevUnit *unit;
|
||||
|
||||
request->ios2_Req.io_Error=0;
|
||||
unit=(APTR)request->ios2_Req.io_Unit;
|
||||
|
||||
if(AttemptSemaphore(&unit->access_lock))
|
||||
ServiceRequest(request,base);
|
||||
else
|
||||
{
|
||||
PutRequest(unit->request_ports[GENERAL_QUEUE],(APTR)request,base);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DevAbortIO ********************************************
|
||||
*
|
||||
* NAME
|
||||
* DevAbortIO -- Try to stop a request.
|
||||
*
|
||||
* SYNOPSIS
|
||||
* DevAbortIO(request)
|
||||
*
|
||||
* VOID DevAbortIO(struct IOSana2Req *);
|
||||
*
|
||||
* FUNCTION
|
||||
* Do our best to halt the progress of a request.
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
* Disable() used instead of a semaphore because device uses interrupts.
|
||||
*
|
||||
*/
|
||||
|
||||
static VOID DevAbortIO(struct IOSana2Req *request REG("a1"),
|
||||
struct DevBase *base REG(BASE_REG))
|
||||
{
|
||||
struct DevUnit *unit;
|
||||
|
||||
unit=(APTR)request->ios2_Req.io_Unit;
|
||||
|
||||
Disable();
|
||||
if((request->ios2_Req.io_Message.mn_Node.ln_Type==NT_MESSAGE)
|
||||
&&((request->ios2_Req.io_Flags&IOF_QUICK)==0))
|
||||
{
|
||||
Remove((APTR)request);
|
||||
request->ios2_Req.io_Error=IOERR_ABORTED;
|
||||
request->ios2_WireError=S2WERR_GENERIC_ERROR;
|
||||
ReplyMsg((APTR)request);
|
||||
}
|
||||
Enable();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****i* 3c589.device/DeleteDevice ******************************************
|
||||
*
|
||||
* NAME
|
||||
* DeleteDevice -- .
|
||||
*
|
||||
* SYNOPSIS
|
||||
* DeleteDevice()
|
||||
*
|
||||
* VOID DeleteDevice(VOID);
|
||||
*
|
||||
* FUNCTION
|
||||
*
|
||||
* INPUTS
|
||||
*
|
||||
* RESULT
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* BUGS
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
VOID DeleteDevice(struct DevBase *base)
|
||||
{
|
||||
UWORD neg_size,pos_size;
|
||||
|
||||
/* Close devices */
|
||||
|
||||
CloseDevice((APTR)&base->timer_request);
|
||||
|
||||
/* Close libraries */
|
||||
|
||||
if(base->pccard_base!=NULL)
|
||||
CloseLibrary(base->pccard_base);
|
||||
if(base->utility_base!=NULL)
|
||||
CloseLibrary((APTR)base->utility_base);
|
||||
|
||||
/* Free device's memory */
|
||||
|
||||
neg_size=base->device.dd_Library.lib_NegSize;
|
||||
pos_size=base->device.dd_Library.lib_PosSize;
|
||||
FreeMem((UBYTE *)base-neg_size,pos_size+neg_size);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+257
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2001-2004 Neil Cafferkey
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DEVICE_H
|
||||
#define DEVICE_H
|
||||
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <exec/devices.h>
|
||||
#include <exec/interrupts.h>
|
||||
#include <exec/semaphores.h>
|
||||
#include <devices/sana2.h>
|
||||
#include <devices/sana2specialstats.h>
|
||||
#include <resources/card.h>
|
||||
#include <libraries/pccard.h>
|
||||
#include <devices/timer.h>
|
||||
|
||||
#ifndef UPINT
|
||||
typedef ULONG UPINT;
|
||||
typedef LONG PINT;
|
||||
#endif
|
||||
|
||||
#ifdef __mc68000
|
||||
#define REG(A) __asm(A)
|
||||
#else
|
||||
#define REG(A)
|
||||
#endif
|
||||
|
||||
#define USE_HACKS
|
||||
|
||||
|
||||
struct DevBase
|
||||
{
|
||||
struct Device device;
|
||||
APTR seg_list;
|
||||
struct ExecBase *sys_base;
|
||||
APTR card_base;
|
||||
struct UtilityBase *utility_base;
|
||||
struct Library *pccard_base;
|
||||
struct MinList units;
|
||||
struct timerequest timer_request;
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
WRITE_QUEUE,
|
||||
ADOPT_QUEUE,
|
||||
EVENT_QUEUE,
|
||||
GENERAL_QUEUE,
|
||||
REQUEST_QUEUE_COUNT
|
||||
};
|
||||
|
||||
#define ADDRESS_SIZE 6
|
||||
#define HEADER_SIZE 14
|
||||
#define PREAMBLE_SIZE 4
|
||||
#define PACKET_DEST 0
|
||||
#define PACKET_SOURCE 6
|
||||
#define PACKET_TYPE 12
|
||||
#define PACKET_DATA 14
|
||||
#define MTU 1500
|
||||
#define MAX_PACKET_SIZE ((HEADER_SIZE)+(MTU))
|
||||
|
||||
#define STAT_COUNT 3
|
||||
|
||||
|
||||
struct DevUnit
|
||||
{
|
||||
struct MinNode node;
|
||||
ULONG unit_num;
|
||||
ULONG open_count;
|
||||
UWORD flags;
|
||||
UWORD transceiver;
|
||||
struct Task *task;
|
||||
struct MsgPort *request_ports[REQUEST_QUEUE_COUNT];
|
||||
struct DevBase *device;
|
||||
struct CardHandle *card_handle;
|
||||
UBYTE *tuple_buffer;
|
||||
UBYTE *rx_buffer;
|
||||
UBYTE *tx_buffer;
|
||||
volatile UBYTE *config_base;
|
||||
volatile UBYTE *io_base;
|
||||
ULONG card_removed_signal;
|
||||
ULONG card_inserted_signal;
|
||||
ULONG range_count;
|
||||
UBYTE address[ADDRESS_SIZE];
|
||||
UBYTE default_address[ADDRESS_SIZE];
|
||||
struct MinList openers;
|
||||
struct MinList type_trackers;
|
||||
struct MinList multicast_ranges;
|
||||
struct Interrupt rx_int;
|
||||
struct Interrupt tx_int;
|
||||
struct Sana2DeviceStats stats;
|
||||
ULONG special_stats[STAT_COUNT];
|
||||
struct SignalSemaphore access_lock;
|
||||
UWORD rx_filter_cmd;
|
||||
};
|
||||
|
||||
|
||||
struct Opener
|
||||
{
|
||||
struct MinNode node;
|
||||
struct MsgPort read_port;
|
||||
BOOL (*rx_function)(APTR REG("a0"),APTR REG("a1"),ULONG REG("d0"));
|
||||
BOOL (*tx_function)(APTR REG("a0"),APTR REG("a1"),ULONG REG("d0"));
|
||||
ULONG *(*dma_tx_function)(APTR REG("a0"));
|
||||
struct Hook *filter_hook;
|
||||
struct MinList initial_stats;
|
||||
};
|
||||
|
||||
|
||||
struct TypeStats
|
||||
{
|
||||
struct MinNode node;
|
||||
ULONG packet_type;
|
||||
struct Sana2PacketTypeStats stats;
|
||||
};
|
||||
|
||||
|
||||
struct TypeTracker
|
||||
{
|
||||
struct MinNode node;
|
||||
ULONG packet_type;
|
||||
struct Sana2PacketTypeStats stats;
|
||||
ULONG user_count;
|
||||
};
|
||||
|
||||
|
||||
struct AddressRange
|
||||
{
|
||||
struct MinNode node;
|
||||
ULONG add_count;
|
||||
ULONG lower_bound_left;
|
||||
ULONG upper_bound_left;
|
||||
UWORD lower_bound_right;
|
||||
UWORD upper_bound_right;
|
||||
};
|
||||
|
||||
|
||||
/* Unit flags */
|
||||
|
||||
#define UNITF_SHARED (1<<0)
|
||||
#define UNITF_ONLINE (1<<1)
|
||||
#define UNITF_HAVECARD (1<<2)
|
||||
#define UNITF_HAVEADAPTER (1<<3)
|
||||
#define UNITF_CONFIGURED (1<<4)
|
||||
#define UNITF_PROM (1<<5)
|
||||
#define UNITF_ROADRUNNER (1<<6)
|
||||
|
||||
|
||||
IMPORT const TEXT device_name[];
|
||||
|
||||
#define HANDLE_PRIORITY 10
|
||||
|
||||
#define S2_3C589_WRITEEEPROM 0x998f
|
||||
|
||||
|
||||
/* Endianness macros */
|
||||
|
||||
#define BEWord(A)\
|
||||
(A)
|
||||
|
||||
#define MakeBEWord(A)\
|
||||
BEWord(A)
|
||||
|
||||
#define LEWord(A)\
|
||||
({\
|
||||
UWORD _LEWord_A=(A);\
|
||||
_LEWord_A=((_LEWord_A)<<8)|((_LEWord_A)>>8);\
|
||||
})
|
||||
|
||||
#define MakeLEWord(A)\
|
||||
LEWord(A)
|
||||
|
||||
#define BELong(A)\
|
||||
(A)
|
||||
|
||||
#define LELong(A)\
|
||||
({\
|
||||
ULONG _LELong_A=(A);\
|
||||
_LELong_A=(LEWord(_LELong_A)<<16)|LEWord((_LELong_A)>>16);\
|
||||
})
|
||||
|
||||
#define MakeLELong(A)\
|
||||
LELong(A)
|
||||
|
||||
|
||||
/* I/O macros */
|
||||
|
||||
#define ByteIn(address)\
|
||||
(*((volatile UBYTE *)(address)))
|
||||
|
||||
#define ByteOut(address,value)\
|
||||
*((volatile UBYTE *)(address))=(value)
|
||||
|
||||
#define WordIn(address)\
|
||||
(*((volatile UWORD *)(address)))
|
||||
|
||||
#define WordOut(address,value)\
|
||||
*((volatile UWORD *)(address))=(value)
|
||||
|
||||
#define LongIn(address)\
|
||||
(*((volatile ULONG *)(address)))
|
||||
|
||||
#define LongOut(address,value)\
|
||||
*((volatile ULONG *)(address))=(value)
|
||||
|
||||
#define LEWordIn(address)\
|
||||
LEWord(WordIn(address))
|
||||
|
||||
#define LEWordOut(address,value)\
|
||||
WordOut(address,MakeLEWord(value))
|
||||
|
||||
#define LELongIn(address)\
|
||||
LELong(LongIn(address))
|
||||
|
||||
#define LELongOut(address,value)\
|
||||
LongOut(address,MakeLELong(value))
|
||||
|
||||
#define BEWordOut(address,value)\
|
||||
WordOut(address,MakeBEWord(value))
|
||||
|
||||
|
||||
/* Library and device bases */
|
||||
|
||||
#define SysBase (base->sys_base)
|
||||
#define CardResource (base->card_base)
|
||||
#define UtilityBase (base->utility_base)
|
||||
#define PCCardBase (base->pccard_base)
|
||||
#define TimerBase (base->timer_request.tr_node.io_Device)
|
||||
|
||||
#ifndef BASE_REG
|
||||
#define BASE_REG "a6"
|
||||
#endif
|
||||
|
||||
/*register APTR base asm(BASE_REG);*/
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,320 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2002 Neil Cafferkey
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef ETHERLINK3_H
|
||||
#define ETHERLINK3_H
|
||||
|
||||
|
||||
/* Registers */
|
||||
/* ========= */
|
||||
|
||||
/* All Windows */
|
||||
|
||||
#define EL3REG_COMMAND 14
|
||||
#define EL3REG_STATUS 14
|
||||
|
||||
/* Window 0 */
|
||||
|
||||
#define EL3REG_MAKERID 0
|
||||
#define EL3REG_PRODUCTID 2
|
||||
#define EL3REG_ADAPTERID 2
|
||||
#define EL3REG_CONFIG 4
|
||||
#define EL3REG_ADDRCONFIG 6
|
||||
#define EL3REG_RESCONFIG 8 /* also in window 3 */
|
||||
#define EL3REG_EEPROMCMD 10 /* window 2 has alternative version */
|
||||
#define EL3REG_EEPROMDATA 12
|
||||
|
||||
/* Window 1 */
|
||||
|
||||
#define EL3REG_DATA0 0
|
||||
#define EL3REG_DATA1 2
|
||||
#define EL3REG_RXSTATUS 8
|
||||
#define EL3REG_TIMER 10
|
||||
#define EL3REG_TXSTATUS 11
|
||||
#define EL3REG_TXSPACE 12 /* also in window 3 */
|
||||
|
||||
/* Window 2 */
|
||||
|
||||
#define EL3REG_ADDRESS0 0
|
||||
#define EL3REG_ADDRESS1 1
|
||||
#define EL3REG_ADDRESS2 2
|
||||
#define EL3REG_ADDRESS3 3
|
||||
#define EL3REG_ADDRESS4 4
|
||||
#define EL3REG_ADDRESS5 5
|
||||
#define EL3REG_SRAMDIAG 6
|
||||
#define EL3REG_MULTIFUNCCONFIG 8
|
||||
#define EL3REG_ALTEEPROMCMD 10
|
||||
|
||||
/* Window 3 */
|
||||
|
||||
#define EL3REG_ROMCONTROL 4
|
||||
#define EL3REG_TXRECLAIM 6
|
||||
#define EL3REG_RXSPACE 10
|
||||
|
||||
/* Window 4 */
|
||||
|
||||
#define EL3REG_FIFODIAG 4
|
||||
#define EL3REG_NETDIAG 6
|
||||
#define EL3REG_CONTROLLERSTATUS 8
|
||||
#define EL3REG_MEDIA 10
|
||||
|
||||
/* Window 5 */
|
||||
|
||||
#define EL3REG_TXSTARTTHRESH 0
|
||||
#define EL3REG_TXAVAILTHRESH 2
|
||||
#define EL3REG_RXEARLYTHRESH 6
|
||||
#define EL3REG_RXFILTER 8
|
||||
#define EL3REG_INTMASK 10
|
||||
#define EL3REG_READZEROMASK 12
|
||||
|
||||
|
||||
/* (Some) EEPROM data offsets */
|
||||
/* ========================== */
|
||||
|
||||
#define EL3EEPROM_ADDRESS0 0
|
||||
#define EL3EEPROM_ADDRESS1 1
|
||||
#define EL3EEPROM_ADDRESS2 2
|
||||
#define EL3EEPROM_PRODUCTID 3
|
||||
#define EL3EEPROM_MANFDATA0 4
|
||||
#define EL3EEPROM_MANFDATA1 5
|
||||
#define EL3EEPROM_MANFDATA2 6
|
||||
#define EL3EEPROM_MAKERID 7
|
||||
#define EL3EEPROM_ADDRCONFIG 8
|
||||
#define EL3EEPROM_RESCONFIG 9
|
||||
#define EL3EEPROM_ALTADDRESS0 10
|
||||
#define EL3EEPROM_ALTADDRESS1 11
|
||||
#define EL3EEPROM_ALTADDRESS2 12
|
||||
#define EL3EEPROM_SOFTWAREINFO 13
|
||||
#define EL3EEPROM_COMPATIBILITY 14
|
||||
#define EL3EEPROM_CHECKSUM 15
|
||||
|
||||
|
||||
/* EEPROM commands */
|
||||
/* =============== */
|
||||
|
||||
#define EL3ECMD_WRITEDISABLE (0x0<<4)
|
||||
#define EL3ECMD_WRITEALL (0x1<<4)
|
||||
#define EL3ECMD_ERASEALL (0x2<<4)
|
||||
#define EL3ECMD_WRITEENABLE (0x3<<4)
|
||||
#define EL3ECMD_WRITE (0x4<<4)
|
||||
#define EL3ECMD_READ (0x8<<4)
|
||||
#define EL3ECMD_ERASE (0xc<<4)
|
||||
|
||||
|
||||
/* Commands */
|
||||
/* ======== */
|
||||
|
||||
#define EL3CMD_GLOBALRESET (0<<11)
|
||||
#define EL3CMD_SELECTWINDOW (1<<11)
|
||||
#define EL3CMD_STARTCOAX (2<<11)
|
||||
#define EL3CMD_RXDISABLE (3<<11)
|
||||
#define EL3CMD_RXENABLE (4<<11)
|
||||
#define EL3CMD_RXRESET (5<<11)
|
||||
#define EL3CMD_RXDISCARD (8<<11)
|
||||
#define EL3CMD_TXENABLE (9<<11)
|
||||
#define EL3CMD_TXDISABLE (10<<11)
|
||||
#define EL3CMD_TXRESET (11<<11)
|
||||
#define EL3CMD_REQINT (12<<11)
|
||||
#define EL3CMD_ACKINT (13<<11)
|
||||
#define EL3CMD_SETINTMASK (14<<11)
|
||||
#define EL3CMD_SETZEROMASK (15<<11)
|
||||
#define EL3CMD_SETRXFILTER (16<<11)
|
||||
#define EL3CMD_SETRXTHRESH (17<<11)
|
||||
#define EL3CMD_SETTXTHRESH (18<<11)
|
||||
#define EL3CMD_SETTXSTART (19<<11)
|
||||
#define EL3CMD_STATSENABLE (21<<11)
|
||||
#define EL3CMD_STATSDISABLE (22<<11)
|
||||
#define EL3CMD_STOPCOAX (23<<11)
|
||||
#define EL3CMD_POWERUP (27<<11)
|
||||
#define EL3CMD_POWERDOWN (28<<11)
|
||||
#define EL3CMD_POWERAUTO (29<<11)
|
||||
|
||||
|
||||
/* Interrupt types */
|
||||
/* =============== */
|
||||
|
||||
#define EL3INTB_UPDATESTATS 7
|
||||
#define EL3INTB_REQINT 6
|
||||
#define EL3INTB_RXEARLY 5
|
||||
#define EL3INTB_RXCOMPLETE 4
|
||||
#define EL3INTB_TXAVAIL 3
|
||||
#define EL3INTB_TXCOMPLETE 2
|
||||
#define EL3INTB_FAILURE 1
|
||||
#define EL3INTB_ANY 0
|
||||
|
||||
#define EL3INTF_UPDATESTATS (1<<EL3INTB_UPDATESTATS)
|
||||
#define EL3INTF_REQINT (1<<EL3INTB_REQINT)
|
||||
#define EL3INTF_RXEARLY (1<<EL3INTB_RXEARLY)
|
||||
#define EL3INTF_RXCOMPLETE (1<<EL3INTB_RXCOMPLETE)
|
||||
#define EL3INTF_TXAVAIL (1<<EL3INTB_TXAVAIL)
|
||||
#define EL3INTF_TXCOMPLETE (1<<EL3INTB_TXCOMPLETE)
|
||||
#define EL3INTF_FAILURE (1<<EL3INTB_FAILURE)
|
||||
#define EL3INTF_ANY (1<<EL3INTB_ANY)
|
||||
|
||||
|
||||
/* Register Details */
|
||||
/* ================ */
|
||||
|
||||
/* Configuration Control Register */
|
||||
|
||||
#define EL3REG_CONFIGB_NOTPCCARD 14
|
||||
#define EL3REG_CONFIGB_HASAUI 13
|
||||
#define EL3REG_CONFIGB_HASCOAX 12
|
||||
#define EL3REG_CONFIGB_HASTP 9
|
||||
#define EL3REG_CONFIGB_USEINTERNAL 8
|
||||
#define EL3REG_CONFIGB_RESET 2
|
||||
#define EL3REG_CONFIGB_ENABLE 0
|
||||
|
||||
#define EL3REG_CONFIGF_NOTPCCARD (1<<EL3REG_CONFIGB_NOTPCCARD)
|
||||
#define EL3REG_CONFIGF_HASAUI (1<<EL3REG_CONFIGB_HASAUI)
|
||||
#define EL3REG_CONFIGF_HASCOAX (1<<EL3REG_CONFIGB_HASCOAX)
|
||||
#define EL3REG_CONFIGF_HASTP (1<<EL3REG_CONFIGB_HASTP)
|
||||
#define EL3REG_CONFIGF_USEINTERNAL (1<<EL3REG_CONFIGB_USEINTERNAL)
|
||||
#define EL3REG_CONFIGF_RESET (1<<EL3REG_CONFIGB_RESET)
|
||||
#define EL3REG_CONFIGF_ENABLE (1<<EL3REG_CONFIGB_ENABLE)
|
||||
|
||||
/* Address Configuration Register */
|
||||
|
||||
#define EL3REG_ADDRCONFIGB_AUTOSELECT 7
|
||||
|
||||
#define EL3REG_ADDRCONFIGF_AUTOSELECT (1<<EL3REG_ADDRCONFIGB_AUTOSELECT)
|
||||
|
||||
#define EL3REG_ADDRCONFIG_XCVRMASK 0xc000
|
||||
|
||||
#define EL3REG_ADDRCONFIG_XCVRTP (0<<14)
|
||||
#define EL3REG_ADDRCONFIG_XCVRAUI (1<<14)
|
||||
#define EL3REG_ADDRCONFIG_XCVRCOAX (3<<14)
|
||||
|
||||
/* Status Register */
|
||||
|
||||
#define EL3REG_STATUSB_CMDINPROGRESS 12
|
||||
|
||||
#define EL3REG_STATUSF_CMDINPROGRESS (1<<EL3REG_STATUSB_CMDINPROGRESS)
|
||||
|
||||
#define EL3REG_STATUS_WINDOWMASK 0xe0
|
||||
|
||||
/* EEPROM Command Register */
|
||||
|
||||
#define EL3REG_EEPROMCMDB_BUSY 15
|
||||
|
||||
#define EL3REG_EEPROMCMDF_BUSY (1<<EL3REG_EEPROMCMDB_BUSY)
|
||||
|
||||
/* RX Status Register */
|
||||
|
||||
#define EL3REG_RXSTATUSB_INCOMPLETE 15
|
||||
#define EL3REG_RXSTATUSB_ERROR 14
|
||||
|
||||
#define EL3REG_RXSTATUSF_INCOMPLETE (1<<EL3REG_RXSTATUSB_INCOMPLETE)
|
||||
#define EL3REG_RXSTATUSF_ERROR (1<<EL3REG_RXSTATUSB_ERROR)
|
||||
|
||||
#define EL3REG_RXSTATUS_ERRORMASK 0x3800
|
||||
#define EL3REG_RXSTATUS_SIZEMASK 0x07ff
|
||||
|
||||
/* TX Status Register */
|
||||
|
||||
#define EL3REG_TXSTATUSB_COMPLETE 7
|
||||
#define EL3REG_TXSTATUSB_ONSUCCESS 6
|
||||
#define EL3REG_TXSTATUSB_JABBER 5
|
||||
#define EL3REG_TXSTATUSB_UNDERRUN 4
|
||||
#define EL3REG_TXSTATUSB_MAXCOLLISIONS 3
|
||||
#define EL3REG_TXSTATUSB_OVERFLOW 2
|
||||
|
||||
#define EL3REG_TXSTATUSF_COMPLETE (1<<EL3REG_TXSTATUSB_COMPLETE)
|
||||
#define EL3REG_TXSTATUSF_ONSUCCESS (1<<EL3REG_TXSTATUSB_ONSUCCESS)
|
||||
#define EL3REG_TXSTATUSF_JABBER (1<<EL3REG_TXSTATUSB_JABBER)
|
||||
#define EL3REG_TXSTATUSF_UNDERRUN (1<<EL3REG_TXSTATUSB_UNDERRUN)
|
||||
#define EL3REG_TXSTATUSF_MAXCOLLISIONS (1<<EL3REG_TXSTATUSB_MAXCOLLISIONS)
|
||||
#define EL3REG_TXSTATUSF_OVERFLOW (1<<EL3REG_TXSTATUSB_OVERFLOW)
|
||||
|
||||
/* Net Diagnostic Port Register */
|
||||
|
||||
#define EL3REG_NETDIAGB_EXTERNALLOOP 15
|
||||
#define EL3REG_NETDIAGB_ENDECLOOP 14
|
||||
#define EL3REG_NETDIAGB_CONTROLLERLOOP 13
|
||||
#define EL3REG_NETDIAGB_FIFOLOOP 12
|
||||
#define EL3REG_NETDIAGB_TXON 11
|
||||
#define EL3REG_NETDIAGB_RXON 10
|
||||
#define EL3REG_NETDIAGB_TXING 9
|
||||
#define EL3REG_NETDIAGB_NEEDTXRESET 8
|
||||
#define EL3REG_NETDIAGB_STATSON 7
|
||||
#define EL3REG_NETDIAGB_TESTLVD 0
|
||||
|
||||
#define EL3REG_NETDIAGF_EXTERNALLOOP (1<<EL3REG_NETDIAGB_EXTERNALLOOP)
|
||||
#define EL3REG_NETDIAGF_ENDECLOOP (1<<EL3REG_NETDIAGB_ENDECLOOP)
|
||||
#define EL3REG_NETDIAGF_CONTROLLERLOOP (1<<EL3REG_NETDIAGB_CONTROLLERLOOP)
|
||||
#define EL3REG_NETDIAGF_FIFOLOOP (1<<EL3REG_NETDIAGB_FIFOLOOP)
|
||||
#define EL3REG_NETDIAGF_TXON (1<<EL3REG_NETDIAGB_TXON)
|
||||
#define EL3REG_NETDIAGF_RXON (1<<EL3REG_NETDIAGB_RXON)
|
||||
#define EL3REG_NETDIAGF_TXING (1<<EL3REG_NETDIAGB_TXING)
|
||||
#define EL3REG_NETDIAGF_NEEDTXRESET (1<<EL3REG_NETDIAGB_NEEDTXRESET)
|
||||
#define EL3REG_NETDIAGF_STATSON (1<<EL3REG_NETDIAGB_STATSON)
|
||||
#define EL3REG_NETDIAGF_TESTLVD (1<<EL3REG_NETDIAGB_TESTLVD)
|
||||
|
||||
#define EL3REG_NETDIAG_REVMASK 0x3e
|
||||
|
||||
/* Media Type and Status Register */
|
||||
|
||||
#define EL3REG_MEDIAB_TP 15
|
||||
#define EL3REG_MEDIAB_COAX 14
|
||||
#define EL3REG_MEDIAB_SQE 12
|
||||
#define EL3REG_MEDIAB_BEAT 11
|
||||
#define EL3REG_MEDIAB_POLEREV 10
|
||||
#define EL3REG_MEDIAB_JABBER 9
|
||||
#define EL3REG_MEDIAB_UNSQUELCH 8
|
||||
#define EL3REG_MEDIAB_BEATENABLE 7
|
||||
#define EL3REG_MEDIAB_JABBERENABLE 6
|
||||
#define EL3REG_MEDIAB_CRS 5
|
||||
#define EL3REG_MEDIAB_COLLISION 4
|
||||
#define EL3REG_MEDIAB_SQESTATSENABLE 3
|
||||
#define EL3REG_MEDIAB_CRCSTRIPDISABLE 2
|
||||
#define EL3REG_MEDIAB_LINKLIGHT 0
|
||||
|
||||
#define EL3REG_MEDIAF_TP (1<<EL3REG_MEDIAB_TP)
|
||||
#define EL3REG_MEDIAF_COAX (1<<EL3REG_MEDIAB_COAX)
|
||||
#define EL3REG_MEDIAF_SQE (1<<EL3REG_MEDIAB_SQE)
|
||||
#define EL3REG_MEDIAF_BEAT (1<<EL3REG_MEDIAB_BEAT)
|
||||
#define EL3REG_MEDIAF_POLEREV (1<<EL3REG_MEDIAB_POLEREV)
|
||||
#define EL3REG_MEDIAF_JABBER (1<<EL3REG_MEDIAB_JABBER)
|
||||
#define EL3REG_MEDIAF_UNSQUELCH (1<<EL3REG_MEDIAB_UNSQUELCH)
|
||||
#define EL3REG_MEDIAF_BEATENABLE (1<<EL3REG_MEDIAB_BEATENABLE)
|
||||
#define EL3REG_MEDIAF_JABBERENABLE (1<<EL3REG_MEDIAB_JABBERENABLE)
|
||||
#define EL3REG_MEDIAF_CRS (1<<EL3REG_MEDIAB_CRS)
|
||||
#define EL3REG_MEDIAF_COLLISION (1<<EL3REG_MEDIAB_COLLISION)
|
||||
#define EL3REG_MEDIAF_SQESTATSENABLE (1<<EL3REG_MEDIAB_SQESTATSENABLE)
|
||||
#define EL3REG_MEDIAF_CRCSTRIPDISABLE (1<<EL3REG_MEDIAB_CRCSTRIPDISABLE)
|
||||
#define EL3REG_MEDIAF_LINKLIGHT (1<<EL3REG_MEDIAB_LINKLIGHT)
|
||||
|
||||
|
||||
/* Command parameters */
|
||||
/* ================== */
|
||||
|
||||
#define EL3CMD_SETRXFILTERB_UCAST 0
|
||||
#define EL3CMD_SETRXFILTERB_MCAST 1
|
||||
#define EL3CMD_SETRXFILTERB_BCAST 2
|
||||
#define EL3CMD_SETRXFILTERB_PROM 3
|
||||
|
||||
#define EL3CMD_SETRXFILTERF_UCAST (1<<EL3CMD_SETRXFILTERB_UCAST)
|
||||
#define EL3CMD_SETRXFILTERF_MCAST (1<<EL3CMD_SETRXFILTERB_MCAST)
|
||||
#define EL3CMD_SETRXFILTERF_BCAST (1<<EL3CMD_SETRXFILTERB_BCAST)
|
||||
#define EL3CMD_SETRXFILTERF_PROM (1<<EL3CMD_SETRXFILTERB_PROM)
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
|
||||
$VER: initializers.h 41.4 (21.11.2003)
|
||||
Copyright (C) 2000-2003 Neil Cafferkey
|
||||
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This file 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this file; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef EXEC_INITIALIZERS_H
|
||||
#define EXEC_INITIALIZERS_H
|
||||
|
||||
#include <exec/types.h>
|
||||
|
||||
|
||||
/* Use the OFFSET macro as the offset parameter of one of the other
|
||||
macros */
|
||||
/*
|
||||
#ifdef OFFSET
|
||||
#undef OFFSET
|
||||
#endif
|
||||
*/
|
||||
#define OFFSET(struct_name, struct_field) \
|
||||
((ULONG)(&(((struct struct_name *)0)->struct_field)))
|
||||
|
||||
/* Use the following macros in the structure definition */
|
||||
|
||||
#define INITBYTEDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
|
||||
UBYTE name ## _o3; UBYTE name ## _v; UBYTE name ## _p
|
||||
#define INITWORDDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
|
||||
UWORD name ## _v
|
||||
#define INITLONGDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
|
||||
ULONG name ## _v
|
||||
#define INITPINTDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
|
||||
UPINT name ## _v
|
||||
|
||||
#define SMALLINITBYTEDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o; UBYTE name ## _v; UBYTE name ## _p
|
||||
#define SMALLINITWORDDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o; UWORD name ## _v
|
||||
#define SMALLINITLONGDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o; ULONG name ## _v
|
||||
#define SMALLINITPINTDEF(name) \
|
||||
UBYTE name ## _c; UBYTE name ## _o; UPINT name ## _v
|
||||
|
||||
#define INITENDDEF UBYTE the_end
|
||||
|
||||
/* Use the following macros to fill in a structure */
|
||||
|
||||
#define NEWINITBYTE(offset, value) \
|
||||
0xe0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
|
||||
(UBYTE)(value), 0
|
||||
#define NEWINITWORD(offset, value) \
|
||||
0xd0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
|
||||
(UWORD)(value)
|
||||
#define NEWINITLONG(offset, value) \
|
||||
0xc0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
|
||||
(ULONG)(value)
|
||||
#define INITPINT(offset, value) \
|
||||
0xc0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
|
||||
(UPINT)(value)
|
||||
|
||||
#define SMALLINITBYTE(offset, value) \
|
||||
0xa0, (offset), (UBYTE)(value), 0
|
||||
#define SMALLINITWORD(offset, value) \
|
||||
0x90, (offset), (UWORD)(value)
|
||||
#define SMALLINITLONG(offset, value) \
|
||||
0x80, (offset), (ULONG)(value)
|
||||
#define SMALLINITPINT(offset, value) \
|
||||
0x80, (offset), (UPINT)(value)
|
||||
|
||||
#define INITEND 0
|
||||
|
||||
/* Obsolete definitions */
|
||||
|
||||
#define INITBYTE(offset, value) \
|
||||
(0xe000 | ((UWORD)(offset) >> 16)), \
|
||||
(UWORD)(offset), (UWORD)((value) << 8)
|
||||
#define INITWORD(offset, value) \
|
||||
(0xd000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), (UWORD)(value)
|
||||
#define INITLONG(offset, value) \
|
||||
(0xc000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), \
|
||||
(UWORD)((value) >> 16), (UWORD)(value)
|
||||
#define INITAPTR(offset, value) \
|
||||
(0xc000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), \
|
||||
(UWORD)((ULONG)(value) >> 16), (UWORD)(value)
|
||||
|
||||
#endif
|
||||
+1523
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
|
||||
File: request_protos.h
|
||||
Author: Neil Cafferkey
|
||||
Copyright (C) 2002 Neil Cafferkey
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef REQUEST_PROTOS_H
|
||||
#define REQUEST_PROTOS_H
|
||||
|
||||
|
||||
#include "device.h"
|
||||
|
||||
VOID ServiceRequest(struct IOSana2Req *request,struct DevBase *base);
|
||||
VOID PutRequest(struct MsgPort *port,struct IORequest *request,
|
||||
struct DevBase *base);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+2166
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
|
||||
File: unit_protos.h
|
||||
Author: Neil Cafferkey
|
||||
Copyright (C) 2002 Neil Cafferkey
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef UNIT_PROTOS_H
|
||||
#define UNIT_PROTOS_H
|
||||
|
||||
|
||||
#include "device.h"
|
||||
|
||||
struct DevUnit *GetUnit(ULONG unit_num,struct DevBase *base);
|
||||
struct DevUnit *FindUnit(ULONG unit_num,struct DevBase *base);
|
||||
struct DevUnit *CreateUnit(ULONG unit_num,struct DevBase *base);
|
||||
VOID DeleteUnit(struct DevUnit *unit,struct DevBase *base);
|
||||
VOID ConfigureAdapter(struct DevUnit *unit,struct DevBase *base);
|
||||
VOID GoOnline(struct DevUnit *unit,struct DevBase *base);
|
||||
VOID GoOffline(struct DevUnit *unit,struct DevBase *base);
|
||||
BOOL AddMulticastRange(struct DevUnit *unit,UBYTE *lower_bound,
|
||||
UBYTE *upper_bound,struct DevBase *base);
|
||||
BOOL RemMulticastRange(struct DevUnit *unit,UBYTE *lower_bound,
|
||||
UBYTE *upper_bound,struct DevBase *base);
|
||||
struct TypeStats *FindTypeStats(struct DevUnit *unit,struct MinList *list,
|
||||
ULONG packet_type,struct DevBase *base);
|
||||
VOID FlushUnit(struct DevUnit *unit,UBYTE last_queue,BYTE error,
|
||||
struct DevBase *base);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user