2002-11-30 14:09:12 +00:00
|
|
|
/*
|
2003-02-08 04:17:25 +00:00
|
|
|
* avrdude - A Downloader/Uploader for AVR device programmers
|
2003-02-06 19:08:33 +00:00
|
|
|
* Copyright (C) 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
|
2002-11-30 14:09:12 +00:00
|
|
|
*
|
2003-02-06 19:08:33 +00:00
|
|
|
* 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.
|
2002-11-30 14:09:12 +00:00
|
|
|
*
|
2003-02-06 19:08:33 +00:00
|
|
|
* 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.
|
2002-11-30 14:09:12 +00:00
|
|
|
*
|
2003-02-06 19:08:33 +00:00
|
|
|
* 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
|
2002-11-30 14:09:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef __pgm_h__
|
|
|
|
#define __pgm_h__
|
|
|
|
|
2002-12-01 04:30:01 +00:00
|
|
|
#include <limits.h>
|
|
|
|
|
2002-11-30 14:09:12 +00:00
|
|
|
#include "avrpart.h"
|
|
|
|
#include "lists.h"
|
|
|
|
#include "pindefs.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define ON 1
|
|
|
|
#define OFF 0
|
|
|
|
|
|
|
|
#define PGM_DESCLEN 80
|
2002-12-01 04:30:01 +00:00
|
|
|
#define PGM_PORTLEN PATH_MAX
|
2002-11-30 14:09:12 +00:00
|
|
|
#define PGM_TYPELEN 32
|
|
|
|
typedef struct programmer_t {
|
|
|
|
LISTID id;
|
|
|
|
char desc[PGM_DESCLEN];
|
|
|
|
char type[PGM_TYPELEN];
|
2002-12-01 04:30:01 +00:00
|
|
|
char port[PGM_PORTLEN];
|
2002-11-30 14:09:12 +00:00
|
|
|
unsigned int pinno[N_PINS];
|
|
|
|
int ppidata;
|
|
|
|
int fd;
|
2002-12-01 15:05:56 +00:00
|
|
|
int page_size; /* page size if the programmer supports paged write/load */
|
2002-11-30 14:09:12 +00:00
|
|
|
int (*rdy_led) (struct programmer_t * pgm, int value);
|
|
|
|
int (*err_led) (struct programmer_t * pgm, int value);
|
|
|
|
int (*pgm_led) (struct programmer_t * pgm, int value);
|
|
|
|
int (*vfy_led) (struct programmer_t * pgm, int value);
|
|
|
|
int (*initialize) (struct programmer_t * pgm, AVRPART * p);
|
|
|
|
void (*display) (struct programmer_t * pgm, char * p);
|
|
|
|
int (*save) (struct programmer_t * pgm);
|
|
|
|
void (*restore) (struct programmer_t * pgm);
|
|
|
|
void (*enable) (struct programmer_t * pgm);
|
|
|
|
void (*disable) (struct programmer_t * pgm);
|
|
|
|
void (*powerup) (struct programmer_t * pgm);
|
|
|
|
void (*powerdown) (struct programmer_t * pgm);
|
|
|
|
int (*program_enable) (struct programmer_t * pgm, AVRPART * p);
|
|
|
|
int (*chip_erase) (struct programmer_t * pgm, AVRPART * p);
|
|
|
|
int (*cmd) (struct programmer_t * pgm, unsigned char cmd[4],
|
|
|
|
unsigned char res[4]);
|
|
|
|
void (*open) (struct programmer_t * pgm, char * port);
|
|
|
|
void (*close) (struct programmer_t * pgm);
|
2002-12-01 06:35:18 +00:00
|
|
|
int (*paged_write) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
2002-12-01 15:05:56 +00:00
|
|
|
int page_size, int n_bytes);
|
2002-12-01 06:35:18 +00:00
|
|
|
int (*paged_load) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
2002-12-01 15:05:56 +00:00
|
|
|
int page_size, int n_bytes);
|
2003-03-24 07:09:16 +00:00
|
|
|
void (*write_setup) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
2003-03-23 23:22:50 +00:00
|
|
|
int (*write_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
|
|
|
unsigned long addr, unsigned char value);
|
|
|
|
int (*read_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
|
|
|
unsigned long addr, unsigned char * value);
|
2003-03-17 06:20:02 +00:00
|
|
|
int (*read_sig_bytes) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
2003-02-22 16:45:13 +00:00
|
|
|
char config_file[PATH_MAX]; /* config file where defined */
|
|
|
|
int lineno; /* config file line number */
|
2002-11-30 14:09:12 +00:00
|
|
|
} PROGRAMMER;
|
|
|
|
|
|
|
|
|
|
|
|
PROGRAMMER * pgm_new(void);
|
|
|
|
|
|
|
|
#endif
|