Go to the documentation of this file.
45 static int dp_pkt2user(
struct device *dev,
int page,
int length);
46 static void getblock(
struct device *dev,
int page,
size_t offset,
size_t size,
void *dst);
47 static int dp_recv(
struct device *);
49 static struct nicBuffer *ne2kBuffer = 0x0;
50 static struct device *mDev = 0x0;
56 " call ne2kHandler \n"
121 kpanic(
"Device Not Ready\n");
125 if ((word16 == 1) && (length & 0x01)) {
138 for (i = 0; i < length / 2; i++) {
143 for (i = 0; i < length; i++) {
148 for (i = 0; i <= 100; i++) {
163 int NICtoPC(
struct device *dev,
void *packet,
int length,
int nic_addr) {
180 for (i = 0; i < length / 2; i++) {
200 if ((isr & 0x02) == 0x02) {
204 if ((isr & 0x01) == 0x01) {
206 kprintf(
"Error Getting Packet\n");
220 static int dp_recv(
struct device *dev) {
222 unsigned int pageno = 0x0, curr = 0x0, next = 0x0;
223 int packet_processed = 0x0, r = 0x0;
238 getblock(dev, pageno, (
size_t) 0,
sizeof(header), &header);
246 if (length < 60 || length > 1514) {
247 kprintf(
"dp8390: packet with strange length arrived: %d\n", length);
250 else if (next < startPage || next >=
stopPage) {
251 kprintf(
"dp8390: strange next page\n");
255 kpanic(
"dp8390: fifo overrun, resetting receive buffer\n");
259 r = dp_pkt2user(dev, pageno, length);
265 packet_processed = 0x1;
274 }
while (packet_processed == 0x0);
278 static void getblock(
struct device *dev,
int page,
size_t offset,
size_t size,
void *dst) {
291 for (i = 0; i < size; i++)
296 static int dp_pkt2user(
struct device *dev,
int page,
int length) {
318 if (ne2kBuffer == 0x0) {
320 ne2kBuffer->
next = 0x0;
345 if (ne2k_spinLock == 0x1)
349 if (ne2kBuffer != 0x0)
350 ne2kBuffer = ne2kBuffer->
next;
struct nicBuffer * ne2kAllocBuffer(int length)
void outportByteP(unsigned int port, unsigned char value)
outputut one byte to specified port with a delay
void ne2kFreeBuffer(struct nicBuffer *buf)
unsigned short int uInt16
void outportWord(unsigned int, unsigned short)
outputut one word to specified port
void irqDisable(uInt16 irqNo)
void outportByte(unsigned int, unsigned char)
outputut one byte to specified port
void kfree(void *baseAddr)
void spinUnlock(spinLock_t *lock)
#define SPIN_LOCK_INITIALIZER
void kpanic(const char *fmt,...)
print panic message and halt system
struct nicBuffer * ne2kGetBuffer()
void spinLock(spinLock_t *lock)
unsigned char inportByte(unsigned int)
input one byte from specified port
int PCtoNIC(struct device *dev, void *packet, int length)
struct dp_rcvhdr dp_rcvhdr_t
unsigned short inportWord(unsigned int)
input one word from specified port
void * kmalloc(uInt32 len)
void setVector(void *handler, unsigned char interrupt, unsigned short controlMajor)
void irqEnable(uInt16 irqNo)
int kprintf(const char *,...)
struct nicBuffer * tmpBuf
int NICtoPC(struct device *dev, void *packet, int length, int nic_addr)