bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
* buspirate.c: Turn the "cmd" argument of the various methods into a "const unsigned char *"; while doing this, declare all arrays being passed as arguments to be pointers rather than arrays, as the latter obfuscates the way arrays are being passed to a callee in C. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1196 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
51da59044e
commit
db1cce8bf4
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
|
||||
* buspirate.c: Turn the "cmd" argument of the various methods into
|
||||
a "const unsigned char *"; while doing this, declare all arrays being
|
||||
passed as arguments to be pointers rather than arrays, as the latter
|
||||
obfuscates the way arrays are being passed to a callee in C.
|
||||
* avrftdi.c: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* avr910.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* bitbang.c: (Dito.)
|
||||
* bitbang.h: (Dito.)
|
||||
* avrftdi_tpi.c: (Dito.)
|
||||
* avrftdi_tpi.h: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* pgm.h: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #38023: avrdude doesn't return an error code when attempting
|
||||
|
|
1
NEWS
1
NEWS
|
@ -84,6 +84,7 @@ Current:
|
|||
- bug #38713: Compilation of the documentation breaks with texinfo-5
|
||||
- bug #38023: avrdude doesn't return an error code when attempting
|
||||
to upload an invalid Intel HEX file
|
||||
- bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
|
||||
|
||||
* Keep track of input file contents
|
||||
|
||||
|
|
4
avr910.c
4
avr910.c
|
@ -299,8 +299,8 @@ static void avr910_enable(PROGRAMMER * pgm)
|
|||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int avr910_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
char buf[5];
|
||||
|
||||
|
|
19
avrftdi.c
19
avrftdi.c
|
@ -171,7 +171,7 @@ void avrftdi_log(int level, const char * func, int line,
|
|||
* number of bytes which are printed on the first line (may be 0). after that
|
||||
* width bytes are printed on each line
|
||||
*/
|
||||
static void buf_dump(unsigned char *buf, int len, char *desc,
|
||||
static void buf_dump(const unsigned char *buf, int len, char *desc,
|
||||
int offset, int width)
|
||||
{
|
||||
int i;
|
||||
|
@ -347,7 +347,7 @@ static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, i
|
|||
}
|
||||
|
||||
|
||||
static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, unsigned char *buf,
|
||||
static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsigned char *buf,
|
||||
unsigned char *data, int buf_size)
|
||||
{
|
||||
size_t blocksize;
|
||||
|
@ -412,7 +412,7 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, unsigned ch
|
|||
* Write is only performed when mode contains MPSSE_DO_WRITE.
|
||||
* Read is only performed when mode contains MPSSE_DO_WRITE and MPSSE_DO_READ.
|
||||
*/
|
||||
static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, unsigned char *buf,
|
||||
static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, const unsigned char *buf,
|
||||
unsigned char *data, int buf_size)
|
||||
{
|
||||
size_t blocksize;
|
||||
|
@ -470,7 +470,7 @@ static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, unsigned
|
|||
return written;
|
||||
}
|
||||
|
||||
static inline int avrftdi_transmit(PROGRAMMER * pgm, unsigned char mode, unsigned char *buf,
|
||||
static inline int avrftdi_transmit(PROGRAMMER * pgm, unsigned char mode, const unsigned char *buf,
|
||||
unsigned char *data, int buf_size)
|
||||
{
|
||||
avrftdi_t* pdata = to_pdata(pgm);
|
||||
|
@ -479,6 +479,8 @@ static inline int avrftdi_transmit(PROGRAMMER * pgm, unsigned char mode, unsigne
|
|||
else
|
||||
return avrftdi_transmit_mpsse(pdata, mode, buf, data, buf_size);
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
/* this function tries to sync up with the FTDI. See FTDI application note AN_129.
|
||||
* AN_135 uses 0xab as bad command and enables/disables loopback around synchronisation.
|
||||
* This may fail if data is left in the buffer (i.e. avrdude aborted with ctrl-c)
|
||||
|
@ -543,6 +545,7 @@ retry:
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
||||
static int write_flush(avrftdi_t* pdata)
|
||||
{
|
||||
|
@ -797,11 +800,11 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
|
|||
E(ftdi_set_bitmode(pdata->ftdic, pdata->pin_direction & 0xff, BITMODE_MPSSE) < 0, pdata->ftdic);
|
||||
E(ftdi_usb_purge_buffers(pdata->ftdic), pdata->ftdic);
|
||||
|
||||
/*
|
||||
#ifdef notyet
|
||||
ret = ftdi_sync(pdata);
|
||||
if(ret < 0)
|
||||
return ret;
|
||||
*/
|
||||
#endif
|
||||
write_flush(pdata);
|
||||
|
||||
if (pgm->baudrate) {
|
||||
|
@ -922,10 +925,8 @@ static void avrftdi_display(PROGRAMMER * pgm, const char *p)
|
|||
}
|
||||
|
||||
|
||||
static int avrftdi_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res[4])
|
||||
static int avrftdi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res)
|
||||
{
|
||||
/* Do not use 'sizeof(cmd)'. => message from cppcheck:
|
||||
Using sizeof for array given as function argument returns the size of pointer. */
|
||||
return avrftdi_transmit(pgm, MPSSE_DO_READ | MPSSE_DO_WRITE, cmd, res, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
static void avrftdi_tpi_disable(PROGRAMMER *);
|
||||
static int avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
#ifdef notyet
|
||||
static void
|
||||
avrftdi_debug_frame(uint16_t frame)
|
||||
{
|
||||
|
@ -61,6 +62,7 @@ avrftdi_debug_frame(uint16_t frame)
|
|||
log_debug("%s\n", line1);
|
||||
//log_debug("%s\n", line2);
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
||||
int
|
||||
avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
@ -129,6 +131,7 @@ tpi_frame2byte(uint16_t frame, uint8_t * byte)
|
|||
return parity != parity_rcvd;
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
static int
|
||||
avrftdi_tpi_break(PROGRAMMER * pgm)
|
||||
{
|
||||
|
@ -137,6 +140,7 @@ avrftdi_tpi_break(PROGRAMMER * pgm)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
||||
static int
|
||||
avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte)
|
||||
|
@ -217,8 +221,8 @@ avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
|||
}
|
||||
|
||||
int
|
||||
avrftdi_cmd_tpi(PROGRAMMER * pgm, unsigned char cmd[], int cmd_len,
|
||||
unsigned char res[], int res_len)
|
||||
avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len,
|
||||
unsigned char *res, int res_len)
|
||||
{
|
||||
int i, err = 0;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
//int avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte);
|
||||
//int avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte);
|
||||
int avrftdi_cmd_tpi(PROGRAMMER * pgm, unsigned char cmd[], int cmd_len,
|
||||
unsigned char res[], int res_len);
|
||||
int avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len,
|
||||
unsigned char *res, int res_len);
|
||||
int avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
|
||||
|
|
12
bitbang.c
12
bitbang.c
|
@ -330,8 +330,8 @@ int bitbang_vfy_led(PROGRAMMER * pgm, int value)
|
|||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
int bitbang_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
int bitbang_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -355,8 +355,8 @@ int bitbang_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bitbang_cmd_tpi(PROGRAMMER * pgm, unsigned char cmd[],
|
||||
int cmd_len, unsigned char res[], int res_len)
|
||||
int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
int cmd_len, unsigned char *res, int res_len)
|
||||
{
|
||||
int i, r;
|
||||
|
||||
|
@ -397,8 +397,8 @@ int bitbang_cmd_tpi(PROGRAMMER * pgm, unsigned char cmd[],
|
|||
* transmit bytes via SPI and return the results; 'cmd' and
|
||||
* 'res' must point to data buffers
|
||||
*/
|
||||
int bitbang_spi(PROGRAMMER * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int count)
|
||||
int bitbang_spi(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
12
bitbang.h
12
bitbang.h
|
@ -37,12 +37,12 @@ int bitbang_rdy_led (PROGRAMMER * pgm, int value);
|
|||
int bitbang_err_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_pgm_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_vfy_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_cmd (PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4]);
|
||||
int bitbang_cmd_tpi (PROGRAMMER * pgm, unsigned char cmd[],
|
||||
int cmd_len, unsigned char res[], int res_len);
|
||||
int bitbang_spi (PROGRAMMER * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int count);
|
||||
int bitbang_cmd (PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
int bitbang_cmd_tpi (PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
int cmd_len, unsigned char *res, int res_len);
|
||||
int bitbang_spi (PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res, int count);
|
||||
int bitbang_chip_erase (PROGRAMMER * pgm, AVRPART * p);
|
||||
int bitbang_program_enable (PROGRAMMER * pgm, AVRPART * p);
|
||||
void bitbang_powerup (PROGRAMMER * pgm);
|
||||
|
|
12
buspirate.c
12
buspirate.c
|
@ -790,8 +790,8 @@ static void buspirate_powerdown(struct programmer_t *pgm)
|
|||
}
|
||||
|
||||
static int buspirate_cmd_bin(struct programmer_t *pgm,
|
||||
unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
/* 0001xxxx - Bulk transfer, send/read 1-16 bytes (0=1byte!)
|
||||
* we are sending 4 bytes -> 0x13 */
|
||||
|
@ -805,8 +805,8 @@ static int buspirate_cmd_bin(struct programmer_t *pgm,
|
|||
}
|
||||
|
||||
static int buspirate_cmd_ascii(struct programmer_t *pgm,
|
||||
unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
char buf[25];
|
||||
char *rcvd;
|
||||
|
@ -838,8 +838,8 @@ static int buspirate_cmd_ascii(struct programmer_t *pgm,
|
|||
}
|
||||
|
||||
static int buspirate_cmd(struct programmer_t *pgm,
|
||||
unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
if (pgm->flag & BP_FLAG_IN_BINMODE)
|
||||
return buspirate_cmd_bin(pgm, cmd, res);
|
||||
|
|
8
ft245r.c
8
ft245r.c
|
@ -367,8 +367,8 @@ static void ft245r_enable(PROGRAMMER * pgm) {
|
|||
set_buff(pgm, ON);
|
||||
}
|
||||
|
||||
static int ft245r_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4]);
|
||||
static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
/*
|
||||
* issue the 'program enable' command to the AVR device
|
||||
*/
|
||||
|
@ -491,8 +491,8 @@ static inline unsigned char extract_data_out(PROGRAMMER * pgm, unsigned char *bu
|
|||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
static int ft245r_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4]) {
|
||||
static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res) {
|
||||
int i,buf_pos;
|
||||
unsigned char buf[128];
|
||||
|
||||
|
|
10
pgm.h
10
pgm.h
|
@ -95,12 +95,12 @@ typedef struct programmer_t {
|
|||
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]);
|
||||
int (*cmd_tpi) (struct programmer_t * pgm, unsigned char cmd[],
|
||||
int (*cmd) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
int (*cmd_tpi) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
int cmd_len, unsigned char res[], int res_len);
|
||||
int (*spi) (struct programmer_t * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int count);
|
||||
int (*spi) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
unsigned char *res, int count);
|
||||
int (*open) (struct programmer_t * pgm, char * port);
|
||||
void (*close) (struct programmer_t * pgm);
|
||||
int (*paged_write) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
|
|
@ -741,15 +741,15 @@ static int pickit2_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
}
|
||||
|
||||
|
||||
static int pickit2_cmd(struct programmer_t * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int pickit2_cmd(struct programmer_t * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
return pgm->spi(pgm, cmd, res, 4);
|
||||
}
|
||||
|
||||
// breaks up the cmd[] data into packets & sends to the pickit2. Data shifted in is stored in res[].
|
||||
static int pickit2_spi(struct programmer_t * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int n_bytes)
|
||||
static int pickit2_spi(struct programmer_t * pgm, const unsigned char *cmd,
|
||||
unsigned char *res, int n_bytes)
|
||||
{
|
||||
int retval = 0, temp1 = 0, temp2 = 0, count = n_bytes;
|
||||
|
||||
|
|
4
stk500.c
4
stk500.c
|
@ -124,8 +124,8 @@ int stk500_getsync(PROGRAMMER * pgm)
|
|||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
static int stk500_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int stk500_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
|
||||
|
|
16
stk500v2.c
16
stk500v2.c
|
@ -529,7 +529,7 @@ int stk500v2_drain(PROGRAMMER * pgm, int display)
|
|||
return serial_drain(&pgm->fd, display);
|
||||
}
|
||||
|
||||
static int stk500v2_recv_mk2(PROGRAMMER * pgm, unsigned char msg[],
|
||||
static int stk500v2_recv_mk2(PROGRAMMER * pgm, unsigned char *msg,
|
||||
size_t maxsize)
|
||||
{
|
||||
int rv;
|
||||
|
@ -543,7 +543,7 @@ static int stk500v2_recv_mk2(PROGRAMMER * pgm, unsigned char msg[],
|
|||
return rv;
|
||||
}
|
||||
|
||||
static int stk500v2_jtagmkII_recv(PROGRAMMER * pgm, unsigned char msg[],
|
||||
static int stk500v2_jtagmkII_recv(PROGRAMMER * pgm, unsigned char *msg,
|
||||
size_t maxsize)
|
||||
{
|
||||
int rv;
|
||||
|
@ -585,7 +585,7 @@ static int stk500v2_jtagmkII_recv(PROGRAMMER * pgm, unsigned char msg[],
|
|||
return rv;
|
||||
}
|
||||
|
||||
static int stk500v2_jtag3_recv(PROGRAMMER * pgm, unsigned char msg[],
|
||||
static int stk500v2_jtag3_recv(PROGRAMMER * pgm, unsigned char *msg,
|
||||
size_t maxsize)
|
||||
{
|
||||
int rv;
|
||||
|
@ -619,7 +619,7 @@ static int stk500v2_jtag3_recv(PROGRAMMER * pgm, unsigned char msg[],
|
|||
return rv;
|
||||
}
|
||||
|
||||
static int stk500v2_recv(PROGRAMMER * pgm, unsigned char msg[], size_t maxsize) {
|
||||
static int stk500v2_recv(PROGRAMMER * pgm, unsigned char *msg, size_t maxsize) {
|
||||
enum states { sINIT, sSTART, sSEQNUM, sSIZE1, sSIZE2, sTOKEN, sDATA, sCSUM, sDONE } state = sSTART;
|
||||
unsigned int msglen = 0;
|
||||
unsigned int curlen = 0;
|
||||
|
@ -933,8 +933,8 @@ retry:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int stk500v2_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int stk500v2_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
unsigned char buf[8];
|
||||
int result;
|
||||
|
@ -970,8 +970,8 @@ static int stk500v2_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
|||
}
|
||||
|
||||
|
||||
static int stk500v2_jtag3_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int stk500v2_jtag3_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: stk500v2_jtag3_cmd(): Not available in JTAGICE3\n",
|
||||
|
|
19
usbasp.c
19
usbasp.c
|
@ -131,7 +131,9 @@ struct pdata
|
|||
static void usbasp_setup(PROGRAMMER * pgm);
|
||||
static void usbasp_teardown(PROGRAMMER * pgm);
|
||||
// internal functions
|
||||
static int usbasp_transmit(PROGRAMMER * pgm, unsigned char receive, unsigned char functionid, unsigned char send[4], unsigned char * buffer, int buffersize);
|
||||
static int usbasp_transmit(PROGRAMMER * pgm, unsigned char receive,
|
||||
unsigned char functionid, const unsigned char *send,
|
||||
unsigned char *buffer, int buffersize);
|
||||
#ifdef USE_LIBUSB_1_0
|
||||
static int usbOpenDevice(libusb_device_handle **device, int vendor, char *vendorName, int product, char *productName);
|
||||
#else
|
||||
|
@ -147,7 +149,7 @@ static void usbasp_display(PROGRAMMER * pgm, const char * p);
|
|||
// universal functions
|
||||
static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p);
|
||||
// SPI specific functions
|
||||
static int usbasp_spi_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res[4]);
|
||||
static int usbasp_spi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res);
|
||||
static int usbasp_spi_program_enable(PROGRAMMER * pgm, AVRPART * p);
|
||||
static int usbasp_spi_chip_erase(PROGRAMMER * pgm, AVRPART * p);
|
||||
static int usbasp_spi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
@ -159,7 +161,7 @@ static int usbasp_spi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
static int usbasp_spi_set_sck_period(PROGRAMMER *pgm, double sckperiod);
|
||||
// TPI specific functions
|
||||
static void usbasp_tpi_send_byte(PROGRAMMER * pgm, uint8_t b);
|
||||
static int usbasp_tpi_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res[4]);
|
||||
static int usbasp_tpi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res);
|
||||
static int usbasp_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p);
|
||||
static int usbasp_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p);
|
||||
static int usbasp_tpi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
@ -221,7 +223,8 @@ static const char *usbasp_get_funcname(unsigned char functionid)
|
|||
*/
|
||||
static int usbasp_transmit(PROGRAMMER * pgm,
|
||||
unsigned char receive, unsigned char functionid,
|
||||
unsigned char send[4], unsigned char * buffer, int buffersize)
|
||||
const unsigned char *send,
|
||||
unsigned char *buffer, int buffersize)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
|
@ -630,16 +633,14 @@ static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|||
}
|
||||
|
||||
/* SPI specific functions */
|
||||
static int usbasp_spi_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int usbasp_spi_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
if (verbose > 2)
|
||||
fprintf(stderr, "%s: usbasp_cpi_cmd(0x%02x, 0x%02x, 0x%02x, 0x%02x)%s",
|
||||
progname, cmd[0], cmd[1], cmd[2], cmd[3],
|
||||
verbose > 3? "...\n": "");
|
||||
|
||||
/* Do not use 'sizeof(res)'. => message from cppcheck:
|
||||
Using sizeof for array given as function argument returns the size of pointer. */
|
||||
int nbytes =
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_TRANSMIT, cmd, res, 4);
|
||||
|
||||
|
@ -995,7 +996,7 @@ static int usbasp_tpi_nvm_waitbusy(PROGRAMMER * pgm)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int usbasp_tpi_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res[4])
|
||||
static int usbasp_tpi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res)
|
||||
{
|
||||
fprintf(stderr, "%s: error: spi_cmd used in TPI mode: not allowed\n", progname);
|
||||
return -1;
|
||||
|
|
|
@ -180,7 +180,7 @@ static int usb_out (PROGRAMMER * pgm,
|
|||
// to get the information from AvrDude and send to the USBtiny
|
||||
static int usbtiny_avr_op (PROGRAMMER * pgm, AVRPART * p,
|
||||
int op,
|
||||
unsigned char res[4])
|
||||
unsigned char *res)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
|
||||
|
@ -383,7 +383,7 @@ static void usbtiny_powerdown(PROGRAMMER * pgm)
|
|||
|
||||
/* Send a 4-byte SPI command to the USBtinyISP for execution
|
||||
This procedure is used by higher-level Avrdude procedures */
|
||||
static int usbtiny_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res[4])
|
||||
static int usbtiny_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
|
|
Loading…
Reference in New Issue