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: releng/10.3/sys/boot/arm/at91/boot0iic/main.c 164322 2006-11-16 00:49:50Z 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 */ 35164322Simp int len, sec; 36157916Simp 37164322Simp printf("\nSend data to be written into EEPROM\n"); 38164322Simp while ((len = xmodem_rx(addr)) == -1) 39157916Simp continue; 40164322Simp sec = GetSeconds() + 1; 41164322Simp while (sec >= GetSeconds()) 42164322Simp continue; 43164322Simp printf("\nWriting EEPROM from 0x%x to addr 0, 0x%x bytes\n", addr, 44164322Simp len); 45161368Simp InitEEPROM(); 46164322Simp printf("init done\n"); 47164322Simp WriteEEPROM(0, addr, len); 48164322Simp printf("\nWrote %d bytes. Press reset\n", len); 49157916Simp return (1); 50157916Simp} 51