You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(37) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Øyvind H. <go...@us...> - 2010-06-17 12:17:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 80eb7e2a789939263662cf37e564d0afcdb0e188 (commit) from b89462d7dc5f5ba7a025f891474a7506a5cd1294 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 80eb7e2a789939263662cf37e564d0afcdb0e188 Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Jun 17 09:04:46 2010 +0200 zy1000: fix arm11 optimisation copy & paste error + added FIFO throttling to work around lockup bug in FPGA. The arm11 optimisation was introduced post v0.4.0, so this is not a regression compared to previous release. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index b50e96a..013d865 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -878,101 +878,100 @@ void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, uint8_t *buffer, int arm11_run_instr_data_to_core_noack_inner(struct jtag_tap * tap, uint32_t opcode, uint32_t * data, size_t count) { -#if 0 - int arm11_run_instr_data_to_core_noack_inner_default(struct jtag_tap * tap, uint32_t opcode, uint32_t * data, size_t count); - return arm11_run_instr_data_to_core_noack_inner_default(tap, opcode, data, count); -#else - static const int bits[] = {32, 2}; - uint32_t values[] = {0, 0}; - - /* FIX!!!!!! the target_write_memory() API started this nasty problem - * with unaligned uint32_t * pointers... */ - const uint8_t *t = (const uint8_t *)data; - - /* bypass bits before and after */ int pre_bits; int post_bits; jtag_pre_post_bits(tap, &pre_bits, &post_bits); - - bool found = false; - struct jtag_tap *cur_tap, *nextTap; - for (cur_tap = jtag_tap_next_enabled(NULL); cur_tap!= NULL; cur_tap = nextTap) - { - nextTap = jtag_tap_next_enabled(cur_tap); - if (cur_tap == tap) - { - found = true; - } else - { - if (found) - { - post_bits++; - } else - { - pre_bits++; - } - } - } - post_bits+=2; - - while (--count > 0) + if ((pre_bits > 32) || (post_bits > 32)) { - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, pre_bits, 0); - - uint32_t value; - value = *t++; - value |= (*t++<<8); - value |= (*t++<<16); - value |= (*t++<<24); + int arm11_run_instr_data_to_core_noack_inner_default(struct jtag_tap * tap, uint32_t opcode, uint32_t * data, size_t count); + return arm11_run_instr_data_to_core_noack_inner_default(tap, opcode, data, count); + } else + { + static const int bits[] = {32, 2}; + uint32_t values[] = {0, 0}; - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, value); - /* minimum 2 bits */ - shiftValueInner(TAP_DRSHIFT, TAP_DRPAUSE, post_bits, 0); + /* FIX!!!!!! the target_write_memory() API started this nasty problem + * with unaligned uint32_t * pointers... */ + const uint8_t *t = (const uint8_t *)data; + while (--count > 0) + { #if 1 - /* copy & paste from arm11_dbgtap.c */ - //TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT + /* Danger! This code doesn't update cmd_queue_cur_state, so + * invoking jtag_add_pathmove() before jtag_add_dr_out() after + * this loop would fail! + */ + shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, pre_bits, 0); - waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); - /* we don't have to wait for the queue to empty here. waitIdle(); */ - ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, TAP_DRSHIFT); + uint32_t value; + value = *t++; + value |= (*t++<<8); + value |= (*t++<<16); + value |= (*t++<<24); + + shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, value); + /* minimum 2 bits */ + shiftValueInner(TAP_DRSHIFT, TAP_DRPAUSE, post_bits, 0); + + /* copy & paste from arm11_dbgtap.c */ + //TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT + /* KLUDGE! we have to flush the fifo or the Nios CPU locks up. + * This is probably a bug in the Avalon bus(cross clocking bridge?) + * or in the jtag registers module. + */ + waitIdle(); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 1); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); + /* we don't have to wait for the queue to empty here */ + ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, TAP_DRSHIFT); + waitIdle(); #else - static const tap_state_t arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay[] = - { - TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT - }; - - jtag_add_pathmove(ARRAY_SIZE(arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay), - arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay); + static const tap_state_t arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay[] = + { + TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT + }; + + values[0] = *t++; + values[0] |= (*t++<<8); + values[0] |= (*t++<<16); + values[0] |= (*t++<<24); + + jtag_add_dr_out(tap, + 2, + bits, + values, + TAP_IDLE); + + jtag_add_pathmove(ARRAY_SIZE(arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay), + arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay); #endif - } + } - values[0] = *t++; - values[0] |= (*t++<<8); - values[0] |= (*t++<<16); - values[0] |= (*t++<<24); + values[0] = *t++; + values[0] |= (*t++<<8); + values[0] |= (*t++<<16); + values[0] |= (*t++<<24); - /* This will happen on the last iteration updating the current tap state - * so we don't have to track it during the common code path */ - jtag_add_dr_out(tap, - 2, - bits, - values, - TAP_IDLE); + /* This will happen on the last iteration updating cmd_queue_cur_state + * so we don't have to track it during the common code path + */ + jtag_add_dr_out(tap, + 2, + bits, + values, + TAP_IDLE); - return jtag_execute_queue(); -#endif + return jtag_execute_queue(); + } } ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/zy1000.c | 157 +++++++++++++++++++++++----------------------- 1 files changed, 78 insertions(+), 79 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-17 07:24:51
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b89462d7dc5f5ba7a025f891474a7506a5cd1294 (commit) via 984bf158213b7cc040975c52aada4830d8d98e79 (commit) from 814c2a8f9a41a6445f131ee35474dced4bbed210 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b89462d7dc5f5ba7a025f891474a7506a5cd1294 Author: Antonio Borneo <bor...@gm...> Date: Mon Jun 14 12:31:13 2010 +0800 helper: remove helper membuf Helper is now unused. Can be removed. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/helper/Makefile.am b/src/helper/Makefile.am index 3ec4f31..27ae1e2 100644 --- a/src/helper/Makefile.am +++ b/src/helper/Makefile.am @@ -22,8 +22,7 @@ libhelper_la_SOURCES = \ command.c \ time_support.c \ replacements.c \ - fileio.c \ - membuf.c + fileio.c if IOUTIL libhelper_la_SOURCES += ioutil.c @@ -44,7 +43,6 @@ noinst_HEADERS = \ types.h \ log.h \ command.h \ - membuf.h \ time_support.h \ replacements.h \ fileio.h \ diff --git a/src/helper/membuf.c b/src/helper/membuf.c deleted file mode 100644 index 766364a..0000000 --- a/src/helper/membuf.c +++ /dev/null @@ -1,240 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 By Duane Ellis * - * op...@du... * - * * - * 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. * - ***************************************************************************/ - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "membuf.h" - -struct membuf { - // buflen is alway "+1" bigger then - // what is shown here, the +1 is for - // the NULL string terminator -#define DEFAULT_BUFSIZE 100 - size_t maxlen; // allocated size - size_t curlen; // where we are inserting at - char *_strtoklast; - void *buf; -}; - - -#define space_avail(pBuf) (pBuf->maxlen - pBuf->curlen) -#define dataend(pBuf) (((char *)(pBuf->buf)) + pBuf->curlen) - -size_t -membuf_len(struct membuf *pBuf) -{ - return pBuf->curlen; -} - -const void * -membuf_datapointer(struct membuf *pBuf) -{ - return ((void *)(pBuf->buf)); -} - -const char * -membuf_strtok(struct membuf *pBuf, const char *sep, void **pLast) -{ - if (pBuf) { - pBuf->_strtoklast = NULL; - *pLast = pBuf; - // this should be "strtok_r()" but windows lacks */ - return strtok(((char *)(pBuf->buf)), sep); - } else { - // recover our pBuf - pBuf = *((struct membuf **)(pLast)); - // this should be "strtok_r()" but windows lacks */ - return strtok( NULL, sep); - } -} - - - -struct membuf * -membuf_new(void) -{ - // by default - parameters are zero. - struct membuf *pBuf; - - pBuf = calloc(1, sizeof(*pBuf)); - if (pBuf) { - // we *ALWAYS* allocate +1 for null terminator. - pBuf->buf = calloc(DEFAULT_BUFSIZE + 1, sizeof(char)); - if (pBuf->buf == NULL) { - free(pBuf); - pBuf = NULL; - } else { - pBuf->maxlen = DEFAULT_BUFSIZE; - } - } - return pBuf; -} - - -struct membuf * -membuf_grow(struct membuf *pBuf, int n) -{ - void *vp; - signed int newsize; - - // this is a *SIGNED* value - newsize = ((int)(pBuf->maxlen)) + n; - - // do not go negative, or too small - if (newsize < DEFAULT_BUFSIZE) { - newsize = DEFAULT_BUFSIZE; - } - - // always alloc +1 for the null terminator - vp = realloc(pBuf->buf, newsize + 1); - if (vp) { - pBuf->buf = vp; - pBuf->maxlen = newsize; - return pBuf; - } else { - return NULL; - } -} - - -void membuf_reset(struct membuf *pBuf) -{ - pBuf->curlen = 0; -} - - -void membuf_delete(struct membuf *pBuf) -{ - if (pBuf) { - if (pBuf->buf) { - // wack data so it cannot be reused - memset(pBuf->buf,0,pBuf->maxlen); - free(pBuf->buf); - } - // wack dat so it cannot be reused - memset(pBuf,0,sizeof(pBuf)); - free(pBuf); - } -} - -int -membuf_sprintf(struct membuf *pBuf , const char *fmt, ...) -{ - int r; - va_list ap; - va_start(ap, fmt); - r = membuf_vsprintf(pBuf, fmt, ap); - va_end(ap); - return r; -} - -int -membuf_vsprintf(struct membuf *pBuf, const char *fmt, va_list ap) -{ - int r; - size_t sa; - int grew; - - - grew = 0; - for (;;) { - sa = space_avail(pBuf); - - // do work - r = vsnprintf(dataend(pBuf), - sa, - fmt, - ap); - if ((r > 0) && (((size_t)(r)) < sa)) { - // Success! - pBuf->curlen += ((size_t)(r)); - // remember: We always alloc'ed +1 - // so this does not overflow - ((char *)(pBuf->buf))[ pBuf->curlen ] = 0; - r = 0; - break; - } - - // failure - if (r < 0) { - // Option(A) format error - // Option(B) glibc2.0 bug - // assume (B). - r = (4 * DEFAULT_BUFSIZE); - } - - // don't do this again - if (grew) { - r = -1; - break; - } - grew = 1; - pBuf = membuf_grow(pBuf, r); - if (pBuf == NULL) { - // grow failed - r = -1; - break; - } - } - return r; -} - -struct membuf * -membuf_strcat(struct membuf *pBuf, const char *pStr) -{ - return membuf_append(pBuf, pStr, strlen(pStr)); -} - -struct membuf * -membuf_append(struct membuf *pBuf, const void *pData, size_t len) -{ - size_t sa; - int r; - - // how much room is there? - sa = space_avail(pBuf); - - // will it fit? - if (sa < len) { - // if not, how much do we need? - r = ((int)(sa - len)); - // do the grow. - pBuf = membuf_grow(pBuf, r); - // failed? - if (pBuf == NULL) { - return pBuf; - } - } - // append - memcpy(dataend(pBuf), - pData, - len); - pBuf->curlen += len; - return pBuf; -} - - - - - - diff --git a/src/helper/membuf.h b/src/helper/membuf.h deleted file mode 100644 index fa96998..0000000 --- a/src/helper/membuf.h +++ /dev/null @@ -1,137 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 By Duane Ellis * - * op...@du... * - * * - * 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. * - ***************************************************************************/ -#ifndef HELPER_MEMBUF_H -#define HELPER_MEMBUF_H - -/** @file - * MEMBUF - an auto-growing string buffer - * - * With OpenOCD often, one must write code that sends text to - * different places.. the historical command_ctx, or JIM output, - * and/or other places. - * - * This is a simple 'string buffer' that auto-grows. - * - * More correctly put, this is a "memory buffer" - * it may contain binary data - * - * Note: Internally the buffer always has a 'null terminator' - */ - -/* contents of this structure are 'opaque' */ -struct membuf; - - -/** Create a new membuf - * By default the memory buffer has "some non-zero-size" - * (couple hundred bytes, exact amount is opaque) - */ -struct membuf *membuf_new(void); - -/** delete (destroy) the mem buffer - * @param pBuf - buffer to release - */ -void membuf_delete(struct membuf *pBuf); - - -/** grow/shrink a membuf by specified amount. - * @param pBuf - the buffer - * @param amount - the amount to grow or shrink by. - * - * Symantics of 'realloc()' return NULL on failure - */ -struct membuf *membuf_grow(struct membuf *pBuf, int amount); - -/** how long is this buffer (memlen(), strlen()) - * @param pBuf - the buffer - * - * @returns: length of current buffer. - */ -size_t membuf_len(struct membuf *pBuf); - - -/** reset an membuf to zero length. - * @param pBuf - buffer to reset - * - * Note this does not 'release' the memory buffer - */ -void membuf_reset(struct membuf *pBuf); - - -/** sprintf() to the string buffer - * @param pBuf - buffer to capture sprintf() data into - * @param fmt - printf format - * - * Returns 0 on success - * Returns non-zero on failure - */ -int membuf_sprintf(struct membuf *pBuf , const char *fmt, ...); - -/** vsprintf() to the string buffer - * @param pBuf - buffer to capture sprintf() data into - * @param fmt - printf format - * @param ap - va_list for fmt - * - * Returns 0 on success - * Returns non-zero on failure - */ -int membuf_vsprintf(struct membuf *pBuf , const char *fmt, va_list ap); - -/** Tokenize lines using strtok() - * @param pBuf - buffer to tokenize - * @param delim - delimiter parameter for strtok_r() - * @param pSave - pointer to string context for tokenization - * - * Identical to "strtok()" - pass "pBuff = NULL" on second call - * - * NOTE: This call is <b > destructive</b> to the buffer. - */ -const char *membuf_strtok(struct membuf *pBuf, const char *delim, void **pSave); - -/** Return pointer to the memory in the buffer - * @param pBuf - buffer - * - * NOTE: Thou shall not modify this pointer, it is <b > CONST</b> - */ -const void *membuf_datapointer(struct membuf *pBuf); - - -/** Append data to the buffer - * @param pBuf - buffer to append - * @param pData - pointer to data to append - * @param len - length of data to append - * - * Modified symantics of "memcpy()". On memory allocation failure - * returns NULL. On success, returns pointer to orginal membuf. - */ -struct membuf *membuf_append(struct membuf *pBuf, const void *pData, size_t len); - - -/** Append string to the buffer - * @param pBuf - buffer to append - * @param str - string to append - * - * Modified symantics of "strcat()". On memory allocation failure - * returns NULL. On success, returns pointer to orginal membuf. - */ -struct membuf *membuf_strcat(struct membuf *pBuf, const char *str); - - -#endif commit 984bf158213b7cc040975c52aada4830d8d98e79 Author: Antonio Borneo <bor...@gm...> Date: Mon Jun 14 12:22:10 2010 +0800 nor/at91sam3: replace helper membuf Helper ./src/helper/membuf.c is only used in at91sam3.c 1) Replace membuf with LOG_* 2) The original code in sam3_GetDetails() invalidates all the buffered output of sam3_GetInfo(). The new code skips sam3_GetInfo() if its output should not be printed. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/at91sam3.c b/src/flash/nor/at91sam3.c index 06b84cd..8fa6dd4 100644 --- a/src/flash/nor/at91sam3.c +++ b/src/flash/nor/at91sam3.c @@ -59,7 +59,6 @@ #include "imp.h" #include "at91sam3.h" -#include <helper/membuf.h> #include <helper/time_support.h> #define REG_NAME_WIDTH (12) @@ -211,8 +210,6 @@ struct sam3_chip { struct sam3_chip_details details; struct target *target; struct sam3_cfg cfg; - - struct membuf *mbuf; }; @@ -1000,20 +997,6 @@ FLASHD_Lock(struct sam3_bank_private *pPrivate, /****** END SAM3 CODE ********/ /* begin helpful debug code */ - -static void -sam3_sprintf(struct sam3_chip *pChip , const char *fmt, ...) -{ - va_list ap; - va_start(ap,fmt); - if (pChip->mbuf == NULL) { - return; - } - - membuf_vsprintf(pChip->mbuf, fmt, ap); - va_end(ap); -} - // print the fieldname, the field value, in dec & hex, and return field value static uint32_t sam3_reg_fieldname(struct sam3_chip *pChip, @@ -1038,7 +1021,7 @@ sam3_reg_fieldname(struct sam3_chip *pChip, } // show the basics - sam3_sprintf(pChip, "\t%*s: %*d [0x%0*x] ", + LOG_USER_N("\t%*s: %*d [0x%0*x] ", REG_NAME_WIDTH, regname, dwidth, v, hwidth, v); @@ -1173,16 +1156,16 @@ sam3_explain_ckgr_mor(struct sam3_chip *pChip) uint32_t rcen; v = sam3_reg_fieldname(pChip, "MOSCXTEN", pChip->cfg.CKGR_MOR, 0, 1); - sam3_sprintf(pChip, "(main xtal enabled: %s)\n", + LOG_USER_N("(main xtal enabled: %s)\n", _yes_or_no(v)); v = sam3_reg_fieldname(pChip, "MOSCXTBY", pChip->cfg.CKGR_MOR, 1, 1); - sam3_sprintf(pChip, "(main osc bypass: %s)\n", + LOG_USER_N("(main osc bypass: %s)\n", _yes_or_no(v)); rcen = sam3_reg_fieldname(pChip, "MOSCRCEN", pChip->cfg.CKGR_MOR, 2, 1); - sam3_sprintf(pChip, "(onchip RC-OSC enabled: %s)\n", + LOG_USER_N("(onchip RC-OSC enabled: %s)\n", _yes_or_no(rcen)); v = sam3_reg_fieldname(pChip, "MOSCRCF", pChip->cfg.CKGR_MOR, 4, 3); - sam3_sprintf(pChip, "(onchip RC-OSC freq: %s)\n", + LOG_USER_N("(onchip RC-OSC freq: %s)\n", _rc_freq[v]); pChip->cfg.rc_freq = 0; @@ -1203,14 +1186,14 @@ sam3_explain_ckgr_mor(struct sam3_chip *pChip) } v = sam3_reg_fieldname(pChip,"MOSCXTST", pChip->cfg.CKGR_MOR, 8, 8); - sam3_sprintf(pChip, "(startup clks, time= %f uSecs)\n", + LOG_USER_N("(startup clks, time= %f uSecs)\n", ((float)(v * 1000000)) / ((float)(pChip->cfg.slow_freq))); v = sam3_reg_fieldname(pChip, "MOSCSEL", pChip->cfg.CKGR_MOR, 24, 1); - sam3_sprintf(pChip, "(mainosc source: %s)\n", + LOG_USER_N("(mainosc source: %s)\n", v ? "external xtal" : "internal RC"); v = sam3_reg_fieldname(pChip,"CFDEN", pChip->cfg.CKGR_MOR, 25, 1); - sam3_sprintf(pChip, "(clock failure enabled: %s)\n", + LOG_USER_N("(clock failure enabled: %s)\n", _yes_or_no(v)); } @@ -1224,19 +1207,19 @@ sam3_explain_chipid_cidr(struct sam3_chip *pChip) const char *cp; sam3_reg_fieldname(pChip, "Version", pChip->cfg.CHIPID_CIDR, 0, 5); - sam3_sprintf(pChip,"\n"); + LOG_USER_N("\n"); v = sam3_reg_fieldname(pChip, "EPROC", pChip->cfg.CHIPID_CIDR, 5, 3); - sam3_sprintf(pChip, "%s\n", eproc_names[v]); + LOG_USER_N("%s\n", eproc_names[v]); v = sam3_reg_fieldname(pChip, "NVPSIZE", pChip->cfg.CHIPID_CIDR, 8, 4); - sam3_sprintf(pChip, "%s\n", nvpsize[v]); + LOG_USER_N("%s\n", nvpsize[v]); v = sam3_reg_fieldname(pChip, "NVPSIZE2", pChip->cfg.CHIPID_CIDR, 12, 4); - sam3_sprintf(pChip, "%s\n", nvpsize2[v]); + LOG_USER_N("%s\n", nvpsize2[v]); v = sam3_reg_fieldname(pChip, "SRAMSIZE", pChip->cfg.CHIPID_CIDR, 16,4); - sam3_sprintf(pChip, "%s\n", sramsize[ v ]); + LOG_USER_N("%s\n", sramsize[ v ]); v = sam3_reg_fieldname(pChip, "ARCH", pChip->cfg.CHIPID_CIDR, 20, 8); cp = _unknown; @@ -1247,13 +1230,13 @@ sam3_explain_chipid_cidr(struct sam3_chip *pChip) } } - sam3_sprintf(pChip, "%s\n", cp); + LOG_USER_N("%s\n", cp); v = sam3_reg_fieldname(pChip, "NVPTYP", pChip->cfg.CHIPID_CIDR, 28, 3); - sam3_sprintf(pChip, "%s\n", nvptype[ v ]); + LOG_USER_N("%s\n", nvptype[ v ]); v = sam3_reg_fieldname(pChip, "EXTID", pChip->cfg.CHIPID_CIDR, 31, 1); - sam3_sprintf(pChip, "(exists: %s)\n", _yes_or_no(v)); + LOG_USER_N("(exists: %s)\n", _yes_or_no(v)); } static void @@ -1263,14 +1246,14 @@ sam3_explain_ckgr_mcfr(struct sam3_chip *pChip) v = sam3_reg_fieldname(pChip, "MAINFRDY", pChip->cfg.CKGR_MCFR, 16, 1); - sam3_sprintf(pChip, "(main ready: %s)\n", _yes_or_no(v)); + LOG_USER_N("(main ready: %s)\n", _yes_or_no(v)); v = sam3_reg_fieldname(pChip, "MAINF", pChip->cfg.CKGR_MCFR, 0, 16); v = (v * pChip->cfg.slow_freq) / 16; pChip->cfg.mainosc_freq = v; - sam3_sprintf(pChip, "(%3.03f Mhz (%d.%03dkhz slowclk)\n", + LOG_USER_N("(%3.03f Mhz (%d.%03dkhz slowclk)\n", _tomhz(v), pChip->cfg.slow_freq / 1000, pChip->cfg.slow_freq % 1000); @@ -1283,17 +1266,17 @@ sam3_explain_ckgr_plla(struct sam3_chip *pChip) uint32_t mula,diva; diva = sam3_reg_fieldname(pChip, "DIVA", pChip->cfg.CKGR_PLLAR, 0, 8); - sam3_sprintf(pChip,"\n"); + LOG_USER_N("\n"); mula = sam3_reg_fieldname(pChip, "MULA", pChip->cfg.CKGR_PLLAR, 16, 11); - sam3_sprintf(pChip,"\n"); + LOG_USER_N("\n"); pChip->cfg.plla_freq = 0; if (mula == 0) { - sam3_sprintf(pChip,"\tPLLA Freq: (Disabled,mula = 0)\n"); + LOG_USER_N("\tPLLA Freq: (Disabled,mula = 0)\n"); } else if (diva == 0) { - sam3_sprintf(pChip,"\tPLLA Freq: (Disabled,diva = 0)\n"); + LOG_USER_N("\tPLLA Freq: (Disabled,diva = 0)\n"); } else if (diva == 1) { pChip->cfg.plla_freq = (pChip->cfg.mainosc_freq * (mula + 1)); - sam3_sprintf(pChip,"\tPLLA Freq: %3.03f MHz\n", + LOG_USER_N("\tPLLA Freq: %3.03f MHz\n", _tomhz(pChip->cfg.plla_freq)); } } @@ -1334,7 +1317,7 @@ sam3_explain_mckr(struct sam3_chip *pChip) break; } - sam3_sprintf(pChip, "%s (%3.03f Mhz)\n", + LOG_USER_N("%s (%3.03f Mhz)\n", cp, _tomhz(fin)); pres = sam3_reg_fieldname(pChip, "PRES", pChip->cfg.PMC_MCKR, 4, 3); @@ -1374,14 +1357,14 @@ sam3_explain_mckr(struct sam3_chip *pChip) assert(0); break; } - sam3_sprintf(pChip, "(%s)\n", cp); + LOG_USER_N("(%s)\n", cp); fin = fin / pdiv; // sam3 has a *SINGLE* clock - // other at91 series parts have divisors for these. pChip->cfg.cpu_freq = fin; pChip->cfg.mclk_freq = fin; pChip->cfg.fclk_freq = fin; - sam3_sprintf(pChip, "\t\tResult CPU Freq: %3.03f\n", + LOG_USER_N("\t\tResult CPU Freq: %3.03f\n", _tomhz(fin)); } @@ -1538,15 +1521,12 @@ sam3_GetInfo(struct sam3_chip *pChip) const struct sam3_reg_list *pReg; uint32_t regval; - membuf_reset(pChip->mbuf); - - pReg = &(sam3_all_regs[0]); while (pReg->name) { // display all regs LOG_DEBUG("Start: %s", pReg->name); regval = *sam3_get_reg_ptr(&(pChip->cfg), pReg); - sam3_sprintf(pChip, "%*s: [0x%08x] -> 0x%08x\n", + LOG_USER_N("%*s: [0x%08x] -> 0x%08x\n", REG_NAME_WIDTH, pReg->name, pReg->address, @@ -1557,14 +1537,14 @@ sam3_GetInfo(struct sam3_chip *pChip) LOG_DEBUG("End: %s", pReg->name); pReg++; } - sam3_sprintf(pChip," rc-osc: %3.03f MHz\n", _tomhz(pChip->cfg.rc_freq)); - sam3_sprintf(pChip," mainosc: %3.03f MHz\n", _tomhz(pChip->cfg.mainosc_freq)); - sam3_sprintf(pChip," plla: %3.03f MHz\n", _tomhz(pChip->cfg.plla_freq)); - sam3_sprintf(pChip," cpu-freq: %3.03f MHz\n", _tomhz(pChip->cfg.cpu_freq)); - sam3_sprintf(pChip,"mclk-freq: %3.03f MHz\n", _tomhz(pChip->cfg.mclk_freq)); + LOG_USER_N(" rc-osc: %3.03f MHz\n", _tomhz(pChip->cfg.rc_freq)); + LOG_USER_N(" mainosc: %3.03f MHz\n", _tomhz(pChip->cfg.mainosc_freq)); + LOG_USER_N(" plla: %3.03f MHz\n", _tomhz(pChip->cfg.plla_freq)); + LOG_USER_N(" cpu-freq: %3.03f MHz\n", _tomhz(pChip->cfg.cpu_freq)); + LOG_USER_N("mclk-freq: %3.03f MHz\n", _tomhz(pChip->cfg.mclk_freq)); - sam3_sprintf(pChip, " UniqueId: 0x%08x 0x%08x 0x%08x 0x%08x\n", + LOG_USER_N(" UniqueId: 0x%08x 0x%08x 0x%08x 0x%08x\n", pChip->cfg.unique_id[0], pChip->cfg.unique_id[1], pChip->cfg.unique_id[2], @@ -1664,11 +1644,6 @@ FLASH_BANK_COMMAND_HANDLER(sam3_flash_bank_command) // assumption is this runs at 32khz pChip->cfg.slow_freq = 32768; pChip->probed = 0; - pChip->mbuf = membuf_new(); - if (!(pChip->mbuf)) { - LOG_ERROR("no memory"); - return ERROR_FAIL; - } } switch (bank->base) { @@ -1702,11 +1677,8 @@ sam3_GetDetails(struct sam3_bank_private *pPrivate) { const struct sam3_chip_details *pDetails; struct sam3_chip *pChip; - void *vp; struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS]; - unsigned x; - const char *cp; LOG_DEBUG("Begin"); pDetails = all_sam3_details; @@ -1721,16 +1693,9 @@ sam3_GetDetails(struct sam3_bank_private *pPrivate) LOG_ERROR("SAM3 ChipID 0x%08x not found in table (perhaps you can this chip?)", (unsigned int)(pPrivate->pChip->cfg.CHIPID_CIDR)); // Help the victim, print details about the chip - membuf_reset(pPrivate->pChip->mbuf); - membuf_sprintf(pPrivate->pChip->mbuf, - "SAM3 CHIPID_CIDR: 0x%08x decodes as follows\n", + LOG_INFO_N("SAM3 CHIPID_CIDR: 0x%08x decodes as follows\n", pPrivate->pChip->cfg.CHIPID_CIDR); sam3_explain_chipid_cidr(pPrivate->pChip); - cp = membuf_strtok(pPrivate->pChip->mbuf, "\n", &vp); - while (cp) { - LOG_INFO("%s", cp); - cp = membuf_strtok(NULL, "\n", &vp); - } return ERROR_FAIL; } @@ -1798,18 +1763,14 @@ _sam3_probe(struct flash_bank *bank, int noise) LOG_DEBUG("Here"); - r = sam3_GetInfo(pPrivate->pChip); + if (pPrivate->pChip->probed) { + r = sam3_GetInfo(pPrivate->pChip); + } else { + r = sam3_GetDetails(pPrivate); + } if (r != ERROR_OK) { return r; } - if (!(pPrivate->pChip->probed)) { - pPrivate->pChip->probed = 1; - LOG_DEBUG("Here"); - r = sam3_GetDetails(pPrivate); - if (r != ERROR_OK) { - return r; - } - } // update the flash bank size for (x = 0 ; x < SAM3_MAX_FLASH_BANKS ; x++) { @@ -2256,8 +2217,6 @@ sam3_write(struct flash_bank *bank, COMMAND_HANDLER(sam3_handle_info_command) { struct sam3_chip *pChip; - void *vp; - const char *cp; unsigned x; int r; @@ -2319,13 +2278,6 @@ COMMAND_HANDLER(sam3_handle_info_command) return r; } - - // print results - cp = membuf_strtok(pChip->mbuf, "\n", &vp); - while (cp) { - command_print(CMD_CTX,"%s", cp); - cp = membuf_strtok(NULL, "\n", &vp); - } return ERROR_OK; } ----------------------------------------------------------------------- Summary of changes: src/flash/nor/at91sam3.c | 126 ++++++++----------------- src/helper/Makefile.am | 4 +- src/helper/membuf.c | 240 ---------------------------------------------- src/helper/membuf.h | 137 -------------------------- 4 files changed, 40 insertions(+), 467 deletions(-) delete mode 100644 src/helper/membuf.c delete mode 100644 src/helper/membuf.h hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-16 09:02:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 814c2a8f9a41a6445f131ee35474dced4bbed210 (commit) via 818120d4092be0d0a7cae50140dc339581cae7fc (commit) via 5104d56e5c37defaf2f6c5c8607bac45b8b49b32 (commit) via cd9c61cc068635fa707981decfea600ee7e94201 (commit) via 9bbbbdc0bd244b09f846b1acdf28327da2a166d8 (commit) from f4958d61ef4188ed02629968d21c3a4de3a89121 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 814c2a8f9a41a6445f131ee35474dced4bbed210 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 08:33:32 2010 +0200 build: enable -Wshadow by default Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/configure.in b/configure.in index d93b21a..7f31e1d 100644 --- a/configure.in +++ b/configure.in @@ -1090,7 +1090,7 @@ fi AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).]) # set default gcc warnings -GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security" +GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow" if test "${gcc_wextra}" = yes; then GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter" GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast" commit 818120d4092be0d0a7cae50140dc339581cae7fc Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 08:27:50 2010 +0200 gdb: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 8ed9e74..a1ff7c8 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2245,7 +2245,6 @@ static int gdb_input_inner(struct connection *connection) case 'c': case 's': { - struct gdb_connection *gdb_con = connection->priv; log_add_callback(gdb_log_callback, connection); if (gdb_con->mem_write_error) commit 5104d56e5c37defaf2f6c5c8607bac45b8b49b32 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 08:24:51 2010 +0200 gdb: clean up error handling in step/continue if step/continue fails, then the error should be reported to the calling fn. The calling fn decides if the connection has to be aborted or if packet processing can continue. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 029bdf8..8ed9e74 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2151,7 +2151,17 @@ static int gdb_input_inner(struct connection *connection) struct gdb_connection *gdb_con = connection->priv; static int extended_protocol = 0; - /* drain input buffer */ + /* drain input buffer. If one of the packets fail, then an error + * packet is replied, if applicable. + * + * This loop will terminate and the error code is returned. + * + * The calling fn will check if this error is something that + * can be recovered from, or if the connection must be closed. + * + * If the error is recoverable, this fn is called again to + * drain the rest of the buffer. + */ do { packet_size = GDB_BUFFER_SIZE-1; @@ -2235,8 +2245,6 @@ static int gdb_input_inner(struct connection *connection) case 'c': case 's': { - int retval = ERROR_OK; - struct gdb_connection *gdb_con = connection->priv; log_add_callback(gdb_log_callback, connection); @@ -2271,7 +2279,7 @@ static int gdb_input_inner(struct connection *connection) } gdb_con->sync = false; - if ((retval!=ERROR_OK) || (!already_running && nostep)) + if (!already_running && nostep) { /* Either the target isn't in the halted state, then we can't * step/continue. This might be early setup, etc. @@ -2294,7 +2302,9 @@ static int gdb_input_inner(struct connection *connection) if (!already_running) { - int retval = gdb_step_continue_packet(connection, target, packet, packet_size); + /* Here we don't want packet processing to stop even if this fails, + * so we use a local variable instead of retval. */ + retval = gdb_step_continue_packet(connection, target, packet, packet_size); if (retval != ERROR_OK) { /* we'll never receive a halted condition... issue a false one.. */ commit cd9c61cc068635fa707981decfea600ee7e94201 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 08:19:25 2010 +0200 xsvf: -Wshadow warning fixes I think this fixed an error message where the error message would show the *previous* uc code rather than the current unsupported uc code. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index dff1a1e..51d0e7b 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -269,7 +269,6 @@ COMMAND_HANDLER(handle_xsvf_command) */ if (collecting_path) { tap_state_t mystate; - uint8_t uc; switch (opcode) { case XCOMMENT: @@ -565,7 +564,6 @@ COMMAND_HANDLER(handle_xsvf_command) case XSTATE: { tap_state_t mystate; - uint8_t uc; if (read(xsvf_fd, &uc, 1) < 0) { commit 9bbbbdc0bd244b09f846b1acdf28327da2a166d8 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 08:17:27 2010 +0200 svf: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/svf/svf.c b/src/svf/svf.c index 6e951e2..62e2324 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -272,7 +272,7 @@ static unsigned svf_get_mask_u32(int bitlen) int svf_add_statemove(tap_state_t state_to) { tap_state_t state_from = cmd_queue_cur_state; - uint8_t index; + unsigned index_var; /* when resetting, be paranoid and ignore current state */ if (state_to == TAP_RESET) { @@ -280,18 +280,18 @@ int svf_add_statemove(tap_state_t state_to) return ERROR_OK; } - for (index = 0; index < ARRAY_SIZE(svf_statemoves); index++) + for (index_var = 0; index_var < ARRAY_SIZE(svf_statemoves); index_var++) { - if ((svf_statemoves[index].from == state_from) - && (svf_statemoves[index].to == state_to)) + if ((svf_statemoves[index_var].from == state_from) + && (svf_statemoves[index_var].to == state_to)) { /* recorded path includes current state ... avoid extra TCKs! */ - if (svf_statemoves[index].num_of_moves > 1) - jtag_add_pathmove(svf_statemoves[index].num_of_moves - 1, - svf_statemoves[index].paths + 1); + if (svf_statemoves[index_var].num_of_moves > 1) + jtag_add_pathmove(svf_statemoves[index_var].num_of_moves - 1, + svf_statemoves[index_var].paths + 1); else - jtag_add_pathmove(svf_statemoves[index].num_of_moves, - svf_statemoves[index].paths); + jtag_add_pathmove(svf_statemoves[index_var].num_of_moves, + svf_statemoves[index_var].paths); return ERROR_OK; } } @@ -723,22 +723,22 @@ static int svf_copy_hexstring_to_binary(char *str, uint8_t **bin, int orig_bit_l static int svf_check_tdo(void) { - int i, len, index; + int i, len, index_var; for (i = 0; i < svf_check_tdo_para_index; i++) { - index = svf_check_tdo_para[i].buffer_offset; + index_var = svf_check_tdo_para[i].buffer_offset; len = svf_check_tdo_para[i].bit_len; if ((svf_check_tdo_para[i].enabled) - && buf_cmp_mask(&svf_tdi_buffer[index], &svf_tdo_buffer[index], &svf_mask_buffer[index], len)) + && buf_cmp_mask(&svf_tdi_buffer[index_var], &svf_tdo_buffer[index_var], &svf_mask_buffer[index_var], len)) { unsigned bitmask; unsigned received, expected, tapmask; bitmask = svf_get_mask_u32(svf_check_tdo_para[i].bit_len); - memcpy(&received, svf_tdi_buffer + index, sizeof(unsigned)); - memcpy(&expected, svf_tdo_buffer + index, sizeof(unsigned)); - memcpy(&tapmask, svf_mask_buffer + index, sizeof(unsigned)); + memcpy(&received, svf_tdi_buffer + index_var, sizeof(unsigned)); + memcpy(&expected, svf_tdo_buffer + index_var, sizeof(unsigned)); + memcpy(&tapmask, svf_mask_buffer + index_var, sizeof(unsigned)); LOG_ERROR("tdo check error at line %d", svf_check_tdo_para[i].line_num); LOG_ERROR("read = 0x%X, want = 0x%X, mask = 0x%X", ----------------------------------------------------------------------- Summary of changes: configure.in | 2 +- src/server/gdb_server.c | 21 +++++++++++++++------ src/svf/svf.c | 30 +++++++++++++++--------------- src/xsvf/xsvf.c | 2 -- 4 files changed, 31 insertions(+), 24 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-16 07:43:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via f4958d61ef4188ed02629968d21c3a4de3a89121 (commit) via 94f373b404b93a1e1b6c693061f2ed504e4d36aa (commit) via 6de2b2d14b0b80f392d0faa05db915141cbd40cf (commit) from 72d227cd5e32a6b141026e31ca4702cd69c79e62 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f4958d61ef4188ed02629968d21c3a4de3a89121 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 07:42:41 2010 +0200 mflash: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/mflash.c b/src/flash/mflash.c index d307858..90e9888 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -209,7 +209,7 @@ static int mg_init_gpio (void) return ret; } -static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) +static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time_var) { uint8_t status, error; struct target *target = mflash_bank->target; @@ -220,7 +220,7 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) struct duration bench; duration_start(&bench); - while (time) { + while (time_var) { ret = target_read_u8(target, mg_task_reg + MG_REG_STATUS, &status); if (ret != ERROR_OK) @@ -280,7 +280,7 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) else LOG_ERROR("mflash: duration measurement failed: %d", ret); - if (t > time) + if (t > time_var) break; } commit 94f373b404b93a1e1b6c693061f2ed504e4d36aa Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 07:41:43 2010 +0200 arm_io: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nand/arm_io.c b/src/flash/nand/arm_io.c index 7c7148e..7a6ceb3 100644 --- a/src/flash/nand/arm_io.c +++ b/src/flash/nand/arm_io.c @@ -100,7 +100,7 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size) struct arm *armv4_5 = target->arch_info; struct reg_param reg_params[3]; uint32_t target_buf; - uint32_t exit = 0; + uint32_t exit_var = 0; int retval; /* Inputs: @@ -153,11 +153,11 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size) /* armv4 must exit using a hardware breakpoint */ if (armv4_5->is_armv4) - exit = nand->copy_area->address + sizeof(code) - 4; + exit_var = nand->copy_area->address + sizeof(code) - 4; /* use alg to write data from work area to NAND chip */ retval = target_run_algorithm(target, 0, NULL, 3, reg_params, - nand->copy_area->address, exit, 1000, &algo); + nand->copy_area->address, exit_var, 1000, &algo); if (retval != ERROR_OK) LOG_ERROR("error executing hosted NAND write"); @@ -184,7 +184,7 @@ int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size) struct arm *armv4_5 = target->arch_info; struct reg_param reg_params[3]; uint32_t target_buf; - uint32_t exit = 0; + uint32_t exit_var = 0; int retval; /* Inputs: @@ -229,11 +229,11 @@ int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size) /* armv4 must exit using a hardware breakpoint */ if (armv4_5->is_armv4) - exit = nand->copy_area->address + sizeof(code) - 4; + exit_var = nand->copy_area->address + sizeof(code) - 4; /* use alg to write data from NAND chip to work area */ retval = target_run_algorithm(target, 0, NULL, 3, reg_params, - nand->copy_area->address, exit, 1000, &algo); + nand->copy_area->address, exit_var, 1000, &algo); if (retval != ERROR_OK) LOG_ERROR("error executing hosted NAND read"); commit 6de2b2d14b0b80f392d0faa05db915141cbd40cf Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 07:39:46 2010 +0200 nand: when verify failed, it didn't return an error when the verify failed, it didn't return an error, which breaks e.g. tcl scripts that rely on this for exceptions to work. Found by -Wshadow Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nand/tcl.c b/src/flash/nand/tcl.c index 1272bf6..592277e 100644 --- a/src/flash/nand/tcl.c +++ b/src/flash/nand/tcl.c @@ -336,13 +336,14 @@ COMMAND_HANDLER(handle_nand_verify_command) while (file.size > 0) { - int retval = nand_read_page(nand, dev.address / dev.page_size, + retval = nand_read_page(nand, dev.address / dev.page_size, dev.page, dev.page_size, dev.oob, dev.oob_size); if (ERROR_OK != retval) { command_print(CMD_CTX, "reading NAND flash page failed"); nand_fileio_cleanup(&dev); - return nand_fileio_cleanup(&file); + nand_fileio_cleanup(&file); + return retval; } int bytes_read = nand_fileio_read(nand, &file); @@ -350,7 +351,8 @@ COMMAND_HANDLER(handle_nand_verify_command) { command_print(CMD_CTX, "error while reading file"); nand_fileio_cleanup(&dev); - return nand_fileio_cleanup(&file); + nand_fileio_cleanup(&file); + return ERROR_FAIL; } if ((dev.page && memcmp(dev.page, file.page, dev.page_size)) || @@ -359,7 +361,8 @@ COMMAND_HANDLER(handle_nand_verify_command) command_print(CMD_CTX, "NAND flash contents differ " "at 0x%8.8" PRIx32, dev.address); nand_fileio_cleanup(&dev); - return nand_fileio_cleanup(&file); + nand_fileio_cleanup(&file); + return ERROR_FAIL; } file.size -= bytes_read; @@ -389,12 +392,13 @@ COMMAND_HANDLER(handle_nand_dump_command) while (s.size > 0) { size_t size_written; - int retval = nand_read_page(nand, s.address / nand->page_size, + retval = nand_read_page(nand, s.address / nand->page_size, s.page, s.page_size, s.oob, s.oob_size); if (ERROR_OK != retval) { command_print(CMD_CTX, "reading NAND flash page failed"); - return nand_fileio_cleanup(&s); + nand_fileio_cleanup(&s); + return retval; } if (NULL != s.page) ----------------------------------------------------------------------- Summary of changes: src/flash/mflash.c | 6 +++--- src/flash/nand/arm_io.c | 12 ++++++------ src/flash/nand/tcl.c | 16 ++++++++++------ 3 files changed, 19 insertions(+), 15 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-16 00:09:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 72d227cd5e32a6b141026e31ca4702cd69c79e62 (commit) via 42c84c59b1a733c27e164920cca58716cd7e8740 (commit) via f9acaa894fbb15ec93463bc4f5eaceb23e0ba3c1 (commit) from f1ce4fe288dc3a2682b8335177a2800980316ce3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 72d227cd5e32a6b141026e31ca4702cd69c79e62 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 00:08:58 2010 +0200 tms470: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c index 343c43e..2f02e5d 100644 --- a/src/flash/nor/tms470.c +++ b/src/flash/nor/tms470.c @@ -1215,7 +1215,7 @@ static int tms470_protect_check(struct flash_bank *bank) /* ---------------------------------------------------------------------- */ -static int tms470_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_tms470_info(struct flash_bank *bank, char *buf, int buf_size) { int used = 0; struct tms470_flash_bank *tms470_info = bank->driver_priv; @@ -1275,5 +1275,5 @@ struct flash_driver tms470_flash = { .auto_probe = tms470_auto_probe, .erase_check = tms470_erase_check, .protect_check = tms470_protect_check, - .info = tms470_info, + .info = get_tms470_info, }; commit 42c84c59b1a733c27e164920cca58716cd7e8740 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 00:07:59 2010 +0200 str9xpec: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c index 073dfe1..f8b705e 100644 --- a/src/flash/nor/str9xpec.c +++ b/src/flash/nor/str9xpec.c @@ -665,7 +665,7 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, if (bytes_remaining) { uint8_t last_dword[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - int i = 0; + i = 0; while (bytes_remaining > 0) { @@ -762,7 +762,7 @@ static int str9xpec_erase_check(struct flash_bank *bank) return str9xpec_blank_check(bank, 0, bank->num_sectors - 1); } -static int str9xpec_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_str9xpec_info(struct flash_bank *bank, char *buf, int buf_size) { snprintf(buf, buf_size, "str9xpec flash driver info"); return ERROR_OK; @@ -1252,5 +1252,5 @@ struct flash_driver str9xpec_flash = { .auto_probe = str9xpec_probe, .erase_check = str9xpec_erase_check, .protect_check = str9xpec_protect_check, - .info = str9xpec_info, + .info = get_str9xpec_info, }; commit f9acaa894fbb15ec93463bc4f5eaceb23e0ba3c1 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 00:05:58 2010 +0200 str9x: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c index e8e942e..103af16 100644 --- a/src/flash/nor/str9x.c +++ b/src/flash/nor/str9x.c @@ -564,7 +564,7 @@ static int str9x_write(struct flash_bank *bank, if (bytes_remaining) { uint8_t last_halfword[2] = {0xff, 0xff}; - int i = 0; + i = 0; while (bytes_remaining > 0) { @@ -621,7 +621,7 @@ COMMAND_HANDLER(str9x_handle_part_id_command) } #endif -static int str9x_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_str9x_info(struct flash_bank *bank, char *buf, int buf_size) { snprintf(buf, buf_size, "str9x flash driver info"); return ERROR_OK; @@ -706,5 +706,5 @@ struct flash_driver str9x_flash = { .auto_probe = str9x_probe, .erase_check = default_flash_blank_check, .protect_check = str9x_protect_check, - .info = str9x_info, + .info = get_str9x_info, }; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/str9x.c | 6 +++--- src/flash/nor/str9xpec.c | 6 +++--- src/flash/nor/tms470.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-16 00:05:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via f1ce4fe288dc3a2682b8335177a2800980316ce3 (commit) from 8022940c5c3a12ecdbc8f8866351ee0ef5de1d35 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f1ce4fe288dc3a2682b8335177a2800980316ce3 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 00:04:23 2010 +0200 oops... backup file snuck in, remove it. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/#jim.c# b/src/helper/#jim.c# deleted file mode 100644 index c8583de..0000000 --- a/src/helper/#jim.c# +++ /dev/null @@ -1,12823 +0,0 @@ -/* Jim - A small embeddable Tcl interpreter - * - * Copyright 2005 Salvatore Sanfilippo <an...@in...> - * Copyright 2005 Clemens Hintze <c.h...@gm...> - * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> - * Copyright 2008,2009 oharboe - Øyvind Harboe - oyv...@zy... - * Copyright 2008 Andrew Lunn <an...@lu...> - * Copyright 2008 Duane Ellis <op...@du...> - * Copyright 2008 Uwe Klein <uk...@kl...> - * Copyright 2008 Steve Bennett <st...@wo...> - * Copyright 2009 Nico Coesel <nc...@de...> - * Copyright 2009 Zachary T Welch zw...@su... - * Copyright 2009 David Brownell - * - * The FreeBSD license - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * JIM TCL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing - * official policies, either expressed or implied, of the Jim Tcl Project. - **/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define __JIM_CORE__ -#define JIM_OPTIMIZATION /* comment to avoid optimizations and reduce size */ - -#ifdef __ECOS -#include <pkgconf/jimtcl.h> -#include <stdio.h> -#include <stdlib.h> - -typedef CYG_ADDRWORD intptr_t; - -#include <string.h> -#include <stdarg.h> -#include <ctype.h> -#include <limits.h> -#include <assert.h> -#include <errno.h> -#include <time.h> -#endif -#ifndef JIM_ANSIC -#define JIM_DYNLIB /* Dynamic library support for UNIX and WIN32 */ -#endif /* JIM_ANSIC */ - -#include <stdarg.h> -#include <limits.h> - -/* Include the platform dependent libraries for - * dynamic loading of libraries. */ -#ifdef JIM_DYNLIB -#if defined(_WIN32) || defined(WIN32) -#ifndef WIN32 -#define WIN32 1 -#endif -#ifndef STRICT -#define STRICT -#endif -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#if _MSC_VER >= 1000 -#pragma warning(disable:4146) -#endif /* _MSC_VER */ -#else -#include <dlfcn.h> -#endif /* WIN32 */ -#endif /* JIM_DYNLIB */ - -#ifdef __ECOS -#include <cyg/jimtcl/jim.h> -#else -#include "jim.h" -#endif - -#ifdef HAVE_BACKTRACE -#include <execinfo.h> -#endif - -/* ----------------------------------------------------------------------------- - * Global variables - * ---------------------------------------------------------------------------*/ - -/* A shared empty string for the objects string representation. - * Jim_InvalidateStringRep knows about it and don't try to free. */ -static char *JimEmptyStringRep = (char*) ""; - -/* ----------------------------------------------------------------------------- - * Required prototypes of not exported functions - * ---------------------------------------------------------------------------*/ -static void JimChangeCallFrameId(Jim_Interp *interp, Jim_CallFrame *cf); -static void JimFreeCallFrame(Jim_Interp *interp, Jim_CallFrame *cf, int flags); -static void JimRegisterCoreApi(Jim_Interp *interp); - -static Jim_HashTableType *getJimVariablesHashTableType(void); - -/* ----------------------------------------------------------------------------- - * Utility functions - * ---------------------------------------------------------------------------*/ - -static char * -jim_vasprintf(const char *fmt, va_list ap) -{ -#ifndef HAVE_VASPRINTF - /* yucky way */ -static char buf[2048]; - vsnprintf(buf, sizeof(buf), fmt, ap); - /* garentee termination */ - buf[sizeof(buf)-1] = 0; -#else - char *buf; - int result; - result = vasprintf(&buf, fmt, ap); - if (result < 0) exit(-1); -#endif - return buf; -} - -static void -jim_vasprintf_done(void *buf) -{ -#ifndef HAVE_VASPRINTF - (void)(buf); -#else - free(buf); -#endif -} - - -/* - * Convert a string to a jim_wide INTEGER. - * This function originates from BSD. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -#ifdef HAVE_LONG_LONG_INT -#define JimIsAscii(c) (((c) & ~0x7f) == 0) -static jim_wide JimStrtoll(const char *nptr, char **endptr, register int base) -{ - register const char *s; - register unsigned jim_wide acc; - register unsigned char c; - register unsigned jim_wide qbase, cutoff; - register int neg, any, cutlim; - - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - s = nptr; - do { - c = *s++; - } while (isspace(c)); - if (c == '-') { - neg = 1; - c = *s++; - } else { - neg = 0; - if (c == '+') - c = *s++; - } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - - /* - * Compute the cutoff value between legal numbers and illegal - * numbers. That is the largest legal value, divided by the - * base. An input number that is greater than this value, if - * followed by a legal input character, is too big. One that - * is equal to this value may be valid or not; the limit - * between valid and invalid numbers is then based on the last - * digit. For instance, if the range for quads is - * [-9223372036854775808..9223372036854775807] and the input base - * is 10, cutoff will be set to 922337203685477580 and cutlim to - * either 7 (neg == 0) or 8 (neg == 1), meaning that if we have - * accumulated a value > 922337203685477580, or equal but the - * next digit is > 7 (or 8), the number is too big, and we will - * return a range error. - * - * Set any if any `digits' consumed; make it negative to indicate - * overflow. - */ - qbase = (unsigned)base; - cutoff = neg ? (unsigned jim_wide)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX - : LLONG_MAX; - cutlim = (int)(cutoff % qbase); - cutoff /= qbase; - for (acc = 0, any = 0;; c = *s++) { - if (!JimIsAscii(c)) - break; - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= qbase; - acc += c; - } - } - if (any < 0) { - acc = neg ? LLONG_MIN : LLONG_MAX; - errno = ERANGE; - } else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = (char *)(any ? s - 1 : nptr); - return (acc); -} -#endif - -/* Glob-style pattern matching. */ -static int JimStringMatch(const char *pattern, int patternLen, - const char *string, int stringLen, int nocase) -{ - while (patternLen) { - switch (pattern[0]) { - case '*': - while (pattern[1] == '*') { - pattern++; - patternLen--; - } - if (patternLen == 1) - return 1; /* match */ - while (stringLen) { - if (JimStringMatch(pattern + 1, patternLen-1, - string, stringLen, nocase)) - return 1; /* match */ - string++; - stringLen--; - } - return 0; /* no match */ - break; - case '?': - if (stringLen == 0) - return 0; /* no match */ - string++; - stringLen--; - break; - case '[': - { - int not, match; - - pattern++; - patternLen--; - not = pattern[0] == '^'; - if (not) { - pattern++; - patternLen--; - } - match = 0; - while (1) { - if (pattern[0] == '\\') { - pattern++; - patternLen--; - if (pattern[0] == string[0]) - match = 1; - } else if (pattern[0] == ']') { - break; - } else if (patternLen == 0) { - pattern--; - patternLen++; - break; - } else if (pattern[1] == '-' && patternLen >= 3) { - int start = pattern[0]; - int end = pattern[2]; - int c = string[0]; - if (start > end) { - int t = start; - start = end; - end = t; - } - if (nocase) { - start = tolower(start); - end = tolower(end); - c = tolower(c); - } - pattern += 2; - patternLen -= 2; - if (c >= start && c <= end) - match = 1; - } else { - if (!nocase) { - if (pattern[0] == string[0]) - match = 1; - } else { - if (tolower((int)pattern[0]) == tolower((int)string[0])) - match = 1; - } - } - pattern++; - patternLen--; - } - if (not) - match = !match; - if (!match) - return 0; /* no match */ - string++; - stringLen--; - break; - } - case '\\': - if (patternLen >= 2) { - pattern++; - patternLen--; - } - /* fall through */ - default: - if (!nocase) { - if (pattern[0] != string[0]) - return 0; /* no match */ - } else { - if (tolower((int)pattern[0]) != tolower((int)string[0])) - return 0; /* no match */ - } - string++; - stringLen--; - break; - } - pattern++; - patternLen--; - if (stringLen == 0) { - while (*pattern == '*') { - pattern++; - patternLen--; - } - break; - } - } - if (patternLen == 0 && stringLen == 0) - return 1; - return 0; -} - -int JimStringCompare(const char *s1, int l1, const char *s2, int l2, - int nocase) -{ - unsigned char *u1 = (unsigned char*) s1, *u2 = (unsigned char*) s2; - - if (nocase == 0) { - while (l1 && l2) { - if (*u1 != *u2) - return (int)*u1-*u2; - u1++; u2++; l1--; l2--; - } - if (!l1 && !l2) return 0; - return l1-l2; - } else { - while (l1 && l2) { - if (tolower((int)*u1) != tolower((int)*u2)) - return tolower((int)*u1)-tolower((int)*u2); - u1++; u2++; l1--; l2--; - } - if (!l1 && !l2) return 0; - return l1-l2; - } -} - -/* Search 's1' inside 's2', starting to search from char 'index' of 's2'. - * The index of the first occurrence of s1 in s2 is returned. - * If s1 is not found inside s2, -1 is returned. */ -int JimStringFirst(const char *s1, int l1, const char *s2, int l2, int index_t) -{ - int i; - - if (!l1 || !l2 || l1 > l2) return -1; - if (index_t < 0) index_t = 0; - s2 += index_t; - for (i = index_t; i <= l2-l1; i++) { - if (memcmp(s2, s1, l1) == 0) - return i; - s2++; - } - return -1; -} - -int Jim_WideToString(char *buf, jim_wide wideValue) -{ - const char *fmt = "%" JIM_WIDE_MODIFIER; - return sprintf(buf, fmt, wideValue); -} - -int Jim_StringToWide(const char *str, jim_wide *widePtr, int base) -{ - char *endptr; - -#ifdef HAVE_LONG_LONG_INT - *widePtr = JimStrtoll(str, &endptr, base); -#else - *widePtr = strtol(str, &endptr, base); -#endif - if ((str[0] == '\0') || (str == endptr)) - return JIM_ERR; - if (endptr[0] != '\0') { - while (*endptr) { - if (!isspace((int)*endptr)) - return JIM_ERR; - endptr++; - } - } - return JIM_OK; -} - -int Jim_StringToIndex(const char *str, int *intPtr) -{ - char *endptr; - - *intPtr = strtol(str, &endptr, 10); - if ((str[0] == '\0') || (str == endptr)) - return JIM_ERR; - if (endptr[0] != '\0') { - while (*endptr) { - if (!isspace((int)*endptr)) - return JIM_ERR; - endptr++; - } - } - return JIM_OK; -} - -/* The string representation of references has two features in order - * to make the GC faster. The first is that every reference starts - * with a non common character '~', in order to make the string matching - * fater. The second is that the reference string rep his 32 characters - * in length, this allows to avoid to check every object with a string - * repr < 32, and usually there are many of this objects. */ - -#define JIM_REFERENCE_SPACE (35 + JIM_REFERENCE_TAGLEN) - -static int JimFormatReference(char *buf, Jim_Reference *refPtr, jim_wide id) -{ - const char *fmt = "<reference.<%s>.%020" JIM_WIDE_MODIFIER ">"; - sprintf(buf, fmt, refPtr->tag, id); - return JIM_REFERENCE_SPACE; -} - -int Jim_DoubleToString(char *buf, double doubleValue) -{ - char *s; - int len; - - len = sprintf(buf, "%.17g", doubleValue); - s = buf; - while (*s) { - if (*s == '.') return len; - s++; - } - /* Add a final ".0" if it's a number. But not - * for NaN or InF */ - if (isdigit((int)buf[0]) - || ((buf[0] == '-' || buf[0] == '+') - && isdigit((int)buf[1]))) { - s[0] = '.'; - s[1] = '0'; - s[2] = '\0'; - return len + 2; - } - return len; -} - -int Jim_StringToDouble(const char *str, double *doublePtr) -{ - char *endptr; - - *doublePtr = strtod(str, &endptr); - if (str[0] == '\0' || endptr[0] != '\0' || (str == endptr)) - return JIM_ERR; - return JIM_OK; -} - -static jim_wide JimPowWide(jim_wide b, jim_wide e) -{ - jim_wide i, res = 1; - if ((b == 0 && e != 0) || (e < 0)) return 0; - for (i = 0; i < e; i++) {res *= b;} - return res; -} - -/* ----------------------------------------------------------------------------- - * Special functions - * ---------------------------------------------------------------------------*/ - -/* Note that 'interp' may be NULL if not available in the - * context of the panic. It's only useful to get the error - * file descriptor, it will default to stderr otherwise. */ -void Jim_Panic(Jim_Interp *interp, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - /* - * Send it here first.. Assuming STDIO still works - */ - fprintf(stderr, JIM_NL "JIM INTERPRETER PANIC: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, JIM_NL JIM_NL); - va_end(ap); - -#ifdef HAVE_BACKTRACE - { - void *array[40]; - int size, i; - char **strings; - - size = backtrace(array, 40); - strings = backtrace_symbols(array, size); - for (i = 0; i < size; i++) - fprintf(fp,"[backtrace] %s" JIM_NL, strings[i]); - fprintf(fp,"[backtrace] Include the above lines and the output" JIM_NL); - fprintf(fp,"[backtrace] of 'nm <executable>' in the bug report." JIM_NL); - } -#endif - - /* This may actually crash... we do it last */ - if (interp && interp->cookie_stderr) { - Jim_fprintf(interp, interp->cookie_stderr, JIM_NL "JIM INTERPRETER PANIC: "); - Jim_vfprintf(interp, interp->cookie_stderr, fmt, ap); - Jim_fprintf(interp, interp->cookie_stderr, JIM_NL JIM_NL); - } - abort(); -} - -/* ----------------------------------------------------------------------------- - * Memory allocation - * ---------------------------------------------------------------------------*/ - -/* Macro used for memory debugging. - * In order for they to work you have to rename Jim_Alloc into _Jim_Alloc - * and similary for Jim_Realloc and Jim_Free */ -#if 0 -#define Jim_Alloc(s) (printf("%s %d: Jim_Alloc(%d)\n",__FILE__,__LINE__,s),_Jim_Alloc(s)) -#define Jim_Free(p) (printf("%s %d: Jim_Free(%p)\n",__FILE__,__LINE__,p),_Jim_Free(p)) -#define Jim_Realloc(p,s) (printf("%s %d: Jim_Realloc(%p,%d)\n",__FILE__,__LINE__,p,s),_Jim_Realloc(p,s)) -#endif - -void *Jim_Alloc(int size) -{ - /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ - if (size == 0) - size = 1; - void *p = malloc(size); - if (p == NULL) - Jim_Panic(NULL,"malloc: Out of memory"); - return p; -} - -void Jim_Free(void *ptr) { - free(ptr); -} - -void *Jim_Realloc(void *ptr, int size) -{ - /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ - if (size == 0) - size = 1; - void *p = realloc(ptr, size); - if (p == NULL) - Jim_Panic(NULL,"realloc: Out of memory"); - return p; -} - -char *Jim_StrDup(const char *s) -{ - int l = strlen(s); - char *copy = Jim_Alloc(l + 1); - - memcpy(copy, s, l + 1); - return copy; -} - -char *Jim_StrDupLen(const char *s, int l) -{ - char *copy = Jim_Alloc(l + 1); - - memcpy(copy, s, l + 1); - copy[l] = 0; /* Just to be sure, original could be substring */ - return copy; -} - -/* ----------------------------------------------------------------------------- - * Time related functions - * ---------------------------------------------------------------------------*/ -/* Returns microseconds of CPU used since start. */ -static jim_wide JimClock(void) -{ -#if (defined WIN32) && !(defined JIM_ANSIC) - LARGE_INTEGER t, f; - QueryPerformanceFrequency(&f); - QueryPerformanceCounter(&t); - return (long)((t.QuadPart * 1000000) / f.QuadPart); -#else /* !WIN32 */ - clock_t clocks = clock(); - - return (long)(clocks*(1000000/CLOCKS_PER_SEC)); -#endif /* WIN32 */ -} - -/* ----------------------------------------------------------------------------- - * Hash Tables - * ---------------------------------------------------------------------------*/ - -/* -------------------------- private prototypes ---------------------------- */ -static int JimExpandHashTableIfNeeded(Jim_HashTable *ht); -static unsigned int JimHashTableNextPower(unsigned int size); -static int JimInsertHashEntry(Jim_HashTable *ht, const void *key); - -/* -------------------------- hash functions -------------------------------- */ - -/* Thomas Wang's 32 bit Mix Function */ -unsigned int Jim_IntHashFunction(unsigned int key) -{ - key += ~(key << 15); - key ^= (key >> 10); - key += (key << 3); - key ^= (key >> 6); - key += ~(key << 11); - key ^= (key >> 16); - return key; -} - -/* Identity hash function for integer keys */ -unsigned int Jim_IdentityHashFunction(unsigned int key) -{ - return key; -} - -/* Generic hash function (we are using to multiply by 9 and add the byte - * as Tcl) */ -unsigned int Jim_GenHashFunction(const unsigned char *buf, int len) -{ - unsigned int h = 0; - while (len--) - h += (h << 3)+*buf++; - return h; -} - -/* ----------------------------- API implementation ------------------------- */ -/* reset an hashtable already initialized with ht_init(). - * NOTE: This function should only called by ht_destroy(). */ -static void JimResetHashTable(Jim_HashTable *ht) -{ - ht->table = NULL; - ht->size = 0; - ht->sizemask = 0; - ht->used = 0; - ht->collisions = 0; -} - -/* Initialize the hash table */ -int Jim_InitHashTable(Jim_HashTable *ht, Jim_HashTableType *type, - void *privDataPtr) -{ - JimResetHashTable(ht); - ht->type = type; - ht->privdata = privDataPtr; - return JIM_OK; -} - -/* Resize the table to the minimal size that contains all the elements, - * but with the invariant of a USER/BUCKETS ration near to <= 1 */ -int Jim_ResizeHashTable(Jim_HashTable *ht) -{ - int minimal = ht->used; - - if (minimal < JIM_HT_INITIAL_SIZE) - minimal = JIM_HT_INITIAL_SIZE; - return Jim_ExpandHashTable(ht, minimal); -} - -/* Expand or create the hashtable */ -int Jim_ExpandHashTable(Jim_HashTable *ht, unsigned int size) -{ - Jim_HashTable n; /* the new hashtable */ - unsigned int realsize = JimHashTableNextPower(size), i; - - /* the size is invalid if it is smaller than the number of - * elements already inside the hashtable */ - if (ht->used >= size) - return JIM_ERR; - - Jim_InitHashTable(&n, ht->type, ht->privdata); - n.size = realsize; - n.sizemask = realsize-1; - n.table = Jim_Alloc(realsize*sizeof(Jim_HashEntry*)); - - /* Initialize all the pointers to NULL */ - memset(n.table, 0, realsize*sizeof(Jim_HashEntry*)); - - /* Copy all the elements from the old to the new table: - * note that if the old hash table is empty ht->size is zero, - * so Jim_ExpandHashTable just creates an hash table. */ - n.used = ht->used; - for (i = 0; i < ht->size && ht->used > 0; i++) { - Jim_HashEntry *he, *nextHe; - - if (ht->table[i] == NULL) continue; - - /* For each hash entry on this slot... */ - he = ht->table[i]; - while (he) { - unsigned int h; - - nextHe = he->next; - /* Get the new element index */ - h = Jim_HashKey(ht, he->key) & n.sizemask; - he->next = n.table[h]; - n.table[h] = he; - ht->used--; - /* Pass to the next element */ - he = nextHe; - } - } - assert(ht->used == 0); - Jim_Free(ht->table); - - /* Remap the new hashtable in the old */ - *ht = n; - return JIM_OK; -} - -/* Add an element to the target hash table */ -int Jim_AddHashEntry(Jim_HashTable *ht, const void *key, void *val) -{ - int index_t; - Jim_HashEntry *entry; - - /* Get the index of the new element, or -1 if - * the element already exists. */ - if ((index_t = JimInsertHashEntry(ht, key)) == -1) - return JIM_ERR; - - /* Allocates the memory and stores key */ - entry = Jim_Alloc(sizeof(*entry)); - entry->next = ht->table[index_t]; - ht->table[index_t] = entry; - - /* Set the hash entry fields. */ - Jim_SetHashKey(ht, entry, key); - Jim_SetHashVal(ht, entry, val); - ht->used++; - return JIM_OK; -} - -/* Add an element, discarding the old if the key already exists */ -int Jim_ReplaceHashEntry(Jim_HashTable *ht, const void *key, void *val) -{ - Jim_HashEntry *entry; - - /* Try to add the element. If the key - * does not exists Jim_AddHashEntry will suceed. */ - if (Jim_AddHashEntry(ht, key, val) == JIM_OK) - return JIM_OK; - /* It already exists, get the entry */ - entry = Jim_FindHashEntry(ht, key); - /* Free the old value and set the new one */ - Jim_FreeEntryVal(ht, entry); - Jim_SetHashVal(ht, entry, val); - return JIM_OK; -} - -/* Search and remove an element */ -int Jim_DeleteHashEntry(Jim_HashTable *ht, const void *key) -{ - unsigned int h; - Jim_HashEntry *he, *prevHe; - - if (ht->size == 0) - return JIM_ERR; - h = Jim_HashKey(ht, key) & ht->sizemask; - he = ht->table[h]; - - prevHe = NULL; - while (he) { - if (Jim_CompareHashKeys(ht, key, he->key)) { - /* Unlink the element from the list */ - if (prevHe) - prevHe->next = he->next; - else - ht->table[h] = he->next; - Jim_FreeEntryKey(ht, he); - Jim_FreeEntryVal(ht, he); - Jim_Free(he); - ht->used--; - return JIM_OK; - } - prevHe = he; - he = he->next; - } - return JIM_ERR; /* not found */ -} - -/* Destroy an entire hash table */ -int Jim_FreeHashTable(Jim_HashTable *ht) -{ - unsigned int i; - - /* Free all the elements */ - for (i = 0; i < ht->size && ht->used > 0; i++) { - Jim_HashEntry *he, *nextHe; - - if ((he = ht->table[i]) == NULL) continue; - while (he) { - nextHe = he->next; - Jim_FreeEntryKey(ht, he); - Jim_FreeEntryVal(ht, he); - Jim_Free(he); - ht->used--; - he = nextHe; - } - } - /* Free the table and the allocated cache structure */ - Jim_Free(ht->table); - /* Re-initialize the table */ - JimResetHashTable(ht); - return JIM_OK; /* never fails */ -} - -Jim_HashEntry *Jim_FindHashEntry(Jim_HashTable *ht, const void *key) -{ - Jim_HashEntry *he; - unsigned int h; - - if (ht->size == 0) return NULL; - h = Jim_HashKey(ht, key) & ht->sizemask; - he = ht->table[h]; - while (he) { - if (Jim_CompareHashKeys(ht, key, he->key)) - return he; - he = he->next; - } - return NULL; -} - -Jim_HashTableIterator *Jim_GetHashTableIterator(Jim_HashTable *ht) -{ - Jim_HashTableIterator *iter = Jim_Alloc(sizeof(*iter)); - - iter->ht = ht; - iter->index = -1; - iter->entry = NULL; - iter->nextEntry = NULL; - return iter; -} - -Jim_HashEntry *Jim_NextHashEntry(Jim_HashTableIterator *iter) -{ - while (1) { - if (iter->entry == NULL) { - iter->index++; - if (iter->index >= - (signed)iter->ht->size) break; - iter->entry = iter->ht->table[iter->index]; - } else { - iter->entry = iter->nextEntry; - } - if (iter->entry) { - /* We need to save the 'next' here, the iterator user - * may delete the entry we are returning. */ - iter->nextEntry = iter->entry->next; - return iter->entry; - } - } - return NULL; -} - -/* ------------------------- private functions ------------------------------ */ - -/* Expand the hash table if needed */ -static int JimExpandHashTableIfNeeded(Jim_HashTable *ht) -{ - /* If the hash table is empty expand it to the intial size, - * if the table is "full" dobule its size. */ - if (ht->size == 0) - return Jim_ExpandHashTable(ht, JIM_HT_INITIAL_SIZE); - if (ht->size == ht->used) - return Jim_ExpandHashTable(ht, ht->size*2); - return JIM_OK; -} - -/* Our hash table capability is a power of two */ -static unsigned int JimHashTableNextPower(unsigned int size) -{ - unsigned int i = JIM_HT_INITIAL_SIZE; - - if (size >= 2147483648U) - return 2147483648U; - while (1) { - if (i >= size) - return i; - i *= 2; - } -} - -/* Returns the index of a free slot that can be populated with - * an hash entry for the given 'key'. - * If the key already exists, -1 is returned. */ -static int JimInsertHashEntry(Jim_HashTable *ht, const void *key) -{ - unsigned int h; - Jim_HashEntry *he; - - /* Expand the hashtable if needed */ - if (JimExpandHashTableIfNeeded(ht) == JIM_ERR) - return -1; - /* Compute the key hash value */ - h = Jim_HashKey(ht, key) & ht->sizemask; - /* Search if this slot does not already contain the given key */ - he = ht->table[h]; - while (he) { - if (Jim_CompareHashKeys(ht, key, he->key)) - return -1; - he = he->next; - } - return h; -} - -/* ----------------------- StringCopy Hash Table Type ------------------------*/ - -static unsigned int JimStringCopyHTHashFunction(const void *key) -{ - return Jim_GenHashFunction(key, strlen(key)); -} - -static const void *JimStringCopyHTKeyDup(void *privdata, const void *key) -{ - int len = strlen(key); - char *copy = Jim_Alloc(len + 1); - JIM_NOTUSED(privdata); - - memcpy(copy, key, len); - copy[len] = '\0'; - return copy; -} - -static void *JimStringKeyValCopyHTValDup(void *privdata, const void *val) -{ - int len = strlen(val); - char *copy = Jim_Alloc(len + 1); - JIM_NOTUSED(privdata); - - memcpy(copy, val, len); - copy[len] = '\0'; - return copy; -} - -static int JimStringCopyHTKeyCompare(void *privdata, const void *key1, - const void *key2) -{ - JIM_NOTUSED(privdata); - - return strcmp(key1, key2) == 0; -} - -static void JimStringCopyHTKeyDestructor(void *privdata, const void *key) -{ - JIM_NOTUSED(privdata); - - Jim_Free((void*)key); /* ATTENTION: const cast */ -} - -static void JimStringKeyValCopyHTValDestructor(void *privdata, void *val) -{ - JIM_NOTUSED(privdata); - - Jim_Free((void*)val); /* ATTENTION: const cast */ -} - -static Jim_HashTableType JimStringCopyHashTableType = { - JimStringCopyHTHashFunction, /* hash function */ - JimStringCopyHTKeyDup, /* key dup */ - NULL, /* val dup */ - JimStringCopyHTKeyCompare, /* key compare */ - JimStringCopyHTKeyDestructor, /* key destructor */ - NULL /* val destructor */ -}; - -/* This is like StringCopy but does not auto-duplicate the key. - * It's used for intepreter's shared strings. */ -static Jim_HashTableType JimSharedStringsHashTableType = { - JimStringCopyHTHashFunction, /* hash function */ - NULL, /* key dup */ - NULL, /* val dup */ - JimStringCopyHTKeyCompare, /* key compare */ - JimStringCopyHTKeyDestructor, /* key destructor */ - NULL /* val destructor */ -}; - -/* This is like StringCopy but also automatically handle dynamic - * allocated C strings as values. */ -static Jim_HashTableType JimStringKeyValCopyHashTableType = { - JimStringCopyHTHashFunction, /* hash function */ - JimStringCopyHTKeyDup, /* key dup */ - JimStringKeyValCopyHTValDup, /* val dup */ - JimStringCopyHTKeyCompare, /* key compare */ - JimStringCopyHTKeyDestructor, /* key destructor */ - JimStringKeyValCopyHTValDestructor, /* val destructor */ -}; - -typedef struct AssocDataValue { - Jim_InterpDeleteProc *delProc; - void *data; -} AssocDataValue; - -static void JimAssocDataHashTableValueDestructor(void *privdata, void *data) -{ - AssocDataValue *assocPtr = (AssocDataValue *)data; - if (assocPtr->delProc != NULL) - assocPtr->delProc((Jim_Interp *)privdata, assocPtr->data); - Jim_Free(data); -} - -static Jim_HashTableType JimAssocDataHashTableType = { - JimStringCopyHTHashFunction, /* hash function */ - JimStringCopyHTKeyDup, /* key dup */ - NULL, /* val dup */ - JimStringCopyHTKeyCompare, /* key compare */ - JimStringCopyHTKeyDestructor, /* key destructor */ - JimAssocDataHashTableValueDestructor /* val destructor */ -}; - -/* ----------------------------------------------------------------------------- - * Stack - This is a simple generic stack implementation. It is used for - * example in the 'expr' expression compiler. - * ---------------------------------------------------------------------------*/ -void Jim_InitStack(Jim_Stack *stack) -{ - stack->len = 0; - stack->maxlen = 0; - stack->vector = NULL; -} - -void Jim_FreeStack(Jim_Stack *stack) -{ - Jim_Free(stack->vector); -} - -int Jim_StackLen(Jim_Stack *stack) -{ - return stack->len; -} - -void Jim_StackPush(Jim_Stack *stack, void *element) { - int neededLen = stack->len + 1; - if (neededLen > stack->maxlen) { - stack->maxlen = neededLen*2; - stack->vector = Jim_Realloc(stack->vector, sizeof(void*)*stack->maxlen); - } - stack->vector[stack->len] = element; - stack->len++; -} - -void *Jim_StackPop(Jim_Stack *stack) -{ - if (stack->len == 0) return NULL; - stack->len--; - return stack->vector[stack->len]; -} - -void *Jim_StackPeek(Jim_Stack *stack) -{ - if (stack->len == 0) return NULL; - return stack->vector[stack->len-1]; -} - -void Jim_FreeStackElements(Jim_Stack *stack, void (*freeFunc)(void *ptr)) -{ - int i; - - for (i = 0; i < stack->len; i++) - freeFunc(stack->vector[i]); -} - -/* ----------------------------------------------------------------------------- - * Parser - * ---------------------------------------------------------------------------*/ - -/* Token types */ -#define JIM_TT_NONE -1 /* No token returned */ -#define JIM_TT_STR 0 /* simple string */ -#define JIM_TT_ESC 1 /* string that needs escape chars conversion */ -#define JIM_TT_VAR 2 /* var substitution */ -#define JIM_TT_DICTSUGAR 3 /* Syntax sugar for [dict get], $foo(bar) */ -#define JIM_TT_CMD 4 /* command substitution */ -#define JIM_TT_SEP 5 /* word separator */ -#define JIM_TT_EOL 6 /* line separator */ - -/* Additional token types needed for expressions */ -#define JIM_TT_SUBEXPR_START 7 -#define JIM_TT_SUBEXPR_END 8 -#define JIM_TT_EXPR_NUMBER 9 -#define JIM_TT_EXPR_OPERATOR 10 - -/* Parser states */ -#define JIM_PS_DEF 0 /* Default state */ -#define JIM_PS_QUOTE 1 /* Inside "" */ - -/* Parser context structure. The same context is used both to parse - * Tcl scripts and lists. */ -struct JimParserCtx { - const char *prg; /* Program text */ - const char *p; /* Pointer to the point of the program we are parsing */ - int len; /* Left length of 'prg' */ - int linenr; /* Current line number */ - const char *tstart; - const char *tend; /* Returned token is at tstart-tend in 'prg'. */ - int tline; /* Line number of the returned token */ - int tt; /* Token type */ - int eof; /* Non zero if EOF condition is true. */ - int state; /* Parser state */ - int comment; /* Non zero if the next chars may be a comment. */ -}; - -#define JimParserEof(c) ((c)->eof) -#define JimParserTstart(c) ((c)->tstart) -#define JimParserTend(c) ((c)->tend) -#define JimParserTtype(c) ((c)->tt) -#define JimParserTline(c) ((c)->tline) - -static int JimParseScript(struct JimParserCtx *pc); -static int JimParseSep(struct JimParserCtx *pc); -static int JimParseEol(struct JimParserCtx *pc); -static int JimParseCmd(struct JimParserCtx *pc); -static int JimParseVar(struct JimParserCtx *pc); -static int JimParseBrace(struct JimParserCtx *pc); -static int JimParseStr(struct JimParserCtx *pc); -static int JimParseComment(struct JimParserCtx *pc); -static char *JimParserGetToken(struct JimParserCtx *pc, - int *lenPtr, int *typePtr, int *linePtr); - -/* Initialize a parser context. - * 'prg' is a pointer to the program text, linenr is the line - * number of the first line contained in the program. */ -void JimParserInit(struct JimParserCtx *pc, const char *prg, - int len, int linenr) -{ - pc->prg = prg; - pc->p = prg; - pc->len = len; - pc->tstart = NULL; - pc->tend = NULL; - pc->tline = 0; - pc->tt = JIM_TT_NONE; - pc->eof = 0; - pc->state = JIM_PS_DEF; - pc->linenr = linenr; - pc->comment = 1; -} - -int JimParseScript(struct JimParserCtx *pc) -{ - while (1) { /* the while is used to reiterate with continue if needed */ - if (!pc->len) { - pc->tstart = pc->p; - pc->tend = pc->p-1; - pc->tline = pc->linenr; - pc->tt = JIM_TT_EOL; - pc->eof = 1; - return JIM_OK; - } - switch (*(pc->p)) { - case '\\': - if (*(pc->p + 1) == '\n') - return JimParseSep(pc); - else { - pc->comment = 0; - return JimParseStr(pc); - } - break; - case ' ': - case '\t': - case '\r': - if (pc->state == JIM_PS_DEF) - return JimParseSep(pc); - else { - pc->comment = 0; - return JimParseStr(pc); - } - break; - case '\n': - case ';': - pc->comment = 1; - if (pc->state == JIM_PS_DEF) - return JimParseEol(pc); - else - return JimParseStr(pc); - break; - case '[': - pc->comment = 0; - return JimParseCmd(pc); - break; - case '$': - pc->comment = 0; - if (JimParseVar(pc) == JIM_ERR) { - pc->tstart = pc->tend = pc->p++; pc->len--; - pc->tline = pc->linenr; - pc->tt = JIM_TT_STR; - return JIM_OK; - } else - return JIM_OK; - break; - case '#': - if (pc->comment) { - JimParseComment(pc); - continue; - } else { - return JimParseStr(pc); - } - default: - pc->comment = 0; - return JimParseStr(pc); - break; - } - return JIM_OK; - } -} - -int JimParseSep(struct JimParserCtx *pc) -{ - pc->tstart = pc->p; - pc->tline = pc->linenr; - while (*pc->p == ' ' || *pc->p == '\t' || *pc->p == '\r' || - (*pc->p == '\\' && *(pc->p + 1) == '\n')) { - if (*pc->p == '\\') { - pc->p++; pc->len--; - pc->linenr++; - } - pc->p++; pc->len--; - } - pc->tend = pc->p-1; - pc->tt = JIM_TT_SEP; - return JIM_OK; -} - -int JimParseEol(struct JimParserCtx *pc) -{ - pc->tstart = pc->p; - pc->tline = pc->linenr; - while (*pc->p == ' ' || *pc->p == '\n' || - *pc->p == '\t' || *pc->p == '\r' || *pc->p == ';') { - if (*pc->p == '\n') - pc->linenr++; - pc->p++; pc->len--; - } - pc->tend = pc->p-1; - pc->tt = JIM_TT_EOL; - return JIM_OK; -} - -/* Todo. Don't stop if ']' appears inside {} or quoted. - * Also should handle the case of puts [string length "]"] */ -int JimParseCmd(struct JimParserCtx *pc) -{ - int level = 1; - int blevel = 0; - - pc->tstart = ++pc->p; pc->len--; - pc->tline = pc->linenr; - while (1) { - if (pc->len == 0) { - break; - } else if (*pc->p == '[' && blevel == 0) { - level++; - } else if (*pc->p == ']' && blevel == 0) { - level--; - if (!level) break; - } else if (*pc->p == '\\') { - pc->p++; pc->len--; - } else if (*pc->p == '{') { - blevel++; - } else if (*pc->p == '}') { - if (blevel != 0) - blevel--; - } else if (*pc->p == '\n') - pc->linenr++; - pc->p++; pc->len--; - } - pc->tend = pc->p-1; - pc->tt = JIM_TT_CMD; - if (*pc->p == ']') { - pc->p++; pc->len--; - } - return JIM_OK; -} - -int JimParseVar(struct JimParserCtx *pc) -{ - int brace = 0, stop = 0, ttype = JIM_TT_VAR; - - pc->tstart = ++pc->p; pc->len--; /* skip the $ */ - pc->tline = pc->linenr; - if (*pc->p == '{') { - pc->tstart = ++pc->p; pc->len--; - brace = 1; - } - if (brace) { - while (!stop) { - if (*pc->p == '}' || pc->len == 0) { - pc->tend = pc->p-1; - stop = 1; - if (pc->len == 0) - break; - } - else if (*pc->p == '\n') - pc->linenr++; - pc->p++; pc->len--; - } - } else { - /* Include leading colons */ - while (*pc->p == ':') { - pc->p++; - pc->len--; - } - while (!stop) { - if (!((*pc->p >= 'a' && *pc->p <= 'z') || - (*pc->p >= 'A' && *pc->p <= 'Z') || - (*pc->p >= '0' && *pc->p <= '9') || *pc->p == '_')) - stop = 1; - else { - pc->p++; pc->len--; - } - } - /* Parse [dict get] syntax sugar. */ - if (*pc->p == '(') { - while (*pc->p != ')' && pc->len) { - pc->p++; pc->len--; - if (*pc->p == '\\' && pc->len >= 2) { - pc->p += 2; pc->len -= 2; - } - } - if (*pc->p != '\0') { - pc->p++; pc->len--; - } - ttype = JIM_TT_DICTSUGAR; - } - pc->tend = pc->p-1; - } - /* Check if we parsed just the '$' character. - * That's not a variable so an error is returned - * to tell the state machine to consider this '$' just - * a string. */ - if (pc->tstart == pc->p) { - pc->p--; pc->len++; - return JIM_ERR; - } - pc->tt = ttype; - return JIM_OK; -} - -int JimParseBrace(struct JimParserCtx *pc) -{ - int level = 1; - - pc->tstart = ++pc->p; pc->len--; - pc->tline = pc->linenr; - while (1) { - if (*pc->p == '\\' && pc->len >= 2) { - pc->p++; pc->len--; - if (*pc->p == '\n') - pc->linenr++; - } else if (*pc->p == '{') { - level++; - } else if (pc->len == 0 || *pc->p == '}') { - level--; - if (pc->len == 0 || level == 0) { - pc->tend = pc->p-1; - if (pc->len != 0) { - pc->p++; pc->len--; - } - pc->tt = JIM_TT_STR; - return JIM_OK; - } - } else if (*pc->p == '\n') { - pc->linenr++; - } - pc->p++; pc->len--; - } - return JIM_OK; /* unreached */ -} - -int JimParseStr(struct JimParserCtx *pc) -{ - int newword = (pc->tt == JIM_TT_SEP || pc->tt == JIM_TT_EOL || - pc->tt == JIM_TT_NONE || pc->tt == JIM_TT_STR); - if (newword && *pc->p == '{') { - return JimParseBrace(pc); - } else if (newword && *pc->p == '"') { - pc->state = JIM_PS_QUOTE; - pc->p++; pc->len--; - } - pc->tstart = pc->p; - pc->tline = pc->linenr; - while (1) { - if (pc->len == 0) { - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - return JIM_OK; - } - switch (*pc->p) { - case '\\': - if (pc->state == JIM_PS_DEF && - *(pc->p + 1) == '\n') { - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - return JIM_OK; - } - if (pc->len >= 2) { - pc->p++; pc->len--; - } - break; - case '$': - case '[': - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - return JIM_OK; - case ' ': - case '\t': - case '\n': - case '\r': - case ';': - if (pc->state == JIM_PS_DEF) { - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - return JIM_OK; - } else if (*pc->p == '\n') { - pc->linenr++; - } - break; - case '"': - if (pc->state == JIM_PS_QUOTE) { - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - pc->p++; pc->len--; - pc->state = JIM_PS_DEF; - return JIM_OK; - } - break; - } - pc->p++; pc->len--; - } - return JIM_OK; /* unreached */ -} - -int JimParseComment(struct JimParserCtx *pc) -{ - while (*pc->p) { - if (*pc->p == '\n') { - pc->linenr++; - if (*(pc->p-1) != '\\') { - pc->p++; pc->len--; - return JIM_OK; - } - } - pc->p++; pc->len--; - } - return JIM_OK; -} - -/* xdigitval and odigitval are helper functions for JimParserGetToken() */ -static int xdigitval(int c) -{ - if (c >= '0' && c <= '9') return c-'0'; - if (c >= 'a' && c <= 'f') return c-'a'+10; - if (c >= 'A' && c <= 'F') return c-'A'+10; - return -1; -} - -static int odigitval(int c) -{ - if (c >= '0' && c <= '7') return c-'0'; - return -1; -} - -/* Perform Tcl escape substitution of 's', storing the result - * string into 'dest'. The escaped string is guaranteed to - * be the same length or shorted than the source string. - * Slen is the length of the string at 's', if it's -1 the string - * length will be calculated by the function. - * - * The function returns the length of the resulting string. */ -static int JimEscape(char *dest, const char *s, int slen) -{ - char *p = dest; - int i, len; - - if (slen == -1) - slen = strlen(s); - - for (i = 0; i < slen; i++) { - switch (s[i]) { - case '\\': - switch (s[i + 1]) { - case 'a': *p++ = 0x7; i++; break; - case 'b': *p++ = 0x8; i++; break; - case 'f': *p++ = 0xc; i++; break; - case 'n': *p++ = 0xa; i++; break; - case 'r': *p++ = 0xd; i++; break; - case 't': *p++ = 0x9; i++; break; - case 'v': *p++ = 0xb; i++; break; - case '\0': *p++ = '\\'; i++; break; - case '\n': *p++ = ' '; i++; break; - default: - if (s[i + 1] == 'x') { - int val = 0; - int c = xdigitval(s[i + 2]); - if (c == -1) { - *p++ = 'x'; - i++; - break; - } - val = c; - c = xdigitval(s[i + 3]); - if (c == -1) { - *p++ = val; - i += 2; - break; - } - val = (val*16) + c; - *p++ = val; - i += 3; - break; - } else if (s[i + 1] >= '0' && s[i + 1] <= '7') - { - int val = 0; - int c = odigitval(s[i + 1]); - val = c; - c = odigitval(s[i + 2]); - if (c == -1) { - *p++ = val; - i ++; - break; - } - val = (val*8) + c; - c = odigitval(s[i + 3]); - if (c == -1) { - *p++ = val; - i += 2; - break; - } - val = (val*8) + c; - *p++ = val; - i += 3; - } else { - *p++ = s[i + 1]; - i++; - } - break; - } - break; - default: - *p++ = s[i]; - break; - } - } - len = p-dest; - *p++ = '\0'; - return len; -} - -/* Returns a dynamically allocated copy of the current token in the - * parser context. The function perform conversion of escapes if - * the token is of type JIM_TT_ESC. - * - * Note that after the conversion, tokens that are grouped with - * braces in the source code, are always recognizable from the - * identical string obtained in a different way from the type. - * - * For exmple the string: - * - * {expand}$a - * - * will return as first token "expand", of type JIM_TT_STR - * - * While the string: - * - * expand$a - * - * will return as first token "expand", of type JIM_TT_ESC - */ -char *JimParserGetToken(struct JimParserCtx *pc, - int *lenPtr, int *typePtr, int *linePtr) -{ - const char *start, *end; - char *token; - int len; - - start = JimParserTstart(pc); - end = JimParserTend(pc); - if (start > end) { - if (lenPtr) *lenPtr = 0; - if (typePtr) *typePtr = JimParserTtype(pc); - if (linePtr) *linePtr = JimParserTline(pc); - token = Jim_Alloc(1); - token[0] = '\0'; - return token; - } - len = (end-start) + 1; - token = Jim_Alloc(len + 1); - if (JimParserTtype(pc) != JIM_TT_ESC) { - /* No escape conversion needed? Just copy it. */ - memcpy(token, start, len); - token[len] = '\0'; - } else { - /* Else convert the escape chars. */ - len = JimEscape(token, start, len); - } - if (lenPtr) *lenPtr = len; - if (typePtr) *typePtr = JimParserTtype(pc); - if (linePtr) *linePtr = JimParserTline(pc); - return token; -} - -/* The following functin is not really part of the parsing engine of Jim, - * but it somewhat related. Given an string and its length, it tries - * to guess if the script is complete or there are instead " " or { } - * open and not completed. This is useful for interactive shells - * implementation and for [info complete]. - * - * If 'stateCharPtr' != NULL, the function stores ' ' on complete script, - * '{' on scripts incomplete missing one or more '}' to be balanced. - * '"' on scripts incomplete missing a '"' char. - * - * If the script is complete, 1 is returned, otherwise 0. */ -int Jim_ScriptIsComplete(const char *s, int len, char *stateCharPtr) -{ - int level = 0; - int state = ' '; - - while (len) { - switch (*s) { - case '\\': - if (len > 1) - s++; - break; - case '"': - if (state == ' ') { - state = '"'; - } else if (state == '"') { - state = ' '; - } - break; - case '{': - if (state == '{') { - level++; - } else if (state == ' ') { - state = '{'; - level++; - } - break; - case '}': - if (state == '{') { - level--; - if (level == 0) - state = ' '; - } - break; - } - s++; - len--; - } - if (stateCharPtr) - *stateCharPtr = state; - return state == ' '; -} - -/* ----------------------------------------------------------------------------- - * Tcl Lists parsing - * ---------------------------------------------------------------------------*/ -static int JimParseListSep(struct JimParserCtx *pc); -static int JimParseListStr(struct JimParserCtx *pc); - -int JimParseList(struct JimParserCtx *pc) -{ - if (pc->len == 0) { - pc->tstart = pc->tend = pc->p; - pc->tline = pc->linenr; - pc->tt = JIM_TT_EOL; - pc->eof = 1; - return JIM_OK; - } - switch (*pc->p) { - case ' ': - case '\n': - case '\t': - case '\r': - if (pc->state == JIM_PS_DEF) - return JimParseListSep(pc); - else - return JimParseListStr(pc); - break; - default: - return JimParseListStr(pc); - break; - } - return JIM_OK; -} - -int JimParseListSep(struct JimParserCtx *pc) -{ - pc->tstart = pc->p; - pc->tline = pc->linenr; - while (*pc->p == ' ' || *pc->p == '\t' || *pc->p == '\r' || *pc->p == '\n') - { - pc->p++; pc->len--; - } - pc->tend = pc->p-1; - pc->tt = JIM_TT_SEP; - return JIM_OK; -} - -int JimParseListStr(struct JimParserCtx *pc) -{ - int newword = (pc->tt == JIM_TT_SEP || pc->tt == JIM_TT_EOL || - pc->tt == JIM_TT_NONE); - if (newword && *pc->p == '{') { - return JimParseBrace(pc); - } else if (newword && *pc->p == '"') { - pc->state = JIM_PS_QUOTE; - pc->p++; pc->len--; - } - pc->tstart = pc->p; - pc->tline = pc->linenr; - while (1) { - if (pc->len == 0) { - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - return JIM_OK; - } - switch (*pc->p) { - case '\\': - pc->p++; pc->len--; - break; - case ' ': - case '\t': - case '\n': - case '\r': - if (pc->state == JIM_PS_DEF) { - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - return JIM_OK; - } else if (*pc->p == '\n') { - pc->linenr++; - } - break; - case '"': - if (pc->state == JIM_PS_QUOTE) { - pc->tend = pc->p-1; - pc->tt = JIM_TT_ESC; - pc->p++; pc->len--; - pc->state = JIM_PS_DEF; - return JIM_OK; - } - break; - } - pc->p++; pc->len--; - } - return JIM_OK; /* unreached */ -} - -/* ----------------------------------------------------------------------------- - * Jim_Obj related functions - * ---------------------------------------------------------------------------*/ - -/* Return a new initialized object. */ -Jim_Obj *Jim_NewObj(Jim_Interp *interp) -{ - Jim_Obj *objPtr; - - /* -- Check if there are objects in the free list -- */ - if (interp->freeList != NULL) { - /* -- Unlink the object from the free list -- */ - objPtr = interp->freeList; - interp->freeList = objPtr->nextObjPtr; - } else { - /* -- No ready to use objects: allocate a new one -- */ - objPtr = Jim_Alloc(sizeof(*objPtr)); - } - - /* Object is returned with refCount of 0. Every - * kind of GC implemented should take care to don't try - * to scan objects with refCount == 0. */ - objPtr->refCount = 0; - /* All the other fields are left not initialized to save time. - * The caller will probably want set they to the right - * value anyway. */ - - /* -- Put the object into the live list -- */ - objPtr->prevObjPtr = NULL; - objPtr->nextObjPtr = interp->liveList; - if (interp->liveList) - interp->liveList->prevObjPtr = objPtr; - interp->liveList = objPtr; - - return objPtr; -} - -/* Free an object. Actually objects are never freed, but - * just moved to the free objects list, where they will be - * reused by Jim_NewObj(). */ -void Jim_FreeObj(Jim_Interp *interp, Jim_Obj *objPtr) -{ - /* Check if the object was already freed, panic. */ - if (objPtr->refCount != 0) { - Jim_Panic(interp,"!!!Object %p freed with bad refcount %d", objPtr, - objPtr->refCount); - } - /* Free the internal representation */ - Jim_FreeIntRep(interp, objPtr); - /* Free the string representation */ - if (objPtr->bytes != NULL) { - if (objPtr->bytes != JimEmptyStringRep) - Jim_Free(objPtr->bytes); - } - /* Unlink the object from the live objects list */ - if (objPtr->prevObjPtr) - objPtr->prevObjPtr->nextObjPtr = objPtr->nextObjPtr; - if (objPtr->nextObjPtr) - objPtr->nextObjPtr->prevObjPtr = objPtr->prevObjPtr; - if (interp->liveList == objPtr) - interp->liveList = objPtr->nextObjPtr; - /* Link the object into the free objects list */ - objPtr->prevObjPtr = NULL; - objPtr->nextObjPtr = interp->freeList; - if (interp->freeList) - interp->freeList->prevObjPtr = objPtr; - interp->freeList = objPtr; - objPtr->refCount = -1; -} - -/* Invalidate the string representation of an object. */ -void Jim_InvalidateStringRep(Jim_Obj *objPtr) -{ - if (objPtr->bytes != NULL) { - if (objPtr->bytes != JimEmptyStringRep) - Jim_Free(objPtr->bytes); - } - objPtr->bytes = NULL; -} - -#define Jim_SetStringRep(o, b, l) \ - do { (o)->bytes = b; (o)->length = l; } while (0) - -/* Set the initial string representation for an object. - * Does not try to free an old one. */ -void Jim_InitStringRep(Jim_Obj *objPtr, const char *bytes, int length) -{ - if (length == 0) { - objPtr->bytes = JimEmptyStringRep; - objPtr->length = 0; - } else { - objPtr->bytes = Jim_Alloc(length + 1); - objPtr->length = length; - memcpy(objPtr->bytes, bytes, length); - objPtr->bytes[length] = '\0'; - } -} - -/* Duplicate an object. The returned object has refcount = 0. */ -Jim_Obj *Jim_DuplicateObj(Jim_Interp *interp, Jim_Obj *objPtr) -{ - Jim_Obj *dupPtr; - - dupPtr = Jim_NewObj(interp); - if (objPtr->bytes == NULL) { - /* Object does not have a valid string representation. */ - dupPtr->bytes = NULL; - } else { - Jim_InitStringRep(dupPtr, objPtr->bytes, objPtr->length); - } - if (objPtr->typePtr != NULL) { - if (objPtr->typePtr->dupIntRepProc == NULL) { - dupPtr->internalRep = objPtr->internalRep; - } else { - objPtr->typePtr->dupIntRepProc(interp, objPtr, dupPtr); - } - dupPtr->typePtr = objPtr->typePtr; - } else { - dupPtr->typePtr = NULL; - } - return dupPtr; -} - -/* Return the string representation for objPtr. If the object - * string representation is invalid, calls the method to create - * a new one starting from the internal representation of the object. */ -const char *Jim_GetString(Jim_Obj *objPtr, int *lenPtr) -{ - if (objPtr->bytes == NULL) { - /* Invalid string repr. Generate it. */ - if (objPtr->typePtr->updateStringProc == NULL) { - Jim_Panic(NULL,"UpdataStringProc called against '%s' type.", - objPtr->typePtr->name); - } - objPtr->typePtr->updateStringProc(objPtr); - } - if (lenPtr) - *lenPtr = objPtr->length; - return objPtr->bytes; -} - -/* Just returns the length of the object's string rep */ -int Jim_Length(Jim_Obj *objPtr) -{ - int len; - - Jim_GetString(objPtr, &len); - return len; -} - -/* ----------------------------------------------------------------------------- - * String Object - * ---------------------------------------------------------------------------*/ -static void DupStringInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr); -static int SetStringFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr); - -static Jim_ObjType stringObjType = { - "string", - NULL, - DupStringInternalRep, - NULL, - JIM_TYPE_REFERENCES, -}; - -void DupStringInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) -{ - JIM_NOTUSED(interp); - - /* This is a bit subtle: the only caller of this function - * should be Jim_DuplicateObj(), that will copy the - * string representaion. After the copy, the duplicated - * object will not have more room in teh buffer than - * srcPtr->length bytes. So we just set it to length. */ - dupPtr->internalRep.strValue.maxLength ... [truncated message content] |
From: Øyvind H. <go...@us...> - 2010-06-16 00:03:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 8022940c5c3a12ecdbc8f8866351ee0ef5de1d35 (commit) via 72eb87673cefbd046416fc27579507b1192fae94 (commit) via e53836718664e507a9cb431444a0fc9021ebae04 (commit) via 0a837fc36bee177094cc064d8146c2a96e4a8f1d (commit) via 0365225c4860d5926c3aacbc2a91a98f873a364e (commit) from 953d96f1e2c6619da76f4925fdb62b7f54f0e0fd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8022940c5c3a12ecdbc8f8866351ee0ef5de1d35 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 00:02:58 2010 +0200 str7x: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index 46510ed..4c450af 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -625,7 +625,7 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, if (bytes_remaining) { uint8_t last_dword[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - int i = 0; + i = 0; while (bytes_remaining > 0) { @@ -680,7 +680,7 @@ COMMAND_HANDLER(str7x_handle_part_id_command) } #endif -static int str7x_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_str7x_info(struct flash_bank *bank, char *buf, int buf_size) { snprintf(buf, buf_size, "str7x flash driver info"); /* STR7x flash doesn't support sector protection interrogation. @@ -795,5 +795,5 @@ struct flash_driver str7x_flash = { .auto_probe = str7x_probe, .erase_check = default_flash_blank_check, .protect_check = str7x_protect_check, - .info = str7x_info, + .info = get_str7x_info, }; commit 72eb87673cefbd046416fc27579507b1192fae94 Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Jun 16 00:00:57 2010 +0200 stm32x: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c index 47ed640..5ce5d45 100644 --- a/src/flash/nor/stm32x.c +++ b/src/flash/nor/stm32x.c @@ -814,7 +814,7 @@ COMMAND_HANDLER(stm32x_handle_part_id_command) } #endif -static int stm32x_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size) { struct target *target = bank->target; uint32_t device_id; @@ -1305,5 +1305,5 @@ struct flash_driver stm32x_flash = { .auto_probe = stm32x_auto_probe, .erase_check = default_flash_mem_blank_check, .protect_check = stm32x_protect_check, - .info = stm32x_info, + .info = get_stm32x_info, }; commit e53836718664e507a9cb431444a0fc9021ebae04 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:59:21 2010 +0200 stellaris: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index f7e2e8d..ff1c2e4 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -255,7 +255,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command) return ERROR_OK; } -static int stellaris_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_stellaris_info(struct flash_bank *bank, char *buf, int buf_size) { int printed, device_class; struct stellaris_flash_bank *stellaris_info = bank->driver_priv; @@ -1272,5 +1272,5 @@ struct flash_driver stellaris_flash = { .auto_probe = stellaris_probe, .erase_check = default_flash_mem_blank_check, .protect_check = stellaris_protect_check, - .info = stellaris_info, + .info = get_stellaris_info, }; commit 0a837fc36bee177094cc064d8146c2a96e4a8f1d Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:58:19 2010 +0200 lpc2900: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c index 3ae7bb4..e17823e 100644 --- a/src/flash/nor/lpc2900.c +++ b/src/flash/nor/lpc2900.c @@ -306,39 +306,39 @@ static uint32_t lpc2900_read_security_status( struct flash_bank *bank ) * a protected sector! */ int sector; - int index; + int index_t; for( sector = 0; sector < bank->num_sectors; sector++ ) { /* Convert logical sector number to physical sector number */ if( sector <= 4 ) { - index = sector + 11; + index_t = sector + 11; } else if( sector <= 7 ) { - index = sector + 27; + index_t = sector + 27; } else { - index = sector - 8; + index_t = sector - 8; } bank->sectors[sector].is_protected = -1; if ( - (iss_secured_field[index][0] == 0x00000000) && - (iss_secured_field[index][1] == 0x00000000) && - (iss_secured_field[index][2] == 0x00000000) && - (iss_secured_field[index][3] == 0x00000000) ) + (iss_secured_field[index_t][0] == 0x00000000) && + (iss_secured_field[index_t][1] == 0x00000000) && + (iss_secured_field[index_t][2] == 0x00000000) && + (iss_secured_field[index_t][3] == 0x00000000) ) { bank->sectors[sector].is_protected = 1; } if ( - (iss_secured_field[index][0] == 0xFFFFFFFF) && - (iss_secured_field[index][1] == 0xFFFFFFFF) && - (iss_secured_field[index][2] == 0xFFFFFFFF) && - (iss_secured_field[index][3] == 0xFFFFFFFF) ) + (iss_secured_field[index_t][0] == 0xFFFFFFFF) && + (iss_secured_field[index_t][1] == 0xFFFFFFFF) && + (iss_secured_field[index_t][2] == 0xFFFFFFFF) && + (iss_secured_field[index_t][3] == 0xFFFFFFFF) ) { bank->sectors[sector].is_protected = 0; } @@ -507,7 +507,7 @@ static int lpc2900_write_index_page( struct flash_bank *bank, * @param clock System clock in Hz * @param time Program/erase time in µs */ -static uint32_t lpc2900_calc_tr( uint32_t clock, uint32_t time ) +static uint32_t lpc2900_calc_tr( uint32_t clock_var, uint32_t time_var ) { /* ((time[µs]/1e6) * f[Hz]) + 511 * FPTR.TR = ------------------------------- @@ -516,7 +516,7 @@ static uint32_t lpc2900_calc_tr( uint32_t clock, uint32_t time ) * The result is the */ - uint32_t tr_val = (uint32_t)((((time / 1e6) * clock) + 511.0) / 512.0); + uint32_t tr_val = (uint32_t)((((time_var / 1e6) * clock_var) + 511.0) / 512.0); return tr_val; } @@ -1365,7 +1365,7 @@ static int lpc2900_write(struct flash_bank *bank, uint8_t *buffer, this_buffer = buffer; /* Make sure we stop at the next secured sector */ - int sector = start_sector + 1; + sector = start_sector + 1; while( sector < bank->num_sectors ) { /* Secured? */ commit 0365225c4860d5926c3aacbc2a91a98f873a364e Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:53:36 2010 +0200 lpc2000: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/lpc2000.c b/src/flash/nor/lpc2000.c index 154248c..866be50 100644 --- a/src/flash/nor/lpc2000.c +++ b/src/flash/nor/lpc2000.c @@ -594,7 +594,6 @@ static int lpc2000_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offs if ((offset == 0) && (count >= 0x20) && lpc2000_info->calc_checksum) { uint32_t checksum = 0; - int i; for (i = 0; i < 8; i++) { LOG_DEBUG("Vector 0x%2.2x: 0x%8.8" PRIx32, i * 4, buf_get_u32(buffer + (i * 4), 0, 32)); @@ -740,7 +739,7 @@ static int lpc2000_protect_check(struct flash_bank *bank) return ERROR_OK; } -static int lpc2000_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_lpc2000_info(struct flash_bank *bank, char *buf, int buf_size) { struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv; @@ -819,5 +818,5 @@ struct flash_driver lpc2000_flash = { .auto_probe = lpc2000_probe, .erase_check = lpc2000_erase_check, .protect_check = lpc2000_protect_check, - .info = lpc2000_info, + .info = get_lpc2000_info, }; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/lpc2000.c | 5 ++--- src/flash/nor/lpc2900.c | 30 +++++++++++++++--------------- src/flash/nor/stellaris.c | 4 ++-- src/flash/nor/stm32x.c | 4 ++-- src/flash/nor/str7x.c | 6 +++--- 5 files changed, 24 insertions(+), 25 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 23:33:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 953d96f1e2c6619da76f4925fdb62b7f54f0e0fd (commit) via 88aa5e31d1496c078c32c95708c62e464959496f (commit) from 90454525b6119b95226e02754d3a5c6e125c5922 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 953d96f1e2c6619da76f4925fdb62b7f54f0e0fd Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:32:47 2010 +0200 ecos flash: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/ecos.c b/src/flash/nor/ecos.c index f9c3285..945852d 100644 --- a/src/flash/nor/ecos.c +++ b/src/flash/nor/ecos.c @@ -173,7 +173,6 @@ static int loadDriver(struct ecosflash_flash_bank *info) for (i = 0; i < image.num_sections; i++) { void *buffer = malloc(image.sections[i].size); - int retval; if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK) { free(buffer); @@ -305,7 +304,6 @@ static int eCosBoard_flash(struct ecosflash_flash_bank *info, void *data, uint32 t = chunk; } - int retval; retval = target_write_buffer(target, buffer, t, ((uint8_t *)data) + i); if (retval != ERROR_OK) return retval; commit 88aa5e31d1496c078c32c95708c62e464959496f Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:31:36 2010 +0200 at91sam7: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/at91sam7.c b/src/flash/nor/at91sam7.c index 606cc32..3a809e2 100644 --- a/src/flash/nor/at91sam7.c +++ b/src/flash/nor/at91sam7.c @@ -298,7 +298,7 @@ static int at91sam7_read_part_info(struct flash_bank *bank) uint32_t ext_freq; uint32_t bank_size; uint32_t base_address = 0; - char *target_name = "Unknown"; + char *target_name_t = "Unknown"; at91sam7_info = t_bank->driver_priv; @@ -386,7 +386,7 @@ static int at91sam7_read_part_info(struct flash_bank *bank) if (arch == 0x70) { num_nvmbits = 2; - target_name = "AT91SAM7S161/16"; + target_name_t = "AT91SAM7S161/16"; } break; @@ -399,12 +399,12 @@ static int at91sam7_read_part_info(struct flash_bank *bank) if (arch == 0x70) { num_nvmbits = 2; - target_name = "AT91SAM7S321/32"; + target_name_t = "AT91SAM7S321/32"; } if (arch == 0x72) { num_nvmbits = 3; - target_name = "AT91SAM7SE32"; + target_name_t = "AT91SAM7SE32"; } break; @@ -417,7 +417,7 @@ static int at91sam7_read_part_info(struct flash_bank *bank) if (arch == 0x70) { num_nvmbits = 2; - target_name = "AT91SAM7S64"; + target_name_t = "AT91SAM7S64"; } break; @@ -430,22 +430,22 @@ static int at91sam7_read_part_info(struct flash_bank *bank) if (arch == 0x70) { num_nvmbits = 2; - target_name = "AT91SAM7S128"; + target_name_t = "AT91SAM7S128"; } if (arch == 0x71) { num_nvmbits = 3; - target_name = "AT91SAM7XC128"; + target_name_t = "AT91SAM7XC128"; } if (arch == 0x72) { num_nvmbits = 3; - target_name = "AT91SAM7SE128"; + target_name_t = "AT91SAM7SE128"; } if (arch == 0x75) { num_nvmbits = 3; - target_name = "AT91SAM7X128"; + target_name_t = "AT91SAM7X128"; } break; @@ -458,27 +458,27 @@ static int at91sam7_read_part_info(struct flash_bank *bank) if (arch == 0x60) { num_nvmbits = 3; - target_name = "AT91SAM7A3"; + target_name_t = "AT91SAM7A3"; } if (arch == 0x70) { num_nvmbits = 2; - target_name = "AT91SAM7S256"; + target_name_t = "AT91SAM7S256"; } if (arch == 0x71) { num_nvmbits = 3; - target_name = "AT91SAM7XC256"; + target_name_t = "AT91SAM7XC256"; } if (arch == 0x72) { num_nvmbits = 3; - target_name = "AT91SAM7SE256"; + target_name_t = "AT91SAM7SE256"; } if (arch == 0x75) { num_nvmbits = 3; - target_name = "AT91SAM7X256"; + target_name_t = "AT91SAM7X256"; } break; @@ -491,22 +491,22 @@ static int at91sam7_read_part_info(struct flash_bank *bank) if (arch == 0x70) { num_nvmbits = 2; - target_name = "AT91SAM7S512"; + target_name_t = "AT91SAM7S512"; } if (arch == 0x71) { num_nvmbits = 3; - target_name = "AT91SAM7XC512"; + target_name_t = "AT91SAM7XC512"; } if (arch == 0x72) { num_nvmbits = 3; - target_name = "AT91SAM7SE512"; + target_name_t = "AT91SAM7SE512"; } if (arch == 0x75) { num_nvmbits = 3; - target_name = "AT91SAM7X512"; + target_name_t = "AT91SAM7X512"; } break; @@ -517,7 +517,7 @@ static int at91sam7_read_part_info(struct flash_bank *bank) break; } - if (strcmp(target_name, "Unknown") == 0) + if (strcmp(target_name_t, "Unknown") == 0) { LOG_ERROR("Target autodetection failed! Please specify target parameters in configuration file"); return ERROR_FLASH_OPERATION_FAILED; @@ -573,7 +573,7 @@ static int at91sam7_read_part_info(struct flash_bank *bank) at91sam7_info->cidr_eproc = (cidr >> 5)&0x0007; at91sam7_info->cidr_version = cidr&0x001F; - at91sam7_info->target_name = target_name; + at91sam7_info->target_name = target_name_t; at91sam7_info->flashmode = 0; at91sam7_info->ext_freq = ext_freq; at91sam7_info->num_nvmbits = num_nvmbits; @@ -731,7 +731,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) uint16_t page_size; uint16_t num_nvmbits; - char *target_name; + char *target_name_t; int bnk, sec; @@ -775,8 +775,8 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) return ERROR_OK; } - target_name = calloc(strlen(CMD_ARGV[7]) + 1, sizeof(char)); - strcpy(target_name, CMD_ARGV[7]); + target_name_t = calloc(strlen(CMD_ARGV[7]) + 1, sizeof(char)); + strcpy(target_name_t, CMD_ARGV[7]); /* calculate bank size */ bank_size = num_sectors * pages_per_sector * page_size; @@ -816,7 +816,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) at91sam7_info = t_bank->driver_priv; - at91sam7_info->target_name = target_name; + at91sam7_info->target_name = target_name_t; at91sam7_info->flashmode = 0; at91sam7_info->ext_freq = ext_freq; at91sam7_info->num_nvmbits = num_nvmbits; @@ -1034,7 +1034,7 @@ static int at91sam7_probe(struct flash_bank *bank) return ERROR_OK; } -static int at91sam7_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_at91sam7_info(struct flash_bank *bank, char *buf, int buf_size) { int printed; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; @@ -1212,5 +1212,5 @@ struct flash_driver at91sam7_flash = { .auto_probe = at91sam7_probe, .erase_check = at91sam7_erase_check, .protect_check = at91sam7_protect_check, - .info = at91sam7_info, + .info = get_at91sam7_info, }; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/at91sam7.c | 52 +++++++++++++++++++++++----------------------- src/flash/nor/ecos.c | 2 - 2 files changed, 26 insertions(+), 28 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 23:29:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 90454525b6119b95226e02754d3a5c6e125c5922 (commit) from 4d0d649ef9a066c8662e2ffcc597614fe917fefc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 90454525b6119b95226e02754d3a5c6e125c5922 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:29:08 2010 +0200 flash: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 28a504e..3dc6cff 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -467,7 +467,7 @@ COMMAND_HANDLER(handle_flash_fill_command) uint32_t cur_size = 0; uint32_t chunk_count; struct target *target = get_current_target(CMD_CTX); - uint32_t i; + unsigned i; uint32_t wordsize; int retval = ERROR_OK; @@ -563,7 +563,6 @@ COMMAND_HANDLER(handle_flash_fill_command) goto done; } - unsigned i; for (i = 0; i < cur_size; i++) { if (readback[i]!=chunk[i]) ----------------------------------------------------------------------- Summary of changes: src/flash/nor/tcl.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 23:27:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4d0d649ef9a066c8662e2ffcc597614fe917fefc (commit) via 26a77f71e1d44d12af549c618a1b7010ff83ac2b (commit) via e85fe0a637d1be9c652ac1779218c1297aaaafec (commit) via 43a9282203d5fc0cf9086a18590c8ff89184b320 (commit) via 78b7a571e9f9c836189c06c095eb98a57761bc4f (commit) via 4bd415d01b70d3afb3aa5d4142dd0cc49a495fe0 (commit) via 8cfd25d29e5ce786eb001461e6d1ab9355b18597 (commit) via 97197c98ebd3c62061729fd5b4eb94eece262edb (commit) via da5979c38d7b373f6aa345ff8f961f5401e67902 (commit) via ab6e62ab76226a4596f7f728d8915acb61507b44 (commit) via 66f42b6f74125a98fed6d9402f6dc83a0f829100 (commit) via a09d6020e08ce1b81e8bf2647cd88ecab5c25887 (commit) via 748863c2e23aca05a81007ca87129a30eac005c4 (commit) from 64cf05f0c4dd5bd3856a57043c73933be0b2ba04 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4d0d649ef9a066c8662e2ffcc597614fe917fefc Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:27:08 2010 +0200 mips_ejtag: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index 84ad529..33507b5 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -304,7 +304,7 @@ int mips_ejtag_init(struct mips_ejtag *ejtag_info) return ERROR_OK; } -int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write, uint32_t *data) +int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data) { struct jtag_tap *tap; tap = ejtag_info->tap; @@ -325,7 +325,7 @@ int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write, uint32_t fields[1].num_bits = 32; fields[1].out_value = t; - if (write) + if (write_t) { fields[1].in_value = NULL; buf_set_u32(t, 0, 32, *data); commit 26a77f71e1d44d12af549c618a1b7010ff83ac2b Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:26:16 2010 +0200 mips32_pracc: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index d96867a..236f389 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -928,7 +928,7 @@ int mips32_pracc_read_regs(struct mips_ejtag *ejtag_info, uint32_t *regs) * 3. data ... */ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_area *source, - int write, uint32_t addr, int count, uint32_t *buf) + int write_t, uint32_t addr, int count, uint32_t *buf) { uint32_t handler_code[] = { /* caution when editing, table is modified below */ @@ -973,7 +973,7 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are if (source->size < MIPS32_FASTDATA_HANDLER_SIZE) return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; - if (write) + if (write_t) { handler_code[8] = MIPS32_LW(11,0,8); /* load data from probe at fastdata area */ handler_code[9] = MIPS32_SW(11,0,9); /* store data to RAM @ r9 */ @@ -1030,7 +1030,7 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are for (i = 0; i < count; i++) { /* Send the data out using fastdata (clears the access pending bit) */ - if ((retval = mips_ejtag_fastdata_scan(ejtag_info, write, buf++)) != ERROR_OK) + if ((retval = mips_ejtag_fastdata_scan(ejtag_info, write_t, buf++)) != ERROR_OK) return retval; } commit e85fe0a637d1be9c652ac1779218c1297aaaafec Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:25:32 2010 +0200 mips_m4k: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index 5604b6a..e258b71 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -951,7 +951,7 @@ int mips_m4k_bulk_write_memory(struct target *target, uint32_t address, struct mips_ejtag *ejtag_info = &mips32->ejtag_info; struct working_area *source; int retval; - int write = 1; + int write_t = 1; LOG_DEBUG("address: 0x%8.8" PRIx32 ", count: 0x%8.8" PRIx32 "", address, count); @@ -984,7 +984,7 @@ int mips_m4k_bulk_write_memory(struct target *target, uint32_t address, } } - retval = mips32_pracc_fastdata_xfer(ejtag_info, source, write, address, + retval = mips32_pracc_fastdata_xfer(ejtag_info, source, write_t, address, count, (uint32_t*) buffer); if (retval != ERROR_OK) { commit 43a9282203d5fc0cf9086a18590c8ff89184b320 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:24:47 2010 +0200 mips32: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/mips32.c b/src/target/mips32.c index 0923a79..2547b01 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -388,7 +388,7 @@ int mips32_run_algorithm(struct target *target, int num_mem_params, } /* refresh core register cache */ - for (unsigned i = 0; i < MIPS32NUMCOREREGS; i++) + for (i = 0; i < MIPS32NUMCOREREGS; i++) { if (!mips32->core_cache->reg_list[i].valid) mips32->read_core_reg(target, i); @@ -404,7 +404,7 @@ int mips32_run_algorithm(struct target *target, int num_mem_params, } } - for (int i = 0; i < num_reg_params; i++) + for (i = 0; i < num_reg_params; i++) { struct reg *reg = register_get_by_name(mips32->core_cache, reg_params[i].reg_name, 0); commit 78b7a571e9f9c836189c06c095eb98a57761bc4f Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:23:16 2010 +0200 cortex_a8: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index c2d61a3..0b12abe 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -473,7 +473,7 @@ static int cortex_a8_instr_read_data_r0(struct arm_dpm *dpm, return cortex_a8_read_dcc(a8, data, &dscr); } -static int cortex_a8_bpwp_enable(struct arm_dpm *dpm, unsigned index, +static int cortex_a8_bpwp_enable(struct arm_dpm *dpm, unsigned index_t, uint32_t addr, uint32_t control) { struct cortex_a8_common *a8 = dpm_to_a8(dpm); @@ -481,7 +481,7 @@ static int cortex_a8_bpwp_enable(struct arm_dpm *dpm, unsigned index, uint32_t cr = a8->armv7a_common.debug_base; int retval; - switch (index) { + switch (index_t) { case 0 ... 15: /* breakpoints */ vr += CPUDBG_BVR_BASE; cr += CPUDBG_BCR_BASE; @@ -489,13 +489,13 @@ static int cortex_a8_bpwp_enable(struct arm_dpm *dpm, unsigned index, case 16 ... 31: /* watchpoints */ vr += CPUDBG_WVR_BASE; cr += CPUDBG_WCR_BASE; - index -= 16; + index_t -= 16; break; default: return ERROR_FAIL; } - vr += 4 * index; - cr += 4 * index; + vr += 4 * index_t; + cr += 4 * index_t; LOG_DEBUG("A8: bpwp enable, vr %08x cr %08x", (unsigned) vr, (unsigned) cr); @@ -509,23 +509,23 @@ static int cortex_a8_bpwp_enable(struct arm_dpm *dpm, unsigned index, return retval; } -static int cortex_a8_bpwp_disable(struct arm_dpm *dpm, unsigned index) +static int cortex_a8_bpwp_disable(struct arm_dpm *dpm, unsigned index_t) { struct cortex_a8_common *a8 = dpm_to_a8(dpm); uint32_t cr; - switch (index) { + switch (index_t) { case 0 ... 15: cr = a8->armv7a_common.debug_base + CPUDBG_BCR_BASE; break; case 16 ... 31: cr = a8->armv7a_common.debug_base + CPUDBG_WCR_BASE; - index -= 16; + index_t -= 16; break; default: return ERROR_FAIL; } - cr += 4 * index; + cr += 4 * index_t; LOG_DEBUG("A8: bpwp disable, cr %08x", (unsigned) cr); commit 4bd415d01b70d3afb3aa5d4142dd0cc49a495fe0 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:22:24 2010 +0200 arm11_dbgtap: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index 18bf255..9ecd08f 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -898,7 +898,7 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions } /* Timeout here so we don't get stuck. */ - int i = 0; + int i_n = 0; while (1) { JTAG_DEBUG("SC7 <= c%-3d Data %08x %s", @@ -917,11 +917,11 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions long long then = 0; - if (i == 1000) + if (i_n == 1000) { then = timeval_ms(); } - if (i >= 1000) + if (i_n >= 1000) { if ((timeval_ms()-then) > 1000) { @@ -930,7 +930,7 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions } } - i++; + i_n++; } if (!nRW) @@ -1086,7 +1086,7 @@ static int arm11_dpm_instr_read_data_r0(struct arm_dpm *dpm, * and watchpoint operations instead of running them right away. Since we * pre-allocated our vector, we don't need to worry about space. */ -static int arm11_bpwp_enable(struct arm_dpm *dpm, unsigned index, +static int arm11_bpwp_enable(struct arm_dpm *dpm, unsigned index_t, uint32_t addr, uint32_t control) { struct arm11_common *arm11 = dpm_to_arm11(dpm); @@ -1104,15 +1104,15 @@ static int arm11_bpwp_enable(struct arm_dpm *dpm, unsigned index, action[0].value = addr; action[1].value = control; - switch (index) { + switch (index_t) { case 0 ... 15: - action[0].address = ARM11_SC7_BVR0 + index; - action[1].address = ARM11_SC7_BCR0 + index; + action[0].address = ARM11_SC7_BVR0 + index_t; + action[1].address = ARM11_SC7_BCR0 + index_t; break; case 16 ... 32: - index -= 16; - action[0].address = ARM11_SC7_WVR0 + index; - action[1].address = ARM11_SC7_WCR0 + index; + index_t -= 16; + action[0].address = ARM11_SC7_WVR0 + index_t; + action[1].address = ARM11_SC7_WCR0 + index_t; break; default: return ERROR_FAIL; @@ -1123,7 +1123,7 @@ static int arm11_bpwp_enable(struct arm_dpm *dpm, unsigned index, return ERROR_OK; } -static int arm11_bpwp_disable(struct arm_dpm *dpm, unsigned index) +static int arm11_bpwp_disable(struct arm_dpm *dpm, unsigned index_t) { struct arm11_common *arm11 = dpm_to_arm11(dpm); struct arm11_sc7_action *action; @@ -1133,13 +1133,13 @@ static int arm11_bpwp_disable(struct arm_dpm *dpm, unsigned index) action[0].write = true; action[0].value = 0; - switch (index) { + switch (index_t) { case 0 ... 15: - action[0].address = ARM11_SC7_BCR0 + index; + action[0].address = ARM11_SC7_BCR0 + index_t; break; case 16 ... 32: - index -= 16; - action[0].address = ARM11_SC7_WCR0 + index; + index_t -= 16; + action[0].address = ARM11_SC7_WCR0 + index_t; break; default: return ERROR_FAIL; commit 8cfd25d29e5ce786eb001461e6d1ab9355b18597 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:20:00 2010 +0200 arm926ejs: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 918306d..d68e5ca 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -59,7 +59,7 @@ static int arm926ejs_cp15_read(struct target *target, uint32_t op1, uint32_t op2 struct scan_field fields[4]; uint8_t address_buf[2] = {0, 0}; uint8_t nr_w_buf = 0; - uint8_t access = 1; + uint8_t access_t = 1; buf_set_u32(address_buf, 0, 14, address); @@ -74,8 +74,8 @@ static int arm926ejs_cp15_read(struct target *target, uint32_t op1, uint32_t op2 fields[0].in_value = (uint8_t *)value; fields[1].num_bits = 1; - fields[1].out_value = &access; - fields[1].in_value = &access; + fields[1].out_value = &access_t; + fields[1].in_value = &access_t; fields[2].num_bits = 14; fields[2].out_value = address_buf; @@ -92,7 +92,7 @@ static int arm926ejs_cp15_read(struct target *target, uint32_t op1, uint32_t op2 for (;;) { /* rescan with NOP, to wait for the access to complete */ - access = 0; + access_t = 0; nr_w_buf = 0; jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE); @@ -103,7 +103,7 @@ static int arm926ejs_cp15_read(struct target *target, uint32_t op1, uint32_t op2 return retval; } - if (buf_get_u32(&access, 0, 1) == 1) + if (buf_get_u32(&access_t, 0, 1) == 1) { break; } @@ -146,7 +146,7 @@ static int arm926ejs_cp15_write(struct target *target, uint32_t op1, uint32_t op uint8_t value_buf[4]; uint8_t address_buf[2] = {0, 0}; uint8_t nr_w_buf = 1; - uint8_t access = 1; + uint8_t access_t = 1; buf_set_u32(address_buf, 0, 14, address); buf_set_u32(value_buf, 0, 32, value); @@ -162,8 +162,8 @@ static int arm926ejs_cp15_write(struct target *target, uint32_t op1, uint32_t op fields[0].in_value = NULL; fields[1].num_bits = 1; - fields[1].out_value = &access; - fields[1].in_value = &access; + fields[1].out_value = &access_t; + fields[1].in_value = &access_t; fields[2].num_bits = 14; fields[2].out_value = address_buf; @@ -180,7 +180,7 @@ static int arm926ejs_cp15_write(struct target *target, uint32_t op1, uint32_t op for (;;) { /* rescan with NOP, to wait for the access to complete */ - access = 0; + access_t = 0; nr_w_buf = 0; jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE); if ((retval = jtag_execute_queue()) != ERROR_OK) @@ -188,7 +188,7 @@ static int arm926ejs_cp15_write(struct target *target, uint32_t op1, uint32_t op return retval; } - if (buf_get_u32(&access, 0, 1) == 1) + if (buf_get_u32(&access_t, 0, 1) == 1) { break; } commit 97197c98ebd3c62061729fd5b4eb94eece262edb Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:18:44 2010 +0200 arm920t: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm920t.c b/src/target/arm920t.c index b99b4d5..fe9bba7 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -1,3 +1,4 @@ + /*************************************************************************** * Copyright (C) 2005 by Dominic Rath * * Dom...@gm... * @@ -841,7 +842,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) int i; FILE *output; struct arm920t_cache_line d_cache[8][64], i_cache[8][64]; - int segment, index; + int segment, index_t; struct reg *r; retval = arm920t_verify_pointer(CMD_CTX, arm920t); @@ -910,12 +911,12 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) arm920t_write_cp15_physical(target, CP15PHYS_TESTSTATE, cp15c15); - for (index = 0; index < 64; index++) + for (index_t = 0; index_t < 64; index_t++) { /* Ra: * r0 = index(31:26):SBZ(25:8):segment(7:5):SBZ(4:0) */ - regs[0] = 0x0 | (segment << 5) | (index << 26); + regs[0] = 0x0 | (segment << 5) | (index_t << 26); arm9tdmi_write_core_regs(target, 0x1, regs); /* set interpret mode */ @@ -949,18 +950,18 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) return retval; } - d_cache[segment][index].cam = regs[9]; + d_cache[segment][index_t].cam = regs[9]; /* mask LFSR[6] */ regs[9] &= 0xfffffffe; fprintf(output, "\nsegment: %i, index: %i, CAM: 0x%8.8" PRIx32 ", content (%s):\n", - segment, index, regs[9], + segment, index_t, regs[9], (regs[9] & 0x10) ? "valid" : "invalid"); for (i = 1; i < 9; i++) { - d_cache[segment][index].data[i] = regs[i]; + d_cache[segment][index_t].data[i] = regs[i]; fprintf(output, "%i: 0x%8.8" PRIx32 "\n", i-1, regs[i]); } @@ -1018,12 +1019,12 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) arm920t_write_cp15_physical(target, CP15PHYS_TESTSTATE, cp15c15); - for (index = 0; index < 64; index++) + for (index_t = 0; index_t < 64; index_t++) { /* Ra: * r0 = index(31:26):SBZ(25:8):segment(7:5):SBZ(4:0) */ - regs[0] = 0x0 | (segment << 5) | (index << 26); + regs[0] = 0x0 | (segment << 5) | (index_t << 26); arm9tdmi_write_core_regs(target, 0x1, regs); /* set interpret mode */ @@ -1057,18 +1058,18 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) return retval; } - i_cache[segment][index].cam = regs[9]; + i_cache[segment][index_t].cam = regs[9]; /* mask LFSR[6] */ regs[9] &= 0xfffffffe; fprintf(output, "\nsegment: %i, index: %i, " "CAM: 0x%8.8" PRIx32 ", content (%s):\n", - segment, index, regs[9], + segment, index_t, regs[9], (regs[9] & 0x10) ? "valid" : "invalid"); for (i = 1; i < 9; i++) { - i_cache[segment][index].data[i] = regs[i]; + i_cache[segment][index_t].data[i] = regs[i]; fprintf(output, "%i: 0x%8.8" PRIx32 "\n", i-1, regs[i]); } commit da5979c38d7b373f6aa345ff8f961f5401e67902 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:17:00 2010 +0200 arm720t: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 8db0b5d..0ea6cb2 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -41,7 +41,7 @@ #endif static int arm720t_scan_cp15(struct target *target, - uint32_t out, uint32_t *in, int instruction, int clock) + uint32_t out, uint32_t *in, int instruction, int clock_arg) { int retval; struct arm720t_common *arm720t = target_to_arm720(target); @@ -81,7 +81,7 @@ static int arm720t_scan_cp15(struct target *target, jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE); } - if (clock) + if (clock_arg) jtag_add_runtest(0, TAP_DRPAUSE); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ @@ -93,9 +93,9 @@ static int arm720t_scan_cp15(struct target *target, if (in) LOG_DEBUG("out: %8.8x, in: %8.8x, instruction: %i, clock: %i", out, *in, instruction, clock); else - LOG_DEBUG("out: %8.8x, instruction: %i, clock: %i", out, instruction, clock); + LOG_DEBUG("out: %8.8x, instruction: %i, clock: %i", out, instruction, clock_arg); #else - LOG_DEBUG("out: %8.8" PRIx32 ", instruction: %i, clock: %i", out, instruction, clock); + LOG_DEBUG("out: %8.8" PRIx32 ", instruction: %i, clock: %i", out, instruction, clock_arg); #endif return ERROR_OK; commit ab6e62ab76226a4596f7f728d8915acb61507b44 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:15:50 2010 +0200 adi_v5_jtag: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c index 04c6ae7..b368708 100644 --- a/src/target/adi_v5_jtag.c +++ b/src/target/adi_v5_jtag.c @@ -366,15 +366,15 @@ static int jtag_dp_q_write(struct adiv5_dap *dap, unsigned reg, /** Select the AP register bank matching bits 7:4 of reg. */ static int jtag_ap_q_bankselect(struct adiv5_dap *dap, unsigned reg) { - uint32_t select = reg & 0x000000F0; + uint32_t select_ap_bank = reg & 0x000000F0; - if (select == dap->ap_bank_value) + if (select_ap_bank == dap->ap_bank_value) return ERROR_OK; - dap->ap_bank_value = select; + dap->ap_bank_value = select_ap_bank; - select |= dap->apsel; + select_ap_bank |= dap->apsel; - return jtag_dp_q_write(dap, DP_SELECT, select); + return jtag_dp_q_write(dap, DP_SELECT, select_ap_bank); } static int jtag_ap_q_read(struct adiv5_dap *dap, unsigned reg, commit 66f42b6f74125a98fed6d9402f6dc83a0f829100 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:14:41 2010 +0200 arm_adi: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 8f43f78..aae60fc 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -102,11 +102,11 @@ static uint32_t max_tar_block_size(uint32_t tar_autoincr_block, uint32_t address */ void dap_ap_select(struct adiv5_dap *dap,uint8_t apsel) { - uint32_t select = (apsel << 24) & 0xFF000000; + uint32_t select_apsel = (apsel << 24) & 0xFF000000; - if (select != dap->apsel) + if (select_apsel != dap->apsel) { - dap->apsel = select; + dap->apsel = select_apsel; /* Switching AP invalidates cached values. * Values MUST BE UPDATED BEFORE AP ACCESS. */ commit a09d6020e08ce1b81e8bf2647cd88ecab5c25887 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:14:20 2010 +0200 arm_simulator: -Wshadow warning fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm_simulator.c b/src/target/arm_simulator.c index 730f588..0f6fe3f 100644 --- a/src/target/arm_simulator.c +++ b/src/target/arm_simulator.c @@ -364,42 +364,42 @@ static int arm_simulate_step_core(struct target *target, /* branch instructions */ if ((instruction.type >= ARM_B) && (instruction.type <= ARM_BLX)) { - uint32_t target; + uint32_t target_address; if (instruction.info.b_bl_bx_blx.reg_operand == -1) { - target = instruction.info.b_bl_bx_blx.target_address; + target_address = instruction.info.b_bl_bx_blx.target_address; } else { - target = sim->get_reg_mode(sim, instruction.info.b_bl_bx_blx.reg_operand); + target_address = sim->get_reg_mode(sim, instruction.info.b_bl_bx_blx.reg_operand); if (instruction.info.b_bl_bx_blx.reg_operand == 15) { - target += 2 * instruction_size; + target_address += 2 * instruction_size; } } if (dry_run_pc) { - *dry_run_pc = target & ~1; + *dry_run_pc = target_address & ~1; return ERROR_OK; } else { if (instruction.type == ARM_B) { - sim->set_reg(sim, 15, target); + sim->set_reg(sim, 15, target_address); } else if (instruction.type == ARM_BL) { uint32_t old_pc = sim->get_reg(sim, 15); int T = (sim->get_state(sim) == ARM_STATE_THUMB); sim->set_reg_mode(sim, 14, old_pc + 4 + T); - sim->set_reg(sim, 15, target); + sim->set_reg(sim, 15, target_address); } else if (instruction.type == ARM_BX) { - if (target & 0x1) + if (target_address & 0x1) { sim->set_state(sim, ARM_STATE_THUMB); } @@ -407,7 +407,7 @@ static int arm_simulate_step_core(struct target *target, { sim->set_state(sim, ARM_STATE_ARM); } - sim->set_reg(sim, 15, target & 0xfffffffe); + sim->set_reg(sim, 15, target_address & 0xfffffffe); } else if (instruction.type == ARM_BLX) { @@ -415,7 +415,7 @@ static int arm_simulate_step_core(struct target *target, int T = (sim->get_state(sim) == ARM_STATE_THUMB); sim->set_reg_mode(sim, 14, old_pc + 4 + T); - if (target & 0x1) + if (target_address & 0x1) { sim->set_state(sim, ARM_STATE_THUMB); } @@ -423,7 +423,7 @@ static int arm_simulate_step_core(struct target *target, { sim->set_state(sim, ARM_STATE_ARM); } - sim->set_reg(sim, 15, target & 0xfffffffe); + sim->set_reg(sim, 15, target_address & 0xfffffffe); } return ERROR_OK; commit 748863c2e23aca05a81007ca87129a30eac005c4 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:09:12 2010 +0200 arm_dpm: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm_dpm.c b/src/target/arm_dpm.c index 213afbd..4fbe5e3 100644 --- a/src/target/arm_dpm.c +++ b/src/target/arm_dpm.c @@ -773,11 +773,11 @@ static int dpm_remove_breakpoint(struct target *target, struct breakpoint *bp) return retval; } -static int dpm_watchpoint_setup(struct arm_dpm *dpm, unsigned index, +static int dpm_watchpoint_setup(struct arm_dpm *dpm, unsigned index_t, struct watchpoint *wp) { int retval; - struct dpm_wp *dwp = dpm->dwp + index; + struct dpm_wp *dwp = dpm->dwp + index_t; uint32_t control; /* this hardware doesn't support data value matching or masking */ @@ -804,7 +804,7 @@ static int dpm_watchpoint_setup(struct arm_dpm *dpm, unsigned index, } dwp->bpwp.control = control; - dpm->dwp[index].wp = wp; + dpm->dwp[index_t].wp = wp; return retval; } ----------------------------------------------------------------------- Summary of changes: src/target/adi_v5_jtag.c | 10 +++++----- src/target/arm11_dbgtap.c | 32 ++++++++++++++++---------------- src/target/arm720t.c | 8 ++++---- src/target/arm920t.c | 23 ++++++++++++----------- src/target/arm926ejs.c | 20 ++++++++++---------- src/target/arm_adi_v5.c | 6 +++--- src/target/arm_dpm.c | 6 +++--- src/target/arm_simulator.c | 22 +++++++++++----------- src/target/cortex_a8.c | 18 +++++++++--------- src/target/mips32.c | 4 ++-- src/target/mips32_pracc.c | 6 +++--- src/target/mips_ejtag.c | 4 ++-- src/target/mips_m4k.c | 4 ++-- 13 files changed, 82 insertions(+), 81 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 23:08:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 64cf05f0c4dd5bd3856a57043c73933be0b2ba04 (commit) from 83ebddd519b2adecd5dace2d268243ad4bd34c9e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 64cf05f0c4dd5bd3856a57043c73933be0b2ba04 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:07:45 2010 +0200 target: -Wshdaow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/target.c b/src/target/target.c index 435d7b6..9599fec 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -3065,8 +3065,8 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, const char *filenam long long a = address-min; long long b = length-1; long long c = addressSpace-1; - int index = (a*b)/c; /* danger!!!! int32 overflows */ - buckets[index]++; + int index_t = (a*b)/c; /* danger!!!! int32 overflows */ + buckets[index_t]++; } /* append binary memory gmon.out &profile_hist_hdr ((char*)&profile_hist_hdr + sizeof(struct gmon_hist_hdr)) */ @@ -3894,14 +3894,14 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target) break; case TCFG_CHAIN_POSITION: if (goi->isconfigure) { - Jim_Obj *o; + Jim_Obj *o_t; struct jtag_tap *tap; target_free_all_working_areas(target); - e = Jim_GetOpt_Obj(goi, &o); + e = Jim_GetOpt_Obj(goi, &o_t); if (e != JIM_OK) { return e; } - tap = jtag_tap_by_jim_obj(goi->interp, o); + tap = jtag_tap_by_jim_obj(goi->interp, o_t); if (tap == NULL) { return JIM_ERR; } ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 23:04:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 83ebddd519b2adecd5dace2d268243ad4bd34c9e (commit) via 9161b5fc5c4655b5320b16d52f1ab3311d69e97d (commit) via 395d3bff8ce59d6c5a34e0a626010343ca9909ba (commit) from 00017c90ae82d3237f5a4784caa695459c5897d2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 83ebddd519b2adecd5dace2d268243ad4bd34c9e Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:04:22 2010 +0200 breakpoint: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index 637f681..dc44642 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -105,7 +105,7 @@ fail: } /* free up a breakpoint */ -static void breakpoint_free(struct target *target, struct breakpoint *breakpoint_remove) +static void breakpoint_free(struct target *target, struct breakpoint *breakpoint_to_remove) { struct breakpoint *breakpoint = target->breakpoints; struct breakpoint **breakpoint_p = &target->breakpoints; @@ -113,7 +113,7 @@ static void breakpoint_free(struct target *target, struct breakpoint *breakpoint while (breakpoint) { - if (breakpoint == breakpoint_remove) + if (breakpoint == breakpoint_to_remove) break; breakpoint_p = &breakpoint->next; breakpoint = breakpoint->next; @@ -246,7 +246,7 @@ bye: return ERROR_OK; } -static void watchpoint_free(struct target *target, struct watchpoint *watchpoint_remove) +static void watchpoint_free(struct target *target, struct watchpoint *watchpoint_to_remove) { struct watchpoint *watchpoint = target->watchpoints; struct watchpoint **watchpoint_p = &target->watchpoints; @@ -254,7 +254,7 @@ static void watchpoint_free(struct target *target, struct watchpoint *watchpoint while (watchpoint) { - if (watchpoint == watchpoint_remove) + if (watchpoint == watchpoint_to_remove) break; watchpoint_p = &watchpoint->next; watchpoint = watchpoint->next; commit 9161b5fc5c4655b5320b16d52f1ab3311d69e97d Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:02:46 2010 +0200 zy1000: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 13685f8..b50e96a 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -508,7 +508,7 @@ static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endSt #endif // here we shuffle N bits out/in -static __inline void scanBits(const uint8_t *out_value, uint8_t *in_value, int num_bits, bool pause, tap_state_t shiftState, tap_state_t end_state) +static __inline void scanBits(const uint8_t *out_value, uint8_t *in_value, int num_bits, bool pause_now, tap_state_t shiftState, tap_state_t end_state) { tap_state_t pause_state = shiftState; for (int j = 0; j < num_bits; j += 32) @@ -518,7 +518,7 @@ static __inline void scanBits(const uint8_t *out_value, uint8_t *in_value, int n { k = 32; /* we have more to shift out */ - } else if (pause) + } else if (pause_now) { /* this was the last to shift out this time */ pause_state = end_state; commit 395d3bff8ce59d6c5a34e0a626010343ca9909ba Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 23:01:42 2010 +0200 fileio: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/fileio.c b/src/helper/fileio.c index 71e807f..ba62397 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -98,12 +98,12 @@ static inline int fileio_open_local(struct fileio *fileio) return ERROR_OK; } -int fileio_open(struct fileio *fileio, const char *url, enum fileio_access access, enum fileio_type type) +int fileio_open(struct fileio *fileio, const char *url, enum fileio_access access_type, enum fileio_type type) { int retval = ERROR_OK; fileio->type = type; - fileio->access = access; + fileio->access = access_type; fileio->url = strdup(url); retval = fileio_open_local(fileio); ----------------------------------------------------------------------- Summary of changes: src/helper/fileio.c | 4 ++-- src/jtag/zy1000/zy1000.c | 4 ++-- src/target/breakpoints.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 22:48:55
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 00017c90ae82d3237f5a4784caa695459c5897d2 (commit) from 3c8a0e72f38e47bfc78dc7ab44ce2ec16cfac53b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 00017c90ae82d3237f5a4784caa695459c5897d2 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Jun 15 22:47:52 2010 +0200 jim: -Wshadow warning fix Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/jim.c b/src/helper/#jim.c# similarity index 99% copy from src/helper/jim.c copy to src/helper/#jim.c# index 8b0014f..c8583de 100644 --- a/src/helper/jim.c +++ b/src/helper/#jim.c# @@ -3,7 +3,7 @@ * Copyright 2005 Salvatore Sanfilippo <an...@in...> * Copyright 2005 Clemens Hintze <c.h...@gm...> * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> - * Copyright 2008,2009 oharboe - Ãyvind Harboe - oyv...@zy... + * Copyright 2008,2009 oharboe - Øyvind Harboe - oyv...@zy... * Copyright 2008 Andrew Lunn <an...@lu...> * Copyright 2008 Duane Ellis <op...@du...> * Copyright 2008 Uwe Klein <uk...@kl...> @@ -11907,15 +11907,15 @@ static int Jim_ScanCoreCommand(Jim_Interp *interp, int argc, } if (argc > 3) { int maxPos = FormatGetMaxPos(argv[2]); - int count = FormatGetCnvCount(argv[2]); + int arg_count = FormatGetCnvCount(argv[2]); if (maxPos > argc-3) { Jim_SetResultString(interp, "\"%n$\" argument index out of range", -1); return JIM_ERR; - } else if (count != 0 && count < argc-3) { + } else if (arg_count != 0 && arg_count < argc-3) { Jim_SetResultString(interp, "variable is not assigned by any " "conversion specifiers", -1); return JIM_ERR; - } else if (count > argc-3) { + } else if (arg_count > argc-3) { Jim_SetResultString(interp, "different numbers of variable names and " "field specifiers", -1); return JIM_ERR; @@ -11934,26 +11934,7 @@ static int Jim_ScanCoreCommand(Jim_Interp *interp, int argc, } JimListGetElements(interp, listPtr, &outc, &outVec); for (i = 0; i < outc; ++i) { - if (Jim_Length(outVec[i]) > 0) { - ++count; - if (Jim_SetVariable(interp, argv[3 + i], outVec[i]) != JIM_OK) - goto err; - } - } - Jim_FreeNewObj(interp, listPtr); - Jim_SetResult(interp, Jim_NewIntObj(interp, count)); - } else { - if (listPtr == (Jim_Obj*)EOF) { - Jim_SetResult(interp, Jim_NewListObj(interp, 0, 0)); - return JIM_OK; - } - Jim_SetResult(interp, listPtr); - } - return JIM_OK; -err: - Jim_FreeNewObj(interp, listPtr); - return JIM_ERR; -} + if (Jim_Len /* [error] */ static int Jim_ErrorCoreCommand(Jim_Interp *interp, int argc, diff --git a/src/helper/jim.c b/src/helper/jim.c index 8b0014f..8538954 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -11907,15 +11907,15 @@ static int Jim_ScanCoreCommand(Jim_Interp *interp, int argc, } if (argc > 3) { int maxPos = FormatGetMaxPos(argv[2]); - int count = FormatGetCnvCount(argv[2]); + int arg_count = FormatGetCnvCount(argv[2]); if (maxPos > argc-3) { Jim_SetResultString(interp, "\"%n$\" argument index out of range", -1); return JIM_ERR; - } else if (count != 0 && count < argc-3) { + } else if (arg_count != 0 && arg_count < argc-3) { Jim_SetResultString(interp, "variable is not assigned by any " "conversion specifiers", -1); return JIM_ERR; - } else if (count > argc-3) { + } else if (arg_count > argc-3) { Jim_SetResultString(interp, "different numbers of variable names and " "field specifiers", -1); return JIM_ERR; ----------------------------------------------------------------------- Summary of changes: src/helper/{jim.c => #jim.c#} | 29 +++++------------------------ src/helper/jim.c | 6 +++--- 2 files changed, 8 insertions(+), 27 deletions(-) copy src/helper/{jim.c => #jim.c#} (99%) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 22:46:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 3c8a0e72f38e47bfc78dc7ab44ce2ec16cfac53b (commit) via 2eba49b8b135fd6cbf95920f2794b411027f3d2e (commit) from c9e2d13cf9410b48612fef023a91b8e29c4a090d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3c8a0e72f38e47bfc78dc7ab44ce2ec16cfac53b Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 22:29:41 2010 +0200 jim: more jim -Wshadow fixes that should be straightforward this bunch was a bit less obvious, but looked straightforward. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/jim.c b/src/helper/jim.c index b8d856f..8b0014f 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -3039,12 +3039,12 @@ int SetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) JimParserInit(&parser, scriptText, scriptTextLen, initialLineNumber); while (!JimParserEof(&parser)) { - char *token; + char *token_t; int len, type, linenr; JimParseScript(&parser); - token = JimParserGetToken(&parser, &len, &type, &linenr); - ScriptObjAddToken(interp, script, token, len, type, + token_t = JimParserGetToken(&parser, &len, &type, &linenr); + ScriptObjAddToken(interp, script, token_t, len, type, propagateSourceInfo ? script->fileName : NULL, linenr); } @@ -4505,7 +4505,7 @@ void Jim_FreeInterp(Jim_Interp *i) /* Check that the live object list is empty, otherwise * there is a memory leak. */ if (i->liveList != NULL) { - Jim_Obj *objPtr = i->liveList; + objPtr = i->liveList; Jim_fprintf(i, i->cookie_stdout,JIM_NL "-------------------------------------" JIM_NL); Jim_fprintf(i, i->cookie_stdout,"Objects still in the free list:" JIM_NL); @@ -5170,7 +5170,7 @@ void UpdateStringOfList(struct Jim_Obj *objPtr) realLength = 0; for (i = 0; i < objPtr->internalRep.listValue.len; i++) { int len, qlen; - const char *strRep = Jim_GetString(ele[i], &len); + strRep = Jim_GetString(ele[i], &len); char *q; switch (quotingType[i]) { @@ -5745,7 +5745,7 @@ void UpdateStringOfDict(struct Jim_Obj *objPtr) realLength = 0; for (i = 0; i < objc; i++) { int len, qlen; - const char *strRep = Jim_GetString(objv[i], &len); + strRep = Jim_GetString(objv[i], &len); char *q; switch (quotingType[i]) { @@ -11030,7 +11030,6 @@ static int Jim_ProcCoreCommand(Jim_Interp *interp, int argc, /* Check for default arguments and reduce arityMin if necessary */ while (arityMin > 1) { - int len; Jim_ListIndex(interp, argv[2], arityMin - 2, &argPtr, JIM_NONE); Jim_ListLength(interp, argPtr, &len); if (len != 2) { commit 2eba49b8b135fd6cbf95920f2794b411027f3d2e Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 22:24:22 2010 +0200 jim: -Wshadow fixes this batch of fixes should be pretty straightforward rename of 'index' and an 'i' local variable shadowing. 'index' conflicts with a global name. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/jim.c b/src/helper/jim.c index 53d1a75..b8d856f 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -397,14 +397,14 @@ int JimStringCompare(const char *s1, int l1, const char *s2, int l2, /* Search 's1' inside 's2', starting to search from char 'index' of 's2'. * The index of the first occurrence of s1 in s2 is returned. * If s1 is not found inside s2, -1 is returned. */ -int JimStringFirst(const char *s1, int l1, const char *s2, int l2, int index) +int JimStringFirst(const char *s1, int l1, const char *s2, int l2, int index_t) { int i; if (!l1 || !l2 || l1 > l2) return -1; - if (index < 0) index = 0; - s2 += index; - for (i = index; i <= l2-l1; i++) { + if (index_t < 0) index_t = 0; + s2 += index_t; + for (i = index_t; i <= l2-l1; i++) { if (memcmp(s2, s1, l1) == 0) return i; s2++; @@ -759,18 +759,18 @@ int Jim_ExpandHashTable(Jim_HashTable *ht, unsigned int size) /* Add an element to the target hash table */ int Jim_AddHashEntry(Jim_HashTable *ht, const void *key, void *val) { - int index; + int index_t; Jim_HashEntry *entry; /* Get the index of the new element, or -1 if * the element already exists. */ - if ((index = JimInsertHashEntry(ht, key)) == -1) + if ((index_t = JimInsertHashEntry(ht, key)) == -1) return JIM_ERR; /* Allocates the memory and stores key */ entry = Jim_Alloc(sizeof(*entry)); - entry->next = ht->table[index]; - ht->table[index] = entry; + entry->next = ht->table[index_t]; + ht->table[index_t] = entry; /* Set the hash entry fields. */ Jim_SetHashKey(ht, entry, key); @@ -2148,11 +2148,11 @@ int Jim_StringCompareObj(Jim_Obj *firstObjPtr, * This function may return negative values, or values * bigger or equal to the length of the list if the index * is out of range. */ -static int JimRelToAbsIndex(int len, int index) +static int JimRelToAbsIndex(int len, int index_t) { - if (index < 0) - return len + index; - return index; + if (index_t < 0) + return len + index_t; + return index_t; } /* Convert a pair of index as normalize by JimRelToAbsIndex(), @@ -5357,7 +5357,7 @@ void ListAppendElement(Jim_Obj *listPtr, Jim_Obj *objPtr) * * NOTE: this function can be called only against objects * with internal type of List. */ -void ListInsertElements(Jim_Obj *listPtr, int index, int elemc, +void ListInsertElements(Jim_Obj *listPtr, int index_t, int elemc, Jim_Obj *const *elemVec) { int currentLen = listPtr->internalRep.listValue.len; @@ -5373,8 +5373,8 @@ void ListInsertElements(Jim_Obj *listPtr, int index, int elemc, sizeof(Jim_Obj*)*maxLen); listPtr->internalRep.listValue.maxLen = maxLen; } - point = listPtr->internalRep.listValue.ele + index; - memmove(point + elemc, point, (currentLen-index) * sizeof(Jim_Obj*)); + point = listPtr->internalRep.listValue.ele + index_t; + memmove(point + elemc, point, (currentLen-index_t) * sizeof(Jim_Obj*)); for (i = 0; i < elemc; ++i) { point[i] = elemVec[i]; Jim_IncrRefCount(point[i]); @@ -5433,57 +5433,57 @@ void Jim_ListLength(Jim_Interp *interp, Jim_Obj *listPtr, int *intPtr) *intPtr = listPtr->internalRep.listValue.len; } -void Jim_ListInsertElements(Jim_Interp *interp, Jim_Obj *listPtr, int index, +void Jim_ListInsertElements(Jim_Interp *interp, Jim_Obj *listPtr, int index_t, int objc, Jim_Obj *const *objVec) { if (Jim_IsShared(listPtr)) Jim_Panic(interp,"Jim_ListInsertElement called with shared object"); if (listPtr->typePtr != &listObjType) SetListFromAny(interp, listPtr); - if (index >= 0 && index > listPtr->internalRep.listValue.len) - index = listPtr->internalRep.listValue.len; - else if (index < 0) - index = 0; + if (index_t >= 0 && index_t > listPtr->internalRep.listValue.len) + index_t = listPtr->internalRep.listValue.len; + else if (index_t < 0) + index_t = 0; Jim_InvalidateStringRep(listPtr); - ListInsertElements(listPtr, index, objc, objVec); + ListInsertElements(listPtr, index_t, objc, objVec); } -int Jim_ListIndex(Jim_Interp *interp, Jim_Obj *listPtr, int index, +int Jim_ListIndex(Jim_Interp *interp, Jim_Obj *listPtr, int index_t, Jim_Obj **objPtrPtr, int flags) { if (listPtr->typePtr != &listObjType) SetListFromAny(interp, listPtr); - if ((index >= 0 && index >= listPtr->internalRep.listValue.len) || - (index < 0 && (-index-1) >= listPtr->internalRep.listValue.len)) { + if ((index_t >= 0 && index_t >= listPtr->internalRep.listValue.len) || + (index_t < 0 && (-index_t-1) >= listPtr->internalRep.listValue.len)) { if (flags & JIM_ERRMSG) { Jim_SetResultString(interp, "list index out of range", -1); } return JIM_ERR; } - if (index < 0) - index = listPtr->internalRep.listValue.len + index; - *objPtrPtr = listPtr->internalRep.listValue.ele[index]; + if (index_t < 0) + index_t = listPtr->internalRep.listValue.len + index_t; + *objPtrPtr = listPtr->internalRep.listValue.ele[index_t]; return JIM_OK; } -static int ListSetIndex(Jim_Interp *interp, Jim_Obj *listPtr, int index, +static int ListSetIndex(Jim_Interp *interp, Jim_Obj *listPtr, int index_t, Jim_Obj *newObjPtr, int flags) { if (listPtr->typePtr != &listObjType) SetListFromAny(interp, listPtr); - if ((index >= 0 && index >= listPtr->internalRep.listValue.len) || - (index < 0 && (-index-1) >= listPtr->internalRep.listValue.len)) { + if ((index_t >= 0 && index_t >= listPtr->internalRep.listValue.len) || + (index_t < 0 && (-index_t-1) >= listPtr->internalRep.listValue.len)) { if (flags & JIM_ERRMSG) { Jim_SetResultString(interp, - "list index out of range", -1); + "list index_t out of range", -1); } return JIM_ERR; } - if (index < 0) - index = listPtr->internalRep.listValue.len + index; - Jim_DecrRefCount(interp, listPtr->internalRep.listValue.ele[index]); - listPtr->internalRep.listValue.ele[index] = newObjPtr; + if (index_t < 0) + index_t = listPtr->internalRep.listValue.len + index_t; + Jim_DecrRefCount(interp, listPtr->internalRep.listValue.ele[index_t]); + listPtr->internalRep.listValue.ele[index_t] = newObjPtr; Jim_IncrRefCount(newObjPtr); return JIM_OK; } @@ -5495,7 +5495,7 @@ int Jim_SetListIndex(Jim_Interp *interp, Jim_Obj *varNamePtr, Jim_Obj *const *indexv, int indexc, Jim_Obj *newObjPtr) { Jim_Obj *varObjPtr, *objPtr, *listObjPtr; - int shared, i, index; + int shared, i, index_t; varObjPtr = objPtr = Jim_GetVariable(interp, varNamePtr, JIM_ERRMSG); if (objPtr == NULL) @@ -5504,21 +5504,21 @@ int Jim_SetListIndex(Jim_Interp *interp, Jim_Obj *varNamePtr, varObjPtr = objPtr = Jim_DuplicateObj(interp, objPtr); for (i = 0; i < indexc-1; i++) { listObjPtr = objPtr; - if (Jim_GetIndex(interp, indexv[i], &index) != JIM_OK) + if (Jim_GetIndex(interp, indexv[i], &index_t) != JIM_OK) goto err; - if (Jim_ListIndex(interp, listObjPtr, index, &objPtr, + if (Jim_ListIndex(interp, listObjPtr, index_t, &objPtr, JIM_ERRMSG) != JIM_OK) { goto err; } if (Jim_IsShared(objPtr)) { objPtr = Jim_DuplicateObj(interp, objPtr); - ListSetIndex(interp, listObjPtr, index, objPtr, JIM_NONE); + ListSetIndex(interp, listObjPtr, index_t, objPtr, JIM_NONE); } Jim_InvalidateStringRep(listObjPtr); } - if (Jim_GetIndex(interp, indexv[indexc-1], &index) != JIM_OK) + if (Jim_GetIndex(interp, indexv[indexc-1], &index_t) != JIM_OK) goto err; - if (ListSetIndex(interp, objPtr, index, newObjPtr, JIM_ERRMSG) == JIM_ERR) + if (ListSetIndex(interp, objPtr, index_t, newObjPtr, JIM_ERRMSG) == JIM_ERR) goto err; Jim_InvalidateStringRep(objPtr); Jim_InvalidateStringRep(varObjPtr); @@ -6050,21 +6050,21 @@ void UpdateStringOfIndex(struct Jim_Obj *objPtr) int SetIndexFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { - int index, end = 0; + int index_t, end = 0; const char *str; /* Get the string representation */ str = Jim_GetString(objPtr, NULL); /* Try to convert into an index */ if (!strcmp(str, "end")) { - index = 0; + index_t = 0; end = 1; } else { if (!strncmp(str, "end-", 4)) { str += 4; end = 1; } - if (Jim_StringToIndex(str, &index) != JIM_OK) { + if (Jim_StringToIndex(str, &index_t) != JIM_OK) { Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); Jim_AppendStrings(interp, Jim_GetResult(interp), "bad index \"", Jim_GetString(objPtr, NULL), "\": " @@ -6073,16 +6073,16 @@ int SetIndexFromAny(Jim_Interp *interp, Jim_Obj *objPtr) } } if (end) { - if (index < 0) - index = INT_MAX; + if (index_t < 0) + index_t = INT_MAX; else - index = -(index + 1); - } else if (index < 0) - index = -INT_MAX; + index_t = -(index_t + 1); + } else if (index_t < 0) + index_t = -INT_MAX; /* Free the old internal repr and set the new one. */ Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &indexObjType; - objPtr->internalRep.indexValue = index; + objPtr->internalRep.indexValue = index_t; return JIM_OK; } @@ -6617,20 +6617,20 @@ static void ExprShareLiterals(Jim_Interp *interp, ExprByteCode *expr, static void ExprMakeLazy(Jim_Interp *interp, ExprByteCode *expr) { while (1) { - int index = -1, leftindex, arity, i, offset; + int index_t = -1, leftindex, arity, i, offset; Jim_ExprOperator *op; /* Search for || or && */ for (i = 0; i < expr->len; i++) { if (expr->opcode[i] == JIM_EXPROP_LOGICAND || expr->opcode[i] == JIM_EXPROP_LOGICOR) { - index = i; + index_t = i; break; } } - if (index == -1) return; + if (index_t == -1) return; /* Search for the end of the first operator */ - leftindex = index-1; + leftindex = index_t-1; arity = 1; while (arity) { switch (expr->opcode[leftindex]) { @@ -6660,23 +6660,23 @@ static void ExprMakeLazy(Jim_Interp *interp, ExprByteCode *expr) memmove(&expr->obj[leftindex + 2], &expr->obj[leftindex], sizeof(Jim_Obj*)*(expr->len-leftindex)); expr->len += 2; - index += 2; - offset = (index-leftindex)-1; - Jim_DecrRefCount(interp, expr->obj[index]); - if (expr->opcode[index] == JIM_EXPROP_LOGICAND) { + index_t += 2; + offset = (index_t-leftindex)-1; + Jim_DecrRefCount(interp, expr->obj[index_t]); + if (expr->opcode[index_t] == JIM_EXPROP_LOGICAND) { expr->opcode[leftindex + 1] = JIM_EXPROP_LOGICAND_LEFT; - expr->opcode[index] = JIM_EXPROP_LOGICAND_RIGHT; + expr->opcode[index_t] = JIM_EXPROP_LOGICAND_RIGHT; expr->obj[leftindex + 1] = Jim_NewStringObj(interp, "&L", -1); - expr->obj[index] = Jim_NewStringObj(interp, "&R", -1); + expr->obj[index_t] = Jim_NewStringObj(interp, "&R", -1); } else { expr->opcode[leftindex + 1] = JIM_EXPROP_LOGICOR_LEFT; - expr->opcode[index] = JIM_EXPROP_LOGICOR_RIGHT; + expr->opcode[index_t] = JIM_EXPROP_LOGICOR_RIGHT; expr->obj[leftindex + 1] = Jim_NewStringObj(interp, "|L", -1); - expr->obj[index] = Jim_NewStringObj(interp, "|R", -1); + expr->obj[index_t] = Jim_NewStringObj(interp, "|R", -1); } expr->opcode[leftindex] = JIM_EXPROP_NUMBER; expr->obj[leftindex] = Jim_NewIntObj(interp, offset); - Jim_IncrRefCount(expr->obj[index]); + Jim_IncrRefCount(expr->obj[index_t]); Jim_IncrRefCount(expr->obj[leftindex]); Jim_IncrRefCount(expr->obj[leftindex + 1]); } @@ -7558,9 +7558,9 @@ JimScanAString(Jim_Interp *interp, const char *sdescr, const char *str) while (*sdescr) { if (sdescr[1] == '-' && sdescr[2] != 0) { /* Handle range definitions */ - int i; - for (i = sdescr[0]; i <= sdescr[2]; ++i) - JimSetBit(charset, (char)i); + int i_t; + for (i_t = sdescr[0]; i_t <= sdescr[2]; ++i_t) + JimSetBit(charset, (char)i_t); sdescr += 3; } else { /* Handle verbatim character definitions */ @@ -7591,7 +7591,7 @@ JimScanAString(Jim_Interp *interp, const char *sdescr, const char *str) * already scanned thru */ static int ScanOneEntry(Jim_Interp *interp, const char *str, long pos, - ScanFmtStringObj *fmtObj, long index, Jim_Obj **valObjPtr) + ScanFmtStringObj *fmtObj, long index_t, Jim_Obj **valObjPtr) { # define MAX_SIZE (sizeof(jim_wide) > sizeof(double) \ ? sizeof(jim_wide) \ @@ -7599,7 +7599,7 @@ static int ScanOneEntry(Jim_Interp *interp, const char *str, long pos, char buffer[MAX_SIZE]; char *value = buffer; const char *tok; - const ScanFmtPartDescr *descr = &fmtObj->descr[index]; + const ScanFmtPartDescr *descr = &fmtObj->descr[index_t]; size_t sLen = strlen(&str[pos]), scanned = 0; size_t anchor = pos; int i; @@ -10473,7 +10473,7 @@ static int Jim_LindexCoreCommand(Jim_Interp *interp, int argc, { Jim_Obj *objPtr, *listObjPtr; int i; - int index; + int index_t; if (argc < 3) { Jim_WrongNumArgs(interp, 1, argv, "list index ?...?"); @@ -10483,11 +10483,11 @@ static int Jim_LindexCoreCommand(Jim_Interp *interp, int argc, Jim_IncrRefCount(objPtr); for (i = 2; i < argc; i++) { listObjPtr = objPtr; - if (Jim_GetIndex(interp, argv[i], &index) != JIM_OK) { + if (Jim_GetIndex(interp, argv[i], &index_t) != JIM_OK) { Jim_DecrRefCount(interp, listObjPtr); return JIM_ERR; } - if (Jim_ListIndex(interp, listObjPtr, index, &objPtr, + if (Jim_ListIndex(interp, listObjPtr, index_t, &objPtr, JIM_NONE) != JIM_OK) { /* Returns an empty object if the index * is out of range. */ @@ -10556,7 +10556,7 @@ static int Jim_LappendCoreCommand(Jim_Interp *interp, int argc, static int Jim_LinsertCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - int index, len; + int index_t, len; Jim_Obj *listPtr; if (argc < 4) { @@ -10567,14 +10567,14 @@ static int Jim_LinsertCoreCommand(Jim_Interp *interp, int argc, listPtr = argv[1]; if (Jim_IsShared(listPtr)) listPtr = Jim_DuplicateObj(interp, listPtr); - if (Jim_GetIndex(interp, argv[2], &index) != JIM_OK) + if (Jim_GetIndex(interp, argv[2], &index_t) != JIM_OK) goto err; Jim_ListLength(interp, listPtr, &len); - if (index >= len) - index = len; - else if (index < 0) - index = len + index + 1; - Jim_ListInsertElements(interp, listPtr, index, argc-3, &argv[3]); + if (index_t >= len) + index_t = len; + else if (index_t < 0) + index_t = len + index_t + 1; + Jim_ListInsertElements(interp, listPtr, index_t, argc-3, &argv[3]); Jim_SetResult(interp, listPtr); return JIM_OK; err: @@ -11304,27 +11304,27 @@ static int Jim_StringCoreCommand(Jim_Interp *interp, int argc, Jim_SetResult(interp, objPtr); return JIM_OK; } else if (option == OPT_INDEX) { - int index, len; + int index_t, len; const char *str; if (argc != 4) { Jim_WrongNumArgs(interp, 2, argv, "string index"); return JIM_ERR; } - if (Jim_GetIndex(interp, argv[3], &index) != JIM_OK) + if (Jim_GetIndex(interp, argv[3], &index_t) != JIM_OK) return JIM_ERR; str = Jim_GetString(argv[2], &len); - if (index != INT_MIN && index != INT_MAX) - index = JimRelToAbsIndex(len, index); - if (index < 0 || index >= len) { + if (index_t != INT_MIN && index_t != INT_MAX) + index_t = JimRelToAbsIndex(len, index_t); + if (index_t < 0 || index_t >= len) { Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); return JIM_OK; } else { - Jim_SetResult(interp, Jim_NewStringObj(interp, str + index, 1)); + Jim_SetResult(interp, Jim_NewStringObj(interp, str + index_t, 1)); return JIM_OK; } } else if (option == OPT_FIRST) { - int index = 0, l1, l2; + int index_t = 0, l1, l2; const char *s1, *s2; if (argc != 4 && argc != 5) { @@ -11334,12 +11334,12 @@ static int Jim_StringCoreCommand(Jim_Interp *interp, int argc, s1 = Jim_GetString(argv[2], &l1); s2 = Jim_GetString(argv[3], &l2); if (argc == 5) { - if (Jim_GetIndex(interp, argv[4], &index) != JIM_OK) + if (Jim_GetIndex(interp, argv[4], &index_t) != JIM_OK) return JIM_ERR; - index = JimRelToAbsIndex(l2, index); + index_t = JimRelToAbsIndex(l2, index_t); } Jim_SetResult(interp, Jim_NewIntObj(interp, - JimStringFirst(s1, l1, s2, l2, index))); + JimStringFirst(s1, l1, s2, l2, index_t))); return JIM_OK; } else if (option == OPT_TOLOWER) { if (argc != 3) { ----------------------------------------------------------------------- Summary of changes: src/helper/jim.c | 189 +++++++++++++++++++++++++++--------------------------- 1 files changed, 94 insertions(+), 95 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 10:40:45
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via c9e2d13cf9410b48612fef023a91b8e29c4a090d (commit) from bf3410fcc711f6601f1f8eb39c5df57cf8cfe535 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c9e2d13cf9410b48612fef023a91b8e29c4a090d Author: Thomas Koeller <tho...@ba...> Date: Tue Jun 15 10:37:05 2010 +0200 DM36x: pll & clock setup Added a function 'pll_v03_setup' to set up PLLs and clock dividers on DM365 and DM368. Signed-off-by: Thomas Koeller <tho...@ba...> Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/tcl/target/davinci.cfg b/tcl/target/davinci.cfg index ee840c8..31750dd 100644 --- a/tcl/target/davinci.cfg +++ b/tcl/target/davinci.cfg @@ -143,6 +143,133 @@ proc pll_v02_setup {pll_addr mult config} { mww $pll_ctrl_addr $pll_ctrl } +# PLL version 0x03: tested on dm365 +proc pll_v03_setup {pll_addr mult config} { + set pll_ctrl_addr [expr $pll_addr + 0x100] + set pll_secctrl_addr [expr $pll_addr + 0x108] + set pll_ctrl [mrw $pll_ctrl_addr] + + # 1 - power up the PLL + set pll_ctrl [expr $pll_ctrl & ~0x0002] + mww $pll_ctrl_addr $pll_ctrl + + # 2 - clear PLLENSRC (bit 5) + set pll_ctrl [expr $pll_ctrl & ~0x0020] + mww $pll_ctrl_addr $pll_ctrl + + # 2 - clear PLLEN (bit 0) ... enter bypass mode + set pll_ctrl [expr $pll_ctrl & ~0x0001] + mww $pll_ctrl_addr $pll_ctrl + + # 3 - wait at least 4 refclk cycles + sleep 1 + + # 4 - set PLLRST (bit 3) + set pll_ctrl [expr $pll_ctrl | 0x0008] + mww $pll_ctrl_addr $pll_ctrl + + # 5 - wait at least 5 usec + sleep 1 + + # 6 - clear PLLRST (bit 3) + set pll_ctrl [expr $pll_ctrl & ~0x0008] + mww $pll_ctrl_addr $pll_ctrl + + # 9 - optional: write prediv, postdiv, and pllm + mww [expr $pll_addr + 0x0110] [expr ($mult / 2) & 0x1ff] + if { [dict exists $config prediv] } { + set div [dict get $config prediv] + set div [expr ($div - 1)] + mww [expr $pll_addr + 0x0114] $div + } + if { [dict exists $config postdiv] } { + set div [dict get $config postdiv] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0128] $div + } + + # 10 - write start sequence to PLLSECCTL + mww $pll_secctrl_addr 0x00470000 + mww $pll_secctrl_addr 0x00460000 + mww $pll_secctrl_addr 0x00400000 + mww $pll_secctrl_addr 0x00410000 + + # 11 - optional: set plldiv1, plldiv2, ... + # NOTE: this assumes some registers have their just-reset values: + # - PLLSTAT.GOSTAT is clear when we enter + # - ALNCTL has everything set + set aln 0 + if { [dict exists $config div1] } { + set div [dict get $config div1] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0118] $div + set aln [expr $aln | 0x1] + } + if { [dict exists $config div2] } { + set div [dict get $config div2] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x011c] $div + set aln [expr $aln | 0x2] + } + if { [dict exists $config div3] } { + set div [dict get $config div3] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0120] $div + set aln [expr $aln | 0x4] + } + if { [dict exists $config div4] } { + set div [dict get $config div4] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0160] $div + set aln [expr $aln | 0x8] + } + if { [dict exists $config div5] } { + set div [dict get $config div5] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0164] $div + set aln [expr $aln | 0x10] + } + if { [dict exists $config div6] } { + set div [dict get $config div6] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0168] $div + set aln [expr $aln | 0x20] + } + if { [dict exists $config div7] } { + set div [dict get $config div7] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x016c] $div + set aln [expr $aln | 0x40] + } + if { [dict exists $config div8] } { + set div [dict get $config div8] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0170] $div + set aln [expr $aln | 0x80] + } + if { [dict exists $config div9] } { + set div [dict get $config div9] + set div [expr 0x8000 | ($div - 1)] + mww [expr $pll_addr + 0x0174] $div + set aln [expr $aln | 0x100] + } + if {$aln != 0} { + # write alingment flags + mww [expr $pll_addr + 0x0140] $aln + # write pllcmd.GO; poll pllstat.GO + mww [expr $pll_addr + 0x0138] 0x01 + set pllstat [expr $pll_addr + 0x013c] + while {[expr [mrw $pllstat] & 0x01] != 0} { sleep 1 } + } + mww [expr $pll_addr + 0x0138] 0x00 + set addr [dict get $config ctladdr] + while {[expr [mrw $addr] & 0x0e000000] != 0x0e000000} { sleep 1 } + + # 12 - set PLLEN (bit 0) ... leave bypass mode + set pll_ctrl [expr $pll_ctrl | 0x0001] + mww $pll_ctrl_addr $pll_ctrl +} + # NOTE: dm6446 requires EMURSTIE set in MDCTL before certain # modules can be enabled. ----------------------------------------------------------------------- Summary of changes: tcl/target/davinci.cfg | 127 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 127 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-15 07:40:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via bf3410fcc711f6601f1f8eb39c5df57cf8cfe535 (commit) from 3e51d893ed3d1273b5487e05196f00fe3d14773d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bf3410fcc711f6601f1f8eb39c5df57cf8cfe535 Author: michal smulski <mic...@oo...> Date: Mon Jun 14 15:13:09 2010 -0700 arm1136 scripts Here is a patch to fix a startup in C100 (arm1136). Basically make sure that UART is configured before using it. Michal Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/tcl/target/c100helper.tcl b/tcl/target/c100helper.tcl index 477fe5c..2a12c36 100644 --- a/tcl/target/c100helper.tcl +++ b/tcl/target/c100helper.tcl @@ -469,11 +469,12 @@ proc initC100 {} { mww $INTC_ARM1_CONTROL_REG 0x1 # configure clocks setupPLL + # setupUART0 must be run before setupDDR2 as setupDDR2 uses UART. + setupUART0 # enable cache # ? (u-boot does nothing here) # DDR2 memory init setupDDR2 - setupUART0 putsUART0 "C100 initialization complete.\n" puts "C100 initialization complete." } ----------------------------------------------------------------------- Summary of changes: tcl/target/c100helper.tcl | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-14 22:13:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 3e51d893ed3d1273b5487e05196f00fe3d14773d (commit) from 9132f7083d01510eb1c2471a7c3f3247e35cdf3b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3e51d893ed3d1273b5487e05196f00fe3d14773d Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 11:51:25 2010 +0200 -Wshadow fixes Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/common.c b/src/flash/common.c index 17bc81c..46cb243 100644 --- a/src/flash/common.c +++ b/src/flash/common.c @@ -25,13 +25,13 @@ unsigned get_flash_name_index(const char *name) { - const char *index = strrchr(name, '.'); - if (NULL == index) + const char *name_index = strrchr(name, '.'); + if (NULL == name_index) return 0; - if (index[1] < '0' || index[1] > '9') + if (name_index[1] < '0' || name_index[1] > '9') return ~0U; unsigned requested; - int retval = parse_uint(index + 1, &requested); + int retval = parse_uint(name_index + 1, &requested); // detect parsing error by forcing past end of bank list return (ERROR_OK == retval) ? requested : ~0U; } diff --git a/src/flash/nand/lpc3180.c b/src/flash/nand/lpc3180.c index 40324f2..93d00d5 100644 --- a/src/flash/nand/lpc3180.c +++ b/src/flash/nand/lpc3180.c @@ -649,7 +649,7 @@ static int lpc3180_write_page(struct nand_device *nand, uint32_t page, uint8_t * * **********************************************************************/ - int retval,i=0,target_mem_base; + int i=0,target_mem_base; uint8_t *ecc_flash_buffer; struct working_area *pworking_area; diff --git a/src/helper/fileio.c b/src/helper/fileio.c index 8f2ce22..71e807f 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -33,24 +33,24 @@ static inline int fileio_open_local(struct fileio *fileio) { - char access[4]; + char file_access[4]; switch (fileio->access) { case FILEIO_READ: - strcpy(access, "r"); + strcpy(file_access, "r"); break; case FILEIO_WRITE: - strcpy(access, "w"); + strcpy(file_access, "w"); break; case FILEIO_READWRITE: - strcpy(access, "w+"); + strcpy(file_access, "w+"); break; case FILEIO_APPEND: - strcpy(access, "a"); + strcpy(file_access, "a"); break; case FILEIO_APPENDREAD: - strcpy(access, "a+"); + strcpy(file_access, "a+"); break; default: LOG_ERROR("BUG: access neither read, write nor readwrite"); @@ -62,10 +62,10 @@ static inline int fileio_open_local(struct fileio *fileio) if (fileio->type == FILEIO_BINARY) #endif { - strcat(access, "b"); + strcat(file_access, "b"); } - if (!(fileio->file = open_file_from_path (fileio->url, access))) + if (!(fileio->file = open_file_from_path (fileio->url, file_access))) { LOG_ERROR("couldn't open %s", fileio->url); return ERROR_FILEIO_OPERATION_FAILED; diff --git a/src/server/server.c b/src/server/server.c index 57c4016..7d8ad51 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -264,7 +264,7 @@ int server_loop(struct command_context *command_context) { struct service *service; - bool poll = true; + bool poll_ok = true; /* used in select() */ fd_set read_fds; @@ -322,7 +322,7 @@ int server_loop(struct command_context *command_context) struct timeval tv; tv.tv_sec = 0; - if (poll) + if (poll_ok) { /* we're just polling this iteration, this is faster on embedded * hosts */ @@ -375,11 +375,11 @@ int server_loop(struct command_context *command_context) FD_ZERO(&read_fds); /* eCos leaves read_fds unchanged in this case! */ /* We timed out/there was nothing to do, timeout rather than poll next time */ - poll = false; + poll_ok = false; } else { /* There was something to do, next time we'll just poll */ - poll = true; + poll_ok = true; } for (service = services; service; service = service->next) ----------------------------------------------------------------------- Summary of changes: src/flash/common.c | 8 ++++---- src/flash/nand/lpc3180.c | 2 +- src/helper/fileio.c | 16 ++++++++-------- src/server/server.c | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-14 15:44:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 9132f7083d01510eb1c2471a7c3f3247e35cdf3b (commit) from b6a82540654f02dbf4caaed1be538044220dd3dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9132f7083d01510eb1c2471a7c3f3247e35cdf3b Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 15:42:39 2010 +0200 cfi: add LOG_ERROR() in case of unsupported intel erase algorithm found by code inspection. There are many other places in CFI where LOG_ERROR() should be called similarly... Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index c134317..96aca48 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -979,7 +979,10 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la * instant individual block locking (bit 5). */ if (!(pri_ext->feature_support & 0x28)) + { + LOG_ERROR("lock/unlock not supported on flash"); return ERROR_FLASH_OPERATION_FAILED; + } cfi_intel_clear_status_register(bank); ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-14 12:29:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b6a82540654f02dbf4caaed1be538044220dd3dc (commit) via f3ae52cace69f9568bac719d50af3a62993e96ad (commit) from 18918a0423e04180f580a4a9453e190488aab17d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b6a82540654f02dbf4caaed1be538044220dd3dc Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 12:08:46 2010 +0200 flash: fix bug in error propagation of flash write_image when a write/unlock/erase failed during write_image, then an error was not propagated back up so e.g. flash write image from tcl scripts would not throw an exception. Also flash filling speed was printed even when the operation failed. Output is now less confusing. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 714cbe4..c134317 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -2383,8 +2383,6 @@ static int cfi_probe(struct flash_bank *bank) */ if (cfi_info->not_cfi == 0) { - int retval; - /* enter CFI query mode * according to JEDEC Standard No. 68.01, * a single bus sequence with address = 0x55, data = 0x98 should put @@ -2716,7 +2714,7 @@ static int cfi_protect_check(struct flash_bank *bank) return ERROR_OK; } -static int cfi_info(struct flash_bank *bank, char *buf, int buf_size) +static int get_cfi_info(struct flash_bank *bank, char *buf, int buf_size) { int printed; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -2806,5 +2804,5 @@ struct flash_driver cfi_flash = { /* FIXME: access flash at bus_width size */ .erase_check = default_flash_blank_check, .protect_check = cfi_protect_check, - .info = cfi_info, + .info = get_cfi_info, }; diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index d2f2754..84408e6 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -599,7 +599,6 @@ int flash_write_unlock(struct target *target, struct image *image, } /* find the corresponding flash bank */ - int retval; retval = get_flash_bank_by_addr(target, run_address, false, &c); if (retval != ERROR_OK) return retval; diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 3d67327..28a504e 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -576,7 +576,7 @@ COMMAND_HANDLER(handle_flash_fill_command) } } - if (duration_measure(&bench) == ERROR_OK) + if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) { command_print(CMD_CTX, "wrote %" PRIu32 " bytes to 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)", wrote, address, commit f3ae52cace69f9568bac719d50af3a62993e96ad Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 12:10:35 2010 +0200 helper: fix -Wshadow warning in number parsing use obtuse local variable names in macros to avoid interfering with global name space Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/command.h b/src/helper/command.h index 2c19241..1bf2cb4 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -387,11 +387,11 @@ DECLARE_PARSE_WRAPPER(_s8, int8_t); */ #define COMMAND_PARSE_NUMBER(type, in, out) \ do { \ - int retval = parse_##type(in, &(out)); \ - if (ERROR_OK != retval) { \ + int retval_macro_tmp = parse_##type(in, &(out)); \ + if (ERROR_OK != retval_macro_tmp) { \ command_print(CMD_CTX, stringify(out) \ " option value ('%s') is not valid", in); \ - return retval; \ + return retval_macro_tmp; \ } \ } while (0) @@ -404,13 +404,13 @@ DECLARE_PARSE_WRAPPER(_s8, int8_t); #define COMMAND_PARSE_BOOL(in, out, on, off) \ do { \ bool value; \ - int retval = command_parse_bool_arg(in, &value); \ - if (ERROR_OK != retval) { \ + int retval_macro_tmp = command_parse_bool_arg(in, &value); \ + if (ERROR_OK != retval_macro_tmp) { \ command_print(CMD_CTX, stringify(out) \ " option value ('%s') is not valid", in); \ command_print(CMD_CTX, " choices are '%s' or '%s'", \ on, off); \ - return retval; \ + return retval_macro_tmp; \ } \ out = value; \ } while (0) ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 6 ++---- src/flash/nor/core.c | 1 - src/flash/nor/tcl.c | 2 +- src/helper/command.h | 12 ++++++------ 4 files changed, 9 insertions(+), 12 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-14 10:00:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 18918a0423e04180f580a4a9453e190488aab17d (commit) from aa2de47d3ce4d484c124f0449702f511aab49112 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 18918a0423e04180f580a4a9453e190488aab17d Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 09:47:33 2010 +0200 cfi: fix gaffe introduced in previous version flash probe broke w/in last commit. ecc8041c0f4c30a7310c0f8414a5261ee7a090ca Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index f911bb7..714cbe4 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -2473,10 +2473,10 @@ static int cfi_probe(struct flash_bank *bank) (1 << cfi_info->chip_erase_timeout_max) * (1 << cfi_info->chip_erase_timeout_typ)); uint8_t data; - retval = 1 << cfi_query_u8(bank, 0, 0x27, &data); + retval = cfi_query_u8(bank, 0, 0x27, &data); if (retval != ERROR_OK) return retval; - cfi_info->dev_size = data; + cfi_info->dev_size = 1 << data; retval = cfi_query_u16(bank, 0, 0x28, &cfi_info->interface_desc); if (retval != ERROR_OK) ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-14 09:35:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via aa2de47d3ce4d484c124f0449702f511aab49112 (commit) from bac52fbac83f0d04fb51a2547e6ae76fff1ac1dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aa2de47d3ce4d484c124f0449702f511aab49112 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Jun 14 09:30:37 2010 +0200 target: fix retval gaffe in mwX commands failure to write to memory was not propagated. This is an interesting case of broken error handling: with exceptions we wouldn't have had this at all, and I also wonder if there is a GCC option to warn about these kinds of potential bugs. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/target.c b/src/target/target.c index 01d9441..435d7b6 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2378,7 +2378,7 @@ static int target_fill_mem(struct target *target, { current = chunk_size; } - int retval = fn(target, address + x * data_size, data_size, current, target_buf); + retval = fn(target, address + x * data_size, data_size, current, target_buf); if (retval != ERROR_OK) { break; ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-12 16:47:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via bac52fbac83f0d04fb51a2547e6ae76fff1ac1dc (commit) from 9e62f86f24dbd1a3f8d1a84fbfd18dc15dc23002 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bac52fbac83f0d04fb51a2547e6ae76fff1ac1dc Author: Antonio Borneo <bor...@gm...> Date: Sat Jun 12 18:35:06 2010 +0800 TARGET: removed unused parameters Parameters "domain" and "ap" of function armv4_5_mmu_translate_va() are not used. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index d450224..8db0b5d 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -255,13 +255,11 @@ static int arm720_virt2phys(struct target *target, uint32_t virtual, uint32_t *physical) { uint32_t cb; - int domain; - uint32_t ap; struct arm720t_common *arm720t = target_to_arm720(target); uint32_t ret; int retval = armv4_5_mmu_translate_va(target, - &arm720t->armv4_5_mmu, virtual, &cb, &domain, &ap, &ret); + &arm720t->armv4_5_mmu, virtual, &cb, &ret); if (retval != ERROR_OK) return retval; *physical = ret; diff --git a/src/target/arm920t.c b/src/target/arm920t.c index b8ff819..b99b4d5 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -509,13 +509,11 @@ static int arm920_virt2phys(struct target *target, uint32_t virt, uint32_t *phys) { uint32_t cb; - int domain; - uint32_t ap; struct arm920t_common *arm920t = target_to_arm920(target); uint32_t ret; int retval = armv4_5_mmu_translate_va(target, - &arm920t->armv4_5_mmu, virt, &cb, &domain, &ap, &ret); + &arm920t->armv4_5_mmu, virt, &cb, &ret); if (retval != ERROR_OK) return retval; *phys = ret; @@ -579,15 +577,13 @@ int arm920t_write_memory(struct target *target, uint32_t address, * by MMU */ uint32_t cb; - int domain; - uint32_t ap; uint32_t pa; /* * We need physical address and cb */ retval = armv4_5_mmu_translate_va(target, &arm920t->armv4_5_mmu, - address, &cb, &domain, &ap, &pa); + address, &cb, &pa); if (retval != ERROR_OK) return retval; diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index dd1d365..918306d 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -721,13 +721,11 @@ COMMAND_HANDLER(arm926ejs_handle_cache_info_command) static int arm926ejs_virt2phys(struct target *target, uint32_t virtual, uint32_t *physical) { uint32_t cb; - int domain; - uint32_t ap; struct arm926ejs_common *arm926ejs = target_to_arm926(target); uint32_t ret; int retval = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, - virtual, &cb, &domain, &ap, &ret); + virtual, &cb, &ret); if (retval != ERROR_OK) return retval; *physical = ret; diff --git a/src/target/armv4_5_mmu.c b/src/target/armv4_5_mmu.c index 78163f1..861410d 100644 --- a/src/target/armv4_5_mmu.c +++ b/src/target/armv4_5_mmu.c @@ -26,7 +26,7 @@ #include "armv4_5_mmu.h" -int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, uint32_t *cb, int *domain, uint32_t *ap, uint32_t *val) +int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, uint32_t *cb, uint32_t *val) { uint32_t first_lvl_descriptor = 0x0; uint32_t second_lvl_descriptor = 0x0; @@ -54,14 +54,10 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a return ERROR_TARGET_TRANSLATION_FAULT; } - /* domain is always specified in bits 8-5 */ - *domain = (first_lvl_descriptor & 0x1e0) >> 5; - if ((first_lvl_descriptor & 0x3) == 2) { /* section descriptor */ *cb = (first_lvl_descriptor & 0xc) >> 2; - *ap = (first_lvl_descriptor & 0xc00) >> 10; *val = (first_lvl_descriptor & 0xfff00000) | (va & 0x000fffff); return ERROR_OK; } @@ -101,7 +97,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((second_lvl_descriptor & 0x3) == 1) { /* large page descriptor */ - *ap = (second_lvl_descriptor & 0xff0) >> 4; *val = (second_lvl_descriptor & 0xffff0000) | (va & 0x0000ffff); return ERROR_OK; } @@ -109,7 +104,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((second_lvl_descriptor & 0x3) == 2) { /* small page descriptor */ - *ap = (second_lvl_descriptor & 0xff0) >> 4; *val = (second_lvl_descriptor & 0xfffff000) | (va & 0x00000fff); return ERROR_OK; } @@ -117,7 +111,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((second_lvl_descriptor & 0x3) == 3) { /* tiny page descriptor */ - *ap = (second_lvl_descriptor & 0x30) >> 4; *val = (second_lvl_descriptor & 0xfffffc00) | (va & 0x000003ff); return ERROR_OK; } diff --git a/src/target/armv4_5_mmu.h b/src/target/armv4_5_mmu.h index 8f540a6..24f3993 100644 --- a/src/target/armv4_5_mmu.h +++ b/src/target/armv4_5_mmu.h @@ -38,7 +38,7 @@ struct armv4_5_mmu_common int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, - uint32_t *cb, int *domain, uint32_t *ap, uint32_t *val); + uint32_t *cb, uint32_t *val); int armv4_5_mmu_read_physical(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index e26bb3d..c2d61a3 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1802,8 +1802,6 @@ static int cortex_a8_virt2phys(struct target *target, uint32_t virt, uint32_t *phys) { uint32_t cb; - int domain; - uint32_t ap; struct cortex_a8_common *cortex_a8 = target_to_cortex_a8(target); // struct armv7a_common *armv7a = &cortex_a8->armv7a_common; struct armv7a_common *armv7a = target_to_armv7a(target); @@ -1818,7 +1816,7 @@ static int cortex_a8_virt2phys(struct target *target, cortex_a8->current_address_mode = ARM_MODE_SVC; uint32_t ret; int retval = armv4_5_mmu_translate_va(target, - &armv7a->armv4_5_mmu, virt, &cb, &domain, &ap, &ret); + &armv7a->armv4_5_mmu, virt, &cb, &ret); if (retval != ERROR_OK) return retval; /* Reset the flag. We don't want someone else to use it by error */ diff --git a/src/target/xscale.c b/src/target/xscale.c index e2b4b6d..d5c2129 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3217,8 +3217,6 @@ static int xscale_virt2phys(struct target *target, { struct xscale_common *xscale = target_to_xscale(target); uint32_t cb; - int domain; - uint32_t ap; if (xscale->common_magic != XSCALE_COMMON_MAGIC) { LOG_ERROR(xscale_not); @@ -3227,7 +3225,7 @@ static int xscale_virt2phys(struct target *target, uint32_t ret; int retval = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, - virtual, &cb, &domain, &ap, &ret); + virtual, &cb, &ret); if (retval != ERROR_OK) return retval; *physical = ret; ----------------------------------------------------------------------- Summary of changes: src/target/arm720t.c | 4 +--- src/target/arm920t.c | 8 ++------ src/target/arm926ejs.c | 4 +--- src/target/armv4_5_mmu.c | 9 +-------- src/target/armv4_5_mmu.h | 2 +- src/target/cortex_a8.c | 4 +--- src/target/xscale.c | 4 +--- 7 files changed, 8 insertions(+), 27 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-12 12:10:47
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 9e62f86f24dbd1a3f8d1a84fbfd18dc15dc23002 (commit) via ce58ab9a4ef7f014eac4d2e30d2b54b2c3e53895 (commit) via dcc7de4f9b4dfa58ed8a8712c4c146a3c83aba17 (commit) via 20724e33250c48aa8f1e9332d1704dd8d58cda9b (commit) from 4532dc78314a543f205e15d37d1bc7fa03df7595 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9e62f86f24dbd1a3f8d1a84fbfd18dc15dc23002 Author: Antonio Borneo <bor...@gm...> Date: Sat Jun 12 11:58:50 2010 +0800 TARGET: removed unsed parameter Parameter "type" of function armv4_5_mmu_translate_va() is now not used. Remove the parameter and the "enum" listing its values. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index e7672b4..d450224 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -254,14 +254,14 @@ static int arm720_mmu(struct target *target, int *enabled) static int arm720_virt2phys(struct target *target, uint32_t virtual, uint32_t *physical) { - int type; uint32_t cb; int domain; uint32_t ap; struct arm720t_common *arm720t = target_to_arm720(target); uint32_t ret; - int retval = armv4_5_mmu_translate_va(target, &arm720t->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); + int retval = armv4_5_mmu_translate_va(target, + &arm720t->armv4_5_mmu, virtual, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; *physical = ret; diff --git a/src/target/arm920t.c b/src/target/arm920t.c index fe2ff01..b8ff819 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -508,7 +508,6 @@ static int arm920_mmu(struct target *target, int *enabled) static int arm920_virt2phys(struct target *target, uint32_t virt, uint32_t *phys) { - int type; uint32_t cb; int domain; uint32_t ap; @@ -516,7 +515,7 @@ static int arm920_virt2phys(struct target *target, uint32_t ret; int retval = armv4_5_mmu_translate_va(target, - &arm920t->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret); + &arm920t->armv4_5_mmu, virt, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; *phys = ret; @@ -579,7 +578,6 @@ int arm920t_write_memory(struct target *target, uint32_t address, * in memory marked read only * by MMU */ - int type; uint32_t cb; int domain; uint32_t ap; @@ -589,7 +587,7 @@ int arm920t_write_memory(struct target *target, uint32_t address, * We need physical address and cb */ retval = armv4_5_mmu_translate_va(target, &arm920t->armv4_5_mmu, - address, &type, &cb, &domain, &ap, &pa); + address, &cb, &domain, &ap, &pa); if (retval != ERROR_OK) return retval; diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index bfa2ab4..dd1d365 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -720,14 +720,14 @@ COMMAND_HANDLER(arm926ejs_handle_cache_info_command) static int arm926ejs_virt2phys(struct target *target, uint32_t virtual, uint32_t *physical) { - int type; uint32_t cb; int domain; uint32_t ap; struct arm926ejs_common *arm926ejs = target_to_arm926(target); uint32_t ret; - int retval = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); + int retval = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, + virtual, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; *physical = ret; diff --git a/src/target/armv4_5_mmu.c b/src/target/armv4_5_mmu.c index 52756c1..78163f1 100644 --- a/src/target/armv4_5_mmu.c +++ b/src/target/armv4_5_mmu.c @@ -26,7 +26,7 @@ #include "armv4_5_mmu.h" -int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, int *type, uint32_t *cb, int *domain, uint32_t *ap, uint32_t *val) +int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, uint32_t *cb, int *domain, uint32_t *ap, uint32_t *val) { uint32_t first_lvl_descriptor = 0x0; uint32_t second_lvl_descriptor = 0x0; @@ -60,7 +60,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((first_lvl_descriptor & 0x3) == 2) { /* section descriptor */ - *type = ARMV4_5_SECTION; *cb = (first_lvl_descriptor & 0xc) >> 2; *ap = (first_lvl_descriptor & 0xc00) >> 10; *val = (first_lvl_descriptor & 0xfff00000) | (va & 0x000fffff); @@ -102,7 +101,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((second_lvl_descriptor & 0x3) == 1) { /* large page descriptor */ - *type = ARMV4_5_LARGE_PAGE; *ap = (second_lvl_descriptor & 0xff0) >> 4; *val = (second_lvl_descriptor & 0xffff0000) | (va & 0x0000ffff); return ERROR_OK; @@ -111,7 +109,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((second_lvl_descriptor & 0x3) == 2) { /* small page descriptor */ - *type = ARMV4_5_SMALL_PAGE; *ap = (second_lvl_descriptor & 0xff0) >> 4; *val = (second_lvl_descriptor & 0xfffff000) | (va & 0x00000fff); return ERROR_OK; @@ -120,7 +117,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((second_lvl_descriptor & 0x3) == 3) { /* tiny page descriptor */ - *type = ARMV4_5_TINY_PAGE; *ap = (second_lvl_descriptor & 0x30) >> 4; *val = (second_lvl_descriptor & 0xfffffc00) | (va & 0x000003ff); return ERROR_OK; diff --git a/src/target/armv4_5_mmu.h b/src/target/armv4_5_mmu.h index 3a6851f..8f540a6 100644 --- a/src/target/armv4_5_mmu.h +++ b/src/target/armv4_5_mmu.h @@ -36,15 +36,8 @@ struct armv4_5_mmu_common int mmu_enabled; }; -enum -{ - ARMV4_5_SECTION, ARMV4_5_LARGE_PAGE, ARMV4_5_SMALL_PAGE, ARMV4_5_TINY_PAGE -}; - -extern char* armv4_5_page_type_names[]; - int armv4_5_mmu_translate_va(struct target *target, - struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, int *type, + struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, uint32_t *cb, int *domain, uint32_t *ap, uint32_t *val); int armv4_5_mmu_read_physical(struct target *target, diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index f154179..e26bb3d 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1801,7 +1801,6 @@ static int cortex_a8_mmu(struct target *target, int *enabled) static int cortex_a8_virt2phys(struct target *target, uint32_t virt, uint32_t *phys) { - int type; uint32_t cb; int domain; uint32_t ap; @@ -1819,7 +1818,7 @@ static int cortex_a8_virt2phys(struct target *target, cortex_a8->current_address_mode = ARM_MODE_SVC; uint32_t ret; int retval = armv4_5_mmu_translate_va(target, - &armv7a->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret); + &armv7a->armv4_5_mmu, virt, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; /* Reset the flag. We don't want someone else to use it by error */ diff --git a/src/target/xscale.c b/src/target/xscale.c index d16f8ec..e2b4b6d 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3216,7 +3216,6 @@ static int xscale_virt2phys(struct target *target, uint32_t virtual, uint32_t *physical) { struct xscale_common *xscale = target_to_xscale(target); - int type; uint32_t cb; int domain; uint32_t ap; @@ -3227,7 +3226,8 @@ static int xscale_virt2phys(struct target *target, } uint32_t ret; - int retval = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); + int retval = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, + virtual, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; *physical = ret; commit ce58ab9a4ef7f014eac4d2e30d2b54b2c3e53895 Author: Antonio Borneo <bor...@gm...> Date: Sat Jun 12 11:46:56 2010 +0800 TARGET: fix handling return code of MMU translation Function armv4_5_mmu_translate_va() now properly signals errors in the return value. Remove former error handling by setting variable "type" to value "-1". Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 867eb94..e7672b4 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -264,10 +264,6 @@ static int arm720_virt2phys(struct target *target, int retval = armv4_5_mmu_translate_va(target, &arm720t->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; - if (type == -1) - { - return ret; - } *physical = ret; return ERROR_OK; } diff --git a/src/target/arm920t.c b/src/target/arm920t.c index d709648..fe2ff01 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -519,10 +519,6 @@ static int arm920_virt2phys(struct target *target, &arm920t->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; - if (type == -1) - { - return ret; - } *phys = ret; return ERROR_OK; } @@ -596,8 +592,6 @@ int arm920t_write_memory(struct target *target, uint32_t address, address, &type, &cb, &domain, &ap, &pa); if (retval != ERROR_OK) return retval; - if (type == -1) - return pa; if (arm920t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled) { diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index a7aac55..bfa2ab4 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -730,10 +730,6 @@ static int arm926ejs_virt2phys(struct target *target, uint32_t virtual, uint32_t int retval = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; - if (type == -1) - { - return ret; - } *physical = ret; return ERROR_OK; } diff --git a/src/target/armv4_5_mmu.c b/src/target/armv4_5_mmu.c index 6990d13..52756c1 100644 --- a/src/target/armv4_5_mmu.c +++ b/src/target/armv4_5_mmu.c @@ -44,14 +44,12 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((first_lvl_descriptor & 0x3) == 0) { - *type = -1; LOG_ERROR("Address translation failure"); return ERROR_TARGET_TRANSLATION_FAULT; } if (!armv4_5_mmu->has_tiny_pages && ((first_lvl_descriptor & 0x3) == 3)) { - *type = -1; LOG_ERROR("Address translation failure"); return ERROR_TARGET_TRANSLATION_FAULT; } @@ -94,7 +92,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a if ((second_lvl_descriptor & 0x3) == 0) { - *type = -1; LOG_ERROR("Address translation failure"); return ERROR_TARGET_TRANSLATION_FAULT; } @@ -130,7 +127,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a } /* should not happen */ - *type = -1; LOG_ERROR("Address translation failure"); return ERROR_TARGET_TRANSLATION_FAULT; } diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index 2edb9e3..f154179 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1825,10 +1825,6 @@ static int cortex_a8_virt2phys(struct target *target, /* Reset the flag. We don't want someone else to use it by error */ cortex_a8->current_address_mode = ARM_MODE_ANY; - if (type == -1) - { - return ret; - } *phys = ret; return ERROR_OK; } diff --git a/src/target/xscale.c b/src/target/xscale.c index ab7eee3..d16f8ec 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3230,10 +3230,6 @@ static int xscale_virt2phys(struct target *target, int retval = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); if (retval != ERROR_OK) return retval; - if (type == -1) - { - return ret; - } *physical = ret; return ERROR_OK; } commit dcc7de4f9b4dfa58ed8a8712c4c146a3c83aba17 Author: Antonio Borneo <bor...@gm...> Date: Sat Jun 12 11:07:47 2010 +0800 TARGET/ARM920T: fix return value Function arm920t_write_memory() default return value should be ERROR_OK. All cases of local errors are handled immediately and not further propagated. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 03aa233..d709648 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -711,7 +711,7 @@ int arm920t_write_memory(struct target *target, uint32_t address, } } - return retval; + return ERROR_OK; } // EXPORTED to FA256 commit 20724e33250c48aa8f1e9332d1704dd8d58cda9b Author: Antonio Borneo <bor...@gm...> Date: Sat Jun 12 11:01:24 2010 +0800 TARGET/ARM920T: fix compile warning Commit 0538081246fafbfb74d554bb1b758412534aa254 introduces a compile time warning: arm920t.c: In function âarm920t_write_memoryâ: arm920t.c:567: warning: âretvalâ may be used uninitialized in this function Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 3175196..03aa233 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -592,7 +592,7 @@ int arm920t_write_memory(struct target *target, uint32_t address, /* * We need physical address and cb */ - int retval = armv4_5_mmu_translate_va(target, &arm920t->armv4_5_mmu, + retval = armv4_5_mmu_translate_va(target, &arm920t->armv4_5_mmu, address, &type, &cb, &domain, &ap, &pa); if (retval != ERROR_OK) return retval; ----------------------------------------------------------------------- Summary of changes: src/target/arm720t.c | 8 ++------ src/target/arm920t.c | 16 ++++------------ src/target/arm926ejs.c | 8 ++------ src/target/armv4_5_mmu.c | 10 +--------- src/target/armv4_5_mmu.h | 9 +-------- src/target/cortex_a8.c | 7 +------ src/target/xscale.c | 8 ++------ 7 files changed, 13 insertions(+), 53 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-11 15:54:59
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4532dc78314a543f205e15d37d1bc7fa03df7595 (commit) via 0538081246fafbfb74d554bb1b758412534aa254 (commit) via ecc8041c0f4c30a7310c0f8414a5261ee7a090ca (commit) from 73aaaf483035cfe79fe339d6c073e851bc9f8f9a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4532dc78314a543f205e15d37d1bc7fa03df7595 Author: Ãyvind Harboe <oyv...@zy...> Date: Fri Jun 11 08:10:39 2010 +0200 flash: add error handling to get_flash_by_addr/name autoprobing can fail and this error has to be reported up the call stack. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 429bad6..d2f2754 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -197,7 +197,7 @@ struct flash_bank *get_flash_bank_by_name_noprobe(const char *name) return NULL; } -struct flash_bank *get_flash_bank_by_name(const char *name) +int get_flash_bank_by_name(const char *name, struct flash_bank **bank_result) { struct flash_bank *bank; int retval; @@ -210,11 +210,12 @@ struct flash_bank *get_flash_bank_by_name(const char *name) if (retval != ERROR_OK) { LOG_ERROR("auto_probe failed %d\n", retval); - return NULL; + return retval; } } - return bank; + *bank_result = bank; + return ERROR_OK; } int get_flash_bank_by_num(int num, struct flash_bank **bank) @@ -238,8 +239,9 @@ int get_flash_bank_by_num(int num, struct flash_bank **bank) return ERROR_OK; } -/* lookup flash bank by address */ -struct flash_bank *get_flash_bank_by_addr(struct target *target, uint32_t addr) +/* lookup flash bank by address, bank not found is success, but + * result_bank is set to NULL. */ +int get_flash_bank_by_addr(struct target *target, uint32_t addr, bool check, struct flash_bank **result_bank) { struct flash_bank *c; @@ -252,14 +254,22 @@ struct flash_bank *get_flash_bank_by_addr(struct target *target, uint32_t addr) if (retval != ERROR_OK) { LOG_ERROR("auto_probe failed %d\n", retval); - return NULL; + return retval; } /* check whether address belongs to this flash bank */ if ((addr >= c->base) && (addr <= c->base + (c->size - 1)) && target == c->target) - return c; + { + *result_bank = c; + return ERROR_OK; + } } - LOG_ERROR("No flash at address 0x%08" PRIx32 "\n", addr); - return NULL; + *result_bank = NULL; + if (check) + { + LOG_ERROR("No flash at address 0x%08" PRIx32 "\n", addr); + return ERROR_FAIL; + } + return ERROR_OK; } int default_flash_mem_blank_check(struct flash_bank *bank) @@ -379,8 +389,9 @@ static int flash_iterate_address_range(struct target *target, int last = -1; int i; - if ((c = get_flash_bank_by_addr(target, addr)) == NULL) - return ERROR_FLASH_DST_OUT_OF_BANK; /* no corresponding bank found */ + int retval = get_flash_bank_by_addr(target, addr, true, &c); + if (retval != ERROR_OK) + return retval; if (c->size == 0 || c->num_sectors == 0) { @@ -588,7 +599,11 @@ int flash_write_unlock(struct target *target, struct image *image, } /* find the corresponding flash bank */ - if ((c = get_flash_bank_by_addr(target, run_address)) == NULL) + int retval; + retval = get_flash_bank_by_addr(target, run_address, false, &c); + if (retval != ERROR_OK) + return retval; + if (c == NULL) { section++; /* and skip it */ section_offset = 0; diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index 17f1c53..ff14df0 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -168,7 +168,7 @@ int default_flash_mem_blank_check(struct flash_bank *bank); * bank number: when two str9x banks are defined, then 'str9x.1' refers * to the second. */ -struct flash_bank *get_flash_bank_by_name(const char *name); +int get_flash_bank_by_name(const char *name, struct flash_bank **bank_result); /** * Returns the flash bank specified by @a name, which matches the * driver name and a suffix (option) specify the driver-specific @@ -206,8 +206,9 @@ struct flash_bank *get_flash_bank_by_num_noprobe(int num); * Returns the flash bank located at a specified address. * @param target The target, presumed to contain one or more banks. * @param addr An address that is within the range of the bank. + * @param check return ERROR_OK and result_bank NULL if the bank does not exist * @returns The struct flash_bank located at @a addr, or NULL. */ -struct flash_bank *get_flash_bank_by_addr(struct target *target, uint32_t addr); +int get_flash_bank_by_addr(struct target *target, uint32_t addr, bool check, struct flash_bank **result_bank); #endif // FLASH_NOR_CORE_H diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index cf1ca4a..3d67327 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -35,7 +35,9 @@ COMMAND_HELPER(flash_command_get_bank, unsigned name_index, struct flash_bank **bank) { const char *name = CMD_ARGV[name_index]; - *bank = get_flash_bank_by_name(name); + int retval = get_flash_bank_by_name(name, bank); + if (retval != ERROR_OK) + return retval; if (*bank) return ERROR_OK; @@ -238,11 +240,9 @@ COMMAND_HANDLER(handle_flash_erase_address_command) return ERROR_COMMAND_SYNTAX_ERROR; } - p = get_flash_bank_by_addr(target, address); - if (p == NULL) - { - return ERROR_FAIL; - } + retval = get_flash_bank_by_addr(target, address, true, &p); + if (retval != ERROR_OK) + return retval; /* We can't know if we did a resume + halt, in which case we no longer know the erased state */ flash_set_dirty(); @@ -544,12 +544,9 @@ COMMAND_HANDLER(handle_flash_fill_command) { struct flash_bank *bank; - bank = get_flash_bank_by_addr(target, address); - if (bank == NULL) - { - retval = ERROR_FAIL; + retval = get_flash_bank_by_addr(target, address, true, &bank ); + if (retval != ERROR_OK) goto done; - } cur_size = MIN((count * wordsize - wrote), chunksize); err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size); commit 0538081246fafbfb74d554bb1b758412534aa254 Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Jun 10 16:18:14 2010 +0200 arm mmu: error propagation added for address translation The return value for MMU translation was a mess, either error or value. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 0093360..867eb94 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -260,7 +260,10 @@ static int arm720_virt2phys(struct target *target, uint32_t ap; struct arm720t_common *arm720t = target_to_arm720(target); - uint32_t ret = armv4_5_mmu_translate_va(target, &arm720t->armv4_5_mmu, virtual, &type, &cb, &domain, &ap); + uint32_t ret; + int retval = armv4_5_mmu_translate_va(target, &arm720t->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); + if (retval != ERROR_OK) + return retval; if (type == -1) { return ret; diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 658315b..3175196 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -514,8 +514,11 @@ static int arm920_virt2phys(struct target *target, uint32_t ap; struct arm920t_common *arm920t = target_to_arm920(target); - uint32_t ret = armv4_5_mmu_translate_va(target, - &arm920t->armv4_5_mmu, virt, &type, &cb, &domain, &ap); + uint32_t ret; + int retval = armv4_5_mmu_translate_va(target, + &arm920t->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret); + if (retval != ERROR_OK) + return retval; if (type == -1) { return ret; @@ -589,8 +592,10 @@ int arm920t_write_memory(struct target *target, uint32_t address, /* * We need physical address and cb */ - pa = armv4_5_mmu_translate_va(target, &arm920t->armv4_5_mmu, - address, &type, &cb, &domain, &ap); + int retval = armv4_5_mmu_translate_va(target, &arm920t->armv4_5_mmu, + address, &type, &cb, &domain, &ap, &pa); + if (retval != ERROR_OK) + return retval; if (type == -1) return pa; diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 1f753a6..a7aac55 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -726,7 +726,10 @@ static int arm926ejs_virt2phys(struct target *target, uint32_t virtual, uint32_t uint32_t ap; struct arm926ejs_common *arm926ejs = target_to_arm926(target); - uint32_t ret = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, virtual, &type, &cb, &domain, &ap); + uint32_t ret; + int retval = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); + if (retval != ERROR_OK) + return retval; if (type == -1) { return ret; diff --git a/src/target/armv4_5_mmu.c b/src/target/armv4_5_mmu.c index fc1dde7..6990d13 100644 --- a/src/target/armv4_5_mmu.c +++ b/src/target/armv4_5_mmu.c @@ -26,15 +26,18 @@ #include "armv4_5_mmu.h" -uint32_t armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, int *type, uint32_t *cb, int *domain, uint32_t *ap) +int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, int *type, uint32_t *cb, int *domain, uint32_t *ap, uint32_t *val) { uint32_t first_lvl_descriptor = 0x0; uint32_t second_lvl_descriptor = 0x0; uint32_t ttb = armv4_5_mmu->get_ttb(target); + int retval; - armv4_5_mmu_read_physical(target, armv4_5_mmu, + retval = armv4_5_mmu_read_physical(target, armv4_5_mmu, (ttb & 0xffffc000) | ((va & 0xfff00000) >> 18), 4, 1, (uint8_t*)&first_lvl_descriptor); + if (retval != ERROR_OK) + return retval; first_lvl_descriptor = target_buffer_get_u32(target, (uint8_t*)&first_lvl_descriptor); LOG_DEBUG("1st lvl desc: %8.8" PRIx32 "", first_lvl_descriptor); @@ -62,22 +65,27 @@ uint32_t armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_comm *type = ARMV4_5_SECTION; *cb = (first_lvl_descriptor & 0xc) >> 2; *ap = (first_lvl_descriptor & 0xc00) >> 10; - return (first_lvl_descriptor & 0xfff00000) | (va & 0x000fffff); + *val = (first_lvl_descriptor & 0xfff00000) | (va & 0x000fffff); + return ERROR_OK; } if ((first_lvl_descriptor & 0x3) == 1) { /* coarse page table */ - armv4_5_mmu_read_physical(target, armv4_5_mmu, + retval = armv4_5_mmu_read_physical(target, armv4_5_mmu, (first_lvl_descriptor & 0xfffffc00) | ((va & 0x000ff000) >> 10), 4, 1, (uint8_t*)&second_lvl_descriptor); + if (retval != ERROR_OK) + return retval; } else if ((first_lvl_descriptor & 0x3) == 3) { /* fine page table */ - armv4_5_mmu_read_physical(target, armv4_5_mmu, + retval = armv4_5_mmu_read_physical(target, armv4_5_mmu, (first_lvl_descriptor & 0xfffff000) | ((va & 0x000ffc00) >> 8), 4, 1, (uint8_t*)&second_lvl_descriptor); + if (retval != ERROR_OK) + return retval; } second_lvl_descriptor = target_buffer_get_u32(target, (uint8_t*)&second_lvl_descriptor); @@ -99,7 +107,8 @@ uint32_t armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_comm /* large page descriptor */ *type = ARMV4_5_LARGE_PAGE; *ap = (second_lvl_descriptor & 0xff0) >> 4; - return (second_lvl_descriptor & 0xffff0000) | (va & 0x0000ffff); + *val = (second_lvl_descriptor & 0xffff0000) | (va & 0x0000ffff); + return ERROR_OK; } if ((second_lvl_descriptor & 0x3) == 2) @@ -107,7 +116,8 @@ uint32_t armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_comm /* small page descriptor */ *type = ARMV4_5_SMALL_PAGE; *ap = (second_lvl_descriptor & 0xff0) >> 4; - return (second_lvl_descriptor & 0xfffff000) | (va & 0x00000fff); + *val = (second_lvl_descriptor & 0xfffff000) | (va & 0x00000fff); + return ERROR_OK; } if ((second_lvl_descriptor & 0x3) == 3) @@ -115,7 +125,8 @@ uint32_t armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_comm /* tiny page descriptor */ *type = ARMV4_5_TINY_PAGE; *ap = (second_lvl_descriptor & 0x30) >> 4; - return (second_lvl_descriptor & 0xfffffc00) | (va & 0x000003ff); + *val = (second_lvl_descriptor & 0xfffffc00) | (va & 0x000003ff); + return ERROR_OK; } /* should not happen */ diff --git a/src/target/armv4_5_mmu.h b/src/target/armv4_5_mmu.h index 6b9ed34..3a6851f 100644 --- a/src/target/armv4_5_mmu.h +++ b/src/target/armv4_5_mmu.h @@ -43,9 +43,9 @@ enum extern char* armv4_5_page_type_names[]; -uint32_t armv4_5_mmu_translate_va(struct target *target, +int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, int *type, - uint32_t *cb, int *domain, uint32_t *ap); + uint32_t *cb, int *domain, uint32_t *ap, uint32_t *val); int armv4_5_mmu_read_physical(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index aa0e030..2edb9e3 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1817,8 +1817,11 @@ static int cortex_a8_virt2phys(struct target *target, cortex_a8->current_address_mode = ARM_MODE_USR; else /* Linux kernel */ cortex_a8->current_address_mode = ARM_MODE_SVC; - uint32_t ret = armv4_5_mmu_translate_va(target, - &armv7a->armv4_5_mmu, virt, &type, &cb, &domain, &ap); + uint32_t ret; + int retval = armv4_5_mmu_translate_va(target, + &armv7a->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret); + if (retval != ERROR_OK) + return retval; /* Reset the flag. We don't want someone else to use it by error */ cortex_a8->current_address_mode = ARM_MODE_ANY; diff --git a/src/target/xscale.c b/src/target/xscale.c index ed0eef3..ab7eee3 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3226,7 +3226,10 @@ static int xscale_virt2phys(struct target *target, return ERROR_TARGET_INVALID; } - uint32_t ret = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, virtual, &type, &cb, &domain, &ap); + uint32_t ret; + int retval = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret); + if (retval != ERROR_OK) + return retval; if (type == -1) { return ret; commit ecc8041c0f4c30a7310c0f8414a5261ee7a090ca Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Jun 10 15:27:35 2010 +0200 cfi: fix error propagation any read/write operation to memory can fail. block write algorithm error propagation was broken in that it would continue after an error was reported writing data to ram or the algorithm failing. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index f0ab332..f911bb7 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -146,37 +146,45 @@ static int cfi_send_command(struct flash_bank *bank, uint8_t cmd, uint32_t addre * flash banks are expected to be made of similar chips * the query result should be the same for all */ -static uint8_t cfi_query_u8(struct flash_bank *bank, int sector, uint32_t offset) +static int cfi_query_u8(struct flash_bank *bank, int sector, uint32_t offset, uint8_t *val) { struct target *target = bank->target; uint8_t data[CFI_MAX_BUS_WIDTH]; - target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data); + int retval; + retval = target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data); + if (retval != ERROR_OK) + return retval; if (bank->target->endianness == TARGET_LITTLE_ENDIAN) - return data[0]; + *val = data[0]; else - return data[bank->bus_width - 1]; + *val = data[bank->bus_width - 1]; + + return ERROR_OK; } /* read unsigned 8-bit value from the bank * in case of a bank made of multiple chips, * the individual values are ORed */ -static uint8_t cfi_get_u8(struct flash_bank *bank, int sector, uint32_t offset) +static int cfi_get_u8(struct flash_bank *bank, int sector, uint32_t offset, uint8_t *val) { struct target *target = bank->target; uint8_t data[CFI_MAX_BUS_WIDTH]; int i; - target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data); + int retval; + retval = target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data); + if (retval != ERROR_OK) + return retval; if (bank->target->endianness == TARGET_LITTLE_ENDIAN) { for (i = 0; i < bank->bus_width / bank->chip_width; i++) data[0] |= data[i]; - return data[0]; + *val = data[0]; } else { @@ -184,53 +192,75 @@ static uint8_t cfi_get_u8(struct flash_bank *bank, int sector, uint32_t offset) for (i = 0; i < bank->bus_width / bank->chip_width; i++) value |= data[bank->bus_width - 1 - i]; - return value; + *val = value; } + return ERROR_OK; } -static uint16_t cfi_query_u16(struct flash_bank *bank, int sector, uint32_t offset) +static int cfi_query_u16(struct flash_bank *bank, int sector, uint32_t offset, uint16_t *val) { struct target *target = bank->target; struct cfi_flash_bank *cfi_info = bank->driver_priv; uint8_t data[CFI_MAX_BUS_WIDTH * 2]; + int retval; if (cfi_info->x16_as_x8) { uint8_t i; for (i = 0;i < 2;i++) - target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, + { + retval = target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width]); + if (retval != ERROR_OK) + return retval; + } + } else + { + retval = target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 2, data); + if (retval != ERROR_OK) + return retval; } - else - target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 2, data); if (bank->target->endianness == TARGET_LITTLE_ENDIAN) - return data[0] | data[bank->bus_width] << 8; + *val = data[0] | data[bank->bus_width] << 8; else - return data[bank->bus_width - 1] | data[(2 * bank->bus_width) - 1] << 8; + *val = data[bank->bus_width - 1] | data[(2 * bank->bus_width) - 1] << 8; + + return ERROR_OK; } -static uint32_t cfi_query_u32(struct flash_bank *bank, int sector, uint32_t offset) +static int cfi_query_u32(struct flash_bank *bank, int sector, uint32_t offset, uint32_t *val) { struct target *target = bank->target; struct cfi_flash_bank *cfi_info = bank->driver_priv; uint8_t data[CFI_MAX_BUS_WIDTH * 4]; + int retval; if (cfi_info->x16_as_x8) { uint8_t i; for (i = 0;i < 4;i++) - target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, + { + retval = target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width]); + if (retval != ERROR_OK) + return retval; + } } else - target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 4, data); + { + retval = target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 4, data); + if (retval != ERROR_OK) + return retval; + } if (bank->target->endianness == TARGET_LITTLE_ENDIAN) - return data[0] | data[bank->bus_width] << 8 | data[bank->bus_width * 2] << 16 | data[bank->bus_width * 3] << 24; + *val = data[0] | data[bank->bus_width] << 8 | data[bank->bus_width * 2] << 16 | data[bank->bus_width * 3] << 24; else - return data[bank->bus_width - 1] | data[(2* bank->bus_width) - 1] << 8 | + *val = data[bank->bus_width - 1] | data[(2* bank->bus_width) - 1] << 8 | data[(3 * bank->bus_width) - 1] << 16 | data[(4 * bank->bus_width) - 1] << 24; + + return ERROR_OK; } static int cfi_reset(struct flash_bank *bank) @@ -275,13 +305,27 @@ static void cfi_intel_clear_status_register(struct flash_bank *bank) cfi_send_command(bank, 0x50, flash_address(bank, 0, 0x0)); } -static uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout) +static int cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout, uint8_t *val) { uint8_t status; - while ((!((status = cfi_get_u8(bank, 0, 0x0)) & 0x80)) && (timeout-- > 0)) + int retval = ERROR_OK; + + for (;;) { - LOG_DEBUG("status: 0x%x", status); + if (timeout-- < 0) + { + LOG_ERROR("timeout while waiting for WSM to become ready"); + return ERROR_FAIL; + } + + retval = cfi_get_u8(bank, 0, 0x0, &status); + if (retval != ERROR_OK) + return retval; + + if (status & 0x80) + break; + alive_sleep(1); } @@ -290,11 +334,7 @@ static uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout) LOG_DEBUG("status: 0x%x", status); - if ((status & 0x80) != 0x80) - { - LOG_ERROR("timeout while waiting for WSM to become ready"); - } - else if (status != 0x80) + if (status != 0x80) { LOG_ERROR("status register: 0x%x", status); if (status & 0x2) @@ -311,24 +351,38 @@ static uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout) LOG_ERROR("Block Erase Suspended"); cfi_intel_clear_status_register(bank); + + retval = ERROR_FAIL; } - return status; + *val = status; + return retval; } static int cfi_spansion_wait_status_busy(struct flash_bank *bank, int timeout) { uint8_t status, oldstatus; struct cfi_flash_bank *cfi_info = bank->driver_priv; + int retval; - oldstatus = cfi_get_u8(bank, 0, 0x0); + retval = cfi_get_u8(bank, 0, 0x0, &oldstatus); + if (retval != ERROR_OK) + return retval; do { - status = cfi_get_u8(bank, 0, 0x0); + retval = cfi_get_u8(bank, 0, 0x0, &status); + + if (retval != ERROR_OK) + return retval; + if ((status ^ oldstatus) & 0x40) { if (status & cfi_info->status_poll_mask & 0x20) { - oldstatus = cfi_get_u8(bank, 0, 0x0); - status = cfi_get_u8(bank, 0, 0x0); + retval = cfi_get_u8(bank, 0, 0x0, &oldstatus); + if (retval != ERROR_OK) + return retval; + retval = cfi_get_u8(bank, 0, 0x0, &status); + if (retval != ERROR_OK) + return retval; if ((status ^ oldstatus) & 0x40) { LOG_ERROR("dq5 timeout, status: 0x%x", status); return(ERROR_FLASH_OPERATION_FAILED); @@ -368,9 +422,15 @@ static int cfi_read_intel_pri_ext(struct flash_bank *bank) } cfi_info->pri_ext = pri_ext; - pri_ext->pri[0] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0); - pri_ext->pri[1] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 1); - pri_ext->pri[2] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 2); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0, &pri_ext->pri[0]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 1, &pri_ext->pri[1]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 2, &pri_ext->pri[2]); + if (retval != ERROR_OK) + return retval; if ((pri_ext->pri[0] != 'P') || (pri_ext->pri[1] != 'R') || (pri_ext->pri[2] != 'I')) { @@ -382,36 +442,58 @@ static int cfi_read_intel_pri_ext(struct flash_bank *bank) return ERROR_FLASH_BANK_INVALID; } - pri_ext->major_version = cfi_query_u8(bank, 0, cfi_info->pri_addr + 3); - pri_ext->minor_version = cfi_query_u8(bank, 0, cfi_info->pri_addr + 4); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 3, &pri_ext->major_version); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 4, &pri_ext->minor_version); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("pri: '%c%c%c', version: %c.%c", pri_ext->pri[0], pri_ext->pri[1], pri_ext->pri[2], pri_ext->major_version, pri_ext->minor_version); - pri_ext->feature_support = cfi_query_u32(bank, 0, cfi_info->pri_addr + 5); - pri_ext->suspend_cmd_support = cfi_query_u8(bank, 0, cfi_info->pri_addr + 9); - pri_ext->blk_status_reg_mask = cfi_query_u16(bank, 0, cfi_info->pri_addr + 0xa); + retval = cfi_query_u32(bank, 0, cfi_info->pri_addr + 5, &pri_ext->feature_support); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 9, &pri_ext->suspend_cmd_support); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u16(bank, 0, cfi_info->pri_addr + 0xa, &pri_ext->blk_status_reg_mask); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("feature_support: 0x%" PRIx32 ", suspend_cmd_support: 0x%x, blk_status_reg_mask: 0x%x", pri_ext->feature_support, pri_ext->suspend_cmd_support, pri_ext->blk_status_reg_mask); - pri_ext->vcc_optimal = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0xc); - pri_ext->vpp_optimal = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0xd); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0xc, &pri_ext->vcc_optimal); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0xd, &pri_ext->vpp_optimal); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("Vcc opt: %x.%x, Vpp opt: %u.%x", (pri_ext->vcc_optimal & 0xf0) >> 4, pri_ext->vcc_optimal & 0x0f, (pri_ext->vpp_optimal & 0xf0) >> 4, pri_ext->vpp_optimal & 0x0f); - pri_ext->num_protection_fields = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0xe); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0xe, &pri_ext->num_protection_fields); + if (retval != ERROR_OK) + return retval; if (pri_ext->num_protection_fields != 1) { LOG_WARNING("expected one protection register field, but found %i", pri_ext->num_protection_fields); } - pri_ext->prot_reg_addr = cfi_query_u16(bank, 0, cfi_info->pri_addr + 0xf); - pri_ext->fact_prot_reg_size = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0x11); - pri_ext->user_prot_reg_size = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0x12); + retval = cfi_query_u16(bank, 0, cfi_info->pri_addr + 0xf, &pri_ext->prot_reg_addr); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0x11, &pri_ext->fact_prot_reg_size); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0x12, &pri_ext->user_prot_reg_size); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("protection_fields: %i, prot_reg_addr: 0x%x, factory pre-programmed: %i, user programmable: %i", pri_ext->num_protection_fields, pri_ext->prot_reg_addr, 1 << pri_ext->fact_prot_reg_size, 1 << pri_ext->user_prot_reg_size); @@ -435,9 +517,15 @@ static int cfi_read_spansion_pri_ext(struct flash_bank *bank) } cfi_info->pri_ext = pri_ext; - pri_ext->pri[0] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0); - pri_ext->pri[1] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 1); - pri_ext->pri[2] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 2); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0, &pri_ext->pri[0]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 1, &pri_ext->pri[1]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 2, &pri_ext->pri[2]); + if (retval != ERROR_OK) + return retval; if ((pri_ext->pri[0] != 'P') || (pri_ext->pri[1] != 'R') || (pri_ext->pri[2] != 'I')) { @@ -449,22 +537,48 @@ static int cfi_read_spansion_pri_ext(struct flash_bank *bank) return ERROR_FLASH_BANK_INVALID; } - pri_ext->major_version = cfi_query_u8(bank, 0, cfi_info->pri_addr + 3); - pri_ext->minor_version = cfi_query_u8(bank, 0, cfi_info->pri_addr + 4); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 3, &pri_ext->major_version); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 4, &pri_ext->minor_version); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("pri: '%c%c%c', version: %c.%c", pri_ext->pri[0], pri_ext->pri[1], pri_ext->pri[2], pri_ext->major_version, pri_ext->minor_version); - pri_ext->SiliconRevision = cfi_query_u8(bank, 0, cfi_info->pri_addr + 5); - pri_ext->EraseSuspend = cfi_query_u8(bank, 0, cfi_info->pri_addr + 6); - pri_ext->BlkProt = cfi_query_u8(bank, 0, cfi_info->pri_addr + 7); - pri_ext->TmpBlkUnprotect = cfi_query_u8(bank, 0, cfi_info->pri_addr + 8); - pri_ext->BlkProtUnprot = cfi_query_u8(bank, 0, cfi_info->pri_addr + 9); - pri_ext->SimultaneousOps = cfi_query_u8(bank, 0, cfi_info->pri_addr + 10); - pri_ext->BurstMode = cfi_query_u8(bank, 0, cfi_info->pri_addr + 11); - pri_ext->PageMode = cfi_query_u8(bank, 0, cfi_info->pri_addr + 12); - pri_ext->VppMin = cfi_query_u8(bank, 0, cfi_info->pri_addr + 13); - pri_ext->VppMax = cfi_query_u8(bank, 0, cfi_info->pri_addr + 14); - pri_ext->TopBottom = cfi_query_u8(bank, 0, cfi_info->pri_addr + 15); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 5, &pri_ext->SiliconRevision); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 6, &pri_ext->EraseSuspend); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 7, &pri_ext->BlkProt); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 8, &pri_ext->TmpBlkUnprotect); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 9, &pri_ext->BlkProtUnprot); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 10, &pri_ext->SimultaneousOps); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 11, &pri_ext->BurstMode); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 12, &pri_ext->PageMode); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 13, &pri_ext->VppMin); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 14, &pri_ext->VppMax); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 15, &pri_ext->TopBottom); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("Silicon Revision: 0x%x, Erase Suspend: 0x%x, Block protect: 0x%x", pri_ext->SiliconRevision, pri_ext->EraseSuspend, pri_ext->BlkProt); @@ -515,9 +629,15 @@ static int cfi_read_atmel_pri_ext(struct flash_bank *bank) cfi_info->pri_ext = pri_ext; - atmel_pri_ext.pri[0] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0); - atmel_pri_ext.pri[1] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 1); - atmel_pri_ext.pri[2] = cfi_query_u8(bank, 0, cfi_info->pri_addr + 2); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 0, &atmel_pri_ext.pri[0]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 1, &atmel_pri_ext.pri[1]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 2, &atmel_pri_ext.pri[2]); + if (retval != ERROR_OK) + return retval; if ((atmel_pri_ext.pri[0] != 'P') || (atmel_pri_ext.pri[1] != 'R') || (atmel_pri_ext.pri[2] != 'I')) { @@ -533,18 +653,30 @@ static int cfi_read_atmel_pri_ext(struct flash_bank *bank) pri_ext->pri[1] = atmel_pri_ext.pri[1]; pri_ext->pri[2] = atmel_pri_ext.pri[2]; - atmel_pri_ext.major_version = cfi_query_u8(bank, 0, cfi_info->pri_addr + 3); - atmel_pri_ext.minor_version = cfi_query_u8(bank, 0, cfi_info->pri_addr + 4); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 3, &atmel_pri_ext.major_version); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 4, &atmel_pri_ext.minor_version); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("pri: '%c%c%c', version: %c.%c", atmel_pri_ext.pri[0], atmel_pri_ext.pri[1], atmel_pri_ext.pri[2], atmel_pri_ext.major_version, atmel_pri_ext.minor_version); pri_ext->major_version = atmel_pri_ext.major_version; pri_ext->minor_version = atmel_pri_ext.minor_version; - atmel_pri_ext.features = cfi_query_u8(bank, 0, cfi_info->pri_addr + 5); - atmel_pri_ext.bottom_boot = cfi_query_u8(bank, 0, cfi_info->pri_addr + 6); - atmel_pri_ext.burst_mode = cfi_query_u8(bank, 0, cfi_info->pri_addr + 7); - atmel_pri_ext.page_mode = cfi_query_u8(bank, 0, cfi_info->pri_addr + 8); + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 5, &atmel_pri_ext.features); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 6, &atmel_pri_ext.bottom_boot); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 7, &atmel_pri_ext.burst_mode); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, cfi_info->pri_addr + 8, &atmel_pri_ext.page_mode); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("features: 0x%2.2x, bottom_boot: 0x%2.2x, burst_mode: 0x%2.2x, page_mode: 0x%2.2x", atmel_pri_ext.features, atmel_pri_ext.bottom_boot, atmel_pri_ext.burst_mode, atmel_pri_ext.page_mode); @@ -697,7 +829,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) cfi_info->write_algorithm = NULL; /* bank wasn't probed yet */ - cfi_info->qry[0] = -1; + cfi_info->qry[0] = 0xff; return ERROR_OK; } @@ -722,7 +854,12 @@ static int cfi_intel_erase(struct flash_bank *bank, int first, int last) return retval; } - if (cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->block_erase_timeout_typ)) == 0x80) + uint8_t status; + retval = cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->block_erase_timeout_typ), &status); + if (retval != ERROR_OK) + return retval; + + if (status == 0x80) bank->sectors[i].is_erased = 1; else { @@ -873,7 +1010,10 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la if (!(pri_ext->feature_support & 0x20)) { /* Clear lock bits operation may take up to 1.4s */ - cfi_intel_wait_status_busy(bank, 1400); + uint8_t status; + retval = cfi_intel_wait_status_busy(bank, 1400, &status); + if (retval != ERROR_OK) + return retval; } else { @@ -883,7 +1023,9 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la { return retval; } - block_status = cfi_get_u8(bank, i, 0x2); + retval = cfi_get_u8(bank, i, 0x2, &block_status); + if (retval != ERROR_OK) + return retval; if ((block_status & 0x1) != set) { @@ -892,7 +1034,10 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la { return retval; } - cfi_intel_wait_status_busy(bank, 10); + uint8_t status; + retval = cfi_intel_wait_status_busy(bank, 10, &status); + if (retval != ERROR_OK) + return retval; if (retry > 10) return ERROR_FLASH_OPERATION_FAILED; @@ -937,7 +1082,10 @@ static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int la return retval; } - cfi_intel_wait_status_busy(bank, 100); + uint8_t status; + retval = cfi_intel_wait_status_busy(bank, 100, &status); + if (retval != ERROR_OK) + return retval; } } } @@ -1223,7 +1371,8 @@ static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer, uint3 if (wsm_error) { /* read status register (outputs debug inforation) */ - cfi_intel_wait_status_busy(bank, 100); + uint8_t status; + cfi_intel_wait_status_busy(bank, 100, &status); cfi_intel_clear_status_register(bank); retval = ERROR_FLASH_OPERATION_FAILED; goto cleanup; @@ -1268,8 +1417,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer, ui struct working_area *source; uint32_t buffer_size = 32768; uint32_t status; - int retval, retvaltemp; - int exit_code = ERROR_OK; + int retval = ERROR_OK; /* input parameters - */ /* R0 = source address */ @@ -1515,7 +1663,11 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer, ui { uint32_t thisrun_count = (count > buffer_size) ? buffer_size : count; - retvaltemp = target_write_buffer(target, source->address, thisrun_count, buffer); + retval = target_write_buffer(target, source->address, thisrun_count, buffer); + if (retval != ERROR_OK) + { + break; + } buf_set_u32(reg_params[0].value, 0, 32, source->address); buf_set_u32(reg_params[1].value, 0, 32, address); @@ -1531,13 +1683,16 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer, ui cfi_info->write_algorithm->address, cfi_info->write_algorithm->address + ((target_code_size) - 4), 10000, &armv4_5_info); + if (retval != ERROR_OK) + { + break; + } status = buf_get_u32(reg_params[5].value, 0, 32); - - if ((retval != ERROR_OK) || (retvaltemp != ERROR_OK) || status != 0x80) + if (status != 0x80) { - LOG_DEBUG("status: 0x%" PRIx32 , status); - exit_code = ERROR_FLASH_OPERATION_FAILED; + LOG_ERROR("flash write block failed status: 0x%" PRIx32 , status); + retval = ERROR_FLASH_OPERATION_FAILED; break; } @@ -1559,7 +1714,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer, ui destroy_reg_param(®_params[8]); destroy_reg_param(®_params[9]); - return exit_code; + return retval; } static int cfi_intel_write_word(struct flash_bank *bank, uint8_t *word, uint32_t address) @@ -1579,7 +1734,9 @@ static int cfi_intel_write_word(struct flash_bank *bank, uint8_t *word, uint32_t return retval; } - if (cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->word_write_timeout_max)) != 0x80) + uint8_t status; + retval = cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->word_write_timeout_max), &status); + if (retval != 0x80) { if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) { @@ -1629,7 +1786,11 @@ static int cfi_intel_write_words(struct flash_bank *bank, uint8_t *word, uint32_ { return retval; } - if (cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->buf_write_timeout_max)) != 0x80) + uint8_t status; + retval = cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->buf_write_timeout_max), &status); + if (retval != ERROR_OK) + return retval; + if (status != 0x80) { if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) { @@ -1656,7 +1817,12 @@ static int cfi_intel_write_words(struct flash_bank *bank, uint8_t *word, uint32_ { return retval; } - if (cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->buf_write_timeout_max)) != 0x80) + + retval = cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->buf_write_timeout_max), &status); + if (retval != ERROR_OK) + return retval; + + if (status != 0x80) { if ((retval = cfi_send_command(bank, 0xff, flash_address(bank, 0, 0x0))) != ERROR_OK) { @@ -2098,9 +2264,15 @@ static int cfi_query_string(struct flash_bank *bank, int address) return retval; } - cfi_info->qry[0] = cfi_query_u8(bank, 0, 0x10); - cfi_info->qry[1] = cfi_query_u8(bank, 0, 0x11); - cfi_info->qry[2] = cfi_query_u8(bank, 0, 0x12); + retval = cfi_query_u8(bank, 0, 0x10, &cfi_info->qry[0]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x11, &cfi_info->qry[1]); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x12, &cfi_info->qry[2]); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("CFI qry returned: 0x%2.2x 0x%2.2x 0x%2.2x", cfi_info->qry[0], cfi_info->qry[1], cfi_info->qry[2]); @@ -2236,25 +2408,57 @@ static int cfi_probe(struct flash_bank *bank) if (retval != ERROR_OK) return retval; - cfi_info->pri_id = cfi_query_u16(bank, 0, 0x13); - cfi_info->pri_addr = cfi_query_u16(bank, 0, 0x15); - cfi_info->alt_id = cfi_query_u16(bank, 0, 0x17); - cfi_info->alt_addr = cfi_query_u16(bank, 0, 0x19); + retval = cfi_query_u16(bank, 0, 0x13, &cfi_info->pri_id); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u16(bank, 0, 0x15, &cfi_info->pri_addr); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u16(bank, 0, 0x17, &cfi_info->alt_id); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u16(bank, 0, 0x19, &cfi_info->alt_addr); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("qry: '%c%c%c', pri_id: 0x%4.4x, pri_addr: 0x%4.4x, alt_id: 0x%4.4x, alt_addr: 0x%4.4x", cfi_info->qry[0], cfi_info->qry[1], cfi_info->qry[2], cfi_info->pri_id, cfi_info->pri_addr, cfi_info->alt_id, cfi_info->alt_addr); - cfi_info->vcc_min = cfi_query_u8(bank, 0, 0x1b); - cfi_info->vcc_max = cfi_query_u8(bank, 0, 0x1c); - cfi_info->vpp_min = cfi_query_u8(bank, 0, 0x1d); - cfi_info->vpp_max = cfi_query_u8(bank, 0, 0x1e); - cfi_info->word_write_timeout_typ = cfi_query_u8(bank, 0, 0x1f); - cfi_info->buf_write_timeout_typ = cfi_query_u8(bank, 0, 0x20); - cfi_info->block_erase_timeout_typ = cfi_query_u8(bank, 0, 0x21); - cfi_info->chip_erase_timeout_typ = cfi_query_u8(bank, 0, 0x22); - cfi_info->word_write_timeout_max = cfi_query_u8(bank, 0, 0x23); - cfi_info->buf_write_timeout_max = cfi_query_u8(bank, 0, 0x24); - cfi_info->block_erase_timeout_max = cfi_query_u8(bank, 0, 0x25); - cfi_info->chip_erase_timeout_max = cfi_query_u8(bank, 0, 0x26); + retval = cfi_query_u8(bank, 0, 0x1b, &cfi_info->vcc_min); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x1c, &cfi_info->vcc_max); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x1d, &cfi_info->vpp_min); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x1e, &cfi_info->vpp_max); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x1f, &cfi_info->word_write_timeout_typ); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x20, &cfi_info->buf_write_timeout_typ); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x21, &cfi_info->block_erase_timeout_typ); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x22, &cfi_info->chip_erase_timeout_typ); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x23, &cfi_info->word_write_timeout_max); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x24, &cfi_info->buf_write_timeout_max); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x25, &cfi_info->block_erase_timeout_max); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x26, &cfi_info->chip_erase_timeout_max); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("Vcc min: %x.%x, Vcc max: %x.%x, Vpp min: %u.%x, Vpp max: %u.%x", (cfi_info->vcc_min & 0xf0) >> 4, cfi_info->vcc_min & 0x0f, @@ -2268,10 +2472,21 @@ static int cfi_probe(struct flash_bank *bank) (1 << cfi_info->block_erase_timeout_max) * (1 << cfi_info->block_erase_timeout_typ), (1 << cfi_info->chip_erase_timeout_max) * (1 << cfi_info->chip_erase_timeout_typ)); - cfi_info->dev_size = 1 << cfi_query_u8(bank, 0, 0x27); - cfi_info->interface_desc = cfi_query_u16(bank, 0, 0x28); - cfi_info->max_buf_write_size = cfi_query_u16(bank, 0, 0x2a); - cfi_info->num_erase_regions = cfi_query_u8(bank, 0, 0x2c); + uint8_t data; + retval = 1 << cfi_query_u8(bank, 0, 0x27, &data); + if (retval != ERROR_OK) + return retval; + cfi_info->dev_size = data; + + retval = cfi_query_u16(bank, 0, 0x28, &cfi_info->interface_desc); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u16(bank, 0, 0x2a, &cfi_info->max_buf_write_size); + if (retval != ERROR_OK) + return retval; + retval = cfi_query_u8(bank, 0, 0x2c, &cfi_info->num_erase_regions); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("size: 0x%" PRIx32 ", interface desc: %i, max buffer write size: %x", cfi_info->dev_size, cfi_info->interface_desc, (1 << cfi_info->max_buf_write_size)); @@ -2280,7 +2495,9 @@ static int cfi_probe(struct flash_bank *bank) cfi_info->erase_region_info = malloc(4 * cfi_info->num_erase_regions); for (i = 0; i < cfi_info->num_erase_regions; i++) { - cfi_info->erase_region_info[i] = cfi_query_u32(bank, 0, 0x2d + (4 * i)); + retval = cfi_query_u32(bank, 0, 0x2d + (4 * i), &cfi_info->erase_region_info[i]); + if (retval != ERROR_OK) + return retval; LOG_DEBUG("erase region[%i]: %" PRIu32 " blocks of size 0x%" PRIx32 "", i, (cfi_info->erase_region_info[i] & 0xffff) + 1, @@ -2417,7 +2634,10 @@ static int cfi_intel_protect_check(struct flash_bank *bank) for (i = 0; i < bank->num_sectors; i++) { - uint8_t block_status = cfi_get_u8(bank, i, 0x2); + uint8_t block_status; + retval = cfi_get_u8(bank, i, 0x2, &block_status); + if (retval != ERROR_OK) + return retval; if (block_status & 1) bank->sectors[i].is_protected = 1; @@ -2452,7 +2672,10 @@ static int cfi_spansion_protect_check(struct flash_bank *bank) for (i = 0; i < bank->num_sectors; i++) { - uint8_t block_status = cfi_get_u8(bank, i, 0x2); + uint8_t block_status; + retval = cfi_get_u8(bank, i, 0x2, &block_status); + if (retval != ERROR_OK) + return retval; if (block_status & 1) bank->sectors[i].is_protected = 1; @@ -2498,7 +2721,7 @@ static int cfi_info(struct flash_bank *bank, char *buf, int buf_size) int printed; struct cfi_flash_bank *cfi_info = bank->driver_priv; - if (cfi_info->qry[0] == (char)-1) + if (cfi_info->qry[0] == 0xff) { printed = snprintf(buf, buf_size, "\ncfi flash bank not probed yet\n"); return ERROR_OK; diff --git a/src/flash/nor/cfi.h b/src/flash/nor/cfi.h index fa717dc..e2ff808 100644 --- a/src/flash/nor/cfi.h +++ b/src/flash/nor/cfi.h @@ -35,7 +35,7 @@ struct cfi_flash_bank uint16_t manufacturer; uint16_t device_id; - char qry[3]; + uint8_t qry[3]; /* identification string */ uint16_t pri_id; @@ -76,7 +76,7 @@ struct cfi_flash_bank */ struct cfi_intel_pri_ext { - char pri[3]; + uint8_t pri[3]; uint8_t major_version; uint8_t minor_version; uint32_t feature_support; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 455 ++++++++++++++++++++++++++++++++++------------ src/flash/nor/cfi.h | 4 +- src/flash/nor/core.c | 39 +++-- src/flash/nor/core.h | 5 +- src/flash/nor/tcl.c | 19 +- src/target/arm720t.c | 5 +- src/target/arm920t.c | 13 +- src/target/arm926ejs.c | 5 +- src/target/armv4_5_mmu.c | 27 ++- src/target/armv4_5_mmu.h | 4 +- src/target/cortex_a8.c | 7 +- src/target/xscale.c | 5 +- 12 files changed, 426 insertions(+), 162 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-06-10 17:32:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 73aaaf483035cfe79fe339d6c073e851bc9f8f9a (commit) from 9ab7636ce6276d222662be431a1e6be96d9d34c0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 73aaaf483035cfe79fe339d6c073e851bc9f8f9a Author: Thomas Koeller <tho...@ba...> Date: Thu Jun 10 16:54:25 2010 +0200 jtag: added mising header Distributions created by 'make dist' were incomplete due to a missing header file. Signed-off-by: Thomas Koeller <tho...@ba...> diff --git a/src/jtag/Makefile.am b/src/jtag/Makefile.am index 875fbcb..910affc 100644 --- a/src/jtag/Makefile.am +++ b/src/jtag/Makefile.am @@ -62,6 +62,7 @@ libjtag_la_SOURCES = \ noinst_HEADERS = \ commands.h \ + driver.h \ interface.h \ interfaces.h \ minidriver.h \ ----------------------------------------------------------------------- Summary of changes: src/jtag/Makefile.am | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |