main.c revision 164132
1275970Scy/*-
2275970Scy * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
3275970Scy *
4275970Scy * Redistribution and use in source and binary forms, with or without
5275970Scy * modification, are permitted provided that the following conditions
6275970Scy * are met:
7275970Scy * 1. Redistributions of source code must retain the above copyright
8275970Scy *    notice, this list of conditions and the following disclaimer.
9275970Scy * 2. Redistributions in binary form must reproduce the above copyright
10275970Scy *    notice, this list of conditions and the following disclaimer in the
11275970Scy *    documentation and/or other materials provided with the distribution.
12275970Scy *
13275970Scy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14275970Scy * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15275970Scy * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16275970Scy * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17275970Scy * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18275970Scy * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19275970Scy * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20275970Scy * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21275970Scy * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22275970Scy * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23275970Scy *
24275970Scy * $FreeBSD: head/sys/boot/arm/at91/boot0iic/main.c 164132 2006-11-09 19:55:25Z imp $
25275970Scy */
26275970Scy
27275970Scy#include "at91rm9200.h"
28275970Scy#include "lib.h"
29275970Scy#include "at91rm9200_lowlevel.h"
30275970Scy
31275970Scyint
32275970Scymain(void)
33275970Scy{
34275970Scy	char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
35275970Scy
36275970Scy	while (xmodem_rx(addr) == -1)
37275970Scy		continue;
38275970Scy	InitEEPROM();
39275970Scy	printf("Writing EEPROM from 0x%x to addr 0\n", addr);
40275970Scy	WriteEEPROM(0, addr, 8192);
41275970Scy	printf("Write complete.  Press reset\n");
42275970Scy	return (1);
43275970Scy}
44275970Scy