![]() ![]() | ![]() |
File: [local] / prex-old / boot / avr32 / ngw100 / uboot.c (download)
Revision 1.1, Tue Jul 15 22:54:49 2008 UTC (16 years, 1 month ago) by nbrk
initial bits of bootldr driver for U-Boot -- now we are able to query first stage bootloader about physical memory, flash, serial port speed etc. |
#include <uboot.h> #include <platform.h> struct uboot_cframe * uboot_map(uint32_t cframeaddr) { /* * Try to treat UBOOT_CFRAMESIZE bytes at cframeaddr as an u-boot * boot_params (configuration frame). U-Boot signs this region with crc32, * so we can determine if our probe is correct. * Return struct uboot_cframe * on success or NULL otherwise. */ struct uboot_cframe *ucfp; cframeaddr = BOOT_PARAMS; ucfp = cframeaddr; /* TODO: actually, check crc */ #if 0 if (crc32((uint8_t *)ucfp, UBOOT_CFRAMESIZE - 4) != ucfp->ucf_crc32) return (NULL); #endif printk("uboot_map: map @0x%x; memstart=%x; memsize=%x\n", cframeaddr, ucfp->ucf_memstart, ucfp->ucf_memsize); /* CRC ok, probe succeeded */ return (ucfp); }