summaryrefslogtreecommitdiffstats
path: root/arch/m68k/mach-mcfv4e/include/proc/net
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k/mach-mcfv4e/include/proc/net')
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/eth.h70
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h88
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/net.h39
-rw-r--r--arch/m68k/mach-mcfv4e/include/proc/net/queue.h54
4 files changed, 251 insertions, 0 deletions
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/eth.h b/arch/m68k/mach-mcfv4e/include/proc/net/eth.h
new file mode 100644
index 0000000000..5240c0c945
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/eth.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 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 U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Declaration for for Ethernet Frames.
+ */
+
+#ifndef _ETH_H
+#define _ETH_H
+
+
+/* Ethernet standard lengths in bytes*/
+#define ETH_ADDR_LEN (6)
+#define ETH_TYPE_LEN (2)
+#define ETH_CRC_LEN (4)
+#define ETH_MAX_DATA (1500)
+#define ETH_MIN_DATA (46)
+#define ETH_HDR_LEN (ETH_ADDR_LEN * 2 + ETH_TYPE_LEN)
+
+/* Defined Ethernet Frame Types */
+#define ETH_FRM_IP (0x0800)
+#define ETH_FRM_ARP (0x0806)
+#define ETH_FRM_RARP (0x8035)
+#define ETH_FRM_TEST (0xA5A5)
+
+/* Maximum and Minimum Ethernet Frame Sizes */
+#define ETH_MAX_FRM (ETH_HDR_LEN + ETH_MAX_DATA + ETH_CRC_LEN)
+#define ETH_MIN_FRM (ETH_HDR_LEN + ETH_MIN_DATA + ETH_CRC_LEN)
+#define ETH_MTU (ETH_HDR_LEN + ETH_MAX_DATA)
+
+/* Ethernet Addresses */
+typedef uint8_t ETH_ADDR[ETH_ADDR_LEN];
+
+/* 16-bit Ethernet Frame Type, ie. Protocol */
+typedef uint16_t ETH_FRM_TYPE;
+
+/* Ethernet Frame Header definition */
+typedef struct
+{
+ ETH_ADDR dest;
+ ETH_ADDR src;
+ ETH_FRM_TYPE type;
+} ETH_HDR;
+
+/* Ethernet Frame definition */
+typedef struct
+{
+ ETH_HDR head;
+ uint8_t* data;
+} ETH_FRAME;
+
+
+#endif /* _ETH_H */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h b/arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h
new file mode 100644
index 0000000000..bc3a7a6924
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/nbuf.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 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 U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Definitions for network buffer management
+ */
+
+#ifndef _MCFV4E_NBUF_H_
+#define _MCFV4E_NBUF_H_
+
+/*
+ * Include the Queue structure definitions
+ */
+#include "queue.h"
+
+/*
+ * Number of network buffers to use
+ */
+#define NBUF_MAX 30
+
+/*
+ * Size of each buffer in bytes
+ */
+#ifndef NBUF_SZ
+#define NBUF_SZ 1520
+#endif
+
+/*
+ * Defines to identify all the buffer queues
+ * - FREE must always be defined as 0
+ */
+#define NBUF_FREE 0 /* available buffers */
+#define NBUF_TX_RING 1 /* buffers in the Tx BD ring */
+#define NBUF_RX_RING 2 /* buffers in the Rx BD ring */
+#define NBUF_SCRATCH 3 /* misc */
+#define NBUF_MAXQ 4 /* total number of queueus */
+
+/*
+ * Buffer Descriptor Format
+ *
+ * Fields:
+ * next Pointer to next node in the queue
+ * data Pointer to the data buffer
+ * offset Index into buffer
+ * length Remaining bytes in buffer from (data + offset)
+ */
+typedef struct
+{
+ QNODE node;
+ uint8_t *data;
+ uint16_t offset;
+ uint16_t length;
+} NBUF;
+
+/*
+ * Functions to manipulate the network buffers.
+ */
+int nbuf_init(void);
+void nbuf_flush(void);
+
+NBUF * nbuf_alloc (void);
+void nbuf_free(NBUF *);
+
+NBUF *nbuf_remove(int);
+void nbuf_add(int, NBUF *);
+
+void nbuf_reset(void);
+void nbuf_debug_dump(void);
+
+
+#endif /* _MCFV4E_NBUF_H_ */
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/net.h b/arch/m68k/mach-mcfv4e/include/proc/net/net.h
new file mode 100644
index 0000000000..a2ccd76510
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/net.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 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 U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Network definitions and prototypes for dBUG.
+ */
+
+#ifndef _MCFV4E_NET_H
+#define _MCFV4E_NET_H
+
+/*
+ * Include information and prototypes for all protocols
+ */
+#include "eth.h"
+#include "nbuf.h"
+
+int netif_init(int channel);
+int netif_setup(int channel);
+int netif_done(int channel);
+
+#endif /* _MCFV4E_NET_H */
+
diff --git a/arch/m68k/mach-mcfv4e/include/proc/net/queue.h b/arch/m68k/mach-mcfv4e/include/proc/net/queue.h
new file mode 100644
index 0000000000..c9da1c83a5
--- /dev/null
+++ b/arch/m68k/mach-mcfv4e/include/proc/net/queue.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2008 Carsten Schlote <c.schlote@konzeptpark.de>
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This file is part of U-Boot V2.
+ *
+ * U-Boot V2 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * U-Boot V2 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 U-Boot V2. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file
+ * Implement a first in, first out linked list
+ */
+#ifndef _QUEUE_H_
+#define _QUEUE_H_
+
+/*
+ * Individual queue node
+ */
+typedef struct NODE
+{
+ struct NODE *next;
+} QNODE;
+
+/*
+ * Queue Struture - linked list of qentry items
+ */
+typedef struct
+{
+ QNODE *head;
+ QNODE *tail;
+} QUEUE;
+
+/*
+ * Functions provided by queue.c
+ */
+void queue_init(QUEUE *);
+int queue_isempty(QUEUE *);
+void queue_add(QUEUE *, QNODE *);
+QNODE* queue_remove(QUEUE *);
+QNODE* queue_peek(QUEUE *);
+void queue_move(QUEUE *, QUEUE *);
+
+#endif /* _QUEUE_H_ */