/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished proprietary information of BroadOn Communications Corp.,
 *  and are protected by federal copyright law. They may not be disclosed
 *  to third parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 *  Description:
 *      This file implements common utility functions.
 */
#include <iostypes.h>
#include <ioslibc.h>
#include <elf.h>
#ifdef RVL
extern void little2big(u32 *buf, u32 len);
#endif 
u32
binload(char *name, u32 addr, u32 len)
{
    FILE *fp = 0;
    u32 rv = 0;
    u8 *buf;

    if ( (NULL == name) || (0 == (fp = fopen(name, "rb")))) {
        printf("fopen: unable to load file '%s'\n", name);
        goto out;
    }
    buf = (u8*)addr;
    fread(buf, len, 1, fp);
    rv = len;
out:
    if (fp) fclose(fp);
    return rv;
}
