hex_file.hh revision 8706
1955SN/A/*
2955SN/A * Copyright (c) 2002-2004 The Regents of The University of Michigan
314209Sandreas.sandberg@arm.com * All rights reserved.
49812Sandreas.hansson@arm.com *
59812Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without
69812Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are
79812Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright
89812Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer;
99812Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright
109812Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the
119812Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution;
129812Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its
139812Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from
149812Sandreas.hansson@arm.com * this software without specific prior written permission.
157816Ssteve.reinhardt@amd.com *
165871Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171762SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27955SN/A *
28955SN/A * Authors: Jaidev Patwardhan
29955SN/A */
30955SN/A
31955SN/A#ifndef __BASE_LOADER_HEX_FILE_HH__
32955SN/A#define __BASE_LOADER_HEX_FILE_HH__
33955SN/A
34955SN/A#include <cstdio>
35955SN/A#include <limits>
36955SN/A#include <string>
37955SN/A
38955SN/A#include "base/types.hh"
39955SN/A
40955SN/Aclass PortProxy;
41955SN/A
422665Ssaidi@eecs.umich.educlass HexFile
432665Ssaidi@eecs.umich.edu{
445863Snate@binkert.org  protected:
45955SN/A    const std::string filename;
46955SN/A    FILE *fp;
47955SN/A
48955SN/A    void parseLine(char *, Addr *, uint32_t *);
49955SN/A
508878Ssteve.reinhardt@amd.com  public:
512632Sstever@eecs.umich.edu    HexFile(const std::string _filename);
528878Ssteve.reinhardt@amd.com    virtual ~HexFile();
532632Sstever@eecs.umich.edu
54955SN/A    void close();
558878Ssteve.reinhardt@amd.com    bool loadSections(PortProxy* memProxy);
562632Sstever@eecs.umich.edu};
572761Sstever@eecs.umich.edu
582632Sstever@eecs.umich.edu#endif // __BASE_LOADER_HEX_FILE_HH__
592632Sstever@eecs.umich.edu