/*
 * avrdude - A Downloader/Uploader for AVR device programmers
 * Copyright (C) 2000-2004  Brian S. Dean <bsd@bsdhome.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/* $Id: fileio.h,v 1.16 2007/01/24 22:43:46 joerg_wunsch Exp $ */

#ifndef fileio_h
#define fileio_h

typedef enum {
  FMT_AUTO,
  FMT_SREC,
  FMT_IHEX,
  FMT_RBIN,
  FMT_IMM,
  FMT_HEX,
  FMT_DEC,
  FMT_OCT,
  FMT_BIN
} FILEFMT;

/**
 * An AVRDUDE struct describing the ways in which a file may be opened.
 */
struct fioparms {
  int    op;
  const char * mode;
  const char * iodesc;
  const char * dir;
  const char * rw;
};

enum {
  FIO_READ,
  FIO_WRITE
};

#ifdef __cplusplus
extern "C" {
#endif

const char * fmtstr(FILEFMT format);

int fileio_setparms(int op, struct fioparms * fp);

#if 0
int fileio(int op, char * filename, FILEFMT format,
           struct avrpart * p, char * memtype, int size);
#endif

extern int fileio_ihex(struct fioparms * fio, 
                  const char * filename, FILE * f, unsigned char * buf, int size);

#ifdef __cplusplus
}
#endif

#endif
