Deleted Added
sdiff udiff text old ( 161196 ) new ( 161370 )
full compact
1/*******************************************************************************
2 *
3 * Filename: emac.c
4 *
5 * Instantiation of routines for MAC/ethernet functions supporting tftp.
6 *
7 * Revision information:
8 *

--- 5 unchanged lines hidden (view full) ---

14 * No warranty, expressed or implied, is included with this software. It is
15 * provided "AS IS" and no warranty of any kind including statutory or aspects
16 * relating to merchantability or fitness for any purpose is provided. All
17 * intellectual property rights of others is maintained with the respective
18 * owners. This software is not copyrighted and is intended for reference
19 * only.
20 * END_BLOCK
21 *
22 * $FreeBSD: head/sys/boot/arm/at91/libat91/emac.c 161370 2006-08-16 23:39:58Z imp $
23 ******************************************************************************/
24
25#include "at91rm9200.h"
26#include "at91rm9200_lowlevel.h"
27#include "emac.h"
28#include "lib.h"
29
30/* ****************************** GLOBALS *************************************/
31
32/* ********************** PRIVATE FUNCTIONS/DATA ******************************/
33
34static char serverMACAddr[6];
35static unsigned char localIPAddr[4], serverIPAddr[4];
36static int ackBlock;
37static char *dlAddress;
38
39static unsigned transmitBuffer[1024 / sizeof(unsigned)];
40static unsigned tftpSendPacket[256 / sizeof(unsigned)];
41
42/*
43 * .KB_C_FN_DEFINITION_START
44 * unsigned short IP_checksum(unsigned short *p, int len)
45 * This private function calculates the IP checksum for various headers.
46 * .KB_C_FN_DEFINITION_END
47 */
48static unsigned short
49IP_checksum(unsigned short *p, int len)

--- 411 unchanged lines hidden (view full) ---

461 pEmac->EMAC_CTL = AT91C_EMAC_TE | AT91C_EMAC_RE;
462
463 pEmac->EMAC_TAR = (unsigned)transmitBuffer;
464}
465
466
467/* ************************** GLOBAL FUNCTIONS ********************************/
468
469/*
470 * .KB_C_FN_DEFINITION_START
471 * void SetServerIPAddress(unsigned address)
472 * This global function sets the IP of the TFTP download server.
473 * .KB_C_FN_DEFINITION_END
474 */
475void
476SetServerIPAddress(unsigned address)
477{
478 // force update in case the IP has changed

--- 76 unchanged lines hidden (view full) ---

555 TFTP_ACK_Data(0, ackBlock, 512);
556 printf("\nNAK %u\r\n", ackBlock);
557 }
558 }
559 }
560 if (timeout == 0)
561 printf("TFTP TIMEOUT!\r\n");
562}