main.c revision 161368
1157916Simp/*- 2157916Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3157916Simp * 4157916Simp * Redistribution and use in source and binary forms, with or without 5157916Simp * modification, are permitted provided that the following conditions 6157916Simp * are met: 7157916Simp * 1. Redistributions of source code must retain the above copyright 8157916Simp * notice, this list of conditions and the following disclaimer. 9157916Simp * 2. Redistributions in binary form must reproduce the above copyright 10157916Simp * notice, this list of conditions and the following disclaimer in the 11157916Simp * documentation and/or other materials provided with the distribution. 12157916Simp * 13157916Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14157916Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15157916Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16157916Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17157916Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18157916Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19157916Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20157916Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21157916Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22157916Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23157916Simp * 24157916Simp * $FreeBSD: head/sys/boot/arm/at91/boot0iic/main.c 161368 2006-08-16 23:14:52Z imp $ 25157916Simp */ 26157916Simp 27157916Simp#include "at91rm9200.h" 28157916Simp#include "lib.h" 29157916Simp#include "at91rm9200_lowlevel.h" 30157916Simp 31157916Simpint 32157916Simpmain(void) 33157916Simp{ 34157916Simp char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ 35157916Simp 36157916Simp while (xmodem_rx(addr) == -1) 37157916Simp continue; 38161368Simp InitEEPROM(); 39161368Simp printf("Writing EEPROM from 0x%x to addr 0\r\n", addr); 40161368Simp WriteEEPROM(0, addr, 8192); 41161368Simp printf("Write complete. Press reset\r\n"); 42157916Simp return (1); 43157916Simp} 44