main.c revision 157926
1157697Simp/*- 2157697Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3157697Simp * 4157697Simp * Redistribution and use in source and binary forms, with or without 5157697Simp * modification, are permitted provided that the following conditions 6157697Simp * are met: 7157697Simp * 1. Redistributions of source code must retain the above copyright 8157697Simp * notice, this list of conditions and the following disclaimer. 9157697Simp * 2. Redistributions in binary form must reproduce the above copyright 10157697Simp * notice, this list of conditions and the following disclaimer in the 11157697Simp * documentation and/or other materials provided with the distribution. 12157697Simp * 13157697Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14157697Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15157697Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16157697Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17157697Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18157697Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19157697Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20157697Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21157697Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22157697Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23157697Simp * 24157697Simp * $FreeBSD: head/sys/boot/arm/at91/boot0/main.c 157926 2006-04-21 07:45:57Z imp $ 25157697Simp */ 26157697Simp 27157873Simp#include "at91rm9200.h" 28157697Simp#include "lib.h" 29157730Simp#include "at91rm9200_lowlevel.h" 30157697Simp 31157926Simptypedef void fn_t(void); 32157697Simp 33157697Simpint 34157697Simpmain(void) 35157697Simp{ 36157697Simp char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ 37157873Simp fn_t *fn = (fn_t *)(SDRAM_BASE + (1 << 20)); /* Load to base + 1MB */ 38157697Simp 39157697Simp while (xmodem_rx(addr) == -1) 40157697Simp continue; 41157697Simp fn(); 42157926Simp return (0); 43157697Simp} 44