PERFORCE change 106172 for review
Warner Losh
imp at FreeBSD.org
Fri Sep 15 13:34:38 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=106172
Change 106172 by imp at imp_lighthouse on 2006/09/15 20:33:45
checkpoint
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#21 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/arm_init.S#8 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#22 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#33 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#21 (text+ko) ====
@@ -5,7 +5,7 @@
__at91_boot_Makefile.inc__:
-CFLAGS=-Os -mcpu=arm9 -ffreestanding \
+CFLAGS=-O2 -mcpu=arm9 -ffreestanding \
-I${.CURDIR}/../libat91 \
-I${.CURDIR}/../../../.. \
-I${.CURDIR}/../../../../arm \
==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/arm_init.S#8 (text+ko) ====
@@ -109,7 +109,7 @@
.string "e 0x10000000 "
.string " "
#else
-#if 0
+#if 1
.string "Bootloader for KB9202 Evaluation Board."
.string "m 42 53 44 0 0 1 "
.string "ip 206 168 13 194 "
==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#22 (text+ko) ====
@@ -280,6 +280,7 @@
// set mac address using 6 byte values
unsigned char mac[6];
+ printf("Set MAC %d\n", argc);
if (argc > 6) {
for (i = 0; i < 6; i++)
mac[i] = p_ASCIIToHex(argv[i + 1]);
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#33 (text+ko) ====
@@ -31,8 +31,8 @@
/* ********************** PRIVATE FUNCTIONS/DATA ******************************/
-static receive_descriptor_t *p_rxBD = (receive_descriptor_t*)RX_BUFFER_START;
-static unsigned short localPort = SWAP16(0x8002);
+static receive_descriptor_t *p_rxBD;
+static unsigned short localPort;
static unsigned short serverPort;
static unsigned serverMACSet;
static unsigned localIPSet, serverIPSet;
@@ -249,7 +249,6 @@
if (!process)
return (0);
-
process = i;
pFrameType = (unsigned short *)((p_rxBD[i].address & 0xFFFFFFFC) + 12);
@@ -260,16 +259,17 @@
case SWAP16(PROTOCOL_ARP):
p_ARP = (arp_header_t*)pData;
if (p_ARP->operation == SWAP16(ARP_REPLY)) {
+ printf("R");
// check if new server info is available
if ((!serverMACSet) &&
(!(p_memcmp((char*)p_ARP->sender_ip,
(char*)serverIPAddr, 4)))) {
serverMACSet = 1;
-
memcpy(serverMACAddr, p_ARP->sender_mac, 6);
}
} else if (p_ARP->operation == SWAP16(ARP_REQUEST)) {
+ printf("r");
// ARP REPLY operation
p_ARP->operation = SWAP16(ARP_REPLY);
@@ -297,6 +297,7 @@
}
break;
case SWAP16(PROTOCOL_IP):
+ printf("i");
pIpHeader = (ip_header_t*)(pData + 14);
memcpy(pHeader, pIpHeader, sizeof(ip_header_t));
@@ -304,24 +305,33 @@
udp_header_t *udpHdr;
tftp_header_t *tftpHdr;
+ printf("u");
udpHdr = (udp_header_t*)((char*)pIpHeader+20);
tftpHdr = (tftp_header_t*)((char*)udpHdr + 8);
- if (udpHdr->dst_port != localPort)
- break;
+ if (udpHdr->dst_port != localPort) {
+ printf("@ %x %x\n", udpHdr->dst_port, localPort);
+ break;
+ }
- if (tftpHdr->opcode != TFTP_DATA_OPCODE)
- break;
+ if (tftpHdr->opcode != TFTP_DATA_OPCODE) {
+ printf("#");
+ break;
+ }
if (ackBlock == -1) {
- if (tftpHdr->block_num != SWAP16(1))
- break;
+ if (tftpHdr->block_num != SWAP16(1)) {
+ printf("%");
+ break;
+ }
serverPort = udpHdr->src_port;
ackBlock = 0;
}
- if (serverPort != udpHdr->src_port)
- break;
+ if (serverPort != udpHdr->src_port) {
+ printf("$");
+ break;
+ }
TFTP_ACK_Data(tftpHdr->data,
SWAP16(tftpHdr->block_num),
@@ -442,6 +452,9 @@
char *pRxPacket = (char*)RX_DATA_START;
AT91PS_EMAC pEmac = AT91C_BASE_EMAC;
+ p_rxBD = (receive_descriptor_t*)RX_BUFFER_START;
+ localPort = SWAP16(0x8002);
+
for (i = 0; i < MAX_RX_PACKETS; ++i) {
p_rxBD[i].address = (unsigned)pRxPacket;
@@ -539,9 +552,11 @@
if (CheckForNewPacket(&IpHeader)) {
if (ackBlock == -2)
break;
+ printf("P");
timeout = 10;
thisSeconds = GetSeconds() + 1;
} else if (GetSeconds() > thisSeconds) {
+ printf(".");
--timeout;
thisSeconds = GetSeconds() + 1;
if (!serverMACSet)
More information about the p4-projects
mailing list