/*
 *               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.
 *
 */

#include <iostypes.h>
#include <hw.h>
#include <ioslibc.h>
#include <apputils.h>
#include <elf.h>

int
m_bindump(char *args, char *d)
{
    char *name;
    char *saddr;
    char *slen;
    u32 rv = 0;
    u32 addr, len;
    if (   getNextToken(&name, &args)
        && getNextToken(&saddr, &args)
        && getNextToken(&slen, &args)) {
        addr = atou32(saddr);
        len = atou32(slen);
        rv = bindump(name, addr, len);
        if ( rv > 0 ) {
            printf("Wrote BIN file: %s [size = %u bytes]\n", name, len);
            printf("Source address: 0x%08x\n", addr);
        }
        else 
           printf("Failed to dump BIN file: %s or size = 0\n", name);
    }
    else
       printf("Usage: bindump file address len\n");

    return rv;
}
