3 * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #ifndef _KEYMILE_HDLC_ENET_H_
25 #define _KEYMILE_HDLC_ENET_H_
27 /* Unfortuantely, we have do this to get the flag defines in the cbd_t */
33 #include <asm/cpm_8260.h>
37 * Defines for the ICN protocol used for communication over HDLC
38 * on the backplane between MGSUVDs and MGCOGEs.
42 * MAC which is reserved for communication (0x00 - 0xff in the last byte,
43 * which is the slot number)
47 * A DLL frame looks like this:
48 * 8 bit | 8 bit | 8 bit | 8 bit | n * 8 bit| 16 bit| 8 bit
49 * opening| destination| source | application| data | FCS | closing
50 * flag | address | address| | | | flag
51 * (HW) (APP) (APP) (APP) (APP) (HW) (HW)
55 * The opening flag, the FCS and the closing flag are set by the hardware so
56 * they are not reflected in this struct.
59 unsigned char dest_addr;
60 unsigned char src_addr;
61 unsigned char application;
62 } __attribute__((packed));
64 #define ICNHDR_LEN (sizeof(struct icn_hdr))
65 #define CRC_LEN (sizeof(short))
66 /* bytes to remove from packet before sending it upstream */
67 #define REMOVE (ICNHDR_LEN + CRC_LEN)
71 unsigned char data[0]; /* a place holder */
72 } __attribute__((packed));
75 #define HDLC_UUA 0x00 /* Unicast Unit Address */
76 #define HDLC_UUA_MASK 0x3f /* the last 6 bits contain the slot number */
77 #define SET_HDLC_UUA(x) ((HDLC_UUA | ((x) & HDLC_UUA_MASK)))
78 #define HDLC_UACUA 0x7f /* Unicast Active Control Unit Address */
79 #define HDLC_BCAST 0xff /* broadcast */
81 /* Application field */
87 #define MGS_ITIME 0x05
89 #define MGS_NETCONS 0x06 /* netconsole */
92 /* Useful defines for buffer sizes, etc. */
93 #define HDLC_PKTBUFSRX 32
94 #define MAX_FRAME_LENGTH 1500 /* ethernet frame size */
96 #define INET_HDR_SIZE (ETHER_HDR_SIZE + IP_HDR_SIZE)
97 #define INET_HDR_ALIGN (((INET_HDR_SIZE + PKTALIGN - 1) / PKTALIGN) * PKTALIGN)
98 /* INET_HDR_SIZE is stripped off */
99 #define PKT_MAXBLR_SIZE (MAX_FRAME_LENGTH + INET_HDR_ALIGN)
102 * It is too slow to read always the port numbers and IP addresses from the
104 * cachedNumbers is meant to cache it.
105 * THIS IS ONLY A SPEED IMPROVEMENT!
108 IP_ADDR = 0, /* getenv_IPaddr("serverip"); */
109 IP_SERVER, /* getenv_IPaddr("ipaddr"); */
110 TFTP_SRC_PORT, /* simple_strtol(getenv("tftpsrcp"), NULL, 10); */
111 TFTP_DST_PORT, /* simple_strtol(getenv("tftpdstp"), NULL, 10); */
112 NETCONS_PORT, /* simple_strtol(getenv("ncip"), NULL, 10); */
116 #define WELL_KNOWN_PORT 69 /* Well known TFTP port # */
118 /* define this to create a test commend (htest) */
121 /* have to save a copy of the eth_device for the test command's use */
122 struct eth_device *seth;
124 /* define this for outputting of received packets */
126 /* define this for outputting of packets being sent */
129 #endif /* _KEYMILE_HDLC_ENET_H_ */