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
(16) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <zw...@ma...> - 2009-06-24 09:43:24
|
Author: zwelch Date: 2009-06-24 09:43:18 +0200 (Wed, 24 Jun 2009) New Revision: 2384 Modified: trunk/src/flash/at91sam3.c trunk/src/flash/at91sam3.h trunk/src/helper/membuf.c trunk/src/helper/membuf.h Log: Fix end-of-line style properties on newly added files. Property changes on: trunk/src/flash/at91sam3.c ___________________________________________________________________ Name: svn:executable - * Name: svn:eol-style + native Modified: trunk/src/flash/at91sam3.h =================================================================== --- trunk/src/flash/at91sam3.h 2009-06-24 02:01:14 UTC (rev 2383) +++ trunk/src/flash/at91sam3.h 2009-06-24 07:43:18 UTC (rev 2384) @@ -1,23 +1,23 @@ -/*************************************************************************** - * 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. * - ***************************************************************************/ - - -// nothing to do here other then export this. -extern flash_driver_t at91sam3_flash; +/*************************************************************************** + * 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. * + ***************************************************************************/ + + +// nothing to do here other then export this. +extern flash_driver_t at91sam3_flash; Property changes on: trunk/src/flash/at91sam3.h ___________________________________________________________________ Name: svn:executable - * Name: svn:eol-style + native Modified: trunk/src/helper/membuf.c =================================================================== --- trunk/src/helper/membuf.c 2009-06-24 02:01:14 UTC (rev 2383) +++ trunk/src/helper/membuf.c 2009-06-24 07:43:18 UTC (rev 2384) @@ -1,238 +1,238 @@ -/*************************************************************************** - * 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 <malloc.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; - return strtok_r( ((char *)(pBuf->buf)), sep, &(pBuf->_strtoklast) ); - } else { - // recover our pBuf - pBuf = *((struct membuf **)(pLast)); - return strtok_r( NULL, sep, &(pBuf->_strtoklast) ); - } -} - - - -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; -} - - - - - - +/*************************************************************************** + * 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 <malloc.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; + return strtok_r( ((char *)(pBuf->buf)), sep, &(pBuf->_strtoklast) ); + } else { + // recover our pBuf + pBuf = *((struct membuf **)(pLast)); + return strtok_r( NULL, sep, &(pBuf->_strtoklast) ); + } +} + + + +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; +} + + + + + + Property changes on: trunk/src/helper/membuf.c ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/helper/membuf.h =================================================================== --- trunk/src/helper/membuf.h 2009-06-24 02:01:14 UTC (rev 2383) +++ trunk/src/helper/membuf.h 2009-06-24 07:43:18 UTC (rev 2384) @@ -1,118 +1,118 @@ -#ifndef HELPER_MEMBUF_H -#define HELPER_MEMBUF_H - -/** @file */ - -/** @page 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() - * - * 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 *s ); - - -#endif +#ifndef HELPER_MEMBUF_H +#define HELPER_MEMBUF_H + +/** @file */ + +/** @page 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() + * + * 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 *s ); + + +#endif Property changes on: trunk/src/helper/membuf.h ___________________________________________________________________ Name: svn:eol-style + native |
From: <du...@ma...> - 2009-06-24 04:01:32
|
Author: duane Date: 2009-06-24 04:01:14 +0200 (Wed, 24 Jun 2009) New Revision: 2383 Added: trunk/src/flash/at91sam3.c trunk/src/flash/at91sam3.h trunk/tcl/board/atmel_sam3u_ek.cfg trunk/tcl/target/at91sam3u1c.cfg trunk/tcl/target/at91sam3u1e.cfg trunk/tcl/target/at91sam3u2c.cfg trunk/tcl/target/at91sam3u2e.cfg trunk/tcl/target/at91sam3u4c.cfg trunk/tcl/target/at91sam3u4e.cfg trunk/tcl/target/at91sam3uXX.cfg Modified: trunk/doc/openocd.texi trunk/src/flash/Makefile.am trunk/src/flash/flash.c Log: Add support for ATMEL AT91SAM3U - CortexM3 Family Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-24 02:00:19 UTC (rev 2382) +++ trunk/doc/openocd.texi 2009-06-24 02:01:14 UTC (rev 2383) @@ -130,7 +130,7 @@ @b{Flash Programing:} Flash writing is supported for external CFI compatible NOR flashes (Intel and AMD/Spansion command set) and several -internal flashes (LPC2000, AT91SAM7, STR7x, STR9x, LM3, and +internal flashes (LPC2000, AT91SAM7, AT91SAM3U, STR7x, STR9x, LM3, and STM32x). Preliminary support for various NAND flash controllers (LPC3180, Orion, S3C24xx, more) controller is included. @@ -3374,12 +3374,69 @@ @end example @end deffn +@deffn {Flash Driver} at91sam3 +@cindex at91sam3 +All members of the AT91SAM3 (cortex-M3) microcontroller family from +atmel include internal flash and use the Cortex-M3 core. The driver +currently (6/22/09) recognizes the AT91SAM3U[1/2/4][C/E] chips. Note +that the driver was orginaly developed and tested using the +AT91SAM3U4E, using a SAM3U-EK eval board. Support for other chips in +the family where cribbed from the data sheet [Note to future +readers/updaters: Please remove this worrysome comment after other +chips are confirmed]. + +The AT91SAM3U4[E/C] (256K) chips have 2 flash banks, the other chips +(3U[1/2][E/C]) have 1 flash bank, in all cases the flash banks are at +the following fixed locations. + +@example +# Flash bank 0 - all chips +flash bank at91sam3 0x000080000 0 1 1 $_TARGETNAME +# Flash bank 1 - only 256K chips +flash bank at91sam3 0x000100000 0 1 1 $_TARGETNAME +@end example + +Internally, the AT91SAM3 flash memory is organized as follows: + +@itemize +@item @var{N-Banks:} 256K chips have 2 banks, others have 1 bank. +@item @var{Bank Size:} 128K/64K Per flash bank +@item @var{Sectors:} 16 or 8 per bank +@item @var{SectorSize:} 8K Per Sector +@item @var{PageSize:} 256 bytes per page. Note that OpenOCD operates on 'sector' sizes, not page sizes. +@end itemize + +The AT91SAM3 driver adds an additional command: + +@deffn Command {at91sam3 gpnvm set|clear|show all|NUMBER} +This command allows you to set, clear, or show the state of the GPNVM bits. +@end deffn + +@deffn Command {at91sam3 info} +This command attempts to display information about the AT91SAM3 +chip. @b{First} it read the @var{CHIPID_CIDR} [address 0x400e0740, see +Section 28.2.1, page 505 of the AT91SAM3U 29/may/2009 datasheet, +document id: doc6430A] and decodes the values. @b{Second} it reads the +various clock configuration registers and attempts to display how it +believes the chip is configured. By default, the SLOWCLK is assumed to +be 32768 Hz, see the command @b{at91sam3 slowclk}. +@end deffn + +@deffn Command {at91sam3 slowclk [VALUE]} +This command shows/sets the slow clock frequency used in the +@b{at91sam3 info} command calculations above. +@end deffn + +@end deffn + @deffn {Flash Driver} at91sam7 -All members of the AT91SAM7 microcontroller family from Atmel -include internal flash and use ARM7TDMI cores. -The driver automatically recognizes a number of these chips using -the chip identification register, and autoconfigures itself. +All members of the AT91SAM7 microcontroller family from Atmel include +internal flash and use ARM7TDMI cores. The driver automatically +recognizes a number of these chips using the chip identification +register, and autoconfigures itself. +@end deffn + @example flash bank at91sam7 0 0 0 0 $_TARGETNAME @end example @@ -3419,7 +3476,6 @@ the appropriate at91sam7 target. @end quotation @end deffn -@end deffn @deffn {Flash Driver} avr The AVR 8-bit microcontrollers from Atmel integrate flash memory. Modified: trunk/src/flash/Makefile.am =================================================================== --- trunk/src/flash/Makefile.am 2009-06-24 02:00:19 UTC (rev 2382) +++ trunk/src/flash/Makefile.am 2009-06-24 02:01:14 UTC (rev 2383) @@ -11,6 +11,7 @@ cfi.c \ non_cfi.c \ at91sam7.c \ + at91sam3.c \ davinci_nand.c \ str7x.c \ str9x.c \ @@ -42,6 +43,7 @@ cfi.h \ non_cfi.h \ at91sam7.h \ + at91sam3.h \ str7x.h \ str9x.h \ nand.h \ Added: trunk/src/flash/at91sam3.c =================================================================== --- trunk/src/flash/at91sam3.c 2009-06-24 02:00:19 UTC (rev 2382) +++ trunk/src/flash/at91sam3.c 2009-06-24 02:01:14 UTC (rev 2383) @@ -0,0 +1,2494 @@ +/*************************************************************************** + * 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. * +****************************************************************************/ + +/* Some of the the lower level code was based on code supplied by + * ATMEL under this copyright. */ + +/* BEGIN ATMEL COPYRIGHT */ +/* ---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support + * ---------------------------------------------------------------------------- + * Copyright (c) 2009, Atmel Corporation + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + * ---------------------------------------------------------------------------- + */ +/* END ATMEL COPYRIGHT */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#include <stdio.h> +#include <string.h> +#include <stddef.h> +#include "log.h" +#include "types.h" +#include "flash.h" +#include "target.h" +#include "membuf.h" +#include "at91sam3.h" +#include "time_support.h" + +#define REG_NAME_WIDTH (12) + + +#define FLASH_BANK0_BASE 0x00080000 +#define FLASH_BANK1_BASE 0x00100000 + +#define AT91C_EFC_FCMD_GETD (0x0) // (EFC) Get Flash Descriptor +#define AT91C_EFC_FCMD_WP (0x1) // (EFC) Write Page +#define AT91C_EFC_FCMD_WPL (0x2) // (EFC) Write Page and Lock +#define AT91C_EFC_FCMD_EWP (0x3) // (EFC) Erase Page and Write Page +#define AT91C_EFC_FCMD_EWPL (0x4) // (EFC) Erase Page and Write Page then Lock +#define AT91C_EFC_FCMD_EA (0x5) // (EFC) Erase All +// cmd6 is not present int he at91sam3u4/2/1 data sheet table 17-2 +// #define AT91C_EFC_FCMD_EPL (0x6) // (EFC) Erase plane? +// cmd7 is not present int he at91sam3u4/2/1 data sheet table 17-2 +// #define AT91C_EFC_FCMD_EPA (0x7) // (EFC) Erase pages? +#define AT91C_EFC_FCMD_SLB (0x8) // (EFC) Set Lock Bit +#define AT91C_EFC_FCMD_CLB (0x9) // (EFC) Clear Lock Bit +#define AT91C_EFC_FCMD_GLB (0xA) // (EFC) Get Lock Bit +#define AT91C_EFC_FCMD_SFB (0xB) // (EFC) Set Fuse Bit +#define AT91C_EFC_FCMD_CFB (0xC) // (EFC) Clear Fuse Bit +#define AT91C_EFC_FCMD_GFB (0xD) // (EFC) Get Fuse Bit +#define AT91C_EFC_FCMD_STUI (0xE) // (EFC) Start Read Unique ID +#define AT91C_EFC_FCMD_SPUI (0xF) // (EFC) Stop Read Unique ID + +#define offset_EFC_FMR 0 +#define offset_EFC_FCR 4 +#define offset_EFC_FSR 8 +#define offset_EFC_FRR 12 + + +static float +_tomhz( uint32_t freq_hz ) +{ + float f; + + f = ((float)(freq_hz)) / 1000000.0; + return f; +} + +// How the chip is configured. +struct sam3_cfg { + uint32_t unique_id[4]; + + uint32_t slow_freq; + uint32_t rc_freq; + uint32_t mainosc_freq; + uint32_t plla_freq; + uint32_t mclk_freq; + uint32_t cpu_freq; + uint32_t fclk_freq; + uint32_t pclk0_freq; + uint32_t pclk1_freq; + uint32_t pclk2_freq; + + +#define SAM3_CHIPID_CIDR (0x400E0740) + uint32_t CHIPID_CIDR; +#define SAM3_CHIPID_EXID (0x400E0744) + uint32_t CHIPID_EXID; + +#define SAM3_SUPC_CR (0x400E1210) + uint32_t SUPC_CR; + +#define SAM3_PMC_BASE (0x400E0400) +#define SAM3_PMC_SCSR (SAM3_PMC_BASE + 0x0008) + uint32_t PMC_SCSR; +#define SAM3_PMC_PCSR (SAM3_PMC_BASE + 0x0018) + uint32_t PMC_PCSR; +#define SAM3_CKGR_UCKR (SAM3_PMC_BASE + 0x001c) + uint32_t CKGR_UCKR; +#define SAM3_CKGR_MOR (SAM3_PMC_BASE + 0x0020) + uint32_t CKGR_MOR; +#define SAM3_CKGR_MCFR (SAM3_PMC_BASE + 0x0024) + uint32_t CKGR_MCFR; +#define SAM3_CKGR_PLLAR (SAM3_PMC_BASE + 0x0028) + uint32_t CKGR_PLLAR; +#define SAM3_PMC_MCKR (SAM3_PMC_BASE + 0x0030) + uint32_t PMC_MCKR; +#define SAM3_PMC_PCK0 (SAM3_PMC_BASE + 0x0040) + uint32_t PMC_PCK0; +#define SAM3_PMC_PCK1 (SAM3_PMC_BASE + 0x0044) + uint32_t PMC_PCK1; +#define SAM3_PMC_PCK2 (SAM3_PMC_BASE + 0x0048) + uint32_t PMC_PCK2; +#define SAM3_PMC_SR (SAM3_PMC_BASE + 0x0068) + uint32_t PMC_SR; +#define SAM3_PMC_IMR (SAM3_PMC_BASE + 0x006c) + uint32_t PMC_IMR; +#define SAM3_PMC_FSMR (SAM3_PMC_BASE + 0x0070) + uint32_t PMC_FSMR; +#define SAM3_PMC_FSPR (SAM3_PMC_BASE + 0x0074) + uint32_t PMC_FSPR; +}; + + +struct sam3_bank_private { + int probed; + // DANGER: THERE ARE DRAGONS HERE.. + // NOTE: If you add more 'ghost' pointers + // be aware that you must *manually* update + // these pointers in the function sam3_GetDetails() + // See the comment "Here there be dragons" + + // so we can find the chip we belong to + struct sam3_chip *pChip; + // so we can find the orginal bank pointer + flash_bank_t *pBank; + unsigned bank_number; + uint32_t controller_address; + uint32_t base_address; + bool present; + unsigned size_bytes; + unsigned nsectors; + unsigned sector_size; + unsigned page_size; +}; + +struct sam3_chip_details { + // THERE ARE DRAGONS HERE.. + // note: If you add pointers here + // becareful about them as they + // may need to be updated inside + // the function: "sam3_GetDetails() + // which copy/overwrites the + // 'runtime' copy of this structure + uint32_t chipid_cidr; + const char *name; + + unsigned n_gpnvms; +#define SAM3_N_NVM_BITS 3 + unsigned gpnvm[SAM3_N_NVM_BITS]; + unsigned total_flash_size; + unsigned total_sram_size; + unsigned n_banks; +#define SAM3_MAX_FLASH_BANKS 2 + // these are "initialized" from the global const data + struct sam3_bank_private bank[SAM3_MAX_FLASH_BANKS]; +}; + + +struct sam3_chip { + struct sam3_chip *next; + int probed; + + // this is "initialized" from the global const structure + struct sam3_chip_details details; + target_t *target; + struct sam3_cfg cfg; + + struct membuf *mbuf; +}; + + +struct sam3_reg_list { + uint32_t address; size_t struct_offset; const char *name; + void (*explain_func)( struct sam3_chip *pInfo ); +}; + + +static struct sam3_chip *all_sam3_chips; + +static struct sam3_chip * +get_current_sam3(struct command_context_s *cmd_ctx ) +{ + target_t *t; + static struct sam3_chip *p; + + t = get_current_target( cmd_ctx ); + if( !t ){ + command_print( cmd_ctx, "No current target?"); + return NULL; + } + + p = all_sam3_chips; + if( !p ){ + // this should not happen + // the command is not registered until the chip is created? + command_print( cmd_ctx, "No SAM3 chips exist?"); + return NULL; + } + + while( p ){ + if( p->target == t ){ + return p; + } + p = p->next; + } + command_print( cmd_ctx, "Cannot find SAM3 chip?"); + return NULL; +} + + +// these are used to *initialize* the "pChip->details" structure. +static const struct sam3_chip_details all_sam3_details[] = { + { + .chipid_cidr = 0x28100960, + .name = "at91sam3u4e", + .total_flash_size = 256 * 1024, + .total_sram_size = 52 * 1024, + .n_gpnvms = 3, + .n_banks = 2, + + // System boots at address 0x0 + // gpnvm[1] = selects boot code + // if gpnvm[1] == 0 + // boot is via "SAMBA" (rom) + // else + // boot is via FLASH + // Selection is via gpnvm[2] + // endif + // + // NOTE: banks 0 & 1 switch places + // if gpnvm[2] == 0 + // Bank0 is the boot rom + // else + // Bank1 is the boot rom + // endif + .bank[0] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 0, + .base_address = FLASH_BANK0_BASE, + .controller_address = 0x400e0800, + .present = 1, + .size_bytes = 128 * 1024, + .nsectors = 16, + .sector_size = 8192, + .page_size = 256, + }, + + .bank[1] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 1, + .base_address = FLASH_BANK1_BASE, + .controller_address = 0x400e0a00, + .present = 1, + .size_bytes = 128 * 1024, + .nsectors = 16, + .sector_size = 8192, + .page_size = 256, + }, + }, + + { + .chipid_cidr = 0x281a0760, + .name = "at91sam3u2e", + .total_flash_size = 128 * 1024, + .total_sram_size = 36 * 1024, + .n_gpnvms = 2, + .n_banks = 1, + + // System boots at address 0x0 + // gpnvm[1] = selects boot code + // if gpnvm[1] == 0 + // boot is via "SAMBA" (rom) + // else + // boot is via FLASH + // Selection is via gpnvm[2] + // endif + .bank[0] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 0, + .base_address = FLASH_BANK0_BASE, + .controller_address = 0x400e0800, + .present = 1, + .size_bytes = 128 * 1024, + .nsectors = 16, + .sector_size = 8192, + .page_size = 256, + }, + + .bank[1] = { + .present = 0, + .probed = 0, + .bank_number = 1, + }, + }, + { + .chipid_cidr = 0x28190560, + .name = "at91sam3u1e", + .total_flash_size = 64 * 1024, + .total_sram_size = 20 * 1024, + .n_gpnvms = 2, + .n_banks = 1, + + // System boots at address 0x0 + // gpnvm[1] = selects boot code + // if gpnvm[1] == 0 + // boot is via "SAMBA" (rom) + // else + // boot is via FLASH + // Selection is via gpnvm[2] + // endif + // + + .bank[0] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 0, + .base_address = FLASH_BANK0_BASE, + .controller_address = 0x400e0800, + .present = 1, + .size_bytes = 64 * 1024, + .nsectors = 8, + .sector_size = 8192, + .page_size = 256, + }, + + .bank[1] = { + .present = 0, + .probed = 0, + .bank_number = 1, + }, + }, + + { + .chipid_cidr = 0x28000960, + .name = "at91sam3u4c", + .total_flash_size = 256 * 1024, + .total_sram_size = 52 * 1024, + .n_gpnvms = 3, + .n_banks = 2, + + // System boots at address 0x0 + // gpnvm[1] = selects boot code + // if gpnvm[1] == 0 + // boot is via "SAMBA" (rom) + // else + // boot is via FLASH + // Selection is via gpnvm[2] + // endif + // + // NOTE: banks 0 & 1 switch places + // if gpnvm[2] == 0 + // Bank0 is the boot rom + // else + // Bank1 is the boot rom + // endif + .bank[0] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 0, + .base_address = FLASH_BANK0_BASE, + .controller_address = 0x400e0800, + .present = 1, + .size_bytes = 128 * 1024, + .nsectors = 16, + .sector_size = 8192, + .page_size = 256, + }, + + .bank[1] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 1, + .base_address = FLASH_BANK1_BASE, + .controller_address = 0x400e0a00, + .present = 1, + .size_bytes = 128 * 1024, + .nsectors = 16, + .sector_size = 8192, + .page_size = 256, + }, + }, + + { + .chipid_cidr = 0x280a0760, + .name = "at91sam3u2c", + .total_flash_size = 128 * 1024, + .total_sram_size = 36 * 1024, + .n_gpnvms = 2, + .n_banks = 1, + + // System boots at address 0x0 + // gpnvm[1] = selects boot code + // if gpnvm[1] == 0 + // boot is via "SAMBA" (rom) + // else + // boot is via FLASH + // Selection is via gpnvm[2] + // endif + .bank[0] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 0, + .base_address = FLASH_BANK0_BASE, + .controller_address = 0x400e0800, + .present = 1, + .size_bytes = 128 * 1024, + .nsectors = 16, + .sector_size = 8192, + .page_size = 256, + }, + + .bank[1] = { + .present = 0, + .probed = 0, + .bank_number = 1, + }, + }, + { + .chipid_cidr = 0x28090560, + .name = "at91sam3u1c", + .total_flash_size = 64 * 1024, + .total_sram_size = 20 * 1024, + .n_gpnvms = 2, + .n_banks = 1, + + // System boots at address 0x0 + // gpnvm[1] = selects boot code + // if gpnvm[1] == 0 + // boot is via "SAMBA" (rom) + // else + // boot is via FLASH + // Selection is via gpnvm[2] + // endif + // + + .bank[0] = { + .probed = 0, + .pChip = NULL, + .pBank = NULL, + .bank_number = 0, + .base_address = FLASH_BANK0_BASE, + .controller_address = 0x400e0800, + .present = 1, + .size_bytes = 64 * 1024, + .nsectors = 8, + .sector_size = 8192, + .page_size = 256, + }, + + .bank[1] = { + .present = 0, + .probed = 0, + .bank_number = 1, + }, + }, + + // terminate + { + .chipid_cidr = 0, + .name = NULL, + } +}; + +/* Globals above */ +/*********************************************************************** + ********************************************************************** + ********************************************************************** + ********************************************************************** + ********************************************************************** + **********************************************************************/ +/* *ATMEL* style code - from the SAM3 driver code */ + +/** Get the current status of the EEFC + * + * the value of some status bits (LOCKE, PROGE). + * @param pPrivate - info about the bank + * @param v - result goes here + */ +static int +EFC_GetStatus( struct sam3_bank_private *pPrivate, uint32_t *v ) +{ + int r; + r = target_read_u32( pPrivate->pChip->target, pPrivate->controller_address + offset_EFC_FSR, v ); + LOG_DEBUG("Status: 0x%08x (lockerror: %d, cmderror: %d, ready: %d)", + (unsigned int)(*v), + ((unsigned int)((*v >> 2) & 1)), + ((unsigned int)((*v >> 1) & 1)), + ((unsigned int)((*v >> 0) & 1))); + + return r; +} + +/** Get the result of the last executed command. + * @param pPrivate - info about the bank + * @param v - result goes here + */ +static int +EFC_GetResult( struct sam3_bank_private *pPrivate, uint32_t *v ) +{ + int r; + uint32_t rv; + r = target_read_u32( pPrivate->pChip->target, pPrivate->controller_address + offset_EFC_FRR, &rv ); + if( v ){ + *v = rv; + } + LOG_DEBUG("Result: 0x%08x", ((unsigned int)(rv))); + return r; +} + +static int +EFC_StartCommand(struct sam3_bank_private *pPrivate, + unsigned command, unsigned argument ) +{ + uint32_t n,v; + int r; + int retry; + + retry = 0; + do_retry: + + // Check command & argument + switch (command) { + + case AT91C_EFC_FCMD_WP: + case AT91C_EFC_FCMD_WPL: + case AT91C_EFC_FCMD_EWP: + case AT91C_EFC_FCMD_EWPL: + // case AT91C_EFC_FCMD_EPL: + // case AT91C_EFC_FCMD_EPA: + case AT91C_EFC_FCMD_SLB: + case AT91C_EFC_FCMD_CLB: + n = (pPrivate->size_bytes / pPrivate->page_size); + if( argument >= n ){ + LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n)); + } + break; + + case AT91C_EFC_FCMD_SFB: + case AT91C_EFC_FCMD_CFB: + if( argument >= pPrivate->pChip->details.n_gpnvms ){ + LOG_ERROR("*BUG*: Embedded flash has only %d GPNVMs", + pPrivate->pChip->details.n_gpnvms ); + } + break; + + case AT91C_EFC_FCMD_GETD: + case AT91C_EFC_FCMD_EA: + case AT91C_EFC_FCMD_GLB: + case AT91C_EFC_FCMD_GFB: + case AT91C_EFC_FCMD_STUI: + case AT91C_EFC_FCMD_SPUI: + if( argument != 0 ){ + LOG_ERROR("Argument is meaningless for cmd: %d", command ); + } + break; + default: + LOG_ERROR("Unknown command %d", command); + break; + } + + if( command == AT91C_EFC_FCMD_SPUI ){ + // this is a very special situation. + // Situation (1) - error/retry - see below + // And we are being called recursively + // Situation (2) - normal, finished reading unique id + } else { + // it should be "ready" + EFC_GetStatus( pPrivate, &v ); + if( v & 1 ){ + // then it is ready + // we go on + } else { + if( retry ){ + // we have done this before + // the controller is not responding. + LOG_ERROR("flash controller(%d) is not ready! Error", pPrivate->bank_number ); + return ERROR_FAIL; + } else { + retry++; + LOG_ERROR("Flash controller(%d) is not ready, attempting reset", + pPrivate->bank_number ); + // we do that by issuing the *STOP* command + EFC_StartCommand( pPrivate, AT91C_EFC_FCMD_SPUI, 0 ); + // above is recursive, and further recursion is blocked by + // if( command == AT91C_EFC_FCMD_SPUI ) above + goto do_retry; + } + } + } + + v = (0x5A << 24) | (argument << 8) | command; + LOG_DEBUG("Command: 0x%08x", ((unsigned int)(v)) ); + r = target_write_u32( pPrivate->pBank->target, + pPrivate->controller_address + offset_EFC_FCR, + v); + if( r != ERROR_OK ){ + LOG_DEBUG("Error Write failed"); + } + return r; +} + +/** Performs the given command and wait until its completion (or an error). + * + * @param pPrivate - info about the bank + * @param command - Command to perform. + * @param argument - Optional command argument. + * @param status - put command status bits here + */ +static int +EFC_PerformCommand( struct sam3_bank_private *pPrivate, + unsigned command, + unsigned argument, + uint32_t *status) +{ + + int r; + uint32_t v; + long long ms_now, ms_end; + + // default + if( status ){ + *status = 0; + } + + r = EFC_StartCommand( pPrivate, command, argument ); + if( r != ERROR_OK ){ + return r; + } + + ms_end = 500 + timeval_ms(); + + + do { + r = EFC_GetStatus( pPrivate, &v ); + if( r != ERROR_OK ){ + return r; + } + ms_now = timeval_ms(); + if( ms_now > ms_end ){ + // error + LOG_ERROR("Command timeout"); + return ERROR_FAIL; + } + } + while ( (v & 1) == 0 ) + ; + + // error bits.. + if( status ){ + *status = (v & 0x6); + } + return ERROR_OK; + +} + + + + + +/** Read the unique ID. + * + * \param pPrivate - info about the bank + * + * The unique ID is stored in the 'pPrivate' structure. + */ + +static int +FLASHD_ReadUniqueID ( struct sam3_bank_private *pPrivate ) +{ + int r; + uint32_t v; + int x; + // assume 0 + pPrivate->pChip->cfg.unique_id[0] = 0; + pPrivate->pChip->cfg.unique_id[1] = 0; + pPrivate->pChip->cfg.unique_id[2] = 0; + pPrivate->pChip->cfg.unique_id[3] = 0; + + LOG_DEBUG("Begin"); + r = EFC_StartCommand( pPrivate, AT91C_EFC_FCMD_STUI, 0); + if( r < 0 ){ + return r; + } + + for( x = 0 ; x < 4 ; x++ ){ + r = target_read_u32( pPrivate->pChip->target, + pPrivate->pBank->base + (x * 4), + &v ); + if( r < 0 ){ + return r; + } + pPrivate->pChip->cfg.unique_id[x] = v; + } + + r = EFC_PerformCommand( pPrivate, AT91C_EFC_FCMD_SPUI, 0, NULL ); + LOG_DEBUG("End: R=%d, id=0x%08x, 0x%08x, 0x%08x, 0x%08x", + r, + (unsigned int)(pPrivate->pChip->cfg.unique_id[0]), + (unsigned int)(pPrivate->pChip->cfg.unique_id[1]), + (unsigned int)(pPrivate->pChip->cfg.unique_id[2]), + (unsigned int)(pPrivate->pChip->cfg.unique_id[3])); + return r; + +} + +/** Erases the entire flash. + * @param pPrivate - the info about the bank. + */ +static int +FLASHD_EraseEntireBank( struct sam3_bank_private *pPrivate ) +{ + LOG_DEBUG("Here"); + return EFC_PerformCommand( pPrivate, AT91C_EFC_FCMD_EA, 0, NULL ); +} + + + +/** Gets current GPNVM state. + * @param pPrivate - info about the bank. + * @param gpnvm - GPNVM bit index. + * @param puthere - result stored here. + * + */ +//------------------------------------------------------------------------------ +static int +FLASHD_GetGPNVM( struct sam3_bank_private *pPrivate, unsigned gpnvm, unsigned *puthere) +{ + uint32_t v; + int r; + + LOG_DEBUG("Here"); + if( pPrivate->bank_number != 0 ){ + LOG_ERROR("GPNVM only works with Bank0"); + return ERROR_FAIL; + } + + if( gpnvm >= pPrivate->pChip->details.n_gpnvms ){ + LOG_ERROR("Invalid GPNVM %d, max: %d, ignored", + gpnvm,pPrivate->pChip->details.n_gpnvms ); + return ERROR_FAIL; + } + + // Get GPNVMs status + r = EFC_PerformCommand( pPrivate, AT91C_EFC_FCMD_GFB, 0, NULL ); + if( r != ERROR_OK ){ + LOG_ERROR("Failed"); + return r; + } + + r = EFC_GetResult(pPrivate, &v ); + + if( puthere ){ + // Check if GPNVM is set + // get the bit and make it a 0/1 + *puthere = (v >> gpnvm) & 1; + } + + return r; +} + + + + +/** Clears the selected GPNVM bit. + * @param gpnvm GPNVM index. + * + * Returns 0 if successful; otherwise returns an error code. + */ +static int +FLASHD_ClrGPNVM( struct sam3_bank_private *pPrivate, unsigned gpnvm) +{ + int r; + unsigned v; + + LOG_DEBUG("Here"); + if( pPrivate->bank_number != 0 ){ + LOG_ERROR("GPNVM only works with Bank0"); + return ERROR_FAIL; + } + + if( gpnvm >= pPrivate->pChip->details.n_gpnvms ){ + LOG_ERROR("Invalid GPNVM %d, max: %d, ignored", + gpnvm,pPrivate->pChip->details.n_gpnvms ); + return ERROR_FAIL; + } + + r = FLASHD_GetGPNVM( pPrivate, gpnvm, &v ); + if( r != ERROR_OK ){ + LOG_DEBUG("Failed: %d",r); + return r; + } + r = EFC_PerformCommand( pPrivate, AT91C_EFC_FCMD_CFB, gpnvm, NULL); + LOG_DEBUG("End: %d",r); + return r; +} + + + +/** Sets the selected GPNVM bit. + * @param gpnvm GPNVM index. + * + */ +static int +FLASHD_SetGPNVM( struct sam3_bank_private *pPrivate, unsigned gpnvm) +{ + int r; + unsigned v; + + if( pPrivate->bank_number != 0 ){ + LOG_ERROR("GPNVM only works with Bank0"); + return ERROR_FAIL; + } + + if( gpnvm >= pPrivate->pChip->details.n_gpnvms ){ + LOG_ERROR("Invalid GPNVM %d, max: %d, ignored", + gpnvm,pPrivate->pChip->details.n_gpnvms ); + return ERROR_FAIL; + } + + r = FLASHD_GetGPNVM( pPrivate, gpnvm, &v ); + if( r != ERROR_OK ){ + return r; + } + if( v ){ + // already set + r = ERROR_OK; + } else { + // set it + r = EFC_PerformCommand( pPrivate, AT91C_EFC_FCMD_SFB, gpnvm, NULL ); + } + return r; +} + + +/** Returns a bit field (at most 64) of locked regions within a page. + * @param pPrivate - info about the bank + * @param v - where to store locked bits + * \param end End address of range. + */ + +static int +FLASHD_GetLockBits(struct sam3_bank_private *pPrivate, uint32_t *v ) +{ + int r; + LOG_DEBUG("Here"); + r = EFC_PerformCommand( pPrivate, AT91C_EFC_FCMD_GLB, 0, NULL); + if( r == ERROR_OK ){ + r = EFC_GetResult(pPrivate, v ); + } + LOG_DEBUG("End: %d",r); + return r; +} + + +/**Unlocks all the regions in the given address range. + * + * \param start_sector - first sector to unlock + * \param end_sector - last (inclusive) to unlock + */ + +static int +FLASHD_Unlock( struct sam3_bank_private *pPrivate, + unsigned start_sector, + unsigned end_sector ) +{ + int r; + uint32_t status; + uint32_t pg; + uint32_t pages_per_sector; + + pages_per_sector = pPrivate->sector_size / pPrivate->page_size; + + /* Unlock all pages */ + while (start_sector <= end_sector){ + pg = start_sector * pages_per_sector; + + r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_CLB, pg, &status ); + if (r != ERROR_OK) { + return r; + } + start_sector++; + } + + return ERROR_OK; +} + + +/** Locks regions + * + * @param start_sector - first sector to lock + * @param end_sector - last sector (inclusive) to lock + */ + + +static int +FLASHD_Lock( struct sam3_bank_private *pPrivate, + unsigned start_sector, + unsigned end_sector ) +{ + uint32_t status; + uint32_t pg; + uint32_t pages_per_sector; + int r; + + pages_per_sector = pPrivate->sector_size / pPrivate->page_size; + + /* Lock all pages */ + while (start_sector <= end_sector){ + pg = start_sector * pages_per_sector; + + r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_SLB, pg, &status ); + if (r != ERROR_OK) { + return r; + } + start_sector++; + } + return ERROR_OK; +} + + +/****** 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, + const char *regname, + uint32_t value, + unsigned shift, + unsigned width) +{ + uint32_t v; + int hwidth, dwidth; + + + // extract the field + v = value >> shift; + v = v & ((1 << width)-1); + if( width <= 16 ){ + hwidth = 4; + dwidth = 5; + } else { + hwidth = 8; + dwidth = 12; + } + + // show the basics + sam3_sprintf( pChip, "\t%*s: %*d [0x%0*x] ", + REG_NAME_WIDTH, regname, + dwidth, v, + hwidth, v ); + return v; +} + + +static const char _unknown[] = "unknown"; +static const char * const eproc_names[] = { + _unknown, // 0 + "arm946es", // 1 + "arm7tdmi", // 2 + "cortex-m3", // 3 + "arm920t", // 4 + "arm926ejs", // 5 + _unknown, // 6 + _unknown, // 7 + _unknown, // 8 + _unknown, // 9 + _unknown, // 10 + _unknown, // 11 + _unknown, // 12 + _unknown, // 13 + _unknown, // 14 + _unknown, // 15 +}; + +#define nvpsize2 nvpsize // these two tables are identical +static const char * const nvpsize[] = { + "none", // 0 + "8K bytes", // 1 + "16K bytes", // 2 + "32K bytes", // 3 + _unknown, // 4 + "64K bytes", // 5 + _unknown, // 6 + "128K bytes", // 7 + _unknown, // 8 + "256K bytes", // 9 + "512K bytes", // 10 + _unknown, // 11 + "1024K bytes", // 12 + _unknown, // 13 + "2048K bytes", // 14 + _unknown, // 15 +}; + + +static const char * const sramsize[] = { + "48K Bytes", // 0 + "1K Bytes", // 1 + "2K Bytes", // 2 + "6K Bytes", // 3 + "112K Bytes", // 4 + "4K Bytes", // 5 + "80K Bytes", // 6 + "160K Bytes", // 7 + "8K Bytes", // 8 + "16K Bytes", // 9 + "32K Bytes", // 10 + "64K Bytes", // 11 + "128K Bytes", // 12 + "256K Bytes", // 13 + "96K Bytes", // 14 + "512K Bytes", // 15 + +}; + +static const struct archnames { unsigned value; const char *name; } archnames[] = { + { 0x19, "AT91SAM9xx Series" }, + { 0x29, "AT91SAM9XExx Series" }, + { 0x34, "AT91x34 Series" }, + { 0x37, "CAP7 Series" }, + { 0x39, "CAP9 Series" }, + { 0x3B, "CAP11 Series" }, + { 0x40, "AT91x40 Series" }, + { 0x42, "AT91x42 Series" }, + { 0x55, "AT91x55 Series" }, + { 0x60, "AT91SAM7Axx Series" }, + { 0x61, "AT91SAM7AQxx Series" }, + { 0x63, "AT91x63 Series" }, + { 0x70, "AT91SAM7Sxx Series" }, + { 0x71, "AT91SAM7XCxx Series" }, + { 0x72, "AT91SAM7SExx Series" }, + { 0x73, "AT91SAM7Lxx Series" }, + { 0x75, "AT91SAM7Xxx Series" }, + { 0x76, "AT91SAM7SLxx Series" }, + { 0x80, "ATSAM3UxC Series (100-pin version)" }, + { 0x81, "ATSAM3UxE Series (144-pin version)" }, + { 0x83, "ATSAM3AxC Series (100-pin version)" }, + { 0x84, "ATSAM3XxC Series (100-pin version)" }, + { 0x85, "ATSAM3XxE Series (144-pin version)" }, + { 0x86, "ATSAM3XxG Series (208/217-pin version)" }, + { 0x88, "ATSAM3SxA Series (48-pin version)" }, + { 0x89, "ATSAM3SxB Series (64-pin version)" }, + { 0x8A, "ATSAM3SxC Series (100-pin version)" }, + { 0x92, "AT91x92 Series" }, + { 0xF0, "AT75Cxx Series" }, + { -1, NULL }, + +}; + +static const char * const nvptype[] = { + "rom", // 0 + "romless or onchip flash", // 1 + "embedded flash memory", // 2 + "rom(nvpsiz) + embedded flash (nvpsiz2)", //3 + "sram emulating flash", // 4 + _unknown, // 5 + _unknown, // 6 + _unknown, // 7 + +}; + +static const char *_yes_or_no( uint32_t v ) +{ + if( v ){ + return "YES"; + } else { + return "NO"; + } +} + +static const char * const _rc_freq[] = { + "4 MHz", "8 MHz", "12 MHz", "reserved" +}; + +static void +sam3_explain_ckgr_mor( struct sam3_chip *pChip ) +{ + uint32_t v; + uint32_t rcen; + + v = sam3_reg_fieldname(pChip, "MOSCXTEN", pChip->cfg.CKGR_MOR, 0, 1 ); + sam3_sprintf( pChip, "(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", + _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", + _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", + _rc_freq[v] ); + + pChip->cfg.rc_freq = 0; + if( rcen ){ + switch( v ){ + default: + pChip->cfg.rc_freq = 0; + case 0: + pChip->cfg.rc_freq = 4 * 1000 * 1000; + break; + case 1: + pChip->cfg.rc_freq = 8 * 1000 * 1000; + break; + case 2: + pChip->cfg.rc_freq = 12* 1000 * 1000; + break; + } + } + + v = sam3_reg_fieldname(pChip,"MOSCXTST", pChip->cfg.CKGR_MOR, 8, 8 ); + sam3_sprintf( pChip, "(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", + 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", + _yes_or_no(v)); +} + + + +static void +sam3_explain_chipid_cidr( struct sam3_chip *pChip ) +{ + int x; + uint32_t v; + const char *cp; + + sam3_reg_fieldname( pChip, "Version", pChip->cfg.CHIPID_CIDR, 0, 5 ); + sam3_sprintf(pChip,"\n"); + + v = sam3_reg_fieldname( pChip, "EPROC", pChip->cfg.CHIPID_CIDR, 5, 3 ); + sam3_sprintf( pChip, "%s\n", eproc_names[v]); + + v = sam3_reg_fieldname( pChip, "NVPSIZE", pChip->cfg.CHIPID_CIDR, 8, 4 ); + sam3_sprintf( pChip, "%s\n", nvpsize[v]); + + v = sam3_reg_fieldname( pChip, "NVPSIZE2", pChip->cfg.CHIPID_CIDR, 12, 4 ); + sam3_sprintf( pChip, "%s\n", nvpsize2[v]); + + v = sam3_reg_fieldname( pChip, "SRAMSIZE", pChip->cfg.CHIPID_CIDR, 16,4 ); + sam3_sprintf( pChip, "%s\n", sramsize[ v ] ); + + v = sam3_reg_fieldname( pChip, "ARCH", pChip->cfg.CHIPID_CIDR, 20, 8 ); + cp = _unknown; + for( x = 0 ; archnames[x].name ; x++ ){ + if( v == archnames[x].value ){ + cp = archnames[x].name; + break; + } + } + + sam3_sprintf( pChip, "%s\n", cp ); + + v = sam3_reg_fieldname( pChip, "NVPTYP", pChip->cfg.CHIPID_CIDR, 28, 3 ); + sam3_sprintf( pChip, "%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)); +} + +static void +sam3_explain_ckgr_mcfr( struct sam3_chip *pChip ) +{ + uint32_t v; + + + v = sam3_reg_fieldname( pChip, "MAINFRDY", pChip->cfg.CKGR_MCFR, 16, 1 ); + sam3_sprintf( pChip, "(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", + _tomhz( v ), + pChip->cfg.slow_freq / 1000, + pChip->cfg.slow_freq % 1000); + +} + +static void +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"); + mula = sam3_reg_fieldname( pChip, "MULA", pChip->cfg.CKGR_PLLAR, 16, 11 ); + sam3_sprintf(pChip,"\n"); + pChip->cfg.plla_freq = 0; + if( mula==0 ){ + sam3_sprintf(pChip,"\tPLLA Freq: (Disabled,mula=0)\n"); + } else if( diva == 0 ){ + sam3_sprintf(pChip,"\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", + _tomhz( pChip->cfg.plla_freq )); + } +} + + +static void +sam3_explain_mckr( struct sam3_chip *pChip ) +{ + uint32_t css, pres,fin; + int pdiv; + const char *cp; + + css = sam3_reg_fieldname( pChip, "CSS", pChip->cfg.PMC_MCKR, 0, 2 ); + switch( css & 3 ){ + case 0: + fin = pChip->cfg.slow_freq; + cp = "slowclk"; + break; + case 1: + fin = pChip->cfg.mainosc_freq; + cp = "mainosc"; + break; + case 2: + fin = pChip->cfg.plla_freq; + cp = "plla"; + break; + case 3: + if( pChip->cfg.CKGR_UCKR & (1 << 16) ){ + fin = 480 * 1000 * 1000; + cp = "upll"; + } else { + fin = 0; + cp = "upll (*ERROR* UPLL is disabled)"; + } + break; + } + + sam3_sprintf( pChip, "%s (%3.03f Mhz)\n", + cp, + _tomhz( fin ) ); + pres = sam3_reg_fieldname(pChip, "PRES", pChip->cfg.PMC_MCKR, 4, 3 ); + switch( pres & 0x07 ){ + case 0: + pdiv = 1; + cp = "selected clock"; + case 1: + pdiv = 2; + cp = "clock/2"; + break; + case 2: + pdiv = 4; + cp = "clock/4"; + break; + case 3: + pdiv = 8; + cp = "clock/8"; + break; + case 4: + pdiv = 16; + cp = "clock/16"; + break; + case 5: + pdiv = 32; + cp = "clock/32"; + break; + case 6: + pdiv = 64; + cp = "clock/64"; + break; + case 7: + pdiv = 6; + cp = "clock/6"; + break; + } + sam3_sprintf( pChip, "(%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", + _tomhz( fin ) ); +} + +#if 0 +static struct sam3_chip * +target2sam3( target_t *pTarget ) +{ + struct sam3_chip *pChip; + + if(pTarget == NULL ){ + return NULL; + } + + pChip = all_sam3_chips; + while(pChip){ + if(pChip->target == pTarget ){ + break; // return below + } else { + pChip = pChip->next; + } + } + return pChip; +} +#endif + +static uint32_t * +sam3_get_reg_ptr( struct sam3_cfg *pCfg, const struct sam3_reg_list *pList ) +{ + // this function exists to help + // keep funky offsetof() errors + // and casting from causing bugs + + // By using prototypes - we can detect what would + // be casting errors. + + return ((uint32_t *)( ((char *)(pCfg)) + pList->struct_offset )); +} + + +#define SAM3_ENTRY( NAME, FUNC ) { .address = SAM3_ ## NAME, .struct_offset = offsetof( struct sam3_cfg, NAME ), #NAME, FUNC } +static const struct sam3_reg_list sam3_all_regs[] = { + SAM3_ENTRY( CKGR_MOR , sam3_explain_ckgr_mor ), + SAM3_ENTRY( CKGR_MCFR , sam3_explain_ckgr_mcfr ), + SAM3_ENTRY( CKGR_PLLAR , sam3_explain_ckgr_plla ), + SAM3_ENTRY( CKGR_UCKR , NULL ), + SAM3_ENTRY( PMC_FSMR , NULL ), + SAM3_ENTRY( PMC_FSPR , NULL ), + SAM3_ENTRY( PMC_IMR , NULL ), + SAM3_ENTRY( PMC_MCKR , sam3_explain_mckr ), + SAM3_ENTRY( PMC_PCK0 , NULL ), + SAM3_ENTRY( PMC_PCK1 , NULL ), + SAM3_ENTRY( PMC_PCK2 , NULL ), + SAM3_ENTRY( PMC_PCSR , NULL ), + SAM3_ENTRY( PMC_SCSR , NULL ), + SAM3_ENTRY( PMC_SR , NULL ), + SAM3_ENTRY( CHIPID_CIDR , sam3_explain_chipid_cidr ), + SAM3_ENTRY( CHIPID_EXID , NULL ), + SAM3_ENTRY( SUPC_CR, NULL ), + + // TERMINATE THE LIST + { .name = NULL } +}; +#undef SAM3_ENTRY + + + + +static struct sam3_bank_private * +get_sam3_bank_private( flash_bank_t *bank ) +{ + return (struct sam3_bank_private *)(bank->driver_priv); +} + +/* + * Given a pointer to where it goes in the structure.. + * Determine the register name, address from the all registers table. + */ +static const struct sam3_reg_list * +sam3_GetReg( struct sam3_chip *pChip, uint32_t *goes_here ) +{ + const struct sam3_reg_list *pReg; + + pReg = &(sam3_all_regs[0]); + while(pReg->name){ + uint32_t *pPossible; + + // calculate where this one go.. + // it is "possibly" this register. + + pPossible = ((uint32_t *)( ((char *)(&(pChip->cfg))) + pReg->struct_offset )); + + // well? Is it this register + if( pPossible == goes_here ){ + // Jump for joy! + return pReg; + } + + // next... + pReg++; + } + // This is *TOTAL*PANIC* - we are totally screwed. + LOG_ERROR("INVALID SAM3 REGISTER"); + return NULL; +} + + +static int +sam3_ReadThisReg( struct sam3_chip *pChip, uint32_t *goes_here ) +{ + const struct sam3_reg_list *pReg; + int r; + + pReg = sam3_GetReg( pChip, goes_here ); + if( !pReg ){ + return ERROR_FAIL; + } + + r = target_read_u32( pChip->target, pReg->address, goes_here ); + if( r != ERROR_OK ){ + LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Err: %d\n", + pReg->name, (unsigned)(pReg->address), r ); + } + return r; +} + + + +static int +sam3_ReadAllRegs( struct sam3_chip *pChip ) +{ + int r; + const struct sam3_reg_list *pReg; + + pReg = &(sam3_all_regs[0]); + while( pReg->name ){ + r = sam3_ReadThisReg( pChip, + sam3_get_reg_ptr( &(pChip->cfg), pReg ) ); + if( r != ERROR_OK ){ + LOG_ERROR("Cannot read SAM3 registere: %s @ 0x%08x, Error: %d\n", + pReg->name, ((unsigned)(pReg->address)), r ); + return r; + } + + pReg++; + } + + return ERROR_OK; +} + + +static int +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", + REG_NAME_WIDTH, + pReg->name, + pReg->address, + regval ); + if( pReg->explain_func ){ + (*(pReg->explain_func))( 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 )); + + + sam3_sprintf( pChip, " 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], + pChip->cfg.unique_id[3]); + + + return ERROR_OK; +} + + +static int +sam3_erase_check(struct flash_bank_s *bank) +{ + int x; + + LOG_DEBUG("Here"); + if (bank->target->state != TARGET_HALTED) { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + if( 0 == bank->num_sectors ){ + LOG_ERROR("Target: not supported/not probed\n"); + return ERROR_FAIL; + } + + LOG_INFO("sam3 - supports auto-erase, erase_check ignored"); + for( x = 0 ; x < bank->num_sectors ; x++ ){ + bank->sectors[x].is_erased = 1; + } + + LOG_DEBUG("Done"); + return ERROR_OK; +} + +static int +sam3_protect_check(struct flash_bank_s *bank) +{ + int r; + uint32_t v; + unsigned x; + struct sam3_bank_private *pPrivate; + + LOG_DEBUG("Begin"); + if (bank->target->state != TARGET_HALTED) { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + pPrivate = get_sam3_bank_private(bank); + if( !pPrivate ){ + LOG_ERROR("no private for this bank?"); + return ERROR_FAIL; + } + if( !(pPrivate->probed) ){ + return ERROR_FLASH_BANK_NOT_PROBED; + } + + r = FLASHD_GetLockBits( pPrivate , &v ); + if( r != ERROR_OK ){ + LOG_DEBUG("Failed: %d",r); + return r; + } + + for( x = 0 ; x < pPrivate->nsectors ; x++ ){ + bank->sectors[x].is_protected = (!!(v & (1 << x))); + } + LOG_DEBUG("Done"); + return ERROR_OK; +} + +static int +sam3_flash_bank_command(struct command_context_s *cmd_ctx, + char *cmd, + char **args, + int argc, + struct flash_bank_s *bank) +{ + struct sam3_chip *pChip; + + pChip = all_sam3_chips; + + // is this an existing chip? + while(pChip){ + if( pChip->target == bank->target ){ + break; + } + pChip = pChip->next; + } + + if( !pChip ){ + // this is a *NEW* chip + pChip = calloc( 1, sizeof(struct sam3_chip) ); + if( !pChip ){ + LOG_ERROR("NO RAM!"); + return ERROR_FAIL; + } + pChip->target = bank->target; + // insert at head + pChip->next = all_sam3_chips; + all_sam3_chips = pChip; + pChip->target = bank->target; + // 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 ){ + default: + LOG_ERROR("Address 0x%08x invalid bank address (try 0x%08x or 0x%08x)", + ((unsigned int)(bank->base)), + ((unsigned int)(FLASH_BANK0_BASE)), + ((unsigned int)(FLASH_BANK1_BASE))); + return ERROR_FAIL; + break; + case FLASH_BANK0_BASE: + bank->driver_priv = &(pChip->details.bank[0]); + bank->bank_number = 0; + pChip->details.bank[0].pChip = pChip; + pChip->details.bank[0].pBank = bank; + break; + case FLASH_BANK1_BASE: + bank->driver_priv = &(pChip->details.bank[1]); + bank->bank_number = 1; + pChip->details.bank[1].pChip = pChip; + pChip->details.bank[1].pBank = bank; + break; + } + + // we initialize after probing. + return ERROR_OK; +} + +static int +sam3_GetDetails( struct sam3_bank_private *pPrivate ) +{ + const struct sam3_chip_details *pDetails; + struct sam3_chip *pChip; + void *vp; + flash_bank_t *saved_banks[SAM3_MAX_FLASH_BANKS]; + + unsigned x; + const char *cp; + + LOG_DEBUG("Begin"); + pDetails = all_sam3_details; + while( pDetails->name ){ + if( pDetails->chipid_cidr == pPrivate->pChip->cfg.CHIPID_CIDR ){ + break; + } else { + pDetails++; + } + } + if( pDetails->name == NULL ){ + 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", + 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; + } + + // DANGER: THERE ARE DRAGONS HERE + + // get our pChip - it is going + // to be over-written shortly + pChip = pPrivate->pChip; + + // Note that, in reality: + // + // pPrivate = &(pChip->details.bank[0]) + // or pPrivate = &(pChip->details.bank[1]) + // + + // save the "bank" pointers + for( x = 0 ; x < SAM3_MAX_FLASH_BANKS ; x++ ){ + saved_banks[ x ] = pChip->details.bank[x].pBank; + } + + // Overwrite the "details" structure. + memcpy( &(pPrivate->pChip->details), + pDetails, + sizeof(pPrivate->pChip->details)); + + // now fix the ghosted pointers + for( x = 0 ; x < SAM3_MAX_FLASH_BANKS ; x++ ){ + pChip->details.bank[x].pChip = pChip; + pChip->details.bank[x].pBank = saved_banks[x]; + } + + // update the *BANK*SIZE* + + LOG_DEBUG("End"); + return ERROR_OK; +} + + + +static int +_sam3_probe(struct flash_bank_s *bank, int noise) +{ + unsigned x; + int r; + struct sam3_bank_private *pPrivate; + + + LOG_DEBUG("Begin: Bank: %d, Noise: %d", bank->bank_number, noise ); + if (bank->target->state != TARGET_HALTED) + { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + pPrivate = get_sam3_bank_private( bank ); + if( !pPrivate ){ + LOG_ERROR("Invalid/unknown bank number\n"); + return ERROR_FAIL; + } + + r = sam3_ReadAllRegs(pPrivate->pChip); + if( r != ERROR_OK ){ + return r; + } + + + LOG_DEBUG("Here"); + r = sam3_GetInfo( pPrivate->pChip ); + 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++ ){ + if( bank->base == pPrivate->pChip->details.bank[0].base_address ){ + bank->size = pPrivate->pChip->details.bank[0].size_bytes; + break; + } + } + + if( bank->sectors == NULL ){ + bank->sectors = calloc(pPrivate->nsectors, (sizeof( (bank->sectors)[0] ))); + if( bank->sectors == NULL ){ + LOG_ERROR("No memory!"); + return ERROR_FAIL; + } + bank->num_sectors = pPrivate->nsectors; + + for( x = 0 ; ((int)(x)) < bank->num_sectors ; x++ ){ + bank->sectors[x].size = pPrivate->sector_size; + bank->sectors[x].offset = x * (pPrivate->sector_size); + // mark as unknown + bank->sectors[x].is_erased = -1; + bank->sectors[x].is_protected = -1; + } + } + + pPrivate->probed = 1; + + r = sam3_protect_check( bank ); + if( r != ERROR_OK ){ + return r; + } + + LOG_DEBUG("Bank = %d, nbanks = %d", + pPrivate->bank_number , pPrivate->pChip->details.n_banks); + if( (pPrivate->bank_number+1) == pPrivate->pChip->details.n_banks ){ + // read unique id, + // it appears to be associated with the *last* flash bank. + FLASHD_ReadUniqueID(pPrivate); + } + + return r; +} + +static int +sam3_probe(struct flash_bank_s *bank) +{ + return _sam3_probe( bank, 1 ); +} + +static int +sam3_auto_probe(struct flash_bank_s *bank) +{ + return _sam3_probe( bank, 0 ); +} + + + +static int +sam3_erase(struct flash_bank_s *bank, int first, int last) +{ + struct sam3_bank_private *pPrivate; + int r; + + LOG_DEBUG("Here"); + if (bank->target->state != TARGET_HALTED) { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + r = sam3_auto_probe( bank ); + if( r != ERROR_OK ){ + LOG_DEBUG("Here,r=%d",r); + return r; + } + + pPrivate = get_sam3_bank_private( bank ); + if( !(pPrivate->probed) ){ + return ERROR_FLASH_BANK_NOT_PROBED; + } + + if( (first == 0) && ((last+1)== ((int)(pPrivate->nsectors))) ){ + // whole chip + LOG_DEBUG("Here"); + return FLASHD_EraseEntireBank( pPrivate ); + } + LOG_INFO("sam3 auto-erases while programing (request ignored)"); + return ERROR_OK; +} + +static int +sam3_protect(struct flash_bank_s *bank, int set, int first, int last) +{ + struct sam3_bank_private *pPrivate; + int r; + + LOG_DEBUG("Here"); + if (bank->target->state != TARGET_HALTED) { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + pPrivate = get_sam3_bank_private( bank ); + if( !(pPrivate->probed) ){ + return ERROR_FLASH_BANK_NOT_PROBED; + } + + if( set ){ + r = FLASHD_Lock( pPrivate, (unsigned)(first), (unsigned)(last)); + } else { + r = FLASHD_Unlock( pPrivate, (unsigned)(first), (unsigned)(last)); + } + LOG_DEBUG("End: r=%d",r); + + return r; + +} + + +static int +sam3_info( flash_bank_t *bank, char *buf, int buf_size ) +{ + if (bank->target->state != TARGET_HALTED) { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + buf[ 0 ] = 0; + return ERROR_OK; +} + +static int +sam3_page_read( struct sam3_bank_private *pPrivate, unsigned pagenum, uint8_t *buf ) +{ + uint32_t adr; + int r; + + adr = pagenum * pPrivate->page_size; + adr += adr + pPrivate->base_address; + + r = target_read_memory( pPrivate->pChip->target, + adr, + 4, /* THIS*MUST*BE* in 32bit values */ + pPrivate->page_size / 4, + buf ); + if( r != ERROR_OK ){ + LOG_ERROR("SAM3: Flash program failed to read page phys address: 0x%08x", (unsigned int)(adr) ); + } + return r; +} + +// The code below is basically this: +// compiled with +// arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -O9 -S ./foobar.c -o foobar.s +// +// Only the *CPU* can write to the flash buffer. +// the DAP cannot... so - we download this 28byte thing +// Run the algorithm - (below) +// to program the device +// +// ======================================== +// #include <stdint.h> +// +// struct foo { +// uint32_t *dst; +// const uint32_t *src; +// int n; +// volatile uint32_t *base; +// uint32_t cmd; +// }; +// +// +// uint32_t sam3_function( struct foo *p ) +// { +// volatile uint32_t *v; +// uint32_t *d; +// const uint32_t *s; +// int n; +// uint32_t r; +// +// d = p->dst; +// s = p->src; +// n = p->n; +// +// do { +// *d++ = *s++; +// } while( --n ) +// ; +// +// v = p->base; +// +// v[ 1 ] = p->cmd; +// do { +// r = v[8/4]; +// } while( !(r&1) ) +// ; +// return r; +// } +// ======================================== + + + +static const uint8_t +sam3_page_write_opcodes[] = { + // 24 0000 0446 mov r4, r0 + 0x04,0x46, + // 25 0002 6168 ldr r1, [r4, #4] + 0x61,0x68, + // 26 0004 0068 ldr r0, [r0, #0] + 0x00,0x68, + // 27 0006 A268 ldr r2, [r4, #8] + 0xa2,0x68, + // 28 @ lr needed for prologue + // 29 .L2: + // 30 0008 51F8043B ldr r3, [r1], #4 + 0x51,0xf8,0x04,0x3b, + // 31 000c 12F1FF32 adds r2, r2, #-1 + 0x12,0xf1,0xff,0x32, + // 32 0010 40F8043B str r3, [r0], #4 + 0x40,0xf8,0x04,0x3b, + // 33 0014 F8D1 bne .L2 + 0xf8,0xd1, + // 34 0016 E268 ldr r2, [r4, #12] + 0xe2,0x68, + // 35 0018 2369 ldr r3, [r4, #16] + 0x23,0x69, + // 36 001a 5360 str r3, [r2, #4] + 0x53,0x60, + // 37 001c 0832 adds r2, r2, #8 + 0x08,0x32, + // 38 .L4: + // 39 001e 1068 ldr r0, [r2, #0] + 0x10,0x68, + // 40 0020 10F0010F tst r0, #1 + 0x10,0xf0,0x01,0x0f, + // 41 0024 FBD0 beq .L4 + 0xfb,0xd0, + // 42 .done: + // 43 0026 FEE7 b .done + 0xfe,0xe7 +}; + + +static int +sam3_page_write( struct sam3_bank_private *pPrivate, unsigned pagenum, uint8_t *buf ) +{ + uint32_t adr; + uint32_t status; + int r; + + adr = pagenum * pPrivate->page_size; + adr += (adr + pPrivate->base_address); + + LOG_DEBUG("Wr Page %u @ phys address: 0x%08x", pagenum, (unsigned int)(adr) ); + r = target_write_memory( pPrivate->pChip->target, + adr, + 4, /* THIS*MUST*BE* in 32bit values */ + pPrivate->page_size / 4, + buf ); + if( r != ERROR_OK ){ + LOG_ERROR("SAM3: Failed to write (buffer) page at phys address 0x%08x", (unsigned int)(adr) ); + return r; + } + + r = EFC_PerformCommand( pPrivate, + // send Erase & Write Page + AT91C_EFC_FCMD_EWP, + pagenum, + &status ); + + if( r != ERROR_OK ){ + LOG_ERROR("SAM3: Error performing Erase & Write page @ phys address 0x%08x", (unsigned int)(adr) ); + } + if( status & (1 << 2) ){ + LOG_ERROR("SAM3: Page @ Phys address 0x%08x is locked", (unsigned int)(adr) ); + return ERROR_FAIL; + } + if( status & (1 << 1) ){ + LOG_ERROR("SAM3: Flash Command error @phys address 0x%08x", (unsigned int)(adr) ); + return ERROR_FAIL; + } + return ERROR_OK; +} + + + + + +static int +sam3_write(struct flash_bank_s *bank, + uint8_t *buffer, + uint32_t offset, + uint32_t count) +{ + int n; + unsigned page_cur; + unsigned page_end; + int r; + unsigned page_offset; + struct sam3_bank_private *pPrivate; + uint8_t *pagebuffer; + + // ignore dumb requests + if( count == 0 ){ + return ERROR_OK; + } + + if (bank->target->state != TARGET_HALTED) { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + pPrivate = get_sam3_bank_private(bank); + if( !(pPrivate->probed) ){ + return ERROR_FLASH_BANK_NOT_PROBED; + } + + + if( (offset + count) > pPrivate->size_bytes ){ + LOG_ERROR("Flash write error - past end of bank"); + LOG_ERROR(" offset: 0x%08x, count 0x%08x, BankEnd: 0x%08x", + (unsigned int)(offset), + (unsigned int)(count), + (unsigned int)(pPrivate->size_bytes) ); + return ERROR_FAIL; + } + + pagebuffer = alloca( pPrivate->page_size ); + + // what page do we start & end in? + page_cur = offset / pPrivate->page_size; + page_end = (offset + count - 1) / pPrivate->page_size; + + LOG_DEBUG("Offset: 0x%08x, Count: 0x%08x", (unsigned int)(offset), (unsigned int)(count)); + LOG_DEBUG("Page start: %d, Page End: %d", (int)(page_cur), (int)(page_end) ); + + // Special case: all one page + // + // Otherwise: + // (1) non-aligned start + // (2) body pages + // (3) non-aligned end. + + // Handle special case - all one page. + if( page_cur == page_end ){ + LOG_DEBUG("Special case, all in one page"); + r = sam3_page_read( pPrivate, page_cur, pagebuffer ); + if( r != ERROR_OK ){ + return r; + } + + page_offset = (offset & (pPrivate->page_size-1)); + memcpy( pagebuffer + page_offset, + buffer, + count ); + + r = sam3_page_write( pPrivate, page_cur, pagebuffer ); + if( r != ERROR_OK ){ + return r; + } + return ERROR_OK; + } + + // non-aligned start + page_offset = offset & (pPrivate->page_size - 1); + if( page_offset ){ + LOG_DEBUG("Not-Aligned start"); + // read the partial + r = sam3_page_read( pPrivate, page_cur, pagebuffer ); + if( r != ERROR_OK ){ + return r; + } + + // over-write with new data + n = (pPrivate->page_size - page_offset ); + memcpy( pagebuffer + page_offset, + buffer, + n ); + + r = sam3_page_write( pPrivate, page_cur, pagebuffer ); + if( r != ERROR_OK ){ + return r; + } + + count -= n; + offset += n; + buffer += n; + page_cur++; + } + + // intermediate large pages + // also - the final *terminal* + // if that terminal page is a full page + LOG_DEBUG("Full Page Loop: cur=%d, end=%d, count=0x%08x", + (int)page_cur, (int)page_end, (unsigned int)(count) ); + + while( (page_cur < page_end) && + (count >= pPrivate->page_size) ){ + r = sam3_page_write( pPrivate, page_cur, buffer ); + if( r != ERROR_OK ){ + return r; + } + count -= pPrivate->page_size; + buffer += pPrivate->page_size; + page_cur += 1; + } + + // terminal partial page? + ... [truncated message content] |
From: <du...@ma...> - 2009-06-24 04:00:28
|
Author: duane Date: 2009-06-24 04:00:19 +0200 (Wed, 24 Jun 2009) New Revision: 2382 Modified: trunk/src/Makefile.am Log: Add quick target - full cygwin builds take a long long long time, this shortens the edit/build/debug cycle Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-06-24 01:54:25 UTC (rev 2381) +++ trunk/src/Makefile.am 2009-06-24 02:00:19 UTC (rev 2382) @@ -90,3 +90,13 @@ endif MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +# The "quick" target builds executables & reinstalls the executables +# Primary use: developer types to quicken the edit/compile/debug +# cycle. by not requiring a "full build and full install". Note the +# assumption is: You are only rebuilding the EXE.... and everything +# else is/was previously installed. +# +# use at your own risk +quick: all install-binPROGRAMS + |
From: <du...@ma...> - 2009-06-24 03:54:35
|
Author: duane Date: 2009-06-24 03:54:25 +0200 (Wed, 24 Jun 2009) New Revision: 2381 Added: trunk/src/helper/membuf.c trunk/src/helper/membuf.h Modified: trunk/src/helper/Makefile.am Log: Add a growable sprintf memory buffer library Modified: trunk/src/helper/Makefile.am =================================================================== --- trunk/src/helper/Makefile.am 2009-06-23 22:50:08 UTC (rev 2380) +++ trunk/src/helper/Makefile.am 2009-06-24 01:54:25 UTC (rev 2381) @@ -23,6 +23,7 @@ time_support.c \ replacements.c \ fileio.c \ + membuf.c \ startup_tcl.c if IOUTIL @@ -41,6 +42,7 @@ types.h \ log.h \ command.h \ + membuf.h \ time_support.h \ replacements.h \ fileio.h \ Added: trunk/src/helper/membuf.c =================================================================== --- trunk/src/helper/membuf.c 2009-06-23 22:50:08 UTC (rev 2380) +++ trunk/src/helper/membuf.c 2009-06-24 01:54:25 UTC (rev 2381) @@ -0,0 +1,238 @@ +/*************************************************************************** + * 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 <malloc.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; + return strtok_r( ((char *)(pBuf->buf)), sep, &(pBuf->_strtoklast) ); + } else { + // recover our pBuf + pBuf = *((struct membuf **)(pLast)); + return strtok_r( NULL, sep, &(pBuf->_strtoklast) ); + } +} + + + +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; +} + + + + + + Added: trunk/src/helper/membuf.h =================================================================== --- trunk/src/helper/membuf.h 2009-06-23 22:50:08 UTC (rev 2380) +++ trunk/src/helper/membuf.h 2009-06-24 01:54:25 UTC (rev 2381) @@ -0,0 +1,118 @@ +#ifndef HELPER_MEMBUF_H +#define HELPER_MEMBUF_H + +/** @file */ + +/** @page 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() + * + * 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 *s ); + + +#endif |
Author: zwelch Date: 2009-06-24 00:50:08 +0200 (Wed, 24 Jun 2009) New Revision: 2380 Modified: trunk/src/helper/binarybuffer.h trunk/src/helper/command.c trunk/src/helper/fileio.c trunk/src/helper/jim-eventloop.c trunk/src/helper/jim-eventloop.h trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/helper/log.h trunk/src/helper/options.c trunk/src/helper/replacements.c trunk/src/helper/time_support.c trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/core.c trunk/src/jtag/ft2232.c trunk/src/jtag/minidriver.h trunk/src/jtag/presto.c trunk/src/server/server.c trunk/src/server/tcl_server.c trunk/src/svf/svf.c trunk/src/xsvf/xsvf.c trunk/testing/examples/AT91R40008Test/inc/typedefs.h trunk/testing/examples/AT91R40008Test/src/main.c trunk/testing/examples/LPC2148Test/inc/typedefs.h trunk/testing/examples/LPC2148Test/src/main.c trunk/testing/examples/LPC2294Test/inc/typedefs.h trunk/testing/examples/LPC2294Test/src/main.c trunk/testing/examples/PIC32/BlinkingLeds.c trunk/testing/examples/SAM7S256Test/inc/typedefs.h trunk/testing/examples/SAM7S256Test/src/main.c trunk/testing/examples/SAM7X256Test/inc/typedefs.h trunk/testing/examples/SAM7X256Test/src/main.c trunk/testing/examples/STR710JtagSpeed/inc/typedefs.h trunk/testing/examples/STR710JtagSpeed/src/main.c trunk/testing/examples/STR710Test/inc/typedefs.h trunk/testing/examples/STR710Test/src/main.c trunk/testing/examples/STR912Test/inc/typedefs.h trunk/testing/examples/STR912Test/src/main.c trunk/testing/examples/cortex/test.c trunk/testing/examples/ledtest-imx27ads/test.c trunk/testing/examples/ledtest-imx31pdk/test.c Log: Remove whitespace at end of lines, step 2. - Replace '\s*$' with ''. Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:50:08 UTC (rev 2380) @@ -41,7 +41,7 @@ } else { unsigned int i; - + for (i = first; i < first + num; i++) { if (((value >> (i-first))&1) == 1) @@ -60,13 +60,13 @@ { uint32_t result = 0; unsigned int i; - + for (i = first; i < first + num; i++) { if (((buffer[i/8]>>(i%8))&1) == 1) result |= 1 << (i-first); } - + return result; } } Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/command.c 2009-06-23 22:50:08 UTC (rev 2380) @@ -896,7 +896,7 @@ return ERROR_COMMAND_ARGUMENT_UNDERFLOW; \ *ul = n; \ return ERROR_OK; \ - } + } #define DEFINE_PARSE_ULONG(name, type, min, max) \ DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long, _ulong) Modified: trunk/src/helper/fileio.c =================================================================== --- trunk/src/helper/fileio.c 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/fileio.c 2009-06-23 22:50:08 UTC (rev 2380) @@ -34,7 +34,7 @@ static inline int fileio_open_local(fileio_t *fileio) { char access[4]; - + switch (fileio->access) { case FILEIO_READ: @@ -47,16 +47,16 @@ strcpy(access, "w+"); break; case FILEIO_APPEND: - strcpy(access, "a"); + strcpy(access, "a"); break; case FILEIO_APPENDREAD: - strcpy(access, "a+"); + strcpy(access, "a+"); break; default: LOG_ERROR("BUG: access neither read, write nor readwrite"); return ERROR_INVALID_ARGUMENTS; } - + /* win32 always opens in binary mode */ #ifndef _WIN32 if (fileio->type == FILEIO_BINARY) @@ -64,26 +64,26 @@ { strcat(access, "b"); } - + if (!(fileio->file = open_file_from_path (fileio->url, access))) { LOG_ERROR("couldn't open %s", fileio->url); return ERROR_FILEIO_OPERATION_FAILED; } - + if ((fileio->access != FILEIO_WRITE) || (fileio->access == FILEIO_READWRITE)) { /* NB! Here we use fseek() instead of stat(), since stat is a * more advanced operation that might not apply to e.g. a disk path * that refers to e.g. a tftp client */ int result, result2; - + result = fseek(fileio->file, 0, SEEK_END); fileio->size = ftell(fileio->file); - - result2 = fseek(fileio->file, 0, SEEK_SET); - + + result2 = fseek(fileio->file, 0, SEEK_SET); + if ((fileio->size < 0)||(result < 0)||(result2 < 0)) { fileio_close(fileio); @@ -94,7 +94,7 @@ { fileio->size = 0x0; } - + return ERROR_OK; } @@ -105,7 +105,7 @@ fileio->type = type; fileio->access = access; fileio->url = strdup(url); - + retval = fileio_open_local(fileio); return retval; @@ -127,19 +127,19 @@ return ERROR_FILEIO_OPERATION_FAILED; } - + return ERROR_OK; } int fileio_close(fileio_t *fileio) { int retval; - + retval = fileio_close_local(fileio); - + free(fileio->url); fileio->url = NULL; - + return retval; } @@ -151,14 +151,14 @@ LOG_ERROR("couldn't seek file %s: %s", fileio->url, strerror(errno)); return ERROR_FILEIO_OPERATION_FAILED; } - + return ERROR_OK; } static inline int fileio_local_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read) { *size_read = fread(buffer, 1, size, fileio->file); - + return ERROR_OK; } @@ -172,11 +172,11 @@ uint8_t buf[4]; uint32_t size_read; int retval; - + if ((retval = fileio_local_read(fileio, 4, buf, &size_read)) != ERROR_OK) return retval; *data = be_to_h_u32(buf); - + return ERROR_OK; } @@ -184,7 +184,7 @@ { if (fgets(buffer, size, fileio->file) == NULL) return ERROR_FILEIO_OPERATION_FAILED; - + return ERROR_OK; } @@ -196,19 +196,19 @@ static inline int fileio_local_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written) { *size_written = fwrite(buffer, 1, size, fileio->file); - + return ERROR_OK; } int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written) { int retval; - + retval = fileio_local_write(fileio, size, buffer, size_written); - + if (retval == ERROR_OK) fileio->size += *size_written; - + return retval;; } @@ -217,11 +217,11 @@ uint8_t buf[4]; uint32_t size_written; int retval; - + h_u32_to_be(buf, data); - + if ((retval = fileio_local_write(fileio, 4, buf, &size_written)) != ERROR_OK) return retval; - + return ERROR_OK; } Modified: trunk/src/helper/jim-eventloop.c =================================================================== --- trunk/src/helper/jim-eventloop.c 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/jim-eventloop.c 2009-06-23 22:50:08 UTC (rev 2380) @@ -2,25 +2,25 @@ * * Copyright 2005 Salvatore Sanfilippo <an...@in...> * Copyright 2005 Clemens Hintze <c.h...@gm...> - * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> + * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> * Copyright 2008 oharboe - vind Harboe - oyv...@zy... * Copyright 2008 Andrew Lunn <an...@lu...> * Copyright 2008 Duane Ellis <op...@du...> * Copyright 2008 Uwe Klein <uk...@kl...> - * + * * 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 @@ -33,7 +33,7 @@ * 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. @@ -133,12 +133,12 @@ } // The same for signals. -void Jim_CreateSignalHandler(Jim_Interp *interp, int signum, +void Jim_CreateSignalHandler(Jim_Interp *interp, int signum, Jim_FileProc *proc, void *clientData, Jim_EventFinalizerProc *finalizerProc) { } -void Jim_DeleteSignalHandler(Jim_Interp *interp, int signum) +void Jim_DeleteSignalHandler(Jim_Interp *interp, int signum) { } @@ -192,7 +192,7 @@ JimGetTime(&cur_sec, &cur_ms); te = eventLoop->timeEventHead; - if (id >= eventLoop->timeEventNextId) + if (id >= eventLoop->timeEventNextId) return -2; /* wrong event ID */ while (te) { if (te->id == id) { @@ -271,7 +271,7 @@ while (fe != NULL) { int fd = fileno((FILE*)fe->handle); - if (fe->mask & JIM_EVENT_READABLE) + if (fe->mask & JIM_EVENT_READABLE) FD_SET(fd, &rfds); if (fe->mask & JIM_EVENT_WRITABLE) FD_SET(fd, &wfds); if (fe->mask & JIM_EVENT_EXCEPTION) FD_SET(fd, &efds); @@ -419,7 +419,7 @@ Jim_Free(data); } -static int JimELVwaitCommand(Jim_Interp *interp, int argc, +static int JimELVwaitCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *oldValue; @@ -461,7 +461,7 @@ Jim_DecrRefCount(interp, objPtr); } -static int JimELAfterCommand(Jim_Interp *interp, int argc, +static int JimELAfterCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { jim_wide ms, id; @@ -510,7 +510,7 @@ } default: fprintf(stderr,"unserviced option to after %d\n",option); - } + } return JIM_OK; } Modified: trunk/src/helper/jim-eventloop.h =================================================================== --- trunk/src/helper/jim-eventloop.h 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/jim-eventloop.h 2009-06-23 22:50:08 UTC (rev 2380) @@ -2,25 +2,25 @@ * * Copyright 2005 Salvatore Sanfilippo <an...@in...> * Copyright 2005 Clemens Hintze <c.h...@gm...> - * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> + * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> * Copyright 2008 oharboe - vind Harboe - oyv...@zy... * Copyright 2008 Andrew Lunn <an...@lu...> * Copyright 2008 Duane Ellis <op...@du...> * Copyright 2008 Uwe Klein <uk...@kl...> - * + * * 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 @@ -33,7 +33,7 @@ * 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. @@ -64,7 +64,7 @@ #define JIM_EVENT_FEOF 8 #define JIM_API(x) x -#define JIM_STATIC +#define JIM_STATIC JIM_STATIC int Jim_EventLoopOnLoad(Jim_Interp *interp); Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/jim.c 2009-06-23 22:50:08 UTC (rev 2380) @@ -2,26 +2,26 @@ * * Copyright 2005 Salvatore Sanfilippo <an...@in...> * Copyright 2005 Clemens Hintze <c.h...@gm...> - * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> + * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> * Copyright 2008 oharboe - vind 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...> - * + * * 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 @@ -34,7 +34,7 @@ * 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. @@ -143,8 +143,8 @@ free(buf); #endif } - + /* * Convert a string to a jim_wide INTEGER. * This function originates from BSD. @@ -389,7 +389,7 @@ } /* Search 's1' inside 's2', starting to search from char 'index' of 's2'. - * The index of the first occurrence of s1 in s2 is returned. + * 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) { @@ -520,7 +520,7 @@ va_list ap; va_start(ap, fmt); - /* + /* * Send it here first.. Assuming STDIO still works */ fprintf(stderr, JIM_NL "JIM INTERPRETER PANIC: "); @@ -542,7 +542,7 @@ 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: "); @@ -603,7 +603,7 @@ 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; @@ -726,7 +726,7 @@ Jim_HashEntry *he, *nextHe; if (ht->table[i] == NULL) continue; - + /* For each hash entry on this slot... */ he = ht->table[i]; while (he) { @@ -1162,7 +1162,7 @@ /* 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, +void JimParserInit(struct JimParserCtx *pc, const char *prg, int len, int linenr) { pc->prg = prg; @@ -1513,7 +1513,7 @@ { char *p = dest; int i, len; - + if (slen == -1) slen = strlen(s); @@ -1599,7 +1599,7 @@ * For exmple the string: * * {expand}$a - * + * * will return as first token "expand", of type JIM_TT_STR * * While the string: @@ -2233,7 +2233,7 @@ /* This is the core of the [format] command. * TODO: Lots of things work - via a hack - * However, no format item can be >= JIM_MAX_FMT + * However, no format item can be >= JIM_MAX_FMT */ #define JIM_MAX_FMT 2048 static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr, @@ -2242,8 +2242,8 @@ const char *fmt, *_fmt; int fmtLen; Jim_Obj *resObjPtr; - + fmt = Jim_GetString(fmtObjPtr, &fmtLen); _fmt = fmt; resObjPtr = Jim_NewStringObj(interp, "", 0); @@ -2299,7 +2299,7 @@ case 'u': /* unsigned */ case 'f': /* float */ break; - + /* non-terminals */ case '0': /* zero pad */ zpad = 1; @@ -2325,7 +2325,7 @@ altfm = 1; fmt++; fmtLen--; goto next_fmt; - + case '.': inprec = 1; fmt++; fmtLen--; @@ -2382,8 +2382,8 @@ goto next_fmt; break; } - - + + if (*fmt != '%') { if (objc == 0) { not_enough_args: @@ -2395,7 +2395,7 @@ objc--; } } - + /* * Create the formatter * cause we cheat and use sprintf() @@ -2476,8 +2476,8 @@ case 'X': /* jim widevaluse are 64bit */ if (sizeof(jim_wide) == sizeof(long long)) { - *cp++ = 'l'; *cp++ = 'l'; + *cp++ = 'l'; } else { *cp++ = 'l'; } @@ -2507,7 +2507,7 @@ printf("FMT was: %s\n", fmt_str); printf("RES was: |%s|\n", sprintf_buf); #endif - + sprintf_buf[ JIM_MAX_FMT - 1] = 0; Jim_AppendString(interp, resObjPtr, sprintf_buf, strlen(sprintf_buf)); /* next obj */ @@ -2524,7 +2524,7 @@ char *sprintf_buf = malloc(JIM_MAX_FMT); Jim_Obj *t = Jim_FormatString_Inner(interp, fmtObjPtr, objc, objv, sprintf_buf); free(sprintf_buf); - return t; + return t; } /* ----------------------------------------------------------------------------- @@ -2618,9 +2618,9 @@ return JIM_ERR; } -int Jim_GetNvp(Jim_Interp *interp, +int Jim_GetNvp(Jim_Interp *interp, Jim_Obj *objPtr, - const Jim_Nvp *nvp_table, + const Jim_Nvp *nvp_table, const Jim_Nvp ** result) { Jim_Nvp *n; @@ -2735,7 +2735,7 @@ * The command structure is a pre-computed representation of the * command length and arguments structure as a simple liner array * of integers. - * + * * For example the script: * * puts hello @@ -3221,7 +3221,7 @@ cmdPtr->arityMin = arityMin; cmdPtr->arityMax = arityMax; cmdPtr->staticVars = NULL; - + /* Create the statics hash table. */ if (staticsListObjPtr) { int len, i; @@ -3319,7 +3319,7 @@ return JIM_OK; } -int Jim_RenameCommand(Jim_Interp *interp, const char *oldName, +int Jim_RenameCommand(Jim_Interp *interp, const char *oldName, const char *newName) { Jim_Cmd *cmdPtr; @@ -3737,7 +3737,7 @@ const char *name; Jim_Var *varPtr; int err; - + if ((err = SetVariableFromAny(interp, nameObjPtr)) != JIM_OK) { /* Check for [dict] syntax sugar. */ if (err == JIM_DICT_SUGAR) @@ -4037,7 +4037,7 @@ return copy; } -int JimReferencesHTKeyCompare(void *privdata, const void *key1, +int JimReferencesHTKeyCompare(void *privdata, const void *key1, const void *key2) { JIM_NOTUSED(privdata); @@ -4275,7 +4275,7 @@ &objPtr->internalRep.refValue.id, NULL); #ifdef JIM_DEBUG_GC Jim_fprintf(interp,interp->cookie_stdout, - "MARK (reference): %d refcount: %d" JIM_NL, + "MARK (reference): %d refcount: %d" JIM_NL, (int) objPtr->internalRep.refValue.id, objPtr->refCount); #endif @@ -4385,7 +4385,7 @@ { jim_wide elapsedId; int elapsedTime; - + elapsedId = interp->referenceNextId - interp->lastCollectId; elapsedTime = time(NULL) - interp->lastCollectTime; @@ -4497,7 +4497,7 @@ * there is a memory leak. */ if (i->liveList != NULL) { Jim_Obj *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); while (objPtr) { @@ -5231,7 +5231,7 @@ return JIM_OK; } -Jim_Obj *Jim_NewListObj(Jim_Interp *interp, Jim_Obj *const *elements, +Jim_Obj *Jim_NewListObj(Jim_Interp *interp, Jim_Obj *const *elements, int len) { Jim_Obj *objPtr; @@ -5433,7 +5433,7 @@ SetListFromAny(interp, listPtr); if (index >= 0 && index > listPtr->internalRep.listValue.len) index = listPtr->internalRep.listValue.len; - else if (index < 0) + else if (index < 0) index = 0; Jim_InvalidateStringRep(listPtr); ListInsertElements(listPtr, index, objc, objVec); @@ -6352,9 +6352,9 @@ if (*pc->p == '-') { pc->p++; pc->len--; } - while (isdigit((int)*pc->p) + while (isdigit((int)*pc->p) || (allowhex && isxdigit((int)*pc->p)) - || (allowdot && *pc->p == '.') + || (allowdot && *pc->p == '.') || (pc->p-pc->tstart == 1 && *pc->tstart == '0' && (*pc->p == 'x' || *pc->p == 'X')) ) @@ -7235,16 +7235,16 @@ * to be parsed in its entirely first and then, if correct, can be used for * scanning. To avoid endless re-parsing, the parsed representation will be * stored in an internal representation and re-used for performance reason. */ - + /* A ScanFmtPartDescr will held the information of /one/ part of the whole * scanformat string. This part will later be used to extract information * out from the string to be parsed by Jim_ScanString */ - + typedef struct ScanFmtPartDescr { char type; /* Type of conversion (e.g. c, d, f) */ char modifier; /* Modify type (e.g. l - long, h - short */ size_t width; /* Maximal width of input to be converted */ - int pos; /* -1 - no assign, 0 - natural pos, >0 - XPG3 pos */ + int pos; /* -1 - no assign, 0 - natural pos, >0 - XPG3 pos */ char *arg; /* Specification of a CHARSET conversion */ char *prefix; /* Prefix to be scanned literally before conversion */ } ScanFmtPartDescr; @@ -7360,7 +7360,7 @@ int width = 0, skip; ScanFmtPartDescr *descr = &fmtObj->descr[curr]; fmtObj->count++; - descr->width = 0; /* Assume width unspecified */ + descr->width = 0; /* Assume width unspecified */ /* Overread and store any "literal" prefix */ if (*fmt != '%' || fmt[1] == '%') { descr->type = 0; @@ -7373,9 +7373,9 @@ buffer[i++] = *fmt; } buffer[i++] = 0; - } + } /* Skip the conversion introducing '%' sign */ - ++fmt; + ++fmt; /* End reached due to non-conversion literal only? */ if (fmt >= fmtEnd) goto done; @@ -7436,7 +7436,7 @@ if (*fmt != ']') { fmtObj->error = "unmatched [ in format string"; return JIM_ERR; - } + } end = i; buffer[i++] = 0; /* In case a range fence was given "backwards", swap it */ @@ -7455,7 +7455,7 @@ /* Remember any valid modifier if given */ if (strchr("hlL", *fmt) != 0) descr->modifier = tolower((int)*fmt++); - + descr->type = *fmt; if (strchr("efgcsndoxui", *fmt) == 0) { fmtObj->error = "bad scan conversion character"; @@ -7489,8 +7489,8 @@ ((ScanFmtStringObj*)((_fo_)->internalRep.ptr))->error /* Some Bit testing/setting/cleaning routines. For now only used in handling - * charsets ([a-z123]) within scanning. Later on perhaps a base for a - * bitvector implementation in Jim? */ + * charsets ([a-z123]) within scanning. Later on perhaps a base for a + * bitvector implementation in Jim? */ static int JimTestBit(const char *bitvec, char ch) { @@ -7533,7 +7533,7 @@ memset(charset, (sdescr ? 0 : 255), sizeof(charset)); if (sdescr) { /* There was a set description given, that means we are parsing - * a specified string. So we have to build a corresponding + * a specified string. So we have to build a corresponding * charset reflecting the description */ int notFlag = 0; /* Should the set be negated at the end? */ @@ -7561,7 +7561,7 @@ /* Negate the charset if there was a NOT given */ for (i = 0; notFlag && i < sizeof(charset); ++i) charset[i] = ~charset[i]; - } + } /* And after all the mess above, the real work begin ... */ while (str && *str) { if (!sdescr && isspace((int)*str)) @@ -7604,7 +7604,7 @@ /* If prefix require, skip WS */ if (isspace((int)descr->prefix[i])) while (str[pos] && isspace((int)str[pos])) ++pos; - else if (descr->prefix[i] != str[pos]) + else if (descr->prefix[i] != str[pos]) break; /* Prefix do not match here, leave the loop */ else ++pos; /* Prefix matched so far, next round */ @@ -7649,7 +7649,7 @@ : descr->type == 'x' ? 16 : descr->type == 'i' ? 0 : 10; - + do { /* Try to scan a number with the given base */ if (descr->modifier == 'l') @@ -7671,7 +7671,7 @@ } /* If scanning failed, and base was undetermined, simply * put it to 10 and try once more. This should catch the - * case where %i begin to parse a number prefix (e.g. + * case where %i begin to parse a number prefix (e.g. * '0x' but no further digits follows. This will be * handled as a ZERO followed by a char 'x' by Tcl */ if (endp == tok && base == 0) base = 10; @@ -7884,7 +7884,7 @@ #ifdef JIM_DYNLIB #ifdef WIN32 #define RTLD_LAZY 0 -void * dlopen(const char *path, int mode) +void * dlopen(const char *path, int mode) { JIM_NOTUSED(mode); @@ -7933,7 +7933,7 @@ const char *prefix; int prefixlen; Jim_Obj *prefixObjPtr; - + buf[0] = '\0'; if (Jim_ListIndex(interp, libPathObjPtr, i, &prefixObjPtr, JIM_NONE) != JIM_OK) @@ -7943,7 +7943,7 @@ continue; if (*pathName == '/') { strcpy(buf, pathName); - } + } else if (prefixlen && prefix[prefixlen-1] == '/') sprintf(buf, "%s%s", prefix, pathName); else @@ -8000,7 +8000,7 @@ #define JIM_PKG_ANY_VERSION -1 /* Convert a string of the type "1.2" into an integer. - * MAJOR.MINOR is converted as MAJOR*100 + MINOR, so "1.2" is converted + * MAJOR.MINOR is converted as MAJOR*100 + MINOR, so "1.2" is converted * to the integer with value 102 */ static int JimPackageVersionToInt(Jim_Interp *interp, const char *v, int *intPtr, int flags) @@ -8958,7 +8958,7 @@ int nread, totread, maxlen, buflen; int retval; Jim_Obj *scriptObjPtr; - + if ((fp = fopen(filename, "r")) == NULL) { const int cwd_len = 2048; char *cwd = malloc(cwd_len); @@ -9137,7 +9137,7 @@ * that's: $foo($bar) */ if (script->len == 1 && script->token[0].type == JIM_TT_VAR) { Jim_Obj *varObjPtr = script->token[0].objPtr; - + Jim_IncrRefCount(varObjPtr); resObjPtr = Jim_GetVariable(interp, varObjPtr, JIM_ERRMSG); if (resObjPtr == NULL) { @@ -9162,7 +9162,7 @@ * to return. */ savedResultObjPtr = interp->result; Jim_IncrRefCount(savedResultObjPtr); - + /* Perform the substitution. Starts with an empty object * and adds every token (performing the appropriate * var/command/escape substitution). */ @@ -9385,7 +9385,7 @@ JIM_REGISTER_API(GetOpt_Nvp); JIM_REGISTER_API(GetOpt_NvpUnknown); JIM_REGISTER_API(GetOpt_Enum); - + JIM_REGISTER_API(Debug_ArgvString); JIM_REGISTER_API(SetResult_sprintf); JIM_REGISTER_API(SetResult_NvpUnknown); @@ -9395,7 +9395,7 @@ /* ----------------------------------------------------------------------------- * Core commands utility functions * ---------------------------------------------------------------------------*/ -void Jim_WrongNumArgs(Jim_Interp *interp, int argc, Jim_Obj *const *argv, +void Jim_WrongNumArgs(Jim_Interp *interp, int argc, Jim_Obj *const *argv, const char *msg) { int i; @@ -9419,11 +9419,11 @@ Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0); const char *pattern; int patternLen; - + pattern = patternObjPtr ? Jim_GetString(patternObjPtr, &patternLen) : NULL; htiter = Jim_GetHashTableIterator(&interp->commands); while ((he = Jim_NextHashEntry(htiter)) != NULL) { - if (pattern && !JimStringMatch(pattern, patternLen, he->key, + if (pattern && !JimStringMatch(pattern, patternLen, he->key, strlen((const char*)he->key), 0)) continue; Jim_ListAppendElement(interp, listObjPtr, @@ -9445,7 +9445,7 @@ Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0); const char *pattern; int patternLen; - + pattern = patternObjPtr ? Jim_GetString(patternObjPtr, &patternLen) : NULL; if (mode == JIM_VARLIST_GLOBALS) { htiter = Jim_GetHashTableIterator(&interp->topFramePtr->vars); @@ -9463,7 +9463,7 @@ if (varPtr->linkFramePtr != NULL) continue; } - if (pattern && !JimStringMatch(pattern, patternLen, he->key, + if (pattern && !JimStringMatch(pattern, patternLen, he->key, strlen((const char*)he->key), 0)) continue; Jim_ListAppendElement(interp, listObjPtr, @@ -9505,7 +9505,7 @@ { const char *str; int len, nonewline = 0; - + if (argc != 2 && argc != 3) { Jim_WrongNumArgs(interp, 1, argv, "-nonewline string"); return JIM_ERR; @@ -9528,7 +9528,7 @@ } /* Helper for [+] and [*] */ -static int Jim_AddMulHelper(Jim_Interp *interp, int argc, +static int Jim_AddMulHelper(Jim_Interp *interp, int argc, Jim_Obj *const *argv, int op) { jim_wide wideValue, res; @@ -9536,7 +9536,7 @@ int i; res = (op == JIM_EXPROP_ADD) ? 0 : 1; - + for (i = 1; i < argc; i++) { if (Jim_GetWide(interp, argv[i], &wideValue) != JIM_OK) goto trydouble; @@ -9562,7 +9562,7 @@ } /* Helper for [-] and [/] */ -static int Jim_SubDivHelper(Jim_Interp *interp, int argc, +static int Jim_SubDivHelper(Jim_Interp *interp, int argc, Jim_Obj *const *argv, int op) { jim_wide wideValue, res = 0; @@ -9687,7 +9687,7 @@ } /* [unset] */ -static int Jim_UnsetCoreCommand(Jim_Interp *interp, int argc, +static int Jim_UnsetCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i; @@ -9704,7 +9704,7 @@ } /* [incr] */ -static int Jim_IncrCoreCommand(Jim_Interp *interp, int argc, +static int Jim_IncrCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { jim_wide wideValue, increment = 1; @@ -9741,7 +9741,7 @@ } /* [while] */ -static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, +static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 3) { @@ -9770,7 +9770,7 @@ /* STEP 1 -- Check if there are the conditions to run the specialized * version of while */ - + if ((expr = Jim_GetExpression(interp, argv[1])) == NULL) goto noopt; if (expr->len <= 0 || expr->len > 3) goto noopt; switch (expr->len) { @@ -9959,7 +9959,7 @@ } /* [for] */ -static int Jim_ForCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ForCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int retval; @@ -10179,7 +10179,7 @@ } /* foreach + lmap implementation. */ -static int JimForeachMapHelper(Jim_Interp *interp, int argc, +static int JimForeachMapHelper(Jim_Interp *interp, int argc, Jim_Obj *const *argv, int doMap) { int result = JIM_ERR, i, nbrOfLists, *listsIdx, *listsEnd; @@ -10234,7 +10234,7 @@ Jim_SetResultString(interp, "couldn't set loop variable: ", -1); goto err; } - ++listsIdx[i]; /* Remember next iterator of current list */ + ++listsIdx[i]; /* Remember next iterator of current list */ } else if (Jim_SetVariable(interp, varName, emptyStr) != JIM_OK) { Jim_SetResultString(interp, "couldn't set loop variable: ", -1); goto err; @@ -10272,21 +10272,21 @@ } /* [foreach] */ -static int Jim_ForeachCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ForeachCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { return JimForeachMapHelper(interp, argc, argv, 0); } /* [lmap] */ -static int Jim_LmapCoreCommand(Jim_Interp *interp, int argc, +static int Jim_LmapCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { return JimForeachMapHelper(interp, argc, argv, 1); } /* [if] */ -static int Jim_IfCoreCommand(Jim_Interp *interp, int argc, +static int Jim_IfCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int boolean, retval, current = 1, falsebody = 0; @@ -10308,7 +10308,7 @@ return Jim_EvalObj(interp, argv[current]); /* Ok: no else-clause follows */ if (++current >= argc) { - Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); + Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); return JIM_OK; } falsebody = current++; @@ -10337,7 +10337,7 @@ enum {SWITCH_EXACT, SWITCH_GLOB, SWITCH_RE, SWITCH_CMD, SWITCH_UNKNOWN}; /* [switch] */ -static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc, +static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int retcode = JIM_ERR, matchOpt = SWITCH_EXACT, opt = 1, patCount, i; @@ -10353,13 +10353,13 @@ else if (strncmp(option, "-regexp", 2) == 0) matchOpt = SWITCH_RE; else if (strncmp(option, "-command", 2) == 0) { matchOpt = SWITCH_CMD; if ((argc - opt) < 2) goto wrongnumargs; - command = argv[++opt]; + command = argv[++opt]; } else { Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); Jim_AppendStrings(interp, Jim_GetResult(interp), "bad option \"", option, "\": must be -exact, -glob, " "-regexp, -command procname or --", 0); - goto err; + goto err; } if ((argc - opt) < 2) goto wrongnumargs; } @@ -10445,11 +10445,11 @@ "pattern body ... ?default body? or " "{pattern body ?pattern body ...?}"); err: - return retcode; + return retcode; } /* [list] */ -static int Jim_ListCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ListCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *listObjPtr; @@ -10460,7 +10460,7 @@ } /* [lindex] */ -static int Jim_LindexCoreCommand(Jim_Interp *interp, int argc, +static int Jim_LindexCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *objPtr, *listObjPtr; @@ -10496,7 +10496,7 @@ } /* [llength] */ -static int Jim_LlengthCoreCommand(Jim_Interp *interp, int argc, +static int Jim_LlengthCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int len; @@ -10511,7 +10511,7 @@ } /* [lappend] */ -static int Jim_LappendCoreCommand(Jim_Interp *interp, int argc, +static int Jim_LappendCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *listObjPtr; @@ -10545,7 +10545,7 @@ } /* [linsert] */ -static int Jim_LinsertCoreCommand(Jim_Interp *interp, int argc, +static int Jim_LinsertCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int index, len; @@ -10577,7 +10577,7 @@ } /* [lset] */ -static int Jim_LsetCoreCommand(Jim_Interp *interp, int argc, +static int Jim_LsetCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc < 3) { @@ -10635,7 +10635,7 @@ } /* [append] */ -static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc, +static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *stringObjPtr; @@ -10675,7 +10675,7 @@ } /* [debug] */ -static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, +static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { const char *options[] = { @@ -10832,7 +10832,7 @@ } /* [eval] */ -static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc, +static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc == 2) { @@ -10853,7 +10853,7 @@ } /* [uplevel] */ -static int Jim_UplevelCoreCommand(Jim_Interp *interp, int argc, +static int Jim_UplevelCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc >= 2) { @@ -10910,7 +10910,7 @@ } /* [expr] */ -static int Jim_ExprCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ExprCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *exprResultPtr; @@ -10936,7 +10936,7 @@ } /* [break] */ -static int Jim_BreakCoreCommand(Jim_Interp *interp, int argc, +static int Jim_BreakCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 1) { @@ -10958,7 +10958,7 @@ } /* [return] */ -static int Jim_ReturnCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ReturnCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc == 1) { @@ -10994,7 +10994,7 @@ } /* [proc] */ -static int Jim_ProcCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ProcCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int argListLen; @@ -11011,7 +11011,7 @@ const char *str; int len; Jim_Obj *argPtr; - + /* Check for 'args' and adjust arityMin and arityMax if necessary */ Jim_ListIndex(interp, argv[2], argListLen-1, &argPtr, JIM_NONE); str = Jim_GetString(argPtr, &len); @@ -11042,7 +11042,7 @@ } /* [concat] */ -static int Jim_ConcatCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ConcatCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_SetResult(interp, Jim_ConcatObj(interp, argc-1, argv + 1)); @@ -11050,7 +11050,7 @@ } /* [upvar] */ -static int Jim_UpvarCoreCommand(Jim_Interp *interp, int argc, +static int Jim_UpvarCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { const char *str; @@ -11059,7 +11059,7 @@ /* Lookup the target frame pointer */ str = Jim_GetString(argv[1], NULL); - if (argc > 3 && + if (argc > 3 && ((str[0] >= '0' && str[0] <= '9') || str[0] == '#')) { if (Jim_GetCallFrameByLevel(interp, argv[1], @@ -11086,7 +11086,7 @@ } /* [global] */ -static int Jim_GlobalCoreCommand(Jim_Interp *interp, int argc, +static int Jim_GlobalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i; @@ -11115,7 +11115,7 @@ Jim_Obj **value; int *keyLen, strLen, i; Jim_Obj *resultObjPtr; - + Jim_ListLength(interp, mapListObjPtr, &numMaps); if (numMaps % 2) { Jim_SetResultString(interp, @@ -11174,7 +11174,7 @@ } /* [string] */ -static int Jim_StringCoreCommand(Jim_Interp *interp, int argc, +static int Jim_StringCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int option; @@ -11350,7 +11350,7 @@ } /* [time] */ -static int Jim_TimeCoreCommand(Jim_Interp *interp, int argc, +static int Jim_TimeCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { long i, count = 1; @@ -11383,7 +11383,7 @@ } /* [exit] */ -static int Jim_ExitCoreCommand(Jim_Interp *interp, int argc, +static int Jim_ExitCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { long exitCode = 0; @@ -11401,7 +11401,7 @@ } /* [catch] */ -static int Jim_CatchCoreCommand(Jim_Interp *interp, int argc, +static int Jim_CatchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int exitCode = 0; @@ -11421,7 +11421,7 @@ } /* [ref] */ -static int Jim_RefCoreCommand(Jim_Interp *interp, int argc, +static int Jim_RefCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 3 && argc != 4) { @@ -11438,7 +11438,7 @@ } /* [getref] */ -static int Jim_GetrefCoreCommand(Jim_Interp *interp, int argc, +static int Jim_GetrefCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Reference *refPtr; @@ -11454,7 +11454,7 @@ } /* [setref] */ -static int Jim_SetrefCoreCommand(Jim_Interp *interp, int argc, +static int Jim_SetrefCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Reference *refPtr; @@ -11473,7 +11473,7 @@ } /* [collect] */ -static int Jim_CollectCoreCommand(Jim_Interp *interp, int argc, +static int Jim_CollectCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 1) { @@ -11485,7 +11485,7 @@ } /* [finalize] reference ?newValue? */ -static int Jim_FinalizeCoreCommand(Jim_Interp *interp, int argc, +static int Jim_FinalizeCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 2 && argc != 3) { @@ -11511,7 +11511,7 @@ /* [info references] (list of all the references/finalizers) */ /* [rename] */ -static int Jim_RenameCoreCommand(Jim_Interp *interp, int argc, +static int Jim_RenameCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { const char *oldName, *newName; @@ -11533,7 +11533,7 @@ } /* [dict] */ -static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, +static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int option; @@ -11607,7 +11607,7 @@ } /* [load] */ -static int Jim_LoadCoreCommand(Jim_Interp *interp, int argc, +static int Jim_LoadCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc < 2) { @@ -11618,7 +11618,7 @@ } /* [subst] */ -static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, +static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i, flags = 0; @@ -11656,7 +11656,7 @@ } /* [info] */ -static int Jim_InfoCoreCommand(Jim_Interp *interp, int argc, +static int Jim_InfoCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int cmd, result = JIM_OK; @@ -11666,7 +11666,7 @@ }; enum {INFO_BODY, INFO_COMMANDS, INFO_EXISTS, INFO_GLOBALS, INFO_LEVEL, INFO_LOCALS, INFO_VARS, INFO_VERSION, INFO_COMPLETE, INFO_ARGS, INFO_HOSTNAME}; - + if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "command ?args ...?"); return JIM_ERR; @@ -11675,7 +11675,7 @@ != JIM_OK) { return JIM_ERR; } - + if (cmd == INFO_COMMANDS) { if (argc != 2 && argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "?pattern?"); @@ -11747,7 +11747,7 @@ Jim_SetResult(interp, cmdPtr->argListObjPtr); } else if (cmd == INFO_VERSION) { char buf[(JIM_INTEGER_SPACE * 2) + 1]; - sprintf(buf, "%d.%d", + sprintf(buf, "%d.%d", JIM_VERSION / 100, JIM_VERSION % 100); Jim_SetResultString(interp, buf, -1); } else if (cmd == INFO_COMPLETE) { @@ -11770,7 +11770,7 @@ } /* [split] */ -static int Jim_SplitCoreCommand(Jim_Interp *interp, int argc, +static int Jim_SplitCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { const char *str, *splitChars, *noMatchStart; @@ -11819,7 +11819,7 @@ memset(objCache, 0, sizeof(objCache)); for (i = 0; i < strLen; i++) { int c = u[i]; - + if (objCache[c] == NULL) objCache[c] = Jim_NewStringObj(interp, (char*)u + i, 1); Jim_ListAppendElement(interp, resObjPtr, objCache[c]); @@ -11830,7 +11830,7 @@ } /* [join] */ -static int Jim_JoinCoreCommand(Jim_Interp *interp, int argc, +static int Jim_JoinCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { const char *joinStr; @@ -11891,7 +11891,7 @@ if (argc < 3) { Jim_WrongNumArgs(interp, 1, argv, "string formatString ?varName ...?"); return JIM_ERR; - } + } if (argv[2]->typePtr != &scanFmtStringObjType) SetScanFmtFromAny(interp, argv[2]); if (FormatGetError(argv[2]) != 0) { @@ -11913,7 +11913,7 @@ "field specifiers", -1); return JIM_ERR; } - } + } listPtr = Jim_ScanString(interp, argv[1], argv[2], JIM_ERRMSG); if (listPtr == 0) return JIM_ERR; @@ -12150,7 +12150,7 @@ } /* [package] */ -static int Jim_PackageCoreCommand(Jim_Interp *interp, int argc, +static int Jim_PackageCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int option; @@ -12284,7 +12284,7 @@ int i = 0; while (Jim_CoreCommandsTable[i].name != NULL) { - Jim_CreateCommand(interp, + Jim_CreateCommand(interp, Jim_CoreCommandsTable[i].name, Jim_CoreCommandsTable[i].cmdProc, NULL, NULL); @@ -12479,19 +12479,19 @@ } int -Jim_Nvp_name2value_obj(Jim_Interp *interp, - const Jim_Nvp *p, - Jim_Obj *o, +Jim_Nvp_name2value_obj(Jim_Interp *interp, + const Jim_Nvp *p, + Jim_Obj *o, Jim_Nvp **result) { return Jim_Nvp_name2value(interp, p, Jim_GetString(o, NULL), result); } - -int -Jim_Nvp_name2value(Jim_Interp *interp, - const Jim_Nvp *_p, - const char *name, + +int +Jim_Nvp_name2value(Jim_Interp *interp, + const Jim_Nvp *_p, + const char *name, Jim_Nvp **result) { const Jim_Nvp *p; @@ -12502,7 +12502,7 @@ if (result) { *result = (Jim_Nvp *)(p); } - + /* found? */ if (p->name) { return JIM_OK; @@ -12536,7 +12536,7 @@ } -int +int Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **result) { int e;; @@ -12563,7 +12563,7 @@ } -int +int Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **result) { const Jim_Nvp *p; @@ -12600,9 +12600,9 @@ Jim_fprintf(p->interp, p->interp->cookie_stderr, "---args---\n"); for (x = 0 ; x < p->argc ; x++) { - Jim_fprintf(p->interp, p->interp->cookie_stderr, - "%2d) %s\n", - x, + Jim_fprintf(p->interp, p->interp->cookie_stderr, + "%2d) %s\n", + x, Jim_GetString(p->argv[x], NULL)); } Jim_fprintf(p->interp, p->interp->cookie_stderr, "-------\n"); @@ -12613,10 +12613,10 @@ Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere) { Jim_Obj *o; - - o = NULL; // failure + + o = NULL; // failure if (goi->argc) { - // success + // success o = goi->argv[0]; goi->argc -= 1; goi->argv += 1; @@ -12656,7 +12656,7 @@ int r; Jim_Obj *o; double _safe; - + if (puthere == NULL) { puthere = &_safe; } @@ -12666,7 +12666,7 @@ r = Jim_GetDouble(goi->interp, o, puthere); if (r != JIM_OK) { Jim_SetResult_sprintf(goi->interp, - "not a number: %s", + "not a number: %s", Jim_GetString(o, NULL)); } } @@ -12691,8 +12691,8 @@ return r; } -int Jim_GetOpt_Nvp(Jim_GetOptInfo *goi, - const Jim_Nvp *nvp, +int Jim_GetOpt_Nvp(Jim_GetOptInfo *goi, + const Jim_Nvp *nvp, Jim_Nvp **puthere) { Jim_Nvp *_safe; @@ -12706,7 +12706,7 @@ e = Jim_GetOpt_Obj(goi, &o); if (e == JIM_OK) { e = Jim_Nvp_name2value_obj(goi->interp, - nvp, + nvp, o, puthere); } @@ -12731,9 +12731,9 @@ nvptable); } } - -int + +int Jim_GetOpt_Enum(Jim_GetOptInfo *goi, const char * const * lookup, int *puthere) @@ -12756,9 +12756,9 @@ } return e; } - + int Jim_SetResult_sprintf(Jim_Interp *interp, const char *fmt,...) { @@ -12774,10 +12774,10 @@ } return JIM_OK; } - + void -Jim_SetResult_NvpUnknown(Jim_Interp *interp, +Jim_SetResult_NvpUnknown(Jim_Interp *interp, Jim_Obj *param_name, Jim_Obj *param_value, const Jim_Nvp *nvp) @@ -12809,8 +12809,8 @@ nvp++; } } - + static Jim_Obj *debug_string_obj; const char * Modified: trunk/src/helper/jim.h =================================================================== --- trunk/src/helper/jim.h 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/jim.h 2009-06-23 22:50:08 UTC (rev 2380) @@ -2,25 +2,25 @@ * * Copyright 2005 Salvatore Sanfilippo <an...@in...> * Copyright 2005 Clemens Hintze <c.h...@gm...> - * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> + * Copyright 2005 patthoyts - Pat Thoyts <pat...@us...> * Copyright 2008 oharboe - vind Harboe - oyv...@zy... * Copyright 2008 Andrew Lunn <an...@lu...> * Copyright 2008 Duane Ellis <op...@du...> * Copyright 2008 Uwe Klein <uk...@kl...> - * + * * 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 @@ -33,12 +33,12 @@ * 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. * - *--- Inline Header File Documentation --- + *--- Inline Header File Documentation --- * [By Duane Ellis, op...@du..., 8/18/8] * * Belief is "Jim" would greatly benifit if Jim Internals where @@ -403,7 +403,7 @@ typedef void (Jim_DupInternalRepProc)(struct Jim_Interp *interp, struct Jim_Obj *srcPtr, Jim_Obj *dupPtr); typedef void (Jim_UpdateStringProc)(struct Jim_Obj *objPtr); - + typedef struct Jim_ObjType { const char *name; /* The name of the type. */ Jim_FreeInternalRepProc *freeIntRepProc; @@ -449,7 +449,7 @@ Jim_Obj *objPtr; struct Jim_CallFrame *linkFramePtr; } Jim_Var; - + /* The cmd structure. */ typedef int (*Jim_CmdProc)(struct Jim_Interp *interp, int argc, Jim_Obj *const *argv); @@ -591,7 +591,7 @@ * }; * * Jim_Nvp *result - * e = Jim_Nvp_name2value(interp, yn, "y", &result); + * e = Jim_Nvp_name2value(interp, yn, "y", &result); * returns &yn[0]; * e = Jim_Nvp_name2value(interp, yn, "n", &result); * returns &yn[1]; @@ -605,8 +605,8 @@ const char *name; int value; } Jim_Nvp; - + /* ----------------------------------------------------------------------------- * Exported API prototypes. * ---------------------------------------------------------------------------*/ @@ -628,7 +628,7 @@ #define Jim_FreeHashTableIterator(iter) Jim_Free(iter) #ifdef DOXYGEN -#define JIM_STATIC +#define JIM_STATIC #define JIM_API(X) X #else #ifndef __JIM_CORE__ @@ -758,15 +758,15 @@ /* commands */ JIM_STATIC void JIM_API(Jim_RegisterCoreCommands) (Jim_Interp *interp); -JIM_STATIC int JIM_API(Jim_CreateCommand) (Jim_Interp *interp, +JIM_STATIC int JIM_API(Jim_CreateCommand) (Jim_Interp *interp, const char *cmdName, Jim_CmdProc cmdProc, void *privData, Jim_DelCmdProc delProc); -JIM_STATIC int JIM_API(Jim_CreateProcedure) (Jim_Interp *interp, +JIM_STATIC int JIM_API(Jim_CreateProcedure) (Jim_Interp *interp, const char *cmdName, Jim_Obj *argListObjPtr, Jim_Obj *staticsListObjPtr, Jim_Obj *bodyObjPtr, int arityMin, int arityMax); JIM_STATIC int JIM_API(Jim_DeleteCommand) (Jim_Interp *interp, const char *cmdName); -JIM_STATIC int JIM_API(Jim_RenameCommand) (Jim_Interp *interp, +JIM_STATIC int JIM_API(Jim_RenameCommand) (Jim_Interp *interp, const char *oldName, const char *newName); JIM_STATIC Jim_Cmd * JIM_API(Jim_GetCommand) (Jim_Interp *interp, Jim_Obj *objPtr, int flags); @@ -865,7 +865,7 @@ JIM_STATIC Jim_Obj * JIM_API(Jim_NewDoubleObj)(Jim_Interp *interp, double doubleValue); /* shared strings */ -JIM_STATIC const char * JIM_API(Jim_GetSharedString) (Jim_Interp *interp, +JIM_STATIC const char * JIM_API(Jim_GetSharedString) (Jim_Interp *interp, const char *str); JIM_STATIC void JIM_API(Jim_ReleaseSharedString) (Jim_Interp *interp, const char *str); @@ -875,9 +875,9 @@ Jim_Obj *const *argv, const char *msg); JIM_STATIC int JIM_API(Jim_GetEnum) (Jim_Interp *interp, Jim_Obj *objPtr, const char * const *tablePtr, int *indexPtr, const char *name, int flags); -JIM_STATIC int JIM_API(Jim_GetNvp) (Jim_Interp *interp, +JIM_STATIC int JIM_API(Jim_GetNvp) (Jim_Interp *interp, Jim_Obj *objPtr, - const Jim_Nvp *nvp_table, + const Jim_Nvp *nvp_table, const Jim_Nvp **result); JIM_STATIC int JIM_API(Jim_ScriptIsComplete) (const char *s, int len, char *stateCharPtr); @@ -892,7 +892,7 @@ /* API import/export functions */ JIM_STATIC int JIM_API(Jim_GetApi) (Jim_Interp *interp, const char *funcname, void *targetPtrPtr); -JIM_STATIC int JIM_API(Jim_RegisterApi) (Jim_Interp *interp, +JIM_STATIC int JIM_API(Jim_RegisterApi) (Jim_Interp *interp, const char *funcname, void *funcptr); /* Packages C API */ @@ -932,20 +932,20 @@ JIM_STATIC int JIM_API(Jim_Nvp_value2name_obj)(Jim_Interp *interp, const Jim_Nvp *nvp_table, Jim_Obj *value_obj, Jim_Nvp **result); /** prints a nice 'unknown' parameter error message to the 'result' */ -JIM_STATIC void JIM_API(Jim_SetResult_NvpUnknown)(Jim_Interp *interp, +JIM_STATIC void JIM_API(Jim_SetResult_NvpUnknown)(Jim_Interp *interp, Jim_Obj *param_name, Jim_Obj *param_value, const Jim_Nvp *nvp_table); /** Debug: convert argc/argv into a printable string for printf() debug - * + * * \param interp - the interpeter * \param argc - arg count * \param argv - the objects * * \returns string pointer holding the text. - * + * * Note, next call to this function will free the old (last) string. * * For example might want do this: @@ -958,11 +958,11 @@ JIM_STATIC const char *JIM_API(Jim_Debug_ArgvString)(Jim_Interp *interp, int argc, Jim_Obj *const *argv); -/** A TCL -ish GetOpt like code. +/** A TCL -ish GetOpt like code. * * Some TCL objects have various "configuration" values. * For example - in Tcl/Tk the "buttons" have many options. - * + * * Usefull when dealing with command options. * that may come in any order... * @@ -972,7 +972,7 @@ typedef struct jim_getopt { Jim_Interp *interp; - int argc; + int argc; Jim_Obj * const * argv; int isconfigure; /* non-zero if configure */ } Jim_GetOptInfo; @@ -981,7 +981,7 @@ * * Example (short and incomplete): * \code - * Jim_GetOptInfo goi; + * Jim_GetOptInfo goi; * * Jim_GetOpt_Setup(&goi, interp, argc, argv); * @@ -1016,10 +1016,10 @@ * } * * \endcode - * + * */ -/** Setup GETOPT +/** Setup GETOPT * * \param goi - get opt info to be initialized * \param interp - jim interp @@ -1028,14 +1028,14 @@ * * \code * Jim_GetOptInfo goi; - * + * * Jim_GetOptSetup(&goi, interp, argc, argv); * \endcode */ -JIM_STATIC int JIM_API(Jim_GetOpt_Setup)(Jim_GetOptInfo *goi, - Jim_Interp *interp, - int argc, +JIM_STATIC int JIM_API(Jim_GetOpt_Setup)(Jim_GetOptInfo *goi, + Jim_Interp *interp, + int argc, Jim_Obj * const * argv); @@ -1050,7 +1050,7 @@ * * \param goi - get opt info * \param puthere - where param is put - * + * */ JIM_STATIC int JIM_API(Jim_GetOpt_Obj)(Jim_GetOptInfo *goi, Jim_Obj **puthere); @@ -1103,7 +1103,7 @@ * \code * * while (goi.argc) { - * // Get the next option + * // Get the next option * e = Jim_GetOpt_Nvp(&goi, cmd_options, &n); * if (e != JIM_OK) { * // option was not recognized @@ -1281,7 +1281,7 @@ JIM_GET_API(Nvp_name2value); JIM_GET_API(Nvp_name2value_nocase); JIM_GET_API(Nvp_name2value_simple); - + JIM_GET_API(Nvp_value2name); JIM_GET_API(Nvp_value2name_simple); Modified: trunk/src/helper/log.h =================================================================== --- trunk/src/helper/log.h 2009-06-23 22:49:23 UTC (rev 2379) +++ trunk/src/helper/log.h 2009-06-23 22:50:08 UTC (rev 2380) @@ -28,12 +28,12 @@ #include "command.h" -/* logging priorities - * LOG_LVL_SILENT - turn off all output. In lieu of try + catch this can be used as a +/* logging priorities + * LOG_LVL_SILENT - turn off all output. In lieu of try + catch this can be used as a * feeble ersatz. - * LOG_LVL_USER - user messages. Could be anything from information + * LOG_LVL_USER - user messages. Could be anything from information * to progress messags. These messages do not represent - * incorrect or unexpected behaviour, just normal execution. + * incorrect or unexpected behaviour, just normal execution. * LOG_LVL_ERROR - fatal errors, that are likely to cause program abort * LOG_LVL_WARNING - non-fatal errors, that may be resolved later * LOG_LVL_INFO - state information, etc. @@ -50,11 +50,11 @@ LOG_LVL_DEBUG = 3 }; -extern void log_printf(enum log_levels level, const char *file, int line, - const char *function, const char *format, ...) +extern void log_printf(enum log_levels level, const char *file, int line, + const char *function, const char *format, ...) __attribute__ ((format (printf, 5, 6))); extern void log_printf_lf(enum log_levels level, const char *file, int line, - const char *function, const char *format, ...) + const char *function, const char *format, ...) __attribute__ ((format (printf, 5, 6))); extern int log_register_commands(struct command_context_s *cmd_ctx); extern int log_init(struct command_context_s *cmd_ctx); @@ -118,7 +118,7 @@ #define ERROR_INVALID_ARGUMENTS ERROR_COMMAND_SYNTAX_ERROR #define ERROR_NO_CONFIG_FILE (-2) #define ERROR_BUF_TOO_SMALL (-3) -/* see "Error:" log entry for meaningful message to the user. The caller should +/* see "Error:" log entry for meaningful message to the user. The caller should * make no assumptions about what went wrong and try to handle the problem. */ #define ERROR_FAIL (-4) Modified: trunk/src/... [truncated message content] |
From: <zw...@ma...> - 2009-06-24 00:50:05
|
Author: zwelch Date: 2009-06-24 00:49:23 +0200 (Wed, 24 Jun 2009) New Revision: 2379 Modified: trunk/src/flash/aduc702x.c trunk/src/flash/at91sam7.c trunk/src/flash/cfi.c trunk/src/flash/flash.c trunk/src/flash/flash.h trunk/src/flash/mflash.c trunk/src/flash/nand.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/stellaris.c trunk/src/flash/str7x.c trunk/src/flash/tms470.c trunk/src/target/algorithm.h trunk/src/target/arm11.c trunk/src/target/arm926ejs.h trunk/src/target/arm9tdmi.h trunk/src/target/arm_adi_v5.h trunk/src/target/arm_disassembler.c trunk/src/target/arm_disassembler.h trunk/src/target/arm_jtag.c trunk/src/target/arm_simulator.c trunk/src/target/armv4_5.c trunk/src/target/armv7m.c trunk/src/target/armv7m.h trunk/src/target/breakpoints.c trunk/src/target/cortex_m3.h trunk/src/target/feroceon.c trunk/src/target/mips32.c trunk/src/target/mips32.h trunk/src/target/mips32_dmaacc.c trunk/src/target/mips32_pracc.c trunk/src/target/mips_ejtag.c trunk/src/target/mips_m4k.c trunk/src/target/target.c trunk/src/target/trace.c trunk/src/target/xscale.h trunk/src/target/xscale/protocol.h Log: Remove whitespace at end of lines, step 1. - Replace '\s*$' with ''. Modified: trunk/src/flash/aduc702x.c =================================================================== --- trunk/src/flash/aduc702x.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/aduc702x.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -109,10 +109,10 @@ static int aduc702x_build_sector_list(struct flash_bank_s *bank) { //aduc7026_flash_bank_t *aduc7026_info = bank->driver_priv; - + int i = 0; uint32_t offset = 0; - + // sector size is 512 bank->num_sectors = bank->size / 512; bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); @@ -203,7 +203,7 @@ reg_param_t reg_params[6]; armv4_5_algorithm_t armv4_5_info; int retval = ERROR_OK; - + /* parameters: r0 - address of source data (absolute) @@ -240,7 +240,7 @@ //<done>: 0xeafffffe // b 1003c <done> }; - + /* flash write code */ if (target_alloc_working_area(target, sizeof(aduc702x_flash_write_code), &aduc702x_info->write_algorithm) != ERROR_OK) @@ -248,8 +248,8 @@ LOG_WARNING("no working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - - target_write_buffer(target, aduc702x_info->write_algorithm->address, + + target_write_buffer(target, aduc702x_info->write_algorithm->address, sizeof(aduc702x_flash_write_code), (uint8_t*)aduc702x_flash_write_code); /* memory buffer */ @@ -261,26 +261,26 @@ /* if we already allocated the writing code, but failed to get a buffer, free the algorithm */ if (aduc702x_info->write_algorithm) target_free_working_area(target, aduc702x_info->write_algorithm); - + LOG_WARNING("no large enough working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } } - + armv4_5_info.common_magic = ARMV4_5_COMMON_MAGIC; armv4_5_info.core_mode = ARMV4_5_MODE_SVC; armv4_5_info.core_state = ARMV4_5_STATE_ARM; - + init_reg_param(®_params[0], "r0", 32, PARAM_OUT); init_reg_param(®_params[1], "r1", 32, PARAM_OUT); init_reg_param(®_params[2], "r2", 32, PARAM_OUT); init_reg_param(®_params[3], "r3", 32, PARAM_IN); init_reg_param(®_params[4], "r4", 32, PARAM_OUT); - + while (count > 0) { uint32_t thisrun_count = (count > (buffer_size / 2)) ? (buffer_size / 2) : count; - + target_write_buffer(target, source->address, thisrun_count * 2, buffer); buf_set_u32(reg_params[0].value, 0, 32, source->address); @@ -288,16 +288,16 @@ buf_set_u32(reg_params[2].value, 0, 32, address); buf_set_u32(reg_params[4].value, 0, 32, 0xFFFFF800); - if ((retval = target_run_algorithm(target, 0, NULL, 5, - reg_params, aduc702x_info->write_algorithm->address, - aduc702x_info->write_algorithm->address + sizeof(aduc702x_flash_write_code) - 4, + if ((retval = target_run_algorithm(target, 0, NULL, 5, + reg_params, aduc702x_info->write_algorithm->address, + aduc702x_info->write_algorithm->address + sizeof(aduc702x_flash_write_code) - 4, 10000, &armv4_5_info)) != ERROR_OK) { LOG_ERROR("error executing aduc702x flash write algorithm"); retval = ERROR_FLASH_OPERATION_FAILED; break; } - + if ((buf_get_u32(reg_params[3].value, 0, 32) & 1) != 1) { retval = ERROR_FLASH_OPERATION_FAILED; break; @@ -310,24 +310,24 @@ target_free_working_area(target, source); target_free_working_area(target, aduc702x_info->write_algorithm); - + destroy_reg_param(®_params[0]); destroy_reg_param(®_params[1]); destroy_reg_param(®_params[2]); destroy_reg_param(®_params[3]); destroy_reg_param(®_params[4]); - + return retval; } -/* All-JTAG, single-access method. Very slow. Used only if there is no +/* All-JTAG, single-access method. Very slow. Used only if there is no * working area available. */ static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { uint32_t x; uint8_t b; target_t *target = bank->target; - + aduc702x_set_write_enable(target, 1); for (x = 0; x < count; x += 2) { @@ -373,13 +373,13 @@ if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) { /* if block write failed (no sufficient working area), - * use normal (slow) JTAG method */ + * use normal (slow) JTAG method */ LOG_WARNING("couldn't use block writes, falling back to single memory accesses"); if ((retval = aduc702x_write_single(bank, buffer, offset, count)) != ERROR_OK) { LOG_ERROR("slow write failed"); - return ERROR_FLASH_OPERATION_FAILED; + return ERROR_FLASH_OPERATION_FAILED; } } else if (retval == ERROR_FLASH_OPERATION_FAILED) Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -57,7 +57,7 @@ static uint32_t at91sam7_get_flash_status(target_t *target, int bank_number); static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode); static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout); -static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen); +static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen); static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); flash_driver_t at91sam7_flash = @@ -85,8 +85,8 @@ static long SRAMSIZ[16] = { -1, 0x0400, /* 1K */ - 0x0800, /* 2K */ - -1, + 0x0800, /* 2K */ + -1, 0x1c000, /* 112K */ 0x1000, /* 4K */ 0x14000, /* 80K */ @@ -135,10 +135,10 @@ target_read_u32(target, PMC_MCKR, &mckr); /* Read Clock Generator PLL Register */ target_read_u32(target, CKGR_PLLR, &pllr); - + at91sam7_info->mck_valid = 0; at91sam7_info->mck_freq = 0; - switch (mckr & PMC_MCKR_CSS) + switch (mckr & PMC_MCKR_CSS) { case 0: /* Slow Clock */ at91sam7_info->mck_valid = 1; @@ -146,7 +146,7 @@ break; case 1: /* Main Clock */ - if ((mcfr & CKGR_MCFR_MAINRDY) && + if ((mcfr & CKGR_MCFR_MAINRDY) && (at91sam7_info->ext_freq == 0)) { at91sam7_info->mck_valid = 1; @@ -163,8 +163,8 @@ break; case 3: /* PLL Clock */ - if ((mcfr & CKGR_MCFR_MAINRDY) && - (at91sam7_info->ext_freq == 0)) + if ((mcfr & CKGR_MCFR_MAINRDY) && + (at91sam7_info->ext_freq == 0)) { target_read_u32(target, CKGR_PLLR, &pllr); if (!(pllr & CKGR_PLLR_DIV)) @@ -280,7 +280,7 @@ at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv; target_t *target = bank->target; - fcr = (0x5A << 24) | ((pagen&0x3FF) << 8) | cmd; + fcr = (0x5A << 24) | ((pagen&0x3FF) << 8) | cmd; target_write_u32(target, MC_FCR[bank->bank_number], fcr); LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number + 1, pagen); @@ -294,7 +294,7 @@ return ERROR_OK; } - if (at91sam7_wait_status_busy(bank, MC_FSR_FRDY, 10)&0x0C) + if (at91sam7_wait_status_busy(bank, MC_FSR_FRDY, 10)&0x0C) { return ERROR_FLASH_OPERATION_FAILED; } @@ -635,7 +635,7 @@ } /* Configure the flash controller timing */ - at91sam7_read_clock_info(bank); + at91sam7_read_clock_info(bank); at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH); fast_check = 1; @@ -892,7 +892,7 @@ if (erase_all) { - if (at91sam7_flash_command(bank, EA, 0) != ERROR_OK) + if (at91sam7_flash_command(bank, EA, 0) != ERROR_OK) { return ERROR_FLASH_OPERATION_FAILED; } @@ -1079,13 +1079,13 @@ buf += printed; buf_size -= printed; - printed = snprintf(buf, + printed = snprintf(buf, buf_size, " Cidr: 0x%8.8" PRIx32 " | Arch: 0x%4.4x | Eproc: %s | Version: 0x%3.3x | Flashsize: 0x%8.8" PRIx32 "\n", - at91sam7_info->cidr, - at91sam7_info->cidr_arch, + at91sam7_info->cidr, + at91sam7_info->cidr_arch, EPROC[at91sam7_info->cidr_eproc], - at91sam7_info->cidr_version, + at91sam7_info->cidr_version, bank->size); buf += printed; @@ -1117,10 +1117,10 @@ return ERROR_OK; } -/* -* On AT91SAM7S: When the gpnvm bits are set with +/* +* On AT91SAM7S: When the gpnvm bits are set with * > at91sam7 gpnvm bitnr set -* the changes are not visible in the flash controller status register MC_FSR +* the changes are not visible in the flash controller status register MC_FSR * until the processor has been reset. * On the Olimex board this requires a power cycle. * Note that the AT91SAM7S has the following errata (doc6175.pdf sec 14.1.3): @@ -1191,7 +1191,7 @@ /* Configure the flash controller timing */ at91sam7_read_clock_info(bank); at91sam7_set_flash_mode(bank, FMR_TIMING_NVBITS); - + if (at91sam7_flash_command(bank, flashcmd, bit) != ERROR_OK) { return ERROR_FLASH_OPERATION_FAILED; @@ -1203,6 +1203,6 @@ /* check protect state */ at91sam7_protect_check(bank); - + return ERROR_OK; } Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/cfi.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -378,9 +378,9 @@ 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); - 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, + 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); @@ -1597,7 +1597,7 @@ /* Check for valid range */ if (address & buffermask) { - LOG_ERROR("Write address at base 0x%" PRIx32 ", address %" PRIx32 " not aligned to 2^%d boundary", + LOG_ERROR("Write address at base 0x%" PRIx32 ", address %" PRIx32 " not aligned to 2^%d boundary", bank->base, address, cfi_info->max_buf_write_size); return ERROR_FLASH_OPERATION_FAILED; } @@ -2279,9 +2279,9 @@ for (i = 0; i < cfi_info->num_erase_regions; i++) { cfi_info->erase_region_info[i] = cfi_query_u32(bank, 0, 0x2d + (4 * i)); - LOG_DEBUG("erase region[%i]: %" PRIu32 " blocks of size 0x%" PRIx32 "", - i, - (cfi_info->erase_region_info[i] & 0xffff) + 1, + LOG_DEBUG("erase region[%i]: %" PRIu32 " blocks of size 0x%" PRIx32 "", + i, + (cfi_info->erase_region_info[i] & 0xffff) + 1, (cfi_info->erase_region_info[i] >> 16) * 256); } } Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/flash.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -92,7 +92,7 @@ retval = bank->driver->write(bank, buffer, offset, count); if (retval != ERROR_OK) { - LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", + LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", bank->base, offset, retval); } @@ -350,13 +350,13 @@ if ((retval = p->driver->auto_probe(p)) != ERROR_OK) return retval; - command_print(cmd_ctx, + command_print(cmd_ctx, "#%" PRIi32 " : %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", buswidth %i, chipwidth %i", i, - p->driver->name, - p->base, - p->size, - p->bus_width, + p->driver->name, + p->base, + p->size, + p->bus_width, p->chip_width); for (j = 0; j < p->num_sectors; j++) { @@ -369,11 +369,11 @@ else protect_state = "protection state unknown"; - command_print(cmd_ctx, + command_print(cmd_ctx, "\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s", j, - p->sectors[j].offset, - p->sectors[j].size, + p->sectors[j].offset, + p->sectors[j].size, p->sectors[j].size >> 10, protect_state); } @@ -462,9 +462,9 @@ command_print(cmd_ctx, "\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s", - j, - p->sectors[j].offset, - p->sectors[j].size, + j, + p->sectors[j].offset, + p->sectors[j].size, p->sectors[j].size >> 10, erase_state); } @@ -708,10 +708,10 @@ } if (retval == ERROR_OK) { - command_print(cmd_ctx, + command_print(cmd_ctx, "wrote %" PRIu32 " byte from file %s in %s (%f kb/s)", written, - args[0], + args[0], duration_text, (float)written / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0))); } @@ -813,7 +813,7 @@ { if (readback[i]!=chunk[i]) { - LOG_ERROR("Verfication error address 0x%08" PRIx32 ", read back 0x%02x, expected 0x%02x", + LOG_ERROR("Verfication error address 0x%08" PRIx32 ", read back 0x%02x, expected 0x%02x", address + wrote + i, readback[i], chunk[i]); return ERROR_FAIL; } @@ -831,10 +831,10 @@ float speed; speed = wrote / 1024.0; speed/=((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0)); - command_print(cmd_ctx, + command_print(cmd_ctx, "wrote %" PRId32 " bytes to 0x%8.8" PRIx32 " in %s (%f kb/s)", - count*wordsize, - address, + count*wordsize, + address, duration_text, speed); } @@ -896,12 +896,12 @@ } if (retval == ERROR_OK) { - command_print(cmd_ctx, + command_print(cmd_ctx, "wrote %lld byte from file %s to flash bank %li at offset 0x%8.8" PRIx32 " in %s (%f kb/s)", - fileio.size, - args[1], - strtoul(args[0], NULL, 0), - offset, + fileio.size, + args[1], + strtoul(args[0], NULL, 0), + offset, duration_text, (float)fileio.size / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0))); } Modified: trunk/src/flash/flash.h =================================================================== --- trunk/src/flash/flash.h 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/flash.h 2009-06-23 22:49:23 UTC (rev 2379) @@ -81,13 +81,13 @@ */ typedef struct flash_driver_s { - /** + /** * Gives a human-readable name of this flash driver, * This field is used to select and initialize the driver. */ char *name; - /** + /** * Registers driver-specific commands. When called (during the * "flash bank" command), the driver may register addition * commands to support new flash chip functions. @@ -96,12 +96,12 @@ */ int (*register_commands)(struct command_context_s *cmd_ctx); - /** + /** * Finish the "flash bank" command for @a bank. The * @a bank parameter will have been filled in by the core flash * layer when this routine is called, and the driver can store * additional information in its flash_bank_t::driver_priv field. - * + * * @param cmd_ctx - the command context * @param cmd - the command, in this case 'flash' * @param args - parameters, see below @@ -112,7 +112,7 @@ * @code * args[0] = bank * args[1] = drivername {name above} - * args[2] = baseaddress + * args[2] = baseaddress * args[3] = lengthbytes * args[4] = chip_width_in bytes * args[5] = bus_width_bytes @@ -129,7 +129,7 @@ */ int (*flash_bank_command)(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); - /** + /** * Bank/sector erase routine (target-specific). When * called, the flash driver should erase the specified sectors * using whatever means are at its disposal. @@ -141,7 +141,7 @@ */ int (*erase)(struct flash_bank_s *bank, int first, int last); - /** + /** * Bank/sector protection routine (target-specific). * When called, the driver should disable 'flash write' bits (or * enable 'erase protection' bits) for the given @a bank and @a @@ -155,7 +155,7 @@ */ int (*protect)(struct flash_bank_s *bank, int set, int first, int last); - /** + /** * Program data into the flash. Note CPU address will be * "bank->base + offset", while the physical address is * dependent upon current target MMU mappings. @@ -168,7 +168,7 @@ */ int (*write)(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); - /** + /** * Probe to determine what kind of flash is present. * This is invoked by the "probe" script command. * @@ -176,8 +176,8 @@ * @returns ERROR_OK if successful; otherwise, an error code. */ int (*probe)(struct flash_bank_s *bank); - - /** + + /** * Check the erasure status of a flash bank. * When called, the driver routine must perform the required * checks and then set the @c flash_sector_s::is_erased field @@ -209,7 +209,7 @@ * @param char - where to put the text for the human to read * @param buf_size - the size of the human buffer. * @returns ERROR_OK if successful; otherwise, an error code. - */ + */ int (*info)(struct flash_bank_s *bank, char *buf, int buf_size); /** @@ -228,7 +228,7 @@ int (*auto_probe)(struct flash_bank_s *bank); } flash_driver_t; -/** +/** * Provides details of a flash bank, available either on-chip or through * a major interface. * @@ -276,7 +276,7 @@ extern int flash_erase_address_range(struct target_s *target, uint32_t addr, uint32_t length); /** * Writes @a image into the @a target flash. The @a written parameter - * will contain the + * will contain the * @param target The target with the flash to be programmed. * @param image The image that will be programmed to flash. * @param written On return, contains the number of bytes written. Modified: trunk/src/flash/mflash.c =================================================================== --- trunk/src/flash/mflash.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/mflash.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -474,7 +474,7 @@ residue = sect_cnt % 256; for (i = 0; i < quotient; i++) { - LOG_DEBUG("mflash: sect num : %" PRIu32 " buff : 0x%0lx", sect_num, + LOG_DEBUG("mflash: sect num : %" PRIu32 " buff : 0x%0lx", sect_num, (unsigned long)buff_ptr); ret = mg_mflash_do_read_sects(buff_ptr, sect_num, 256); if (ret != ERROR_OK) @@ -485,7 +485,7 @@ } if (residue) { - LOG_DEBUG("mflash: sect num : %" PRIx32 " buff : %0lx", sect_num, + LOG_DEBUG("mflash: sect num : %" PRIx32 " buff : %0lx", sect_num, (unsigned long)buff_ptr); return mg_mflash_do_read_sects(buff_ptr, sect_num, residue); } @@ -517,7 +517,7 @@ ret = target_write_memory(target, address, 2, MG_MFLASH_SECTOR_SIZE / 2, buff_ptr); if (ret != ERROR_OK) return ret; - + buff_ptr += MG_MFLASH_SECTOR_SIZE; ret = target_write_u8(target, mflash_bank->base + MG_REG_OFFSET + MG_REG_COMMAND, mg_io_cmd_confirm_write); @@ -552,7 +552,7 @@ residue = sect_cnt % 256; for (i = 0; i < quotient; i++) { - LOG_DEBUG("mflash: sect num : %" PRIu32 "buff : %p", sect_num, + LOG_DEBUG("mflash: sect num : %" PRIu32 "buff : %p", sect_num, buff_ptr); ret = mg_mflash_do_write_sects(buff_ptr, sect_num, 256, mg_io_cmd_write); if (ret != ERROR_OK) @@ -563,7 +563,7 @@ } if (residue) { - LOG_DEBUG("mflash: sect num : %" PRIu32 " buff : %p", sect_num, + LOG_DEBUG("mflash: sect num : %" PRIu32 " buff : %p", sect_num, buff_ptr); return mg_mflash_do_write_sects(buff_ptr, sect_num, residue, mg_io_cmd_write); } @@ -741,10 +741,10 @@ goto mg_write_cmd_err; address += MG_FILEIO_CHUNK; } - + if (res) { if ((ret = fileio_read(&fileio, res, buffer, &buf_cnt)) != ERROR_OK) - goto mg_write_cmd_err; + goto mg_write_cmd_err; if ((ret = mg_mflash_write(address, buffer, res)) != ERROR_OK) goto mg_write_cmd_err; } @@ -789,7 +789,7 @@ ret = fileio_open(&fileio, args[1], FILEIO_WRITE, FILEIO_BINARY); if (ret != ERROR_OK) return ret; - + buffer = malloc(MG_FILEIO_CHUNK); if (!buffer) { fileio_close(&fileio); @@ -798,7 +798,7 @@ cnt = size / MG_FILEIO_CHUNK; res = size % MG_FILEIO_CHUNK; - + duration_start_measure(&duration); for (i = 0; i < cnt; i++) { @@ -809,7 +809,7 @@ goto mg_dump_cmd_err; address += MG_FILEIO_CHUNK; } - + if (res) { if ((ret = mg_mflash_read(address, buffer, res)) != ERROR_OK) goto mg_dump_cmd_err; @@ -834,8 +834,8 @@ free(duration_text); free(buffer); fileio_close(&fileio); - - return ret; + + return ret; } static int mg_set_feature(mg_feature_id feature, mg_feature_val config) @@ -1229,7 +1229,7 @@ switch (argc) { case 2: - if (!strcmp(args[1], "boot")) + if (!strcmp(args[1], "boot")) return mg_boot_config(); else if (!strcmp(args[1], "storage")) return mg_storage_config(); @@ -1252,7 +1252,7 @@ return ERROR_MG_INVALID_PLL; } - LOG_INFO("mflash: Fout=%" PRIu32 " Hz, feedback=%u," + LOG_INFO("mflash: Fout=%" PRIu32 " Hz, feedback=%u," "indiv=%u, outdiv=%u, lock=%u", (uint32_t)fout, pll.feedback_div, pll.input_div, pll.output_div, Modified: trunk/src/flash/nand.c =================================================================== --- trunk/src/flash/nand.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/nand.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -1138,12 +1138,12 @@ else bad_state = " (block condition unknown)"; - command_print(cmd_ctx, + command_print(cmd_ctx, "\t#%i: 0x%8.8" PRIx32 " (%" PRId32 "kB) %s%s", j, - p->blocks[j].offset, + p->blocks[j].offset, p->blocks[j].size / 1024, - erase_state, + erase_state, bad_state); } } Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -174,7 +174,7 @@ int flash_erase_all(void) { int result; - + if ((result = flash_erase_plane(0)) != FLASH_STAT_OK) return result; /* the second flash controller, if any */ Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -603,10 +603,10 @@ pic32mx_info->probed = 0; device_id = ejtag_info->idcode; - LOG_INFO("device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)", + LOG_INFO("device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)", device_id, - (unsigned)((device_id >> 1)&0x7ff), - (unsigned)((device_id >> 12)&0xff), + (unsigned)((device_id >> 1)&0x7ff), + (unsigned)((device_id >> 12)&0xff), (unsigned)((device_id >> 20)&0xfff)); if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) { @@ -698,9 +698,9 @@ device_id = ejtag_info->idcode; if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) { - snprintf(buf, buf_size, - "Cannot identify target as a PIC32MX family (manufacturer 0x%03d != 0x%03d)\n", - (unsigned)((device_id >> 1)&0x7ff), + snprintf(buf, buf_size, + "Cannot identify target as a PIC32MX family (manufacturer 0x%03d != 0x%03d)\n", + (unsigned)((device_id >> 1)&0x7ff), PIC32MX_MANUF_ID); return ERROR_FLASH_OPERATION_FAILED; } @@ -715,7 +715,7 @@ } buf += printed; buf_size -= printed; - printed = snprintf(buf, buf_size, " Ver: 0x%03x", + printed = snprintf(buf, buf_size, " Ver: 0x%03x", (unsigned)((device_id >> 20)&0xfff)); return ERROR_OK; Modified: trunk/src/flash/stellaris.c =================================================================== --- trunk/src/flash/stellaris.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/stellaris.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -292,32 +292,32 @@ { device_class = 0; } - printed = snprintf(buf, + printed = snprintf(buf, buf_size, "\nLMI Stellaris information: Chip is class %i(%s) %s v%c.%i\n", - device_class, - StellarisClassname[device_class], + device_class, + StellarisClassname[device_class], stellaris_info->target_name, (int)('A' + ((stellaris_info->did0 >> 8) & 0xFF)), (int)((stellaris_info->did0) & 0xFF)); buf += printed; buf_size -= printed; - printed = snprintf(buf, - buf_size, + printed = snprintf(buf, + buf_size, "did1: 0x%8.8" PRIx32 ", arch: 0x%4.4" PRIx32 ", eproc: %s, ramsize:%ik, flashsize: %ik\n", - stellaris_info->did1, - stellaris_info->did1, - "ARMV7M", + stellaris_info->did1, + stellaris_info->did1, + "ARMV7M", (int)((1 + ((stellaris_info->dc0 >> 16) & 0xFFFF))/4), (int)((1 + (stellaris_info->dc0 & 0xFFFF))*2)); buf += printed; buf_size -= printed; - printed = snprintf(buf, + printed = snprintf(buf, buf_size, "master clock(estimated): %ikHz, rcc is 0x%" PRIx32 " \n", - (int)(stellaris_info->mck_freq / 1000), + (int)(stellaris_info->mck_freq / 1000), stellaris_info->rcc); buf += printed; buf_size -= printed; @@ -326,9 +326,9 @@ { printed = snprintf(buf, buf_size, - "pagesize: %" PRIi32 ", lockbits: %i 0x%4.4" PRIx32 ", pages in lock region: %i \n", - stellaris_info->pagesize, - stellaris_info->num_lockbits, + "pagesize: %" PRIi32 ", lockbits: %i 0x%4.4" PRIx32 ", pages in lock region: %i \n", + stellaris_info->pagesize, + stellaris_info->num_lockbits, stellaris_info->lockbits, (int)(stellaris_info->num_pages/stellaris_info->num_lockbits)); buf += printed; Modified: trunk/src/flash/str7x.c =================================================================== --- trunk/src/flash/str7x.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/str7x.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -75,10 +75,10 @@ static int str7x_register_commands(struct command_context_s *cmd_ctx) { command_t *str7x_cmd = register_command(cmd_ctx, NULL, "str7x", NULL, COMMAND_ANY, NULL); - + register_command(cmd_ctx, str7x_cmd, "disable_jtag", str7x_handle_disable_jtag_command, COMMAND_EXEC, "disable jtag access"); - + return ERROR_OK; } @@ -95,7 +95,7 @@ int i; int num_sectors; int b0_sectors = 0, b1_sectors = 0; - + switch (bank->size) { case 16 * 1024: @@ -114,15 +114,15 @@ LOG_ERROR("BUG: unknown bank->size encountered"); exit(-1); } - + num_sectors = b0_sectors + b1_sectors; - + bank->num_sectors = num_sectors; bank->sectors = malloc(sizeof(flash_sector_t) * num_sectors); str7x_info->sector_bits = malloc(sizeof(uint32_t) * num_sectors); - + num_sectors = 0; - + for (i = 0; i < b0_sectors; i++) { bank->sectors[num_sectors].offset = mem_layout_str7bank0[i].sector_start; @@ -131,7 +131,7 @@ bank->sectors[num_sectors].is_protected = 1; str7x_info->sector_bits[num_sectors++] = mem_layout_str7bank0[i].sector_bit; } - + for (i = 0; i < b1_sectors; i++) { bank->sectors[num_sectors].offset = mem_layout_str7bank1[i].sector_start; @@ -140,7 +140,7 @@ bank->sectors[num_sectors].is_protected = 1; str7x_info->sector_bits[num_sectors++] = mem_layout_str7bank1[i].sector_bit; } - + return ERROR_OK; } @@ -149,20 +149,20 @@ static int str7x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) { str7x_flash_bank_t *str7x_info; - + if (argc < 7) { LOG_WARNING("incomplete flash_bank str7x configuration"); return ERROR_FLASH_BANK_INVALID; } - + str7x_info = malloc(sizeof(str7x_flash_bank_t)); bank->driver_priv = str7x_info; - + /* set default bits for str71x flash */ str7x_info->busy_bits = (FLASH_LOCK | FLASH_BSYA1 | FLASH_BSYA0); str7x_info->disable_bit = (1 << 1); - + if (strcmp(args[6], "STR71x") == 0) { str7x_info->register_base = 0x40100000; @@ -185,9 +185,9 @@ } str7x_build_block_list(bank); - + str7x_info->write_algorithm = NULL; - + return ERROR_OK; } @@ -207,7 +207,7 @@ uint32_t retval; target_read_u32(target, str7x_get_flash_adr(bank, FLASH_ER), &retval); - + return retval; } @@ -215,7 +215,7 @@ { str7x_flash_bank_t *str7x_info = bank->driver_priv; target_t *target = bank->target; - + int i; uint32_t retval; @@ -242,12 +242,12 @@ { str7x_flash_bank_t *str7x_info = bank->driver_priv; target_t *target = bank->target; - + int i; uint32_t cmd; uint32_t retval; uint32_t sectors = 0; - + if (bank->target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); @@ -258,33 +258,33 @@ { sectors |= str7x_info->sector_bits[i]; } - + LOG_DEBUG("sectors: 0x%" PRIx32 "", sectors); - - /* clear FLASH_ER register */ + + /* clear FLASH_ER register */ target_write_u32(target, str7x_get_flash_adr(bank, FLASH_ER), 0x0); - + cmd = FLASH_SER; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + cmd = sectors; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR1), cmd); - + cmd = FLASH_SER | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { alive_sleep(1); } - + retval = str7x_result(bank); - + if (retval) { LOG_ERROR("error erasing flash bank, FLASH_ER: 0x%" PRIx32 "", retval); return ERROR_FLASH_OPERATION_FAILED; } - + for (i = first; i <= last; i++) bank->sectors[i].is_erased = 1; @@ -299,13 +299,13 @@ uint32_t cmd; uint32_t retval; uint32_t protect_blocks; - + if (bank->target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_TARGET_NOT_HALTED; } - + protect_blocks = 0xFFFFFFFF; if (set) @@ -313,30 +313,30 @@ for (i = first; i <= last; i++) protect_blocks &= ~(str7x_info->sector_bits[i]); } - - /* clear FLASH_ER register */ + + /* clear FLASH_ER register */ target_write_u32(target, str7x_get_flash_adr(bank, FLASH_ER), 0x0); cmd = FLASH_SPR; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + cmd = str7x_get_flash_adr(bank, FLASH_NVWPAR); target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), cmd); - + cmd = protect_blocks; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), cmd); - + cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { alive_sleep(1); } - + retval = str7x_result(bank); - + LOG_DEBUG("retval: 0x%8.8" PRIx32 "", retval); - + if (retval & FLASH_ERER) return ERROR_FLASH_SECTOR_NOT_ERASED; else if (retval & FLASH_WPF) @@ -355,7 +355,7 @@ reg_param_t reg_params[6]; armv4_5_algorithm_t armv4_5_info; int retval = ERROR_OK; - + uint32_t str7x_flash_write_code[] = { /* write: */ 0xe3a04201, /* mov r4, #0x10000000 */ @@ -381,14 +381,14 @@ /* exit: */ 0xeafffffe, /* b exit */ }; - + /* flash write code */ if (target_alloc_working_area(target, 4 * 20, &str7x_info->write_algorithm) != ERROR_OK) { LOG_WARNING("no working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - + target_write_buffer(target, str7x_info->write_algorithm->address, 20 * 4, (uint8_t*)str7x_flash_write_code); /* memory buffer */ @@ -400,63 +400,63 @@ /* if we already allocated the writing code, but failed to get a buffer, free the algorithm */ if (str7x_info->write_algorithm) target_free_working_area(target, str7x_info->write_algorithm); - + LOG_WARNING("no large enough working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } } - + armv4_5_info.common_magic = ARMV4_5_COMMON_MAGIC; armv4_5_info.core_mode = ARMV4_5_MODE_SVC; armv4_5_info.core_state = ARMV4_5_STATE_ARM; - + init_reg_param(®_params[0], "r0", 32, PARAM_OUT); init_reg_param(®_params[1], "r1", 32, PARAM_OUT); init_reg_param(®_params[2], "r2", 32, PARAM_OUT); init_reg_param(®_params[3], "r3", 32, PARAM_OUT); init_reg_param(®_params[4], "r4", 32, PARAM_IN); init_reg_param(®_params[5], "r5", 32, PARAM_OUT); - + while (count > 0) { uint32_t thisrun_count = (count > (buffer_size / 8)) ? (buffer_size / 8) : count; - + target_write_buffer(target, source->address, thisrun_count * 8, buffer); - + buf_set_u32(reg_params[0].value, 0, 32, source->address); buf_set_u32(reg_params[1].value, 0, 32, address); buf_set_u32(reg_params[2].value, 0, 32, str7x_get_flash_adr(bank, FLASH_CR0)); buf_set_u32(reg_params[3].value, 0, 32, thisrun_count); buf_set_u32(reg_params[5].value, 0, 32, str7x_info->busy_bits); - + if ((retval = target_run_algorithm(target, 0, NULL, 6, reg_params, str7x_info->write_algorithm->address, str7x_info->write_algorithm->address + (19 * 4), 10000, &armv4_5_info)) != ERROR_OK) { LOG_ERROR("error executing str7x flash write algorithm"); retval = ERROR_FLASH_OPERATION_FAILED; break; } - + if (buf_get_u32(reg_params[4].value, 0, 32) != 0x00) { retval = ERROR_FLASH_OPERATION_FAILED; break; } - + buffer += thisrun_count * 8; address += thisrun_count * 8; count -= thisrun_count; } - + target_free_working_area(target, source); target_free_working_area(target, str7x_info->write_algorithm); - + destroy_reg_param(®_params[0]); destroy_reg_param(®_params[1]); destroy_reg_param(®_params[2]); destroy_reg_param(®_params[3]); destroy_reg_param(®_params[4]); destroy_reg_param(®_params[5]); - + return retval; } @@ -472,7 +472,7 @@ int retval; uint32_t check_address = offset; int i; - + if (bank->target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); @@ -484,12 +484,12 @@ LOG_WARNING("offset 0x%" PRIx32 " breaks required 8-byte alignment", offset); return ERROR_FLASH_DST_BREAKS_ALIGNMENT; } - + for (i = 0; i < bank->num_sectors; i++) { uint32_t sec_start = bank->sectors[i].offset; uint32_t sec_end = sec_start + bank->sectors[i].size; - + /* check if destination falls within the current sector */ if ((check_address >= sec_start) && (check_address < sec_end)) { @@ -500,15 +500,15 @@ check_address = sec_end; } } - + if (check_address != offset + count) return ERROR_FLASH_DST_OUT_OF_BANK; - - /* clear FLASH_ER register */ + + /* clear FLASH_ER register */ target_write_u32(target, str7x_get_flash_adr(bank, FLASH_ER), 0x0); /* multiple dwords (8-byte) to be programmed? */ - if (dwords_remaining > 0) + if (dwords_remaining > 0) { /* try using a block write */ if ((retval = str7x_write_block(bank, buffer, offset, dwords_remaining)) != ERROR_OK) @@ -516,14 +516,14 @@ if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) { /* if block write failed (no sufficient working area), - * we use normal (slow) single dword accesses */ + * we use normal (slow) single dword accesses */ LOG_WARNING("couldn't use block writes, falling back to single memory accesses"); } else if (retval == ERROR_FLASH_OPERATION_FAILED) { /* if an error occured, we examine the reason, and quit */ retval = str7x_result(bank); - + LOG_ERROR("flash writing failed with error code: 0x%x", retval); return ERROR_FLASH_OPERATION_FAILED; } @@ -541,29 +541,29 @@ /* command */ cmd = FLASH_DWPG; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + /* address */ target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), address); - + /* data word 1 */ target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR0), 4, 1, buffer + bytes_written); bytes_written += 4; - + /* data word 2 */ target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR1), 4, 1, buffer + bytes_written); bytes_written += 4; - + /* start programming cycle */ cmd = FLASH_DWPG | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { alive_sleep(1); } - + retval = str7x_result(bank); - + if (retval & FLASH_PGER) return ERROR_FLASH_OPERATION_FAILED; else if (retval & FLASH_WPF) @@ -572,51 +572,51 @@ dwords_remaining--; address += 8; } - + if (bytes_remaining) { uint8_t last_dword[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; int i = 0; - + while (bytes_remaining > 0) { - last_dword[i++] = *(buffer + bytes_written); + last_dword[i++] = *(buffer + bytes_written); bytes_remaining--; bytes_written++; } - + /* command */ cmd = FLASH_DWPG; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + /* address */ target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), address); - + /* data word 1 */ target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR0), 4, 1, last_dword); bytes_written += 4; - + /* data word 2 */ target_write_memory(target, str7x_get_flash_adr(bank, FLASH_DR1), 4, 1, last_dword + 4); bytes_written += 4; - + /* start programming cycle */ cmd = FLASH_DWPG | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - + while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { alive_sleep(1); } - + retval = str7x_result(bank); - + if (retval & FLASH_PGER) return ERROR_FLASH_OPERATION_FAILED; else if (retval & FLASH_WPF) return ERROR_FLASH_OPERATION_FAILED; } - + return ERROR_OK; } @@ -643,35 +643,35 @@ flash_bank_t *bank; target_t *target = NULL; str7x_flash_bank_t *str7x_info = NULL; - + uint32_t flash_cmd; uint32_t retval; uint16_t ProtectionLevel = 0; uint16_t ProtectionRegs; - + if (argc < 1) { command_print(cmd_ctx, "str7x disable_jtag <bank>"); - return ERROR_OK; + return ERROR_OK; } - + bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0)); if (!bank) { command_print(cmd_ctx, "str7x disable_jtag <bank> ok"); return ERROR_OK; } - + str7x_info = bank->driver_priv; - + target = bank->target; - + if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_TARGET_NOT_HALTED; } - + /* first we get protection status */ target_read_u32(target, str7x_get_flash_adr(bank, FLASH_NVAPR0), &retval); @@ -679,7 +679,7 @@ { ProtectionLevel = 1; } - + target_read_u32(target, str7x_get_flash_adr(bank, FLASH_NVAPR1), &retval); ProtectionRegs = ~(retval >> 16); @@ -688,7 +688,7 @@ ProtectionRegs >>= 1; ProtectionLevel++; } - + if (ProtectionLevel == 0) { flash_cmd = FLASH_SPR; @@ -707,6 +707,6 @@ flash_cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); } - + return ERROR_OK; } Modified: trunk/src/flash/tms470.c =================================================================== --- trunk/src/flash/tms470.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/flash/tms470.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -49,7 +49,7 @@ .info = tms470_info }; -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- Internal Support, Helpers ---------------------------------------------------------------------- */ @@ -288,10 +288,10 @@ bank->chip_width = 32; bank->bus_width = 32; - LOG_INFO("Identified %s, ver=%d, core=%s, nvmem=%s.", + LOG_INFO("Identified %s, ver=%d, core=%s, nvmem=%s.", part_name, (int)(silicon_version), - (technology_family ? "1.8v" : "3.3v"), + (technology_family ? "1.8v" : "3.3v"), (rom_flash ? "rom" : "flash")); tms470_info->device_ident_reg = device_ident_reg; @@ -347,7 +347,7 @@ if (keysSet) { - command_print(cmd_ctx, "using flash keys 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 "", + command_print(cmd_ctx, "using flash keys 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 "", flashKeys[0], flashKeys[1], flashKeys[2], flashKeys[3]); } else @@ -488,7 +488,7 @@ if (ERROR_OK == tms470_check_flash_unlocked(target)) { - /* + /* * There seems to be a side-effect of reading the FMPKEY * register in that it re-enables the protection. So we * re-enable it. @@ -754,7 +754,7 @@ uint32_t flashAddr = bank->base + bank->sectors[sector].offset; int result = ERROR_OK; - /* + /* * Set the bit GLBCTRL4 of the GLBCTRL register (in the System * module) to enable writing to the flash registers }. */ @@ -787,8 +787,8 @@ } bank->sectors[sector].is_protected = 0; - /* - * clear status regiser, sent erase command, kickoff erase + /* + * clear status regiser, sent erase command, kickoff erase */ target_write_u16(target, flashAddr, 0x0040); LOG_DEBUG("write *(uint16_t *)0x%08" PRIx32 "=0x0040", flashAddr); @@ -838,7 +838,7 @@ return result; } -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- Implementation of Flash Driver Interfaces ---------------------------------------------------------------------- */ @@ -1115,7 +1115,7 @@ target_read_u32(target, 0xFFE88004, &fmbac2); target_write_u32(target, 0xFFE88004, fmbac2 | 0xff); - /* + /* * The TI primitives inspect the flash memory by reading one 32-bit * word at a time. Here we read an entire sector and inspect it in * an attempt to reduce the JTAG overhead. Modified: trunk/src/target/algorithm.h =================================================================== --- trunk/src/target/algorithm.h 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/target/algorithm.h 2009-06-23 22:49:23 UTC (rev 2379) @@ -35,7 +35,7 @@ uint32_t size; uint8_t *value; enum param_direction direction; -} mem_param_t; +} mem_param_t; typedef struct reg_param_s { Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/target/arm11.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -1888,7 +1888,7 @@ if (values[i] > arm11_coproc_instruction_limits[i]) { LOG_ERROR("Parameter %ld out of bounds (%" PRId32 " max). %s", - (long)(i + 2), + (long)(i + 2), arm11_coproc_instruction_limits[i], read ? arm11_mrc_syntax : arm11_mcr_syntax); return -1; @@ -1913,10 +1913,10 @@ arm11_run_instr_data_from_core_via_r0(arm11, instr, &result); LOG_INFO("MRC p%d, %d, R0, c%d, c%d, %d = 0x%08" PRIx32 " (%" PRId32 ")", - (int)(values[0]), - (int)(values[1]), - (int)(values[2]), - (int)(values[3]), + (int)(values[0]), + (int)(values[1]), + (int)(values[2]), + (int)(values[3]), (int)(values[4]), result, result); } else Modified: trunk/src/target/arm926ejs.h =================================================================== --- trunk/src/target/arm926ejs.h 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/target/arm926ejs.h 2009-06-23 22:49:23 UTC (rev 2379) @@ -39,9 +39,9 @@ } arm926ejs_common_t; extern int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, jtag_tap_t *tap); -extern int arm926ejs_register_commands(struct command_context_s *cmd_ctx); -extern int arm926ejs_arch_state(struct target_s *target); -extern int arm926ejs_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); +extern int arm926ejs_register_commands(struct command_context_s *cmd_ctx); +extern int arm926ejs_arch_state(struct target_s *target); +extern int arm926ejs_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); extern int arm926ejs_soft_reset_halt(struct target_s *target); #endif /* ARM926EJS_H */ Modified: trunk/src/target/arm9tdmi.h =================================================================== --- trunk/src/target/arm9tdmi.h 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/target/arm9tdmi.h 2009-06-23 22:49:23 UTC (rev 2379) @@ -59,7 +59,7 @@ extern int arm9tdmi_clock_out(arm_jtag_t *jtag_info, uint32_t instr, uint32_t out, uint32_t *in, int sysspeed); extern int arm9tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in); -extern int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be); +extern int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be); extern void arm9tdmi_read_core_regs(target_t *target, uint32_t mask, uint32_t* core_regs[16]); extern void arm9tdmi_write_core_regs(target_t *target, uint32_t mask, uint32_t core_regs[16]); Modified: trunk/src/target/arm_adi_v5.h =================================================================== --- trunk/src/target/arm_adi_v5.h 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/target/arm_adi_v5.h 2009-06-23 22:49:23 UTC (rev 2379) @@ -104,7 +104,7 @@ } swjdp_common_t; -/* Accessor function for currently selected DAP-AP number */ +/* Accessor function for currently selected DAP-AP number */ static inline uint8_t dap_ap_get_select(swjdp_common_t *swjdp) { return (uint8_t)(swjdp ->apsel >> 24); Modified: trunk/src/target/arm_disassembler.c =================================================================== --- trunk/src/target/arm_disassembler.c 2009-06-23 22:49:06 UTC (rev 2378) +++ trunk/src/target/arm_disassembler.c 2009-06-23 22:49:23 UTC (rev 2379) @@ -33,9 +33,9 @@ }; /* make up for C's missing ROR */ -uint32_t ror(uint32_t value, int places) -{ - return (value >> places) | (value << (32 - places)); +uint32_t ror(uint32_t value, int places) +{ + return (value >> places) | (value << (32 - places)); } int evaluate_pld(uint32_t opcode, uint32_t address, arm_instruction_t *instruction) @@ -44,9 +44,9 @@ if ((opcode & 0x0d70f0000) == 0x0550f000) { instruction->type = ARM_PLD; - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tPLD ...TODO...", address, opcode); - + return ERROR_OK; } else @@ -54,7 +54,7 @@ instruction->type = ARM_UNDEFINED_INSTRUCTION; return ERROR_OK; } - + LOG_ERROR("should never reach this point"); return -1; } @@ -62,9 +62,9 @@ int evaluate_swi(uint32_t opcode, uint32_t address, arm_instruction_t *instruction) { instruction->type = ARM_SWI; - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSWI 0x%6.6" PRIx32 "", address, opcode, (opcode & 0xffffff)); - + return ERROR_OK; } @@ -73,30 +73,30 @@ int offset; uint32_t immediate; uint32_t target_address; - + instruction->type = ARM_BLX; immediate = opcode & 0x00ffffff; - + /* sign extend 24-bit immediate */ if (immediate & 0x00800000) offset = 0xff000000 | immediate; else offset = immediate; - + /* shift two bits left */ offset <<= 2; - + /* odd/event halfword */ if (opcode & 0x01000000) offset |= 0x2; - + target_address = address + 8 + offset; - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBLX 0x%8.8" PRIx32 "", address, opcode, target_address); - + instruction->info.b_bl_bx_blx.reg_operand = -1; instruction->info.b_bl_bx_blx.target_address = target_address; - + return ERROR_OK; } @@ -106,32 +106,32 @@ uint32_t immediate; int offset; uint32_t target_address; - + immediate = opcode & 0x00ffffff; L = (opcode & 0x01000000) >> 24; - + /* sign extend 24-bit immediate */ if (immediate & 0x00800000) offset = 0xff000000 | immediate; else offset = immediate; - + /* shift two bits left */ offset <<= 2; - + target_address = address + 8 + offset; if (L) instruction->type = ARM_BL; else instruction->type = ARM_B; - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tB%s%s 0x%8.8" PRIx32 , address, opcode, (L) ? "L" : "", COND(opcode), target_address); - + instruction->info.b_bl_bx_blx.reg_operand = -1; instruction->info.b_bl_bx_blx.target_address = target_address; - + return ERROR_OK; } @@ -140,32 +140,32 @@ int evaluate_ldc_stc_mcrr_mrrc(uint32_t opcode, uint32_t address, arm_instruction_t *instruction) { uint8_t cp_num = (opcode & 0xf00) >> 8; - + /* MCRR or MRRC */ if (((opcode & 0x0ff00000) == 0x0c400000) || ((opcode & 0x0ff00000) == 0x0c400000)) { uint8_t cp_opcode, Rd, Rn, CRm; char *mnemonic; - + cp_opcode = (opcode & 0xf0) >> 4; Rd = (opcode & 0xf000) >> 12; Rn = (opcode & 0xf0000) >> 16; CRm = (opcode & 0xf); - + /* MCRR */ if ((opcode & 0x0ff00000) == 0x0c400000) { instruction->type = ARM_MCRR; mnemonic = "MCRR"; } - + /* MRRC */ if ((opcode & 0x0ff00000) == 0x0c500000) { instruction->type = ARM_MRRC; mnemonic = "MRRC"; } - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s p%i, %x, r%i, r%i, c%i", address, opcode, mnemonic, COND(opcode), cp_num, cp_opcode, Rd, Rn, CRm); } @@ -175,11 +175,11 @@ uint8_t U, N; char *mnemonic; char addressing_mode[32]; - + CRd = (opcode & 0xf000) >> 12; Rn = (opcode & 0xf0000) >> 16; offset = (opcode & 0xff); - + /* load/store */ if (opcode & 0x00100000) { @@ -191,10 +191,10 @@ instruction->type = ARM_STC; mnemonic = "STC"; } - + U = (opcode & 0x00800000) >> 23; N = (opcode & 0x00400000) >> 22; - + /* addressing modes */ if ((opcode & 0x01200000) == 0x01000000) /* immediate offset */ snprintf(addressing_mode, 32, "[r%i, #%s0x%2.2x*4]", Rn, (U) ? "" : "-", offset); @@ -210,7 +210,7 @@ (N) ? "L" : "", cp_num, CRd, addressing_mode); } - + return ERROR_OK; } @@ -222,14 +222,14 @@ char* cond; char* mnemonic; uint8_t cp_num, opcode_1, CRd_Rd, CRn, CRm, opcode_2; - + cond = ((opcode & 0xf0000000) == 0xf0000000) ? "2" : COND(opcode); cp_num = (opcode & 0xf00) >> 8; CRd_Rd = (opcode & 0xf000) >> 12; CRn = (opcode & 0xf0000) >> 16; CRm = (opcode & 0xf); opcode_2 = (opcode & 0xe0) >> 5; - + /* CDP or MRC/MCR */ if (opcode & 0x00000010) /* bit 4 set -> MRC/MCR */ { @@ -243,9 +243,9 @@ instruction->type = ARM_MCR; mnemonic = "MCR"; } - + opcode_1 = (opcode & 0x00e00000) >> 21; - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s p%i, 0x%2.2x, r%i, c%i, c%i, 0x%2.2x", address, opcode, mnemonic, cond, cp_num, opcode_1, CRd_Rd, CRn, CRm, opcode_2); @@ -254,14 +254,14 @@ { instruction->type = ARM_CDP; mnemonic = "CDP"; - + opcode_1 = (opcode & 0x00f00000) >> 20; - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s p%i, 0x%2.2x, c%i, c%i, c%i, 0x%2.2x", address, opcode, mnemonic, cond, cp_num, opcode_1, CRd_Rd, CRn, CRm, opcode_2); } - + return ERROR_OK; } @@ -273,7 +273,7 @@ char *operation; /* "LDR" or "STR" */ char *suffix; /* "", "B", "T", "BT" */ char offset[32]; - + /* examine flags */ I = (opcode & 0x02000000) >> 25; P = (opcode & 0x01000000) >> 24; @@ -281,13 +281,13 @@ B = (opcode & 0x00400000) >> 22; W = (opcode & 0x00200000) >> 21; L = (opcode & 0x00100000) >> 20; - + /* target register */ Rd = (opcode & 0xf000) >> 12; - + /* base register */ Rn = (opcode & 0xf0000) >> 16; - + instruction->info.load_store.Rd = Rd; instruction->info.load_store.Rn = Rn; instruction->info.load_store.U = U; @@ -297,7 +297,7 @@ operation = "LDR"; else operation = "STR"; - + /* determine instruction type and suffix */ if (B) { @@ -337,7 +337,7 @@ suffix = ""; } } - + if (!I) /* #+-<offset_12> */ { uint32_t offset_12 = (opcode & 0xfff); @@ -345,7 +345,7 @@ snprintf(offset, 32, ", #%s0x%" PRIx32 "", (U) ? "" : "-", offset_12); else snprintf(offset, 32, "%s", ""); - + instruction->info.load_store.offset_mode = 0; instruction->info.load_store.offset.offset = offset_12; } @@ -353,15 +353,15 @@ { uint8_t shift_imm, shift; uint8_t Rm; - + shift_imm = (opcode & 0xf80) >> 7; shift = (opcode & 0x60) >> 5; Rm = (opcode & 0xf); - + /* LSR encodes a shift by 32 bit as 0x0 */ if ((shift == 0x1) && (shift_imm == 0x0)) shift_imm = 0x20; - + /* ASR encodes a shift by 32 bit as 0x0 */ if ((shift == 0x2) && (shift_imm == 0x0)) shift_imm = 0x20; @@ -369,7 +369,7 @@ /* ROR by 32 bit is actually a RRX */ if ((shift == 0x3) && (shift_imm == 0x0)) shift = 0x4; - + instruction->info.load_store.offset_mode = 1; instruction->info.load_store.offset.reg.Rm = Rm; instruction->info.load_store.offset.reg.shift = shift; @@ -401,7 +401,7 @@ } } } - + if (P == 1) { if (W == 0) /* offset */ @@ -409,7 +409,7 @@ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, [r%i%s]", address, opcode, operation, COND(opcode), suffix, Rd, Rn, offset); - + instruction->info.load_store.index_mode = 0; } else /* pre-indexed */ @@ -417,7 +417,7 @@ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, [r%i%s]!", address, opcode, operation, COND(opcode), suffix, Rd, Rn, offset); - + instruction->info.load_store.index_mode = 1; } } @@ -426,10 +426,10 @@ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, [r%i]%s", address, opcode, operation, COND(opcode), suffix, Rd, Rn, offset); - + instruction->info.load_store.index_mode = 2; } - + return ERROR_OK; } @@ -441,7 +441,7 @@ char *operation; /* "LDR" or "STR" */ char *suffix; /* "H", "SB", "SH", "D" */ char offset[32]; - + /* examine flags */ P = (opcode & 0x01000000) >> 24; U = (opcode & 0x00800000) >> 23; @@ -450,17 +450,17 @@ L = (opcode & 0x00100000) >> 20; S = (opcode & 0x00000040) >> 6; H = (opcode & 0x00000020) >> 5; - + /* target register */ Rd = (opcode & 0xf000) >> 12; - + /* base register */ Rn = (opcode & 0xf0000) >> 16; - + instruction->info.load_store.Rd = Rd; instruction->info.load_store.Rn = Rn; instruction->info.load_store.U = U; - + /* determine instruction type and suffix */ if (S) /* signed */ { @@ -508,12 +508,12 @@ instruction->type = ARM_STRH; } } - + if (I) /* Immediate offset/index (#+-<offset_8>)*/ { uint32_t offset_8 = ((opcode & 0xf00) >> 4) | (opcode & 0xf); snprintf(offset, 32, "#%s0x%" PRIx32 "", (U) ? "" : "-", offset_8); - + instruction->info.load_store.offset_mode = 0; instruction->info.load_store.offset.offset = offset_8; } @@ -522,13 +522,13 @@ uint8_t Rm; Rm = (opcode & 0xf); snprintf(offset, 32, "%sr%i", (U) ? "" : "-", Rm); - + instruction->info.load_store.offset_mode = 1; instruction->info.load_store.offset.reg.Rm = Rm; instruction->info.load_store.offset.reg.shift = 0x0; instruction->info.load_store.offset.reg.shift_imm = 0x0; } - + if (P == 1) { if (W == 0) /* offset */ @@ -536,7 +536,7 @@ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, [r%i, %s]", address, opcode, operation, COND(opcode), suffix, Rd, Rn, offset); - + instruction->info.load_store.index_mode = 0; } else /* pre-indexed */ @@ -544,7 +544,7 @@ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, [r%i, %s]!", address, opcode, operation, COND(opcode), suffix, Rd, Rn, offset); - + instruction->info.load_store.index_mode = 1; } } @@ -553,10 +553,10 @@ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, [r%i], %s", address, opcode, operation, COND(opcode), suffix, Rd, Rn, offset); - + instruction->info.load_store.index_mode = 2; } - + return ERROR_OK; } @@ -571,7 +571,7 @@ char *reg_list_p; int i; int first_reg = 1; - + P = (opcode & 0x01000000) >> 24; U = (opcode & 0x00800000) >> 23; S = (opcode & 0x00400000) >> 22; @@ -579,12 +579,12 @@ L = (opcode & 0x00100000) >> 20; register_list = (opcode & 0xffff); Rn = (opcode & 0xf0000) >> 16; - + instruction->info.load_store_multiple.Rn = Rn; instruction->info.load_store_multiple.register_list = register_list; instruction->info.load_store_multiple.S = S; instruction->info.load_store_multiple.W = W; - + if (L) { instruction->type = ARM_LDM; @@ -595,7 +595,7 @@ instruction->type = ARM_STM; mnemonic = "STM"; } - + if (P) { if (U) @@ -622,7 +622,7 @@ addressing_mode = "DA"; } } - + reg_list_p = reg_list; for (i = 0; i <= 15; i++) { @@ -639,11 +639,11 @@ } } } - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i%s, {%s}%s", address, opcode, mnemonic, COND(opcode), addressing_mode, Rn, (W) ? "!" : "", reg_list, (S) ? "^" : ""); - + return ERROR_OK; } @@ -662,7 +662,7 @@ Rn = (opcode & 0xf000) >> 12; Rd = (opcode & 0xf0000) >> 16; S = (opcode & 0x00100000) >> 20; - + /* examine A bit (accumulate) */ if (opcode & 0x00200000) { @@ -676,10 +676,10 @@ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMUL%s%s r%i, r%i, r%i", address, opcode, COND(opcode), (S) ? "S" : "", Rd, Rm, Rs); } - + return ERROR_OK; } - + /* Multiply (accumulate) long */ if ((opcode & 0x0f800000) == 0x00800000) { @@ -690,7 +690,7 @@ RdHi = (opcode & 0xf000) >> 12; RdLow = (opcode & 0xf0000) >> 16; S = (opcode & 0x00100000) >> 20; - + switch ((opcode & 0x00600000) >> 21) { case 0x0: @@ -710,14 +710,14 @@ mnemonic = "SMLAL"; break; } - + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, r%i, r%i, r%i", address, opcode, mnemonic, COND(opcode), (S) ? "S" : "", RdLow, RdHi, Rm, Rs); - + return ERROR_OK; } - + /* Swap/swap byte */ if ((opcode & 0x0f800000) == 0x01000000) { @@ -725,17 +725,17 @@... [truncated message content] |
From: <zw...@ma...> - 2009-06-24 00:49:18
|
Author: zwelch Date: 2009-06-24 00:49:06 +0200 (Wed, 24 Jun 2009) New Revision: 2378 Modified: trunk/src/flash/str7x.c trunk/src/flash/str9xpec.c trunk/src/helper/command.c trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/jtag/core.c trunk/src/jtag/interface.c trunk/src/jtag/tcl.c trunk/src/pld/xilinx_bit.c trunk/src/server/gdb_server.c trunk/src/target/target.c Log: - Replace '){' with ') {'. Modified: trunk/src/flash/str7x.c =================================================================== --- trunk/src/flash/str7x.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/flash/str7x.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -273,7 +273,7 @@ cmd = FLASH_SER | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){ + while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { alive_sleep(1); } @@ -329,7 +329,7 @@ cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); - while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){ + while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) { alive_sleep(1); } Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/flash/str9xpec.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -101,7 +101,7 @@ int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state) { - if (tap == NULL){ + if (tap == NULL) { return ERROR_TARGET_INVALID; } @@ -671,11 +671,11 @@ check_address = sec_end; } - if ((offset >= sec_start) && (offset < sec_end)){ + if ((offset >= sec_start) && (offset < sec_end)) { first_sector = i; } - if ((offset + count >= sec_start) && (offset + count < sec_end)){ + if ((offset + count >= sec_start) && (offset + count < sec_end)) { last_sector = i; } } Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/helper/command.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -348,7 +348,7 @@ void command_output_text(command_context_t *context, const char *data) { - if (context && context->output_handler && data){ + if (context && context->output_handler && data) { context->output_handler(context, data); } } Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/helper/jim.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -544,7 +544,7 @@ #endif /* This may actually crash... we do it last */ - if (interp && interp->cookie_stderr){ + 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); @@ -2064,7 +2064,7 @@ buf = jim_vasprintf(fmt, ap); va_end(ap); - if (buf){ + if (buf) { Jim_AppendString(interp, objPtr, buf, -1); jim_vasprintf_done(buf); } @@ -2283,10 +2283,10 @@ haveprec = 0; prec = -1; /* not found yet */ next_fmt: - if (fmtLen <= 0){ + if (fmtLen <= 0) { break; } - switch (*fmt){ + switch (*fmt) { /* terminals */ case 'b': /* binary - not all printfs() do this */ case 's': /* string */ @@ -2341,11 +2341,11 @@ case '8': case '9': accum = 0; - while (isdigit(*fmt) && (fmtLen > 0)){ + while (isdigit(*fmt) && (fmtLen > 0)) { accum = (accum * 10) + (*fmt - '0'); fmt++; fmtLen--; } - if (inprec){ + if (inprec) { haveprec = 1; prec = accum; } else { @@ -2356,24 +2356,24 @@ /* suck up the next item as an integer */ fmt++; fmtLen--; objc--; - if (objc <= 0){ + if (objc <= 0) { goto not_enough_args; } - if (Jim_GetWide(interp,objv[0],&wideValue)== JIM_ERR){ + if (Jim_GetWide(interp,objv[0],&wideValue)== JIM_ERR) { Jim_FreeNewObj(interp, resObjPtr); return NULL; } - if (inprec){ + if (inprec) { haveprec = 1; prec = wideValue; - if (prec < 0){ + if (prec < 0) { /* man 3 printf says */ /* if prec is negative, it is zero */ prec = 0; } } else { width = wideValue; - if (width < 0){ + if (width < 0) { ljust = 1; width = -width; } @@ -2402,32 +2402,32 @@ */ cp = fmt_str; *cp++ = '%'; - if (altfm){ + if (altfm) { *cp++ = '#'; } - if (forceplus){ + if (forceplus) { *cp++ = '+'; - } else if (spad){ + } else if (spad) { /* PLUS overrides */ *cp++ = ' '; } - if (ljust){ + if (ljust) { *cp++ = '-'; } - if (zpad){ + if (zpad) { *cp++ = '0'; } - if (width > 0){ + if (width > 0) { sprintf(cp, "%d", width); /* skip ahead */ cp = strchr(cp,0); } /* did we find a period? */ - if (inprec){ + if (inprec) { /* then add it */ *cp++ = '.'; /* did something occur after the period? */ - if (haveprec){ + if (haveprec) { sprintf(cp, "%d", prec); } cp = strchr(cp,0); @@ -2461,7 +2461,7 @@ case 'E': *cp++ = *fmt; *cp = 0; - if (Jim_GetDouble(interp, objv[0], &doubleValue) == JIM_ERR){ + if (Jim_GetDouble(interp, objv[0], &doubleValue) == JIM_ERR) { Jim_FreeNewObj(interp, resObjPtr); return NULL; } @@ -2475,7 +2475,7 @@ case 'x': case 'X': /* jim widevaluse are 64bit */ - if (sizeof(jim_wide) == sizeof(long long)){ + if (sizeof(jim_wide) == sizeof(long long)) { *cp++ = 'l'; *cp++ = 'l'; } else { @@ -2627,12 +2627,12 @@ int e; e = Jim_Nvp_name2value_obj(interp, nvp_table, objPtr, &n); - if (e == JIM_ERR){ + if (e == JIM_ERR) { return e; } /* Success? found? */ - if (n->name){ + if (n->name) { /* remove const */ *result = (Jim_Nvp *)n; return JIM_OK; @@ -8894,7 +8894,7 @@ Jim_IncrRefCount(scriptObjPtr); - if (filename){ + if (filename) { JimSetSourceInfo(interp, scriptObjPtr, filename, lineno); } @@ -12412,7 +12412,7 @@ int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap) { - if ((interp == NULL) || (interp->cb_vfprintf == NULL)){ + if ((interp == NULL) || (interp->cb_vfprintf == NULL)) { errno = ENOTSUP; return -1; } @@ -12421,7 +12421,7 @@ size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie) { - if ((interp == NULL) || (interp->cb_fwrite == NULL)){ + if ((interp == NULL) || (interp->cb_fwrite == NULL)) { errno = ENOTSUP; return 0; } @@ -12430,7 +12430,7 @@ size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie) { - if ((interp == NULL) || (interp->cb_fread == NULL)){ + if ((interp == NULL) || (interp->cb_fread == NULL)) { errno = ENOTSUP; return 0; } @@ -12439,7 +12439,7 @@ int Jim_fflush(Jim_Interp *interp, void *cookie) { - if ((interp == NULL) || (interp->cb_fflush == NULL)){ + if ((interp == NULL) || (interp->cb_fflush == NULL)) { /* pretend all is well */ return 0; } @@ -12448,7 +12448,7 @@ char* Jim_fgets(Jim_Interp *interp, char *s, int size, void *cookie) { - if ((interp == NULL) || (interp->cb_fgets == NULL)){ + if ((interp == NULL) || (interp->cb_fgets == NULL)) { errno = ENOTSUP; return NULL; } @@ -12457,8 +12457,8 @@ Jim_Nvp * Jim_Nvp_name2value_simple(const Jim_Nvp *p, const char *name) { - while (p->name){ - if (0 == strcmp(name, p->name)){ + while (p->name) { + if (0 == strcmp(name, p->name)) { break; } p++; @@ -12469,8 +12469,8 @@ Jim_Nvp * Jim_Nvp_name2value_nocase_simple(const Jim_Nvp *p, const char *name) { - while (p->name){ - if (0 == strcasecmp(name, p->name)){ + while (p->name) { + if (0 == strcasecmp(name, p->name)) { break; } p++; @@ -12499,12 +12499,12 @@ p = Jim_Nvp_name2value_simple(_p, name); /* result */ - if (result){ + if (result) { *result = (Jim_Nvp *)(p); } /* found? */ - if (p->name){ + if (p->name) { return JIM_OK; } else { return JIM_ERR; @@ -12524,11 +12524,11 @@ p = Jim_Nvp_name2value_nocase_simple(_p, name); - if (puthere){ + if (puthere) { *puthere = (Jim_Nvp *)(p); } /* found */ - if (p->name){ + if (p->name) { return JIM_OK; } else { return JIM_ERR; @@ -12543,7 +12543,7 @@ jim_wide w; e = Jim_GetWide(interp, o, &w); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } @@ -12553,8 +12553,8 @@ Jim_Nvp * Jim_Nvp_value2name_simple(const Jim_Nvp *p, int value) { - while (p->name){ - if (value == p->value){ + while (p->name) { + if (value == p->value) { break; } p++; @@ -12570,11 +12570,11 @@ p = Jim_Nvp_value2name_simple(_p, value); - if (result){ + if (result) { *result = (Jim_Nvp *)(p); } - if (p->name){ + if (p->name) { return JIM_OK; } else { return JIM_ERR; @@ -12599,7 +12599,7 @@ int x; Jim_fprintf(p->interp, p->interp->cookie_stderr, "---args---\n"); - for (x = 0 ; x < p->argc ; x++){ + for (x = 0 ; x < p->argc ; x++) { Jim_fprintf(p->interp, p->interp->cookie_stderr, "%2d) %s\n", x, @@ -12615,16 +12615,16 @@ Jim_Obj *o; o = NULL; // failure - if (goi->argc){ + if (goi->argc) { // success o = goi->argv[0]; goi->argc -= 1; goi->argv += 1; } - if (puthere){ + if (puthere) { *puthere = o; } - if (o != NULL){ + if (o != NULL) { return JIM_OK; } else { return JIM_ERR; @@ -12640,9 +12640,9 @@ r = Jim_GetOpt_Obj(goi, &o); - if (r == JIM_OK){ + if (r == JIM_OK) { cp = Jim_GetString(o, len); - if (puthere){ + if (puthere) { /* remove const */ *puthere = (char *)(cp); } @@ -12657,14 +12657,14 @@ Jim_Obj *o; double _safe; - if (puthere == NULL){ + if (puthere == NULL) { puthere = &_safe; } r = Jim_GetOpt_Obj(goi, &o); - if (r == JIM_OK){ + if (r == JIM_OK) { r = Jim_GetDouble(goi->interp, o, puthere); - if (r != JIM_OK){ + if (r != JIM_OK) { Jim_SetResult_sprintf(goi->interp, "not a number: %s", Jim_GetString(o, NULL)); @@ -12680,12 +12680,12 @@ Jim_Obj *o; jim_wide _safe; - if (puthere == NULL){ + if (puthere == NULL) { puthere = &_safe; } r = Jim_GetOpt_Obj(goi, &o); - if (r == JIM_OK){ + if (r == JIM_OK) { r = Jim_GetWide(goi->interp, o, puthere); } return r; @@ -12699,12 +12699,12 @@ Jim_Obj *o; int e; - if (puthere == NULL){ + if (puthere == NULL) { puthere = &_safe; } e = Jim_GetOpt_Obj(goi, &o); - if (e == JIM_OK){ + if (e == JIM_OK) { e = Jim_Nvp_name2value_obj(goi->interp, nvp, o, @@ -12719,7 +12719,7 @@ const Jim_Nvp *nvptable, int hadprefix) { - if (hadprefix){ + if (hadprefix) { Jim_SetResult_NvpUnknown(goi->interp, goi->argv[-2], goi->argv[-1], @@ -12742,11 +12742,11 @@ Jim_Obj *o; int e; - if (puthere == NULL){ + if (puthere == NULL) { puthere = &_safe; } e = Jim_GetOpt_Obj(goi, &o); - if (e == JIM_OK){ + if (e == JIM_OK) { e = Jim_GetEnum(goi->interp, o, lookup, @@ -12768,7 +12768,7 @@ va_start(ap,fmt); buf = jim_vasprintf(fmt, ap); va_end(ap); - if (buf){ + if (buf) { Jim_SetResultString(interp, buf, -1); jim_vasprintf_done(buf); } @@ -12782,7 +12782,7 @@ Jim_Obj *param_value, const Jim_Nvp *nvp) { - if (param_name){ + if (param_name) { Jim_SetResult_sprintf(interp, "%s: Unknown: %s, try one of: ", Jim_GetString(param_name, NULL), @@ -12792,11 +12792,11 @@ "Unknown param: %s, try one of: ", Jim_GetString(param_value, NULL)); } - while (nvp->name){ + while (nvp->name) { const char *a; const char *b; - if ((nvp + 1)->name){ + if ((nvp + 1)->name) { a = nvp->name; b = ", "; } else { @@ -12818,12 +12818,12 @@ { int x; - if (debug_string_obj){ + if (debug_string_obj) { Jim_FreeObj(interp, debug_string_obj); } debug_string_obj = Jim_NewEmptyStringObj(interp); - for (x = 0 ; x < argc ; x++){ + for (x = 0 ; x < argc ; x++) { Jim_AppendStrings(interp, debug_string_obj, Jim_GetString(argv[x], NULL), Modified: trunk/src/helper/jim.h =================================================================== --- trunk/src/helper/jim.h 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/helper/jim.h 2009-06-23 22:49:06 UTC (rev 2378) @@ -985,19 +985,19 @@ * * Jim_GetOpt_Setup(&goi, interp, argc, argv); * - * while (goi.argc){ + * while (goi.argc) { * e = Jim_GetOpt_Nvp(&goi, nvp_options, &n); - * if (e != JIM_OK){ + * if (e != JIM_OK) { * Jim_GetOpt_NvpUnknown(&goi, nvp_options, 0); * return e; * } * - * switch (n->value){ + * switch (n->value) { * case ALIVE: * printf("Option ALIVE specified\n"); * break; * case FIRST: - * if (goi.argc < 1){ + * if (goi.argc < 1) { * .. not enough args error .. * } * Jim_GetOpt_String(&goi, &cp, NULL); @@ -1008,7 +1008,7 @@ * break; * case POLITICS: * e = Jim_GetOpt_Nvp(&goi, nvp_politics, &n); - * if (e != JIM_OK){ + * if (e != JIM_OK) { * Jim_GetOpt_NvpUnknown(&goi, nvp_politics, 1); * return e; * } @@ -1102,21 +1102,21 @@ * Example: * \code * - * while (goi.argc){ + * while (goi.argc) { * // Get the next option * e = Jim_GetOpt_Nvp(&goi, cmd_options, &n); - * if (e != JIM_OK){ + * if (e != JIM_OK) { * // option was not recognized * // pass 'hadprefix = 0' because there is no prefix * Jim_GetOpt_NvpUnknown(&goi, cmd_options, 0); * return e; * } * - * switch (n->value){ + * switch (n->value) { * case OPT_SEX: * // handle: --sex male | female | lots | needmore * e = Jim_GetOpt_Nvp(&goi, &nvp_sex, &n); - * if (e != JIM_OK){ + * if (e != JIM_OK) { * Jim_GetOpt_NvpUnknown(&ogi, nvp_sex, 1); * return e; * } Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/jtag/core.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -704,7 +704,7 @@ else compare_failed = buf_cmp(captured, in_check_value, num_bits); - if (compare_failed){ + if (compare_failed) { /* An error handler could have caught the failing check * only report a problem when there wasn't a handler, or if the handler * acknowledged the error @@ -1024,9 +1024,9 @@ tap = NULL; total_ir_length = 0; - for (;;){ + for (;;) { tap = jtag_tap_next_enabled(tap); - if (tap == NULL){ + if (tap == NULL) { break; } total_ir_length += tap->ir_length; @@ -1048,9 +1048,9 @@ tap = NULL; chain_pos = 0; int val; - for (;;){ + for (;;) { tap = jtag_tap_next_enabled(tap); - if (tap == NULL){ + if (tap == NULL) { break; } @@ -1151,7 +1151,7 @@ LOG_DEBUG("Init JTAG chain"); tap = jtag_tap_next_enabled(NULL); - if (tap == NULL){ + if (tap == NULL) { LOG_ERROR("There are no enabled taps?"); return ERROR_JTAG_INIT_FAILED; } Modified: trunk/src/jtag/interface.c =================================================================== --- trunk/src/jtag/interface.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/jtag/interface.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -359,9 +359,9 @@ { tap_state_t x; - for (x = 0 ; x < TAP_NUM_STATES ; x++){ + for (x = 0 ; x < TAP_NUM_STATES ; x++) { /* be nice to the human */ - if (0 == strcasecmp(name, tap_state_name(x))){ + if (0 == strcasecmp(name, tap_state_name(x))) { return x; } } Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/jtag/tcl.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -340,7 +340,7 @@ /* * we expect CHIP + TAP + OPTIONS * */ - if (goi->argc < 3){ + if (goi->argc < 3) { Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ...."); return JIM_ERR; } @@ -367,14 +367,14 @@ /* clear them as we find them */ reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK); - while (goi->argc){ + while (goi->argc) { e = Jim_GetOpt_Nvp(goi, opts, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(goi, opts, 0); return e; } LOG_DEBUG("Processing option: %s", n->name); - switch (n->value){ + switch (n->value) { case NTAP_OPT_ENABLED: pTap->disabled_after_reset = false; break; @@ -410,11 +410,11 @@ case NTAP_OPT_IRMASK: case NTAP_OPT_IRCAPTURE: e = Jim_GetOpt_Wide(goi, &w); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name); return e; } - switch (n->value){ + switch (n->value) { case NTAP_OPT_IRLEN: if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value))) LOG_WARNING("huge IR length %d", (int) w); @@ -535,29 +535,29 @@ Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); e = Jim_GetOpt_Nvp(&goi, jtag_cmds, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(&goi, jtag_cmds, 0); return e; } Jim_SetEmptyResult(goi.interp); - switch (n->value){ + switch (n->value) { case JTAG_CMD_INTERFACE: /* return the name of the interface */ /* TCL code might need to know the exact type... */ /* FUTURE: we allow this as a means to "set" the interface. */ - if (goi.argc != 0){ + if (goi.argc != 0) { Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); return JIM_ERR; } Jim_SetResultString(goi.interp, jtag_interface->name, -1); return JIM_OK; case JTAG_CMD_INIT_RESET: - if (goi.argc != 0){ + if (goi.argc != 0) { Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); return JIM_ERR; } e = jtag_init_reset(context); - if (e != ERROR_OK){ + if (e != ERROR_OK) { Jim_SetResult_sprintf(goi.interp, "error: %d", e); return JIM_ERR; } @@ -568,7 +568,7 @@ case JTAG_CMD_TAPISENABLED: case JTAG_CMD_TAPENABLE: case JTAG_CMD_TAPDISABLE: - if (goi.argc != 1){ + if (goi.argc != 1) { Jim_SetResultString(goi.interp, "Too many parameters",-1); return JIM_ERR; } @@ -619,7 +619,7 @@ break; case JTAG_CMD_CGET: - if (goi.argc < 2){ + if (goi.argc < 2) { Jim_WrongNumArgs(goi.interp, 0, NULL, "?tap-name? -option ..."); return JIM_ERR; } @@ -629,7 +629,7 @@ Jim_GetOpt_Obj(&goi, &o); t = jtag_tap_by_jim_obj(goi.interp, o); - if (t == NULL){ + if (t == NULL) { return JIM_ERR; } @@ -639,7 +639,7 @@ break; case JTAG_CMD_CONFIGURE: - if (goi.argc < 3){ + if (goi.argc < 3) { Jim_WrongNumArgs(goi.interp, 0, NULL, "?tap-name? -option ?VALUE? ..."); return JIM_ERR; } @@ -649,7 +649,7 @@ Jim_GetOpt_Obj(&goi, &o); t = jtag_tap_by_jim_obj(goi.interp, o); - if (t == NULL){ + if (t == NULL) { return JIM_ERR; } @@ -806,7 +806,7 @@ * argv[ 3] = not actually used by anything but in the docs */ - if (argc < 4){ + if (argc < 4) { command_print(cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax"); return ERROR_OK; } @@ -847,7 +847,7 @@ Jim_GetString(newargs[9], NULL)); e = jim_jtag_command(interp, 10, newargs); - if (e != JIM_OK){ + if (e != JIM_OK) { command_print(cmd_ctx, "%s", Jim_GetString(Jim_GetResult(interp), NULL)); } return e; @@ -861,7 +861,7 @@ command_print(cmd_ctx, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr "); command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------"); - while (tap){ + while (tap) { uint32_t expected, expected_mask, cur_instr, ii; expected = buf_get_u32(tap->expected, 0, tap->ir_length); expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length); @@ -1174,20 +1174,20 @@ */ endstate = TAP_IDLE; - if (argc >= 4){ + if (argc >= 4) { /* have at least one pair of numbers. */ /* is last pair the magic text? */ - if (0 == strcmp("-endstate", args[ argc - 2 ])){ + if (0 == strcmp("-endstate", args[ argc - 2 ])) { const char *cpA; const char *cpS; cpA = args[ argc-1 ]; - for (endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++){ + for (endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++) { cpS = tap_state_name(endstate); - if (0 == strcmp(cpA, cpS)){ + if (0 == strcmp(cpA, cpS)) { break; } } - if (endstate >= TAP_NUM_STATES){ + if (endstate >= TAP_NUM_STATES) { return ERROR_COMMAND_SYNTAX_ERROR; } else { if (!scan_is_safe(endstate)) @@ -1281,12 +1281,12 @@ e = Jim_GetLong(interp, args[i], &bits); /* If valid - try next arg */ - if (e == JIM_OK){ + if (e == JIM_OK) { continue; } /* Not valid.. are we at the end? */ - if (((i + 2) != argc)){ + if (((i + 2) != argc)) { /* nope, then error */ return e; } @@ -1299,13 +1299,13 @@ /* get arg as a string. */ cp = Jim_GetString(args[i], NULL); /* is it the magic? */ - if (0 == strcmp("-endstate", cp)){ + if (0 == strcmp("-endstate", cp)) { /* is the statename valid? */ cp = Jim_GetString(args[i + 1], NULL); /* see if it is a valid state name */ endstate = tap_state_by_name(cp); - if (endstate < 0){ + if (endstate < 0) { /* update the error message */ Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp); } else { @@ -1321,13 +1321,13 @@ } /* Still an error? */ - if (e != JIM_OK){ + if (e != JIM_OK) { return e; /* too bad */ } } /* validate args */ tap = jtag_tap_by_jim_obj(interp, args[1]); - if (tap == NULL){ + if (tap == NULL) { return JIM_ERR; } Modified: trunk/src/pld/xilinx_bit.c =================================================================== --- trunk/src/pld/xilinx_bit.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/pld/xilinx_bit.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -96,7 +96,7 @@ return ERROR_PLD_FILE_LOAD_FAILED; } - if (input_stat.st_size == 0){ + if (input_stat.st_size == 0) { LOG_ERROR("Empty file %s", filename); return ERROR_PLD_FILE_LOAD_FAILED; } Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/server/gdb_server.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -319,7 +319,7 @@ break; if ((retval = gdb_get_char(connection, &reply)) != ERROR_OK) return retval; - if (reply == '$'){ + if (reply == '$') { /* fix a problem with some IAR tools */ gdb_putback_char(connection, reply); LOG_DEBUG("Unexpected start of new packet"); @@ -402,7 +402,7 @@ log_remove_callback(gdb_log_callback, connection); LOG_WARNING("negative reply, retrying"); } - else if (reply == '$'){ + else if (reply == '$') { LOG_ERROR("GDB missing ack(1) - assumed good"); gdb_putback_char(connection, reply); return ERROR_OK; @@ -413,7 +413,7 @@ return ERROR_SERVER_REMOTE_CLOSED; } } - else if (reply == '$'){ + else if (reply == '$') { LOG_ERROR("GDB missing ack(2) - assumed good"); gdb_putback_char(connection, reply); return ERROR_OK; @@ -2036,12 +2036,12 @@ /* terminate with zero */ packet[packet_size] = 0; - if (LOG_LEVEL_IS(LOG_LVL_DEBUG)){ - if (packet[0] == 'X'){ + if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) { + if (packet[0] == 'X') { // binary packets spew junk into the debug log stream char buf[ 50 ]; int x; - for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++){ + for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++) { buf[x] = packet[x]; } buf[x] = 0; Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:47:42 UTC (rev 2377) +++ trunk/src/target/target.c 2009-06-23 22:49:06 UTC (rev 2378) @@ -144,7 +144,7 @@ const Jim_Nvp *n; n = Jim_Nvp_value2name_simple(nvp_error_target, err); - if (n->name == NULL){ + if (n->name == NULL) { return "unknown"; } else { return n->name; @@ -244,8 +244,8 @@ x = -1; t = all_targets; - while (t){ - if (x < t->target_number){ + while (t) { + if (x < t->target_number) { x = (t->target_number) + 1; } t = t->next; @@ -262,8 +262,8 @@ /* number is 0 based */ x = -1; t = all_targets; - while (t){ - if (x < t->target_number){ + while (t) { + if (x < t->target_number) { x = t->target_number; } t = t->next; @@ -352,8 +352,8 @@ { target_t *target = all_targets; - while (target){ - if (target->target_number == num){ + while (target) { + if (target->target_number == num) { return target; } target = target->next; @@ -429,7 +429,7 @@ int retval; Jim_Nvp *n; n = Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode); - if (n->name == NULL){ + if (n->name == NULL) { LOG_ERROR("invalid reset mode"); return ERROR_FAIL; } @@ -1983,7 +1983,7 @@ { const Jim_Nvp *n; n = Jim_Nvp_name2value_simple(nvp_reset_modes, args[0]); - if ((n->name == NULL) || (n->value == RESET_UNKNOWN)){ + if ((n->name == NULL) || (n->value == RESET_UNKNOWN)) { return ERROR_COMMAND_SYNTAX_ERROR; } reset_mode = n->value; @@ -3205,12 +3205,12 @@ target_t *target; context = Jim_GetAssocData(interp, "context"); - if (context == NULL){ + if (context == NULL) { LOG_ERROR("array2mem: no command context"); return JIM_ERR; } target = get_current_target(context); - if (target == NULL){ + if (target == NULL) { LOG_ERROR("array2mem: no current target"); return JIM_ERR; } @@ -3364,7 +3364,7 @@ Jim_Nvp_value2name_simple(nvp_target_event, e)->name); target = all_targets; - while (target){ + while (target) { target_handle_event(target, e); target = target->next; } @@ -3378,8 +3378,8 @@ teap = target->event_action; done = 0; - while (teap){ - if (teap->event == e){ + while (teap) { + if (teap->event == e) { done = 1; LOG_DEBUG("target: (%d) %s (%s) event: %d (%s) action: %s\n", target->target_number, @@ -3395,7 +3395,7 @@ } teap = teap->next; } - if (!done){ + if (!done) { LOG_DEBUG("event: %d %s - no action", e, Jim_Nvp_value2name_simple(nvp_target_event, e)->name); @@ -3437,38 +3437,38 @@ int e; /* parse config or cget options ... */ - while (goi->argc > 0){ + while (goi->argc > 0) { Jim_SetEmptyResult(goi->interp); /* Jim_GetOpt_Debug(goi); */ - if (target->type->target_jim_configure){ + if (target->type->target_jim_configure) { /* target defines a configure function */ /* target gets first dibs on parameters */ e = (*(target->type->target_jim_configure))(target, goi); - if (e == JIM_OK){ + if (e == JIM_OK) { /* more? */ continue; } - if (e == JIM_ERR){ + if (e == JIM_ERR) { /* An error */ return e; } /* otherwise we 'continue' below */ } e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0); return e; } - switch (n->value){ + switch (n->value) { case TCFG_TYPE: /* not setable */ - if (goi->isconfigure){ + if (goi->isconfigure) { Jim_SetResult_sprintf(goi->interp, "not setable: %s", n->name); return JIM_ERR; } else { no_params: - if (goi->argc != 0){ + if (goi->argc != 0) { Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO PARAMS"); return JIM_ERR; } @@ -3477,24 +3477,24 @@ /* loop for more */ break; case TCFG_EVENT: - if (goi->argc == 0){ + if (goi->argc == 0) { Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ..."); return JIM_ERR; } e = Jim_GetOpt_Nvp(goi, nvp_target_event, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(goi, nvp_target_event, 1); return e; } - if (goi->isconfigure){ - if (goi->argc != 1){ + if (goi->isconfigure) { + if (goi->argc != 1) { Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?"); return JIM_ERR; } } else { - if (goi->argc != 0){ + if (goi->argc != 0) { Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name?"); return JIM_ERR; } @@ -3505,21 +3505,21 @@ teap = target->event_action; /* replace existing? */ - while (teap){ - if (teap->event == (enum target_event)n->value){ + while (teap) { + if (teap->event == (enum target_event)n->value) { break; } teap = teap->next; } - if (goi->isconfigure){ - if (teap == NULL){ + if (goi->isconfigure) { + if (teap == NULL) { /* create new */ teap = calloc(1, sizeof(*teap)); } teap->event = n->value; Jim_GetOpt_Obj(goi, &o); - if (teap->body){ + if (teap->body) { Jim_DecrRefCount(interp, teap->body); } teap->body = Jim_DuplicateObj(goi->interp, o); @@ -3541,7 +3541,7 @@ Jim_SetEmptyResult(goi->interp); } else { /* get */ - if (teap == NULL){ + if (teap == NULL) { Jim_SetEmptyResult(goi->interp); } else { Jim_SetResult(goi->interp, Jim_DuplicateObj(goi->interp, teap->body)); @@ -3552,15 +3552,15 @@ break; case TCFG_WORK_AREA_VIRT: - if (goi->isconfigure){ + if (goi->isconfigure) { target_free_all_working_areas(target); e = Jim_GetOpt_Wide(goi, &w); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } target->working_area_virt = w; } else { - if (goi->argc != 0){ + if (goi->argc != 0) { goto no_params; } } @@ -3569,15 +3569,15 @@ break; case TCFG_WORK_AREA_PHYS: - if (goi->isconfigure){ + if (goi->isconfigure) { target_free_all_working_areas(target); e = Jim_GetOpt_Wide(goi, &w); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } target->working_area_phys = w; } else { - if (goi->argc != 0){ + if (goi->argc != 0) { goto no_params; } } @@ -3586,15 +3586,15 @@ break; case TCFG_WORK_AREA_SIZE: - if (goi->isconfigure){ + if (goi->isconfigure) { target_free_all_working_areas(target); e = Jim_GetOpt_Wide(goi, &w); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } target->working_area_size = w; } else { - if (goi->argc != 0){ + if (goi->argc != 0) { goto no_params; } } @@ -3603,16 +3603,16 @@ break; case TCFG_WORK_AREA_BACKUP: - if (goi->isconfigure){ + if (goi->isconfigure) { target_free_all_working_areas(target); e = Jim_GetOpt_Wide(goi, &w); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } /* make this exactly 1 or 0 */ target->backup_working_area = (!!w); } else { - if (goi->argc != 0){ + if (goi->argc != 0) { goto no_params; } } @@ -3621,20 +3621,20 @@ break; case TCFG_ENDIAN: - if (goi->isconfigure){ + if (goi->isconfigure) { e = Jim_GetOpt_Nvp(goi, nvp_target_endian, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(goi, nvp_target_endian, 1); return e; } target->endianness = n->value; } else { - if (goi->argc != 0){ + if (goi->argc != 0) { goto no_params; } } n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness); - if (n->name == NULL){ + if (n->name == NULL) { target->endianness = TARGET_LITTLE_ENDIAN; n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness); } @@ -3643,20 +3643,20 @@ break; case TCFG_VARIANT: - if (goi->isconfigure){ - if (goi->argc < 1){ + if (goi->isconfigure) { + if (goi->argc < 1) { Jim_SetResult_sprintf(goi->interp, "%s ?STRING?", n->name); return JIM_ERR; } - if (target->variant){ + if (target->variant) { free((void *)(target->variant)); } e = Jim_GetOpt_String(goi, &cp, NULL); target->variant = strdup(cp); } else { - if (goi->argc != 0){ + if (goi->argc != 0) { goto no_params; } } @@ -3664,22 +3664,22 @@ /* loop for more */ break; case TCFG_CHAIN_POSITION: - if (goi->isconfigure){ + if (goi->isconfigure) { Jim_Obj *o; jtag_tap_t *tap; target_free_all_working_areas(target); e = Jim_GetOpt_Obj(goi, &o); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } tap = jtag_tap_by_jim_obj(goi->interp, o); - if (tap == NULL){ + if (tap == NULL) { return JIM_ERR; } /* make this exactly 1 or 0 */ target->tap = tap; } else { - if (goi->argc != 0){ + if (goi->argc != 0) { goto no_params; } } @@ -3756,16 +3756,16 @@ /* commands here are in an NVP table */ e = Jim_GetOpt_Nvp(&goi, target_options, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(&goi, target_options, 0); return e; } /* Assume blank result */ Jim_SetEmptyResult(goi.interp); - switch (n->value){ + switch (n->value) { case TS_CMD_CONFIGURE: - if (goi.argc < 2){ + if (goi.argc < 2) { Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, "missing: -option VALUE ..."); return JIM_ERR; } @@ -3773,7 +3773,7 @@ return target_configure(&goi, target); case TS_CMD_CGET: // some things take params - if (goi.argc < 1){ + if (goi.argc < 1) { Jim_WrongNumArgs(goi.interp, 0, goi.argv, "missing: ?-option?"); return JIM_ERR; } @@ -3789,7 +3789,7 @@ * argv[3] = optional count. */ - if ((goi.argc == 2) || (goi.argc == 3)){ + if ((goi.argc == 2) || (goi.argc == 3)) { /* all is well */ } else { mwx_error: @@ -3798,24 +3798,24 @@ } e = Jim_GetOpt_Wide(&goi, &a); - if (e != JIM_OK){ + if (e != JIM_OK) { goto mwx_error; } e = Jim_GetOpt_Wide(&goi, &b); - if (e != JIM_OK){ + if (e != JIM_OK) { goto mwx_error; } if (goi.argc == 3) { e = Jim_GetOpt_Wide(&goi, &c); - if (e != JIM_OK){ + if (e != JIM_OK) { goto mwx_error; } } else { c = 1; } - switch (n->value){ + switch (n->value) { case TS_CMD_MWW: target_buffer_set_u32(target, target_buf, b); b = 4; @@ -3829,9 +3829,9 @@ b = 1; break; } - for (x = 0 ; x < c ; x++){ + for (x = 0 ; x < c ; x++) { e = target_write_memory(target, a, b, 1, target_buf); - if (e != ERROR_OK){ + if (e != ERROR_OK) { Jim_SetResult_sprintf(interp, "Error writing @ 0x%08x: %d\n", (int)(a), e); return JIM_ERR; } @@ -3849,24 +3849,24 @@ * argv[1] = address * argv[2] = optional count */ - if ((goi.argc == 2) || (goi.argc == 3)){ + if ((goi.argc == 2) || (goi.argc == 3)) { Jim_SetResult_sprintf(goi.interp, "expected: %s ADDR [COUNT]", n->name); return JIM_ERR; } e = Jim_GetOpt_Wide(&goi, &a); - if (e != JIM_OK){ + if (e != JIM_OK) { return JIM_ERR; } - if (goi.argc){ + if (goi.argc) { e = Jim_GetOpt_Wide(&goi, &c); - if (e != JIM_OK){ + if (e != JIM_OK) { return JIM_ERR; } } else { c = 1; } b = 1; /* shut up gcc */ - switch (n->value){ + switch (n->value) { case TS_CMD_MDW: b = 4; break; @@ -3881,52 +3881,52 @@ /* convert to "bytes" */ c = c * b; /* count is now in 'BYTES' */ - while (c > 0){ + while (c > 0) { y = c; - if (y > 16){ + if (y > 16) { y = 16; } e = target_read_memory(target, a, b, y / b, target_buf); - if (e != ERROR_OK){ + if (e != ERROR_OK) { Jim_SetResult_sprintf(interp, "error reading target @ 0x%08lx", (int)(a)); return JIM_ERR; } Jim_fprintf(interp, interp->cookie_stdout, "0x%08x ", (int)(a)); - switch (b){ + switch (b) { case 4: - for (x = 0 ; (x < 16) && (x < y) ; x += 4){ + for (x = 0 ; (x < 16) && (x < y) ; x += 4) { z = target_buffer_get_u32(target, &(target_buf[ x * 4 ])); Jim_fprintf(interp, interp->cookie_stdout, "%08x ", (int)(z)); } - for (; (x < 16) ; x += 4){ + for (; (x < 16) ; x += 4) { Jim_fprintf(interp, interp->cookie_stdout, " "); } break; case 2: - for (x = 0 ; (x < 16) && (x < y) ; x += 2){ + for (x = 0 ; (x < 16) && (x < y) ; x += 2) { z = target_buffer_get_u16(target, &(target_buf[ x * 2 ])); Jim_fprintf(interp, interp->cookie_stdout, "%04x ", (int)(z)); } - for (; (x < 16) ; x += 2){ + for (; (x < 16) ; x += 2) { Jim_fprintf(interp, interp->cookie_stdout, " "); } break; case 1: default: - for (x = 0 ; (x < 16) && (x < y) ; x += 1){ + for (x = 0 ; (x < 16) && (x < y) ; x += 1) { z = target_buffer_get_u8(target, &(target_buf[ x * 4 ])); Jim_fprintf(interp, interp->cookie_stdout, "%02x ", (int)(z)); } - for (; (x < 16) ; x += 1){ + for (; (x < 16) ; x += 1) { Jim_fprintf(interp, interp->cookie_stdout, " "); } break; } /* ascii-ify the bytes */ - for (x = 0 ; x < y ; x++){ + for (x = 0 ; x < y ; x++) { if ((target_buf[x] >= 0x20) && - (target_buf[x] <= 0x7e)){ + (target_buf[x] <= 0x7e)) { /* good */ } else { /* smack it */ @@ -3934,7 +3934,7 @@ } } /* space pad */ - while (x < 16){ + while (x < 16) { target_buf[x] = ' '; x++; } @@ -3954,31 +3954,31 @@ return target_array2mem(goi.interp, target, goi.argc, goi.argv); break; case TS_CMD_EXAMINE: - if (goi.argc){ + if (goi.argc) { Jim_WrongNumArgs(goi.interp, 2, argv, "[no parameters]"); return JIM_ERR; } if (!target->tap->enabled) goto err_tap_disabled; e = target->type->examine(target); - if (e != ERROR_OK){ + if (e != ERROR_OK) { Jim_SetResult_sprintf(interp, "examine-fails: %d", e); return JIM_ERR; } return JIM_OK; case TS_CMD_POLL: - if (goi.argc){ + if (goi.argc) { Jim_WrongNumArgs(goi.interp, 2, argv, "[no parameters]"); return JIM_ERR; } if (!target->tap->enabled) goto err_tap_disabled; - if (!(target_was_examined(target))){ + if (!(target_was_examined(target))) { e = ERROR_TARGET_NOT_EXAMINED; } else { e = target->type->poll(target); } - if (e != ERROR_OK){ + if (e != ERROR_OK) { Jim_SetResult_sprintf(interp, "poll-fails: %d", e); return JIM_ERR; } else { @@ -3986,18 +3986,18 @@ } break; case TS_CMD_RESET: - if (goi.argc != 2){ + if (goi.argc != 2) { Jim_WrongNumArgs(interp, 2, argv, "t | f|assert | deassert BOOL"); return JIM_ERR; } e = Jim_GetOpt_Nvp(&goi, nvp_assert, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(&goi, nvp_assert, 1); return e; } /* the halt or not param */ e = Jim_GetOpt_Wide(&goi, &a); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } if (!target->tap->enabled) @@ -4008,14 +4008,14 @@ target_free_all_working_areas_restore(target, 0); /* do the assert */ - if (n->value == NVP_ASSERT){ + if (n->value == NVP_ASSERT) { target->type->assert_reset(target); } else { target->type->deassert_reset(target); } return JIM_OK; case TS_CMD_HALT: - if (goi.argc){ + if (goi.argc) { Jim_WrongNumArgs(goi.interp, 0, argv, "halt [no parameters]"); return JIM_ERR; } @@ -4025,23 +4025,23 @@ return JIM_OK; case TS_CMD_WAITSTATE: /* params: <name> statename timeoutmsecs */ - if (goi.argc != 2){ + if (goi.argc != 2) { Jim_SetResult_sprintf(goi.interp, "%s STATENAME TIMEOUTMSECS", n->name); return JIM_ERR; } e = Jim_GetOpt_Nvp(&goi, nvp_target_state, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(&goi, nvp_target_state,1); return e; } e = Jim_GetOpt_Wide(&goi, &a); - if (e != JIM_OK){ + if (e != JIM_OK) { return e; } if (!target->tap->enabled) goto err_tap_disabled; e = target_wait_state(target, n->value, a); - if (e != ERROR_OK){ + if (e != ERROR_OK) { Jim_SetResult_sprintf(goi.interp, "target: %s wait %s fails (%d) %s", target->cmd_name, @@ -4063,7 +4063,7 @@ target->cmd_name); command_print(cmd_ctx, "%-25s | Body", "Event"); command_print(cmd_ctx, "------------------------- | ----------------------------------------"); - while (teap){ + while (teap) { command_print(cmd_ctx, "%-25s | %s", Jim_Nvp_value2name_simple(nvp_target_event, teap->event)->name, @@ -4074,7 +4074,7 @@ return JIM_OK; } case TS_CMD_CURSTATE: - if (goi.argc != 0){ + if (goi.argc != 0) { Jim_WrongNumArgs(goi.interp, 0, argv, "[no parameters]"); return JIM_ERR; } @@ -4082,12 +4082,12 @@ Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name,-1); return JIM_OK; case TS_CMD_INVOKE_EVENT: - if (goi.argc != 1){ + if (goi.argc != 1) { Jim_SetResult_sprintf(goi.interp, "%s ?EVENTNAME?",n->name); return JIM_ERR; } e = Jim_GetOpt_Nvp(&goi, nvp_target_event, &n); - if (e != JIM_OK){ + if (e != JIM_OK) { Jim_GetOpt_NvpUnknown(&goi, nvp_target_event, 1); return e; } @@ -4113,7 +4113,7 @@ struct command_context_s *cmd_ctx; cmd_ctx = Jim_GetAssocData(goi->interp, "context"); - if (goi->argc < 3){ + if (goi->argc < 3) { Jim_WrongNumArgs(goi->interp, 1, goi->argv, "?name? ?type? ..options..."); return JIM_ERR; } @@ -4122,7 +4122,7 @@ Jim_GetOpt_Obj(goi, &new_cmd); /* does this command exist? */ cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG); - if (cmd){ + if (cmd) { cp = Jim_GetString(new_cmd, NULL); Jim_SetResult_sprintf(goi->interp, "Command/target: %s Exists", cp); return JIM_ERR; @@ -4132,16 +4132,16 @@ e = Jim_GetOpt_String(goi, &cp2, NULL); cp = cp2; /* now does target type exist */ - for (x = 0 ; target_types[x] ; x++){ - if (0 == strcmp(cp, target_types[x]->name)){ + for (x = 0 ; target_types[x] ; x++) { + if (0 == strcmp(cp, target_types[x]->name)) { /* found */ break; } } - if (target_types[x] == NULL){ + if (target_types[x] == NULL) { Jim_SetResult_sprintf(goi->interp, "Unknown target type %s, try one of ", cp); - for (x = 0 ; target_types[x] ; x++){ - if (target_types[x + 1]){ + for (x = 0 ; target_types[x] ; x++) { + if (target_types[x + 1]) { Jim_AppendStrings(goi->interp, Jim_GetResult(goi->interp), target_types[x]->name, @@ -4209,13 +4209,13 @@ e = JIM_ERR; } - if (e != JIM_OK){ + if (e != JIM_OK) { free(target->type); free(target); return e; } - if (target->endianness == TARGET_ENDIAN_UNKNOWN){ + if (target->endianness == TARGET_ENDIAN_UNKNOWN) { /* default endian to little if not specified */ target->endianness = TARGET_LITTLE_ENDIAN; } @@ -4225,10 +4225,10 @@ target->variant = strdup(""); /* create the target specific commands */ - if (target->type->register_commands){ + if (target->type->register_commands) { (*(target->type->register_commands))(cmd_ctx); } - if (target->type->target_create){ + if (target->type->target_create) { (*(target->type->target_create))(target, goi->interp); } @@ -4236,7 +4236,7 @@ { target_t **tpp; tpp = &(all_targets); - while (*tpp){ + while (*tpp) { tpp = &((*tpp)->next); } *tpp = target; @@ -4285,48 +4285,48 @@ Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); - if (goi.argc == 0){ + if (goi.argc == 0) { Jim_WrongNumArgs(interp, 1, argv, "missing: command ..."); return JIM_ERR; } /* Jim_GetOpt_Debug(&goi); */ r = Jim_GetOpt_Enum(&goi, target_cmds, &x); - if (r != JIM_OK){ + if (r != JIM_OK) { return r; } - switch (x){ + switch (x) { default: Jim_Panic(goi.interp,"Why am I here?"); return JIM_ERR; case TG_CMD_CURRENT: - if (goi.argc != 0){ + if (goi.argc != 0) { Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); return JIM_ERR; } Jim_SetResultString(goi.interp, get_current_target(cmd_ctx)->cmd_name, -1); return JIM_OK; case TG_CMD_TYPES: - if (goi.argc != 0){ + if (goi.argc != 0) { Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); return JIM_ERR; } Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0)); - for (x = 0 ; target_types[x] ; x++){ + for (x = 0 ; target_types[x] ; x++) { Jim_ListAppendElement(goi.interp, Jim_GetResult(goi.interp), Jim_NewStringObj(goi.interp, target_types[x]->name, -1)); } return JIM_OK; case TG_CMD_NAMES: - if (goi.argc != 0){ + if (goi.argc != 0) { Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); return JIM_ERR; } Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0)); target = all_targets; - while (target){ + while (target) { Jim_ListAppendElement(goi.interp, Jim_GetResult(goi.interp), Jim_NewStringObj(goi.interp, target->cmd_name, -1)); @@ -4334,25 +4334,25 @@ } return JIM_OK; case TG_CMD_CREATE: - if (goi.argc < 3){ + if (goi.argc < 3) { Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, "?name ... config options ..."); return JIM_ERR; } return target_create(&goi); break; case TG_CMD_NUMBER: - if (goi.argc != 1){ + if (goi.argc != 1) { Jim_SetResult_sprintf(goi.interp, "expected: target number ?NUMBER?"); return JIM_ERR; } e = Jim_GetOpt_Wide(&goi, &w); - if (e != JIM_OK){ + if (e != JIM_OK) { return JIM_ERR; } { target_t *t; t = get_target_by_num(w); - if (t == NULL){ + if (t == NULL) { Jim_SetResult_sprintf(goi.interp,"Target: number %d does not exist", (int)(w)); return JIM_ERR; } @@ -4360,7 +4360,7 @@ return JIM_OK; } case TG_CMD_COUNT: - if (goi.argc != 0){ + if (goi.argc != 0) { Jim_WrongNumArgs(goi.interp, 0, goi.argv, "<no parameters>"); return JIM_ERR; } |
From: <zw...@ma...> - 2009-06-24 00:49:01
|
Author: zwelch Date: 2009-06-24 00:47:42 +0200 (Wed, 24 Jun 2009) New Revision: 2377 Modified: trunk/src/ecosboard.c trunk/src/flash/aduc702x.c trunk/src/flash/at91sam7.c trunk/src/flash/avrf.c trunk/src/flash/cfi.c trunk/src/flash/davinci_nand.c trunk/src/flash/ecos.c trunk/src/flash/flash.c trunk/src/flash/mflash.c trunk/src/flash/nand.c trunk/src/flash/ocl/at91sam7x/dcc.c trunk/src/flash/pic32mx.c trunk/src/flash/stm32x.c trunk/src/flash/str7x.c trunk/src/flash/str9x.c trunk/src/flash/str9xpec.c trunk/src/helper/binarybuffer.c trunk/src/helper/command.c trunk/src/helper/ioutil.c trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/helper/log.h trunk/src/helper/replacements.h trunk/src/jtag/amt_jtagaccel.c trunk/src/jtag/bitbang.c trunk/src/jtag/bitq.c trunk/src/jtag/commands.c trunk/src/jtag/core.c trunk/src/jtag/driver.c trunk/src/jtag/dummy.c trunk/src/jtag/ft2232.c trunk/src/jtag/gw16012.c trunk/src/jtag/interface.c trunk/src/jtag/interface.h trunk/src/jtag/parport.c trunk/src/jtag/rlink/dtc_cmd.h trunk/src/jtag/rlink/rlink.c trunk/src/jtag/tcl.c trunk/src/jtag/vsllink.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/openocd.c trunk/src/pld/virtex2.c trunk/src/server/gdb_server.c trunk/src/server/httpd.c trunk/src/server/server.c trunk/src/svf/svf.c trunk/src/target/arm11.c trunk/src/target/arm720t.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm966e.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_disassembler.c trunk/src/target/armv4_5.c trunk/src/target/armv7m.h trunk/src/target/cortex_m3.c trunk/src/target/etb.c trunk/src/target/image.c trunk/src/target/mips32.c trunk/src/target/mips32_pracc.c trunk/src/target/mips32_pracc.h trunk/src/target/mips_ejtag.c trunk/src/target/mips_m4k.c trunk/src/target/register.c trunk/src/target/target.c trunk/src/target/target.h trunk/src/target/target_request.c trunk/src/target/target_type.h trunk/src/target/trace.c trunk/src/target/xscale.c trunk/src/xsvf/xsvf.c Log: Remove whitespace that occurs before ')'. - Replace '[ \t]*[)]' with ')'. Modified: trunk/src/ecosboard.c =================================================================== --- trunk/src/ecosboard.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/ecosboard.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -257,7 +257,7 @@ "/rom", "romfs", "", - (CYG_ADDRWORD) &filedata[0] ); + (CYG_ADDRWORD) &filedata[0]); #endif void openocd_sleep_prelude(void) @@ -1156,7 +1156,7 @@ // "romfs", // FIlesystem type // "", // hardware device // (CYG_ADDRWORD) CYGNUM_FS_ROM_BASE_ADDRESS // Address in ROM -// ); +//); // ------------------------------------------------------------------------- Modified: trunk/src/flash/aduc702x.c =================================================================== --- trunk/src/flash/aduc702x.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/aduc702x.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -399,7 +399,7 @@ static int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size) { - snprintf(buf, buf_size, "aduc702x flash driver info" ); + snprintf(buf, buf_size, "aduc702x flash driver info"); return ERROR_OK; } Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -187,7 +187,7 @@ } /* Prescaler adjust */ - if ((((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0) ) + if ((((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0)) { at91sam7_info->mck_valid = 0; at91sam7_info->mck_freq = 0; @@ -613,7 +613,7 @@ at91sam7_protect_check(t_bank); } - LOG_DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch ); + LOG_DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch); return ERROR_OK; } Modified: trunk/src/flash/avrf.c =================================================================== --- trunk/src/flash/avrf.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/avrf.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -323,7 +323,7 @@ return ERROR_FAIL; } - LOG_INFO("device id = 0x%08" PRIx32 "", device_id ); + LOG_INFO("device id = 0x%08" PRIx32 "", device_id); if (EXTRACT_MFG(device_id) != 0x1F) { LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); @@ -402,7 +402,7 @@ return ERROR_FAIL; } - LOG_INFO("device id = 0x%08" PRIx32 "", device_id ); + LOG_INFO("device id = 0x%08" PRIx32 "", device_id); if (EXTRACT_MFG(device_id) != 0x1F) { LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/cfi.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -214,7 +214,7 @@ uint8_t i; for (i = 0;i < 2;i++) target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, - &data[i*bank->bus_width] ); + &data[i*bank->bus_width]); } else target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 2, data); @@ -236,7 +236,7 @@ uint8_t i; for (i = 0;i < 4;i++) target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, - &data[i*bank->bus_width] ); + &data[i*bank->bus_width]); } else target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 4, data); @@ -1154,7 +1154,7 @@ /* flash write code */ if (!cfi_info->write_algorithm) { - if (target_code_size > sizeof(target_code) ) + if (target_code_size > sizeof(target_code)) { LOG_WARNING("Internal error - target code buffer to small. Increase CFI_MAX_INTEL_CODESIZE and recompile."); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; @@ -1206,7 +1206,7 @@ busy_pattern_val = cfi_command_val(bank, 0x80); error_pattern_val = cfi_command_val(bank, 0x7e); - LOG_INFO("Using target buffer at 0x%08" PRIx32 " and of size 0x%04" PRIx32, source->address, buffer_size ); + LOG_INFO("Using target buffer at 0x%08" PRIx32 " and of size 0x%04" PRIx32, source->address, buffer_size); /* Programming main loop */ while (count > 0) @@ -1227,7 +1227,7 @@ buf_set_u32(reg_params[5].value, 0, 32, busy_pattern_val); buf_set_u32(reg_params[6].value, 0, 32, error_pattern_val); - LOG_INFO("Write 0x%04" PRIx32 " bytes to flash at 0x%08" PRIx32 , thisrun_count, address ); + LOG_INFO("Write 0x%04" PRIx32 " bytes to flash at 0x%08" PRIx32 , thisrun_count, address); /* Execute algorithm, assume breakpoint for last instruction */ retval = target_run_algorithm(target, 0, NULL, 7, reg_params, @@ -1883,7 +1883,7 @@ write_p = address & ~(bank->bus_width - 1); if ((align = address - write_p) != 0) { - LOG_INFO("Fixup %d unaligned head bytes", align ); + LOG_INFO("Fixup %d unaligned head bytes", align); for (i = 0; i < bank->bus_width; i++) current_word[i] = 0; @@ -2029,7 +2029,7 @@ /* handle unaligned tail bytes */ if (count > 0) { - LOG_INFO("Fixup %" PRId32 " unaligned tail bytes", count ); + LOG_INFO("Fixup %" PRId32 " unaligned tail bytes", count); copy_p = write_p; for (i = 0; i < bank->bus_width; i++) Modified: trunk/src/flash/davinci_nand.c =================================================================== --- trunk/src/flash/davinci_nand.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/davinci_nand.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -675,7 +675,7 @@ if (aemif == 0x01e00000 /* dm6446, dm357 */ || aemif == 0x01e10000 /* dm335, dm355 */ || aemif == 0x01d10000 /* dm365 */ - ) { +) { if (chip < 0x0200000 || chip >= 0x0a000000) { LOG_ERROR("NAND address %08lx out of range?", chip); goto fail; Modified: trunk/src/flash/ecos.c =================================================================== --- trunk/src/flash/ecos.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/ecos.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -281,7 +281,7 @@ 0, &flashErr, timeout - ); +); if (retval != ERROR_OK) return retval; Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/flash.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -793,7 +793,7 @@ for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) { - cur_size = MIN((count*wordsize - wrote), sizeof(chunk) ); + cur_size = MIN((count*wordsize - wrote), sizeof(chunk)); flash_bank_t *bank; bank = get_flash_bank_by_addr(target, address); if (bank == NULL) @@ -994,7 +994,7 @@ } } - if (first == -1 || last == -1 ) + if (first == -1 || last == -1) return ERROR_OK; return flash_driver_erase(c, first, last); @@ -1076,7 +1076,7 @@ run_size += pad_bytes; padding[section_last] = 0; - LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes ); + LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes); } /* fit the run into bank constraints */ @@ -1127,7 +1127,7 @@ if (erase) { /* calculate and erase sectors */ - retval = flash_erase_address_range(target, run_address, run_size ); + retval = flash_erase_address_range(target, run_address, run_size); } if (retval == ERROR_OK) Modified: trunk/src/flash/mflash.c =================================================================== --- trunk/src/flash/mflash.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/mflash.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -415,7 +415,7 @@ if (ret == ERROR_OK) { command_print(cmd_ctx, "mflash (total %" PRIu32 " sectors) found at 0x%8.8" PRIx32 "", - mflash_bank->drv_info->tot_sects, mflash_bank->base ); + mflash_bank->drv_info->tot_sects, mflash_bank->base); } return ret; @@ -429,7 +429,7 @@ uint8_t *buff_ptr = buff; duration_t duration; - if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, mg_io_cmd_read)) != ERROR_OK ) + if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, mg_io_cmd_read)) != ERROR_OK) return ret; address = mflash_bank->base + MG_BUFFER_OFFSET; @@ -502,7 +502,7 @@ uint8_t *buff_ptr = buff; duration_t duration; - if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, cmd)) != ERROR_OK ) + if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, cmd)) != ERROR_OK) return ret; address = mflash_bank->base + MG_BUFFER_OFFSET; Modified: trunk/src/flash/nand.c =================================================================== --- trunk/src/flash/nand.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/nand.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -736,7 +736,7 @@ page = malloc(device->page_size); - while (data_size > 0 ) + while (data_size > 0) { uint32_t thisrun_size = (data_size > device->page_size) ? device->page_size : data_size; uint32_t page_address; @@ -773,7 +773,7 @@ page = malloc(device->page_size); - while (data_size > 0 ) + while (data_size > 0) { uint32_t thisrun_size = (data_size > device->page_size) ? device->page_size : data_size; uint32_t page_address; Modified: trunk/src/flash/ocl/at91sam7x/dcc.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/dcc.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/ocl/at91sam7x/dcc.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -26,10 +26,10 @@ volatile uint32 dcc_reg; do { - asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) : ); + asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) :); } while ((dcc_reg&1) == 0); - asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) : ); + asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) :); return dcc_reg; } @@ -40,7 +40,7 @@ volatile uint32 dcc_reg; do { - asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) : ); + asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) :); /* operation controled by master, cancel operation upon reception of data for immediate response */ if (dcc_reg&1) return -1; Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -148,11 +148,11 @@ /* wait for busy to clear */ while (((status = pic32mx_get_flash_status(bank)) & NVMCON_NVMWR) && (timeout-- > 0)) { - LOG_DEBUG("status: 0x%" PRIx32, status ); + LOG_DEBUG("status: 0x%" PRIx32, status); alive_sleep(1); } if (timeout <= 0) - LOG_DEBUG("timeout: status: 0x%" PRIx32, status ); + LOG_DEBUG("timeout: status: 0x%" PRIx32, status); return status; } @@ -229,9 +229,9 @@ { LOG_DEBUG("Erasing entire program flash"); status = pic32mx_nvm_exec(bank, NVMCON_OP_PFM_ERASE, 50); - if (status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR) return ERROR_FLASH_OPERATION_FAILED; return ERROR_OK; } @@ -245,9 +245,9 @@ status = pic32mx_nvm_exec(bank, NVMCON_OP_PAGE_ERASE, 10); - if (status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR) return ERROR_FLASH_OPERATION_FAILED; bank->sectors[i].is_erased = 1; } @@ -313,7 +313,7 @@ reg = (i / pic32mx_info->ppage_size) / 8; bit = (i / pic32mx_info->ppage_size) - (reg * 8); - if (set ) + if (set) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -327,7 +327,7 @@ reg = (i / pic32mx_info->ppage_size) / 8; bit = (i / pic32mx_info->ppage_size) - (reg * 8); - if (set ) + if (set) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -434,12 +434,12 @@ } #endif status = pic32mx_write_row(bank, address, source->address); - if (status & NVMCON_NVMERR ) { + if (status & NVMCON_NVMERR) { LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } - if (status & NVMCON_LVDERR ) { + if (status & NVMCON_LVDERR) { LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; @@ -458,12 +458,12 @@ memcpy(&value, buffer, sizeof(uint32_t)); uint32_t status = pic32mx_write_word(bank, address, value); - if (status & NVMCON_NVMERR ) { + if (status & NVMCON_NVMERR) { LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } - if (status & NVMCON_LVDERR ) { + if (status & NVMCON_LVDERR) { LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; @@ -564,9 +564,9 @@ memcpy(&value, buffer + bytes_written, sizeof(uint32_t)); status = pic32mx_write_word(bank, address, value); - if (status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR) return ERROR_FLASH_OPERATION_FAILED; bytes_written += 4; @@ -580,9 +580,9 @@ memcpy(&value, buffer + bytes_written, bytes_remaining); status = pic32mx_write_word(bank, address, value); - if (status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR) return ERROR_FLASH_OPERATION_FAILED; } @@ -607,10 +607,10 @@ device_id, (unsigned)((device_id >> 1)&0x7ff), (unsigned)((device_id >> 12)&0xff), - (unsigned)((device_id >> 20)&0xfff) ); + (unsigned)((device_id >> 20)&0xfff)); if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) { - LOG_WARNING("Cannot identify target as a PIC32MX family." ); + LOG_WARNING("Cannot identify target as a PIC32MX family."); return ERROR_FLASH_OPERATION_FAILED; } @@ -626,7 +626,7 @@ break; } if (pic32mx_devs[i].name == NULL) { - LOG_WARNING("Cannot identify target as a PIC32MX family." ); + LOG_WARNING("Cannot identify target as a PIC32MX family."); return ERROR_FLASH_OPERATION_FAILED; } } @@ -646,7 +646,7 @@ } #endif - LOG_INFO("flash size = %dkbytes", num_pages ); + LOG_INFO("flash size = %dkbytes", num_pages); /* calculate numbers of pages */ num_pages /= (page_size / 1024); @@ -847,13 +847,13 @@ target_write_u32(target, PIC32MX_FLASH_CR, FLASH_LOCK); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) { LOG_ERROR("pic32mx device protected"); return ERROR_OK; } - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) { LOG_ERROR("pic32mx device programming failed"); return ERROR_OK; @@ -931,9 +931,9 @@ res = ERROR_OK; status = pic32mx_write_word(bank, address, value); - if (status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR) res = ERROR_FLASH_OPERATION_FAILED; - if (status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR) res = ERROR_FLASH_OPERATION_FAILED; if (res == ERROR_OK) Modified: trunk/src/flash/stm32x.c =================================================================== --- trunk/src/flash/stm32x.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/stm32x.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -182,9 +182,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; /* clear readout protection and complementary option bytes @@ -218,9 +218,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 1 */ @@ -228,9 +228,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 2 */ @@ -238,9 +238,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 3 */ @@ -248,9 +248,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 4 */ @@ -258,9 +258,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; /* write readout protection bit */ @@ -268,9 +268,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK); @@ -378,9 +378,9 @@ status = stm32x_wait_status_busy(bank, 10); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) return ERROR_FLASH_OPERATION_FAILED; - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) return ERROR_FLASH_OPERATION_FAILED; bank->sectors[i].is_erased = 1; } @@ -445,7 +445,7 @@ reg = (i / stm32x_info->ppage_size) / 8; bit = (i / stm32x_info->ppage_size) - (reg * 8); - if (set ) + if (set) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -459,7 +459,7 @@ reg = (i / stm32x_info->ppage_size) / 8; bit = (i / stm32x_info->ppage_size) - (reg * 8); - if (set ) + if (set) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -658,12 +658,12 @@ status = stm32x_wait_status_busy(bank, 5); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) { LOG_ERROR("flash memory not erased before writing"); return ERROR_FLASH_OPERATION_FAILED; } - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) { LOG_ERROR("flash memory write protected"); return ERROR_FLASH_OPERATION_FAILED; @@ -684,12 +684,12 @@ status = stm32x_wait_status_busy(bank, 5); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) { LOG_ERROR("flash memory not erased before writing"); return ERROR_FLASH_OPERATION_FAILED; } - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) { LOG_ERROR("flash memory write protected"); return ERROR_FLASH_OPERATION_FAILED; @@ -720,7 +720,7 @@ /* read stm32 device id register */ target_read_u32(target, 0xE0042000, &device_id); - LOG_INFO("device id = 0x%08" PRIx32 "", device_id ); + LOG_INFO("device id = 0x%08" PRIx32 "", device_id); /* get flash size from target */ if (target_read_u16(target, 0x1FFFF7E0, &num_pages) != ERROR_OK) @@ -740,7 +740,7 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revA */ - LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 128k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 128k flash"); num_pages = 128; } } @@ -755,7 +755,7 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revA */ - LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 32k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 32k flash"); num_pages = 32; } } @@ -770,7 +770,7 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revZ */ - LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash"); num_pages = 512; } } @@ -785,17 +785,17 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revZ */ - LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 256k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 256k flash"); num_pages = 256; } } else { - LOG_WARNING("Cannot identify target as a STM32 family." ); + LOG_WARNING("Cannot identify target as a STM32 family."); return ERROR_FLASH_OPERATION_FAILED; } - LOG_INFO("flash size = %dkbytes", num_pages ); + LOG_INFO("flash size = %dkbytes", num_pages); /* calculate numbers of pages */ num_pages /= (page_size / 1024); @@ -1188,13 +1188,13 @@ target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK); - if (status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR) { LOG_ERROR("stm32x device protected"); return ERROR_OK; } - if (status & FLASH_PGERR ) + if (status & FLASH_PGERR) { LOG_ERROR("stm32x device programming failed"); return ERROR_OK; Modified: trunk/src/flash/str7x.c =================================================================== --- trunk/src/flash/str7x.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/str7x.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -634,7 +634,7 @@ static int str7x_info(struct flash_bank_s *bank, char *buf, int buf_size) { - snprintf(buf, buf_size, "str7x flash driver info" ); + snprintf(buf, buf_size, "str7x flash driver info"); return ERROR_OK; } Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/str9x.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -305,7 +305,7 @@ { return retval; } - if (status & 0x80 ) + if (status & 0x80) break; alive_sleep(1); } @@ -327,7 +327,7 @@ return retval; } - if (status & 0x22 ) + if (status & 0x22) { LOG_ERROR("error erasing flash bank, status: 0x%x", status); return ERROR_FLASH_OPERATION_FAILED; @@ -365,7 +365,7 @@ adr = bank->base + bank->sectors[i].offset; target_write_u16(target, adr, 0x60); - if (set ) + if (set) target_write_u16(target, adr, 0x01); else target_write_u16(target, adr, 0xD0); @@ -578,7 +578,7 @@ for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); - if (status & 0x80 ) + if (status & 0x80) break; alive_sleep(1); } @@ -627,7 +627,7 @@ for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); - if (status & 0x80 ) + if (status & 0x80) break; alive_sleep(1); } @@ -665,7 +665,7 @@ static int str9x_info(struct flash_bank_s *bank, char *buf, int buf_size) { - snprintf(buf, buf_size, "str9x flash driver info" ); + snprintf(buf, buf_size, "str9x flash driver info"); return ERROR_OK; } Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/flash/str9xpec.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -101,7 +101,7 @@ int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state) { - if (tap == NULL ){ + if (tap == NULL){ return ERROR_TARGET_INVALID; } @@ -349,7 +349,7 @@ tap = str9xpec_info->tap; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable(bank ); + str9xpec_isc_enable(bank); } if (!str9xpec_info->isc_enable) { @@ -438,7 +438,7 @@ tap = str9xpec_info->tap; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable(bank ); + str9xpec_isc_enable(bank); } if (!str9xpec_info->isc_enable) { @@ -518,7 +518,7 @@ tap = str9xpec_info->tap; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable(bank ); + str9xpec_isc_enable(bank); } if (!str9xpec_info->isc_enable) { @@ -575,7 +575,7 @@ /* last bank: 0xFF signals a full device protect */ if (last == 0xFF) { - if (set ) + if (set) { status = str9xpec_lock_device(bank); } @@ -589,7 +589,7 @@ { for (i = first; i <= last; i++) { - if (set ) + if (set) buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 1); else buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 0); @@ -845,7 +845,7 @@ static int str9xpec_info(struct flash_bank_s *bank, char *buf, int buf_size) { - snprintf(buf, buf_size, "str9xpec flash driver info" ); + snprintf(buf, buf_size, "str9xpec flash driver info"); return ERROR_OK; } @@ -919,13 +919,13 @@ tap = str9xpec_info->tap; /* erase config options first */ - status = str9xpec_erase_area(bank, 0xFE, 0xFE ); + status = str9xpec_erase_area(bank, 0xFE, 0xFE); if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS) return status; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable(bank ); + str9xpec_isc_enable(bank); } if (!str9xpec_info->isc_enable) { Modified: trunk/src/helper/binarybuffer.c =================================================================== --- trunk/src/helper/binarybuffer.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/helper/binarybuffer.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -80,7 +80,7 @@ { /* last byte */ /* mask out bits that don't really belong to the buffer if size isn't a multiple of 8 bits */ - if ((size % 8) && (i == num_bytes -1 )) + if ((size % 8) && (i == num_bytes -1)) { if ((buf1[i] & ((1 << (size % 8)) - 1)) != (buf2[i] & ((1 << (size % 8)) - 1))) return 1; @@ -104,7 +104,7 @@ { /* last byte */ /* mask out bits that don't really belong to the buffer if size isn't a multiple of 8 bits */ - if ((size % 8) && (i == num_bytes -1 )) + if ((size % 8) && (i == num_bytes -1)) { if ((buf1[i] & ((1 << (size % 8)) - 1) & mask[i]) != (buf2[i] & ((1 << (size % 8)) - 1) & mask[i])) Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/helper/command.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -238,7 +238,7 @@ /* we now need to add an overrideable proc */ const char *override_name = alloc_printf("proc %s%s%s {args} {if {[catch {eval ocd_%s%s%s $args}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3); - Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__ ); + Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__); free((void *)override_name); /* accumulate help text in Tcl helptext list. */ @@ -348,8 +348,8 @@ void command_output_text(command_context_t *context, const char *data) { - if (context && context->output_handler && data ){ - context->output_handler(context, data ); + if (context && context->output_handler && data){ + context->output_handler(context, data); } } @@ -405,7 +405,7 @@ int run_command(command_context_t *context, command_t *c, char *words[], int num_words) { int start_word = 0; - if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode) )) + if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode))) { /* Config commands can not run after the config stage */ LOG_ERROR("Command '%s' only runs during configuration stage", c->name); @@ -466,7 +466,7 @@ retcode = Jim_SetAssocData(interp, "retval", NULL, &retval); if (retcode == JIM_OK) { - retcode = Jim_Eval_Named(interp, line, __THIS__FILE__, __LINE__ ); + retcode = Jim_Eval_Named(interp, line, __THIS__FILE__, __LINE__); Jim_DeleteAssocData(interp, "retval"); } @@ -673,7 +673,7 @@ log_add_callback(tcl_output, tclOutput); - retcode = Jim_Eval_Named(interp, str, __THIS__FILE__, __LINE__ ); + retcode = Jim_Eval_Named(interp, str, __THIS__FILE__, __LINE__); log_remove_callback(tcl_output, tclOutput); @@ -704,7 +704,7 @@ Jim_RegisterCoreCommands(interp); #endif -#if defined(_MSC_VER ) +#if defined(_MSC_VER) /* WinXX - is generic, the forward * looking problem is this: * @@ -715,16 +715,16 @@ HostOs = "winxx"; #elif defined(__LINUX__) HostOs = "linux"; -#elif defined(__DARWIN__ ) +#elif defined(__DARWIN__) HostOs = "darwin"; -#elif defined(__CYGWIN__ ) +#elif defined(__CYGWIN__) HostOs = "cygwin"; -#elif defined(__MINGW32__ ) +#elif defined(__MINGW32__) HostOs = "mingw32"; #else HostOs = "other"; #endif - Jim_SetGlobalVariableStr(interp, "ocd_HOSTOS", Jim_NewStringObj(interp, HostOs , strlen(HostOs)) ); + Jim_SetGlobalVariableStr(interp, "ocd_HOSTOS", Jim_NewStringObj(interp, HostOs , strlen(HostOs))); Jim_CreateCommand(interp, "ocd_find", jim_find, NULL, NULL); Jim_CreateCommand(interp, "echo", jim_echo, NULL, NULL); Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/helper/ioutil.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -199,7 +199,7 @@ } prev = info.fordblks; - command_print(cmd_ctx, "Available ram: %d", info.fordblks ); + command_print(cmd_ctx, "Available ram: %d", info.fordblks); return ERROR_OK; } @@ -325,34 +325,34 @@ fd1 = open(name1, O_WRONLY | O_CREAT, 0664); if (fd1 < 0) - SHOW_RESULT(open, fd1 ); + SHOW_RESULT(open, fd1); fd2 = open(name2, O_RDONLY); if (fd2 < 0) - SHOW_RESULT(open, fd2 ); + SHOW_RESULT(open, fd2); for (;;) { - done = read(fd2, buf, IOSIZE ); + done = read(fd2, buf, IOSIZE); if (done < 0) { - SHOW_RESULT(read, done ); + SHOW_RESULT(read, done); break; } - if (done == 0 ) break; + if (done == 0) break; wrote = write(fd1, buf, done); - if (wrote != done ) SHOW_RESULT(write, wrote ); + if (wrote != done) SHOW_RESULT(write, wrote); - if (wrote != done ) break; + if (wrote != done) break; } err = close(fd1); - if (err < 0 ) SHOW_RESULT(close, err ); + if (err < 0) SHOW_RESULT(close, err); err = close(fd2); - if (err < 0 ) SHOW_RESULT(close, err ); + if (err < 0) SHOW_RESULT(close, err); } @@ -372,7 +372,7 @@ } dirp = opendir(name); - if (dirp == NULL ) SHOW_RESULT(opendir, -1 ); + if (dirp == NULL) SHOW_RESULT(opendir, -1); for (;;) { @@ -421,7 +421,7 @@ } err = closedir(dirp); - if (err < 0 ) SHOW_RESULT(stat, err ); + if (err < 0) SHOW_RESULT(stat, err); } Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/helper/jim.c 2009-06-23 22:47:42 UTC (rev 2377) @@ -117,25 +117,25 @@ * ---------------------------------------------------------------------------*/ static char * -jim_vasprintf(const char *fmt, va_list ap ) +jim_vasprintf(const char *fmt, va_list ap) { #ifndef HAVE_VASPRINTF /* yucky way */ static char buf[2048]; - vsnprintf(buf, sizeof(buf), fmt, ap ); + vsnprintf(buf, sizeof(buf), fmt, ap); /* garentee termination */ buf[sizeof(buf)-1] = 0; #else char *buf; int result; - result = vasprintf(&buf, fmt, ap ); + result = vasprintf(&buf, fmt, ap); if (result < 0) exit(-1); #endif return buf; } static void -jim_vasprintf_done(void *buf ) +jim_vasprintf_done(void *buf) { #ifndef HAVE_VASPRINTF (void)(buf); @@ -421,7 +421,7 @@ #else *widePtr = strtol(str, &endptr, base); #endif - if ((str[0] == '\0') || (str == endptr) ) + if ((str[0] == '\0') || (str == endptr)) return JIM_ERR; if (endptr[0] != '\0') { while (*endptr) { @@ -438,7 +438,7 @@ char *endptr; *intPtr = strtol(str, &endptr, 10); - if ((str[0] == '\0') || (str == endptr) ) + if ((str[0] == '\0') || (str == endptr)) return JIM_ERR; if (endptr[0] != '\0') { while (*endptr) { @@ -495,7 +495,7 @@ char *endptr; *doublePtr = strtod(str, &endptr); - if (str[0] == '\0' || endptr[0] != '\0' || (str == endptr) ) + if (str[0] == '\0' || endptr[0] != '\0' || (str == endptr)) return JIM_ERR; return JIM_OK; } @@ -544,10 +544,10 @@ #endif /* This may actually crash... we do it last */ - if (interp && interp->cookie_stderr ){ + 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 ); + Jim_vfprintf(interp, interp->cookie_stderr, fmt, ap); + Jim_fprintf(interp, interp->cookie_stderr, JIM_NL JIM_NL); } abort(); } @@ -2055,17 +2055,17 @@ StringAppendString(objPtr, str, len); } -void Jim_AppendString_sprintf(Jim_Interp *interp, Jim_Obj *objPtr, const char *fmt, ... ) +void Jim_AppendString_sprintf(Jim_Interp *interp, Jim_Obj *objPtr, const char *fmt, ...) { char *buf; va_list ap; - va_start(ap, fmt ); - buf = jim_vasprintf(fmt, ap ); + va_start(ap, fmt); + buf = jim_vasprintf(fmt, ap); va_end(ap); - if (buf ){ - Jim_AppendString(interp, objPtr, buf, -1 ); + if (buf){ + Jim_AppendString(interp, objPtr, buf, -1); jim_vasprintf_done(buf); } } @@ -2283,10 +2283,10 @@ haveprec = 0; prec = -1; /* not found yet */ next_fmt: - if (fmtLen <= 0 ){ + if (fmtLen <= 0){ break; } - switch (*fmt ){ + switch (*fmt){ /* terminals */ case 'b': /* binary - not all printfs() do this */ case 's': /* string */ @@ -2341,11 +2341,11 @@ case '8': case '9': accum = 0; - while (isdigit(*fmt) && (fmtLen > 0) ){ + while (isdigit(*fmt) && (fmtLen > 0)){ accum = (accum * 10) + (*fmt - '0'); fmt++; fmtLen--; } - if (inprec ){ + if (inprec){ haveprec = 1; prec = accum; } else { @@ -2356,24 +2356,24 @@ /* suck up the next item as an integer */ fmt++; fmtLen--; objc--; - if (objc <= 0 ){ + if (objc <= 0){ goto not_enough_args; } - if (Jim_GetWide(interp,objv[0],&wideValue )== JIM_ERR ){ - Jim_FreeNewObj(interp, resObjPtr ); + if (Jim_GetWide(interp,objv[0],&wideValue)== JIM_ERR){ + Jim_FreeNewObj(interp, resObjPtr); return NULL; } - if (inprec ){ + if (inprec){ haveprec = 1; prec = wideValue; - if (prec < 0 ){ + if (prec < 0){ /* man 3 printf says */ /* if prec is negative, it is zero */ prec = 0; } } else { width = wideValue; - if (width < 0 ){ + if (width < 0){ ljust = 1; width = -width; } @@ -2402,33 +2402,33 @@ */ cp = fmt_str; *cp++ = '%'; - if (altfm ){ + if (altfm){ *cp++ = '#'; } - if (forceplus ){ + if (forceplus){ *cp++ = '+'; - } else if (spad ){ + } else if (spad){ /* PLUS overrides */ *cp++ = ' '; } - if (ljust ){ + if (ljust){ *cp++ = '-'; } - if (zpad ){ + if (zpad){ *cp++ = '0'; } - if (width > 0 ){ - sprintf(cp, "%d", width ); + if (width > 0){ + sprintf(cp, "%d", width); /* skip ahead */ cp = strchr(cp,0); } /* did we find a period? */ - if (inprec ){ + if (inprec){ /* then add it */ *cp++ = '.'; /* did something occur after the period? */ - if (haveprec ){ - sprintf(cp, "%d", prec ); + if (haveprec){ + sprintf(cp, "%d", prec); } cp = strchr(cp,0); } @@ -2441,7 +2441,7 @@ *cp++ = 's'; *cp = 0; /* BUG: we do not handled embeded NULLs */ - snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, Jim_GetString(objv[0], NULL )); + snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, Jim_GetString(objv[0], NULL)); break; case 'c': *cp++ = 'c'; @@ -2451,7 +2451,7 @@ return NULL; } c = (char) wideValue; - snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, c ); + snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, c); break; case 'f': case 'F': @@ -2461,11 +2461,11 @@ case 'E': *cp++ = *fmt; *cp = 0; - if (Jim_GetDouble(interp, objv[0], &doubleValue ) == JIM_ERR ){ - Jim_FreeNewObj(interp, resObjPtr ); + if (Jim_GetDouble(interp, objv[0], &doubleValue) == JIM_ERR){ + Jim_FreeNewObj(interp, resObjPtr); return NULL; } - snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, doubleValue ); + snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, doubleValue); break; case 'b': case 'd': @@ -2475,7 +2475,7 @@ case 'x': case 'X': /* jim widevaluse are 64bit */ - if (sizeof(jim_wide) == sizeof(long long) ){ + if (sizeof(jim_wide) == sizeof(long long)){ *cp++ = 'l'; *cp++ = 'l'; } else { @@ -2487,7 +2487,7 @@ Jim_FreeNewObj(interp, resObjPtr); return NULL; } - snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, wideValue ); + snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, wideValue); break; case '%': sprintf_buf[0] = '%'; @@ -2504,12 +2504,12 @@ } /* force terminate */ #if 0 - printf("FMT was: %s\n", fmt_str ); - printf("RES was: |%s|\n", sprintf_buf ); + printf("FMT was: %s\n", fmt_str); + printf("RES was: |%s|\n", sprintf_buf); #endif sprintf_buf[ JIM_MAX_FMT - 1] = 0; - Jim_AppendString(interp, resObjPtr, sprintf_buf, strlen(sprintf_buf) ); + Jim_AppendString(interp, resObjPtr, sprintf_buf, strlen(sprintf_buf)); /* next obj */ objv++; fmt++; @@ -2626,13 +2626,13 @@ Jim_Nvp *n; int e; - e = Jim_Nvp_name2value_obj(interp, nvp_table, objPtr, &n ); - if (e == JIM_ERR ){ + e = Jim_Nvp_name2value_obj(interp, nvp_table, objPtr, &n); + if (e == JIM_ERR){ return e; } /* Success? found? */ - if (n->name ){ + if (n->name){ /* remove const */ *result = (Jim_Nvp *)n; return JIM_OK; @@ -4426,7 +4426,7 @@ i->cookie_stderr = stderr; i->cb_fwrite = ((size_t (*)(const void *, size_t, size_t, void *))(fwrite)); i->cb_fread = ((size_t (*)(void *, size_t, size_t, void *))(fread)); - i->cb_vfprintf = ((int (*)(void *, const char *fmt, va_list ))(vfprintf)); + i->cb_vfprintf = ((int (*)(void *, const char *fmt, va_list))(vfprintf)); i->cb_fflush = ((int (*)(void *))(fflush)); i->cb_fgets = ((char * (*)(char *, int, void *))(fgets)); @@ -5433,7 +5433,7 @@ SetListFromAny(interp, listPtr); if (index >= 0 && index > listPtr->internalRep.listValue.len) index = listPtr->internalRep.listValue.len; - else if (index < 0 ) + else if (index < 0) index = 0; Jim_InvalidateStringRep(listPtr); ListInsertElements(listPtr, index, objc, objVec); @@ -6353,11 +6353,11 @@ pc->p++; pc->len--; } while (isdigit((int)*pc->p) - || (allowhex && isxdigit((int)*pc->p) ) + || (allowhex && isxdigit((int)*pc->p)) || (allowdot && *pc->p == '.') || (pc->p-pc->tstart == 1 && *pc->tstart == '0' && (*pc->p == 'x' || *pc->p == 'X')) - ) +) { if ((*pc->p == 'x') || (*pc->p == 'X')) { allowhex = 1; @@ -8894,8 +8894,8 @@ Jim_IncrRefCount(scriptObjPtr); - if (filename ){ - JimSetSourceInfo(interp, scriptObjPtr, filename, lineno ); + if (filename){ + JimSetSourceInfo(interp, scriptObjPtr, filename, lineno); } retval = Jim_EvalObj(interp, scriptObjPtr); @@ -8905,7 +8905,7 @@ int Jim_Eval(Jim_Interp *interp, const char *script) { - return Jim_Eval_Named(interp, script, NULL, 0 ); + return Jim_Eval_Named(interp, script, NULL, 0); } @@ -8963,7 +8963,7 @@ const int cwd_len = 2048; char *cwd = malloc(cwd_len); Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); - if (!getcwd(cwd, cwd_len )) strcpy(cwd, "unknown"); + if (!getcwd(cwd, cwd_len)) strcpy(cwd, "unknown"); Jim_AppendStrings(interp, Jim_GetResult(interp), "Error loading script \"", filename, "\"", " cwd: ", cwd, @@ -9359,12 +9359,12 @@ JIM_REGISTER_API(StackPop); JIM_REGISTER_API(StackPeek); JIM_REGISTER_API(FreeStackElements); - JIM_REGISTER_API(fprintf ); - JIM_REGISTER_API(vfprintf ); - JIM_REGISTER_API(fwrite ); - JIM_REGISTER_API(fread ); - JIM_REGISTER_API(fflush ); - JIM_REGISTER_API(fgets ); + JIM_REGISTER_API(fprintf); + JIM_REGISTER_API(vfprintf); + JIM_REGISTER_API(fwrite); + JIM_REGISTER_API(fread); + JIM_REGISTER_API(fflush); + JIM_REGISTER_API(fgets); JIM_REGISTER_API(GetNvp); JIM_REGISTER_API(Nvp_name2value); JIM_REGISTER_API(Nvp_name2value_simple); @@ -10217,7 +10217,7 @@ if (count > nbrOfLoops) nbrOfLoops = count; } - for (; nbrOfLoops-- > 0; ) { + for (; nbrOfLoops-- > 0;) { for (i = 0; i < nbrOfLists; ++i) { int varIdx = 0, var = i * 2; while (varIdx < listsEnd[var]) { @@ -12276,7 +12276,7 @@ "proc lambdaFinalizer {name val} {\n" " rename $name {}\n" "}\n" - ); +); } void Jim_RegisterCoreCommands(Jim_Interp *interp) @@ -12399,66 +12399,66 @@ * Jim's idea of STDIO.. * ---------------------------------------------------------------------------*/ -int Jim_fprintf(Jim_Interp *interp, void *cookie, const char *fmt, ... ) +int Jim_fprintf(Jim_Interp *interp, void *cookie, const char *fmt, ...) { int r; va_list ap; va_start(ap,fmt); - r = Jim_vfprintf(interp, cookie, fmt,ap ); + r = Jim_vfprintf(interp, cookie, fmt,ap); va_end(ap); return r; } -int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap ) +int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap) { - if ((interp == NULL) || (interp->cb_vfprintf == NULL) ){ + if ((interp == NULL) || (interp->cb_vfprintf == NULL)){ errno = ENOTSUP; return -1; } - return (*(interp->cb_vfprintf))(cookie, fmt, ap ); + return (*(interp->cb_vfprintf))(cookie, fmt, ap); } -size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie ) +size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie) { - if ((interp == NULL) || (interp->cb_fwrite == NULL) ){ + if ((interp == NULL) || (interp->cb_fwrite == NULL)){ errno = ENOTSUP; return 0; } return (*(interp->cb_fwrite))(ptr, size, n, cookie); } -size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie ) +size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie) { - if ((interp == NULL) || (interp->cb_fread == NULL) ){ + if ((interp == NULL) || (interp->cb_fread == NULL)){ errno = ENOTSUP; return 0; } return (*(interp->cb_fread))(ptr, size, n, cookie); } -int Jim_fflush(Jim_Interp *interp, void *cookie ) +int Jim_fflush(Jim_Interp *interp, void *cookie) { - if ((interp == NULL) || (interp->cb_fflush == NULL) ){ + if ((interp == NULL) || (interp->cb_fflush == NULL)){ /* pretend all is well */ return 0; } - return (*(interp->cb_fflush))(cookie ); + return (*(interp->cb_fflush))(cookie); } -char* Jim_fgets(Jim_Interp *interp, char *s, int size, void *cookie ) +char* Jim_fgets(Jim_Interp *interp, char *s, int size, void *cookie) { - if ((interp == NULL) || (interp->cb_fgets == NULL) ){ + if ((interp == NULL) || (interp->cb_fgets == NULL)){ errno = ENOTSUP; return NULL; } - return (*(interp->cb_fgets))(s, size, cookie ); + return (*(interp->cb_fgets))(s, size, cookie); } Jim_Nvp * -Jim_Nvp_name2value_simple(const Jim_Nvp *p, const char *name ) +Jim_Nvp_name2value_simple(const Jim_Nvp *p, const char *name) { - while (p->name ){ - if (0 == strcmp(name, p->name ) ){ + while (p->name){ + if (0 == strcmp(name, p->name)){ break; } p++; @@ -12467,10 +12467,10 @@ } Jim_Nvp * -Jim_Nvp_name2value_nocase_simple(const Jim_Nvp *p, const char *name ) +Jim_Nvp_name2value_nocase_simple(const Jim_Nvp *p, const char *name) { - while (p->name ){ - if (0 == strcasecmp(name, p->name ) ){ + while (p->name){ + if (0 == strcasecmp(name, p->name)){ break; } p++; @@ -12482,9 +12482,9 @@ Jim_Nvp_name2value_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, - Jim_Nvp **result ) + Jim_Nvp **result) { - return Jim_Nvp_name2value(interp, p, Jim_GetString(o, NULL ), result ); + return Jim_Nvp_name2value(interp, p, Jim_GetString(o, NULL), result); } @@ -12496,15 +12496,15 @@ { const Jim_Nvp *p; - p = Jim_Nvp_name2value_simple(_p, name ); + p = Jim_Nvp_name2value_simple(_p, name); /* result */ - if (result ){ + if (result){ *result = (Jim_Nvp *)(p); } /* found? */ - if (p->name ){ + if (p->name){ return JIM_OK; } else { return JIM_ERR; @@ -12512,23 +12512,23 @@ } int -Jim_Nvp_name2value_obj_nocase(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **puthere ) +Jim_Nvp_name2value_obj_nocase(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **puthere) { - return Jim_Nvp_name2value_nocase(interp, p, Jim_GetString(o, NULL ), puthere ); + return Jim_Nvp_name2value_nocase(interp, p, Jim_GetString(o, NULL), puthere); } int -Jim_Nvp_name2value_nocase(Jim_Interp *interp, const Jim_Nvp *_p, const char *name, Jim_Nvp **puthere ) +Jim_Nvp_name2value_nocase(Jim_Interp *interp, const Jim_Nvp *_p, const char *name, Jim_Nvp **puthere) { const Jim_Nvp *p; - p = Jim_Nvp_name2value_nocase_simple(_p, name ); + p = Jim_Nvp_name2value_nocase_simple(_p, name); - if (puthere ){ + if (puthere){ *puthere = (Jim_Nvp *)(p); } /* found */ - if (p->name ){ + if (p->name){ return JIM_OK; } else { return JIM_ERR; @@ -12537,24 +12537,24 @@ int -Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **result ) +Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **result) { int e;; jim_wide w; - e = Jim_GetWide(interp, o, &w ); - if (e != JIM_OK ){ + e = Jim_GetWide(interp, o, &w); + if (e != JIM_OK){ return e; } - return Jim_Nvp_value2name(interp, p, w, result ); + return Jim_Nvp_value2name(interp, p, w, result); } Jim_Nvp * -Jim_Nvp_value2name_simple(const Jim_Nvp *p, int value ) +Jim_Nvp_value2name_simple(const Jim_Nvp *p, int value) { - while (p->name ){ - if (value == p->value ){ + while (p->name){ + if (value == p->value){ break; } p++; @@ -12564,17 +12564,17 @@ int -Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **result ) +Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **result) { const Jim_Nvp *p; - p = Jim_Nvp_value2name_simple(_p, value ); + p = Jim_Nvp_value2name_simple(_p, value); - if (result ){ + if (result){ *result = (Jim_Nvp *)(p); } - if (p->name ){ + if (p->name){ return JIM_OK; } else { return JIM_ERR; @@ -12585,7 +12585,7 @@ int Jim_GetOpt_Setup(Jim_GetOptInfo *p, Jim_Interp *interp, int argc, Jim_Obj * const * argv) { - memset(p, 0, sizeof(*p) ); + memset(p, 0, sizeof(*p)); p->interp = interp; p->argc = argc; p->argv = argv; @@ -12594,37 +12594,37 @@ } void -Jim_GetOpt_Debug(Jim_GetOptInfo *p ) +Jim_GetOpt_Debug(Jim_GetOptInfo *p) { int x; Jim_fprintf(p->interp, p->interp->cookie_stderr, "---args---\n"); - for (x = 0 ; x < p->argc ; x++ ){ + for (x = 0 ; x < p->argc ; x++){ Jim_fprintf(p->interp, p->interp->cookie_stderr, "%2d) %s\n", x, - Jim_GetString(p->argv[x], NULL ) ); + Jim_GetString(p->argv[x], NULL)); } Jim_fprintf(p->interp, p->interp->cookie_stderr, "-------\n"); } int -Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere ) +Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere) { Jim_Obj *o; o = NULL; // failure - if (goi->argc ){ + if (goi->argc){ // success o = goi->argv[0]; goi->argc -= 1; goi->argv += 1; } - if (puthere ){ + if (puthere){ *puthere = o; } - if (o != NULL ){ + if (o != NULL){ return JIM_OK; } else { return JIM_ERR; @@ -12632,17 +12632,17 @@ } int -Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len ) +Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len) { int r; Jim_Obj *o; const char *cp; - r = Jim_GetOpt_Obj(goi, &o ); - if (r == JIM_OK ){ - cp = Jim_GetString(o, len ); - if (puthere ){ + r = Jim_GetOpt_Obj(goi, &o); + if (r == JIM_OK){ + cp = Jim_GetString(o, len); + if (puthere){ /* remove const */ *puthere = (char *)(cp); } @@ -12651,42 +12651,42 @@ } int -Jim_GetOpt_Double(Jim_GetOptInfo *goi, double *puthere ) +Jim_GetOpt_Double(Jim_GetOptInfo *goi, double *puthere) { int r; Jim_Obj *o; double _safe; - if (puthere == NULL ){ + if (puthere == NULL){ puthere = &_safe; } - r = Jim_GetOpt_Obj(goi, &o ); - if (r == JIM_OK ){ - r = Jim_GetDouble(goi->interp, o, puthere ); - if (r != JIM_OK ){ + r = Jim_GetOpt_Obj(goi, &o); + if (r == JIM_OK){ + r = Jim_GetDouble(goi->interp, o, puthere); + if (r != JIM_OK){ Jim_SetResult_sprintf(goi->interp, "not a number: %s", - Jim_GetString(o, NULL ) ); + Jim_GetString(o, NULL)); } } return r; } int -Jim_GetOpt_Wide(Jim_GetOptInfo *goi, jim_wide *puthere ) +Jim_GetOpt_Wide(Jim_GetOptInfo *goi, jim_wide *puthere) { int r; Jim_Obj *o; jim_wide _safe; - if (puthere == NULL ){ + if (puthere == NULL){ puthere = &_safe; } - r = Jim_GetOpt_Obj(goi, &o ); - if (r == JIM_OK ){ - r = Jim_GetWide(goi->interp, o, puthere ); + r = Jim_GetOpt_Obj(goi, &o); + if (r == JIM_OK){ + r = Jim_GetWide(goi->interp, o, puthere); } return r; } @@ -12699,16 +12699,16 @@ Jim_Obj *o; int e; - if (puthere == NULL ){ + if (puthere == NULL){ puthere = &_safe; } - e = Jim_GetOpt_Obj(goi, &o ); - if (e == JIM_OK ){ + e = Jim_GetOpt_Obj(goi, &o); + if (e == JIM_OK){ e = Jim_Nvp_name2value_obj(goi->interp, nvp, o, - puthere ); + puthere); } return e; @@ -12717,18 +12717,18 @@ void Jim_GetOpt_NvpUnknown(Jim_GetOptInfo *goi, const Jim_Nvp *nvptable, - int hadprefix ) + int hadprefix) { - if (hadprefix ){ + if (hadprefix){ Jim_SetResult_NvpUnknown(goi->interp, goi->argv[-2], goi->argv[-1], - nvptable ); + nvptable); } else { Jim_SetResult_NvpUnknown(goi->interp, NULL, goi->argv[-1], - nvptable ); + nvptable); } } @@ -12742,17 +12742,17 @@ Jim_Obj *o; int e; - if (puthere == NULL ){ + if (puthere == NULL){ puthere = &_safe; } - e = Jim_GetOpt_Obj(goi, &o ); - if (e == JIM_OK ){ + e = Jim_GetOpt_Obj(goi, &o); + if (e == JIM_OK){ e = Jim_GetEnum(goi->interp, o, lookup, puthere, "option", - JIM_ERRMSG ); + JIM_ERRMSG); } return e; } @@ -12760,16 +12760,16 @@ int -Jim_SetResult_sprintf(Jim_Interp *interp, const char *fmt,... ) +Jim_SetResult_sprintf(Jim_Interp *interp, const char *fmt,...) { va_list ap; char *buf; va_start(ap,fmt); - buf = jim_vasprintf(fmt, ap ); + buf = jim_vasprintf(fmt, ap); va_end(ap); - if (buf ){ - Jim_SetResultString(interp, buf, -1 ); + if (buf){ + Jim_SetResultString(interp, buf, -1); jim_vasprintf_done(buf); } return JIM_OK; @@ -12780,23 +12780,23 @@ Jim_SetResult_NvpUnknown(Jim_Interp *interp, Jim_Obj *param_name, Jim_Obj *param_value, - const Jim_Nvp *nvp ) + const Jim_Nvp *nvp) { - if (param_name ){ + if (param_name){ Jim_SetResult_sprintf(interp, "%s: Unknown: %s, try one of: ", - Jim_GetString(param_name, NULL ), - Jim_GetString(param_value, NULL ) ); + Jim_GetString(param_name, NULL), + Jim_GetString(param_value, NULL)); } else { Jim_SetResult_sprintf(interp, "Unknown param: %s, try one of: ", - Jim_GetString(param_value, NULL ) ); + Jim_GetString(param_value, NULL)); } - while (nvp->name ){ + while (nvp->name){ const char *a; const char *b; - if ((nvp + 1)->name ){ + if ((nvp + 1)->name){ a = nvp->name; b = ", "; } else { @@ -12805,7 +12805,7 @@ } Jim_AppendStrings(interp, Jim_GetResult(interp), - a, b, NULL ); + a, b, NULL); nvp++; } } @@ -12814,22 +12814,22 @@ static Jim_Obj *debug_string_obj; const char * -Jim_Debug_ArgvString(Jim_Interp *interp, int argc, Jim_Obj *const *argv ) +Jim_Debug_ArgvString(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int x; - if (debug_string_obj ){ - Jim_FreeObj(interp, debug_string_obj ); + if (debug_string_obj){ + Jim_FreeObj(interp, debug_string_obj); } - debug_string_obj = Jim_NewEmptyStringObj(interp ); - for (x = 0 ; x < argc ; x++ ){ + debug_string_obj = Jim_NewEmptyStringObj(interp); + for (x = 0 ; x < argc ; x++){ Jim_AppendStrings(interp, debug_string_obj, - Jim_GetString(argv[x], NULL ), + Jim_GetString(argv[x], NULL), " ", - NULL ); + NULL); } - return Jim_GetString(debug_string_obj, NULL ); + return Jim_GetString(debug_string_obj, NULL); } Modified: trunk/src/helper/jim.h =================================================================== --- trunk/src/helper/jim.h 2009-06-23 22:46:23 UTC (rev 2376) +++ trunk/src/helper/jim.h 2009-06-23 22:47:42 UTC (rev 2377) @@ -530,11 +530,11 @@ void *cookie_stdin; /* input file pointer, 'stdin' by default */ void *cookie_stdout; /* output file pointer, 'stdout' by default */ void *cookie_stderr; /* errors file pointer, 'stderr' by default */ - size_t (*cb_fwrite )(const void *ptr, size_t size, size_t n, void *cookie ); - size_t (*cb_fread )(void *ptr, size_t size, size_t n, void *cookie ); - int (*cb_vfprintf)(void *cookie, const char *fmt, va_list ap ); - int (*cb_fflush )(void *cookie ); - char *(*cb_fgets )(char *s, int size, void *cookie ); + size_t (*cb_fwrite)(const void *ptr, size_t size, size_t n, void *cookie); + size_t (*cb_fread)(void *ptr, size_t size, size_t n, void *cookie); + int (*cb_vfprintf)(void *cookie, const char *fmt, va_list ap); + int (*cb_fflush)(void *cookie); + char *(*cb_fgets)(char *s, int size, void *cookie); } Jim_Interp; /* Currently provided as macro that performs the increment. @@ -591,11 +591,11 @@ * }; * * Jim_Nvp *result - * e = Jim_Nvp_name2value(interp, yn, "y", &result ); + * e = Jim_Nvp_name2value(interp, yn, "y", &result); * returns &yn[0]; - * e = Jim_Nvp_name2value(interp, yn, "n", &result ); + * e = Jim_Nvp_name2value(interp, yn, "n", &result); * returns &yn[1]; - * e = Jim_Nvp_name2value(interp, yn, "Blah", &result ); + * e = Jim_Nvp_name2value(interp, yn, "Blah", &result); * returns &yn[4]; * \endcode * @@ -629,7 +629,7 @@ #ifdef DOXYGEN #define JIM_STATIC -#define JIM_API(X ) X +#define JIM_API(X) X #else #ifndef __JIM_CORE__ # if defined JIM_EMBEDDED @@ -650,7 +650,7 @@ #endif /* DOXYGEN */ /** Set the result - printf() style */ -JIM_STATIC int JIM_API(Jim_SetResult_sprintf )(Jim_Interp *p, const char *fmt, ... ); +JIM_STATIC int JIM_API(Jim_SetResult_sprintf)(Jim_Interp *p, const char *fmt, ...); /* Memory allocation */ JIM_STATIC void * JIM_API(Jim_Alloc) (int size); @@ -660,7 +660,7 @@ /* evaluation */ JIM_STATIC int JIM_API(Jim_Eval)(Jim_Interp *interp, const char *script); /* in C code, you can do this and get better error messages */ -/* Jim_Eval_Named(interp, "some tcl commands", __FILE__, __LINE__ ); */ +/* Jim_Eval_Named(interp, "some tcl commands", __FILE__, __LINE__); */ JIM_STATIC int JIM_API(Jim_Eval_Named)(Jim_Interp *interp, const char *script,const char *filename, int lineno); JIM_STATIC int JIM_API(Jim_EvalGlobal)(Jim_Interp *interp, const char *script); JIM_STATIC int JIM_API(Jim_EvalFile)(Jim_Interp *interp, const char *filename); @@ -721,7 +721,7 @@ JIM_STATIC void JIM_API(Jim_AppendString) (Jim_Interp *interp, Jim_Obj *objPtr, const char *str, int len); JIM_STATIC void JIM_API(Jim_AppendString_sprintf) (Jim_Interp *interp, Jim_Obj *objPtr, - const char *fmt, ... ); + const char *fmt, ...); JIM_STATIC void JIM_API(Jim_AppendObj) (Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *appendObjPtr); JIM_STATIC void JIM_API(Jim_AppendStrings) (Jim_Interp *interp, @@ -911,31 +911,31 @@ JIM_STATIC void JIM_API(Jim_Panic) (Jim_Interp *interp, const char *fmt, ...); /* Jim's STDIO */ -JIM_STATIC int JIM_API(Jim_fprintf )(Jim_Interp *interp, void *cookie, const char *fmt, ... ); -JIM_STATIC int JIM_API(Jim_vfprintf )(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap ); -JIM_STATIC size_t JIM_API(Jim_fwrite )(Jim_Interp *interp, const void *ptr, size_t size, size_t nmeb, void *cookie ); -JIM_STATIC size_t JIM_API(Jim_fread )(Jim_Interp *interp, void *ptr, size_t size, size_t nmeb, void *cookie ); -JIM_STATIC int JIM_API(Jim_fflush )(Jim_Interp *interp, void *cookie ); -JIM_STATIC char * JIM_API(Jim_fgets )(Jim_Interp *interp, char *s, int size, void *cookie ); +JIM_STATIC int JIM_API(Jim_fprintf)(Jim_Interp *interp, void *cookie, const char *fmt, ...); +JIM_STATIC int JIM_API(Jim_vfprintf)(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap); +JIM_STATIC size_t JIM_API(Jim_fwrite)(Jim_Interp *interp, const void *ptr, size_t size, size_t nmeb, void *cookie); +JIM_STATIC size_t JIM_API(Jim_fread)(Jim_Interp *interp, void *ptr, size_t size, size_t nmeb, void *cookie); +JIM_STATIC int JIM_API(Jim_fflush)(Jim_Interp *interp, void *cookie); +JIM_STATIC char * JIM_API(Jim_fgets)(Jim_Interp *interp, char *s, int size, void *cookie); /* Name Value Pairs Operations */ -JIM_STATIC Jim_Nvp *JIM_API(Jim_Nvp_name2value_simple)(const Jim_Nvp *nvp_table, const char *name ); -JIM_STATIC Jim_Nvp *JIM_API(Jim_Nvp_nam... [truncated message content] |
From: <zw...@ma...> - 2009-06-24 00:47:38
|
Author: zwelch Date: 2009-06-24 00:46:23 +0200 (Wed, 24 Jun 2009) New Revision: 2376 Modified: trunk/src/ecosboard.c trunk/src/flash/at91sam7.c trunk/src/flash/avrf.c trunk/src/flash/cfi.c trunk/src/flash/flash.c trunk/src/flash/non_cfi.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/stm32x.c trunk/src/flash/str9x.c trunk/src/flash/str9xpec.c trunk/src/helper/command.c trunk/src/helper/fileio.c trunk/src/helper/ioutil.c trunk/src/helper/jim-eventloop.c trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/helper/log.h trunk/src/helper/replacements.h trunk/src/jtag/amt_jtagaccel.c trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/bitq.c trunk/src/jtag/core.c trunk/src/jtag/driver.c trunk/src/jtag/dummy.c trunk/src/jtag/ft2232.c trunk/src/jtag/gw16012.c trunk/src/jtag/interface.c trunk/src/jtag/interface.h trunk/src/jtag/parport.c trunk/src/jtag/rlink/dtc_cmd.h trunk/src/jtag/rlink/rlink.c trunk/src/jtag/tcl.c trunk/src/jtag/vsllink.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/openocd.c trunk/src/pld/virtex2.c trunk/src/server/gdb_server.c trunk/src/server/httpd.c trunk/src/server/server.c trunk/src/svf/svf.c trunk/src/target/arm11.c trunk/src/target/arm720t.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm966e.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.h trunk/src/target/armv4_5.c trunk/src/target/armv7m.c trunk/src/target/armv7m.h trunk/src/target/cortex_a8.c trunk/src/target/cortex_m3.c trunk/src/target/embeddedice.h trunk/src/target/etb.c trunk/src/target/image.c trunk/src/target/mips32.c trunk/src/target/mips32_pracc.c trunk/src/target/mips32_pracc.h trunk/src/target/mips_m4k.c trunk/src/target/target.c trunk/src/target/target.h trunk/src/target/target_request.c trunk/src/target/target_type.h trunk/src/target/trace.c trunk/src/target/xscale.c trunk/src/xsvf/xsvf.c Log: Remove whitespace that occurs after '('. - Replace '([ \t]*' with '('. Modified: trunk/src/ecosboard.c =================================================================== --- trunk/src/ecosboard.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/ecosboard.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -93,7 +93,7 @@ (int (*)(const char *, int))open, close, (int (*)(int, const void *, int))write, - ( int (*)(int, void *, int))read + (int (*)(int, void *, int))read }; #endif @@ -253,7 +253,7 @@ void copydir(char *name, char *destdir); #if 0 -MTAB_ENTRY( romfs_mte1, +MTAB_ENTRY(romfs_mte1, "/rom", "romfs", "", @@ -1130,7 +1130,7 @@ // For simplicity we use _FILESYSTEM synchronization for all accesses since // we should never block in any filesystem operations. #if 1 -FSTAB_ENTRY( tftpfs_fste, "tftpfs", 0, +FSTAB_ENTRY(tftpfs_fste, "tftpfs", 0, CYG_SYNCMODE_NONE, tftpfs_mount, tftpfs_umount, @@ -1151,7 +1151,7 @@ // mtab entry. // This defines a single ROMFS loaded into ROM at the configured address // -// MTAB_ENTRY( rom_mte, // structure name +// MTAB_ENTRY(rom_mte, // structure name // "/rom", // mount point // "romfs", // FIlesystem type // "", // hardware device @@ -1459,7 +1459,7 @@ // This defines the entry in the filesystem table. // For simplicity we use _FILESYSTEM synchronization for all accesses since // we should never block in any filesystem operations. -FSTAB_ENTRY( logfs_fste, "logfs", 0, +FSTAB_ENTRY(logfs_fste, "logfs", 0, CYG_SYNCMODE_FILE_FILESYSTEM | CYG_SYNCMODE_IO_FILESYSTEM, logfs_mount, logfs_umount, Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -187,7 +187,7 @@ } /* Prescaler adjust */ - if ( (((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0) ) + if ((((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0) ) { at91sam7_info->mck_valid = 0; at91sam7_info->mck_freq = 0; @@ -707,7 +707,7 @@ at91sam7_info->num_lockbits_on = 0; for (lock_pos = 0; lock_pos < bank->num_sectors; lock_pos++) { - if ( ((status >> (16 + lock_pos))&(0x0001)) == 1) + if (((status >> (16 + lock_pos))&(0x0001)) == 1) { at91sam7_info->num_lockbits_on++; bank->sectors[lock_pos].is_protected = 1; @@ -725,7 +725,7 @@ at91sam7_info->num_nvmbits_on = 0; for (gpnvm_pos = 0; gpnvm_pos < at91sam7_info->num_nvmbits; gpnvm_pos++) { - if ( ((status >> (8 + gpnvm_pos))&(0x01)) == 1) + if (((status >> (8 + gpnvm_pos))&(0x01)) == 1) { at91sam7_info->num_nvmbits_on++; } @@ -907,7 +907,7 @@ buffer[pos] = 0xFF; } - if ( at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK) + if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK) { return ERROR_FLASH_OPERATION_FAILED; } Modified: trunk/src/flash/avrf.c =================================================================== --- trunk/src/flash/avrf.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/avrf.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -323,7 +323,7 @@ return ERROR_FAIL; } - LOG_INFO( "device id = 0x%08" PRIx32 "", device_id ); + LOG_INFO("device id = 0x%08" PRIx32 "", device_id ); if (EXTRACT_MFG(device_id) != 0x1F) { LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); @@ -402,7 +402,7 @@ return ERROR_FAIL; } - LOG_INFO( "device id = 0x%08" PRIx32 "", device_id ); + LOG_INFO("device id = 0x%08" PRIx32 "", device_id ); if (EXTRACT_MFG(device_id) != 0x1F) { LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/cfi.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -1154,7 +1154,7 @@ /* flash write code */ if (!cfi_info->write_algorithm) { - if ( target_code_size > sizeof(target_code) ) + if (target_code_size > sizeof(target_code) ) { LOG_WARNING("Internal error - target code buffer to small. Increase CFI_MAX_INTEL_CODESIZE and recompile."); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/flash.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -793,7 +793,7 @@ for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) { - cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) ); + cur_size = MIN((count*wordsize - wrote), sizeof(chunk) ); flash_bank_t *bank; bank = get_flash_bank_by_addr(target, address); if (bank == NULL) @@ -994,7 +994,7 @@ } } - if ( first == -1 || last == -1 ) + if (first == -1 || last == -1 ) return ERROR_OK; return flash_driver_erase(c, first, last); @@ -1127,7 +1127,7 @@ if (erase) { /* calculate and erase sectors */ - retval = flash_erase_address_range( target, run_address, run_size ); + retval = flash_erase_address_range(target, run_address, run_size ); } if (retval == ERROR_OK) Modified: trunk/src/flash/non_cfi.c =================================================================== --- trunk/src/flash/non_cfi.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/non_cfi.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -114,10 +114,10 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 1, 16*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 32*KB), - ERASE_REGION( 7, 64*KB) + ERASE_REGION(1, 16*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 32*KB), + ERASE_REGION(7, 64*KB) } }, { @@ -131,10 +131,10 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 7, 64*KB), - ERASE_REGION( 1, 32*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 16*KB) + ERASE_REGION(7, 64*KB), + ERASE_REGION(1, 32*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 16*KB) } }, @@ -236,10 +236,10 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 1, 16*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 32*KB), - ERASE_REGION( 7, 64*KB) + ERASE_REGION(1, 16*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 32*KB), + ERASE_REGION(7, 64*KB) } }, { @@ -253,10 +253,10 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 7, 64*KB), - ERASE_REGION( 1, 32*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 16*KB) + ERASE_REGION(7, 64*KB), + ERASE_REGION(1, 32*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 16*KB) } }, { @@ -270,9 +270,9 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 1, 16*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 32*KB), + ERASE_REGION(1, 16*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 32*KB), ERASE_REGION(15, 64*KB) } }, @@ -287,9 +287,9 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 1, 16*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 32*KB), + ERASE_REGION(1, 16*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 32*KB), ERASE_REGION(15, 64*KB) } }, @@ -304,9 +304,9 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 1, 16*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 32*KB), + ERASE_REGION(1, 16*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 32*KB), ERASE_REGION(15, 64*KB) } }, @@ -322,9 +322,9 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 1, 16*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 32*KB), + ERASE_REGION(1, 16*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 32*KB), ERASE_REGION(31, 64*KB) } }, @@ -340,9 +340,9 @@ .erase_region_info = { ERASE_REGION(31, 64*KB), - ERASE_REGION( 1, 32*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 16*KB) + ERASE_REGION(1, 32*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 16*KB) } }, { @@ -356,8 +356,8 @@ .num_erase_regions = 3, .erase_region_info = { - ERASE_REGION( 8, 8*KB), - ERASE_REGION( 2, 32*KB), + ERASE_REGION(8, 8*KB), + ERASE_REGION(2, 32*KB), ERASE_REGION(30, 64*KB) } }, @@ -373,8 +373,8 @@ .erase_region_info = { ERASE_REGION(30, 64*KB), - ERASE_REGION( 2, 32*KB), - ERASE_REGION( 8, 8*KB) + ERASE_REGION(2, 32*KB), + ERASE_REGION(8, 8*KB) } }, { @@ -388,9 +388,9 @@ .num_erase_regions = 4, .erase_region_info = { - ERASE_REGION( 1, 16*KB), - ERASE_REGION( 2, 8*KB), - ERASE_REGION( 1, 32*KB), + ERASE_REGION(1, 16*KB), + ERASE_REGION(2, 8*KB), + ERASE_REGION(1, 32*KB), ERASE_REGION(15, 64*KB) } }, Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -189,7 +189,7 @@ unsigned char *flash_ptr; flash_ptr = (uint8 *)FLASH_AREA_ADDR + adr; - for ( ;len; len--) { + for (;len; len--) { if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE; } return FLASH_STAT_OK; Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -229,9 +229,9 @@ { LOG_DEBUG("Erasing entire program flash"); status = pic32mx_nvm_exec(bank, NVMCON_OP_PFM_ERASE, 50); - if ( status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR ) return ERROR_FLASH_OPERATION_FAILED; return ERROR_OK; } @@ -245,9 +245,9 @@ status = pic32mx_nvm_exec(bank, NVMCON_OP_PAGE_ERASE, 10); - if ( status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR ) return ERROR_FLASH_OPERATION_FAILED; bank->sectors[i].is_erased = 1; } @@ -313,7 +313,7 @@ reg = (i / pic32mx_info->ppage_size) / 8; bit = (i / pic32mx_info->ppage_size) - (reg * 8); - if ( set ) + if (set ) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -327,7 +327,7 @@ reg = (i / pic32mx_info->ppage_size) / 8; bit = (i / pic32mx_info->ppage_size) - (reg * 8); - if ( set ) + if (set ) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -434,12 +434,12 @@ } #endif status = pic32mx_write_row(bank, address, source->address); - if ( status & NVMCON_NVMERR ) { + if (status & NVMCON_NVMERR ) { LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } - if ( status & NVMCON_LVDERR ) { + if (status & NVMCON_LVDERR ) { LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; @@ -458,12 +458,12 @@ memcpy(&value, buffer, sizeof(uint32_t)); uint32_t status = pic32mx_write_word(bank, address, value); - if ( status & NVMCON_NVMERR ) { + if (status & NVMCON_NVMERR ) { LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } - if ( status & NVMCON_LVDERR ) { + if (status & NVMCON_LVDERR ) { LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; @@ -564,9 +564,9 @@ memcpy(&value, buffer + bytes_written, sizeof(uint32_t)); status = pic32mx_write_word(bank, address, value); - if ( status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR ) return ERROR_FLASH_OPERATION_FAILED; bytes_written += 4; @@ -580,9 +580,9 @@ memcpy(&value, buffer + bytes_written, bytes_remaining); status = pic32mx_write_word(bank, address, value); - if ( status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR ) return ERROR_FLASH_OPERATION_FAILED; } @@ -603,14 +603,14 @@ pic32mx_info->probed = 0; device_id = ejtag_info->idcode; - LOG_INFO( "device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)", + LOG_INFO("device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)", device_id, (unsigned)((device_id >> 1)&0x7ff), (unsigned)((device_id >> 12)&0xff), (unsigned)((device_id >> 20)&0xfff) ); if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) { - LOG_WARNING( "Cannot identify target as a PIC32MX family." ); + LOG_WARNING("Cannot identify target as a PIC32MX family." ); return ERROR_FLASH_OPERATION_FAILED; } @@ -626,7 +626,7 @@ break; } if (pic32mx_devs[i].name == NULL) { - LOG_WARNING( "Cannot identify target as a PIC32MX family." ); + LOG_WARNING("Cannot identify target as a PIC32MX family." ); return ERROR_FLASH_OPERATION_FAILED; } } @@ -646,7 +646,7 @@ } #endif - LOG_INFO( "flash size = %dkbytes", num_pages ); + LOG_INFO("flash size = %dkbytes", num_pages ); /* calculate numbers of pages */ num_pages /= (page_size / 1024); @@ -847,13 +847,13 @@ target_write_u32(target, PIC32MX_FLASH_CR, FLASH_LOCK); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) { LOG_ERROR("pic32mx device protected"); return ERROR_OK; } - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) { LOG_ERROR("pic32mx device programming failed"); return ERROR_OK; @@ -931,9 +931,9 @@ res = ERROR_OK; status = pic32mx_write_word(bank, address, value); - if ( status & NVMCON_NVMERR ) + if (status & NVMCON_NVMERR ) res = ERROR_FLASH_OPERATION_FAILED; - if ( status & NVMCON_LVDERR ) + if (status & NVMCON_LVDERR ) res = ERROR_FLASH_OPERATION_FAILED; if (res == ERROR_OK) Modified: trunk/src/flash/stm32x.c =================================================================== --- trunk/src/flash/stm32x.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/stm32x.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -182,9 +182,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; /* clear readout protection and complementary option bytes @@ -218,9 +218,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 1 */ @@ -228,9 +228,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 2 */ @@ -238,9 +238,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 3 */ @@ -248,9 +248,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; /* write protection byte 4 */ @@ -258,9 +258,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; /* write readout protection bit */ @@ -268,9 +268,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK); @@ -338,7 +338,7 @@ { set = 1; - if ( protection & (1 << i)) + if (protection & (1 << i)) set = 0; for (s = 0; s < stm32x_info->ppage_size; s++) @@ -378,9 +378,9 @@ status = stm32x_wait_status_busy(bank, 10); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) return ERROR_FLASH_OPERATION_FAILED; - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) return ERROR_FLASH_OPERATION_FAILED; bank->sectors[i].is_erased = 1; } @@ -445,7 +445,7 @@ reg = (i / stm32x_info->ppage_size) / 8; bit = (i / stm32x_info->ppage_size) - (reg * 8); - if ( set ) + if (set ) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -459,7 +459,7 @@ reg = (i / stm32x_info->ppage_size) / 8; bit = (i / stm32x_info->ppage_size) - (reg * 8); - if ( set ) + if (set ) prot_reg[reg] &= ~(1 << bit); else prot_reg[reg] |= (1 << bit); @@ -658,12 +658,12 @@ status = stm32x_wait_status_busy(bank, 5); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) { LOG_ERROR("flash memory not erased before writing"); return ERROR_FLASH_OPERATION_FAILED; } - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) { LOG_ERROR("flash memory write protected"); return ERROR_FLASH_OPERATION_FAILED; @@ -684,12 +684,12 @@ status = stm32x_wait_status_busy(bank, 5); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) { LOG_ERROR("flash memory not erased before writing"); return ERROR_FLASH_OPERATION_FAILED; } - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) { LOG_ERROR("flash memory write protected"); return ERROR_FLASH_OPERATION_FAILED; @@ -720,7 +720,7 @@ /* read stm32 device id register */ target_read_u32(target, 0xE0042000, &device_id); - LOG_INFO( "device id = 0x%08" PRIx32 "", device_id ); + LOG_INFO("device id = 0x%08" PRIx32 "", device_id ); /* get flash size from target */ if (target_read_u16(target, 0x1FFFF7E0, &num_pages) != ERROR_OK) @@ -740,7 +740,7 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revA */ - LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 128k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 128k flash" ); num_pages = 128; } } @@ -755,7 +755,7 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revA */ - LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 32k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 32k flash" ); num_pages = 32; } } @@ -770,7 +770,7 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revZ */ - LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 512k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash" ); num_pages = 512; } } @@ -785,17 +785,17 @@ if (num_pages == 0xffff) { /* number of sectors incorrect on revZ */ - LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 256k flash" ); + LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 256k flash" ); num_pages = 256; } } else { - LOG_WARNING( "Cannot identify target as a STM32 family." ); + LOG_WARNING("Cannot identify target as a STM32 family." ); return ERROR_FLASH_OPERATION_FAILED; } - LOG_INFO( "flash size = %dkbytes", num_pages ); + LOG_INFO("flash size = %dkbytes", num_pages ); /* calculate numbers of pages */ num_pages /= (page_size / 1024); @@ -1188,13 +1188,13 @@ target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK); - if ( status & FLASH_WRPRTERR ) + if (status & FLASH_WRPRTERR ) { LOG_ERROR("stm32x device protected"); return ERROR_OK; } - if ( status & FLASH_PGERR ) + if (status & FLASH_PGERR ) { LOG_ERROR("stm32x device programming failed"); return ERROR_OK; Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/str9x.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -305,7 +305,7 @@ { return retval; } - if ( status & 0x80 ) + if (status & 0x80 ) break; alive_sleep(1); } @@ -327,7 +327,7 @@ return retval; } - if ( status & 0x22 ) + if (status & 0x22 ) { LOG_ERROR("error erasing flash bank, status: 0x%x", status); return ERROR_FLASH_OPERATION_FAILED; @@ -365,7 +365,7 @@ adr = bank->base + bank->sectors[i].offset; target_write_u16(target, adr, 0x60); - if ( set ) + if (set ) target_write_u16(target, adr, 0x01); else target_write_u16(target, adr, 0xD0); @@ -578,7 +578,7 @@ for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); - if ( status & 0x80 ) + if (status & 0x80 ) break; alive_sleep(1); } @@ -627,7 +627,7 @@ for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); - if ( status & 0x80 ) + if (status & 0x80 ) break; alive_sleep(1); } Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/flash/str9xpec.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -101,7 +101,7 @@ int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state) { - if ( tap == NULL ){ + if (tap == NULL ){ return ERROR_TARGET_INVALID; } @@ -325,7 +325,7 @@ arm7_9 = armv4_5->arch_info; jtag_info = &arm7_9->jtag_info; - str9xpec_info->tap = jtag_tap_by_position( jtag_info->tap->abs_chain_position - 1); + str9xpec_info->tap = jtag_tap_by_position(jtag_info->tap->abs_chain_position - 1); str9xpec_info->isc_enable = 0; str9xpec_build_block_list(bank); @@ -349,7 +349,7 @@ tap = str9xpec_info->tap; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable( bank ); + str9xpec_isc_enable(bank ); } if (!str9xpec_info->isc_enable) { @@ -438,7 +438,7 @@ tap = str9xpec_info->tap; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable( bank ); + str9xpec_isc_enable(bank ); } if (!str9xpec_info->isc_enable) { @@ -518,7 +518,7 @@ tap = str9xpec_info->tap; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable( bank ); + str9xpec_isc_enable(bank ); } if (!str9xpec_info->isc_enable) { @@ -575,7 +575,7 @@ /* last bank: 0xFF signals a full device protect */ if (last == 0xFF) { - if ( set ) + if (set ) { status = str9xpec_lock_device(bank); } @@ -589,7 +589,7 @@ { for (i = first; i <= last; i++) { - if ( set ) + if (set ) buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 1); else buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 0); @@ -919,13 +919,13 @@ tap = str9xpec_info->tap; /* erase config options first */ - status = str9xpec_erase_area( bank, 0xFE, 0xFE ); + status = str9xpec_erase_area(bank, 0xFE, 0xFE ); if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS) return status; if (!str9xpec_info->isc_enable) { - str9xpec_isc_enable( bank ); + str9xpec_isc_enable(bank ); } if (!str9xpec_info->isc_enable) { Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/helper/command.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -348,8 +348,8 @@ void command_output_text(command_context_t *context, const char *data) { - if ( context && context->output_handler && data ){ - context->output_handler( context, data ); + if (context && context->output_handler && data ){ + context->output_handler(context, data ); } } @@ -704,7 +704,7 @@ Jim_RegisterCoreCommands(interp); #endif -#if defined( _MSC_VER ) +#if defined(_MSC_VER ) /* WinXX - is generic, the forward * looking problem is this: * @@ -713,18 +713,18 @@ * "winxx" is generic. */ HostOs = "winxx"; -#elif defined( __LINUX__) +#elif defined(__LINUX__) HostOs = "linux"; -#elif defined( __DARWIN__ ) +#elif defined(__DARWIN__ ) HostOs = "darwin"; -#elif defined( __CYGWIN__ ) +#elif defined(__CYGWIN__ ) HostOs = "cygwin"; -#elif defined( __MINGW32__ ) +#elif defined(__MINGW32__ ) HostOs = "mingw32"; #else HostOs = "other"; #endif - Jim_SetGlobalVariableStr( interp, "ocd_HOSTOS", Jim_NewStringObj( interp, HostOs , strlen(HostOs)) ); + Jim_SetGlobalVariableStr(interp, "ocd_HOSTOS", Jim_NewStringObj(interp, HostOs , strlen(HostOs)) ); Jim_CreateCommand(interp, "ocd_find", jim_find, NULL, NULL); Jim_CreateCommand(interp, "echo", jim_echo, NULL, NULL); Modified: trunk/src/helper/fileio.c =================================================================== --- trunk/src/helper/fileio.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/helper/fileio.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -182,7 +182,7 @@ static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buffer) { - if ( fgets(buffer, size, fileio->file) == NULL) + if (fgets(buffer, size, fileio->file) == NULL) return ERROR_FILEIO_OPERATION_FAILED; return ERROR_OK; Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/helper/ioutil.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -325,34 +325,34 @@ fd1 = open(name1, O_WRONLY | O_CREAT, 0664); if (fd1 < 0) - SHOW_RESULT( open, fd1 ); + SHOW_RESULT(open, fd1 ); fd2 = open(name2, O_RDONLY); if (fd2 < 0) - SHOW_RESULT( open, fd2 ); + SHOW_RESULT(open, fd2 ); for (;;) { done = read(fd2, buf, IOSIZE ); if (done < 0) { - SHOW_RESULT( read, done ); + SHOW_RESULT(read, done ); break; } - if ( done == 0 ) break; + if (done == 0 ) break; wrote = write(fd1, buf, done); - if ( wrote != done ) SHOW_RESULT( write, wrote ); + if (wrote != done ) SHOW_RESULT(write, wrote ); - if ( wrote != done ) break; + if (wrote != done ) break; } err = close(fd1); - if ( err < 0 ) SHOW_RESULT( close, err ); + if (err < 0 ) SHOW_RESULT(close, err ); err = close(fd2); - if ( err < 0 ) SHOW_RESULT( close, err ); + if (err < 0 ) SHOW_RESULT(close, err ); } @@ -372,7 +372,7 @@ } dirp = opendir(name); - if ( dirp == NULL ) SHOW_RESULT( opendir, -1 ); + if (dirp == NULL ) SHOW_RESULT(opendir, -1 ); for (;;) { @@ -421,7 +421,7 @@ } err = closedir(dirp); - if ( err < 0 ) SHOW_RESULT( stat, err ); + if (err < 0 ) SHOW_RESULT(stat, err ); } Modified: trunk/src/helper/jim-eventloop.c =================================================================== --- trunk/src/helper/jim-eventloop.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/helper/jim-eventloop.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -298,7 +298,7 @@ JimGetTime(&now_sec, &now_ms); tvp = &tv; dt = 1000 * (shortest->when_sec - now_sec); - dt += ( shortest->when_ms - now_ms); + dt += (shortest->when_ms - now_ms); if (dt < 0) { dt = 1; } @@ -498,7 +498,7 @@ int tlen ; jim_wide remain = 0; const char *tok = Jim_GetString(argv[2], &tlen); - if ( sscanf(tok,"after#%lld",&id) == 1) { + if (sscanf(tok,"after#%lld",&id) == 1) { remain = Jim_DeleteTimeHandler(interp, id); if (remain > -2) { Jim_SetResult(interp, Jim_NewIntObj(interp, remain)); Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/helper/jim.c 2009-06-23 22:46:23 UTC (rev 2376) @@ -117,25 +117,25 @@ * ---------------------------------------------------------------------------*/ static char * -jim_vasprintf( const char *fmt, va_list ap ) +jim_vasprintf(const char *fmt, va_list ap ) { #ifndef HAVE_VASPRINTF /* yucky way */ static char buf[2048]; - vsnprintf( buf, sizeof(buf), fmt, ap ); + vsnprintf(buf, sizeof(buf), fmt, ap ); /* garentee termination */ buf[sizeof(buf)-1] = 0; #else char *buf; int result; - result = vasprintf( &buf, fmt, ap ); + result = vasprintf(&buf, fmt, ap ); if (result < 0) exit(-1); #endif return buf; } static void -jim_vasprintf_done( void *buf ) +jim_vasprintf_done(void *buf ) { #ifndef HAVE_VASPRINTF (void)(buf); @@ -438,7 +438,7 @@ char *endptr; *intPtr = strtol(str, &endptr, 10); - if ( (str[0] == '\0') || (str == endptr) ) + if ((str[0] == '\0') || (str == endptr) ) return JIM_ERR; if (endptr[0] != '\0') { while (*endptr) { @@ -544,10 +544,10 @@ #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 ); + 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(); } @@ -2055,17 +2055,17 @@ StringAppendString(objPtr, str, len); } -void Jim_AppendString_sprintf( Jim_Interp *interp, Jim_Obj *objPtr, const char *fmt, ... ) +void Jim_AppendString_sprintf(Jim_Interp *interp, Jim_Obj *objPtr, const char *fmt, ... ) { char *buf; va_list ap; - va_start( ap, fmt ); - buf = jim_vasprintf( fmt, ap ); + va_start(ap, fmt ); + buf = jim_vasprintf(fmt, ap ); va_end(ap); - if ( buf ){ - Jim_AppendString( interp, objPtr, buf, -1 ); + if (buf ){ + Jim_AppendString(interp, objPtr, buf, -1 ); jim_vasprintf_done(buf); } } @@ -2283,10 +2283,10 @@ haveprec = 0; prec = -1; /* not found yet */ next_fmt: - if ( fmtLen <= 0 ){ + if (fmtLen <= 0 ){ break; } - switch ( *fmt ){ + switch (*fmt ){ /* terminals */ case 'b': /* binary - not all printfs() do this */ case 's': /* string */ @@ -2341,11 +2341,11 @@ case '8': case '9': accum = 0; - while ( isdigit(*fmt) && (fmtLen > 0) ){ + while (isdigit(*fmt) && (fmtLen > 0) ){ accum = (accum * 10) + (*fmt - '0'); fmt++; fmtLen--; } - if ( inprec ){ + if (inprec ){ haveprec = 1; prec = accum; } else { @@ -2356,24 +2356,24 @@ /* suck up the next item as an integer */ fmt++; fmtLen--; objc--; - if ( objc <= 0 ){ + if (objc <= 0 ){ goto not_enough_args; } - if ( Jim_GetWide(interp,objv[0],&wideValue )== JIM_ERR ){ + if (Jim_GetWide(interp,objv[0],&wideValue )== JIM_ERR ){ Jim_FreeNewObj(interp, resObjPtr ); return NULL; } - if ( inprec ){ + if (inprec ){ haveprec = 1; prec = wideValue; - if ( prec < 0 ){ + if (prec < 0 ){ /* man 3 printf says */ /* if prec is negative, it is zero */ prec = 0; } } else { width = wideValue; - if ( width < 0 ){ + if (width < 0 ){ ljust = 1; width = -width; } @@ -2402,33 +2402,33 @@ */ cp = fmt_str; *cp++ = '%'; - if ( altfm ){ + if (altfm ){ *cp++ = '#'; } - if ( forceplus ){ + if (forceplus ){ *cp++ = '+'; - } else if ( spad ){ + } else if (spad ){ /* PLUS overrides */ *cp++ = ' '; } - if ( ljust ){ + if (ljust ){ *cp++ = '-'; } - if ( zpad ){ + if (zpad ){ *cp++ = '0'; } - if ( width > 0 ){ - sprintf( cp, "%d", width ); + if (width > 0 ){ + sprintf(cp, "%d", width ); /* skip ahead */ cp = strchr(cp,0); } /* did we find a period? */ - if ( inprec ){ + if (inprec ){ /* then add it */ *cp++ = '.'; /* did something occur after the period? */ - if ( haveprec ){ - sprintf( cp, "%d", prec ); + if (haveprec ){ + sprintf(cp, "%d", prec ); } cp = strchr(cp,0); } @@ -2441,7 +2441,7 @@ *cp++ = 's'; *cp = 0; /* BUG: we do not handled embeded NULLs */ - snprintf( sprintf_buf, JIM_MAX_FMT, fmt_str, Jim_GetString( objv[0], NULL )); + snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, Jim_GetString(objv[0], NULL )); break; case 'c': *cp++ = 'c'; @@ -2451,7 +2451,7 @@ return NULL; } c = (char) wideValue; - snprintf( sprintf_buf, JIM_MAX_FMT, fmt_str, c ); + snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, c ); break; case 'f': case 'F': @@ -2461,11 +2461,11 @@ case 'E': *cp++ = *fmt; *cp = 0; - if ( Jim_GetDouble( interp, objv[0], &doubleValue ) == JIM_ERR ){ - Jim_FreeNewObj( interp, resObjPtr ); + if (Jim_GetDouble(interp, objv[0], &doubleValue ) == JIM_ERR ){ + Jim_FreeNewObj(interp, resObjPtr ); return NULL; } - snprintf( sprintf_buf, JIM_MAX_FMT, fmt_str, doubleValue ); + snprintf(sprintf_buf, JIM_MAX_FMT, fmt_str, doubleValue ); break; case 'b': case 'd': @@ -2475,7 +2475,7 @@ case 'x': case 'X': /* jim widevaluse are 64bit */ - if ( sizeof(jim_wide) == sizeof(long long) ){ + if (sizeof(jim_wide) == sizeof(long long) ){ *cp++ = 'l'; *cp++ = 'l'; } else { @@ -2509,7 +2509,7 @@ #endif sprintf_buf[ JIM_MAX_FMT - 1] = 0; - Jim_AppendString( interp, resObjPtr, sprintf_buf, strlen(sprintf_buf) ); + Jim_AppendString(interp, resObjPtr, sprintf_buf, strlen(sprintf_buf) ); /* next obj */ objv++; fmt++; @@ -2626,13 +2626,13 @@ Jim_Nvp *n; int e; - e = Jim_Nvp_name2value_obj( interp, nvp_table, objPtr, &n ); - if ( e == JIM_ERR ){ + e = Jim_Nvp_name2value_obj(interp, nvp_table, objPtr, &n ); + if (e == JIM_ERR ){ return e; } /* Success? found? */ - if ( n->name ){ + if (n->name ){ /* remove const */ *result = (Jim_Nvp *)n; return JIM_OK; @@ -4424,11 +4424,11 @@ i->cookie_stdin = stdin; i->cookie_stdout = stdout; i->cookie_stderr = stderr; - i->cb_fwrite = ((size_t (*)( const void *, size_t, size_t, void *))(fwrite)); - i->cb_fread = ((size_t (*)( void *, size_t, size_t, void *))(fread)); - i->cb_vfprintf = ((int (*)( void *, const char *fmt, va_list ))(vfprintf)); - i->cb_fflush = ((int (*)( void *))(fflush)); - i->cb_fgets = ((char * (*)( char *, int, void *))(fgets)); + i->cb_fwrite = ((size_t (*)(const void *, size_t, size_t, void *))(fwrite)); + i->cb_fread = ((size_t (*)(void *, size_t, size_t, void *))(fread)); + i->cb_vfprintf = ((int (*)(void *, const char *fmt, va_list ))(vfprintf)); + i->cb_fflush = ((int (*)(void *))(fflush)); + i->cb_fgets = ((char * (*)(char *, int, void *))(fgets)); /* Note that we can create objects only after the * interpreter liveList and freeList pointers are @@ -4498,23 +4498,23 @@ if (i->liveList != NULL) { Jim_Obj *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); + Jim_fprintf(i, i->cookie_stdout,JIM_NL "-------------------------------------" JIM_NL); + Jim_fprintf(i, i->cookie_stdout,"Objects still in the free list:" JIM_NL); while (objPtr) { const char *type = objPtr->typePtr ? objPtr->typePtr->name : ""; - Jim_fprintf( i, i->cookie_stdout,"%p \"%-10s\": '%.20s' (refCount: %d)" JIM_NL, + Jim_fprintf(i, i->cookie_stdout,"%p \"%-10s\": '%.20s' (refCount: %d)" JIM_NL, objPtr, type, objPtr->bytes ? objPtr->bytes : "(null)", objPtr->refCount); if (objPtr->typePtr == &sourceObjType) { - Jim_fprintf( i, i->cookie_stdout, "FILE %s LINE %d" JIM_NL, + Jim_fprintf(i, i->cookie_stdout, "FILE %s LINE %d" JIM_NL, objPtr->internalRep.sourceValue.fileName, objPtr->internalRep.sourceValue.lineNumber); } objPtr = objPtr->nextObjPtr; } - Jim_fprintf( i, i->cookie_stdout, "-------------------------------------" JIM_NL JIM_NL); + Jim_fprintf(i, i->cookie_stdout, "-------------------------------------" JIM_NL JIM_NL); Jim_Panic(i,"Live list non empty freeing the interpreter! Leak?"); } /* Free all the freed objects. */ @@ -6352,7 +6352,7 @@ if (*pc->p == '-') { pc->p++; pc->len--; } - while ( isdigit((int)*pc->p) + while (isdigit((int)*pc->p) || (allowhex && isxdigit((int)*pc->p) ) || (allowdot && *pc->p == '.') || (pc->p-pc->tstart == 1 && *pc->tstart == '0' && @@ -8684,7 +8684,7 @@ Jim_Obj **eargv = NULL; for (j = 0; j < argc; j++) { - Jim_ExpandArgument( interp, &eargv, &eargc, + Jim_ExpandArgument(interp, &eargv, &eargc, ecs[j] < 0, argv[j]); } if (argv != sargv) @@ -8894,8 +8894,8 @@ Jim_IncrRefCount(scriptObjPtr); - if ( filename ){ - JimSetSourceInfo( interp, scriptObjPtr, filename, lineno ); + if (filename ){ + JimSetSourceInfo(interp, scriptObjPtr, filename, lineno ); } retval = Jim_EvalObj(interp, scriptObjPtr); @@ -8905,7 +8905,7 @@ int Jim_Eval(Jim_Interp *interp, const char *script) { - return Jim_Eval_Named( interp, script, NULL, 0 ); + return Jim_Eval_Named(interp, script, NULL, 0 ); } @@ -8942,7 +8942,7 @@ Jim_IncrRefCount(objv[1]); if (Jim_EvalObjVector(interp, 2, objv) != JIM_OK) { /* Report the error to stderr. */ - Jim_fprintf( interp, interp->cookie_stderr, "Background error:" JIM_NL); + Jim_fprintf(interp, interp->cookie_stderr, "Background error:" JIM_NL); Jim_PrintErrorMessage(interp); } Jim_DecrRefCount(interp, objv[0]); @@ -8963,7 +8963,7 @@ const int cwd_len = 2048; char *cwd = malloc(cwd_len); Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); - if (!getcwd( cwd, cwd_len )) strcpy(cwd, "unknown"); + if (!getcwd(cwd, cwd_len )) strcpy(cwd, "unknown"); Jim_AppendStrings(interp, Jim_GetResult(interp), "Error loading script \"", filename, "\"", " cwd: ", cwd, @@ -9523,7 +9523,7 @@ } str = Jim_GetString(argv[1], &len); Jim_fwrite(interp, str, 1, len, interp->cookie_stdout); - if (!nonewline) Jim_fprintf( interp, interp->cookie_stdout, JIM_NL); + if (!nonewline) Jim_fprintf(interp, interp->cookie_stdout, JIM_NL); return JIM_OK; } @@ -12320,16 +12320,16 @@ JIM_NONE); line = Jim_GetString(objPtr, NULL); if (*proc) { - Jim_fprintf( interp, interp->cookie_stderr, + Jim_fprintf(interp, interp->cookie_stderr, "in procedure '%s' ", proc); } if (*file) { - Jim_fprintf( interp, interp->cookie_stderr, + Jim_fprintf(interp, interp->cookie_stderr, "called at file \"%s\", line %s", file, line); } if (*file || *proc) { - Jim_fprintf( interp, interp->cookie_stderr, JIM_NL); + Jim_fprintf(interp, interp->cookie_stderr, JIM_NL); } } } @@ -12357,8 +12357,8 @@ else Jim_fprintf(interp,interp->cookie_stdout, "[%d] . ", retcode); } else - Jim_fprintf( interp, interp->cookie_stdout, ". "); - Jim_fflush( interp, interp->cookie_stdout); + Jim_fprintf(interp, interp->cookie_stdout, ". "); + Jim_fflush(interp, interp->cookie_stdout); scriptObjPtr = Jim_NewStringObj(interp, "", 0); Jim_IncrRefCount(scriptObjPtr); while (1) { @@ -12366,7 +12366,7 @@ char state; int len; - if ( Jim_fgets(interp, buf, 1024, interp->cookie_stdin) == NULL) { + if (Jim_fgets(interp, buf, 1024, interp->cookie_stdin) == NULL) { Jim_DecrRefCount(interp, scriptObjPtr); goto out; } @@ -12374,8 +12374,8 @@ str = Jim_GetString(scriptObjPtr, &len); if (Jim_ScriptIsComplete(str, len, &state)) break; - Jim_fprintf( interp, interp->cookie_stdout, "%c> ", state); - Jim_fflush( interp, interp->cookie_stdout); + Jim_fprintf(interp, interp->cookie_stdout, "%c> ", state); + Jim_fflush(interp, interp->cookie_stdout); } retcode = Jim_EvalObj(interp, scriptObjPtr); Jim_DecrRefCount(interp, scriptObjPtr); @@ -12386,8 +12386,8 @@ exit(Jim_GetExitCode(interp)); } else { if (reslen) { - Jim_fwrite( interp, result, 1, reslen, interp->cookie_stdout); - Jim_fprintf( interp,interp->cookie_stdout, JIM_NL); + Jim_fwrite(interp, result, 1, reslen, interp->cookie_stdout); + Jim_fprintf(interp,interp->cookie_stdout, JIM_NL); } } } @@ -12399,66 +12399,66 @@ * Jim's idea of STDIO.. * ---------------------------------------------------------------------------*/ -int Jim_fprintf( Jim_Interp *interp, void *cookie, const char *fmt, ... ) +int Jim_fprintf(Jim_Interp *interp, void *cookie, const char *fmt, ... ) { int r; va_list ap; va_start(ap,fmt); - r = Jim_vfprintf( interp, cookie, fmt,ap ); + r = Jim_vfprintf(interp, cookie, fmt,ap ); va_end(ap); return r; } -int Jim_vfprintf( Jim_Interp *interp, void *cookie, const char *fmt, va_list ap ) +int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap ) { - if ( (interp == NULL) || (interp->cb_vfprintf == NULL) ){ + if ((interp == NULL) || (interp->cb_vfprintf == NULL) ){ errno = ENOTSUP; return -1; } - return (*(interp->cb_vfprintf))( cookie, fmt, ap ); + return (*(interp->cb_vfprintf))(cookie, fmt, ap ); } -size_t Jim_fwrite( Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie ) +size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie ) { - if ( (interp == NULL) || (interp->cb_fwrite == NULL) ){ + if ((interp == NULL) || (interp->cb_fwrite == NULL) ){ errno = ENOTSUP; return 0; } - return (*(interp->cb_fwrite))( ptr, size, n, cookie); + return (*(interp->cb_fwrite))(ptr, size, n, cookie); } -size_t Jim_fread( Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie ) +size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie ) { - if ( (interp == NULL) || (interp->cb_fread == NULL) ){ + if ((interp == NULL) || (interp->cb_fread == NULL) ){ errno = ENOTSUP; return 0; } - return (*(interp->cb_fread))( ptr, size, n, cookie); + return (*(interp->cb_fread))(ptr, size, n, cookie); } -int Jim_fflush( Jim_Interp *interp, void *cookie ) +int Jim_fflush(Jim_Interp *interp, void *cookie ) { - if ( (interp == NULL) || (interp->cb_fflush == NULL) ){ + if ((interp == NULL) || (interp->cb_fflush == NULL) ){ /* pretend all is well */ return 0; } - return (*(interp->cb_fflush))( cookie ); + return (*(interp->cb_fflush))(cookie ); } -char* Jim_fgets( Jim_Interp *interp, char *s, int size, void *cookie ) +char* Jim_fgets(Jim_Interp *interp, char *s, int size, void *cookie ) { - if ( (interp == NULL) || (interp->cb_fgets == NULL) ){ + if ((interp == NULL) || (interp->cb_fgets == NULL) ){ errno = ENOTSUP; return NULL; } - return (*(interp->cb_fgets))( s, size, cookie ); + return (*(interp->cb_fgets))(s, size, cookie ); } Jim_Nvp * -Jim_Nvp_name2value_simple( const Jim_Nvp *p, const char *name ) +Jim_Nvp_name2value_simple(const Jim_Nvp *p, const char *name ) { - while ( p->name ){ - if ( 0 == strcmp( name, p->name ) ){ + while (p->name ){ + if (0 == strcmp(name, p->name ) ){ break; } p++; @@ -12467,10 +12467,10 @@ } Jim_Nvp * -Jim_Nvp_name2value_nocase_simple( const Jim_Nvp *p, const char *name ) +Jim_Nvp_name2value_nocase_simple(const Jim_Nvp *p, const char *name ) { - while ( p->name ){ - if ( 0 == strcasecmp( name, p->name ) ){ + while (p->name ){ + if (0 == strcasecmp(name, p->name ) ){ break; } p++; @@ -12479,32 +12479,32 @@ } int -Jim_Nvp_name2value_obj( Jim_Interp *interp, +Jim_Nvp_name2value_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **result ) { - return Jim_Nvp_name2value( interp, p, Jim_GetString( o, NULL ), result ); + return Jim_Nvp_name2value(interp, p, Jim_GetString(o, NULL ), result ); } int -Jim_Nvp_name2value( Jim_Interp *interp, +Jim_Nvp_name2value(Jim_Interp *interp, const Jim_Nvp *_p, const char *name, Jim_Nvp **result) { const Jim_Nvp *p; - p = Jim_Nvp_name2value_simple( _p, name ); + p = Jim_Nvp_name2value_simple(_p, name ); /* result */ - if ( result ){ + if (result ){ *result = (Jim_Nvp *)(p); } /* found? */ - if ( p->name ){ + if (p->name ){ return JIM_OK; } else { return JIM_ERR; @@ -12512,23 +12512,23 @@ } int -Jim_Nvp_name2value_obj_nocase( Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **puthere ) +Jim_Nvp_name2value_obj_nocase(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **puthere ) { - return Jim_Nvp_name2value_nocase( interp, p, Jim_GetString( o, NULL ), puthere ); + return Jim_Nvp_name2value_nocase(interp, p, Jim_GetString(o, NULL ), puthere ); } int -Jim_Nvp_name2value_nocase( Jim_Interp *interp, const Jim_Nvp *_p, const char *name, Jim_Nvp **puthere ) +Jim_Nvp_name2value_nocase(Jim_Interp *interp, const Jim_Nvp *_p, const char *name, Jim_Nvp **puthere ) { const Jim_Nvp *p; - p = Jim_Nvp_name2value_nocase_simple( _p, name ); + p = Jim_Nvp_name2value_nocase_simple(_p, name ); - if ( puthere ){ + if (puthere ){ *puthere = (Jim_Nvp *)(p); } /* found */ - if ( p->name ){ + if (p->name ){ return JIM_OK; } else { return JIM_ERR; @@ -12537,24 +12537,24 @@ int -Jim_Nvp_value2name_obj( Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **result ) +Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **result ) { int e;; jim_wide w; - e = Jim_GetWide( interp, o, &w ); - if ( e != JIM_OK ){ + e = Jim_GetWide(interp, o, &w ); + if (e != JIM_OK ){ return e; } - return Jim_Nvp_value2name( interp, p, w, result ); + return Jim_Nvp_value2name(interp, p, w, result ); } Jim_Nvp * -Jim_Nvp_value2name_simple( const Jim_Nvp *p, int value ) +Jim_Nvp_value2name_simple(const Jim_Nvp *p, int value ) { - while ( p->name ){ - if ( value == p->value ){ + while (p->name ){ + if (value == p->value ){ break; } p++; @@ -12564,17 +12564,17 @@ int -Jim_Nvp_value2name( Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **result ) +Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **result ) { const Jim_Nvp *p; - p = Jim_Nvp_value2name_simple( _p, value ); + p = Jim_Nvp_value2name_simple(_p, value ); - if ( result ){ + if (result ){ *result = (Jim_Nvp *)(p); } - if ( p->name ){ + if (p->name ){ return JIM_OK; } else { return JIM_ERR; @@ -12583,9 +12583,9 @@ int -Jim_GetOpt_Setup( Jim_GetOptInfo *p, Jim_Interp *interp, int argc, Jim_Obj * const * argv) +Jim_GetOpt_Setup(Jim_GetOptInfo *p, Jim_Interp *interp, int argc, Jim_Obj * const * argv) { - memset( p, 0, sizeof(*p) ); + memset(p, 0, sizeof(*p) ); p->interp = interp; p->argc = argc; p->argv = argv; @@ -12594,37 +12594,37 @@ } void -Jim_GetOpt_Debug( Jim_GetOptInfo *p ) +Jim_GetOpt_Debug(Jim_GetOptInfo *p ) { int x; - Jim_fprintf( p->interp, p->interp->cookie_stderr, "---args---\n"); - for ( x = 0 ; x < p->argc ; x++ ){ - Jim_fprintf( p->interp, p->interp->cookie_stderr, + Jim_fprintf(p->interp, p->interp->cookie_stderr, "---args---\n"); + for (x = 0 ; x < p->argc ; x++ ){ + Jim_fprintf(p->interp, p->interp->cookie_stderr, "%2d) %s\n", x, - Jim_GetString( p->argv[x], NULL ) ); + Jim_GetString(p->argv[x], NULL ) ); } - Jim_fprintf( p->interp, p->interp->cookie_stderr, "-------\n"); + Jim_fprintf(p->interp, p->interp->cookie_stderr, "-------\n"); } int -Jim_GetOpt_Obj( Jim_GetOptInfo *goi, Jim_Obj **puthere ) +Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere ) { Jim_Obj *o; o = NULL; // failure - if ( goi->argc ){ + if (goi->argc ){ // success o = goi->argv[0]; goi->argc -= 1; goi->argv += 1; } - if ( puthere ){ + if (puthere ){ *puthere = o; } - if ( o != NULL ){ + if (o != NULL ){ return JIM_OK; } else { return JIM_ERR; @@ -12632,17 +12632,17 @@ } int -Jim_GetOpt_String( Jim_GetOptInfo *goi, char **puthere, int *len ) +Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len ) { int r; Jim_Obj *o; const char *cp; - r = Jim_GetOpt_Obj( goi, &o ); - if ( r == JIM_OK ){ - cp = Jim_GetString( o, len ); - if ( puthere ){ + r = Jim_GetOpt_Obj(goi, &o ); + if (r == JIM_OK ){ + cp = Jim_GetString(o, len ); + if (puthere ){ /* remove const */ *puthere = (char *)(cp); } @@ -12651,47 +12651,47 @@ } int -Jim_GetOpt_Double( Jim_GetOptInfo *goi, double *puthere ) +Jim_GetOpt_Double(Jim_GetOptInfo *goi, double *puthere ) { int r; Jim_Obj *o; double _safe; - if ( puthere == NULL ){ + if (puthere == NULL ){ puthere = &_safe; } - r = Jim_GetOpt_Obj( goi, &o ); - if ( r == JIM_OK ){ - r = Jim_GetDouble( goi->interp, o, puthere ); - if ( r != JIM_OK ){ - Jim_SetResult_sprintf( goi->interp, + r = Jim_GetOpt_Obj(goi, &o ); + if (r == JIM_OK ){ + r = Jim_GetDouble(goi->interp, o, puthere ); + if (r != JIM_OK ){ + Jim_SetResult_sprintf(goi->interp, "not a number: %s", - Jim_GetString( o, NULL ) ); + Jim_GetString(o, NULL ) ); } } return r; } int -Jim_GetOpt_Wide( Jim_GetOptInfo *goi, jim_wide *puthere ) +Jim_GetOpt_Wide(Jim_GetOptInfo *goi, jim_wide *puthere ) { int r; Jim_Obj *o; jim_wide _safe; - if ( puthere == NULL ){ + if (puthere == NULL ){ puthere = &_safe; } - r = Jim_GetOpt_Obj( goi, &o ); - if ( r == JIM_OK ){ - r = Jim_GetWide( goi->interp, o, puthere ); + r = Jim_GetOpt_Obj(goi, &o ); + if (r == JIM_OK ){ + r = Jim_GetWide(goi->interp, o, puthere ); } return r; } -int Jim_GetOpt_Nvp( Jim_GetOptInfo *goi, +int Jim_GetOpt_Nvp(Jim_GetOptInfo *goi, const Jim_Nvp *nvp, Jim_Nvp **puthere) { @@ -12699,13 +12699,13 @@ Jim_Obj *o; int e; - if ( puthere == NULL ){ + if (puthere == NULL ){ puthere = &_safe; } - e = Jim_GetOpt_Obj( goi, &o ); - if ( e == JIM_OK ){ - e = Jim_Nvp_name2value_obj( goi->interp, + e = Jim_GetOpt_Obj(goi, &o ); + if (e == JIM_OK ){ + e = Jim_Nvp_name2value_obj(goi->interp, nvp, o, puthere ); @@ -12715,17 +12715,17 @@ } void -Jim_GetOpt_NvpUnknown( Jim_GetOptInfo *goi, +Jim_GetOpt_NvpUnknown(Jim_GetOptInfo *goi, const Jim_Nvp *nvptable, int hadprefix ) { - if ( hadprefix ){ - Jim_SetResult_NvpUnknown( goi->interp, + if (hadprefix ){ + Jim_SetResult_NvpUnknown(goi->interp, goi->argv[-2], goi->argv[-1], nvptable ); } else { - Jim_SetResult_NvpUnknown( goi->interp, + Jim_SetResult_NvpUnknown(goi->interp, NULL, goi->argv[-1], nvptable ); @@ -12734,7 +12734,7 @@ int -Jim_GetOpt_Enum( Jim_GetOptInfo *goi, +Jim_GetOpt_Enum(Jim_GetOptInfo *goi, const char * const * lookup, int *puthere) { @@ -12742,12 +12742,12 @@ Jim_Obj *o; int e; - if ( puthere == NULL ){ + if (puthere == NULL ){ puthere = &_safe; } - e = Jim_GetOpt_Obj( goi, &o ); - if ( e == JIM_OK ){ - e = Jim_GetEnum( goi->interp, + e = Jim_GetOpt_Obj(goi, &o ); + if (e == JIM_OK ){ + e = Jim_GetEnum(goi->interp, o, lookup, puthere, @@ -12760,16 +12760,16 @@ int -Jim_SetResult_sprintf( Jim_Interp *interp, const char *fmt,... ) +Jim_SetResult_sprintf(Jim_Interp *interp, const char *fmt,... ) { va_list ap; char *buf; va_start(ap,fmt); - buf = jim_vasprintf( fmt, ap ); + buf = jim_vasprintf(fmt, ap ); va_end(ap); - if ( buf ){ - Jim_SetResultString( interp, buf, -1 ); + if (buf ){ + Jim_SetResultString(interp, buf, -1 ); jim_vasprintf_done(buf); } return JIM_OK; @@ -12777,33 +12777,33 @@ void -Jim_SetResult_NvpUnknown( Jim_Interp *interp, +Jim_SetResult_NvpUnknown(Jim_Interp *interp, Jim_Obj *param_name, Jim_Obj *param_value, const Jim_Nvp *nvp ) { - if ( param_name ){ - Jim_SetResult_sprintf( interp, + if (param_name ){ + Jim_SetResult_sprintf(interp, "%s: Unknown: %s, try one of: ", - Jim_GetString( param_name, NULL ), - Jim_GetString( param_value, NULL ) ); + Jim_GetString(param_name, NULL ), + Jim_GetString(param_value, NULL ) ); } else { - Jim_SetResult_sprintf( interp, + Jim_SetResult_sprintf(interp, "Unknown param: %s, try one of: ", - Jim_GetString( param_value, NULL ) ); + Jim_GetString(param_value, NULL ) ); } - while ( nvp->name ){ + while (nvp->name ){ const char *a; const char *b; - if ( (nvp + 1)->name ){ + if ((nvp + 1)->name ){ a = nvp->name; b = ", "; } else { a = "or "; b = nvp->name; } - Jim_AppendStrings( interp, + Jim_AppendStrings(interp, Jim_GetResult(interp), a, b, NULL ); nvp++; @@ -12814,22 +12814,22 @@ static Jim_Obj *debug_string_obj; const char * -Jim_Debug_ArgvString( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) +Jim_Debug_ArgvString(Jim_Interp *interp, int argc, Jim_Obj *const *argv ) { int x; - if ( debug_string_obj ){ - Jim_FreeObj( interp, debug_string_obj ); + if (debug_string_obj ){ + Jim_FreeObj(interp, debug_string_obj ); } - debug_string_obj = Jim_NewEmptyStringObj( interp ); - for ( x = 0 ; x < argc ; x++ ){ - Jim_AppendStrings( interp, + debug_string_obj = Jim_NewEmptyStringObj(interp ); + for (x = 0 ; x < argc ; x++ ){ + Jim_AppendStrings(interp, debug_string_obj, - Jim_GetString( argv[x], NULL ), + Jim_GetString(argv[x], NULL ), " ", NULL ); } - return Jim_GetString( debug_string_obj, NULL ); + return Jim_GetString(debug_string_obj, NULL ); } Modified: trunk/src/helper/jim.h =================================================================== --- trunk/src/helper/jim.h 2009-06-23 22:45:47 UTC (rev 2375) +++ trunk/src/helper/jim.h 2009-06-23 22:46:23 UTC (rev 2376) @@ -530,11 +530,11 @@ void *cookie_stdin; /* input file pointer, 'stdin' by default */ void *cookie_stdout; /* output file pointer, 'stdout' by default */ void *cookie_stderr; /* errors file pointer, 'stderr' by default */ - size_t (*cb_fwrite )( const void *ptr, size_t size, size_t n, void *cookie ); - size_t (*cb_fread )( void *ptr, size_t size, size_t n, void *cookie ); - int (*cb_vfprintf)( void *cookie, const char *fmt, va_list ap ); - int (*cb_fflush )( void *cookie ); - char *(*cb_fgets )( char *s, int size, void *cookie ); + size_t (*cb_fwrite )(const void *ptr, size_t size, size_t n, void *cookie ); + size_t (*cb_fread )(void *ptr, size_t size, size_t n, void *cookie ); + int (*cb_vfprintf)(void *cookie, const char *fmt, va_list ap ); + int (*cb_fflush )(void *cookie ); + char *(*cb_fgets )(char *s, int size, void *cookie ); } Jim_Interp; /* Currently provided as macro that performs the increment. @@ -591,11 +591,11 @@ * }; * * Jim_Nvp *result - * e = Jim_Nvp_name2value( interp, yn, "y", &result ); + * e = Jim_Nvp_name2value(interp, yn, "y", &result ); * returns &yn[0]; - * e = Jim_Nvp_name2value( interp, yn, "n", &result ); + * e = Jim_Nvp_name2value(interp, yn, "n", &result ); * returns &yn[1]; - * e = Jim_Nvp_name2value( interp, yn, "Blah", &result ); + * e = Jim_Nvp_name2value(interp, yn, "Blah", &result ); * returns &yn[4]; * \endcode * @@ -629,7 +629,7 @@ #ifdef DOXYGEN #define JIM_STATIC -#define JIM_API( X ) X +#define JIM_API(X ) X #else #ifndef __JIM_CORE__ # if defined JIM_EMBEDDED @@ -650,7 +650,7 @@ #endif /* DOXYGEN */ /** Set the result - printf() style */ -JIM_STATIC int JIM_API( Jim_SetResult_sprintf )( Jim_Interp *p, const char *fmt, ... ); +JIM_STATIC int JIM_API(Jim_SetResult_sprintf )(Jim_Interp *p, const char *fmt, ... ); /* Memory allocation */ JIM_STATIC void * JIM_API(Jim_Alloc) (int size); @@ -660,7 +660,7 @@ /* evaluation */ JIM_STATIC int JIM_API(Jim_Eval)(Jim_Interp *interp, const char *script); /* in C code, you can do this and get better error messages */ -/* Jim_Eval_Named( interp, "some tcl commands", __FILE__, __LINE__ ); */ +/* Jim_Eval_Named(interp, "some tcl commands", __FILE__, __LINE__ ); */ JIM_STATIC int JIM_API(Jim_Eval_Named)(Jim_Interp *interp, const char *script,const char *filename, int lineno); JIM_STATIC int JIM_API(Jim_EvalGlobal)(Jim_Interp *interp, const char *script); JIM_STATIC int JIM_API(Jim_EvalFile)(Jim_Interp *interp, const char *filename); @@ -911,28 +911,28 @@ JIM_STATIC void JIM_API(Jim_Panic) (Jim_Interp *interp, const char *fmt, ...); /* Jim's STDIO */ -JIM_STATIC int JIM_API( Jim_fprintf )( Jim_Interp *int... [truncated message content] |
From: <zw...@ma...> - 2009-06-24 00:46:18
|
Author: zwelch Date: 2009-06-24 00:45:47 +0200 (Wed, 24 Jun 2009) New Revision: 2375 Modified: trunk/src/flash/at91sam7.c trunk/src/flash/cfi.c trunk/src/flash/ecos.c trunk/src/flash/flash.c trunk/src/flash/flash.h trunk/src/flash/ocl.c trunk/src/flash/ocl/at91sam7x/main.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/stellaris.c trunk/src/flash/str9x.c trunk/src/helper/binarybuffer.h trunk/src/helper/command.c trunk/src/helper/fileio.c trunk/src/helper/jim.c trunk/src/helper/log.c trunk/src/helper/replacements.h trunk/src/jtag/bitq.c trunk/src/jtag/ft2232.c trunk/src/jtag/gw16012.c trunk/src/jtag/parport.c trunk/src/jtag/presto.c trunk/src/jtag/tcl.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/server/gdb_server.c trunk/src/server/httpd.c trunk/src/server/telnet_server.c trunk/src/target/arm11_dbgtap.c trunk/src/target/arm720t.c trunk/src/target/arm7_9_common.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_disassembler.c trunk/src/target/image.c trunk/src/target/mips32_dmaacc.c trunk/src/target/target.c trunk/src/xsvf/xsvf.c trunk/testing/examples/cortex/test.c Log: - Fixes '[<>]' whitespace - Replace ')\([<>]\)(' with ') \1 ('. - Replace ')\([<>]\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\([<>]\)(' with '\1 \2 ('. - Replace '\(\w\)\([<>]\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -550,7 +550,7 @@ /* calculate bank size */ bank_size = sectors_num * pages_per_sector * page_size; - for (bnk = 0; bnk<banks_num; bnk++) + for (bnk = 0; bnk < banks_num; bnk++) { if (bnk > 0) { @@ -575,7 +575,7 @@ /* allocate sectors */ t_bank->sectors = malloc(sectors_num * sizeof(flash_sector_t)); - for (sec = 0; sec<sectors_num; sec++) + for (sec = 0; sec < sectors_num; sec++) { t_bank->sectors[sec].offset = sec * pages_per_sector * page_size; t_bank->sectors[sec].size = pages_per_sector * page_size; @@ -639,7 +639,7 @@ at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH); fast_check = 1; - for (nSector = 0; nSector<bank->num_sectors; nSector++) + for (nSector = 0; nSector < bank->num_sectors; nSector++) { retval = target_blank_check_memory(target, bank->base + bank->sectors[nSector].offset, bank->sectors[nSector].size, &blank); @@ -662,7 +662,7 @@ LOG_USER("Running slow fallback erase check - add working memory"); buffer = malloc(bank->sectors[0].size); - for (nSector = 0; nSector<bank->num_sectors; nSector++) + for (nSector = 0; nSector < bank->num_sectors; nSector++) { bank->sectors[nSector].is_erased = 1; retval = target_read_memory(target, bank->base + bank->sectors[nSector].offset, 4, @@ -670,7 +670,7 @@ if (retval != ERROR_OK) return retval; - for (nByte = 0; nByte<bank->sectors[nSector].size; nByte++) + for (nByte = 0; nByte < bank->sectors[nSector].size; nByte++) { if (buffer[nByte] != 0xFF) { @@ -705,7 +705,7 @@ at91sam7_info->lockbits = (status >> 16); at91sam7_info->num_lockbits_on = 0; - for (lock_pos = 0; lock_pos<bank->num_sectors; lock_pos++) + for (lock_pos = 0; lock_pos < bank->num_sectors; lock_pos++) { if ( ((status >> (16 + lock_pos))&(0x0001)) == 1) { @@ -723,7 +723,7 @@ at91sam7_info->nvmbits = (status >> 8)&0xFF; at91sam7_info->num_nvmbits_on = 0; - for (gpnvm_pos = 0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++) + for (gpnvm_pos = 0; gpnvm_pos < at91sam7_info->num_nvmbits; gpnvm_pos++) { if ( ((status >> (8 + gpnvm_pos))&(0x01)) == 1) { @@ -809,7 +809,7 @@ /* calculate bank size */ bank_size = num_sectors * pages_per_sector * page_size; - for (bnk = 0; bnk<banks_num; bnk++) + for (bnk = 0; bnk < banks_num; bnk++) { if (bnk > 0) { @@ -834,7 +834,7 @@ /* allocate sectors */ t_bank->sectors = malloc(num_sectors * sizeof(flash_sector_t)); - for (sec = 0; sec<num_sectors; sec++) + for (sec = 0; sec < num_sectors; sec++) { t_bank->sectors[sec].offset = sec * pages_per_sector * page_size; t_bank->sectors[sec].size = pages_per_sector * page_size; @@ -902,7 +902,7 @@ /* allocate and clean buffer */ nbytes = (last - first + 1) * bank->sectors[first].size; buffer = malloc(nbytes * sizeof(uint8_t)); - for (pos = 0; pos<nbytes; pos++) + for (pos = 0; pos < nbytes; pos++) { buffer[pos] = 0xFF; } @@ -1016,9 +1016,9 @@ at91sam7_read_clock_info(bank); at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH); - for (pagen = first_page; pagen<last_page; pagen++) + for (pagen = first_page; pagen < last_page; pagen++) { - if (bytes_remaining<dst_min_alignment) + if (bytes_remaining < dst_min_alignment) count = bytes_remaining; else count = dst_min_alignment; Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/cfi.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -212,7 +212,7 @@ if (cfi_info->x16_as_x8) { uint8_t i; - for (i = 0;i<2;i++) + for (i = 0;i < 2;i++) target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } @@ -234,7 +234,7 @@ if (cfi_info->x16_as_x8) { uint8_t i; - for (i = 0;i<4;i++) + for (i = 0;i < 4;i++) target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } Modified: trunk/src/flash/ecos.c =================================================================== --- trunk/src/flash/ecos.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/ecos.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -319,10 +319,10 @@ uint32_t i; - for (i = 0; i<len; i += chunk) + for (i = 0; i < len; i += chunk) { int t = len-i; - if (t>chunk) + if (t > chunk) { t = chunk; } Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/flash.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -791,7 +791,7 @@ duration_start_measure(&duration); - for (wrote = 0; wrote<(count*wordsize); wrote += cur_size) + for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) { cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) ); flash_bank_t *bank; @@ -809,7 +809,7 @@ return err; unsigned i; - for (i = 0; i<cur_size; i++) + for (i = 0; i < cur_size; i++) { if (readback[i]!=chunk[i]) { Modified: trunk/src/flash/flash.h =================================================================== --- trunk/src/flash/flash.h 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/flash.h 2009-06-23 22:45:47 UTC (rev 2375) @@ -76,7 +76,7 @@ * that matches @c DRIVERNAME. * * The flash subsystem calls some of the other drivers routines a using - * corresponding static <code>flash_driver_<i>callback</i>()</code> + * corresponding static <code > flash_driver_ < i>callback</i > ()</code> * routine in flash.c. */ typedef struct flash_driver_s Modified: trunk/src/flash/ocl/at91sam7x/main.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -45,13 +45,13 @@ bi_start = ofs/4; bi_end = (ofs + len + 3)/4; - if (bi_end>BUFSIZE) { + if (bi_end > BUFSIZE) { dcc_wr(OCL_BUFF_OVER); return; } chksum = OCL_CHKS_INIT; - for (bi = 0; bi<bi_end; bi++) chksum^=buffer[bi]=dcc_rd(); + for (bi = 0; bi < bi_end; bi++) chksum^=buffer[bi]=dcc_rd(); if (dcc_rd() != chksum) { dcc_wr(OCL_CHKS_FAIL); @@ -59,12 +59,12 @@ } /* fill in unused positions with unprogrammed values */ - for (bi = 0; bi<bi_start; bi++) buffer[bi]=0xffffffff; + for (bi = 0; bi < bi_start; bi++) buffer[bi]=0xffffffff; for (bi = bi_end; bi%flash_page_size; bi++) buffer[bi]=0xffffffff; result = 0; pagenum = adr/flash_page_size; - for (bi = 0; bi<bi_end; bi += flash_page_size/4) { + for (bi = 0; bi < bi_end; bi += flash_page_size/4) { result = flash_page_program(buffer + bi, pagenum++); if (result) break; } Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -146,7 +146,7 @@ if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; } - if ((page_num += flash_lock_pages)>flash_page_count) break; + if ((page_num += flash_lock_pages) > flash_page_count) break; lockbits>>=1; } @@ -178,7 +178,7 @@ if ((result = flash_erase_plane(0)) != FLASH_STAT_OK) return result; /* the second flash controller, if any */ - if (flash_page_count>1024) result = flash_erase_plane(0x10); + if (flash_page_count > 1024) result = flash_erase_plane(0x10); return result; } Modified: trunk/src/flash/ocl.c =================================================================== --- trunk/src/flash/ocl.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/ocl.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -200,7 +200,7 @@ chksum = OCL_CHKS_INIT; /* copy data to DCC buffer in proper byte order and properly aligned */ - for (i = 0; i<runlen; i++) + for (i = 0; i < runlen; i++) { switch (byteofs++) { @@ -332,7 +332,7 @@ return ERROR_FLASH_BANK_INVALID; } sectsize = bank->size / bank->num_sectors; - for (i = 0; i<bank->num_sectors; i++) + for (i = 0; i < bank->num_sectors; i++) { bank->sectors[i].offset = i * sectsize; bank->sectors[i].size = sectsize; Modified: trunk/src/flash/stellaris.c =================================================================== --- trunk/src/flash/stellaris.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/stellaris.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -322,7 +322,7 @@ buf += printed; buf_size -= printed; - if (stellaris_info->num_lockbits>0) + if (stellaris_info->num_lockbits > 0) { printed = snprintf(buf, buf_size, Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/flash/str9x.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -300,7 +300,7 @@ } int timeout; - for (timeout = 0; timeout<1000; timeout++) { + for (timeout = 0; timeout < 1000; timeout++) { if ((retval = target_read_u8(target, adr, &status)) != ERROR_OK) { return retval; @@ -575,7 +575,7 @@ target_write_u16(target, bank_adr, 0x70); int timeout; - for (timeout = 0; timeout<1000; timeout++) + for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); if ( status & 0x80 ) @@ -624,7 +624,7 @@ target_write_u16(target, bank_adr, 0x70); int timeout; - for (timeout = 0; timeout<1000; timeout++) + for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); if ( status & 0x80 ) Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:45:47 UTC (rev 2375) @@ -42,7 +42,7 @@ { unsigned int i; - for (i = first; i<first + num; i++) + for (i = first; i < first + num; i++) { if (((value >> (i-first))&1) == 1) buffer[i/8] |= 1 << (i%8); @@ -61,7 +61,7 @@ uint32_t result = 0; unsigned int i; - for (i = first; i<first + num; i++) + for (i = first; i < first + num; i++) { if (((buffer[i/8]>>(i%8))&1) == 1) result |= 1 << (i-first); Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/helper/command.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -492,7 +492,7 @@ int reslen; result = Jim_GetString(Jim_GetResult(interp), &reslen); - if (reslen>0) + if (reslen > 0) { int i; char buff[256 + 1]; Modified: trunk/src/helper/fileio.c =================================================================== --- trunk/src/helper/fileio.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/helper/fileio.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -84,7 +84,7 @@ result2 = fseek(fileio->file, 0, SEEK_SET); - if ((fileio->size<0)||(result<0)||(result2<0)) + if ((fileio->size < 0)||(result < 0)||(result2 < 0)) { fileio_close(fileio); return ERROR_FILEIO_OPERATION_FAILED; Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/helper/jim.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -503,8 +503,8 @@ 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;} + if ((b == 0 && e != 0) || (e < 0)) return 0; + for (i = 0; i < e; i++) {res *= b;} return res; } @@ -6953,8 +6953,8 @@ case JIM_EXPROP_ADD: wC = wA + wB; break; case JIM_EXPROP_SUB: wC = wA-wB; break; case JIM_EXPROP_MUL: wC = wA*wB; break; - case JIM_EXPROP_LT: wC = wA<wB; break; - case JIM_EXPROP_GT: wC = wA>wB; break; + case JIM_EXPROP_LT: wC = wA < wB; break; + case JIM_EXPROP_GT: wC = wA > wB; break; case JIM_EXPROP_LTE: wC = wA <= wB; break; case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_LSHIFT: wC = wA << wB; break; @@ -7058,8 +7058,8 @@ case JIM_EXPROP_ADD: dC = dA + dB; break; case JIM_EXPROP_SUB: dC = dA-dB; break; case JIM_EXPROP_MUL: dC = dA*dB; break; - case JIM_EXPROP_LT: dC = dA<dB; break; - case JIM_EXPROP_GT: dC = dA>dB; break; + case JIM_EXPROP_LT: dC = dA < dB; break; + case JIM_EXPROP_GT: dC = dA > dB; break; case JIM_EXPROP_LTE: dC = dA <= dB; break; case JIM_EXPROP_GTE: dC = dA >= dB; break; case JIM_EXPROP_NUMEQ: dC = dA == dB; break; @@ -8197,7 +8197,7 @@ strncmp(fileName + fileNameLen-4, ".dll", 4) == 0 || strncmp(fileName + fileNameLen-3, ".so", 3) == 0)) { - char ver[6]; /* xx.yy<nulterm> */ + char ver[6]; /* xx.yy < nulterm> */ char *p = strrchr(fileName, '.'); int verLen, fileVer; Modified: trunk/src/helper/log.c =================================================================== --- trunk/src/helper/log.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/helper/log.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -384,7 +384,7 @@ void keep_alive() { current_time = timeval_ms(); - if (current_time-last_time>1000) + if (current_time-last_time > 1000) { extern int gdb_actual_connections; @@ -400,7 +400,7 @@ "trouble with GDB connections.", current_time-last_time); } - if (current_time-last_time>500) + if (current_time-last_time > 500) { /* this will keep the GDB connection alive */ LOG_USER_N("%s", ""); @@ -429,10 +429,10 @@ { int i; int napTime = 10; - for (i = 0; i<ms; i += napTime) + for (i = 0; i < ms; i += napTime) { int sleep_a_bit = ms-i; - if (sleep_a_bit>napTime) + if (sleep_a_bit > napTime) { sleep_a_bit = napTime; } @@ -445,7 +445,7 @@ { long long then; then = timeval_ms(); - while ((timeval_ms()-then)<ms) + while ((timeval_ms()-then) < ms) { /* busy wait */ } Modified: trunk/src/helper/replacements.h =================================================================== --- trunk/src/helper/replacements.h 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/helper/replacements.h 2009-06-23 22:45:47 UTC (rev 2375) @@ -28,10 +28,10 @@ /* MIN,MAX macros */ #ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MIN(a,b) (((a) < (b))?(a):(b)) #endif #ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MAX(a,b) (((a) > (b))?(a):(b)) #endif /* for systems that do not support ENOTSUP Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/bitq.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -54,7 +54,7 @@ if (bitq_in_state.cmd->type == JTAG_SCAN) { /* loop through the fields */ - while (bitq_in_state.field_idx<bitq_in_state.cmd->cmd.scan->num_fields) + while (bitq_in_state.field_idx < bitq_in_state.cmd->cmd.scan->num_fields) { field = &bitq_in_state.cmd->cmd.scan->fields[bitq_in_state.field_idx]; if (field->in_value) @@ -69,7 +69,7 @@ else { /* buffer reallocation needed? */ - if (field->num_bits>bitq_in_bufsize * 8) + if (field->num_bits > bitq_in_bufsize * 8) { /* buffer previously allocated? */ if (bitq_in_buffer != NULL) @@ -79,7 +79,7 @@ bitq_in_buffer = NULL; } /* double the buffer size until it fits */ - while (field->num_bits>bitq_in_bufsize * 8) + while (field->num_bits > bitq_in_bufsize * 8) bitq_in_bufsize *= 2; } /* if necessary, allocate buffer and check for malloc error */ @@ -93,9 +93,9 @@ } /* field scanning */ - while (bitq_in_state.bit_pos<field->num_bits) + while (bitq_in_state.bit_pos < field->num_bits) { - if ( ( tdo = bitq_interface->in() )<0 ) + if ( ( tdo = bitq_interface->in() ) < 0 ) { #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("bitq in EOF"); @@ -161,7 +161,7 @@ tms_scan = tap_get_tms_path(tap_get_state(), new_state); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - for (i = 0; i<tms_count; i++) + for (i = 0; i < tms_count; i++) { bitq_io(tms_scan & 1, 0, 0); tms_scan >>= 1; @@ -229,7 +229,7 @@ if (field->out_value == NULL) { /* just send zeros and request data from TDO */ - for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--) + for (bit_cnt = field->num_bits; bit_cnt > 1; bit_cnt--) bitq_io(0, 0, tdo_req); bitq_io(pause, 0, tdo_req); @@ -239,7 +239,7 @@ /* send data, and optionally request TDO */ out_mask = 0x01; out_ptr = field->out_value; - for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--) + for (bit_cnt = field->num_bits; bit_cnt > 1; bit_cnt--) { bitq_io(0, ( (*out_ptr) & out_mask ) != 0, tdo_req); if (out_mask == 0x80) Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/ft2232.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -2794,7 +2794,7 @@ cp[-2] = 0; ft2232_device_desc = strdup(buf); } else { - // <space>A not defined + // <space > A not defined // so create it sprintf(buf, "%s A", ft2232_device_desc); ft2232_device_desc_A = strdup(buf); Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/gw16012.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -500,7 +500,7 @@ LOG_DEBUG("opening %s...", buffer); device_handle = open(buffer, O_WRONLY); - if (device_handle<0) + if (device_handle < 0) { LOG_ERROR("cannot open device. check it exists and that user read and write rights are set"); return ERROR_JTAG_INIT_FAILED; Modified: trunk/src/jtag/parport.c =================================================================== --- trunk/src/jtag/parport.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/parport.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -345,7 +345,7 @@ #if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) i = ioctl(device_handle, PPCLAIM); - if (i<0) + if (i < 0) { LOG_ERROR("cannot claim device"); return ERROR_JTAG_INIT_FAILED; @@ -353,7 +353,7 @@ i = PARPORT_MODE_COMPAT; i= ioctl(device_handle, PPSETMODE, & i); - if (i<0) + if (i < 0) { LOG_ERROR(" cannot set compatible mode to device"); return ERROR_JTAG_INIT_FAILED; @@ -361,7 +361,7 @@ i = IEEE1284_MODE_COMPAT; i = ioctl(device_handle, PPNEGOT, & i); - if (i<0) + if (i < 0) { LOG_ERROR("cannot set compatible 1284 mode to device"); return ERROR_JTAG_INIT_FAILED; Modified: trunk/src/jtag/presto.c =================================================================== --- trunk/src/jtag/presto.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/presto.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -553,7 +553,7 @@ if (presto_flush() != ERROR_OK) return -1; - if (presto->buff_in_pos<presto->buff_in_len) + if (presto->buff_in_pos < presto->buff_in_len) return presto->buff_in[presto->buff_in_pos++]; return -1; @@ -625,14 +625,14 @@ } /* delay with TCK low */ - for (i = presto->jtag_speed; i>1; i--) + for (i = presto->jtag_speed; i > 1; i--) presto_sendbyte(cmd); cmd |= 0x04; presto_sendbyte(cmd | (tdo_req ? 0x10 : 0)); /* delay with TCK high */ - for (i = presto->jtag_speed; i>1; i--) + for (i = presto->jtag_speed; i > 1; i--) presto_sendbyte(cmd); presto->jtag_tck = 1; Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/tcl.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -1396,7 +1396,7 @@ script_debug(interp, "pathmove", argc, args); int i; - for (i = 0; i<argc-1; i++) + for (i = 0; i < argc-1; i++) { const char *cp; cp = Jim_GetString( args[i + 1], NULL ); Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:45:47 UTC (rev 2375) @@ -96,7 +96,7 @@ { int i; setCurrentState(state); - for (i = 0; i<repeat; i++) + for (i = 0; i < repeat; i++) { int tms; tms = 0; @@ -124,11 +124,11 @@ #endif #else /* maximum debug version */ - if ((repeat>0) && ((state == TAP_DRSHIFT)||(state == TAP_SI))) + if ((repeat > 0) && ((state == TAP_DRSHIFT)||(state == TAP_SI))) { int i; /* sample shift register for every bit. */ - for (i = 0; i<repeat-1; i++) + for (i = 0; i < repeat-1; i++) { sampleShiftRegister(); ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value >> i); @@ -167,7 +167,7 @@ if (tap == target_tap) { int j; - for (j = 0; j<(num_fields-1); j++) + for (j = 0; j < (num_fields-1); j++) { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[j], value[j]); } Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -164,7 +164,7 @@ if (!srst) { int i; - for (i = 0; i<1000; i++) + for (i = 0; i < 1000; i++) { // We don't want to sense our own reset, so we clear here. // There is of course a timing hole where we could loose @@ -179,7 +179,7 @@ if (i == 1000) { LOG_USER("SRST didn't deassert after %dms", i); - } else if (i>1) + } else if (i > 1) { LOG_USER("SRST took %dms to deassert", i); } @@ -434,13 +434,13 @@ // here we shuffle N bits out/in j = 0; - while (j<num_bits) + while (j < num_bits) { tap_state_t pause_state; int l; k = num_bits-j; pause_state = (shiftState == TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT; - if (k>32) + if (k > 32) { k = 32; /* we have more to shift out */ @@ -455,7 +455,7 @@ value = 0; if (fields[i].out_value != NULL) { - for (l = 0; l<k; l += 8) + for (l = 0; l < k; l += 8) { value|=fields[i].out_value[(j + l)/8]<<l; } @@ -472,7 +472,7 @@ // we're shifting in data to MSB, shift data to be aligned for returning the value value >>= 32-k; - for (l = 0; l<k; l += 8) + for (l = 0; l < k; l += 8) { inBuffer[(j + l)/8]=(value >> l)&0xff; } @@ -634,11 +634,11 @@ /* execute num_cycles, 32 at the time. */ int i; - for (i = 0; i<num_cycles; i += 32) + for (i = 0; i < num_cycles; i += 32) { int num; num = 32; - if (num_cycles-i<num) + if (num_cycles-i < num) { num = num_cycles-i; } Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/server/gdb_server.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -109,7 +109,7 @@ got_data=&t; *got_data = 0; - if (gdb_con->buf_cnt>0) + if (gdb_con->buf_cnt > 0) { *got_data = 1; return ERROR_OK; @@ -125,7 +125,7 @@ /* This can typically be because a "monitor" command took too long * before printing any progress messages */ - if (timeout_s>0) + if (timeout_s > 0) { return ERROR_GDB_TIMEOUT; } else @@ -649,7 +649,7 @@ return ERROR_GDB_BUFFER_TOO_SMALL; hex_buffer[0] = 'O'; - for (i = 0; i<bin_size; i++) + for (i = 0; i < bin_size; i++) snprintf(hex_buffer + 1 + i*2, 3, "%2.2x", line[i]); hex_buffer[bin_size*2 + 1] = 0; @@ -1268,7 +1268,7 @@ LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len); - for (i = 0; i<len; i++) + for (i = 0; i < len; i++) { uint32_t tmp; sscanf(separator + 2*i, "%2" SCNx32 , &tmp); @@ -1563,7 +1563,7 @@ if (b1->base == b2->base) { return 0; - } else if (b1->base>b2->base) + } else if (b1->base > b2->base) { return 1; } else @@ -1654,7 +1654,7 @@ xml_printf(&retval, &buffer, &pos, &size, "PacketSize=%x;qXfer:memory-map:read%c;qXfer:features:read-;QStartNoAckMode+", - (GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1) && (flash_get_bank_count()>0)) ? '+' : '-'); + (GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1) && (flash_get_bank_count() > 0)) ? '+' : '-'); if (retval != ERROR_OK) { @@ -1667,7 +1667,7 @@ return ERROR_OK; } - else if (strstr(packet, "qXfer:memory-map:read::") && (flash_get_bank_count()>0)) + else if (strstr(packet, "qXfer:memory-map:read::") && (flash_get_bank_count() > 0)) { /* We get away with only specifying flash here. Regions that are not * specified are treated as if we provided no memory map(if not we @@ -1702,7 +1702,7 @@ flash_bank_t **banks = malloc(sizeof(flash_bank_t *)*flash_get_bank_count()); int i; - for (i = 0; i<flash_get_bank_count(); i++) + for (i = 0; i < flash_get_bank_count(); i++) { p = get_flash_bank_by_num(i); if (p == NULL) @@ -1718,11 +1718,11 @@ qsort(banks, flash_get_bank_count(), sizeof(flash_bank_t *), compare_bank); uint32_t ram_start = 0; - for (i = 0; i<flash_get_bank_count(); i++) + for (i = 0; i < flash_get_bank_count(); i++) { p = banks[i]; - if (ram_start<p->base) + if (ram_start < p->base) { xml_printf(&retval, &xml, &pos, &size, "<memory type=\"ram\" start=\"0x%x\" length=\"0x%x\"/>\n", ram_start, p->base-ram_start); @@ -1800,7 +1800,7 @@ } xml_printf(&retval, &xml, &pos, &size, \ - "l<target version=\"1.0\">\n<architecture>arm</architecture>\n</target>\n"); + "l < target version=\"1.0\">\n < architecture > arm</architecture>\n</target>\n"); if (retval != ERROR_OK) { Modified: trunk/src/server/httpd.c =================================================================== --- trunk/src/server/httpd.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/server/httpd.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -34,7 +34,7 @@ #include <pthread.h> #include <signal.h> -#define PAGE_NOT_FOUND "<html><head><title>File not found</title></head><body>File not found</body></html>" +#define PAGE_NOT_FOUND "<html><head><title > File not found</title></head><body > File not found</body></html>" int loadFile(const char *name, void **data, size_t *len); @@ -71,7 +71,7 @@ t = appendf(t, "Runtime error, file \"%s\", line %d:<br>", interp->errorFileName, interp->errorLine); - t = appendf(t, " %s<br>", Jim_GetString(interp->result, NULL)); + t = appendf(t, " %s < br>", Jim_GetString(interp->result, NULL)); Jim_ListLength(interp, interp->stackTrace, &len); for (i = 0; i < len; i += 3) { @@ -84,7 +84,7 @@ file = Jim_GetString(objPtr, NULL); Jim_ListIndex(interp, interp->stackTrace, i + 2, &objPtr, JIM_NONE); line = Jim_GetString(objPtr, NULL); - t = appendf(t, "In procedure '%s' called at file \"%s\", line %s<br>", + t = appendf(t, "In procedure '%s' called at file \"%s\", line %s < br>", proc, file, line); } t = appendf(t, "</html></body>\n"); Modified: trunk/src/server/telnet_server.c =================================================================== --- trunk/src/server/telnet_server.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/server/telnet_server.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -120,8 +120,8 @@ /* clear the command line */ telnet_write(connection, "\r", 1); - for (i = strlen(t_con->prompt) + t_con->line_size; i>0; i -= 16) - telnet_write(connection, " ", i>16 ? 16 : i); + for (i = strlen(t_con->prompt) + t_con->line_size; i > 0; i -= 16) + telnet_write(connection, " ", i > 16 ? 16 : i); telnet_write(connection, "\r", 1); /* output the message */ @@ -130,7 +130,7 @@ /* put the command line to its previous state */ telnet_prompt(connection); telnet_write(connection, t_con->line, t_con->line_size); - for (i = t_con->line_size; i>t_con->line_cursor; i--) + for (i = t_con->line_size; i > t_con->line_cursor; i--) telnet_write(connection, "\b", 1); } Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/arm11_dbgtap.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -75,9 +75,9 @@ * \param arm11 Target state variable. * \param num_bits Length of the data field * \param out_data pointer to the data that will be sent out - * <em>(data is read when it is added to the JTAG queue)</em> + * <em > (data is read when it is added to the JTAG queue)</em> * \param in_data pointer to the memory that will receive data that was clocked in - * <em>(data is written when the JTAG queue is executed)</em> + * <em > (data is written when the JTAG queue is executed)</em> * \param field target data structure that will be initialized */ void arm11_setup_field(arm11_common_t * arm11, int num_bits, void * out_data, void * in_data, scan_field_t * field) Modified: trunk/src/target/arm720t.c =================================================================== --- trunk/src/target/arm720t.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/arm720t.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -375,7 +375,7 @@ long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) { Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -702,7 +702,7 @@ long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { /* read debug status register */ embeddedice_read_reg(dbg_stat); @@ -862,11 +862,11 @@ * what happens: * * <table> - * <tr><th>State</th><th>Action</th></tr> - * <tr><td>TARGET_RUNNING | TARGET_RESET</td><td>Enters debug mode. If TARGET_RESET, pc may be checked</td></tr> - * <tr><td>TARGET_UNKNOWN</td><td>Warning is logged</td></tr> - * <tr><td>TARGET_DEBUG_RUNNING</td><td>Enters debug mode</td></tr> - * <tr><td>TARGET_HALTED</td><td>Nothing</td></tr> + * <tr><th > State</th><th > Action</th></tr> + * <tr><td > TARGET_RUNNING | TARGET_RESET</td><td > Enters debug mode. If TARGET_RESET, pc may be checked</td></tr> + * <tr><td > TARGET_UNKNOWN</td><td > Warning is logged</td></tr> + * <tr><td > TARGET_DEBUG_RUNNING</td><td > Enters debug mode</td></tr> + * <tr><td > TARGET_HALTED</td><td > Nothing</td></tr> * </table> * * If the target does not end up in the halted state, a warning is produced. If @@ -1152,7 +1152,7 @@ long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) != 0) break; @@ -2582,7 +2582,7 @@ int little = target->endianness == TARGET_LITTLE_ENDIAN; int count = dcc_count; uint8_t *buffer = dcc_buffer; - if (count>2) + if (count > 2) { /* Handle first & last using standard embeddedice_write_reg and the middle ones w/the * core function repeated. */ Modified: trunk/src/target/arm920t.c =================================================================== --- trunk/src/target/arm920t.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/arm920t.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -574,7 +574,7 @@ long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) { Modified: trunk/src/target/arm926ejs.c =================================================================== --- trunk/src/target/arm926ejs.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/arm926ejs.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -574,7 +574,7 @@ long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) { Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/arm_adi_v5.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -1118,7 +1118,7 @@ command_print(cmd_ctx, "\t\tEnd of ROM table"); } entry_offset += 4; - } while (romentry>0); + } while (romentry > 0); } else { Modified: trunk/src/target/arm_disassembler.c =================================================================== --- trunk/src/target/arm_disassembler.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/arm_disassembler.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -891,7 +891,7 @@ int x = (opcode & 0x20) >> 5; int y = (opcode & 0x40) >> 6; - /* SMLA<x><y> */ + /* SMLA < x><y> */ if ((opcode & 0x00600000) == 0x00000000) { uint8_t Rd, Rm, Rs, Rn; @@ -906,7 +906,7 @@ Rd, Rm, Rs, Rn); } - /* SMLAL<x><y> */ + /* SMLAL < x><y> */ if ((opcode & 0x00600000) == 0x00400000) { uint8_t RdLow, RdHi, Rm, Rs; @@ -921,7 +921,7 @@ RdLow, RdHi, Rm, Rs); } - /* SMLAW<y> */ + /* SMLAW < y> */ if (((opcode & 0x00600000) == 0x00100000) && (x == 0)) { uint8_t Rd, Rm, Rs, Rn; @@ -936,7 +936,7 @@ Rd, Rm, Rs, Rn); } - /* SMUL<x><y> */ + /* SMUL < x><y> */ if ((opcode & 0x00600000) == 0x00300000) { uint8_t Rd, Rm, Rs; @@ -950,7 +950,7 @@ Rd, Rm, Rs); } - /* SMULW<y> */ + /* SMULW < y> */ if (((opcode & 0x00600000) == 0x00100000) && (x == 1)) { uint8_t Rd, Rm, Rs; @@ -1922,7 +1922,7 @@ if (reg_list & (1 << i)) reg_names_p += snprintf(reg_names_p, (reg_names + 40 - reg_names_p), "r%i, ", i); } - if (reg_names_p>reg_names) + if (reg_names_p > reg_names) reg_names_p[-2] = '\0'; else /* invalid op : no registers */ reg_names[0] = '\0'; Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/image.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -414,12 +414,12 @@ /* count useful segments (loadable), ignore BSS section */ image->num_sections = 0; - for (i = 0;i<elf->segment_count;i++) + for (i = 0;i < elf->segment_count;i++) if ((field32(elf, elf->segments[i].p_type) == PT_LOAD) && (field32(elf, elf->segments[i].p_filesz) != 0)) image->num_sections++; /* alloc and fill sections array with loadable segments */ image->sections = malloc(image->num_sections * sizeof(image_section_t)); - for (i = 0,j = 0;i<elf->segment_count;i++) + for (i = 0,j = 0;i < elf->segment_count;i++) { if ((field32(elf, elf->segments[i].p_type) == PT_LOAD) && (field32(elf, elf->segments[i].p_filesz) != 0)) { @@ -449,7 +449,7 @@ LOG_DEBUG("load segment %d at 0x%" PRIx32 " (sz = 0x%" PRIx32 ")",section,offset,size); /* read initialized data in current segment if any */ - if (offset<field32(elf,segment->p_filesz)) + if (offset < field32(elf,segment->p_filesz)) { /* maximal size present in file for the current segment */ read_size = MIN(size, field32(elf,segment->p_filesz)-offset); @@ -1015,10 +1015,10 @@ crc32_table[i] = c; } - while (nbytes>0) + while (nbytes > 0) { int run = nbytes; - if (run>32768) + if (run > 32768) { run = 32768; } Modified: trunk/src/target/mips32_dmaacc.c =================================================================== --- trunk/src/target/mips32_dmaacc.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/mips32_dmaacc.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -369,7 +369,7 @@ int i; int retval; - for (i = 0; i<count; i++) { + for (i = 0; i < count; i++) { if ((retval = ejtag_dma_read(ejtag_info, addr + i*sizeof(*buf), &buf[i])) != ERROR_OK) return retval; } @@ -382,7 +382,7 @@ int i; int retval; - for (i = 0; i<count; i++) { + for (i = 0; i < count; i++) { if ((retval = ejtag_dma_read_h(ejtag_info, addr + i*sizeof(*buf), &buf[i])) != ERROR_OK) return retval; } @@ -395,7 +395,7 @@ int i; int retval; - for (i = 0; i<count; i++) { + for (i = 0; i < count; i++) { if ((retval = ejtag_dma_read_b(ejtag_info, addr + i*sizeof(*buf), &buf[i])) != ERROR_OK) return retval; } @@ -423,7 +423,7 @@ int i; int retval; - for (i = 0; i<count; i++) { + for (i = 0; i < count; i++) { if ((retval = ejtag_dma_write(ejtag_info, addr + i*sizeof(*buf), buf[i])) != ERROR_OK) return retval; } @@ -436,7 +436,7 @@ int i; int retval; - for (i = 0; i<count; i++) { + for (i = 0; i < count; i++) { if ((retval = ejtag_dma_write_h(ejtag_info, addr + i*sizeof(*buf), buf[i])) != ERROR_OK) return retval; } @@ -449,7 +449,7 @@ int i; int retval; - for (i = 0; i<count; i++) { + for (i = 0; i < count; i++) { if ((retval = ejtag_dma_write_b(ejtag_info, addr + i*sizeof(*buf), buf[i])) != ERROR_OK) return retval; } Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/target/target.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -1924,12 +1924,12 @@ Jim_Nvp_value2name_simple(nvp_target_state,state)->name); } - if (cur-then>500) + if (cur-then > 500) { keep_alive(); } - if ((cur-then)>ms) + if ((cur-then) > ms) { LOG_ERROR("timed out while waiting for target %s", Jim_Nvp_value2name_simple(nvp_target_state,state)->name); @@ -2280,16 +2280,16 @@ /* DANGER!!! beware of unsigned comparision here!!! */ if ((image.sections[i].base_address + buf_cnt >= min_address)&& - (image.sections[i].base_address<max_address)) + (image.sections[i].base_address < max_address)) { - if (image.sections[i].base_address<min_address) + if (image.sections[i].base_address < min_address) { /* clip addresses below */ offset += min_address-image.sections[i].base_address; length -= offset; } - if (image.sections[i].base_address + buf_cnt>max_address) + if (image.sections[i].base_address + buf_cnt > max_address) { length -= (image.sections[i].base_address + buf_cnt)-max_address; } @@ -2790,7 +2790,7 @@ static void writeLong(FILE *f, int l) { int i; - for (i = 0; i<4; i++) + for (i = 0; i < 4; i++) { char c = (l >> (i*8))&0xff; writeData(f, &c, 1); @@ -2822,13 +2822,13 @@ /* figure out bucket size */ uint32_t min = samples[0]; uint32_t max = samples[0]; - for (i = 0; i<sampleNum; i++) + for (i = 0; i < sampleNum; i++) { - if (min>samples[i]) + if (min > samples[i]) { min = samples[i]; } - if (max<samples[i]) + if (max < samples[i]) { max = samples[i]; } @@ -2849,7 +2849,7 @@ return; } memset(buckets, 0, sizeof(int)*length); - for (i = 0; i<sampleNum;i++) + for (i = 0; i < sampleNum;i++) { uint32_t address = samples[i]; long long a = address-min; @@ -2865,7 +2865,7 @@ writeLong(f, length); /* # of samples */ writeLong(f, 64000000); /* 64MHz */ writeString(f, "seconds"); - for (i = 0; i<(15-strlen("seconds")); i++) + for (i = 0; i < (15-strlen("seconds")); i++) writeData(f, &zero, 1); writeString(f, "s"); @@ -2874,11 +2874,11 @@ char *data = malloc(2*length); if (data != NULL) { - for (i = 0; i<length;i++) + for (i = 0; i < length;i++) { int val; val = buckets[i]; - if (val>65535) + if (val > 65535) { val = 65535; } @@ -4389,7 +4389,7 @@ if (fastload != NULL) { int i; - for (i = 0; i<fastload_num; i++) + for (i = 0; i < fastload_num; i++) { if (fastload[i].data) free(fastload[i].data); @@ -4461,16 +4461,16 @@ /* DANGER!!! beware of unsigned comparision here!!! */ if ((image.sections[i].base_address + buf_cnt >= min_address)&& - (image.sections[i].base_address<max_address)) + (image.sections[i].base_address < max_address)) { - if (image.sections[i].base_address<min_address) + if (image.sections[i].base_address < min_address) { /* clip addresses below */ offset += min_address-image.sections[i].base_address; length -= offset; } - if (image.sections[i].base_address + buf_cnt>max_address) + if (image.sections[i].base_address + buf_cnt > max_address) { length -= (image.sections[i].base_address + buf_cnt)-max_address; } @@ -4514,7 +4514,7 @@ static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc>0) + if (argc > 0) return ERROR_COMMAND_SYNTAX_ERROR; if (fastload == NULL) { @@ -4525,7 +4525,7 @@ int ms = timeval_ms(); int size = 0; int retval = ERROR_OK; - for (i = 0; i<fastload_num;i++) + for (i = 0; i < fastload_num;i++) { target_t *target = get_current_target(cmd_ctx); command_print(cmd_ctx, "Write to 0x%08x, length 0x%08x", Modified: trunk/src/xsvf/xsvf.c =================================================================== --- trunk/src/xsvf/xsvf.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/src/xsvf/xsvf.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -366,11 +366,11 @@ LOG_DEBUG("%s %d", op_name, xsdrsize); - for ( attempt = 0; attempt<limit; ++attempt ) + for ( attempt = 0; attempt < limit; ++attempt ) { scan_field_t field; - if ( attempt>0 ) + if ( attempt > 0 ) { /* perform the XC9500 exception handling sequence shown in xapp067.pdf and illustrated in psuedo code at end of this file. We start from state @@ -836,7 +836,7 @@ if (limit < 1) limit = 1; - for ( attempt = 0; attempt<limit; ++attempt ) + for ( attempt = 0; attempt < limit; ++attempt ) { scan_field_t field; Modified: trunk/testing/examples/cortex/test.c =================================================================== --- trunk/testing/examples/cortex/test.c 2009-06-23 22:45:15 UTC (rev 2374) +++ trunk/testing/examples/cortex/test.c 2009-06-23 22:45:47 UTC (rev 2375) @@ -20,7 +20,7 @@ void _start() { int i; - for (i = 0; i<1000; i++) + for (i = 0; i < 1000; i++) { j++; } |
From: <zw...@ma...> - 2009-06-24 00:45:46
|
Author: zwelch Date: 2009-06-24 00:45:15 +0200 (Wed, 24 Jun 2009) New Revision: 2374 Modified: trunk/src/ecosboard.c trunk/src/flash/at91sam7.c trunk/src/flash/flash.c trunk/src/flash/lpc2000.c trunk/src/flash/nand.c trunk/src/flash/non_cfi.c trunk/src/flash/ocl/at91sam7x/main.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/stellaris.c trunk/src/flash/stellaris.h trunk/src/flash/stm32x.c trunk/src/flash/str7x.c trunk/src/flash/str9xpec.c trunk/src/flash/tms470.c trunk/src/helper/binarybuffer.h trunk/src/helper/command.c trunk/src/helper/jim-eventloop.c trunk/src/helper/jim-eventloop.h trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/jtag/jlink.c trunk/src/jtag/parport.c trunk/src/jtag/tcl.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/target/arm7_9_common.c trunk/src/target/arm_adi_v5.c trunk/src/target/armv4_5.c trunk/src/target/cortex_m3.c trunk/src/target/etm.c trunk/src/target/mips32.h trunk/src/target/target.c trunk/src/target/xscale.c Log: - Fixes '[|]' whitespace - Replace ')\([|]\)(' with ') \1 ('. - Replace ')\([|]\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\([|]\)(' with '\1 \2 ('. - Replace '\(\w\)\([|]\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/ecosboard.c =================================================================== --- trunk/src/ecosboard.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/ecosboard.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -1460,7 +1460,7 @@ // For simplicity we use _FILESYSTEM synchronization for all accesses since // we should never block in any filesystem operations. FSTAB_ENTRY( logfs_fste, "logfs", 0, - CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM, + CYG_SYNCMODE_FILE_FILESYSTEM | CYG_SYNCMODE_IO_FILESYSTEM, logfs_mount, logfs_umount, logfs_open, Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -107,7 +107,7 @@ command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL); register_command(cmd_ctx, at91sam7_cmd, "gpnvm", at91sam7_handle_gpnvm_command, COMMAND_EXEC, - "at91sam7 gpnvm <bit> set|clear, set or clear one gpnvm bit"); + "at91sam7 gpnvm <bit> set | clear, set or clear one gpnvm bit"); return ERROR_OK; } @@ -284,7 +284,7 @@ target_write_u32(target, MC_FCR[bank->bank_number], fcr); LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number + 1, pagen); - if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB)|(cmd == CLB))) + if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB) | (cmd == CLB))) { /* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */ if (at91sam7_wait_status_busy(bank, MC_FSR_EOL, 10)&0x0C) @@ -1138,7 +1138,7 @@ if (argc != 2) { - command_print(cmd_ctx, "at91sam7 gpnvm <bit> <set|clear>"); + command_print(cmd_ctx, "at91sam7 gpnvm <bit> <set | clear>"); return ERROR_OK; } Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/flash.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -197,7 +197,7 @@ register_command(cmd_ctx, flash_cmd, "write_image", handle_flash_write_image_command, COMMAND_EXEC, "write_image [erase] <file> [offset] [type]"); register_command(cmd_ctx, flash_cmd, "protect", handle_flash_protect_command, COMMAND_EXEC, - "set protection of sectors at <bank> <first> <last> <on|off>"); + "set protection of sectors at <bank> <first> <last> <on | off>"); } return ERROR_OK; Modified: trunk/src/flash/lpc2000.c =================================================================== --- trunk/src/flash/lpc2000.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/lpc2000.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -30,18 +30,18 @@ /* flash programming support for Philips LPC2xxx devices * currently supported devices: * variant 1 (lpc2000_v1): - * - 2104|5|6 - * - 2114|9 - * - 2124|9 + * - 2104 | 5|6 + * - 2114 | 9 + * - 2124 | 9 * - 2194 - * - 2212|4 - * - 2292|4 + * - 2212 | 4 + * - 2292 | 4 * * variant 2 (lpc2000_v2): * - 213x * - 214x - * - 2101|2|3 - * - 2364|6|8 + * - 2101 | 2|3 + * - 2364 | 6|8 * - 2378 */ Modified: trunk/src/flash/nand.c =================================================================== --- trunk/src/flash/nand.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/nand.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -311,9 +311,9 @@ "erase blocks on NAND flash device <num> <offset> <length>"); register_command(cmd_ctx, nand_cmd, "dump", handle_nand_dump_command, COMMAND_EXEC, "dump from NAND flash device <num> <filename> " - "<offset> <length> [oob_raw|oob_only]"); + "<offset> <length> [oob_raw | oob_only]"); register_command(cmd_ctx, nand_cmd, "write", handle_nand_write_command, COMMAND_EXEC, - "write to NAND flash device <num> <filename> <offset> [oob_raw|oob_only|oob_softecc|oob_softecc_kw]"); + "write to NAND flash device <num> <filename> <offset> [oob_raw | oob_only | oob_softecc | oob_softecc_kw]"); register_command(cmd_ctx, nand_cmd, "raw_access", handle_nand_raw_access_command, COMMAND_EXEC, "raw access to NAND flash device <num> ['enable'|'disable']"); } Modified: trunk/src/flash/non_cfi.c =================================================================== --- trunk/src/flash/non_cfi.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/non_cfi.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -29,7 +29,7 @@ #define KB 1024 #define MB (1024*1024) -#define ERASE_REGION(num, size) (((size/256) << 16)|(num-1)) +#define ERASE_REGION(num, size) (((size/256) << 16) | (num-1)) /* non-CFI compatible flashes */ non_cfi_t non_cfi_flashes[] = { Modified: trunk/src/flash/ocl/at91sam7x/main.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -72,7 +72,7 @@ /* verify written data */ if (!result) result = flash_verify(adr, len, ((uint8 *)buffer) + ofs); - dcc_wr(OCL_CMD_DONE|result); + dcc_wr(OCL_CMD_DONE | result); } @@ -84,14 +84,14 @@ cmd = dcc_rd(); switch (cmd&OCL_CMD_MASK) { case OCL_PROBE: - dcc_wr(OCL_CMD_DONE|flash_init()); + dcc_wr(OCL_CMD_DONE | flash_init()); dcc_wr(0x100000); /* base */ dcc_wr(flash_page_count*flash_page_size); /* size */ dcc_wr(1); /* num_sectors */ dcc_wr(4096 | ((unsigned long) flash_page_size << 16)); /* buflen and bufalign */ break; case OCL_ERASE_ALL: - dcc_wr(OCL_CMD_DONE|flash_erase_all()); + dcc_wr(OCL_CMD_DONE | flash_erase_all()); break; case OCL_FLASH_BLOCK: cmd_flash(cmd); Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -164,7 +164,7 @@ if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; /* set no erase before programming */ - outr(MC_FMR + efc_ofs, inr(MC_FMR + efc_ofs)|0x80); + outr(MC_FMR + efc_ofs, inr(MC_FMR + efc_ofs) | 0x80); return FLASH_STAT_OK; } Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -162,7 +162,7 @@ target_t *target = bank->target; uint32_t status; - target_write_u32(target, PIC32MX_NVMCON, NVMCON_NVMWREN|op); + target_write_u32(target, PIC32MX_NVMCON, NVMCON_NVMWREN | op); /* unlock flash registers */ target_write_u32(target, PIC32MX_NVMKEY, NVMKEY1); @@ -841,7 +841,7 @@ /* chip erase flash memory */ target_write_u32(target, PIC32MX_FLASH_CR, FLASH_MER); - target_write_u32(target, PIC32MX_FLASH_CR, FLASH_MER|FLASH_STRT); + target_write_u32(target, PIC32MX_FLASH_CR, FLASH_MER | FLASH_STRT); status = pic32mx_wait_status_busy(bank, 10); Modified: trunk/src/flash/stellaris.c =================================================================== --- trunk/src/flash/stellaris.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/stellaris.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -346,7 +346,7 @@ target_t *target = bank->target; uint32_t fmc; - target_read_u32(target, FLASH_CONTROL_BASE|FLASH_FMC, &fmc); + target_read_u32(target, FLASH_CONTROL_BASE | FLASH_FMC, &fmc); return fmc; } @@ -360,9 +360,9 @@ uint32_t rcc, pllcfg, sysdiv, usesysdiv, bypass, oscsrc; unsigned long mainfreq; - target_read_u32(target, SCB_BASE|RCC, &rcc); + target_read_u32(target, SCB_BASE | RCC, &rcc); LOG_DEBUG("Stellaris RCC %" PRIx32 "", rcc); - target_read_u32(target, SCB_BASE|PLLCFG, &pllcfg); + target_read_u32(target, SCB_BASE | PLLCFG, &pllcfg); LOG_DEBUG("Stellaris PLLCFG %" PRIx32 "", pllcfg); stellaris_info->rcc = rcc; @@ -412,7 +412,7 @@ uint32_t usecrl = (stellaris_info->mck_freq/1000000ul-1); LOG_DEBUG("usecrl = %i",(int)(usecrl)); - target_write_u32(target, SCB_BASE|USECRL, usecrl); + target_write_u32(target, SCB_BASE | USECRL, usecrl); } #if 0 @@ -439,7 +439,7 @@ target_t *target = bank->target; fmc = FMC_WRKEY | cmd; - target_write_u32(target, FLASH_CONTROL_BASE|FLASH_FMC, fmc); + target_write_u32(target, FLASH_CONTROL_BASE | FLASH_FMC, fmc); LOG_DEBUG("Flash command: 0x%x", fmc); if (stellaris_wait_status_busy(bank, cmd, 100)) @@ -460,10 +460,10 @@ int i; /* Read and parse chip identification register */ - target_read_u32(target, SCB_BASE|DID0, &did0); - target_read_u32(target, SCB_BASE|DID1, &did1); - target_read_u32(target, SCB_BASE|DC0, &stellaris_info->dc0); - target_read_u32(target, SCB_BASE|DC1, &stellaris_info->dc1); + target_read_u32(target, SCB_BASE | DID0, &did0); + target_read_u32(target, SCB_BASE | DID1, &did1); + target_read_u32(target, SCB_BASE | DC0, &stellaris_info->dc0); + target_read_u32(target, SCB_BASE | DC1, &stellaris_info->dc1); LOG_DEBUG("did0 0x%" PRIx32 ", did1 0x%" PRIx32 ", dc0 0x%" PRIx32 ", dc1 0x%" PRIx32 "", did0, did1, stellaris_info->dc0, stellaris_info->dc1); @@ -503,7 +503,7 @@ stellaris_info->pagesize = 1024; bank->size = 1024 * stellaris_info->num_pages; stellaris_info->pages_in_lockregion = 2; - target_read_u32(target, SCB_BASE|FMPPE, &stellaris_info->lockbits); + target_read_u32(target, SCB_BASE | FMPPE, &stellaris_info->lockbits); /* provide this for the benefit of the higher flash driver layers */ bank->num_sectors = stellaris_info->num_pages; @@ -597,7 +597,7 @@ /* Clear and disable flash programming interrupts */ target_write_u32(target, FLASH_CIM, 0); - target_write_u32(target, FLASH_MISC, PMISC|AMISC); + target_write_u32(target, FLASH_MISC, PMISC | AMISC); for (banknr = first; banknr <= last; banknr++) { @@ -672,10 +672,10 @@ /* Clear and disable flash programming interrupts */ target_write_u32(target, FLASH_CIM, 0); - target_write_u32(target, FLASH_MISC, PMISC|AMISC); + target_write_u32(target, FLASH_MISC, PMISC | AMISC); LOG_DEBUG("fmppe 0x%" PRIx32 "",fmppe); - target_write_u32(target, SCB_BASE|FMPPE, fmppe); + target_write_u32(target, SCB_BASE | FMPPE, fmppe); /* Commit FMPPE */ target_write_u32(target, FLASH_FMA, 1); /* Write commit command */ @@ -698,7 +698,7 @@ return ERROR_FLASH_OPERATION_FAILED; } - target_read_u32(target, SCB_BASE|FMPPE, &stellaris_info->lockbits); + target_read_u32(target, SCB_BASE | FMPPE, &stellaris_info->lockbits); return ERROR_OK; } @@ -869,7 +869,7 @@ /* Clear and disable flash programming interrupts */ target_write_u32(target, FLASH_CIM, 0); - target_write_u32(target, FLASH_MISC, PMISC|AMISC); + target_write_u32(target, FLASH_MISC, PMISC | AMISC); /* multiple words to be programmed? */ if (words_remaining > 0) @@ -1014,7 +1014,7 @@ /* Clear and disable flash programming interrupts */ target_write_u32(target, FLASH_CIM, 0); - target_write_u32(target, FLASH_MISC, PMISC|AMISC); + target_write_u32(target, FLASH_MISC, PMISC | AMISC); target_write_u32(target, FLASH_FMA, 0); target_write_u32(target, FLASH_FMC, FMC_WRKEY | FMC_MERASE); Modified: trunk/src/flash/stellaris.h =================================================================== --- trunk/src/flash/stellaris.h 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/stellaris.h 2009-06-23 22:45:15 UTC (rev 2374) @@ -68,12 +68,12 @@ #define USECRL 0x140 #define FLASH_CONTROL_BASE 0x400FD000 -#define FLASH_FMA (FLASH_CONTROL_BASE|0x000) -#define FLASH_FMD (FLASH_CONTROL_BASE|0x004) -#define FLASH_FMC (FLASH_CONTROL_BASE|0x008) -#define FLASH_CRIS (FLASH_CONTROL_BASE|0x00C) -#define FLASH_CIM (FLASH_CONTROL_BASE|0x010) -#define FLASH_MISC (FLASH_CONTROL_BASE|0x014) +#define FLASH_FMA (FLASH_CONTROL_BASE | 0x000) +#define FLASH_FMD (FLASH_CONTROL_BASE | 0x004) +#define FLASH_FMC (FLASH_CONTROL_BASE | 0x008) +#define FLASH_CRIS (FLASH_CONTROL_BASE | 0x00C) +#define FLASH_CIM (FLASH_CONTROL_BASE | 0x010) +#define FLASH_MISC (FLASH_CONTROL_BASE | 0x014) #define AMISC 1 #define PMISC 2 Modified: trunk/src/flash/stm32x.c =================================================================== --- trunk/src/flash/stm32x.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/stm32x.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -122,9 +122,9 @@ alive_sleep(1); } /* Clear but report errors */ - if (status & (FLASH_WRPRTERR|FLASH_PGERR)) + if (status & (FLASH_WRPRTERR | FLASH_PGERR)) { - target_write_u32(target, STM32_FLASH_SR, FLASH_WRPRTERR|FLASH_PGERR); + target_write_u32(target, STM32_FLASH_SR, FLASH_WRPRTERR | FLASH_PGERR); } return status; } @@ -140,7 +140,7 @@ /* read current option bytes */ target_read_u32(target, STM32_FLASH_OBR, &optiondata); - stm32x_info->option_bytes.user_options = (uint16_t)0xFFF8|((optiondata >> 2) & 0x07); + stm32x_info->option_bytes.user_options = (uint16_t)0xFFF8 | ((optiondata >> 2) & 0x07); stm32x_info->option_bytes.RDP = (optiondata & (1 << OPT_READOUT)) ? 0xFFFF : 0x5AA5; if (optiondata & (1 << OPT_READOUT)) @@ -177,8 +177,8 @@ target_write_u32(target, STM32_FLASH_OPTKEYR, KEY2); /* erase option bytes */ - target_write_u32(target, STM32_FLASH_CR, FLASH_OPTER|FLASH_OPTWRE); - target_write_u32(target, STM32_FLASH_CR, FLASH_OPTER|FLASH_STRT|FLASH_OPTWRE); + target_write_u32(target, STM32_FLASH_CR, FLASH_OPTER | FLASH_OPTWRE); + target_write_u32(target, STM32_FLASH_CR, FLASH_OPTER | FLASH_STRT | FLASH_OPTWRE); status = stm32x_wait_status_busy(bank, 10); @@ -211,7 +211,7 @@ target_write_u32(target, STM32_FLASH_OPTKEYR, KEY2); /* program option bytes */ - target_write_u32(target, STM32_FLASH_CR, FLASH_OPTPG|FLASH_OPTWRE); + target_write_u32(target, STM32_FLASH_CR, FLASH_OPTPG | FLASH_OPTWRE); /* write user option byte */ target_write_u16(target, STM32_OB_USER, stm32x_info->option_bytes.user_options); @@ -374,7 +374,7 @@ { target_write_u32(target, STM32_FLASH_CR, FLASH_PER); target_write_u32(target, STM32_FLASH_AR, bank->base + bank->sectors[i].offset); - target_write_u32(target, STM32_FLASH_CR, FLASH_PER|FLASH_STRT); + target_write_u32(target, STM32_FLASH_CR, FLASH_PER | FLASH_STRT); status = stm32x_wait_status_busy(bank, 10); @@ -1098,7 +1098,7 @@ if (argc < 4) { - command_print(cmd_ctx, "stm32x options_write <bank> <SWWDG|HWWDG> <RSTSTNDBY|NORSTSTNDBY> <RSTSTOP|NORSTSTOP>"); + command_print(cmd_ctx, "stm32x options_write <bank> <SWWDG | HWWDG> <RSTSTNDBY | NORSTSTNDBY> <RSTSTOP | NORSTSTOP>"); return ERROR_OK; } @@ -1182,7 +1182,7 @@ /* mass erase flash memory */ target_write_u32(target, STM32_FLASH_CR, FLASH_MER); - target_write_u32(target, STM32_FLASH_CR, FLASH_MER|FLASH_STRT); + target_write_u32(target, STM32_FLASH_CR, FLASH_MER | FLASH_STRT); status = stm32x_wait_status_busy(bank, 10); Modified: trunk/src/flash/str7x.c =================================================================== --- trunk/src/flash/str7x.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/str7x.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -160,7 +160,7 @@ bank->driver_priv = str7x_info; /* set default bits for str71x flash */ - str7x_info->busy_bits = (FLASH_LOCK|FLASH_BSYA1|FLASH_BSYA0); + str7x_info->busy_bits = (FLASH_LOCK | FLASH_BSYA1 | FLASH_BSYA0); str7x_info->disable_bit = (1 << 1); if (strcmp(args[6], "STR71x") == 0) @@ -170,7 +170,7 @@ else if (strcmp(args[6], "STR73x") == 0) { str7x_info->register_base = 0x80100000; - str7x_info->busy_bits = (FLASH_LOCK|FLASH_BSYA0); + str7x_info->busy_bits = (FLASH_LOCK | FLASH_BSYA0); } else if (strcmp(args[6], "STR75x") == 0) { @@ -270,7 +270,7 @@ cmd = sectors; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR1), cmd); - cmd = FLASH_SER|FLASH_WMS; + cmd = FLASH_SER | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){ @@ -326,7 +326,7 @@ cmd = protect_blocks; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), cmd); - cmd = FLASH_SPR|FLASH_WMS; + cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd); while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){ Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/str9xpec.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -1002,7 +1002,7 @@ if (argc < 2) { - command_print(cmd_ctx, "str9xpec options_cmap <bank> <bank0|bank1>"); + command_print(cmd_ctx, "str9xpec options_cmap <bank> <bank0 | bank1>"); return ERROR_OK; } @@ -1034,7 +1034,7 @@ if (argc < 2) { - command_print(cmd_ctx, "str9xpec options_lvdthd <bank> <2.4v|2.7v>"); + command_print(cmd_ctx, "str9xpec options_lvdthd <bank> <2.4v | 2.7v>"); return ERROR_OK; } @@ -1066,7 +1066,7 @@ if (argc < 2) { - command_print(cmd_ctx, "str9xpec options_lvdsel <bank> <vdd|vdd_vddq>"); + command_print(cmd_ctx, "str9xpec options_lvdsel <bank> <vdd | vdd_vddq>"); return ERROR_OK; } @@ -1098,7 +1098,7 @@ if (argc < 2) { - command_print(cmd_ctx, "str9xpec options_lvdwarn <bank> <vdd|vdd_vddq>"); + command_print(cmd_ctx, "str9xpec options_lvdwarn <bank> <vdd | vdd_vddq>"); return ERROR_OK; } Modified: trunk/src/flash/tms470.c =================================================================== --- trunk/src/flash/tms470.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/flash/tms470.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -411,7 +411,7 @@ { if (argc > 1) { - command_print(cmd_ctx, "tms470 plldis <0|1>"); + command_print(cmd_ctx, "tms470 plldis <0 | 1>"); return ERROR_INVALID_ARGUMENTS; } else if (argc == 1) Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:45:15 UTC (rev 2374) @@ -55,7 +55,7 @@ { if ((num == 32) && (first == 0)) { - return (((uint32_t)buffer[3]) << 24)|(((uint32_t)buffer[2]) << 16)|(((uint32_t)buffer[1]) << 8)|(((uint32_t)buffer[0]) << 0); + return (((uint32_t)buffer[3]) << 24) | (((uint32_t)buffer[2]) << 16) | (((uint32_t)buffer[1]) << 8) | (((uint32_t)buffer[0]) << 0); } else { uint32_t result = 0; Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/helper/command.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -825,7 +825,7 @@ if (!recursion) { recursion++; - Jim_ProcessEvents (interp, JIM_ALL_EVENTS|JIM_DONT_WAIT); + Jim_ProcessEvents (interp, JIM_ALL_EVENTS | JIM_DONT_WAIT); recursion--; } #endif Modified: trunk/src/helper/jim-eventloop.c =================================================================== --- trunk/src/helper/jim-eventloop.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/helper/jim-eventloop.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -64,7 +64,7 @@ /* File event structure */ typedef struct Jim_FileEvent { void *handle; - int mask; /* one of JIM_EVENT_(READABLE|WRITABLE|EXCEPTION) */ + int mask; /* one of JIM_EVENT_(READABLE | WRITABLE | EXCEPTION) */ Jim_FileProc *fileProc; Jim_EventFinalizerProc *finalizerProc; void *clientData; @@ -237,7 +237,7 @@ /* --- POSIX version of Jim_ProcessEvents, for now the only available --- */ #define JIM_FILE_EVENTS 1 #define JIM_TIME_EVENTS 2 -#define JIM_ALL_EVENTS (JIM_FILE_EVENTS|JIM_TIME_EVENTS) +#define JIM_ALL_EVENTS (JIM_FILE_EVENTS | JIM_TIME_EVENTS) #define JIM_DONT_WAIT 4 /* Process every pending time event, then every pending file event Modified: trunk/src/helper/jim-eventloop.h =================================================================== --- trunk/src/helper/jim-eventloop.h 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/helper/jim-eventloop.h 2009-06-23 22:45:15 UTC (rev 2374) @@ -71,7 +71,7 @@ /* --- POSIX version of Jim_ProcessEvents, for now the only available --- */ #define JIM_FILE_EVENTS 1 #define JIM_TIME_EVENTS 2 -#define JIM_ALL_EVENTS (JIM_FILE_EVENTS|JIM_TIME_EVENTS) +#define JIM_ALL_EVENTS (JIM_FILE_EVENTS | JIM_TIME_EVENTS) #define JIM_DONT_WAIT 4 JIM_STATIC void JIM_API(Jim_CreateFileHandler) (Jim_Interp *interp, Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/helper/jim.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -6963,7 +6963,7 @@ case JIM_EXPROP_NUMNE: wC = wA != wB; break; case JIM_EXPROP_BITAND: wC = wA&wB; break; case JIM_EXPROP_BITXOR: wC = wA^wB; break; - case JIM_EXPROP_BITOR: wC = wA|wB; break; + case JIM_EXPROP_BITOR: wC = wA | wB; break; case JIM_EXPROP_POW: wC = JimPowWide(wA,wB); break; case JIM_EXPROP_LOGICAND_LEFT: if (wA == 0) { @@ -6996,7 +6996,7 @@ wC = _rotl(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA << wB)|(uA >> (S-wB))); + wC = (unsigned long)((uA << wB) | (uA >> (S-wB))); #endif break; } @@ -7006,7 +7006,7 @@ wC = _rotr(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA >> wB)|(uA << (S-wB))); + wC = (unsigned long)((uA >> wB) | (uA << (S-wB))); #endif break; } Modified: trunk/src/helper/jim.h =================================================================== --- trunk/src/helper/jim.h 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/helper/jim.h 2009-06-23 22:45:15 UTC (rev 2374) @@ -1114,7 +1114,7 @@ * * switch ( n->value ){ * case OPT_SEX: - * // handle: --sex male|female|lots|needmore + * // handle: --sex male | female | lots | needmore * e = Jim_GetOpt_Nvp( &goi, &nvp_sex, &n ); * if ( e != JIM_OK ){ * Jim_GetOpt_NvpUnknown( &ogi, nvp_sex, 1 ); Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/jtag/jlink.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -299,7 +299,7 @@ "query jlink info"); register_command(cmd_ctx, NULL, "jlink_hw_jtag", &jlink_handle_jlink_hw_jtag_command, COMMAND_EXEC, - "set/get jlink hw jtag command version [2|3]"); + "set/get jlink hw jtag command version [2 | 3]"); return ERROR_OK; } Modified: trunk/src/jtag/parport.c =================================================================== --- trunk/src/jtag/parport.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/jtag/parport.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -469,7 +469,7 @@ { if (argc != 1) { - command_print(cmd_ctx, "usage: parport_write_on_exit <on|off>"); + command_print(cmd_ctx, "usage: parport_write_on_exit <on | off>"); return ERROR_OK; } Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/jtag/tcl.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -699,11 +699,11 @@ register_jim(cmd_ctx, "pathmove", Jim_Command_pathmove, "move JTAG to state1 then to state2, state3, etc. <state1>,<state2>,<stat3>..."); register_command(cmd_ctx, NULL, "verify_ircapture", handle_verify_ircapture_command, - COMMAND_ANY, "verify value captured during Capture-IR <enable|disable>"); + COMMAND_ANY, "verify value captured during Capture-IR <enable | disable>"); register_command(cmd_ctx, NULL, "verify_jtag", handle_verify_jtag_command, - COMMAND_ANY, "verify value capture <enable|disable>"); + COMMAND_ANY, "verify value capture <enable | disable>"); register_command(cmd_ctx, NULL, "tms_sequence", handle_tms_sequence_command, - COMMAND_ANY, "choose short(default) or long tms_sequence <short|long>"); + COMMAND_ANY, "choose short(default) or long tms_sequence <short | long>"); return ERROR_OK; } Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:45:15 UTC (rev 2374) @@ -74,7 +74,7 @@ } waitQueue(); sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|a); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8) | (a << 4) | a); } @@ -106,7 +106,7 @@ } /* shift out value */ waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, (((value >> i)&1) << 1)|tms); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, (((value >> i)&1) << 1) | tms); } waitIdle(); ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0); @@ -116,11 +116,11 @@ setCurrentState(endState); } else { - ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8) | (a << 4) | b); } #else /* fast version */ - ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8) | (a << 4) | b); #endif #else /* maximum debug version */ @@ -132,15 +132,15 @@ { sampleShiftRegister(); ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value >> i); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 8)|(a << 4)|a); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 8) | (a << 4) | a); } sampleShiftRegister(); ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value >> (repeat-1)); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 8)|(a << 4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 8) | (a << 4) | b); } else { sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8) | (a << 4) | b); } sampleShiftRegister(); #endif Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -405,7 +405,7 @@ a = state; b = endState; ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value); - ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 15)|(repeat << 8)|(a << 4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 15) | (repeat << 8) | (a << 4) | b); VERBOSE(getShiftValueFlip()); } #endif @@ -741,7 +741,7 @@ for (i = 0; i < count; i++) { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 1)); - shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1 << 5)); + shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr | (1 << 5)); buffer += 4; } } else @@ -750,7 +750,7 @@ for (i = 0; i < count; i++) { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 0)); - shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1 << 5)); + shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr | (1 << 5)); buffer += 4; } } Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -1951,7 +1951,7 @@ embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_MASK], 0xffffffff); embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_MASK], 0xffffffff); embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE); - embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~(EICE_W_CTRL_RANGE|EICE_W_CTRL_nOPC) & 0xff); + embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~(EICE_W_CTRL_RANGE | EICE_W_CTRL_nOPC) & 0xff); embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], current_pc); embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_MASK], 0); embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_MASK], 0xffffffff); @@ -2842,17 +2842,17 @@ arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", NULL, COMMAND_ANY, "arm7/9 specific commands"); - register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", handle_arm7_9_write_xpsr_command, COMMAND_EXEC, "write program status register <value> <not cpsr|spsr>"); - register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, "write program status register <8bit immediate> <rotate> <not cpsr|spsr>"); + register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", handle_arm7_9_write_xpsr_command, COMMAND_EXEC, "write program status register <value> <not cpsr | spsr>"); + register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, "write program status register <8bit immediate> <rotate> <not cpsr | spsr>"); register_command(cmd_ctx, arm7_9_cmd, "write_core_reg", handle_arm7_9_write_core_reg_command, COMMAND_EXEC, "write core register <num> <mode> <value>"); register_command(cmd_ctx, arm7_9_cmd, "dbgrq", handle_arm7_9_dbgrq_command, - COMMAND_ANY, "use EmbeddedICE dbgrq instead of breakpoint for target halt requests <enable|disable>"); + COMMAND_ANY, "use EmbeddedICE dbgrq instead of breakpoint for target halt requests <enable | disable>"); register_command(cmd_ctx, arm7_9_cmd, "fast_memory_access", handle_arm7_9_fast_memory_access_command, - COMMAND_ANY, "use fast memory accesses instead of slower but potentially safer accesses <enable|disable>"); + COMMAND_ANY, "use fast memory accesses instead of slower but potentially safer accesses <enable | disable>"); register_command(cmd_ctx, arm7_9_cmd, "dcc_downloads", handle_arm7_9_dcc_downloads_command, - COMMAND_ANY, "use DCC downloads for larger memory writes <enable|disable>"); + COMMAND_ANY, "use DCC downloads for larger memory writes <enable | disable>"); armv4_5_register_commands(cmd_ctx); @@ -2884,7 +2884,7 @@ if (argc < 2) { - command_print(cmd_ctx, "usage: write_xpsr <value> <not cpsr|spsr>"); + command_print(cmd_ctx, "usage: write_xpsr <value> <not cpsr | spsr>"); return ERROR_OK; } @@ -2929,7 +2929,7 @@ if (argc < 3) { - command_print(cmd_ctx, "usage: write_xpsr_im8 <im8> <rotate> <not cpsr|spsr>"); + command_print(cmd_ctx, "usage: write_xpsr_im8 <im8> <rotate> <not cpsr | spsr>"); return ERROR_OK; } @@ -3005,7 +3005,7 @@ } else { - command_print(cmd_ctx, "usage: arm7_9 dbgrq <enable|disable>"); + command_print(cmd_ctx, "usage: arm7_9 dbgrq <enable | disable>"); } } @@ -3038,7 +3038,7 @@ } else { - command_print(cmd_ctx, "usage: arm7_9 fast_memory_access <enable|disable>"); + command_print(cmd_ctx, "usage: arm7_9 fast_memory_access <enable | disable>"); } } @@ -3071,7 +3071,7 @@ } else { - command_print(cmd_ctx, "usage: arm7_9 dcc_downloads <enable|disable>"); + command_print(cmd_ctx, "usage: arm7_9 dcc_downloads <enable | disable>"); } } Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/arm_adi_v5.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -1068,11 +1068,11 @@ command_print(cmd_ctx, "\tROM table in legacy format" ); } /* Now we read ROM table ID registers, ref. ARM IHI 0029B sec */ - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF0, &cid0); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF4, &cid1); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF8, &cid2); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFFC, &cid3); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFCC, &memtype); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000) | 0xFF0, &cid0); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000) | 0xFF4, &cid1); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000) | 0xFF8, &cid2); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000) | 0xFFC, &cid3); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000) | 0xFCC, &memtype); swjdp_transaction_endcheck(swjdp); command_print(cmd_ctx, "\tCID3 0x%" PRIx32 ", CID2 0x%" PRIx32 ", CID1 0x%" PRIx32 " CID0, 0x%" PRIx32,cid3,cid2,cid1,cid0); if (memtype&0x01) @@ -1084,25 +1084,25 @@ command_print(cmd_ctx, "\tMEMTYPE system memory not present. Dedicated debug bus" ); } - /* Now we read ROM table entries from dbgbase&0xFFFFF000)|0x000 until we get 0x00000000 */ + /* Now we read ROM table entries from dbgbase&0xFFFFF000) | 0x000 until we get 0x00000000 */ entry_offset = 0; do { - mem_ap_read_atomic_u32(swjdp, (dbgbase&0xFFFFF000)|entry_offset, &romentry); + mem_ap_read_atomic_u32(swjdp, (dbgbase&0xFFFFF000) | entry_offset, &romentry); command_print(cmd_ctx, "\tROMTABLE[0x%x] = 0x%" PRIx32 "",entry_offset,romentry); if (romentry&0x01) { uint32_t c_cid0,c_cid1,c_cid2,c_cid3,c_pid0,c_pid1,c_pid2,c_pid3,c_pid4,component_start; uint32_t component_base = (uint32_t)((dbgbase&0xFFFFF000) + (int)(romentry&0xFFFFF000)); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFE0, &c_pid0); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFE4, &c_pid1); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFE8, &c_pid2); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFEC, &c_pid3); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFD0, &c_pid4); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFF0, &c_cid0); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFF4, &c_cid1); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFF8, &c_cid2); - mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFFC, &c_cid3); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFE0, &c_pid0); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFE4, &c_pid1); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFE8, &c_pid2); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFEC, &c_pid3); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFD0, &c_pid4); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFF0, &c_cid0); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFF4, &c_cid1); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFF8, &c_cid2); + mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000) | 0xFFC, &c_cid3); component_start = component_base - 0x1000*(c_pid4 >> 4); command_print(cmd_ctx, "\t\tComponent base address 0x%" PRIx32 ", pid4 0x%" PRIx32 ", start address 0x%" PRIx32 "",component_base,c_pid4,component_start); command_print(cmd_ctx, "\t\tComponent cid1 0x%" PRIx32 ", class is %s",c_cid1,class_description[(c_cid1 >> 4)&0xF]); /* Se ARM DDI 0314 C Table 2.2 */ Modified: trunk/src/target/armv4_5.c =================================================================== --- trunk/src/target/armv4_5.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/armv4_5.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -456,7 +456,7 @@ armv4_5_cmd = register_command(cmd_ctx, NULL, "armv4_5", NULL, COMMAND_ANY, "armv4/5 specific commands"); register_command(cmd_ctx, armv4_5_cmd, "reg", handle_armv4_5_reg_command, COMMAND_EXEC, "display ARM core registers"); - register_command(cmd_ctx, armv4_5_cmd, "core_state", handle_armv4_5_core_state_command, COMMAND_EXEC, "display/change ARM core state <arm|thumb>"); + register_command(cmd_ctx, armv4_5_cmd, "core_state", handle_armv4_5_core_state_command, COMMAND_EXEC, "display/change ARM core state <arm | thumb>"); register_command(cmd_ctx, armv4_5_cmd, "disassemble", handle_armv4_5_disassemble_command, COMMAND_EXEC, "disassemble instructions <address> <count> ['thumb']"); return ERROR_OK; Modified: trunk/src/target/cortex_m3.c =================================================================== --- trunk/src/target/cortex_m3.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/cortex_m3.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -1112,8 +1112,8 @@ comparator_list[dwt_num].mask = mask; comparator_list[dwt_num].function = watchpoint->rw + 5; target_write_u32(target, comparator_list[dwt_num].dwt_comparator_address, comparator_list[dwt_num].comp); - target_write_u32(target, comparator_list[dwt_num].dwt_comparator_address|0x4, comparator_list[dwt_num].mask); - target_write_u32(target, comparator_list[dwt_num].dwt_comparator_address|0x8, comparator_list[dwt_num].function); + target_write_u32(target, comparator_list[dwt_num].dwt_comparator_address | 0x4, comparator_list[dwt_num].mask); + target_write_u32(target, comparator_list[dwt_num].dwt_comparator_address | 0x8, comparator_list[dwt_num].function); LOG_DEBUG("dwt_num %i 0x%" PRIx32 " 0x%" PRIx32 " 0x%" PRIx32 "", dwt_num, comparator_list[dwt_num].comp, comparator_list[dwt_num].mask, comparator_list[dwt_num].function); } else @@ -1149,7 +1149,7 @@ } comparator_list[dwt_num].used = 0; comparator_list[dwt_num].function = 0; - target_write_u32(target, comparator_list[dwt_num].dwt_comparator_address|0x8, comparator_list[dwt_num].function); + target_write_u32(target, comparator_list[dwt_num].dwt_comparator_address | 0x8, comparator_list[dwt_num].function); watchpoint->set = 0; @@ -1648,7 +1648,7 @@ { if (!strcmp(args[0], "on")) { - cortex_m3_write_debug_halt_mask(target, C_HALT|C_MASKINTS, 0); + cortex_m3_write_debug_halt_mask(target, C_HALT | C_MASKINTS, 0); } else if (!strcmp(args[0], "off")) { Modified: trunk/src/target/etm.c =================================================================== --- trunk/src/target/etm.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/etm.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -1107,7 +1107,7 @@ } else if (argc != 0) { - command_print(cmd_ctx, "usage: configure trace mode <none|data|address|all> <context id bits> <cycle accurate> <branch output>"); + command_print(cmd_ctx, "usage: configure trace mode <none | data | address | all> <context id bits> <cycle accurate> <branch output>"); return ERROR_OK; } @@ -1826,7 +1826,7 @@ int etm_register_user_commands(struct command_context_s *cmd_ctx) { register_command(cmd_ctx, etm_cmd, "tracemode", handle_etm_tracemode_command, - COMMAND_EXEC, "configure trace mode <none|data|address|all> " + COMMAND_EXEC, "configure trace mode <none | data | address | all> " "<context_id_bits> <cycle_accurate> <branch_output>"); register_command(cmd_ctx, etm_cmd, "info", handle_etm_info_command, Modified: trunk/src/target/mips32.h =================================================================== --- trunk/src/target/mips32.h 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/mips32.h 2009-06-23 22:45:15 UTC (rev 2374) @@ -94,8 +94,8 @@ #define MIPS32_COP0_MF 0x00 #define MIPS32_COP0_MT 0x04 -#define MIPS32_R_INST(opcode, rs, rt, rd, shamt, funct) (((opcode) << 26) |((rs) << 21)|((rt) << 16)|((rd) << 11)| ((shamt) << 6) | (funct)) -#define MIPS32_I_INST(opcode, rs, rt, immd) (((opcode) << 26) |((rs) << 21)|((rt) << 16)|(immd)) +#define MIPS32_R_INST(opcode, rs, rt, rd, shamt, funct) (((opcode) << 26) |((rs) << 21) | ((rt) << 16) | ((rd) << 11)| ((shamt) << 6) | (funct)) +#define MIPS32_I_INST(opcode, rs, rt, immd) (((opcode) << 26) |((rs) << 21) | ((rt) << 16) | (immd)) #define MIPS32_J_INST(opcode, addr) (((opcode) << 26) |(addr)) #define MIPS32_NOP 0 Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/target.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -1483,7 +1483,7 @@ register_command(cmd_ctx, NULL, "halt", handle_halt_command, COMMAND_EXEC, "halt target"); register_command(cmd_ctx, NULL, "resume", handle_resume_command, COMMAND_EXEC, "resume target [addr]"); register_command(cmd_ctx, NULL, "step", handle_step_command, COMMAND_EXEC, "step one instruction from current PC or [addr]"); - register_command(cmd_ctx, NULL, "reset", handle_reset_command, COMMAND_EXEC, "reset target [run|halt|init] - default is run"); + register_command(cmd_ctx, NULL, "reset", handle_reset_command, COMMAND_EXEC, "reset target [run | halt | init] - default is run"); register_command(cmd_ctx, NULL, "soft_reset_halt", handle_soft_reset_halt_command, COMMAND_EXEC, "halt the target and do a soft reset"); register_command(cmd_ctx, NULL, "mdw", handle_md_command, COMMAND_EXEC, "display memory words <addr> [count]"); @@ -3987,7 +3987,7 @@ break; case TS_CMD_RESET: if ( goi.argc != 2 ){ - Jim_WrongNumArgs( interp, 2, argv, "t|f|assert|deassert BOOL"); + Jim_WrongNumArgs( interp, 2, argv, "t | f|assert | deassert BOOL"); return JIM_ERR; } e = Jim_GetOpt_Nvp( &goi, nvp_assert, &n ); Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-23 22:44:17 UTC (rev 2373) +++ trunk/src/target/xscale.c 2009-06-23 22:45:15 UTC (rev 2374) @@ -3693,7 +3693,7 @@ register_command(cmd_ctx, xscale_cmd, "vector_catch", xscale_handle_vector_catch_command, COMMAND_EXEC, "<mask> of vectors that should be catched"); - register_command(cmd_ctx, xscale_cmd, "trace_buffer", xscale_handle_trace_buffer_command, COMMAND_EXEC, "<enable|disable> ['fill' [n]|'wrap']"); + register_command(cmd_ctx, xscale_cmd, "trace_buffer", xscale_handle_trace_buffer_command, COMMAND_EXEC, "<enable | disable> ['fill' [n]|'wrap']"); register_command(cmd_ctx, xscale_cmd, "dump_trace", xscale_handle_dump_trace_command, COMMAND_EXEC, "dump content of trace buffer to <file>"); register_command(cmd_ctx, xscale_cmd, "analyze_trace", xscale_handle_analyze_trace_buffer_command, COMMAND_EXEC, "analyze content of trace buffer"); |
From: <zw...@ma...> - 2009-06-24 00:45:11
|
Author: zwelch Date: 2009-06-24 00:44:17 +0200 (Wed, 24 Jun 2009) New Revision: 2373 Modified: trunk/src/flash/at91sam7.c trunk/src/flash/cfi.c trunk/src/flash/ecos.c trunk/src/flash/flash.c trunk/src/flash/mflash.c trunk/src/flash/mflash.h trunk/src/flash/nand.c trunk/src/flash/ocl.c trunk/src/flash/ocl/at91sam7x/main.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/pic32mx.h trunk/src/flash/stellaris.c trunk/src/flash/str7x.c trunk/src/flash/str9x.c trunk/src/flash/tms470.c trunk/src/helper/binarybuffer.h trunk/src/helper/command.c trunk/src/helper/configuration.c trunk/src/helper/ioutil.c trunk/src/helper/jim-eventloop.c trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/helper/log.c trunk/src/helper/log.h trunk/src/helper/replacements.c trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/ft2232.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.h trunk/src/jtag/presto.c trunk/src/jtag/tcl.c trunk/src/jtag/vsllink.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/server/gdb_server.c trunk/src/server/telnet_server.c trunk/src/target/arm11.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/armv4_5.c trunk/src/target/etb.c trunk/src/target/fa526.c trunk/src/target/image.c trunk/src/target/mips32_dmaacc.c trunk/src/target/mips32_pracc.c trunk/src/target/oocd_trace.c trunk/src/target/target.c trunk/src/target/xscale.c trunk/src/xsvf/xsvf.c Log: - Fixes '+' whitespace - Replace ')\(+\)(' with ') \1 ('. - Replace ')\(+\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(+\)(' with '\1 \2 ('. - Replace '\(\w\)\(+\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -213,19 +213,19 @@ if (at91sam7_info->cidr_arch == 0x60) { /* AT91SAM7A3 uses master clocks in 100 ns */ - fmcn = (at91sam7_info->mck_freq/10000000ul)+1; + fmcn = (at91sam7_info->mck_freq/10000000ul) + 1; } else { /* master clocks in 1uS for ARCH 0x7 types */ - fmcn = (at91sam7_info->mck_freq/1000000ul)+1; + fmcn = (at91sam7_info->mck_freq/1000000ul) + 1; } } else if (mode == FMR_TIMING_FLASH) { /* main clocks in 1.5uS */ fmcn = (at91sam7_info->mck_freq/1000000ul)+ - (at91sam7_info->mck_freq/2000000ul)+1; + (at91sam7_info->mck_freq/2000000ul) + 1; } /* hard overclocking */ @@ -282,7 +282,7 @@ fcr = (0x5A << 24) | ((pagen&0x3FF) << 8) | cmd; target_write_u32(target, MC_FCR[bank->bank_number], fcr); - LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen); + LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number + 1, pagen); if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB)|(cmd == CLB))) { @@ -641,7 +641,7 @@ fast_check = 1; for (nSector = 0; nSector<bank->num_sectors; nSector++) { - retval = target_blank_check_memory(target, bank->base+bank->sectors[nSector].offset, + retval = target_blank_check_memory(target, bank->base + bank->sectors[nSector].offset, bank->sectors[nSector].size, &blank); if (retval != ERROR_OK) { @@ -665,7 +665,7 @@ for (nSector = 0; nSector<bank->num_sectors; nSector++) { bank->sectors[nSector].is_erased = 1; - retval = target_read_memory(target, bank->base+bank->sectors[nSector].offset, 4, + retval = target_read_memory(target, bank->base + bank->sectors[nSector].offset, 4, bank->sectors[nSector].size/4, buffer); if (retval != ERROR_OK) return retval; @@ -707,7 +707,7 @@ at91sam7_info->num_lockbits_on = 0; for (lock_pos = 0; lock_pos<bank->num_sectors; lock_pos++) { - if ( ((status >> (16+lock_pos))&(0x0001)) == 1) + if ( ((status >> (16 + lock_pos))&(0x0001)) == 1) { at91sam7_info->num_lockbits_on++; bank->sectors[lock_pos].is_protected = 1; @@ -725,7 +725,7 @@ at91sam7_info->num_nvmbits_on = 0; for (gpnvm_pos = 0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++) { - if ( ((status >> (8+gpnvm_pos))&(0x01)) == 1) + if ( ((status >> (8 + gpnvm_pos))&(0x01)) == 1) { at91sam7_info->num_nvmbits_on++; } @@ -803,7 +803,7 @@ page_size = atoi(args[11]); num_nvmbits = atoi(args[12]); - target_name = calloc(strlen(args[7])+1, sizeof(char)); + target_name = calloc(strlen(args[7]) + 1, sizeof(char)); strcpy(target_name, args[7]); /* calculate bank size */ @@ -1027,7 +1027,7 @@ /* Write one block to the PageWriteBuffer */ buffer_pos = (pagen-first_page)*dst_min_alignment; wcount = CEIL(count,4); - if ((retval = target_write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK) + if ((retval = target_write_memory(target, bank->base + pagen*dst_min_alignment, 4, wcount, buffer + buffer_pos)) != ERROR_OK) { return retval; } Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/cfi.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -213,7 +213,7 @@ { uint8_t i; for (i = 0;i<2;i++) - target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, + target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } else @@ -235,7 +235,7 @@ { uint8_t i; for (i = 0;i<4;i++) - target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, + target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } else Modified: trunk/src/flash/ecos.c =================================================================== --- trunk/src/flash/ecos.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/ecos.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -274,8 +274,8 @@ uint32_t flashErr; retval = runCode(info, - info->start_address+OFFSET_ERASE, - info->start_address+OFFSET_ERASE+OFFSET_ERASE_SIZE, + info->start_address + OFFSET_ERASE, + info->start_address + OFFSET_ERASE + OFFSET_ERASE_SIZE, address, len, 0, @@ -307,8 +307,8 @@ uint32_t buffer; retval = runCode(info, - info->start_address+OFFSET_GET_WORKAREA, - info->start_address+OFFSET_GET_WORKAREA+OFFSET_GET_WORKAREA_SIZE, + info->start_address + OFFSET_GET_WORKAREA, + info->start_address + OFFSET_GET_WORKAREA + OFFSET_GET_WORKAREA_SIZE, 0, 0, 0, @@ -328,16 +328,16 @@ } int retval; - retval = target_write_buffer(target, buffer, t, ((uint8_t *)data)+i); + retval = target_write_buffer(target, buffer, t, ((uint8_t *)data) + i); if (retval != ERROR_OK) return retval; uint32_t flashErr; retval = runCode(info, - info->start_address+OFFSET_FLASH, - info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE, + info->start_address + OFFSET_FLASH, + info->start_address + OFFSET_FLASH + OFFSET_FLASH_SIZE, buffer, - address+i, + address + i, t, &flashErr, timeout); @@ -410,7 +410,7 @@ { struct flash_bank_s *c = bank; ecosflash_flash_bank_t *info = bank->driver_priv; - return eCosBoard_erase(info, c->base+first*sectorSize, sectorSize*(last-first+1)); + return eCosBoard_erase(info, c->base + first*sectorSize, sectorSize*(last-first + 1)); } static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last) @@ -422,7 +422,7 @@ { ecosflash_flash_bank_t *info = bank->driver_priv; struct flash_bank_s *c = bank; - return eCosBoard_flash(info, buffer, c->base+offset, count); + return eCosBoard_flash(info, buffer, c->base + offset, count); } static int ecosflash_protect_check(struct flash_bank_s *bank) Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/flash.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -1110,7 +1110,7 @@ /* see if we need to pad the section */ while (padding[section]--) - (buffer+buffer_size)[size_read++] = 0xff; + (buffer + buffer_size)[size_read++] = 0xff; buffer_size += size_read; section_offset += size_read; Modified: trunk/src/flash/mflash.c =================================================================== --- trunk/src/flash/mflash.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/mflash.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -923,7 +923,7 @@ CLK_OUT = XIN * ((double)M / N) / NO; - if ((int)((CLK_OUT+ROUND) / DIV) + if ((int)((CLK_OUT + ROUND) / DIV) == (int)(MG_PLL_CLK_OUT / DIV)) { if (mg_is_valid_pll(XIN, N, CLK_OUT, NO) == ERROR_OK) { Modified: trunk/src/flash/mflash.h =================================================================== --- trunk/src/flash/mflash.h 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/mflash.h 2009-06-23 22:44:17 UTC (rev 2373) @@ -294,7 +294,7 @@ typedef enum _mg_opmode { mg_op_mode_xip = 1, /* TRUE XIP */ - mg_op_mode_snd = 2, /* BOOT+Storage */ + mg_op_mode_snd = 2, /* BOOT + Storage */ mg_op_mode_stg = 0 /* Only Storage */ } mg_opmode; Modified: trunk/src/flash/nand.c =================================================================== --- trunk/src/flash/nand.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/nand.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -518,9 +518,9 @@ { if (device->bus_width == 8) { - device->controller->read_data(device, id_buff+3); - device->controller->read_data(device, id_buff+4); - device->controller->read_data(device, id_buff+5); + device->controller->read_data(device, id_buff + 3); + device->controller->read_data(device, id_buff + 4); + device->controller->read_data(device, id_buff + 5); } else { @@ -1420,7 +1420,7 @@ uint8_t ecc[3]; memset(oob, 0xff, oob_size); for (i = 0, j = 0; i < page_size; i += 256) { - nand_calculate_ecc(p, page+i, ecc); + nand_calculate_ecc(p, page + i, ecc); oob[eccpos[j++]] = ecc[0]; oob[eccpos[j++]] = ecc[1]; oob[eccpos[j++]] = ecc[2]; @@ -1437,7 +1437,7 @@ uint8_t *ecc = oob + oob_size - page_size/512 * 10; memset(oob, 0xff, oob_size); for (i = 0; i < page_size; i += 512) { - nand_calculate_ecc_kw(p, page+i, ecc); + nand_calculate_ecc_kw(p, page + i, ecc); ecc += 10; } } Modified: trunk/src/flash/ocl/at91sam7x/main.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -43,7 +43,7 @@ len = cmd&0xffff; ofs = adr%flash_page_size; bi_start = ofs/4; - bi_end = (ofs+len+3)/4; + bi_end = (ofs + len + 3)/4; if (bi_end>BUFSIZE) { dcc_wr(OCL_BUFF_OVER); @@ -65,12 +65,12 @@ result = 0; pagenum = adr/flash_page_size; for (bi = 0; bi<bi_end; bi += flash_page_size/4) { - result = flash_page_program(buffer+bi, pagenum++); + result = flash_page_program(buffer + bi, pagenum++); if (result) break; } /* verify written data */ - if (!result) result = flash_verify(adr, len, ((uint8 *)buffer)+ofs); + if (!result) result = flash_verify(adr, len, ((uint8 *)buffer) + ofs); dcc_wr(OCL_CMD_DONE|result); } Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -86,11 +86,11 @@ else efc_ofs = 0; /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* calculate page address, only lower 8 bits are used to address the latch, but the upper part of address is needed for writing to proper EFC */ - flash_ptr = (uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size)); + flash_ptr = (uint32 *)(FLASH_AREA_ADDR + (page_num*flash_page_size)); data_ptr = data; /* copy data to latch */ @@ -100,18 +100,18 @@ } /* page number and page write command to FCR */ - outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP); + outr(MC_FCR + efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* check for errors */ - if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; - if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; + if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; + if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; #if 0 /* verify written data */ - flash_ptr = (uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size)); + flash_ptr = (uint32 *)(FLASH_AREA_ADDR + (page_num*flash_page_size)); data_ptr = data; for (i = flash_page_size/4; i; i--) { @@ -129,21 +129,21 @@ int page_num; page_num = 0; - lockbits = inr(MC_FSR+efc_ofs) >> 16; + lockbits = inr(MC_FSR + efc_ofs) >> 16; while (lockbits) { if (lockbits&1) { /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); - outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004); + outr(MC_FCR + efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* check for errors */ - if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; - if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; + if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; + if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; } if ((page_num += flash_lock_pages)>flash_page_count) break; @@ -151,20 +151,20 @@ } /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* erase all command to FCR */ - outr(MC_FCR+efc_ofs, 0x5a000008); + outr(MC_FCR + efc_ofs, 0x5a000008); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* check for errors */ - if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; - if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; + if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; + if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; /* set no erase before programming */ - outr(MC_FMR+efc_ofs, inr(MC_FMR+efc_ofs)|0x80); + outr(MC_FMR + efc_ofs, inr(MC_FMR + efc_ofs)|0x80); return FLASH_STAT_OK; } @@ -188,7 +188,7 @@ { unsigned char *flash_ptr; - flash_ptr = (uint8 *)FLASH_AREA_ADDR+adr; + flash_ptr = (uint8 *)FLASH_AREA_ADDR + adr; for ( ;len; len--) { if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE; } Modified: trunk/src/flash/ocl.c =================================================================== --- trunk/src/flash/ocl.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/ocl.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -139,7 +139,7 @@ } /* receive response */ - if ((retval = embeddedice_receive(ocl->jtag_info, dcc_buffer+1, 1) != ERROR_OK)) + if ((retval = embeddedice_receive(ocl->jtag_info, dcc_buffer + 1, 1) != ERROR_OK)) return retval; if (dcc_buffer[1] != OCL_CMD_DONE) @@ -182,7 +182,7 @@ } /* allocate buffer for max. ocl buffer + overhead */ - dcc_buffer = malloc(sizeof(uint32_t)*(ocl->buflen/4+3)); + dcc_buffer = malloc(sizeof(uint32_t)*(ocl->buflen/4 + 3)); while (count) { Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -923,7 +923,7 @@ command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[2]); return ERROR_OK; } - if (address < bank->base || address >= (bank->base+bank->size)) + if (address < bank->base || address >= (bank->base + bank->size)) { command_print(cmd_ctx, "flash address '%s' is out of bounds", args[0]); return ERROR_OK; Modified: trunk/src/flash/pic32mx.h =================================================================== --- trunk/src/flash/pic32mx.h 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/pic32mx.h 2009-06-23 22:44:17 UTC (rev 2373) @@ -62,9 +62,9 @@ * Note: These macros only work for KSEG0/KSEG1 addresses. */ #define KS1Virt2Phys(vaddr) ((vaddr)-0xA0000000) -#define Phys2KS1Virt(paddr) ((paddr)+0xA0000000) +#define Phys2KS1Virt(paddr) ((paddr) + 0xA0000000) #define KS0Virt2Phys(vaddr) ((vaddr)-0x80000000) -#define Phys2KS0Virt(paddr) ((paddr)+0x80000000) +#define Phys2KS0Virt(paddr) ((paddr) + 0x80000000) /* pic32mx configuration register locations */ Modified: trunk/src/flash/stellaris.c =================================================================== --- trunk/src/flash/stellaris.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/stellaris.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -309,8 +309,8 @@ stellaris_info->did1, stellaris_info->did1, "ARMV7M", - (int)((1+((stellaris_info->dc0 >> 16) & 0xFFFF))/4), - (int)((1+(stellaris_info->dc0 & 0xFFFF))*2)); + (int)((1 + ((stellaris_info->dc0 >> 16) & 0xFFFF))/4), + (int)((1 + (stellaris_info->dc0 & 0xFFFF))*2)); buf += printed; buf_size -= printed; @@ -396,7 +396,7 @@ mainfreq = 200000000; /* PLL out frec */ if (usesysdiv) - stellaris_info->mck_freq = mainfreq/(1+sysdiv); + stellaris_info->mck_freq = mainfreq/(1 + sysdiv); else stellaris_info->mck_freq = mainfreq; @@ -499,7 +499,7 @@ stellaris_info->did1 = did1; stellaris_info->num_lockbits = 1 + (stellaris_info->dc0 & 0xFFFF); - stellaris_info->num_pages = 2 *(1+(stellaris_info->dc0 & 0xFFFF)); + stellaris_info->num_pages = 2 *(1 + (stellaris_info->dc0 & 0xFFFF)); stellaris_info->pagesize = 1024; bank->size = 1024 * stellaris_info->num_pages; stellaris_info->pages_in_lockregion = 2; Modified: trunk/src/flash/str7x.c =================================================================== --- trunk/src/flash/str7x.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/str7x.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -703,7 +703,7 @@ flash_cmd = FLASH_SPR; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), 0x4010DFBC); - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), ~(1 << (15+ProtectionLevel))); + target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), ~(1 << (15 + ProtectionLevel))); flash_cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); } Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/str9x.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -145,7 +145,7 @@ if (str9x_info->variant) str9x_info->sector_bits[num_sectors++] = (1 << i); else - str9x_info->sector_bits[num_sectors++] = (1 << (i+8)); + str9x_info->sector_bits[num_sectors++] = (1 << (i + 8)); } return ERROR_OK; Modified: trunk/src/flash/tms470.c =================================================================== --- trunk/src/flash/tms470.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/flash/tms470.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -593,7 +593,7 @@ LOG_DEBUG("set fmmaxpp = 50"); /* - * MAXCP = 0xf000+2000 + * MAXCP = 0xf000 + 2000 */ target_write_u32(target, 0xFFE8A084, 0xf000 + 2000); LOG_DEBUG("set fmmaxcp = 0x%04x", 0xf000 + 2000); Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:44:17 UTC (rev 2373) @@ -42,7 +42,7 @@ { unsigned int i; - for (i = first; i<first+num; i++) + for (i = first; i<first + num; i++) { if (((value >> (i-first))&1) == 1) buffer[i/8] |= 1 << (i%8); @@ -61,7 +61,7 @@ uint32_t result = 0; unsigned int i; - for (i = first; i<first+num; i++) + for (i = first; i<first + num; i++) { if (((buffer[i/8]>>(i%8))&1) == 1) result |= 1 << (i-first); Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/helper/command.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -495,14 +495,14 @@ if (reslen>0) { int i; - char buff[256+1]; + char buff[256 + 1]; for (i = 0; i < reslen; i += 256) { int chunk; chunk = reslen - i; if (chunk > 256) chunk = 256; - strncpy(buff, result+i, chunk); + strncpy(buff, result + i, chunk); buff[chunk] = 0; LOG_USER_N("%s", buff); } @@ -599,7 +599,7 @@ } /* GRR we must chunk - not null terminated */ while (nbytes) { - char chunk[128+1]; + char chunk[128 + 1]; int x; x = nbytes; Modified: trunk/src/helper/configuration.c =================================================================== --- trunk/src/helper/configuration.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/helper/configuration.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -37,7 +37,7 @@ void add_script_search_dir (const char *dir) { num_script_dirs++; - script_search_dirs = (char **)realloc(script_search_dirs, (num_script_dirs+1) * sizeof (char *)); + script_search_dirs = (char **)realloc(script_search_dirs, (num_script_dirs + 1) * sizeof (char *)); script_search_dirs[num_script_dirs-1] = strdup(dir); script_search_dirs[num_script_dirs] = NULL; @@ -46,7 +46,7 @@ void add_config_command (const char *cfg) { num_config_files++; - config_file_names = (char **)realloc(config_file_names, (num_config_files+1) * sizeof (char *)); + config_file_names = (char **)realloc(config_file_names, (num_config_files + 1) * sizeof (char *)); config_file_names[num_config_files-1] = strdup(cfg); config_file_names[num_config_files] = NULL; Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/helper/ioutil.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -274,7 +274,7 @@ chunk = maxChunk; } - if ((retval == ERROR_OK) && (fwrite(((char *)data)+pos, 1, chunk, f) != chunk)) + if ((retval == ERROR_OK) && (fwrite(((char *)data) + pos, 1, chunk, f) != chunk)) retval = ERROR_INVALID_ARGUMENTS; if (retval != ERROR_OK) Modified: trunk/src/helper/jim-eventloop.c =================================================================== --- trunk/src/helper/jim-eventloop.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/helper/jim-eventloop.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -310,7 +310,7 @@ // fprintf(stderr,"No Event\n"); } - retval = select(maxfd+1, &rfds, &wfds, &efds, tvp); + retval = select(maxfd + 1, &rfds, &wfds, &efds, tvp); if (retval < 0) { switch (errno) { case EINTR: fprintf(stderr,"select EINTR\n"); break; Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:42:54 UTC (rev 2372) +++ trunk/src/helper/jim.c 2009-06-23 22:44:17 UTC (rev 2373) @@ -255,7 +255,7 @@ if (patternLen == 1) return 1; /* match */ while (stringLen) { - if (JimStringMatch(pattern+1, patternLen-1, + if (JimStringMatch(pattern + 1, patternLen-1, string, stringLen, nocase)) return 1; /* match */ string++; @@ -457,7 +457,7 @@ * 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) +#define JIM_REFERENCE_SPACE (35 + JIM_REFERENCE_TAGLEN) static int JimFormatReference(char *buf, Jim_Reference *refPtr, jim_wide id) { @@ -485,7 +485,7 @@ s[0] = '.'; s[1] = '0'; s[2] = '\0'; - return len+2; + return len + 2; } return len; } @@ -594,17 +594,17 @@ char *Jim_StrDup(const char *s) { int l = strlen(s); - char *copy = Jim_Alloc(l+1); + char *copy = Jim_Alloc(l + 1); - memcpy(copy, s, l+1); + memcpy(copy, s, l + 1); return copy; } char *Jim_StrDupLen(const char *s, int l) { - char *copy = Jim_Alloc(l+1); + char *copy = Jim_Alloc(l + 1); - memcpy(copy, s, l+1); + memcpy(copy, s, l + 1); copy[l] = 0; /* Just to be sure, original could be substring */ return copy; } @@ -956,7 +956,7 @@ static const void *JimStringCopyHTKeyDup(void *privdata, const void *key) { int len = strlen(key); - char *copy = Jim_Alloc(len+1); + char *copy = Jim_Alloc(len + 1); JIM_NOTUSED(privdata); memcpy(copy, key, len); @@ -967,7 +967,7 @@ static void *JimStringKeyValCopyHTValDup(void *privdata, const void *val) { int len = strlen(val); - char *copy = Jim_Alloc(len+1); + char *copy = Jim_Alloc(len + 1); JIM_NOTUSED(privdata); memcpy(copy, val, len); @@ -1072,7 +1072,7 @@ } void Jim_StackPush(Jim_Stack *stack, void *element) { - int neededLen = stack->len+1; + int neededLen = stack->len + 1; if (neededLen > stack->maxlen) { stack->maxlen = neededLen*2; stack->vector = Jim_Realloc(stack->vector, sizeof(void*)*stack->maxlen); @@ -1191,7 +1191,7 @@ } switch (*(pc->p)) { case '\\': - if (*(pc->p+1) == '\n') + if (*(pc->p + 1) == '\n') return JimParseSep(pc); else { pc->comment = 0; @@ -1251,7 +1251,7 @@ pc->tstart = pc->p; pc->tline = pc->linenr; while (*pc->p == ' ' || *pc->p == '\t' || *pc->p == '\r' || - (*pc->p == '\\' && *(pc->p+1) == '\n')) { + (*pc->p == '\\' && *(pc->p + 1) == '\n')) { if (*pc->p == '\\') { pc->p++; pc->len--; pc->linenr++; @@ -1430,7 +1430,7 @@ switch (*pc->p) { case '\\': if (pc->state == JIM_PS_DEF && - *(pc->p+1) == '\n') { + *(pc->p + 1) == '\n') { pc->tend = pc->p-1; pc->tt = JIM_TT_ESC; return JIM_OK; @@ -1520,7 +1520,7 @@ for (i = 0; i < slen; i++) { switch (s[i]) { case '\\': - switch (s[i+1]) { + switch (s[i + 1]) { case 'a': *p++ = 0x7; i++; break; case 'b': *p++ = 0x8; i++; break; case 'f': *p++ = 0xc; i++; break; @@ -1531,48 +1531,48 @@ case '\0': *p++ = '\\'; i++; break; case '\n': *p++ = ' '; i++; break; default: - if (s[i+1] == 'x') { + if (s[i + 1] == 'x') { int val = 0; - int c = xdigitval(s[i+2]); + int c = xdigitval(s[i + 2]); if (c == -1) { *p++ = 'x'; i++; break; } val = c; - c = xdigitval(s[i+3]); + c = xdigitval(s[i + 3]); if (c == -1) { *p++ = val; i += 2; break; } - val = (val*16)+c; + val = (val*16) + c; *p++ = val; i += 3; break; - } else if (s[i+1] >= '0' && s[i+1] <= '7') + } else if (s[i + 1] >= '0' && s[i + 1] <= '7') { int val = 0; - int c = odigitval(s[i+1]); + int c = odigitval(s[i + 1]); val = c; - c = odigitval(s[i+2]); + c = odigitval(s[i + 2]); if (c == -1) { *p++ = val; i ++; break; } - val = (val*8)+c; - c = odigitval(s[i+3]); + val = (val*8) + c; + c = odigitval(s[i + 3]); if (c == -1) { *p++ = val; i += 2; break; } - val = (val*8)+c; + val = (val*8) + c; *p++ = val; i += 3; } else { - *p++ = s[i+1]; + *p++ = s[i + 1]; i++; } break; @@ -1625,8 +1625,8 @@ token[0] = '\0'; return token; } - len = (end-start)+1; - token = Jim_Alloc(len+1); + 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); @@ -1879,7 +1879,7 @@ objPtr->bytes = JimEmptyStringRep; objPtr->length = 0; } else { - objPtr->bytes = Jim_Alloc(length+1); + objPtr->bytes = Jim_Alloc(length + 1); objPtr->length = length; memcpy(objPtr->bytes, bytes, length); objPtr->bytes[length] = '\0'; @@ -1987,7 +1987,7 @@ objPtr->bytes = JimEmptyStringRep; objPtr->length = 0; } else { - objPtr->bytes = Jim_Alloc(len+1); + objPtr->bytes = Jim_Alloc(len + 1); objPtr->length = len; memcpy(objPtr->bytes, s, len); objPtr->bytes[len] = '\0'; @@ -2023,14 +2023,14 @@ if (objPtr->internalRep.strValue.maxLength < needlen || objPtr->internalRep.strValue.maxLength == 0) { if (objPtr->bytes == JimEmptyStringRep) { - objPtr->bytes = Jim_Alloc((needlen*2)+1); + objPtr->bytes = Jim_Alloc((needlen*2) + 1); } else { - objPtr->bytes = Jim_Realloc(objPtr->bytes, (needlen*2)+1); + objPtr->bytes = Jim_Realloc(objPtr->bytes, (needlen*2) + 1); } objPtr->internalRep.strValue.maxLength = needlen*2; } memcpy(objPtr->bytes + objPtr->length, str, len); - objPtr->bytes[objPtr->length+len] = '\0'; + objPtr->bytes[objPtr->length + len] = '\0'; objPtr->length += len; } @@ -2163,7 +2163,7 @@ if (first > last) { rangeLen = 0; } else { - rangeLen = last-first+1; + rangeLen = last-first + 1; if (rangeLen) { if (first < 0) { rangeLen += first; @@ -2196,7 +2196,7 @@ first = JimRelToAbsIndex(len, first); last = JimRelToAbsIndex(len, last); JimRelToAbsRange(len, first, last, &first, &last, &rangeLen); - return Jim_NewStringObj(interp, str+first, rangeLen); + return Jim_NewStringObj(interp, str + first, rangeLen); } static Jim_Obj *JimStringToLower(Jim_Interp *interp, Jim_Obj *strObjPtr) @@ -2207,9 +2207,9 @@ SetStringFromAny(interp, strObjPtr); } - buf = Jim_Alloc(strObjPtr->length+1); + buf = Jim_Alloc(strObjPtr->length + 1); - memcpy(buf, strObjPtr->bytes, strObjPtr->length+1); + memcpy(buf, strObjPtr->bytes, strObjPtr->length + 1); for (i = 0; i < strObjPtr->length; i++) buf[i] = tolower(buf[i]); return Jim_NewStringObjNoAlloc(interp, buf, strObjPtr->length); @@ -2223,9 +2223,9 @@ SetStringFromAny(interp, strObjPtr); } - buf = Jim_Alloc(strObjPtr->length+1); + buf = Jim_Alloc(strObjPtr->length + 1); - memcpy(buf, strObjPtr->bytes, strObjPtr->length+1); + memcpy(buf, strObjPtr->bytes, strObjPtr->length + 1); for (i = 0; i < strObjPtr->length; i++) buf[i] = toupper(buf[i]); return Jim_NewStringObjNoAlloc(interp, buf, strObjPtr->length); @@ -2606,11 +2606,11 @@ memcpy(tablePtrSorted, tablePtr, sizeof(char*)*count); qsort(tablePtrSorted, count, sizeof(char*), qsortCompareStringPointers); for (i = 0; i < count; i++) { - if (i+1 == count && count > 1) + if (i + 1 == count && count > 1) Jim_AppendString(interp, Jim_GetResult(interp), "or ", -1); Jim_AppendString(interp, Jim_GetResult(interp), tablePtrSorted[i], -1); - if (i+1 != count) + if (i + 1 != count) Jim_AppendString(interp, Jim_GetResult(interp), ", ", -1); } Jim_Free(tablePtrSorted); @@ -2888,7 +2888,7 @@ script->token = Jim_Realloc(script->token, sizeof(ScriptToken)*script->len); /* Initialize the new token */ - token = script->token+(script->len-1); + token = script->token + (script->len-1); token->type = type; /* Every object is intially as a string, but the * internal type may be specialized during execution of the @@ -3060,8 +3060,8 @@ token[end-1].type == JIM_TT_EOL) { if (token[end].type == JIM_TT_STR && - token[end+1].type != JIM_TT_SEP && - token[end+1].type != JIM_TT_EOL && + token[end + 1].type != JIM_TT_SEP && + token[end + 1].type != JIM_TT_EOL && (!strcmp(token[end].objPtr->bytes, "expand") || !strcmp(token[end].objPtr->bytes, "*"))) expand++; @@ -3070,7 +3070,7 @@ args++; end++; } - interpolation = !((end-start+1) == args*2); + interpolation = !((end-start + 1) == args*2); /* Add the 'number of arguments' info into cmdstruct. * Negative value if there is list expansion involved. */ if (expand) @@ -3796,15 +3796,15 @@ str = Jim_GetString(objPtr, &len); p = strchr(str, '('); p++; - keyLen = len-((p-str)+1); + keyLen = len-((p-str) + 1); nameLen = (p-str)-1; /* Create the objects with the variable name and key. */ - t = Jim_Alloc(nameLen+1); + t = Jim_Alloc(nameLen + 1); memcpy(t, str, nameLen); t[nameLen] = '\0'; varObjPtr = Jim_NewStringObjNoAlloc(interp, t, nameLen); - t = Jim_Alloc(keyLen+1); + t = Jim_Alloc(keyLen + 1); memcpy(t, p, keyLen); t[keyLen] = '\0'; keyObjPtr = Jim_NewStringObjNoAlloc(interp, t, keyLen); @@ -4078,13 +4078,13 @@ void UpdateStringOfReference(struct Jim_Obj *objPtr) { int len; - char buf[JIM_REFERENCE_SPACE+1]; + char buf[JIM_REFERENCE_SPACE + 1]; Jim_Reference *refPtr; refPtr = objPtr->internalRep.refValue.refPtr; len = JimFormatReference(buf, refPtr, objPtr->internalRep.refValue.id); - objPtr->bytes = Jim_Alloc(len+1); - memcpy(objPtr->bytes, buf, len+1); + objPtr->bytes = Jim_Alloc(len + 1); + memcpy(objPtr->bytes, buf, len + 1); objPtr->length = len; } @@ -4112,19 +4112,19 @@ if (len < JIM_REFERENCE_SPACE) goto badformat; /* Trim spaces */ start = str; - end = str+len-1; + end = str + len-1; while (*start == ' ') start++; while (*end == ' ' && end > start) end--; - if (end-start+1 != JIM_REFERENCE_SPACE) goto badformat; + if (end-start + 1 != JIM_REFERENCE_SPACE) goto badformat; /* <reference.<1234567>.%020> */ if (memcmp(start, "<reference.<", 12) != 0) goto badformat; - if (start[12+JIM_REFERENCE_TAGLEN] != '>' || end[0] != '>') goto badformat; + if (start[12 + JIM_REFERENCE_TAGLEN] != '>' || end[0] != '>') goto badformat; /* The tag can't contain chars other than a-zA-Z0-9 + '_'. */ for (i = 0; i < JIM_REFERENCE_TAGLEN; i++) { - if (!isrefchar(start[12+i])) goto badformat; + if (!isrefchar(start[12 + i])) goto badformat; } /* Extract info from the refernece. */ - memcpy(refId, start+14+JIM_REFERENCE_TAGLEN, 20); + memcpy(refId, start + 14 + JIM_REFERENCE_TAGLEN, 20); refId[20] = '\0'; /* Try to convert the ID into a jim_wide */ if (Jim_StringToWide(refId, &wideValue, 10) != JIM_OK) goto badformat; @@ -4305,7 +4305,7 @@ if (!isdigit((int)p[i])) break; /* Get the ID */ - memcpy(buf, p+21, 20); + memcpy(buf, p + 21, 20); buf[20] = '\0'; Jim_StringToWide(buf, &id, 10); @@ -4340,7 +4340,7 @@ * finalizer first if registered. */ refPtr = he->val; if (refPtr->finalizerCmdNamePtr) { - char *refstr = Jim_Alloc(JIM_REFERENCE_SPACE+1); + char *refstr = Jim_Alloc(JIM_REFERENCE_SPACE + 1); Jim_Obj *objv[3], *oldResult; JimFormatReference(refstr, refPtr, *refId); @@ -4575,7 +4575,7 @@ return JIM_OK; } - level = strtol(str+1, &endptr, 0); + level = strtol(str + 1, &endptr, 0); if (str[1] == '\0' || endptr[0] != '\0' || level < 0) goto badlevel; /* An 'absolute' level is converted into the @@ -4792,11 +4792,11 @@ void UpdateStringOfInt(struct Jim_Obj *objPtr) { int len; - char buf[JIM_INTEGER_SPACE+1]; + char buf[JIM_INTEGER_SPACE + 1]; len = Jim_WideToString(buf, objPtr->internalRep.wideValue); - objPtr->bytes = Jim_Alloc(len+1); - memcpy(objPtr->bytes, buf, len+1); + objPtr->bytes = Jim_Alloc(len + 1); + memcpy(objPtr->bytes, buf, len + 1); objPtr->length = len; } @@ -4904,11 +4904,11 @@ void UpdateStringOfDouble(struct Jim_Obj *objPtr) { int len; - char buf[JIM_DOUBLE_SPACE+1]; + char buf[JIM_DOUBLE_SPACE + 1]; len = Jim_DoubleToString(buf, objPtr->internalRep.doubleValue); - objPtr->bytes = Jim_Alloc(len+1); - memcpy(objPtr->bytes, buf, len+1); + objPtr->bytes = Jim_Alloc(len + 1); + memcpy(objPtr->bytes, buf, len + 1); objPtr->length = len; } @@ -5063,10 +5063,10 @@ if (level < 0) return JIM_ELESTR_QUOTE; break; case '\\': - if (s[i+1] == '\n') + if (s[i + 1] == '\n') return JIM_ELESTR_QUOTE; else - if (s[i+1] != '\0') i++; + if (s[i + 1] != '\0') i++; break; } } @@ -5099,7 +5099,7 @@ * using backslash to quote special chars. */ char *BackslashQuoteString(const char *s, int len, int *qlenPtr) { - char *q = Jim_Alloc(len*2+1), *p; + char *q = Jim_Alloc(len*2 + 1), *p; p = q; while (*s) { @@ -5140,7 +5140,7 @@ Jim_Obj **ele = objPtr->internalRep.listValue.ele; /* (Over) Estimate the space needed. */ - quotingType = Jim_Alloc(sizeof(int)*objPtr->internalRep.listValue.len+1); + quotingType = Jim_Alloc(sizeof(int)*objPtr->internalRep.listValue.len + 1); bufLen = 0; for (i = 0; i < objPtr->internalRep.listValue.len; i++) { int len; @@ -5149,7 +5149,7 @@ quotingType[i] = ListElementQuotingType(strRep, len); switch (quotingType[i]) { case JIM_ELESTR_SIMPLE: bufLen += len; break; - case JIM_ELESTR_BRACE: bufLen += len+2; break; + case JIM_ELESTR_BRACE: bufLen += len + 2; break; case JIM_ELESTR_QUOTE: bufLen += len*2; break; } bufLen++; /* elements separator. */ @@ -5157,7 +5157,7 @@ bufLen++; /* Generate the string rep. */ - p = objPtr->bytes = Jim_Alloc(bufLen+1); + p = objPtr->bytes = Jim_Alloc(bufLen + 1); realLength = 0; for (i = 0; i < objPtr->internalRep.listValue.len; i++) { int len, qlen; @@ -5175,7 +5175,7 @@ memcpy(p, strRep, len); p += len; *p++ = '}'; - realLength += len+2; + realLength += len + 2; break; case JIM_ELESTR_QUOTE: q = BackslashQuoteString(strRep, len, &qlen); @@ -5186,7 +5186,7 @@ break; } /* Add a separating space */ - if (i+1 != objPtr->internalRep.listValue.len) { + if (i + 1 != objPtr->internalRep.listValue.len) { *p++ = ' '; realLength ++; } @@ -5365,7 +5365,7 @@ listPtr->internalRep.listValue.maxLen = maxLen; } point = listPtr->internalRep.listValue.ele + index; - memmove(point+elemc, point, (currentLen-index) * sizeof(Jim_Obj*)); + memmove(point + elemc, point, (currentLen-index) * sizeof(Jim_Obj*)); for (i = 0; i < elemc; ++i) { point[i] = elemVec[i]; Jim_IncrRefCount(point[i]); @@ -5391,7 +5391,7 @@ } for (i = 0; i < appendLen; i++) { Jim_Obj *objPtr = appendListPtr->internalRep.listValue.ele[i]; - listPtr->internalRep.listValue.ele[oldLen+i] = objPtr; + listPtr->internalRep.listValue.ele[oldLen + i] = objPtr; Jim_IncrRefCount(objPtr); } listPtr->internalRep.listValue.len += appendLen; @@ -5453,7 +5453,7 @@ return JIM_ERR; } if (index < 0) - index = listPtr->internalRep.listValue.len+index; + index = listPtr->internalRep.listValue.len + index; *objPtrPtr = listPtr->internalRep.listValue.ele[index]; return JIM_OK; } @@ -5472,7 +5472,7 @@ return JIM_ERR; } if (index < 0) - index = listPtr->internalRep.listValue.len+index; + index = listPtr->internalRep.listValue.len + index; Jim_DecrRefCount(interp, listPtr->internalRep.listValue.ele[index]); listPtr->internalRep.listValue.ele[index] = newObjPtr; Jim_IncrRefCount(newObjPtr); @@ -5552,7 +5552,7 @@ } if (objc) len += objc-1; /* Create the string rep, and a stinrg object holding it. */ - p = bytes = Jim_Alloc(len+1); + p = bytes = Jim_Alloc(len + 1); for (i = 0; i < objc; i++) { const char *s = Jim_GetString(objv[i], &objLen); while (objLen && (*s == ' ' || *s == '\t' || *s == '\n')) @@ -5565,9 +5565,9 @@ } memcpy(p, s, objLen); p += objLen; - if (objLen && i+1 != objc) { + if (objLen && i + 1 != objc) { *p++ = ' '; - } else if (i+1 != objc) { + } else if (i + 1 != objc) { /* Drop the space calcuated for this * element that is instead null. */ len--; @@ -5594,7 +5594,7 @@ last = JimRelToAbsIndex(len, last); JimRelToAbsRange(len, first, last, &first, &last, &rangeLen); return Jim_NewListObj(interp, - listObjPtr->internalRep.listValue.ele+first, rangeLen); + listObjPtr->internalRep.listValue.ele + first, rangeLen); } /* ----------------------------------------------------------------------------- @@ -5724,7 +5724,7 @@ quotingType[i] = ListElementQuotingType(strRep, len); switch (quotingType[i]) { case JIM_ELESTR_SIMPLE: bufLen += len; break; - case JIM_ELESTR_BRACE: bufLen += len+2; break; + case JIM_ELESTR_BRACE: bufLen += len + 2; break; case JIM_ELESTR_QUOTE: bufLen += len*2; break; } bufLen++; /* elements separator. */ @@ -5732,7 +5732,7 @@ bufLen++; /* Generate the string rep. */ - p = objPtr->bytes = Jim_Alloc(bufLen+1); + p = objPtr->bytes = Jim_Alloc(bufLen + 1); realLength = 0; for (i = 0; i < objc; i++) { int len, qlen; @@ -5750,7 +5750,7 @@ memcpy(p, strRep, len); p += len; *p++ = '}'; - realLength += len+2; + realLength += len + 2; break; case JIM_ELESTR_QUOTE: q = BackslashQuoteString(strRep, len, &qlen); @@ -5761,7 +5761,7 @@ break; } /* Add a separating space */ - if (i+1 != objc) { + if (i + 1 != objc) { *p++ = ' '; realLength ++; } @@ -5886,7 +5886,7 @@ objPtr->internalRep.ptr = Jim_Alloc(sizeof(Jim_HashTable)); Jim_InitHashTable(objPtr->internalRep.ptr, &JimDictHashTableType, interp); for (i = 0; i < len; i += 2) - DictAddElement(interp, objPtr, elements[i], elements[i+1]); + DictAddElement(interp, objPtr, elements[i], elements[i + 1]); return objPtr; } @@ -6025,17 +6025,17 @@ void UpdateStringOfIndex(struct Jim_Obj *objPtr) { int len; - char buf[JIM_INTEGER_SPACE+1]; + char buf[JIM_INTEGER_SPACE + 1]; if (objPtr->internalRep.indexValue >= 0) len = sprintf(buf, "%d", objPtr->internalRep.indexValue); else if (objPtr->internalRep.indexValue == -1) len = sprintf(buf, "end"); else { - len = sprintf(buf, "end%d", objPtr->internalRep.indexValue+1); + len = sprintf(buf, "end%d", objPtr->internalRep.indexValue + 1); } - objPtr->bytes = Jim_Alloc(len+1); - memcpy(objPtr->bytes, buf, len+1); + objPtr->bytes = Jim_Alloc(len + 1); + memcpy(objPtr->bytes, buf, len + 1); objPtr->length = len; } @@ -6067,7 +6067,7 @@ if (index < 0) index = INT_MAX; else - index = -(index+1); + index = -(index + 1); } else if (!end && index < 0) index = -INT_MAX; /* Free the old internal repr and set the new one. */ @@ -6280,7 +6280,7 @@ *(pc->p) == '\t' || *(pc->p) == '\r' || *(pc->p) == '\n' || - (*(pc->p) == '\\' && *(pc->p+1) == '\n')) { + (*(pc->p) == '\\' && *(pc->p + 1) == '\n')) { pc->p++; pc->len--; } @@ -6315,7 +6315,7 @@ break; case '-': if ((pc->tt == JIM_TT_NONE || pc->tt == JIM_TT_EXPR_OPERATOR) && - isdigit((int)*(pc->p+1))) + isdigit((int)*(pc->p + 1))) return JimParseExprNumber(pc); else return JimParseExprOperator(pc); @@ -6366,7 +6366,7 @@ if (*pc->p == '.') allowdot = 0; pc->p++; pc->len--; - if (!allowdot && *pc->p == 'e' && *(pc->p+1) == '-') { + if (!allowdot && *pc->p == 'e' && *(pc->p + 1) == '-') { pc->p += 2; pc->len -= 2; } } @@ -6490,8 +6490,8 @@ static void ExprObjAddInstr(Jim_Interp *interp, ExprByteCode *expr, int opcode, char *str, int len) { - expr->opcode = Jim_Realloc(expr->opcode, sizeof(int)*(expr->len+1)); - expr->obj = Jim_Realloc(expr->obj, sizeof(Jim_Obj*)*(expr->len+1)); + expr->opcode = Jim_Realloc(expr->opcode, sizeof(int)*(expr->len + 1)); + expr->obj = Jim_Realloc(expr->obj, sizeof(Jim_Obj*)*(expr->len + 1)); expr->opcode[expr->len] = opcode; expr->obj[expr->len] = Jim_NewStringObjNoAlloc(interp, str, len); Jim_IncrRefCount(expr->obj[expr->len]); @@ -6644,32 +6644,32 @@ leftindex--; } leftindex++; - expr->opcode = Jim_Realloc(expr->opcode, sizeof(int)*(expr->len+2)); - expr->obj = Jim_Realloc(expr->obj, sizeof(Jim_Obj*)*(expr->len+2)); - memmove(&expr->opcode[leftindex+2], &expr->opcode[leftindex], + expr->opcode = Jim_Realloc(expr->opcode, sizeof(int)*(expr->len + 2)); + expr->obj = Jim_Realloc(expr->obj, sizeof(Jim_Obj*)*(expr->len + 2)); + memmove(&expr->opcode[leftindex + 2], &expr->opcode[leftindex], sizeof(int)*(expr->len-leftindex)); - memmove(&expr->obj[leftindex+2], &expr->obj[leftindex], + 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) { - expr->opcode[leftindex+1] = JIM_EXPROP_LOGICAND_LEFT; + expr->opcode[leftindex + 1] = JIM_EXPROP_LOGICAND_LEFT; expr->opcode[index] = JIM_EXPROP_LOGICAND_RIGHT; - expr->obj[leftindex+1] = Jim_NewStringObj(interp, "&L", -1); + expr->obj[leftindex + 1] = Jim_NewStringObj(interp, "&L", -1); expr->obj[index] = Jim_NewStringObj(interp, "&R", -1); } else { - expr->opcode[leftindex+1] = JIM_EXPROP_LOGICOR_LEFT; + expr->opcode[leftindex + 1] = JIM_EXPROP_LOGICOR_LEFT; expr->opcode[index] = JIM_EXPROP_LOGICOR_RIGHT; - expr->obj[leftindex+1] = Jim_NewStringObj(interp, "|L", -1); + expr->obj[leftindex + 1] = Jim_NewStringObj(interp, "|L", -1); expr->obj[index] = 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[leftindex]); - Jim_IncrRefCount(expr->obj[leftindex+1]); + Jim_IncrRefCount(expr->obj[leftindex + 1]); } } @@ -6950,7 +6950,7 @@ Jim_DecrRefCount(interp, A); Jim_DecrRefCount(interp, B); switch (expr->opcode[i]) { - case JIM_EXPROP_ADD: wC = wA+wB; break; + case JIM_EXPROP_ADD: wC = wA + wB; break; case JIM_EXPROP_SUB: wC = wA-wB; break; case JIM_EXPROP_MUL: wC = wA*wB; break; case JIM_EXPROP_LT: wC = wA<wB; break; @@ -7055,7 +7055,7 @@ error = 1; goto err; break; - case JIM_EXPROP_ADD: dC = dA+dB; break; + case JIM_EXPROP_ADD: dC = dA + dB; break; case JIM_EXPROP_SUB: dC = dA-dB; break; case JIM_EXPROP_MUL: dC = dA*dB; break; case JIM_EXPROP_LT: dC = dA<dB; break; @@ -7350,7 +7350,7 @@ memset(fmtObj, 0, approxSize); fmtObj->size = approxSize; fmtObj->maxPos = 0; - fmtObj->scratch = (char*)&fmtObj->descr[maxCount+1]; + fmtObj->scratch = (char*)&fmtObj->descr[maxCount + 1]; fmtObj->stringRep = fmtObj->scratch + maxFmtLen + 3 + 1; memcpy(fmtObj->stringRep, fmt, maxFmtLen); buffer = fmtObj->stringRep + maxFmtLen + 1; @@ -7442,11 +7442,11 @@ /* In case a range fence was given "backwards", swap it */ while (swapped) { swapped = 0; - for (j = beg+1; j < end-1; ++j) { - if (buffer[j] == '-' && buffer[j-1] > buffer[j+1]) { + for (j = beg + 1; j < end-1; ++j) { + if (buffer[j] == '-' && buffer[j-1] > buffer[j + 1]) { char tmp = buffer[j-1]; - buffer[j-1] = buffer[j+1]; - buffer[j+1] = tmp; + buffer[j-1] = buffer[j + 1]; + buffer[j + 1] = tmp; swapped = 1; } } @@ -7525,8 +7525,8 @@ { size_t i; Jim_Obj *result; - char charset[256/8+1]; /* A Charset may contain max 256 chars */ - char *buffer = Jim_Alloc(strlen(str)+1), *anchor = buffer; + char charset[256/8 + 1]; /* A Charset may contain max 256 chars */ + char *buffer = Jim_Alloc(strlen(str) + 1), *anchor = buffer; /* First init charset to nothing or all, depending if a specified * or an unspecified string has to be parsed */ @@ -7838,13 +7838,13 @@ prng = interp->prngState; /* generates 'len' bytes of pseudo-random numbers */ for (x = 0; x < len; x++) { - prng->i = (prng->i+1) & 0xff; + prng->i = (prng->i + 1) & 0xff; si = prng->sbox[prng->i]; prng->j = (prng->j + si) & 0xff; sj = prng->sbox[prng->j]; prng->sbox[prng->i] = sj; prng->sbox[prng->j] = si; - *destByte++ = prng->sbox[(si+sj)&0xff]; + *destByte++ = prng->sbox[(si + sj)&0xff]; } } @@ -7939,7 +7939,7 @@ &prefixObjPtr, JIM_NONE) != JIM_OK) continue; prefix = Jim_GetString(prefixObjPtr, &prefixlen); - if (prefixlen+strlen(pathName)+1 >= JIM_PATH_LEN) + if (prefixlen + strlen(pathName) + 1 >= JIM_PATH_LEN) continue; if (*pathName == '/') { strcpy(buf, pathName); @@ -8000,7 +8000,7 @@ #define JIM_PKG_ANY_VERSION -1 /* Convert a string of the type "1.2" into an integer. - * MAJOR.MINOR is converted as MAJOR*100+MINOR, so "1.2" is converted + * MAJOR.MINOR is converted as MAJOR*100 + MINOR, so "1.2" is converted * to the integer with value 102 */ static int JimPackageVersionToInt(Jim_Interp *interp, const char *v, int *intPtr, int flags) @@ -8019,12 +8019,12 @@ if (p == NULL) goto badfmt; *p = '\0'; majorStr = copy; - minorStr = p+1; + minorStr = p + 1; if (Jim_StringToWide(majorStr, &major, 10) != JIM_OK || Jim_StringToWide(minorStr, &minor, 10) != JIM_OK) goto badfmt; - *intPtr = (int)(major*100+minor); + *intPtr = (int)(major*100 + minor); Jim_Free(copy); return JIM_OK; @@ -8190,20 +8190,20 @@ int fileNameLen = strlen(fileName); if (strncmp(fileName, "jim-", 4) == 0 && - strncmp(fileName+4, pkgName, pkgNameLen) == 0 && - *(fileName+4+pkgNameLen) == '-' && + strncmp(fileName + 4, pkgName, pkgNameLen) == 0 && + *(fileName + 4+pkgNameLen) == '-' && fileNameLen > 4 && /* note that this is not really useful */ - (strncmp(fileName+fileNameLen-4, ".tcl", 4) == 0 || - strncmp(fileName+fileNameLen-4, ".dll", 4) == 0 || - strncmp(fileName+fileNameLen-3, ".so", 3) == 0)) + (strncmp(fileName + fileNameLen-4, ".tcl", 4) == 0 || + strncmp(fileName + fileNameLen-4, ".dll", 4) == 0 || + strncmp(fileName + fileNameLen-3, ".so", 3) == 0)) { char ver[6]; /* xx.yy<nulterm> */ char *p = strrchr(fileName, '.'); int verLen, fileVer; - verLen = p - (fileName+4+pkgNameLen+1); + verLen = p - (fileName + 4+pkgNameLen + 1); if (verLen < 3 || verLen > 5) continue; - memcpy(ver, fileName+4+pkgNameLen+1, verLen); + memcpy(ver, fileName + 4+pkgNameLen + 1, verLen); ver[verLen] = '\0'; if (JimPackageVersionToInt(interp, ver, &fileVer, JIM_NONE) != JIM_OK) continue; @@ -8212,7 +8212,7 @@ { bestVer = fileVer; Jim_Free(bestPackage); - bestPackage = Jim_Alloc(strlen(buf)+strlen(fileName)+2); + bestPackage = Jim_Alloc(strlen(buf) + strlen(fileName) + 2); sprintf(bestPackage, "%s/%s", buf, fileName); } } @@ -8368,19 +8368,19 @@ * the "unknown" string, it is used in order to * avoid to lookup the unknown command every time * but instread to cache the result. */ - if (argc+1 <= JIM_EVAL_SARGV_LEN) + if (argc + 1 <= JIM_EVAL_SARGV_LEN) v = sv; else - v = Jim_Alloc(sizeof(Jim_Obj*)*(argc+1)); + v = Jim_Alloc(sizeof(Jim_Obj*)*(argc + 1)); /* Make a copy of the arguments vector, but shifted on * the right of one position. The command name of the * command will be instead the first argument of the * [unknonw] call. */ - memcpy(v+1, argv, sizeof(Jim_Obj*)*argc); + memcpy(v + 1, argv, sizeof(Jim_Obj*)*argc); v[0] = interp->unknown; /* Call it */ interp->unknown_called++; - retCode = Jim_EvalObjVector(interp, argc+1, v); + retCode = Jim_EvalObjVector(interp, argc + 1, v); interp->unknown_called--; /* Clean up */ @@ -8496,7 +8496,7 @@ * object. */ objPtr = Jim_NewStringObjNoAlloc(interp, NULL, 0); - s = objPtr->bytes = Jim_Alloc(totlen+1); + s = objPtr->bytes = Jim_Alloc(totlen + 1); objPtr->length = totlen; for (i = 0; i < tokens; i++) { memcpy(s, intv[i]->bytes, intv[i]->length); @@ -8527,7 +8527,7 @@ int *argcPtr, int expand, Jim_Obj *objPtr) { if (!expand) { - (*argv) = Jim_Realloc(*argv, sizeof(Jim_Obj*)*((*argcPtr)+1)); + (*argv) = Jim_Realloc(*argv, sizeof(Jim_Obj*)*((*argcPtr) + 1)); /* refcount of objPtr not incremented because * we are actually transfering a reference from * the old 'argv' to the expanded one. */ @@ -8537,7 +8537,7 @@ int len, i; Jim_ListLength(interp, objPtr, &len); - (*argv) = Jim_Realloc(*argv, sizeof(Jim_Obj*)*((*argcPtr)+len)); + (*argv) = Jim_Realloc(*argv, sizeof(Jim_Obj*)*((*argcPtr) + len)); for (i = 0; i < len; i++) { (*argv)[*argcPtr] = objPtr->internalRep.listValue.ele[i]; Jim_IncrRefCount(objPtr->internalRep.listValue.ele[i]); @@ -8668,13 +8668,13 @@ /* For interpolation we call an helper * function doing the work for us. */ if ((retcode = Jim_InterpolateTokens(interp, - token+i, tokens, &tmpObjPtr)) != JIM_OK) + token + i, tokens, &tmpObjPtr)) != JIM_OK) { goto err; } argv[j] = tmpObjPtr; Jim_IncrRefCount(argv[j]); - i += tokens+1; + i += tokens + 1; } } /* Handle {expand} expansion */ @@ -8840,7 +8840,7 @@ Jim_ListIndex(interp, argObjPtr, 1, &valueObjPtr, JIM_NONE); } else { - valueObjPtr = argv[i+1]; + valueObjPtr = argv[i + 1]; } Jim_SetVariable(interp, nameObjPtr, valueObjPtr); } @@ -8849,7 +8849,7 @@ Jim_Obj *listObjPtr, *objPtr; i++; - listObjPtr = Jim_NewListObj(interp, argv+i, argc-i); + listObjPtr = Jim_NewListObj(interp, argv + i, argc-i); Jim_ListIndex(interp, cmd->argListObjPtr, num_args, &objPtr, JIM_NONE); Jim_SetVariable(interp, objPtr, listObjPtr); } @@ -8974,12 +8974,12 @@ buflen = 1024; maxlen = totread = 0; while (1) { - if (maxlen < totread+buflen+1) { - maxlen = totread+buflen+1; + if (maxlen < totread + buflen + 1) { + maxlen = totread + buflen + 1; prg = Jim_Realloc(prg, maxlen); } /* do not use Jim_fread() - this is really a file */ - if ((nread = fread(prg+totread, 1, buflen, fp)) == 0) break; + if ((nread = fread(prg + totread, 1, buflen, fp)) == 0) break; totread += nread; } prg[totread] = '\0'; @@ -9045,7 +9045,7 @@ pc->tt = JIM_TT_ESC; if (*pc->tstart == '{') { pc->tstart--; - if (*(pc->tend+1)) + if (*(pc->tend + 1)) pc->tend++; } } @@ -9404,7 +9404,7 @@ Jim_AppendString(interp, objPtr, "wrong # args: should be \"", -1); for (i = 0; i < argc; i++) { Jim_AppendObj(interp, objPtr, argv[i]); - if (!(i+1 == argc && msg[0] == '\0')) + if (!(i + 1 == argc && msg[0] == '\0')) Jim_AppendString(interp, objPtr, " ", 1); } Jim_AppendString(interp, objPtr, msg, -1); @@ -9723,13 +9723,13 @@ if (Jim_GetWide(interp, intObjPtr, &wideValue) != JIM_OK) return JIM_ERR; if (Jim_IsShared(intObjPtr)) { - intObjPtr = Jim_NewIntO... [truncated message content] |
Author: zwelch Date: 2009-06-24 00:42:54 +0200 (Wed, 24 Jun 2009) New Revision: 2372 Modified: trunk/src/ecosboard.c trunk/src/flash/at91sam7.c trunk/src/flash/cfi.c trunk/src/flash/ecos.c trunk/src/flash/flash.c trunk/src/flash/flash.h trunk/src/flash/lpc2000.c trunk/src/flash/mflash.c trunk/src/flash/ocl.c trunk/src/flash/ocl/at91sam7x/main.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/stm32x.c trunk/src/flash/str9x.c trunk/src/flash/tms470.c trunk/src/helper/binarybuffer.h trunk/src/helper/command.c trunk/src/helper/configuration.c trunk/src/helper/ioutil.c trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/helper/log.c trunk/src/helper/options.c trunk/src/helper/time_support.c trunk/src/jtag/bitbang.c trunk/src/jtag/commands.c trunk/src/jtag/commands.h trunk/src/jtag/core.c trunk/src/jtag/driver.c trunk/src/jtag/dummy.c trunk/src/jtag/ft2232.c trunk/src/jtag/gw16012.c trunk/src/jtag/interface.h trunk/src/jtag/jlink.c trunk/src/jtag/minidummy/minidummy.c trunk/src/jtag/parport.c trunk/src/jtag/presto.c trunk/src/jtag/rlink/rlink.c trunk/src/jtag/tcl.c trunk/src/jtag/usbprog.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/openocd.c trunk/src/pld/virtex2.c trunk/src/server/gdb_server.c trunk/src/server/httpd.c trunk/src/server/server.c trunk/src/server/telnet_server.c trunk/src/target/arm11_dbgtap.c trunk/src/target/arm720t.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_jtag.h trunk/src/target/armv4_5.c trunk/src/target/armv4_5.h trunk/src/target/armv7m.c trunk/src/target/cortex_m3.c trunk/src/target/embeddedice.c trunk/src/target/etb.c trunk/src/target/etm.c trunk/src/target/image.c trunk/src/target/mips32_dmaacc.c trunk/src/target/mips32_pracc.c trunk/src/target/mips_m4k.c trunk/src/target/target.c trunk/src/target/target.h trunk/src/target/xscale.c trunk/src/xsvf/xsvf.c trunk/testing/examples/cortex/test.c Log: - Fixes '=' whitespace - Replace ')\(=\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(=\)(' with '\1 \2 ('. - Replace '\(\w\)\(=\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/ecosboard.c =================================================================== --- trunk/src/ecosboard.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/ecosboard.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -975,13 +975,13 @@ } mkdir(zylin_config_dir, 0777); - char *dirname=alloc_printf("%s/target", zylin_config_dir); + char *dirname = alloc_printf("%s/target", zylin_config_dir); mkdir(dirname, 0777); free(dirname); - dirname=alloc_printf("%s/board", zylin_config_dir); + dirname = alloc_printf("%s/board", zylin_config_dir); mkdir(dirname, 0777); free(dirname); - dirname=alloc_printf("%s/event", zylin_config_dir); + dirname = alloc_printf("%s/event", zylin_config_dir); mkdir(dirname, 0777); free(dirname); @@ -1036,7 +1036,7 @@ if (logAllToSerial) { diag_printf( - "%s/logserial=1 => sending log output to serial port using \"debug_level 3\" as default.\n", zylin_config_dir); + "%s/logserial = 1 => sending log output to serial port using \"debug_level 3\" as default.\n", zylin_config_dir); command_run_line(cmd_ctx, "debug_level 3"); } Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -232,10 +232,10 @@ if (fmcn > 0xFF) fmcn = 0xFF; - /* Only allow fmcn=0 if clock period is > 30 us = 33kHz. */ + /* Only allow fmcn = 0 if clock period is > 30 us = 33kHz. */ if (at91sam7_info->mck_freq <= 33333ul) fmcn = 0; - /* Only allow fws=0 if clock frequency is < 30 MHz. */ + /* Only allow fws = 0 if clock frequency is < 30 MHz. */ if (at91sam7_info->mck_freq > 30000000ul) fws = 1; @@ -550,7 +550,7 @@ /* calculate bank size */ bank_size = sectors_num * pages_per_sector * page_size; - for (bnk=0; bnk<banks_num; bnk++) + for (bnk = 0; bnk<banks_num; bnk++) { if (bnk > 0) { @@ -575,7 +575,7 @@ /* allocate sectors */ t_bank->sectors = malloc(sectors_num * sizeof(flash_sector_t)); - for (sec=0; sec<sectors_num; sec++) + for (sec = 0; sec<sectors_num; sec++) { t_bank->sectors[sec].offset = sec * pages_per_sector * page_size; t_bank->sectors[sec].size = pages_per_sector * page_size; @@ -639,7 +639,7 @@ at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH); fast_check = 1; - for (nSector=0; nSector<bank->num_sectors; nSector++) + for (nSector = 0; nSector<bank->num_sectors; nSector++) { retval = target_blank_check_memory(target, bank->base+bank->sectors[nSector].offset, bank->sectors[nSector].size, &blank); @@ -662,7 +662,7 @@ LOG_USER("Running slow fallback erase check - add working memory"); buffer = malloc(bank->sectors[0].size); - for (nSector=0; nSector<bank->num_sectors; nSector++) + for (nSector = 0; nSector<bank->num_sectors; nSector++) { bank->sectors[nSector].is_erased = 1; retval = target_read_memory(target, bank->base+bank->sectors[nSector].offset, 4, @@ -670,7 +670,7 @@ if (retval != ERROR_OK) return retval; - for (nByte=0; nByte<bank->sectors[nSector].size; nByte++) + for (nByte = 0; nByte<bank->sectors[nSector].size; nByte++) { if (buffer[nByte] != 0xFF) { @@ -705,7 +705,7 @@ at91sam7_info->lockbits = (status >> 16); at91sam7_info->num_lockbits_on = 0; - for (lock_pos=0; lock_pos<bank->num_sectors; lock_pos++) + for (lock_pos = 0; lock_pos<bank->num_sectors; lock_pos++) { if ( ((status >> (16+lock_pos))&(0x0001)) == 1) { @@ -723,7 +723,7 @@ at91sam7_info->nvmbits = (status >> 8)&0xFF; at91sam7_info->num_nvmbits_on = 0; - for (gpnvm_pos=0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++) + for (gpnvm_pos = 0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++) { if ( ((status >> (8+gpnvm_pos))&(0x01)) == 1) { @@ -809,7 +809,7 @@ /* calculate bank size */ bank_size = num_sectors * pages_per_sector * page_size; - for (bnk=0; bnk<banks_num; bnk++) + for (bnk = 0; bnk<banks_num; bnk++) { if (bnk > 0) { @@ -834,7 +834,7 @@ /* allocate sectors */ t_bank->sectors = malloc(num_sectors * sizeof(flash_sector_t)); - for (sec=0; sec<num_sectors; sec++) + for (sec = 0; sec<num_sectors; sec++) { t_bank->sectors[sec].offset = sec * pages_per_sector * page_size; t_bank->sectors[sec].size = pages_per_sector * page_size; @@ -902,7 +902,7 @@ /* allocate and clean buffer */ nbytes = (last - first + 1) * bank->sectors[first].size; buffer = malloc(nbytes * sizeof(uint8_t)); - for (pos=0; pos<nbytes; pos++) + for (pos = 0; pos<nbytes; pos++) { buffer[pos] = 0xFF; } @@ -916,7 +916,7 @@ } /* mark erased sectors */ - for (sec=first; sec <= last; sec++) + for (sec = first; sec <= last; sec++) { bank->sectors[sec].is_erased = 1; } @@ -952,7 +952,7 @@ at91sam7_read_clock_info(bank); at91sam7_set_flash_mode(bank, FMR_TIMING_NVBITS); - for (sector=first; sector <= last; sector++) + for (sector = first; sector <= last; sector++) { if (set) cmd = SLB; @@ -1016,7 +1016,7 @@ at91sam7_read_clock_info(bank); at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH); - for (pagen=first_page; pagen<last_page; pagen++) + for (pagen = first_page; pagen<last_page; pagen++) { if (bytes_remaining<dst_min_alignment) count = bytes_remaining; Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/cfi.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -212,7 +212,7 @@ if (cfi_info->x16_as_x8) { uint8_t i; - for (i=0;i<2;i++) + for (i = 0;i<2;i++) target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, &data[i*bank->bus_width] ); } @@ -234,7 +234,7 @@ if (cfi_info->x16_as_x8) { uint8_t i; - for (i=0;i<4;i++) + for (i = 0;i<4;i++) target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, &data[i*bank->bus_width] ); } @@ -1011,7 +1011,7 @@ static void cfi_fix_code_endian(target_t *target, uint8_t *dest, const uint32_t *src, uint32_t count) { uint32_t i; - for (i=0; i< count; i++) + for (i = 0; i< count; i++) { target_buffer_set_u32(target, dest, *src); dest += 4; @@ -1452,7 +1452,7 @@ cfi_fix_code_endian(target, target_code, src, target_code_size / 4); /* allocate working area */ - retval=target_alloc_working_area(target, target_code_size, + retval = target_alloc_working_area(target, target_code_size, &cfi_info->write_algorithm); if (retval != ERROR_OK) { @@ -1987,7 +1987,7 @@ buffer += buffersize; write_p += buffersize; count -= buffersize; - fallback=0; + fallback = 0; } } /* try the slow way? */ Modified: trunk/src/flash/ecos.c =================================================================== --- trunk/src/flash/ecos.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/ecos.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -66,7 +66,7 @@ uint32_t start_address; } ecosflash_flash_bank_t; -static const int sectorSize=0x10000; +static const int sectorSize = 0x10000; char * flash_errmsg(int err); @@ -145,7 +145,7 @@ exit(-1); } bank->driver_priv = info; - info->driverPath=strdup(args[6]); + info->driverPath = strdup(args[6]); /* eCos flash sector sizes are not exposed to OpenOCD, use 0x10000 as * a way to improve impeadance matach between OpenOCD and eCos flash @@ -153,7 +153,7 @@ */ int i = 0; uint32_t offset = 0; - bank->num_sectors=bank->size/sectorSize; + bank->num_sectors = bank->size/sectorSize; bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); for (i = 0; i < bank->num_sectors; i++) { @@ -181,15 +181,15 @@ image.base_address_set = 0; image.start_address_set = 0; - target_t *target=info->target; + target_t *target = info->target; int retval; - if ((retval=image_open(&image, info->driverPath, NULL)) != ERROR_OK) + if ((retval = image_open(&image, info->driverPath, NULL)) != ERROR_OK) { return retval; } - info->start_address=image.start_address; + info->start_address = image.start_address; image_size = 0x0; int i; @@ -215,12 +215,12 @@ return ERROR_OK; } -static int const OFFSET_ERASE=0x0; -static int const OFFSET_ERASE_SIZE=0x8; -static int const OFFSET_FLASH=0xc; -static int const OFFSET_FLASH_SIZE=0x8; -static int const OFFSET_GET_WORKAREA=0x18; -static int const OFFSET_GET_WORKAREA_SIZE=0x4; +static int const OFFSET_ERASE = 0x0; +static int const OFFSET_ERASE_SIZE = 0x8; +static int const OFFSET_FLASH = 0xc; +static int const OFFSET_FLASH_SIZE = 0x8; +static int const OFFSET_GET_WORKAREA = 0x18; +static int const OFFSET_GET_WORKAREA_SIZE = 0x4; static int runCode(ecosflash_flash_bank_t *info, uint32_t codeStart, uint32_t codeStop, uint32_t r0, uint32_t r1, uint32_t r2, @@ -228,7 +228,7 @@ /* timeout in ms */ int timeout) { - target_t *target=info->target; + target_t *target = info->target; reg_param_t reg_params[3]; armv4_5_algorithm_t armv4_5_info; @@ -254,7 +254,7 @@ return retval; } - *result=buf_get_u32(reg_params[0].value, 0, 32); + *result = buf_get_u32(reg_params[0].value, 0, 32); destroy_reg_param(®_params[0]); destroy_reg_param(®_params[1]); @@ -268,12 +268,12 @@ int retval; int timeout = (len / 20480 + 1) * 1000; /*asume 20 KB/s*/ - retval=loadDriver(info); + retval = loadDriver(info); if (retval != ERROR_OK) return retval; uint32_t flashErr; - retval=runCode(info, + retval = runCode(info, info->start_address+OFFSET_ERASE, info->start_address+OFFSET_ERASE+OFFSET_ERASE_SIZE, address, @@ -296,17 +296,17 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t address, uint32_t len) { - target_t *target=info->target; - const int chunk=8192; - int retval=ERROR_OK; + target_t *target = info->target; + const int chunk = 8192; + int retval = ERROR_OK; int timeout = (chunk / 20480 + 1) * 1000; /*asume 20 KB/s + 1 second*/ - retval=loadDriver(info); + retval = loadDriver(info); if (retval != ERROR_OK) return retval; uint32_t buffer; - retval=runCode(info, + retval = runCode(info, info->start_address+OFFSET_GET_WORKAREA, info->start_address+OFFSET_GET_WORKAREA+OFFSET_GET_WORKAREA_SIZE, 0, @@ -319,21 +319,21 @@ uint32_t i; - for (i=0; i<len; i += chunk) + for (i = 0; i<len; i += chunk) { - int t=len-i; + int t = len-i; if (t>chunk) { - t=chunk; + t = chunk; } int retval; - retval=target_write_buffer(target, buffer, t, ((uint8_t *)data)+i); + retval = target_write_buffer(target, buffer, t, ((uint8_t *)data)+i); if (retval != ERROR_OK) return retval; uint32_t flashErr; - retval=runCode(info, + retval = runCode(info, info->start_address+OFFSET_FLASH, info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE, buffer, @@ -408,7 +408,7 @@ static int ecosflash_erase(struct flash_bank_s *bank, int first, int last) { - struct flash_bank_s *c=bank; + struct flash_bank_s *c = bank; ecosflash_flash_bank_t *info = bank->driver_priv; return eCosBoard_erase(info, c->base+first*sectorSize, sectorSize*(last-first+1)); } @@ -421,7 +421,7 @@ static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { ecosflash_flash_bank_t *info = bank->driver_priv; - struct flash_bank_s *c=bank; + struct flash_bank_s *c = bank; return eCosBoard_flash(info, buffer, c->base+offset, count); } Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/flash.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -89,7 +89,7 @@ { int retval; - retval=bank->driver->write(bank, buffer, offset, count); + retval = bank->driver->write(bank, buffer, offset, count); if (retval != ERROR_OK) { LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", @@ -103,7 +103,7 @@ { int retval; - retval=bank->driver->erase(bank, first, last); + retval = bank->driver->erase(bank, first, last); if (retval != ERROR_OK) { LOG_ERROR("failed erasing sectors %d to %d (%d)", first, last, retval); @@ -116,7 +116,7 @@ { int retval; - retval=bank->driver->protect(bank, set, first, last); + retval = bank->driver->protect(bank, set, first, last); if (retval != ERROR_OK) { LOG_ERROR("failed setting protection for areas %d to %d (%d)", first, last, retval); @@ -142,10 +142,10 @@ return JIM_ERR; } - Jim_Obj *list=Jim_NewListObj(interp, NULL, 0); + Jim_Obj *list = Jim_NewListObj(interp, NULL, 0); for (p = flash_banks; p; p = p->next) { - Jim_Obj *elem=Jim_NewListObj(interp, NULL, 0); + Jim_Obj *elem = Jim_NewListObj(interp, NULL, 0); Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "name", -1)); Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->driver->name, -1)); @@ -291,7 +291,7 @@ c->sectors = NULL; c->next = NULL; - if ((retval=flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK) + if ((retval = flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK) { LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base); free(c); @@ -754,13 +754,13 @@ switch (cmd[4]) { case 'w': - wordsize=4; + wordsize = 4; break; case 'h': - wordsize=2; + wordsize = 2; break; case 'b': - wordsize=1; + wordsize = 1; break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -791,7 +791,7 @@ duration_start_measure(&duration); - for (wrote=0; wrote<(count*wordsize); wrote += cur_size) + for (wrote = 0; wrote<(count*wordsize); wrote += cur_size) { cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) ); flash_bank_t *bank; @@ -809,7 +809,7 @@ return err; unsigned i; - for (i=0; i<cur_size; i++) + for (i = 0; i<cur_size; i++) { if (readback[i]!=chunk[i]) { @@ -829,7 +829,7 @@ if (err == ERROR_OK) { float speed; - speed=wrote / 1024.0; + speed = wrote / 1024.0; speed/=((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0)); command_print(cmd_ctx, "wrote %" PRId32 " bytes to 0x%8.8" PRIx32 " in %s (%f kb/s)", @@ -1003,7 +1003,7 @@ /* write (optional verify) an image to flash memory of the given target */ int flash_write(target_t *target, image_t *image, uint32_t *written, int erase) { - int retval=ERROR_OK; + int retval = ERROR_OK; int section; uint32_t section_offset; Modified: trunk/src/flash/flash.h =================================================================== --- trunk/src/flash/flash.h 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/flash.h 2009-06-23 22:42:54 UTC (rev 2372) @@ -45,13 +45,13 @@ /// Number of bytes in this flash sector. uint32_t size; /** - * Indication of erasure status: 0=not erased, 1=erased, - * other=unknown. Set by @c flash_driver_s::erase_check. + * Indication of erasure status: 0 = not erased, 1 = erased, + * other = unknown. Set by @c flash_driver_s::erase_check. */ int is_erased; /** - * Indication of protection status: 0=unprotected/unlocked, - * 1=protected/locked, other=unknown. Set by + * Indication of protection status: 0 = unprotected/unlocked, + * 1 = protected/locked, other = unknown. Set by * @c flash_driver_s::protect_check. */ int is_protected; Modified: trunk/src/flash/lpc2000.c =================================================================== --- trunk/src/flash/lpc2000.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/lpc2000.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -525,7 +525,7 @@ checksum = 0 - checksum; LOG_DEBUG("checksum: 0x%8.8" PRIx32, checksum); - uint32_t original_value=buf_get_u32(buffer + (5 * 4), 0, 32); + uint32_t original_value = buf_get_u32(buffer + (5 * 4), 0, 32); if (original_value != checksum) { LOG_WARNING("Verification will fail since checksum in image(0x%8.8" PRIx32 ") written to flash was different from calculated vector checksum(0x%8.8" PRIx32 ").", Modified: trunk/src/flash/mflash.c =================================================================== --- trunk/src/flash/mflash.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/mflash.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -217,7 +217,7 @@ uint32_t mg_task_reg = mflash_bank->base + MG_REG_OFFSET; duration_t duration; int ret; - long long t=0; + long long t = 0; duration_start_measure(&duration); @@ -277,7 +277,7 @@ duration_stop_measure(&duration, NULL); - t=duration.duration.tv_usec/1000; + t = duration.duration.tv_usec/1000; t += duration.duration.tv_sec*1000; if (t > time) @@ -871,7 +871,7 @@ { int i, M; - for (i = 1, M=0; i < 512; i <<= 1, feedback_div >>= 1) + for (i = 1, M = 0; i < 512; i <<= 1, feedback_div >>= 1) M += (feedback_div & 1) * i; return M + 2; Modified: trunk/src/flash/ocl/at91sam7x/main.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -39,19 +39,19 @@ int pagenum; int result; - adr=dcc_rd(); - len=cmd&0xffff; - ofs=adr%flash_page_size; - bi_start=ofs/4; - bi_end=(ofs+len+3)/4; + adr = dcc_rd(); + len = cmd&0xffff; + ofs = adr%flash_page_size; + bi_start = ofs/4; + bi_end = (ofs+len+3)/4; if (bi_end>BUFSIZE) { dcc_wr(OCL_BUFF_OVER); return; } - chksum=OCL_CHKS_INIT; - for (bi=0; bi<bi_end; bi++) chksum^=buffer[bi]=dcc_rd(); + chksum = OCL_CHKS_INIT; + for (bi = 0; bi<bi_end; bi++) chksum^=buffer[bi]=dcc_rd(); if (dcc_rd() != chksum) { dcc_wr(OCL_CHKS_FAIL); @@ -59,18 +59,18 @@ } /* fill in unused positions with unprogrammed values */ - for (bi=0; bi<bi_start; bi++) buffer[bi]=0xffffffff; - for (bi=bi_end; bi%flash_page_size; bi++) buffer[bi]=0xffffffff; + for (bi = 0; bi<bi_start; bi++) buffer[bi]=0xffffffff; + for (bi = bi_end; bi%flash_page_size; bi++) buffer[bi]=0xffffffff; - result=0; - pagenum=adr/flash_page_size; - for (bi=0; bi<bi_end; bi += flash_page_size/4) { - result=flash_page_program(buffer+bi, pagenum++); + result = 0; + pagenum = adr/flash_page_size; + for (bi = 0; bi<bi_end; bi += flash_page_size/4) { + result = flash_page_program(buffer+bi, pagenum++); if (result) break; } /* verify written data */ - if (!result) result=flash_verify(adr, len, ((uint8 *)buffer)+ofs); + if (!result) result = flash_verify(adr, len, ((uint8 *)buffer)+ofs); dcc_wr(OCL_CMD_DONE|result); } @@ -81,7 +81,7 @@ uint32 cmd; for (;;) { - cmd=dcc_rd(); + cmd = dcc_rd(); switch (cmd&OCL_CMD_MASK) { case OCL_PROBE: dcc_wr(OCL_CMD_DONE|flash_init()); Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -20,11 +20,11 @@ #include "samflash.h" -unsigned int flash_page_count=1024; -unsigned int flash_page_size=256; +unsigned int flash_page_count = 1024; +unsigned int flash_page_size = 256; /* pages per lock bit */ -unsigned int flash_lock_pages=1024/16; +unsigned int flash_lock_pages = 1024/16; /* detect chip and set loader parameters */ @@ -32,38 +32,38 @@ { unsigned int nvpsiz; - nvpsiz=(inr(DBGU_CIDR) >> 8)&0xf; + nvpsiz = (inr(DBGU_CIDR) >> 8)&0xf; switch (nvpsiz) { case 3: /* AT91SAM7x32 */ - flash_page_count=256; - flash_page_size=128; - flash_lock_pages=256/8; + flash_page_count = 256; + flash_page_size = 128; + flash_lock_pages = 256/8; break; case 5: /* AT91SAM7x64 */ - flash_page_count=512; - flash_page_size=128; - flash_lock_pages=512/16; + flash_page_count = 512; + flash_page_size = 128; + flash_lock_pages = 512/16; break; case 7: /* AT91SAM7x128*/ - flash_page_count=512; - flash_page_size=256; - flash_lock_pages=512/8; + flash_page_count = 512; + flash_page_size = 256; + flash_lock_pages = 512/8; break; case 9: /* AT91SAM7x256 */ - flash_page_count=1024; - flash_page_size=256; - flash_lock_pages=1024/16; + flash_page_count = 1024; + flash_page_size = 256; + flash_lock_pages = 1024/16; break; case 10: /* AT91SAM7x512 */ - flash_page_count=2048; - flash_page_size=256; - flash_lock_pages=2048/32; + flash_page_count = 2048; + flash_page_size = 256; + flash_lock_pages = 2048/32; break; default: return FLASH_STAT_INITE; @@ -82,19 +82,19 @@ uint32 *data_ptr; /* select proper controller */ - if (page_num >= 1024) efc_ofs=0x10; - else efc_ofs=0; + if (page_num >= 1024) efc_ofs = 0x10; + else efc_ofs = 0; /* wait until FLASH is ready, just for sure */ while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); /* calculate page address, only lower 8 bits are used to address the latch, but the upper part of address is needed for writing to proper EFC */ - flash_ptr=(uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size)); - data_ptr=data; + flash_ptr = (uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size)); + data_ptr = data; /* copy data to latch */ - for (i=flash_page_size/4; i; i--) { + for (i = flash_page_size/4; i; i--) { /* we do not use memcpy to be sure that only 32 bit access is used */ *(flash_ptr++)=*(data_ptr++); } @@ -111,10 +111,10 @@ #if 0 /* verify written data */ - flash_ptr=(uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size)); - data_ptr=data; + flash_ptr = (uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size)); + data_ptr = data; - for (i=flash_page_size/4; i; i--) { + for (i = flash_page_size/4; i; i--) { if (*(flash_ptr++)!=*(data_ptr++)) return FLASH_STAT_VERIFE; } #endif @@ -128,8 +128,8 @@ unsigned int lockbits; int page_num; - page_num=0; - lockbits=inr(MC_FSR+efc_ofs) >> 16; + page_num = 0; + lockbits = inr(MC_FSR+efc_ofs) >> 16; while (lockbits) { if (lockbits&1) { @@ -175,10 +175,10 @@ { int result; - if ((result=flash_erase_plane(0)) != FLASH_STAT_OK) return result; + if ((result = flash_erase_plane(0)) != FLASH_STAT_OK) return result; /* the second flash controller, if any */ - if (flash_page_count>1024) result=flash_erase_plane(0x10); + if (flash_page_count>1024) result = flash_erase_plane(0x10); return result; } @@ -188,7 +188,7 @@ { unsigned char *flash_ptr; - flash_ptr=(uint8 *)FLASH_AREA_ADDR+adr; + flash_ptr = (uint8 *)FLASH_AREA_ADDR+adr; for ( ;len; len--) { if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE; } Modified: trunk/src/flash/ocl.c =================================================================== --- trunk/src/flash/ocl.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/ocl.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -200,7 +200,7 @@ chksum = OCL_CHKS_INIT; /* copy data to DCC buffer in proper byte order and properly aligned */ - for (i=0; i<runlen; i++) + for (i = 0; i<runlen; i++) { switch (byteofs++) { @@ -332,7 +332,7 @@ return ERROR_FLASH_BANK_INVALID; } sectsize = bank->size / bank->num_sectors; - for (i=0; i<bank->num_sectors; i++) + for (i = 0; i<bank->num_sectors; i++) { bank->sectors[i].offset = i * sectsize; bank->sectors[i].size = sectsize; Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -388,7 +388,7 @@ return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - if ((retval=target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code)) != ERROR_OK) + if ((retval = target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code)) != ERROR_OK) return retval; #endif @@ -435,12 +435,12 @@ #endif status = pic32mx_write_row(bank, address, source->address); if ( status & NVMCON_NVMERR ) { - LOG_ERROR("Flash write error NVMERR (status=0x%08" PRIx32 ")", status); + LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } if ( status & NVMCON_LVDERR ) { - LOG_ERROR("Flash write error LVDERR (status=0x%08" PRIx32 ")", status); + LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } @@ -459,12 +459,12 @@ uint32_t status = pic32mx_write_word(bank, address, value); if ( status & NVMCON_NVMERR ) { - LOG_ERROR("Flash write error NVMERR (status=0x%08" PRIx32 ")", status); + LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } if ( status & NVMCON_LVDERR ) { - LOG_ERROR("Flash write error LVDERR (status=0x%08" PRIx32 ")", status); + LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status); retval = ERROR_FLASH_OPERATION_FAILED; break; } @@ -620,7 +620,7 @@ num_pages = 12; } else { /* 0xBD000000: Program flash size varies with device */ - for (i=0; pic32mx_devs[i].name != NULL; i++) + for (i = 0; pic32mx_devs[i].name != NULL; i++) if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) { num_pages = pic32mx_devs[i].pfm_size; break; @@ -704,7 +704,7 @@ PIC32MX_MANUF_ID); return ERROR_FLASH_OPERATION_FAILED; } - for (i=0; pic32mx_devs[i].name != NULL; i++) + for (i = 0; pic32mx_devs[i].name != NULL; i++) if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) { printed = snprintf(buf, buf_size, "PIC32MX%s", pic32mx_devs[i].name); break; @@ -939,7 +939,7 @@ if (res == ERROR_OK) command_print(cmd_ctx, "pic32mx pgm word complete"); else - command_print(cmd_ctx, "pic32mx pgm word failed (status=0x%x)", status); + command_print(cmd_ctx, "pic32mx pgm word failed (status = 0x%x)", status); return ERROR_OK; } Modified: trunk/src/flash/stm32x.c =================================================================== --- trunk/src/flash/stm32x.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/stm32x.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -517,7 +517,7 @@ return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - if ((retval=target_write_buffer(target, stm32x_info->write_algorithm->address, sizeof(stm32x_flash_write_code), stm32x_flash_write_code)) != ERROR_OK) + if ((retval = target_write_buffer(target, stm32x_info->write_algorithm->address, sizeof(stm32x_flash_write_code), stm32x_flash_write_code)) != ERROR_OK) return retval; /* memory buffer */ Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/str9x.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -198,11 +198,11 @@ if (str9x_info->bank1) { adr = bank1start + 0x18; - if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0x90)) != ERROR_OK) { return retval; } - if ((retval=target_read_u16(target, adr, &hstatus)) != ERROR_OK) + if ((retval = target_read_u16(target, adr, &hstatus)) != ERROR_OK) { return retval; } @@ -211,11 +211,11 @@ else { adr = bank1start + 0x14; - if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0x90)) != ERROR_OK) { return retval; } - if ((retval=target_read_u32(target, adr, &status)) != ERROR_OK) + if ((retval = target_read_u32(target, adr, &status)) != ERROR_OK) { return retval; } @@ -224,11 +224,11 @@ else { adr = bank1start + 0x10; - if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0x90)) != ERROR_OK) { return retval; } - if ((retval=target_read_u16(target, adr, &hstatus)) != ERROR_OK) + if ((retval = target_read_u16(target, adr, &hstatus)) != ERROR_OK) { return retval; } @@ -236,7 +236,7 @@ } /* read array command */ - if ((retval=target_write_u16(target, adr, 0xFF)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0xFF)) != ERROR_OK) { return retval; } @@ -284,24 +284,24 @@ adr = bank->base + bank->sectors[i].offset; /* erase sectors */ - if ((retval=target_write_u16(target, adr, erase_cmd)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, erase_cmd)) != ERROR_OK) { return retval; } - if ((retval=target_write_u16(target, adr, 0xD0)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0xD0)) != ERROR_OK) { return retval; } /* get status */ - if ((retval=target_write_u16(target, adr, 0x70)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0x70)) != ERROR_OK) { return retval; } int timeout; - for (timeout=0; timeout<1000; timeout++) { - if ((retval=target_read_u8(target, adr, &status)) != ERROR_OK) + for (timeout = 0; timeout<1000; timeout++) { + if ((retval = target_read_u8(target, adr, &status)) != ERROR_OK) { return retval; } @@ -316,13 +316,13 @@ } /* clear status, also clear read array */ - if ((retval=target_write_u16(target, adr, 0x50)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0x50)) != ERROR_OK) { return retval; } /* read array command */ - if ((retval=target_write_u16(target, adr, 0xFF)) != ERROR_OK) + if ((retval = target_write_u16(target, adr, 0xFF)) != ERROR_OK) { return retval; } @@ -575,7 +575,7 @@ target_write_u16(target, bank_adr, 0x70); int timeout; - for (timeout=0; timeout<1000; timeout++) + for (timeout = 0; timeout<1000; timeout++) { target_read_u8(target, bank_adr, &status); if ( status & 0x80 ) @@ -624,7 +624,7 @@ target_write_u16(target, bank_adr, 0x70); int timeout; - for (timeout=0; timeout<1000; timeout++) + for (timeout = 0; timeout<1000; timeout++) { target_read_u8(target, bank_adr, &status); if ( status & 0x80 ) Modified: trunk/src/flash/tms470.c =================================================================== --- trunk/src/flash/tms470.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/flash/tms470.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -150,7 +150,7 @@ /* read and parse the device identification register */ target_read_u32(target, 0xFFFFFFF0, &device_ident_reg); - LOG_INFO("device_ident_reg=0x%08" PRIx32 "", device_ident_reg); + LOG_INFO("device_ident_reg = 0x%08" PRIx32 "", device_ident_reg); if ((device_ident_reg & 7) == 0) { @@ -432,7 +432,7 @@ uint32_t fmbbusy; target_read_u32(target, 0xFFE89C08, &fmbbusy); - LOG_INFO("tms470 fmbbusy=0x%08" PRIx32 " -> %s", fmbbusy, fmbbusy & 0x8000 ? "unlocked" : "LOCKED"); + LOG_INFO("tms470 fmbbusy = 0x%08" PRIx32 " -> %s", fmbbusy, fmbbusy & 0x8000 ? "unlocked" : "LOCKED"); return fmbbusy & 0x8000 ? ERROR_OK : ERROR_FLASH_OPERATION_FAILED; } @@ -482,7 +482,7 @@ */ target_read_u32(target, 0x00001FF0 + 4 * i, &tmp); - LOG_INFO("tms470 writing fmpkey=0x%08" PRIx32 "", key_set[i]); + LOG_INFO("tms470 writing fmpkey = 0x%08" PRIx32 "", key_set[i]); target_write_u32(target, 0xFFE89C0C, key_set[i]); } @@ -570,7 +570,7 @@ fmmac2 &= ~0x0007; fmmac2 |= (tms470_info->ordinal & 7); target_write_u32(target, 0xFFE8BC04, fmmac2); - LOG_DEBUG("set fmmac2=0x%04" PRIx32 "", fmmac2); + LOG_DEBUG("set fmmac2 = 0x%04" PRIx32 "", fmmac2); /* * Disable level 1 sector protection by setting bit 15 of FMMAC1. @@ -578,25 +578,25 @@ target_read_u32(target, 0xFFE8BC00, &fmmac1); fmmac1 |= 0x8000; target_write_u32(target, 0xFFE8BC00, fmmac1); - LOG_DEBUG("set fmmac1=0x%04" PRIx32 "", fmmac1); + LOG_DEBUG("set fmmac1 = 0x%04" PRIx32 "", fmmac1); /* - * FMTCREG=0x2fc0; + * FMTCREG = 0x2fc0; */ target_write_u32(target, 0xFFE8BC10, 0x2fc0); - LOG_DEBUG("set fmtcreg=0x2fc0"); + LOG_DEBUG("set fmtcreg = 0x2fc0"); /* - * MAXPP=50 + * MAXPP = 50 */ target_write_u32(target, 0xFFE8A07C, 50); - LOG_DEBUG("set fmmaxpp=50"); + LOG_DEBUG("set fmmaxpp = 50"); /* - * MAXCP=0xf000+2000 + * MAXCP = 0xf000+2000 */ target_write_u32(target, 0xFFE8A084, 0xf000 + 2000); - LOG_DEBUG("set fmmaxcp=0x%04x", 0xf000 + 2000); + LOG_DEBUG("set fmmaxcp = 0x%04x", 0xf000 + 2000); /* * configure VHV @@ -606,22 +606,22 @@ { fmmaxep = 0xf000 + 4095; target_write_u32(target, 0xFFE8A80C, 0x9964); - LOG_DEBUG("set fmptr3=0x9964"); + LOG_DEBUG("set fmptr3 = 0x9964"); } else { fmmaxep = 0xa000 + 4095; target_write_u32(target, 0xFFE8A80C, 0x9b64); - LOG_DEBUG("set fmptr3=0x9b64"); + LOG_DEBUG("set fmptr3 = 0x9b64"); } target_write_u32(target, 0xFFE8A080, fmmaxep); - LOG_DEBUG("set fmmaxep=0x%04" PRIx32 "", fmmaxep); + LOG_DEBUG("set fmmaxep = 0x%04" PRIx32 "", fmmaxep); /* - * FMPTR4=0xa000 + * FMPTR4 = 0xa000 */ target_write_u32(target, 0xFFE8A810, 0xa000); - LOG_DEBUG("set fmptr4=0xa000"); + LOG_DEBUG("set fmptr4 = 0xa000"); /* * FMPESETUP, delay parameter selected based on clock frequency. @@ -635,56 +635,56 @@ sysclk = (plldis ? 1 : (glbctrl & 0x08) ? 4 : 8) * oscMHz / (1 + (glbctrl & 7)); delay = (sysclk > 10) ? (sysclk + 1) / 2 : 5; target_write_u32(target, 0xFFE8A018, (delay << 4) | (delay << 8)); - LOG_DEBUG("set fmpsetup=0x%04" PRIx32 "", (delay << 4) | (delay << 8)); + LOG_DEBUG("set fmpsetup = 0x%04" PRIx32 "", (delay << 4) | (delay << 8)); /* * FMPVEVACCESS, based on delay. */ k = delay | (delay << 8); target_write_u32(target, 0xFFE8A05C, k); - LOG_DEBUG("set fmpvevaccess=0x%04" PRIx32 "", k); + LOG_DEBUG("set fmpvevaccess = 0x%04" PRIx32 "", k); /* * FMPCHOLD, FMPVEVHOLD, FMPVEVSETUP, based on delay. */ k <<= 1; target_write_u32(target, 0xFFE8A034, k); - LOG_DEBUG("set fmpchold=0x%04" PRIx32 "", k); + LOG_DEBUG("set fmpchold = 0x%04" PRIx32 "", k); target_write_u32(target, 0xFFE8A040, k); - LOG_DEBUG("set fmpvevhold=0x%04" PRIx32 "", k); + LOG_DEBUG("set fmpvevhold = 0x%04" PRIx32 "", k); target_write_u32(target, 0xFFE8A024, k); - LOG_DEBUG("set fmpvevsetup=0x%04" PRIx32 "", k); + LOG_DEBUG("set fmpvevsetup = 0x%04" PRIx32 "", k); /* * FMCVACCESS, based on delay. */ k = delay * 16; target_write_u32(target, 0xFFE8A060, k); - LOG_DEBUG("set fmcvaccess=0x%04" PRIx32 "", k); + LOG_DEBUG("set fmcvaccess = 0x%04" PRIx32 "", k); /* * FMCSETUP, based on delay. */ k = 0x3000 | delay * 20; target_write_u32(target, 0xFFE8A020, k); - LOG_DEBUG("set fmcsetup=0x%04" PRIx32 "", k); + LOG_DEBUG("set fmcsetup = 0x%04" PRIx32 "", k); /* * FMEHOLD, based on delay. */ k = (delay * 20) << 2; target_write_u32(target, 0xFFE8A038, k); - LOG_DEBUG("set fmehold=0x%04" PRIx32 "", k); + LOG_DEBUG("set fmehold = 0x%04" PRIx32 "", k); /* * PWIDTH, CWIDTH, EWIDTH, based on delay. */ target_write_u32(target, 0xFFE8A050, delay * 8); - LOG_DEBUG("set fmpwidth=0x%04" PRIx32 "", delay * 8); + LOG_DEBUG("set fmpwidth = 0x%04" PRIx32 "", delay * 8); target_write_u32(target, 0xFFE8A058, delay * 1000); - LOG_DEBUG("set fmcwidth=0x%04" PRIx32 "", delay * 1000); + LOG_DEBUG("set fmcwidth = 0x%04" PRIx32 "", delay * 1000); target_write_u32(target, 0xFFE8A054, delay * 5400); - LOG_DEBUG("set fmewidth=0x%04" PRIx32 "", delay * 5400); + LOG_DEBUG("set fmewidth = 0x%04" PRIx32 "", delay * 5400); return result; } @@ -698,7 +698,7 @@ uint32_t fmmstat; target_read_u32(target, 0xFFE8BC0C, &fmmstat); - LOG_DEBUG("set fmmstat=0x%04" PRIx32 "", fmmstat); + LOG_DEBUG("set fmmstat = 0x%04" PRIx32 "", fmmstat); if (fmmstat & 0x0080) { @@ -760,12 +760,12 @@ */ target_read_u32(target, 0xFFFFFFDC, &glbctrl); target_write_u32(target, 0xFFFFFFDC, glbctrl | 0x10); - LOG_DEBUG("set glbctrl=0x%08" PRIx32 "", glbctrl | 0x10); + LOG_DEBUG("set glbctrl = 0x%08" PRIx32 "", glbctrl | 0x10); /* Force normal read mode. */ target_read_u32(target, 0xFFE89C00, &orig_fmregopt); target_write_u32(target, 0xFFE89C00, 0); - LOG_DEBUG("set fmregopt=0x%08x", 0); + LOG_DEBUG("set fmregopt = 0x%08x", 0); (void)tms470_flash_initialize_internal_state_machine(bank); @@ -777,13 +777,13 @@ { target_read_u32(target, 0xFFE88008, &fmbsea); target_write_u32(target, 0xFFE88008, fmbsea | (1 << sector)); - LOG_DEBUG("set fmbsea=0x%04" PRIx32 "", fmbsea | (1 << sector)); + LOG_DEBUG("set fmbsea = 0x%04" PRIx32 "", fmbsea | (1 << sector)); } else { target_read_u32(target, 0xFFE8800C, &fmbseb); target_write_u32(target, 0xFFE8800C, fmbseb | (1 << (sector - 16))); - LOG_DEBUG("set fmbseb=0x%04" PRIx32 "", fmbseb | (1 << (sector - 16))); + LOG_DEBUG("set fmbseb = 0x%04" PRIx32 "", fmbseb | (1 << (sector - 16))); } bank->sectors[sector].is_protected = 0; @@ -816,19 +816,19 @@ if (sector < 16) { target_write_u32(target, 0xFFE88008, fmbsea); - LOG_DEBUG("set fmbsea=0x%04" PRIx32 "", fmbsea); + LOG_DEBUG("set fmbsea = 0x%04" PRIx32 "", fmbsea); bank->sectors[sector].is_protected = fmbsea & (1 << sector) ? 0 : 1; } else { target_write_u32(target, 0xFFE8800C, fmbseb); - LOG_DEBUG("set fmbseb=0x%04" PRIx32 "", fmbseb); + LOG_DEBUG("set fmbseb = 0x%04" PRIx32 "", fmbseb); bank->sectors[sector].is_protected = fmbseb & (1 << (sector - 16)) ? 0 : 1; } target_write_u32(target, 0xFFE89C00, orig_fmregopt); - LOG_DEBUG("set fmregopt=0x%08" PRIx32 "", orig_fmregopt); + LOG_DEBUG("set fmregopt = 0x%08" PRIx32 "", orig_fmregopt); target_write_u32(target, 0xFFFFFFDC, glbctrl); - LOG_DEBUG("set glbctrl=0x%08" PRIx32 "", glbctrl); + LOG_DEBUG("set glbctrl = 0x%08" PRIx32 "", glbctrl); if (result == ERROR_OK) { @@ -1028,7 +1028,7 @@ if (fmmstat & 0x3ff) { - LOG_ERROR("fmstat=0x%04" PRIx32 "", fmmstat); + LOG_ERROR("fmstat = 0x%04" PRIx32 "", fmmstat); LOG_ERROR("Could not program word 0x%04x at address 0x%08" PRIx32 ".", word, addr); result = ERROR_FLASH_OPERATION_FAILED; break; @@ -1105,7 +1105,7 @@ target_read_u32(target, 0xFFE8BC04, &fmmac2); target_write_u32(target, 0xFFE8BC04, (fmmac2 & ~7) | tms470_info->ordinal); - /* TCR=0 */ + /* TCR = 0 */ target_write_u32(target, 0xFFE8BC10, 0x2fc0); /* clear TEZ in fmbrdy */ Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:42:54 UTC (rev 2372) @@ -42,7 +42,7 @@ { unsigned int i; - for (i=first; i<first+num; i++) + for (i = first; i<first+num; i++) { if (((value >> (i-first))&1) == 1) buffer[i/8] |= 1 << (i%8); @@ -61,7 +61,7 @@ uint32_t result = 0; unsigned int i; - for (i=first; i<first+num; i++) + for (i = first; i<first+num; i++) { if (((buffer[i/8]>>(i%8))&1) == 1) result |= 1 << (i-first); Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/command.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -54,7 +54,7 @@ static void tcl_output(void *privData, const char *file, int line, const char *function, const char *string) { - Jim_Obj *tclOutput=(Jim_Obj *)privData; + Jim_Obj *tclOutput = (Jim_Obj *)privData; Jim_AppendString(interp, tclOutput, string, strlen(string)); } @@ -108,7 +108,7 @@ for (i = 0; i < argc; i++) { int len; - const char *w=Jim_GetString(argv[i], &len); + const char *w = Jim_GetString(argv[i], &len); if (*w=='#') { /* hit an end of line comment */ @@ -228,26 +228,26 @@ /* maximum of two levels :-) */ if (c->parent != NULL) { - t1=c->parent->name; + t1 = c->parent->name; t2="_"; } - t3=c->name; - const char *full_name=alloc_printf("ocd_%s%s%s", t1, t2, t3); + t3 = c->name; + const char *full_name = alloc_printf("ocd_%s%s%s", t1, t2, t3); Jim_CreateCommand(interp, full_name, script_command, c, NULL); free((void *)full_name); /* we now need to add an overrideable proc */ - const char *override_name=alloc_printf("proc %s%s%s {args} {if {[catch {eval ocd_%s%s%s $args}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3); + const char *override_name = alloc_printf("proc %s%s%s {args} {if {[catch {eval ocd_%s%s%s $args}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3); Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__ ); free((void *)override_name); /* accumulate help text in Tcl helptext list. */ - Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); + Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); if (Jim_IsShared(helptext)) helptext = Jim_DuplicateObj(interp, helptext); - Jim_Obj *cmd_entry=Jim_NewListObj(interp, NULL, 0); + Jim_Obj *cmd_entry = Jim_NewListObj(interp, NULL, 0); - Jim_Obj *cmd_list=Jim_NewListObj(interp, NULL, 0); + Jim_Obj *cmd_list = Jim_NewListObj(interp, NULL, 0); /* maximum of two levels :-) */ if (c->parent != NULL) @@ -404,7 +404,7 @@ int run_command(command_context_t *context, command_t *c, char *words[], int num_words) { - int start_word=0; + int start_word = 0; if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode) )) { /* Config commands can not run after the config stage */ @@ -422,10 +422,10 @@ /* maximum of two levels :-) */ if (c->parent != NULL) { - t1=c->parent->name; + t1 = c->parent->name; t2=" "; } - t3=c->name; + t3 = c->name; command_run_linef(context, "help {%s%s%s}", t1, t2, t3); } else if (retval == ERROR_COMMAND_CLOSE_CONNECTION) @@ -450,7 +450,7 @@ * results */ /* run the line thru a script engine */ - int retval=ERROR_FAIL; + int retval = ERROR_FAIL; int retcode; /* Beware! This code needs to be reentrant. It is also possible * for OpenOCD commands to be invoked directly from Tcl. This would @@ -508,21 +508,21 @@ } LOG_USER_N("%s", "\n"); } - retval=ERROR_OK; + retval = ERROR_OK; } return retval; } int command_run_linef(command_context_t *context, const char *format, ...) { - int retval=ERROR_FAIL; + int retval = ERROR_FAIL; char *string; va_list ap; va_start(ap, format); string = alloc_vprintf(format, ap); if (string != NULL) { - retval=command_run_line(context, string); + retval = command_run_line(context, string); } va_end(ap); return retval; @@ -837,13 +837,13 @@ /* FIX!!! it would be prettier to invoke add_help_text... * accumulate help text in Tcl helptext list. */ - Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); + Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); if (Jim_IsShared(helptext)) helptext = Jim_DuplicateObj(interp, helptext); - Jim_Obj *cmd_entry=Jim_NewListObj(interp, NULL, 0); + Jim_Obj *cmd_entry = Jim_NewListObj(interp, NULL, 0); - Jim_Obj *cmd_list=Jim_NewListObj(interp, NULL, 0); + Jim_Obj *cmd_list = Jim_NewListObj(interp, NULL, 0); Jim_ListAppendElement(interp, cmd_list, Jim_NewStringObj(interp, name, -1)); Jim_ListAppendElement(interp, cmd_entry, cmd_list); @@ -854,7 +854,7 @@ /* return global variable long value or 0 upon failure */ long jim_global_long(const char *variable) { - Jim_Obj *objPtr=Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG); + Jim_Obj *objPtr = Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG); long t; if (Jim_GetLong(interp, objPtr, &t) == JIM_OK) { Modified: trunk/src/helper/configuration.c =================================================================== --- trunk/src/helper/configuration.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/configuration.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -93,7 +93,7 @@ return fopen(file, mode); } else { - char *full_path=find_file(file); + char *full_path = find_file(file); if (full_path == NULL) return NULL; FILE *fp = NULL; @@ -115,7 +115,7 @@ while (*cfg) { - retval=command_run_line(cmd_ctx, *cfg); + retval = command_run_line(cmd_ctx, *cfg); if (retval != ERROR_OK) return retval; cfg++; Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/ioutil.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -215,7 +215,7 @@ return ERROR_INVALID_ARGUMENTS; } - int retval=ERROR_FAIL; + int retval = ERROR_FAIL; FILE *config_file = NULL; config_file = fopen(args[0], "a"); if (config_file != NULL) @@ -235,7 +235,7 @@ } if ((i == argc) && (fwrite("\n", 1, 1, config_file) == 1)) { - retval=ERROR_OK; + retval = ERROR_OK; } fclose(config_file); } Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/jim.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -504,7 +504,7 @@ { jim_wide i, res = 1; if ((b == 0 && e != 0) || (e<0)) return 0; - for (i=0; i<e; i++) {res *= b;} + for (i = 0; i<e; i++) {res *= b;} return res; } @@ -569,7 +569,7 @@ { /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ if (size == 0) - size=1; + size = 1; void *p = malloc(size); if (p == NULL) Jim_Panic(NULL,"malloc: Out of memory"); @@ -584,7 +584,7 @@ { /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ if (size == 0) - size=1; + size = 1; void *p = realloc(ptr, size); if (p == NULL) Jim_Panic(NULL,"realloc: Out of memory"); @@ -2521,8 +2521,8 @@ Jim_Obj *Jim_FormatString(Jim_Interp *interp, Jim_Obj *fmtObjPtr, int objc, Jim_Obj *const *objv) { - char *sprintf_buf=malloc(JIM_MAX_FMT); - Jim_Obj *t=Jim_FormatString_Inner(interp, fmtObjPtr, objc, objv, sprintf_buf); + char *sprintf_buf = malloc(JIM_MAX_FMT); + Jim_Obj *t = Jim_FormatString_Inner(interp, fmtObjPtr, objc, objv, sprintf_buf); free(sprintf_buf); return t; } @@ -5366,7 +5366,7 @@ } point = listPtr->internalRep.listValue.ele + index; memmove(point+elemc, point, (currentLen-index) * sizeof(Jim_Obj*)); - for (i=0; i < elemc; ++i) { + for (i = 0; i < elemc; ++i) { point[i] = elemVec[i]; Jim_IncrRefCount(point[i]); } @@ -7335,7 +7335,7 @@ Jim_FreeIntRep(interp, objPtr); /* Count how many conversions could take place maximally */ - for (i=0, maxCount=0; i < maxFmtLen; ++i) + for (i = 0, maxCount = 0; i < maxFmtLen; ++i) if (fmt[i] == '%') ++maxCount; /* Calculate an approximation of the memory necessary */ @@ -7356,8 +7356,8 @@ buffer = fmtObj->stringRep + maxFmtLen + 1; objPtr->internalRep.ptr = fmtObj; objPtr->typePtr = &scanFmtStringObjType; - for (i=0, curr=0; fmt < fmtEnd; ++fmt) { - int width=0, skip; + for (i = 0, curr = 0; fmt < fmtEnd; ++fmt) { + int width = 0, skip; ScanFmtPartDescr *descr = &fmtObj->descr[curr]; fmtObj->count++; descr->width = 0; /* Assume width unspecified */ @@ -7401,7 +7401,7 @@ return JIM_ERR; } /* Look if this position was already used */ - for (prev=0; prev < curr; ++prev) { + for (prev = 0; prev < curr; ++prev) { if (fmtObj->descr[prev].pos == -1) continue; if (fmtObj->descr[prev].pos == descr->pos) { fmtObj->error = "same \"%n$\" conversion specifier " @@ -7442,7 +7442,7 @@ /* In case a range fence was given "backwards", swap it */ while (swapped) { swapped = 0; - for (j=beg+1; j < end-1; ++j) { + for (j = beg+1; j < end-1; ++j) { if (buffer[j] == '-' && buffer[j-1] > buffer[j+1]) { char tmp = buffer[j-1]; buffer[j-1] = buffer[j+1]; @@ -7550,7 +7550,7 @@ if (sdescr[1] == '-' && sdescr[2] != 0) { /* Handle range definitions */ int i; - for (i=sdescr[0]; i <= sdescr[2]; ++i) + for (i = sdescr[0]; i <= sdescr[2]; ++i) JimSetBit(charset, (char)i); sdescr += 3; } else { @@ -7559,7 +7559,7 @@ } } /* Negate the charset if there was a NOT given */ - for (i=0; notFlag && i < sizeof(charset); ++i) + for (i = 0; notFlag && i < sizeof(charset); ++i) charset[i] = ~charset[i]; } /* And after all the mess above, the real work begin ... */ @@ -7600,7 +7600,7 @@ if (descr->prefix) { /* There was a prefix given before the conversion, skip it and adjust * the string-to-be-parsed accordingly */ - for (i=0; str[pos] && descr->prefix[i]; ++i) { + for (i = 0; str[pos] && descr->prefix[i]; ++i) { /* If prefix require, skip WS */ if (isspace((int)descr->prefix[i])) while (str[pos] && isspace((int)str[pos])) ++pos; @@ -7757,12 +7757,12 @@ /* Create a list and fill it with empty strings up to max specified XPG3 */ resultList = Jim_NewListObj(interp, 0, 0); if (fmtObj->maxPos > 0) { - for (i=0; i < fmtObj->maxPos; ++i) + for (i = 0; i < fmtObj->maxPos; ++i) Jim_ListAppendElement(interp, resultList, emptyStr); JimListGetElements(interp, resultList, &resultc, &resultVec); } /* Now handle every partial format description */ - for (i=0, pos=0; i < fmtObj->count; ++i) { + for (i = 0, pos = 0; i < fmtObj->count; ++i) { ScanFmtPartDescr *descr = &(fmtObj->descr[i]); Jim_Obj *value = 0; /* Only last type may be "literal" w/o conversion - skip it! */ @@ -8960,8 +8960,8 @@ Jim_Obj *scriptObjPtr; if ((fp = fopen(filename, "r")) == NULL) { - const int cwd_len=2048; - char *cwd=malloc(cwd_len); + const int cwd_len = 2048; + char *cwd = malloc(cwd_len); Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); if (!getcwd( cwd, cwd_len )) strcpy(cwd, "unknown"); Jim_AppendStrings(interp, Jim_GetResult(interp), @@ -10203,7 +10203,7 @@ /* Initialize iterators and remember max nbr elements each list */ memset(listsIdx, 0, nbrOfLists * sizeof(int)); /* Remember lengths of all lists and calculate how much rounds to loop */ - for (i=0; i < nbrOfLists*2; i += 2) { + for (i = 0; i < nbrOfLists*2; i += 2) { div_t cnt; int count; Jim_ListLength(interp, argv[i+1], &listsEnd[i]); @@ -10218,7 +10218,7 @@ nbrOfLoops = count; } for (; nbrOfLoops-- > 0; ) { - for (i=0; i < nbrOfLists; ++i) { + for (i = 0; i < nbrOfLists; ++i) { int varIdx = 0, var = i * 2; while (varIdx < listsEnd[var]) { Jim_Obj *varName, *ele; @@ -10340,11 +10340,11 @@ static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - int retcode = JIM_ERR, matchOpt = SWITCH_EXACT, opt=1, patCount, i; + int retcode = JIM_ERR, matchOpt = SWITCH_EXACT, opt = 1, patCount, i; Jim_Obj *command = 0, *const *caseList = 0, *strObj; Jim_Obj *script = 0; if (argc < 3) goto wrongnumargs; - for (opt=1; opt < argc; ++opt) { + for (opt = 1; opt < argc; ++opt) { const char *option = Jim_GetString(argv[opt], 0); if (*option != '-') break; else if (strncmp(option, "--", 2) == 0) { ++opt; break; } @@ -10372,7 +10372,7 @@ } else caseList = &argv[opt]; if (patCount == 0 || patCount % 2 != 0) goto wrongnumargs; - for (i=0; script == 0 && i < patCount; i += 2) { + for (i = 0; script == 0 && i < patCount; i += 2) { Jim_Obj *patObj = caseList[i]; if (!Jim_CompareStringImmediate(interp, patObj, "default") || i < (patCount-2)) { Modified: trunk/src/helper/jim.h =================================================================== --- trunk/src/helper/jim.h 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/jim.h 2009-06-23 22:42:54 UTC (rev 2372) @@ -575,7 +575,7 @@ * known string, or there may be multiple strings (aliases) that mean then same * thing. * - * An NVP Table is terminated with ".name=NULL". + * An NVP Table is terminated with ".name = NULL". * * During the 'name2value' operation, if no matching string is found * the pointer to the terminal element (with p->name == NULL) is returned. @@ -966,7 +966,7 @@ * Usefull when dealing with command options. * that may come in any order... * - * Does not support "-foo=123" type options. + * Does not support "-foo = 123" type options. * Only supports tcl type options, like "-foo 123" */ @@ -1097,7 +1097,7 @@ * * This function assumes the previous option argv[-1] is the unknown string. * - * If this option had some prefix, then pass "hadprefix=1" else pass "hadprefix=0" + * If this option had some prefix, then pass "hadprefix = 1" else pass "hadprefix = 0" * * Example: * \code @@ -1107,7 +1107,7 @@ * e = Jim_GetOpt_Nvp( &goi, cmd_options, &n ); * if ( e != JIM_OK ){ * // option was not recognized - * // pass 'hadprefix=0' because there is no prefix + * // pass 'hadprefix = 0' because there is no prefix * Jim_GetOpt_NvpUnknown( &goi, cmd_options, 0 ); * return e; * } Modified: trunk/src/helper/log.c =================================================================== --- trunk/src/helper/log.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/log.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -94,7 +94,7 @@ if (debug_level >= LOG_LVL_DEBUG) { /* print with count and time information */ - int t=(int)(timeval_ms()-start); + int t = (int)(timeval_ms()-start); #ifdef _DEBUG_FREE_SPACE_ struct mallinfo info; info = mallinfo(); @@ -136,9 +136,9 @@ /* DANGER!!!! the log callback can remove itself!!!! */ while (cb) { - next=cb->next; + next = cb->next; cb->fn(cb->priv, file, line, function, string); - cb=next; + cb = next; } } } @@ -259,7 +259,7 @@ log_output = stderr; } - start=last_time=timeval_ms(); + start = last_time = timeval_ms(); return ERROR_OK; } @@ -383,7 +383,7 @@ */ void keep_alive() { - current_time=timeval_ms(); + current_time = timeval_ms(); if (current_time-last_time>1000) { extern int gdb_actual_connections; @@ -413,28 +413,28 @@ * These functions should be invoked at a well defined spot in server.c */ - last_time=current_time; + last_time = current_time; } } /* reset keep alive timer without sending message */ void kept_alive() { - current_time=timeval_ms(); - last_time=current_time; + current_time = timeval_ms(); + last_time = current_time; } /* if we sleep for extended periods of time, we must invoke keep_alive() intermittantly */ void alive_sleep(int ms) { int i; - int napTime=10; - for (i=0; i<ms; i += napTime) + int napTime = 10; + for (i = 0; i<ms; i += napTime) { - int sleep_a_bit=ms-i; + int sleep_a_bit = ms-i; if (sleep_a_bit>napTime) { - sleep_a_bit=napTime; + sleep_a_bit = napTime; } usleep(sleep_a_bit*1000); keep_alive(); @@ -444,7 +444,7 @@ void busy_sleep(int ms) { long long then; - then=timeval_ms(); + then = timeval_ms(); while ((timeval_ms()-then)<ms) { /* busy wait */ Modified: trunk/src/helper/options.c =================================================================== --- trunk/src/helper/options.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/options.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -70,7 +70,7 @@ /* Either this code will *always* work or it will SEGFAULT giving * excellent information on the culprit. */ - *strrchr(strExePath, '\\')=0; + *strrchr(strExePath, '\\') = 0; strcat(strExePath, "\\.."); add_script_search_dir(strExePath); } @@ -88,9 +88,9 @@ char strExePath [MAX_PATH]; char *p; GetModuleFileName (NULL, strExePath, MAX_PATH); - *strrchr(strExePath, '\\')=0; + *strrchr(strExePath, '\\') = 0; strcat(strExePath, "/../lib/"PACKAGE); - for (p=strExePath; *p; p++) { + for (p = strExePath; *p; p++) { if (*p == '\\') *p = '/'; } Modified: trunk/src/helper/time_support.c =================================================================== --- trunk/src/helper/time_support.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/helper/time_support.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -99,7 +99,7 @@ if (text) { float t; - t=duration->duration.tv_sec; + t = duration->duration.tv_sec; t += (float)duration->duration.tv_usec/1000000.0; *text = malloc(100); snprintf(*text, 100, "%fs", t); @@ -111,7 +111,7 @@ long long timeval_ms() { struct timeval now; - long long t=0; + long long t = 0; gettimeofday(&now, NULL); t += now.tv_usec/1000; Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2009-06-23 22:42:03 UTC (rev 2371) +++ trunk/src/jtag/bitbang.c 2009-06-23 22:42:54 UTC (rev 2372) @@ -47,7 +47,7 @@ * * If someone can submit a patch with an explanation it will be greatly * appreciated, but as far as I can tell () DCLK is generated upon - * clk=0 in TAP_IDLE. Good luck deducing that from the ARM documentation! + * clk = 0 in TAP_IDLE. Good luck deducing that from the ARM documentation! * The ARM documentation uses the ter... [truncated message content] |
From: <zw...@ma...> - 2009-06-24 00:42:50
|
Author: zwelch Date: 2009-06-24 00:42:03 +0200 (Wed, 24 Jun 2009) New Revision: 2371 Modified: trunk/src/flash/at91sam7.c trunk/src/flash/flash.c trunk/src/flash/ocl.c trunk/src/flash/ocl/at91sam7x/dcc.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/str9x.c trunk/src/helper/binarybuffer.h trunk/src/helper/command.c trunk/src/helper/configuration.c trunk/src/helper/ioutil.c trunk/src/helper/jim.c trunk/src/helper/jim.h trunk/src/jtag/bitbang.c trunk/src/jtag/bitq.c trunk/src/jtag/core.c trunk/src/jtag/driver.c trunk/src/jtag/dummy.c trunk/src/jtag/ft2232.c trunk/src/jtag/jlink.c trunk/src/jtag/presto.c trunk/src/jtag/tcl.c trunk/src/jtag/usbprog.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/server/gdb_server.c trunk/src/target/arm11.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_disassembler.c trunk/src/target/arm_jtag.c trunk/src/target/breakpoints.c trunk/src/target/etb.c trunk/src/target/image.c trunk/src/target/mips32_pracc.c trunk/src/target/mips_ejtag.c trunk/src/target/target.c trunk/src/target/xscale.c Log: - Fixes '==' whitespace - Replace ')\(==\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(==\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -284,7 +284,7 @@ target_write_u32(target, MC_FCR[bank->bank_number], fcr); LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen); - if ((at91sam7_info->cidr_arch == 0x60) && ((cmd==SLB)|(cmd==CLB))) + if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB)|(cmd == CLB))) { /* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */ if (at91sam7_wait_status_busy(bank, MC_FSR_EOL, 10)&0x0C) Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/flash/flash.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -654,7 +654,7 @@ /* flash auto-erase is disabled by default*/ int auto_erase = 0; - if (strcmp(args[0], "erase")==0) + if (strcmp(args[0], "erase") == 0) { auto_erase = 1; args++; @@ -894,7 +894,7 @@ fileio_close(&fileio); return retvaltemp; } - if (retval==ERROR_OK) + if (retval == ERROR_OK) { command_print(cmd_ctx, "wrote %lld byte from file %s to flash bank %li at offset 0x%8.8" PRIx32 " in %s (%f kb/s)", Modified: trunk/src/flash/ocl/at91sam7x/dcc.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/dcc.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/flash/ocl/at91sam7x/dcc.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -27,7 +27,7 @@ do { asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) : ); - } while ((dcc_reg&1)==0); + } while ((dcc_reg&1) == 0); asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) : ); return dcc_reg; Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -86,7 +86,7 @@ else efc_ofs=0; /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); + while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); /* calculate page address, only lower 8 bits are used to address the latch, but the upper part of address is needed for writing to proper EFC */ @@ -103,7 +103,7 @@ outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); + while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); /* check for errors */ if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; @@ -134,12 +134,12 @@ if (lockbits&1) { /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); + while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); + while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); /* check for errors */ if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; @@ -151,13 +151,13 @@ } /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); + while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); /* erase all command to FCR */ outr(MC_FCR+efc_ofs, 0x5a000008); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); + while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); /* check for errors */ if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; Modified: trunk/src/flash/ocl.c =================================================================== --- trunk/src/flash/ocl.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/flash/ocl.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -172,7 +172,7 @@ int i; /* check preconditions */ - if (ocl->buflen == 0 || ocl->bufalign==0) + if (ocl->buflen == 0 || ocl->bufalign == 0) return ERROR_FLASH_BANK_NOT_PROBED; if (bank->target->state != TARGET_RUNNING) @@ -373,7 +373,7 @@ { ocl_priv_t *ocl = bank->driver_priv; - if (ocl->buflen == 0 || ocl->bufalign==0) + if (ocl->buflen == 0 || ocl->bufalign == 0) return ERROR_FLASH_BANK_NOT_PROBED; return ERROR_OK; Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/flash/str9x.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -309,7 +309,7 @@ break; alive_sleep(1); } - if (timeout==1000) + if (timeout == 1000) { LOG_ERROR("erase timed out"); return ERROR_FAIL; @@ -582,7 +582,7 @@ break; alive_sleep(1); } - if (timeout==1000) + if (timeout == 1000) { LOG_ERROR("write timed out"); return ERROR_FAIL; @@ -631,7 +631,7 @@ break; alive_sleep(1); } - if (timeout==1000) + if (timeout == 1000) { LOG_ERROR("write timed out"); return ERROR_FAIL; Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:42:03 UTC (rev 2371) @@ -32,7 +32,7 @@ /* inlining this will help show what fn that is taking time during profiling. */ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, uint32_t value) { - if ((num==32) && (first==0)) + if ((num == 32) && (first == 0)) { buffer[3]=(value >> 24)&0xff; buffer[2]=(value >> 16)&0xff; @@ -53,7 +53,7 @@ } static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num) { - if ((num==32) && (first==0)) + if ((num == 32) && (first == 0)) { return (((uint32_t)buffer[3]) << 24)|(((uint32_t)buffer[2]) << 16)|(((uint32_t)buffer[1]) << 8)|(((uint32_t)buffer[0]) << 0); } else Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/helper/command.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -94,9 +94,9 @@ * to the fn and fish it out manually. */ c = interp->cmdPrivData; - if (c==NULL) + if (c == NULL) { - LOG_ERROR("BUG: interp->cmdPrivData==NULL"); + LOG_ERROR("BUG: interp->cmdPrivData == NULL"); return JIM_ERR; } target_call_timer_callbacks_now(); @@ -157,7 +157,7 @@ *return_retval = retval; } - return (retval==ERROR_OK)?JIM_OK:JIM_ERR; + return (retval == ERROR_OK)?JIM_OK:JIM_ERR; } /* nice short description of source file */ @@ -212,7 +212,7 @@ } /* just a placeholder, no handler */ - if (c->handler==NULL) + if (c->handler == NULL) return c; /* If this is a two level command, e.g. "flash banks", then the @@ -478,7 +478,7 @@ /* We do not print the connection closed error message */ Jim_PrintErrorMessage(interp); } - if (retval==ERROR_OK) + if (retval == ERROR_OK) { /* It wasn't a low level OpenOCD command that failed */ return ERROR_FAIL; @@ -745,7 +745,7 @@ #if !BUILD_ECOSBOARD Jim_EventLoopOnLoad(interp); #endif - if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1)==JIM_ERR) + if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1) == JIM_ERR) { LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD compile time)"); Jim_PrintErrorMessage(interp); @@ -812,7 +812,7 @@ if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; - fast_and_dangerous = strcmp("enable", args[0])==0; + fast_and_dangerous = strcmp("enable", args[0]) == 0; return ERROR_OK; } @@ -856,7 +856,7 @@ { Jim_Obj *objPtr=Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG); long t; - if (Jim_GetLong(interp, objPtr, &t)==JIM_OK) + if (Jim_GetLong(interp, objPtr, &t) == JIM_OK) { return t; } Modified: trunk/src/helper/configuration.c =================================================================== --- trunk/src/helper/configuration.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/helper/configuration.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -94,7 +94,7 @@ } else { char *full_path=find_file(file); - if (full_path==NULL) + if (full_path == NULL) return NULL; FILE *fp = NULL; fp = fopen(full_path, mode); Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/helper/ioutil.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -84,7 +84,7 @@ FILE * pFile; pFile = fopen(fileName,"rb"); - if (pFile==NULL) + if (pFile == NULL) { LOG_ERROR("Can't open %s\n", fileName); return ERROR_FAIL; @@ -111,7 +111,7 @@ return ERROR_FAIL; } *data = malloc(*len + 1); - if (*data==NULL) + if (*data == NULL) { LOG_ERROR("Can't open %s\n", fileName); fclose(pFile); @@ -233,7 +233,7 @@ break; } } - if ((i==argc) && (fwrite("\n", 1, 1, config_file)==1)) + if ((i == argc) && (fwrite("\n", 1, 1, config_file) == 1)) { retval=ERROR_OK; } @@ -274,7 +274,7 @@ chunk = maxChunk; } - if ((retval==ERROR_OK) && (fwrite(((char *)data)+pos, 1, chunk, f) != chunk)) + if ((retval == ERROR_OK) && (fwrite(((char *)data)+pos, 1, chunk, f) != chunk)) retval = ERROR_INVALID_ARGUMENTS; if (retval != ERROR_OK) @@ -363,7 +363,7 @@ DIR *dirp; dirp = opendir(destdir); - if (dirp==NULL) + if (dirp == NULL) { mkdir(destdir, 0777); } else @@ -477,7 +477,7 @@ if (entry == NULL) break; - if ((strcmp(".", entry->d_name)==0)||(strcmp("..", entry->d_name)==0)) + if ((strcmp(".", entry->d_name) == 0)||(strcmp("..", entry->d_name) == 0)) continue; Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name))); Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/helper/jim.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -198,7 +198,7 @@ * 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 + * 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. @@ -503,7 +503,7 @@ static jim_wide JimPowWide(jim_wide b, jim_wide e) { jim_wide i, res = 1; - if ((b==0 && e != 0) || (e<0)) return 0; + if ((b == 0 && e != 0) || (e<0)) return 0; for (i=0; i<e; i++) {res *= b;} return res; } @@ -568,7 +568,7 @@ void *Jim_Alloc(int size) { /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ - if (size==0) + if (size == 0) size=1; void *p = malloc(size); if (p == NULL) @@ -583,7 +583,7 @@ void *Jim_Realloc(void *ptr, int size) { /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ - if (size==0) + if (size == 0) size=1; void *p = realloc(ptr, size); if (p == NULL) @@ -6959,7 +6959,7 @@ case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_LSHIFT: wC = wA << wB; break; case JIM_EXPROP_RSHIFT: wC = wA >> wB; break; - case JIM_EXPROP_NUMEQ: wC = wA==wB; break; + case JIM_EXPROP_NUMEQ: wC = wA == wB; break; case JIM_EXPROP_NUMNE: wC = wA != wB; break; case JIM_EXPROP_BITAND: wC = wA&wB; break; case JIM_EXPROP_BITXOR: wC = wA^wB; break; @@ -7062,7 +7062,7 @@ case JIM_EXPROP_GT: dC = dA>dB; break; case JIM_EXPROP_LTE: dC = dA <= dB; break; case JIM_EXPROP_GTE: dC = dA >= dB; break; - case JIM_EXPROP_NUMEQ: dC = dA==dB; break; + case JIM_EXPROP_NUMEQ: dC = dA == dB; break; case JIM_EXPROP_NUMNE: dC = dA != dB; break; case JIM_EXPROP_LOGICAND_LEFT: if (dA == 0) { Modified: trunk/src/helper/jim.h =================================================================== --- trunk/src/helper/jim.h 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/helper/jim.h 2009-06-23 22:42:03 UTC (rev 2371) @@ -578,7 +578,7 @@ * An NVP Table is terminated with ".name=NULL". * * During the 'name2value' operation, if no matching string is found - * the pointer to the terminal element (with p->name==NULL) is returned. + * the pointer to the terminal element (with p->name == NULL) is returned. * * Example: * \code Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/bitbang.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -189,7 +189,7 @@ for (bit_cnt = 0; bit_cnt < scan_size; bit_cnt++) { int val=0; - int tms=(bit_cnt==scan_size-1) ? 1 : 0; + int tms=(bit_cnt == scan_size-1) ? 1 : 0; int tdi; int bytec=bit_cnt/8; int bcval=1 << (bit_cnt % 8); Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/bitq.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -51,7 +51,7 @@ while (bitq_in_state.cmd) { /* only JTAG_SCAN command may return data */ - if (bitq_in_state.cmd->type==JTAG_SCAN) + if (bitq_in_state.cmd->type == JTAG_SCAN) { /* loop through the fields */ while (bitq_in_state.field_idx<bitq_in_state.cmd->cmd.scan->num_fields) @@ -59,7 +59,7 @@ field = &bitq_in_state.cmd->cmd.scan->fields[bitq_in_state.field_idx]; if (field->in_value) { - if (bitq_in_state.bit_pos==0) + if (bitq_in_state.bit_pos == 0) { /* initialize field scanning */ in_mask = 0x01; @@ -83,7 +83,7 @@ bitq_in_bufsize *= 2; } /* if necessary, allocate buffer and check for malloc error */ - if (bitq_in_buffer==NULL && ( bitq_in_buffer = malloc(bitq_in_bufsize) )==NULL) + if (bitq_in_buffer == NULL && ( bitq_in_buffer = malloc(bitq_in_bufsize) ) == NULL) { LOG_ERROR("malloc error"); exit(-1); @@ -102,11 +102,11 @@ #endif return; } - if (in_mask==0x01) + if (in_mask == 0x01) in_buff[in_idx] = 0; if (tdo) in_buff[in_idx] |= in_mask; - if (in_mask==0x80) + if (in_mask == 0x80) { in_mask = 0x01; in_idx++; @@ -226,7 +226,7 @@ else tdo_req = 0; - if (field->out_value==NULL) + if (field->out_value == NULL) { /* just send zeros and request data from TDO */ for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--) @@ -242,7 +242,7 @@ for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--) { bitq_io(0, ( (*out_ptr) & out_mask ) != 0, tdo_req); - if (out_mask==0x80) + if (out_mask == 0x80) { out_mask = 0x01; out_ptr++; @@ -257,9 +257,9 @@ if (pause) { bitq_io(0, 0, 0); - if (tap_get_state()==TAP_IRSHIFT) + if (tap_get_state() == TAP_IRSHIFT) tap_set_state(TAP_IRPAUSE); - else if (tap_get_state()==TAP_DRSHIFT) + else if (tap_get_state() == TAP_DRSHIFT) tap_set_state(TAP_DRPAUSE); } } Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/core.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -508,9 +508,9 @@ tap_state_name(goal_state) ); - if (goal_state==cur_state ) + if (goal_state == cur_state ) ; /* nothing to do */ - else if ( goal_state==TAP_RESET ) + else if ( goal_state == TAP_RESET ) { jtag_add_tlr(); } @@ -576,7 +576,7 @@ */ if ((jtag_reset_config & RESET_HAS_SRST)&& (jtag_reset_config & RESET_HAS_TRST)&& - ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)) + ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0)) { if (((req_tlr_or_trst&&!jtag_trst)|| (!req_tlr_or_trst && jtag_trst))&& @@ -746,7 +746,7 @@ { assert(field->in_value != NULL); - if (value==NULL) + if (value == NULL) { /* no checking to do */ return; @@ -1216,7 +1216,7 @@ if (jtag_reset_config & RESET_HAS_SRST) { jtag_add_reset(1, 1); - if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0) + if ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0) jtag_add_reset(0, 1); } jtag_add_reset(0, 0); @@ -1238,7 +1238,7 @@ int retval; if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK) return retval; - if (jtag_init_inner(cmd_ctx)==ERROR_OK) + if (jtag_init_inner(cmd_ctx) == ERROR_OK) { return ERROR_OK; } Modified: trunk/src/jtag/driver.c =================================================================== --- trunk/src/jtag/driver.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/driver.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -476,7 +476,7 @@ entry->data2=data2; entry->data3=data3; - if (jtag_callback_queue_head==NULL) + if (jtag_callback_queue_head == NULL) { jtag_callback_queue_head=entry; jtag_callback_queue_tail=entry; Modified: trunk/src/jtag/dummy.c =================================================================== --- trunk/src/jtag/dummy.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/dummy.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -131,7 +131,7 @@ static int dummy_khz(int khz, int *jtag_speed) { - if (khz==0) + if (khz == 0) { *jtag_speed=0; } @@ -144,7 +144,7 @@ static int dummy_speed_div(int speed, int *khz) { - if (speed==0) + if (speed == 0) { *khz = 0; } Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/ft2232.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -50,7 +50,7 @@ #include <assert.h> -#if (BUILD_FT2232_FTD2XX==1 && BUILD_FT2232_LIBFTDI==1) +#if (BUILD_FT2232_FTD2XX == 1 && BUILD_FT2232_LIBFTDI == 1) #error "BUILD_FT2232_FTD2XX && BUILD_FT2232_LIBFTDI are mutually exclusive" #elif (BUILD_FT2232_FTD2XX != 1 && BUILD_FT2232_LIBFTDI != 1) #error "BUILD_FT2232_FTD2XX || BUILD_FT2232_LIBFTDI must be chosen" @@ -274,7 +274,7 @@ */ ++tms_ndx; - if (tms_ndx==7 || i==tms_count-1) + if (tms_ndx == 7 || i == tms_count-1) { buffer_write(mpsse_cmd); buffer_write(tms_ndx - 1); @@ -498,7 +498,7 @@ static int ft2232_khz(int khz, int* jtag_speed) { - if (khz==0) + if (khz == 0) { #ifdef BUILD_FTD2XX_HIGHSPEED *jtag_speed = 0; @@ -2049,7 +2049,7 @@ const ft2232_layout_t* cur_layout = ft2232_layouts; int i; - if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE)==7) + if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE) == 7) { LOG_DEBUG("ft2232 interface using 7 step jtag state transitions"); } Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/jlink.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -770,7 +770,7 @@ /* JLink returns an extra NULL in packet when size of in message is a multiple of 64, creates problems with usb comms */ /* WARNING This will interfere with tap state counting */ - while ((TAP_SCAN_BYTES(tap_length)%64)==0) + while ((TAP_SCAN_BYTES(tap_length)%64) == 0) { jlink_tap_append_step((tap_get_state() == TAP_RESET)?1:0, 0); } @@ -932,7 +932,7 @@ if (1 != result2) { LOG_ERROR("jlink_usb_read_emu_result retried requested=1, result=%d, in_length=%i", result2,in_length); - /* Try again once, should only happen if (in_length%64==0) */ + /* Try again once, should only happen if (in_length%64 == 0) */ result2 = jlink_usb_read_emu_result(jlink_jtag); if (1 != result2) { Modified: trunk/src/jtag/presto.c =================================================================== --- trunk/src/jtag/presto.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/presto.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -534,7 +534,7 @@ if (presto->buff_out_pos >= BUFFER_SIZE) #elif BUILD_PRESTO_LIBFTDI == 1 /* libftdi does not do background read, be sure that USB IN buffer does not overflow (128 bytes only!) */ - if (presto->buff_out_pos >= BUFFER_SIZE || presto->buff_in_exp==128) + if (presto->buff_out_pos >= BUFFER_SIZE || presto->buff_in_exp == 128) #endif return presto_flush(); Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/tcl.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -1208,7 +1208,7 @@ for (i = 0; i < num_fields; i++) { tap = jtag_tap_by_string( args[i*2] ); - if (tap==NULL) + if (tap == NULL) { command_print( cmd_ctx, "Tap: %s unknown", args[i*2] ); return ERROR_FAIL; Modified: trunk/src/jtag/usbprog.c =================================================================== --- trunk/src/jtag/usbprog.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/usbprog.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -591,7 +591,7 @@ { send_bits = size; loops = size/8; - /* if (loops==0) */ + /* if (loops == 0) */ loops++; size = 0; } Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:42:03 UTC (rev 2371) @@ -41,7 +41,7 @@ do { ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, empty); - } while ((empty & 0x100)==0); + } while ((empty & 0x100) == 0); } static __inline__ void waitQueue(void) @@ -64,7 +64,7 @@ cyg_uint32 a; a=state; int repeat=0; - if (state==TAP_RESET) + if (state == TAP_RESET) { // The FPGA nor we know the current state of the CPU TAP // controller. This will move it to TAP for sure. @@ -92,7 +92,7 @@ ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value); #if 1 #if TEST_MANUAL() - if ((state==TAP_DRSHIFT) && (endState != TAP_DRSHIFT)) + if ((state == TAP_DRSHIFT) && (endState != TAP_DRSHIFT)) { int i; setCurrentState(state); @@ -100,7 +100,7 @@ { int tms; tms=0; - if ((i==repeat-1) && (state != endState)) + if ((i == repeat-1) && (state != endState)) { tms=1; } @@ -124,7 +124,7 @@ #endif #else /* maximum debug version */ - if ((repeat>0) && ((state==TAP_DRSHIFT)||(state==TAP_SI))) + if ((repeat>0) && ((state == TAP_DRSHIFT)||(state == TAP_SI))) { int i; /* sample shift register for every bit. */ @@ -160,7 +160,7 @@ for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) { nextTap=jtag_tap_next_enabled(tap); - if (nextTap==NULL) + if (nextTap == NULL) { pause_state = end_state; } @@ -187,14 +187,14 @@ enum tap_state end_state) { - int singletap=(jtag_tap_next_enabled(jtag_tap_next_enabled(NULL))==NULL); - if ((singletap) && (num_fields==3)) + int singletap=(jtag_tap_next_enabled(jtag_tap_next_enabled(NULL)) == NULL); + if ((singletap) && (num_fields == 3)) { /* used by embeddedice_write_reg_inner() */ shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[1], value[1]); shiftValueInner(TAP_DRSHIFT, end_state, num_bits[2], value[2]); - } else if ((singletap) && (num_fields==2)) + } else if ((singletap) && (num_fields == 2)) { /* used by arm7 code */ shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -49,7 +49,7 @@ static int zy1000_khz(int khz, int *jtag_speed) { - if (khz==0) + if (khz == 0) { *jtag_speed=0; } @@ -62,7 +62,7 @@ static int zy1000_speed_div(int speed, int *khz) { - if (speed==0) + if (speed == 0) { *khz = 0; } @@ -176,7 +176,7 @@ alive_sleep(1); } - if (i==1000) + if (i == 1000) { LOG_USER("SRST didn't deassert after %dms", i); } else if (i>1) @@ -439,7 +439,7 @@ tap_state_t pause_state; int l; k=num_bits-j; - pause_state=(shiftState==TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT; + pause_state=(shiftState == TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT; if (k>32) { k=32; @@ -498,7 +498,7 @@ { nextTap=jtag_tap_next_enabled(tap); tap_state_t end_state; - if (nextTap==NULL) + if (nextTap == NULL) { end_state = state; } else @@ -568,7 +568,7 @@ nextTap=jtag_tap_next_enabled(tap); int found=0; tap_state_t end_state; - if (nextTap==NULL) + if (nextTap == NULL) { end_state = state; } else @@ -732,7 +732,7 @@ { // static int const reg_addr=0x5; tap_state_t end_state=jtag_get_end_state(); - if (jtag_tap_next_enabled(jtag_tap_next_enabled(NULL))==NULL) + if (jtag_tap_next_enabled(jtag_tap_next_enabled(NULL)) == NULL) { /* better performance via code duplication */ if (little) Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/server/gdb_server.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -105,7 +105,7 @@ fd_set read_fds; gdb_connection_t *gdb_con = connection->priv; int t; - if (got_data==NULL) + if (got_data == NULL) got_data=&t; *got_data=0; @@ -1397,7 +1397,7 @@ else if (type == 4) /* access watchpoint */ wp_type = WPT_ACCESS; - if (gdb_breakpoint_override && ((bp_type==BKPT_SOFT)||(bp_type==BKPT_HARD))) + if (gdb_breakpoint_override && ((bp_type == BKPT_SOFT)||(bp_type == BKPT_HARD))) { bp_type=gdb_breakpoint_override_type; } @@ -1560,7 +1560,7 @@ b1=*((flash_bank_t **)a); b2=*((flash_bank_t **)b); - if (b1->base==b2->base) + if (b1->base == b2->base) { return 0; } else if (b1->base>b2->base) @@ -2349,13 +2349,13 @@ if (argc == 0) { - } else if (argc==1) + } else if (argc == 1) { gdb_breakpoint_override = 1; - if (strcmp(args[0], "hard")==0) + if (strcmp(args[0], "hard") == 0) { gdb_breakpoint_override_type=BKPT_HARD; - } else if (strcmp(args[0], "soft")==0) + } else if (strcmp(args[0], "soft") == 0) { gdb_breakpoint_override_type=BKPT_SOFT; } else if (strcmp(args[0], "disable") == 0) @@ -2368,7 +2368,7 @@ } if (gdb_breakpoint_override) { - LOG_USER("force %s breakpoints", (gdb_breakpoint_override_type==BKPT_HARD)?"hard":"soft"); + LOG_USER("force %s breakpoints", (gdb_breakpoint_override_type == BKPT_HARD)?"hard":"soft"); } else { LOG_USER("breakpoint type is not overriden"); Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/arm11.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -1540,7 +1540,7 @@ arm11->target = target; - if (target->tap==NULL) + if (target->tap == NULL) return ERROR_FAIL; if (target->tap->ir_length != 5) Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -131,7 +131,7 @@ return ERROR_FAIL; } - if (arm7_9->sw_breakpoints_added==1) + if (arm7_9->sw_breakpoints_added == 1) { embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_VALUE], arm7_9->arm_bkpt); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_MASK], 0x0); @@ -139,7 +139,7 @@ embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE); } - else if (arm7_9->sw_breakpoints_added==2) + else if (arm7_9->sw_breakpoints_added == 2) { embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_VALUE], arm7_9->arm_bkpt); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_MASK], 0x0); @@ -232,12 +232,12 @@ uint32_t mask = (breakpoint->length == 4) ? 0x3u : 0x1u; /* reassign a hw breakpoint */ - if (breakpoint->set==0) + if (breakpoint->set == 0) { arm7_9_assign_wp(arm7_9, breakpoint); } - if (breakpoint->set==1) + if (breakpoint->set == 1) { embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_VALUE], breakpoint->address); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_MASK], mask); @@ -245,7 +245,7 @@ embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE); } - else if (breakpoint->set==2) + else if (breakpoint->set == 2) { embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], breakpoint->address); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_MASK], mask); @@ -377,7 +377,7 @@ { return retval; } - if (current_instr==arm7_9->arm_bkpt) + if (current_instr == arm7_9->arm_bkpt) if ((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; @@ -391,7 +391,7 @@ { return retval; } - if (current_instr==arm7_9->thumb_bkpt) + if (current_instr == arm7_9->thumb_bkpt) if ((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; @@ -423,7 +423,7 @@ return ERROR_TARGET_NOT_HALTED; } - if (arm7_9->breakpoint_count==0) + if (arm7_9->breakpoint_count == 0) { /* make sure we don't have any dangling breakpoints. This is vital upon * GDB connect/disconnect @@ -478,7 +478,7 @@ arm7_9->wp_available++; arm7_9->breakpoint_count--; - if (arm7_9->breakpoint_count==0) + if (arm7_9->breakpoint_count == 0) { /* make sure we don't have any dangling breakpoints */ if ((retval = arm7_9_clear_watchpoints(arm7_9)) != ERROR_OK) @@ -906,7 +906,7 @@ if (target->reset_halt) { enum reset_types jtag_reset_config = jtag_get_reset_config(); - if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0) + if ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0) { check_pc = 1; } @@ -1022,7 +1022,7 @@ armv4_5_invalidate_core_regs(target); - if ((target->reset_halt) && ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)) + if ((target->reset_halt) && ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0)) { /* debug entry was already prepared in arm7_9_assert_reset() */ target->debug_reason = DBG_REASON_DBGRQ; @@ -1246,7 +1246,7 @@ */ int arm7_9_halt(target_t *target) { - if (target->state==TARGET_RESET) + if (target->state == TARGET_RESET) { LOG_ERROR("BUG: arm7/9 does not support halt during reset. This is handled in arm7_9_assert_reset()"); return ERROR_OK; @@ -2272,7 +2272,7 @@ buffer += thisrun_accesses * 4; num_accesses += thisrun_accesses; - if ((j++%1024)==0) + if ((j++%1024) == 0) { keep_alive(); } @@ -2310,7 +2310,7 @@ buffer += thisrun_accesses * 2; num_accesses += thisrun_accesses; - if ((j++%1024)==0) + if ((j++%1024) == 0) { keep_alive(); } @@ -2347,7 +2347,7 @@ buffer += thisrun_accesses * 1; num_accesses += thisrun_accesses; - if ((j++%1024)==0) + if ((j++%1024) == 0) { keep_alive(); } @@ -2579,7 +2579,7 @@ if ((retval=target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK) return retval; - int little=target->endianness==TARGET_LITTLE_ENDIAN; + int little=target->endianness == TARGET_LITTLE_ENDIAN; int count=dcc_count; uint8_t *buffer=dcc_buffer; if (count>2) @@ -2674,7 +2674,7 @@ retval = armv4_5_run_algorithm_inner(target, 0, NULL, 1, reg_params, arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address+6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion); - if (retval==ERROR_OK) + if (retval == ERROR_OK) { uint32_t endaddress=buf_get_u32(reg_params[0].value, 0, 32); if (endaddress != (address+count*4)) Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/arm7tdmi.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -254,7 +254,7 @@ /* clock the target, and read the databus * the *in pointer points to a buffer where elements of 'size' bytes - * are stored in big (be==1) or little (be==0) endianness + * are stored in big (be == 1) or little (be == 0) endianness */ int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be) { @@ -725,7 +725,7 @@ /* get pointers to arch-specific information */ reg_cache_t **cache_p = register_get_last_cache_p(&target->reg_cache); reg_cache_t *t=embeddedice_build_reg_cache(target, arm7_9); - if (t==NULL) + if (t == NULL) return ERROR_FAIL; (*cache_p) = t; Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/arm9tdmi.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -301,7 +301,7 @@ /* clock the target, and read the databus * the *in pointer points to a buffer where elements of 'size' bytes - * are stored in big (be==1) or little (be==0) endianness + * are stored in big (be == 1) or little (be == 0) endianness */ int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be) { @@ -818,7 +818,7 @@ reg_cache_t *t; /* one extra register (vector catch) */ t=embeddedice_build_reg_cache(target, arm7_9); - if (t==NULL) + if (t == NULL) return ERROR_FAIL; (*cache_p) = t; arm7_9->eice_cache = (*cache_p); Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/arm_adi_v5.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -165,7 +165,7 @@ { adi_jtag_dp_scan_u32(swjdp, instr, reg_addr, RnW, outvalue, NULL, NULL); - if ((RnW==DPAP_READ) && (invalue != NULL)) + if ((RnW == DPAP_READ) && (invalue != NULL)) { adi_jtag_dp_scan_u32(swjdp, DAP_IR_DPACC, DP_RDBUFF, DPAP_READ, 0, invalue, &swjdp->ack); } @@ -1108,7 +1108,7 @@ command_print(cmd_ctx, "\t\tComponent cid1 0x%" PRIx32 ", class is %s",c_cid1,class_description[(c_cid1 >> 4)&0xF]); /* Se ARM DDI 0314 C Table 2.2 */ command_print(cmd_ctx, "\t\tCID3 0x%" PRIx32 ", CID2 0x%" PRIx32 ", CID1 0x%" PRIx32 ", CID0, 0x%" PRIx32 "",c_cid3,c_cid2,c_cid1,c_cid0); command_print(cmd_ctx, "\t\tPID3 0x%" PRIx32 ", PID2 0x%" PRIx32 ", PID1 0x%" PRIx32 ", PID0, 0x%" PRIx32 "",c_pid3,c_pid2,c_pid1,c_pid0); - /* For CoreSight components, (c_cid1 >> 4)&0xF==9 , we also read 0xFC8 DevId and 0xFCC DevType */ + /* For CoreSight components, (c_cid1 >> 4)&0xF == 9 , we also read 0xFC8 DevId and 0xFCC DevType */ } else { Modified: trunk/src/target/arm_disassembler.c =================================================================== --- trunk/src/target/arm_disassembler.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/arm_disassembler.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -1158,7 +1158,7 @@ } else if ((op == 0xd) || (op == 0xf)) /* <opcode1>{<cond>}{S} <Rd>, <shifter_operand> */ { - if (opcode==0xe1a00000) /* print MOV r0,r0 as NOP */ + if (opcode == 0xe1a00000) /* print MOV r0,r0 as NOP */ snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tNOP",address, opcode); else snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, %s", @@ -1327,7 +1327,7 @@ char *mnemonic = NULL; /* sign extend 11-bit offset */ - if (((opc==0) || (opc==2)) && (offset & 0x00000400)) + if (((opc == 0) || (opc == 2)) && (offset & 0x00000400)) offset = 0xfffff800 | offset; target_address = address + 4 + (offset << 1); @@ -1435,7 +1435,7 @@ break; } - if ((imm==0) && (opc != 0)) + if ((imm == 0) && (opc != 0)) imm = 32; instruction->info.data_proc.Rd = Rd; @@ -1748,7 +1748,7 @@ mnemonic = "STR"; } - if ((opcode&0xF000)==0x8000) + if ((opcode&0xF000) == 0x8000) { suffix = 'H'; shift = 1; Modified: trunk/src/target/arm_jtag.c =================================================================== --- trunk/src/target/arm_jtag.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/arm_jtag.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -35,7 +35,7 @@ { jtag_tap_t *tap; tap = jtag_info->tap; - if (tap==NULL) + if (tap == NULL) return ERROR_FAIL; if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr) @@ -51,7 +51,7 @@ - if (no_verify_capture==NULL) + if (no_verify_capture == NULL) { jtag_add_ir_scan(1, &field, jtag_get_end_state()); } else Modified: trunk/src/target/breakpoints.c =================================================================== --- trunk/src/target/breakpoints.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/breakpoints.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -99,13 +99,13 @@ while (breakpoint) { - if (breakpoint==breakpoint_remove) + if (breakpoint == breakpoint_remove) break; breakpoint_p = &breakpoint->next; breakpoint = breakpoint->next; } - if (breakpoint==NULL) + if (breakpoint == NULL) return; target_remove_breakpoint(target, breakpoint); @@ -227,7 +227,7 @@ watchpoint = watchpoint->next; } - if (watchpoint==NULL) + if (watchpoint == NULL) return; target_remove_watchpoint(target, watchpoint); (*watchpoint_p) = watchpoint->next; Modified: trunk/src/target/etb.c =================================================================== --- trunk/src/target/etb.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/etb.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -49,7 +49,7 @@ jtag_tap_t *tap; tap = etb->tap; - if (tap==NULL) + if (tap == NULL) return ERROR_FAIL; if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr) Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/image.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -34,11 +34,11 @@ /* convert ELF header field to host endianness */ #define field16(elf,field)\ - ((elf->endianness==ELFDATA2LSB)? \ + ((elf->endianness == ELFDATA2LSB)? \ le_to_h_u16((uint8_t*)&field):be_to_h_u16((uint8_t*)&field)) #define field32(elf,field)\ - ((elf->endianness==ELFDATA2LSB)? \ + ((elf->endianness == ELFDATA2LSB)? \ le_to_h_u32((uint8_t*)&field):be_to_h_u32((uint8_t*)&field)) static int autodetect_image_type(image_t *image, char *url) @@ -55,7 +55,7 @@ } retval = fileio_read(&fileio, 9, buffer, &read_bytes); - if (retval==ERROR_OK) + if (retval == ERROR_OK) { if (read_bytes != 9) { @@ -68,7 +68,7 @@ return retval; /* check header against known signatures */ - if (strncmp((char*)buffer,ELFMAG,SELFMAG)==0) + if (strncmp((char*)buffer,ELFMAG,SELFMAG) == 0) { LOG_DEBUG("ELF image detected."); image->type = IMAGE_ELF; @@ -382,7 +382,7 @@ } elf->segment_count = field16(elf,elf->header->e_phnum); - if (elf->segment_count==0) + if (elf->segment_count == 0) { LOG_ERROR("invalid ELF file, no program headers"); return ERROR_IMAGE_FORMAT_ERROR; Modified: trunk/src/target/mips32_pracc.c =================================================================== --- trunk/src/target/mips32_pracc.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/mips32_pracc.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -278,7 +278,7 @@ case 2: return mips32_pracc_read_mem16(ejtag_info, addr, count, (uint16_t*)buf); case 4: - if (count==1) + if (count == 1) return mips32_pracc_read_u32(ejtag_info, addr, (uint32_t*)buf); else return mips32_pracc_read_mem32(ejtag_info, addr, count, (uint32_t*)buf); @@ -562,7 +562,7 @@ case 2: return mips32_pracc_write_mem16(ejtag_info, addr, count,(uint16_t*)buf); case 4: - if (count==1) + if (count == 1) return mips32_pracc_write_u32(ejtag_info, addr, (uint32_t*)buf); else return mips32_pracc_write_mem32(ejtag_info, addr, count, (uint32_t*)buf); Modified: trunk/src/target/mips_ejtag.c =================================================================== --- trunk/src/target/mips_ejtag.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/mips_ejtag.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -32,7 +32,7 @@ jtag_tap_t *tap; tap = ejtag_info->tap; - if (tap==NULL) + if (tap == NULL) return ERROR_FAIL; if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != (uint32_t)new_instr) @@ -115,7 +115,7 @@ jtag_tap_t *tap; tap = ejtag_info->tap; - if (tap==NULL) + if (tap == NULL) return ERROR_FAIL; scan_field_t field; uint8_t t[4], r[4]; Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/target.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -1079,7 +1079,7 @@ int target_arch_state(struct target_s *target) { int retval; - if (target==NULL) + if (target == NULL) { LOG_USER("No target has been configured"); return ERROR_OK; @@ -1851,7 +1851,7 @@ return retval; } - else if (argc==1) + else if (argc == 1) { if (strcmp(args[0], "on") == 0) { @@ -2314,7 +2314,7 @@ return retvaltemp; } - if (retval==ERROR_OK) + if (retval == ERROR_OK) { command_print(cmd_ctx, "downloaded %u byte in %s", (unsigned int)image_size, @@ -2390,7 +2390,7 @@ if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) return retvaltemp; - if (retval==ERROR_OK) + if (retval == ERROR_OK) { command_print(cmd_ctx, "dumped %lld byte in %s", fileio.size, duration_text); @@ -2517,7 +2517,7 @@ retval=ERROR_FAIL; goto done; } - if ((t%16384)==0) + if ((t%16384) == 0) { keep_alive(); } @@ -2544,7 +2544,7 @@ return retvaltemp; } - if (retval==ERROR_OK) + if (retval == ERROR_OK) { command_print(cmd_ctx, "verified %u bytes in %s", (unsigned int)image_size, @@ -2808,7 +2808,7 @@ { uint32_t i; FILE *f=fopen(filename, "w"); - if (f==NULL) + if (f == NULL) return; writeString(f, "gmon"); writeLong(f, 0x00000001); /* Version */ @@ -2843,7 +2843,7 @@ length=maxBuckets; } int *buckets=malloc(sizeof(int)*length); - if (buckets==NULL) + if (buckets == NULL) { fclose(f); return; @@ -2918,7 +2918,7 @@ static const int maxSample=10000; uint32_t *samples=malloc(sizeof(uint32_t)*maxSample); - if (samples==NULL) + if (samples == NULL) return ERROR_OK; int numSamples=0; @@ -4432,7 +4432,7 @@ retval = ERROR_OK; fastload_num=image.num_sections; fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections); - if (fastload==NULL) + if (fastload == NULL) { image_close(&image); return ERROR_FAIL; @@ -4477,7 +4477,7 @@ fastload[i].address=image.sections[i].base_address+offset; fastload[i].data=malloc(length); - if (fastload[i].data==NULL) + if (fastload[i].data == NULL) { free(buffer); break; @@ -4495,7 +4495,7 @@ } duration_stop_measure(&duration, &duration_text); - if (retval==ERROR_OK) + if (retval == ERROR_OK) { command_print(cmd_ctx, "Loaded %u bytes in %s", (unsigned int)image_size, duration_text); command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so."); @@ -4516,7 +4516,7 @@ { if (argc>0) return ERROR_COMMAND_SYNTAX_ERROR; - if (fastload==NULL) + if (fastload == NULL) { LOG_ERROR("No image in memory"); return ERROR_FAIL; @@ -4531,7 +4531,7 @@ command_print(cmd_ctx, "Write to 0x%08x, length 0x%08x", (unsigned int)(fastload[i].address), (unsigned int)(fastload[i].length)); - if (retval==ERROR_OK) + if (retval == ERROR_OK) { retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data); } Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-23 22:41:13 UTC (rev 2370) +++ trunk/src/target/xscale.c 2009-06-23 22:42:03 UTC (rev 2371) @@ -197,7 +197,7 @@ int xscale_jtag_set_instr(jtag_tap_t *tap, uint32_t new_instr) { - if (tap==NULL) + if (tap == NULL) return ERROR_FAIL; if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr) @@ -301,7 +301,7 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words) { - if (num_words==0) + if (num_words == 0) return ERROR_INVALID_ARGUMENTS; int retval=ERROR_OK; @@ -392,7 +392,7 @@ words_scheduled--; } } - if (words_scheduled==0) + if (words_scheduled == 0) { if (attempts++==1000) { |
From: <zw...@ma...> - 2009-06-24 00:41:59
|
Author: zwelch Date: 2009-06-24 00:41:13 +0200 (Wed, 24 Jun 2009) New Revision: 2370 Modified: trunk/src/flash/at91sam7.c trunk/src/flash/cfi.c trunk/src/flash/non_cfi.c trunk/src/flash/ocl.c trunk/src/flash/ocl/at91sam7x/main.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/pic32mx.h trunk/src/flash/s3c24xx_regs_nand.h trunk/src/flash/stellaris.c trunk/src/flash/stellaris.h trunk/src/flash/stm32x.c trunk/src/flash/stm32x.h trunk/src/flash/str7x.c trunk/src/flash/str9x.c trunk/src/helper/binarybuffer.h trunk/src/helper/jim.c trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/bitbang.c trunk/src/jtag/dummy.c trunk/src/jtag/ft2232.c trunk/src/jtag/interface.c trunk/src/jtag/usbprog.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/server/gdb_server.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_adi_v5.h trunk/src/target/arm_disassembler.c trunk/src/target/armv7m.h trunk/src/target/cortex_m3.c trunk/src/target/cortex_m3.h trunk/src/target/mips32.c trunk/src/target/mips32.h trunk/src/target/mips_ejtag.c Log: - Fixes '<<' whitespace - Replace ')\(<<\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(<<\)(' with '\1 \2 ('. - Replace '\(\w\)\(<<\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -280,7 +280,7 @@ at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv; target_t *target = bank->target; - fcr = (0x5A<<24) | ((pagen&0x3FF)<<8) | cmd; + fcr = (0x5A << 24) | ((pagen&0x3FF) << 8) | cmd; target_write_u32(target, MC_FCR[bank->bank_number], fcr); LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen); Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/cfi.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -2266,7 +2266,7 @@ (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->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); Modified: trunk/src/flash/non_cfi.c =================================================================== --- trunk/src/flash/non_cfi.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/non_cfi.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -29,7 +29,7 @@ #define KB 1024 #define MB (1024*1024) -#define ERASE_REGION(num, size) (((size/256)<<16)|(num-1)) +#define ERASE_REGION(num, size) (((size/256) << 16)|(num-1)) /* non-CFI compatible flashes */ non_cfi_t non_cfi_flashes[] = { Modified: trunk/src/flash/ocl/at91sam7x/main.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -88,7 +88,7 @@ dcc_wr(0x100000); /* base */ dcc_wr(flash_page_count*flash_page_size); /* size */ dcc_wr(1); /* num_sectors */ - dcc_wr(4096 | ((unsigned long) flash_page_size<<16)); /* buflen and bufalign */ + dcc_wr(4096 | ((unsigned long) flash_page_size << 16)); /* buflen and bufalign */ break; case OCL_ERASE_ALL: dcc_wr(OCL_CMD_DONE|flash_erase_all()); Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -100,7 +100,7 @@ } /* page number and page write command to FCR */ - outr(MC_FCR+efc_ofs, ((page_num&0x3ff)<<8) | MC_KEY | MC_FCMD_WP); + outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP); /* wait until it's done */ while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); @@ -136,7 +136,7 @@ /* wait until FLASH is ready, just for sure */ while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); - outr(MC_FCR+efc_ofs, ((page_num&0x3ff)<<8) | 0x5a000004); + outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004); /* wait until it's done */ while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); Modified: trunk/src/flash/ocl.c =================================================================== --- trunk/src/flash/ocl.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/ocl.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -208,13 +208,13 @@ *dcc_bufptr &= *(buffer++) | 0xffffff00; break; case 1: - *dcc_bufptr &= ((*(buffer++))<<8) | 0xffff00ff; + *dcc_bufptr &= ((*(buffer++)) << 8) | 0xffff00ff; break; case 2: - *dcc_bufptr &= ((*(buffer++))<<16) | 0xff00ffff; + *dcc_bufptr &= ((*(buffer++)) << 16) | 0xff00ffff; break; case 3: - *dcc_bufptr &= ((*(buffer++))<<24) | 0x00ffffff; + *dcc_bufptr &= ((*(buffer++)) << 24) | 0x00ffffff; chksum ^= *(dcc_bufptr++); *dcc_bufptr = 0xffffffff; byteofs = 0; Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -194,11 +194,11 @@ } target_read_u32(target, PIC32MX_DEVCFG0, &devcfg0); - if ((devcfg0 & (1<<28)) == 0) /* code protect bit */ + if ((devcfg0 & (1 << 28)) == 0) /* code protect bit */ num_pages = 0xffff; /* All pages protected */ else if (bank->base == PIC32MX_KSEG1_BOOT_FLASH) { - if (devcfg0 & (1<<24)) + if (devcfg0 & (1 << 24)) num_pages = 0; /* All pages unprotected */ else num_pages = 0xffff; /* All pages protected */ Modified: trunk/src/flash/pic32mx.h =================================================================== --- trunk/src/flash/pic32mx.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/pic32mx.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -80,11 +80,11 @@ #define PIC32MX_NVMCONCLR 0xBF80F404 #define PIC32MX_NVMCONSET 0xBF80F408 #define PIC32MX_NVMCONINV 0xBF80F40C -#define NVMCON_NVMWR (1<<15) -#define NVMCON_NVMWREN (1<<14) -#define NVMCON_NVMERR (1<<13) -#define NVMCON_LVDERR (1<<12) -#define NVMCON_LVDSTAT (1<<11) +#define NVMCON_NVMWR (1 << 15) +#define NVMCON_NVMWREN (1 << 14) +#define NVMCON_NVMERR (1 << 13) +#define NVMCON_LVDERR (1 << 12) +#define NVMCON_LVDSTAT (1 << 11) #define NVMCON_OP_PFM_ERASE 0x5 #define NVMCON_OP_PAGE_ERASE 0x4 #define NVMCON_OP_ROW_PROG 0x3 Modified: trunk/src/flash/s3c24xx_regs_nand.h =================================================================== --- trunk/src/flash/s3c24xx_regs_nand.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/s3c24xx_regs_nand.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -59,63 +59,63 @@ #define S3C2412_NFMECC1 S3C2410_NFREG(0x38) #define S3C2412_NFSECC S3C2410_NFREG(0x3C) -#define S3C2410_NFCONF_EN (1<<15) -#define S3C2410_NFCONF_512BYTE (1<<14) -#define S3C2410_NFCONF_4STEP (1<<13) -#define S3C2410_NFCONF_INITECC (1<<12) -#define S3C2410_NFCONF_nFCE (1<<11) -#define S3C2410_NFCONF_TACLS(x) ((x)<<8) -#define S3C2410_NFCONF_TWRPH0(x) ((x)<<4) -#define S3C2410_NFCONF_TWRPH1(x) ((x)<<0) +#define S3C2410_NFCONF_EN (1 << 15) +#define S3C2410_NFCONF_512BYTE (1 << 14) +#define S3C2410_NFCONF_4STEP (1 << 13) +#define S3C2410_NFCONF_INITECC (1 << 12) +#define S3C2410_NFCONF_nFCE (1 << 11) +#define S3C2410_NFCONF_TACLS(x) ((x) << 8) +#define S3C2410_NFCONF_TWRPH0(x) ((x) << 4) +#define S3C2410_NFCONF_TWRPH1(x) ((x) << 0) -#define S3C2410_NFSTAT_BUSY (1<<0) +#define S3C2410_NFSTAT_BUSY (1 << 0) -#define S3C2440_NFCONF_BUSWIDTH_8 (0<<0) -#define S3C2440_NFCONF_BUSWIDTH_16 (1<<0) -#define S3C2440_NFCONF_ADVFLASH (1<<3) -#define S3C2440_NFCONF_TACLS(x) ((x)<<12) -#define S3C2440_NFCONF_TWRPH0(x) ((x)<<8) -#define S3C2440_NFCONF_TWRPH1(x) ((x)<<4) +#define S3C2440_NFCONF_BUSWIDTH_8 (0 << 0) +#define S3C2440_NFCONF_BUSWIDTH_16 (1 << 0) +#define S3C2440_NFCONF_ADVFLASH (1 << 3) +#define S3C2440_NFCONF_TACLS(x) ((x) << 12) +#define S3C2440_NFCONF_TWRPH0(x) ((x) << 8) +#define S3C2440_NFCONF_TWRPH1(x) ((x) << 4) -#define S3C2440_NFCONT_LOCKTIGHT (1<<13) -#define S3C2440_NFCONT_SOFTLOCK (1<<12) -#define S3C2440_NFCONT_ILLEGALACC_EN (1<<10) -#define S3C2440_NFCONT_RNBINT_EN (1<<9) -#define S3C2440_NFCONT_RN_FALLING (1<<8) -#define S3C2440_NFCONT_SPARE_ECCLOCK (1<<6) -#define S3C2440_NFCONT_MAIN_ECCLOCK (1<<5) -#define S3C2440_NFCONT_INITECC (1<<4) -#define S3C2440_NFCONT_nFCE (1<<1) -#define S3C2440_NFCONT_ENABLE (1<<0) +#define S3C2440_NFCONT_LOCKTIGHT (1 << 13) +#define S3C2440_NFCONT_SOFTLOCK (1 << 12) +#define S3C2440_NFCONT_ILLEGALACC_EN (1 << 10) +#define S3C2440_NFCONT_RNBINT_EN (1 << 9) +#define S3C2440_NFCONT_RN_FALLING (1 << 8) +#define S3C2440_NFCONT_SPARE_ECCLOCK (1 << 6) +#define S3C2440_NFCONT_MAIN_ECCLOCK (1 << 5) +#define S3C2440_NFCONT_INITECC (1 << 4) +#define S3C2440_NFCONT_nFCE (1 << 1) +#define S3C2440_NFCONT_ENABLE (1 << 0) -#define S3C2440_NFSTAT_READY (1<<0) -#define S3C2440_NFSTAT_nCE (1<<1) -#define S3C2440_NFSTAT_RnB_CHANGE (1<<2) -#define S3C2440_NFSTAT_ILLEGAL_ACCESS (1<<3) +#define S3C2440_NFSTAT_READY (1 << 0) +#define S3C2440_NFSTAT_nCE (1 << 1) +#define S3C2440_NFSTAT_RnB_CHANGE (1 << 2) +#define S3C2440_NFSTAT_ILLEGAL_ACCESS (1 << 3) -#define S3C2412_NFCONF_NANDBOOT (1<<31) -#define S3C2412_NFCONF_ECCCLKCON (1<<30) -#define S3C2412_NFCONF_ECC_MLC (1<<24) -#define S3C2412_NFCONF_TACLS_MASK (7<<12) /* 1 extra bit of Tacls */ +#define S3C2412_NFCONF_NANDBOOT (1 << 31) +#define S3C2412_NFCONF_ECCCLKCON (1 << 30) +#define S3C2412_NFCONF_ECC_MLC (1 << 24) +#define S3C2412_NFCONF_TACLS_MASK (7 << 12) /* 1 extra bit of Tacls */ -#define S3C2412_NFCONT_ECC4_DIRWR (1<<18) -#define S3C2412_NFCONT_LOCKTIGHT (1<<17) -#define S3C2412_NFCONT_SOFTLOCK (1<<16) -#define S3C2412_NFCONT_ECC4_ENCINT (1<<13) -#define S3C2412_NFCONT_ECC4_DECINT (1<<12) -#define S3C2412_NFCONT_MAIN_ECC_LOCK (1<<7) -#define S3C2412_NFCONT_INIT_MAIN_ECC (1<<5) -#define S3C2412_NFCONT_nFCE1 (1<<2) -#define S3C2412_NFCONT_nFCE0 (1<<1) +#define S3C2412_NFCONT_ECC4_DIRWR (1 << 18) +#define S3C2412_NFCONT_LOCKTIGHT (1 << 17) +#define S3C2412_NFCONT_SOFTLOCK (1 << 16) +#define S3C2412_NFCONT_ECC4_ENCINT (1 << 13) +#define S3C2412_NFCONT_ECC4_DECINT (1 << 12) +#define S3C2412_NFCONT_MAIN_ECC_LOCK (1 << 7) +#define S3C2412_NFCONT_INIT_MAIN_ECC (1 << 5) +#define S3C2412_NFCONT_nFCE1 (1 << 2) +#define S3C2412_NFCONT_nFCE0 (1 << 1) -#define S3C2412_NFSTAT_ECC_ENCDONE (1<<7) -#define S3C2412_NFSTAT_ECC_DECDONE (1<<6) -#define S3C2412_NFSTAT_ILLEGAL_ACCESS (1<<5) -#define S3C2412_NFSTAT_RnB_CHANGE (1<<4) -#define S3C2412_NFSTAT_nFCE1 (1<<3) -#define S3C2412_NFSTAT_nFCE0 (1<<2) -#define S3C2412_NFSTAT_Res1 (1<<1) -#define S3C2412_NFSTAT_READY (1<<0) +#define S3C2412_NFSTAT_ECC_ENCDONE (1 << 7) +#define S3C2412_NFSTAT_ECC_DECDONE (1 << 6) +#define S3C2412_NFSTAT_ILLEGAL_ACCESS (1 << 5) +#define S3C2412_NFSTAT_RnB_CHANGE (1 << 4) +#define S3C2412_NFSTAT_nFCE1 (1 << 3) +#define S3C2412_NFSTAT_nFCE0 (1 << 2) +#define S3C2412_NFSTAT_Res1 (1 << 1) +#define S3C2412_NFSTAT_READY (1 << 0) #define S3C2412_NFECCERR_SERRDATA(x) (((x) >> 21) & 0xf) #define S3C2412_NFECCERR_SERRBIT(x) (((x) >> 18) & 0x7) Modified: trunk/src/flash/stellaris.c =================================================================== --- trunk/src/flash/stellaris.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/stellaris.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -665,9 +665,9 @@ for (lockregion = first; lockregion <= last; lockregion++) { if (set) - fmppe &= ~(1<<lockregion); + fmppe &= ~(1 << lockregion); else - fmppe |= (1<<lockregion); + fmppe |= (1 << lockregion); } /* Clear and disable flash programming interrupts */ Modified: trunk/src/flash/stellaris.h =================================================================== --- trunk/src/flash/stellaris.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/stellaris.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -82,11 +82,11 @@ #define PMASK 2 /* Flash Controller Command bits */ -#define FMC_WRKEY (0xA442<<16) -#define FMC_COMT (1<<3) -#define FMC_MERASE (1<<2) -#define FMC_ERASE (1<<1) -#define FMC_WRITE (1<<0) +#define FMC_WRKEY (0xA442 << 16) +#define FMC_COMT (1 << 3) +#define FMC_MERASE (1 << 2) +#define FMC_ERASE (1 << 1) +#define FMC_WRITE (1 << 0) /* STELLARIS constants */ Modified: trunk/src/flash/stm32x.c =================================================================== --- trunk/src/flash/stm32x.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/stm32x.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -1121,29 +1121,29 @@ if (strcmp(args[1], "SWWDG") == 0) { - optionbyte |= (1<<0); + optionbyte |= (1 << 0); } else { - optionbyte &= ~(1<<0); + optionbyte &= ~(1 << 0); } if (strcmp(args[2], "NORSTSTNDBY") == 0) { - optionbyte |= (1<<1); + optionbyte |= (1 << 1); } else { - optionbyte &= ~(1<<1); + optionbyte &= ~(1 << 1); } if (strcmp(args[3], "NORSTSTOP") == 0) { - optionbyte |= (1<<2); + optionbyte |= (1 << 2); } else { - optionbyte &= ~(1<<2); + optionbyte &= ~(1 << 2); } if (stm32x_erase_options(bank) != ERROR_OK) Modified: trunk/src/flash/stm32x.h =================================================================== --- trunk/src/flash/stm32x.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/stm32x.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -64,21 +64,21 @@ /* FLASH_CR register bits */ -#define FLASH_PG (1<<0) -#define FLASH_PER (1<<1) -#define FLASH_MER (1<<2) -#define FLASH_OPTPG (1<<4) -#define FLASH_OPTER (1<<5) -#define FLASH_STRT (1<<6) -#define FLASH_LOCK (1<<7) -#define FLASH_OPTWRE (1<<9) +#define FLASH_PG (1 << 0) +#define FLASH_PER (1 << 1) +#define FLASH_MER (1 << 2) +#define FLASH_OPTPG (1 << 4) +#define FLASH_OPTER (1 << 5) +#define FLASH_STRT (1 << 6) +#define FLASH_LOCK (1 << 7) +#define FLASH_OPTWRE (1 << 9) /* FLASH_SR register bits */ -#define FLASH_BSY (1<<0) -#define FLASH_PGERR (1<<2) -#define FLASH_WRPRTERR (1<<4) -#define FLASH_EOP (1<<5) +#define FLASH_BSY (1 << 0) +#define FLASH_PGERR (1 << 2) +#define FLASH_WRPRTERR (1 << 4) +#define FLASH_EOP (1 << 5) /* STM32_FLASH_OBR bit definitions (reading) */ Modified: trunk/src/flash/str7x.c =================================================================== --- trunk/src/flash/str7x.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/str7x.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -161,7 +161,7 @@ /* set default bits for str71x flash */ str7x_info->busy_bits = (FLASH_LOCK|FLASH_BSYA1|FLASH_BSYA0); - str7x_info->disable_bit = (1<<1); + str7x_info->disable_bit = (1 << 1); if (strcmp(args[6], "STR71x") == 0) { @@ -175,7 +175,7 @@ else if (strcmp(args[6], "STR75x") == 0) { str7x_info->register_base = 0x20100000; - str7x_info->disable_bit = (1<<0); + str7x_info->disable_bit = (1 << 0); } else { @@ -703,7 +703,7 @@ flash_cmd = FLASH_SPR; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), 0x4010DFBC); - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), ~(1<<(15+ProtectionLevel))); + target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), ~(1 << (15+ProtectionLevel))); flash_cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); } Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/flash/str9x.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -132,7 +132,7 @@ offset += bank->sectors[i].size; bank->sectors[num_sectors].is_erased = -1; bank->sectors[num_sectors].is_protected = 1; - str9x_info->sector_bits[num_sectors++] = (1<<i); + str9x_info->sector_bits[num_sectors++] = (1 << i); } for (i = 0; i < b1_sectors; i++) @@ -143,9 +143,9 @@ bank->sectors[num_sectors].is_erased = -1; bank->sectors[num_sectors].is_protected = 1; if (str9x_info->variant) - str9x_info->sector_bits[num_sectors++] = (1<<i); + str9x_info->sector_bits[num_sectors++] = (1 << i); else - str9x_info->sector_bits[num_sectors++] = (1<<(i+8)); + str9x_info->sector_bits[num_sectors++] = (1 << (i+8)); } return ERROR_OK; Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -55,7 +55,7 @@ { if ((num==32) && (first==0)) { - return (((uint32_t)buffer[3])<<24)|(((uint32_t)buffer[2])<<16)|(((uint32_t)buffer[1])<<8)|(((uint32_t)buffer[0])<<0); + return (((uint32_t)buffer[3]) << 24)|(((uint32_t)buffer[2]) << 16)|(((uint32_t)buffer[1]) << 8)|(((uint32_t)buffer[0]) << 0); } else { uint32_t result = 0; Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/helper/jim.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -662,7 +662,7 @@ { unsigned int h = 0; while (len--) - h += (h<<3)+*buf++; + h += (h << 3)+*buf++; return h; } @@ -6957,7 +6957,7 @@ case JIM_EXPROP_GT: wC = wA>wB; break; case JIM_EXPROP_LTE: wC = wA <= wB; break; case JIM_EXPROP_GTE: wC = wA >= wB; break; - case JIM_EXPROP_LSHIFT: wC = wA<<wB; break; + case JIM_EXPROP_LSHIFT: wC = wA << wB; break; case JIM_EXPROP_RSHIFT: wC = wA >> wB; break; case JIM_EXPROP_NUMEQ: wC = wA==wB; break; case JIM_EXPROP_NUMNE: wC = wA != wB; break; @@ -6996,7 +6996,7 @@ wC = _rotl(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA<<wB)|(uA >> (S-wB))); + wC = (unsigned long)((uA << wB)|(uA >> (S-wB))); #endif break; } @@ -7006,7 +7006,7 @@ wC = _rotr(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA >> wB)|(uA<<(S-wB))); + wC = (unsigned long)((uA >> wB)|(uA << (S-wB))); #endif break; } @@ -8038,7 +8038,7 @@ return JIM_ERR; } -#define JIM_MATCHVER_EXACT (1<<JIM_PRIV_FLAG_SHIFT) +#define JIM_MATCHVER_EXACT (1 << JIM_PRIV_FLAG_SHIFT) static int JimPackageMatchVersion(int needed, int actual, int flags) { if (needed == JIM_PKG_ANY_VERSION) return 1; Modified: trunk/src/jtag/arm-jtag-ew.c =================================================================== --- trunk/src/jtag/arm-jtag-ew.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/arm-jtag-ew.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -413,8 +413,8 @@ static void armjtagew_reset(int trst, int srst) { - const uint8_t trst_mask = (1u<<5); - const uint8_t srst_mask = (1u<<6); + const uint8_t trst_mask = (1u << 5); + const uint8_t srst_mask = (1u << 6); uint8_t val = 0; uint8_t outp_en = 0; uint8_t change_mask = 0; Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/bitbang.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -192,7 +192,7 @@ int tms=(bit_cnt==scan_size-1) ? 1 : 0; int tdi; int bytec=bit_cnt/8; - int bcval=1<<(bit_cnt % 8); + int bcval=1 << (bit_cnt % 8); /* if we're just reading the scan, but don't care about the output * default to outputting 'low', this also makes valgrind traces more readable, Modified: trunk/src/jtag/dummy.c =================================================================== --- trunk/src/jtag/dummy.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/dummy.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -77,7 +77,7 @@ static int dummy_read(void) { int data = 1 & dummy_data; - dummy_data = (dummy_data >> 1) | (1<<31); + dummy_data = (dummy_data >> 1) | (1 << 31); return data; } Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/ft2232.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -264,7 +264,7 @@ bool bit = tms_bits & 1; if (bit) - tms_byte |= (1<<tms_ndx); + tms_byte |= (1 << tms_ndx); /* always do state transitions in public view */ tap_set_state(tap_state_transition(tap_get_state(), bit)); @@ -760,7 +760,7 @@ if (tap_state_transition(walker, false) == desired_next_state) ; /* bit within tms_bits at index state_ndx is already zero */ else if (tap_state_transition(walker, true) == desired_next_state) - tms_bits |= (1<<state_ndx); + tms_bits |= (1 << state_ndx); else { LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", Modified: trunk/src/jtag/interface.c =================================================================== --- trunk/src/jtag/interface.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/interface.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -118,14 +118,14 @@ #define HEX__(n) 0x##n##LU #define B8__(x) \ - (((x) & 0x0000000FLU)?(1<<0):0) \ - +(((x) & 0x000000F0LU)?(1<<1):0) \ - +(((x) & 0x00000F00LU)?(1<<2):0) \ - +(((x) & 0x0000F000LU)?(1<<3):0) \ - +(((x) & 0x000F0000LU)?(1<<4):0) \ - +(((x) & 0x00F00000LU)?(1<<5):0) \ - +(((x) & 0x0F000000LU)?(1<<6):0) \ - +(((x) & 0xF0000000LU)?(1<<7):0) + (((x) & 0x0000000FLU)?(1 << 0):0) \ + +(((x) & 0x000000F0LU)?(1 << 1):0) \ + +(((x) & 0x00000F00LU)?(1 << 2):0) \ + +(((x) & 0x0000F000LU)?(1 << 3):0) \ + +(((x) & 0x000F0000LU)?(1 << 4):0) \ + +(((x) & 0x00F00000LU)?(1 << 5):0) \ + +(((x) & 0x0F000000LU)?(1 << 6):0) \ + +(((x) & 0xF0000000LU)?(1 << 7):0) #define B8(bits,count) { ((uint8_t)B8__(HEX__(bits))), (count) } Modified: trunk/src/jtag/usbprog.c =================================================================== --- trunk/src/jtag/usbprog.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/usbprog.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -373,11 +373,11 @@ unsigned char output_value=0x00; if (tms) - output_value |= (1<<TMS_BIT); + output_value |= (1 << TMS_BIT); if (tdi) - output_value |= (1<<TDI_BIT); + output_value |= (1 << TDI_BIT); if (tck) - output_value |= (1<<TCK_BIT); + output_value |= (1 << TCK_BIT); usbprog_jtag_write_slice(usbprog_jtag_handle,output_value); } Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -74,7 +74,7 @@ } waitQueue(); sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|a); + ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|a); } @@ -106,7 +106,7 @@ } /* shift out value */ waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x28, (((value >> i)&1)<<1)|tms); + ZY1000_POKE(ZY1000_JTAG_BASE+0x28, (((value >> i)&1) << 1)|tms); } waitIdle(); ZY1000_POKE(ZY1000_JTAG_BASE+0x28, 0); @@ -116,11 +116,11 @@ setCurrentState(endState); } else { - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|b); } #else /* fast version */ - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|b); #endif #else /* maximum debug version */ @@ -132,15 +132,15 @@ { sampleShiftRegister(); ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value >> i); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<8)|(a<<4)|a); + ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1 << 8)|(a << 4)|a); } sampleShiftRegister(); ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value >> (repeat-1)); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<8)|(a<<4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1 << 8)|(a << 4)|b); } else { sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|b); } sampleShiftRegister(); #endif Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -405,7 +405,7 @@ a=state; b=endState; ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<15)|(repeat<<8)|(a<<4)|b); + ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1 << 15)|(repeat << 8)|(a << 4)|b); VERBOSE(getShiftValueFlip()); } #endif @@ -461,7 +461,7 @@ } } /* mask away unused bits for easier debugging */ - value&=~(((uint32_t)0xffffffff)<<k); + value&=~(((uint32_t)0xffffffff) << k); shiftValueInner(shiftState, pause_state, k, value); @@ -741,7 +741,7 @@ for (i = 0; i < count; i++) { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 1)); - shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1<<5)); + shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1 << 5)); buffer += 4; } } else @@ -750,7 +750,7 @@ for (i = 0; i < count; i++) { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 0)); - shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1<<5)); + shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1 << 5)); buffer += 4; } } Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/server/gdb_server.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -925,7 +925,7 @@ int i; for (i = 0; i < str_len; i += 2) { - uint8_t t = hextoint(tstr[i])<<4; + uint8_t t = hextoint(tstr[i]) << 4; t |= hextoint(tstr[i+1]); int j = gdb_reg_pos(target, i/2, str_len/2); Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/arm_adi_v5.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -300,7 +300,7 @@ int dap_ap_select(swjdp_common_t *swjdp,uint8_t apsel) { uint32_t select; - select = (apsel<<24) & 0xFF000000; + select = (apsel << 24) & 0xFF000000; if (select != swjdp->apsel) { Modified: trunk/src/target/arm_adi_v5.h =================================================================== --- trunk/src/target/arm_adi_v5.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/arm_adi_v5.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -37,15 +37,15 @@ #define DP_SELECT 0x8 #define DP_RDBUFF 0xC -#define CORUNDETECT (1<<0) -#define SSTICKYORUN (1<<1) -#define SSTICKYERR (1<<5) -#define CDBGRSTREQ (1<<26) -#define CDBGRSTACK (1<<27) -#define CDBGPWRUPREQ (1<<28) -#define CDBGPWRUPACK (1<<29) -#define CSYSPWRUPREQ (1<<30) -#define CSYSPWRUPACK (1<<31) +#define CORUNDETECT (1 << 0) +#define SSTICKYORUN (1 << 1) +#define SSTICKYERR (1 << 5) +#define CDBGRSTREQ (1 << 26) +#define CDBGRSTACK (1 << 27) +#define CDBGPWRUPREQ (1 << 28) +#define CDBGPWRUPACK (1 << 29) +#define CSYSPWRUPREQ (1 << 30) +#define CSYSPWRUPACK (1 << 31) #define AP_REG_CSW 0x00 #define AP_REG_TAR 0x04 @@ -61,13 +61,13 @@ #define CSW_16BIT 1 #define CSW_32BIT 2 -#define CSW_ADDRINC_MASK (3<<4) +#define CSW_ADDRINC_MASK (3 << 4) #define CSW_ADDRINC_OFF 0 -#define CSW_ADDRINC_SINGLE (1<<4) -#define CSW_ADDRINC_PACKED (2<<4) -#define CSW_HPROT (1<<25) -#define CSW_MASTER_DEBUG (1<<29) -#define CSW_DBGSWENABLE (1<<31) +#define CSW_ADDRINC_SINGLE (1 << 4) +#define CSW_ADDRINC_PACKED (2 << 4) +#define CSW_HPROT (1 << 25) +#define CSW_MASTER_DEBUG (1 << 29) +#define CSW_DBGSWENABLE (1 << 31) /* transaction mode */ #define TRANS_MODE_NONE 0 Modified: trunk/src/target/arm_disassembler.c =================================================================== --- trunk/src/target/arm_disassembler.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/arm_disassembler.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -1330,7 +1330,7 @@ if (((opc==0) || (opc==2)) && (offset & 0x00000400)) offset = 0xfffff800 | offset; - target_address = address + 4 + (offset<<1); + target_address = address + 4 + (offset << 1); switch (opc) { @@ -1348,7 +1348,7 @@ case 2: instruction->type = ARM_UNKNOWN_INSTUCTION; mnemonic = "prefix"; - target_address = offset<<12; + target_address = offset << 12; break; /* BL suffix */ case 3: @@ -1371,8 +1371,8 @@ uint8_t Rd = (opcode >> 0) & 0x7; uint8_t Rn = (opcode >> 3) & 0x7; uint8_t Rm_imm = (opcode >> 6) & 0x7; - uint32_t opc = opcode & (1<<9); - uint32_t reg_imm = opcode & (1<<10); + uint32_t opc = opcode & (1 << 9); + uint32_t reg_imm = opcode & (1 << 10); char *mnemonic; if (opc) @@ -1731,8 +1731,8 @@ uint32_t offset = (opcode >> 6) & 0x1f; uint8_t Rd = (opcode >> 0) & 0x7; uint8_t Rn = (opcode >> 3) & 0x7; - uint32_t L = opcode & (1<<11); - uint32_t B = opcode & (1<<12); + uint32_t L = opcode & (1 << 11); + uint32_t B = opcode & (1 << 12); char *mnemonic; char suffix = ' '; uint32_t shift = 2; @@ -1759,13 +1759,13 @@ shift = 0; } - snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%4.4x\t%s%c r%i, [r%i, #0x%" PRIx32 "]", address, opcode, mnemonic, suffix, Rd, Rn, offset<<shift); + snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%4.4x\t%s%c r%i, [r%i, #0x%" PRIx32 "]", address, opcode, mnemonic, suffix, Rd, Rn, offset << shift); instruction->info.load_store.Rd = Rd; instruction->info.load_store.Rn = Rn; instruction->info.load_store.index_mode = 0; /*offset*/ instruction->info.load_store.offset_mode = 0; /*immediate*/ - instruction->info.load_store.offset.offset = offset<<shift; + instruction->info.load_store.offset.offset = offset << shift; return ERROR_OK; } @@ -1774,7 +1774,7 @@ { uint32_t offset = opcode & 0xff; uint8_t Rd = (opcode >> 8) & 0x7; - uint32_t L = opcode & (1<<11); + uint32_t L = opcode & (1 << 11); char *mnemonic; if (L) @@ -1804,7 +1804,7 @@ uint32_t imm = opcode & 0xff; uint8_t Rd = (opcode >> 8) & 0x7; uint8_t Rn; - uint32_t SP = opcode & (1<<11); + uint32_t SP = opcode & (1 << 11); char *reg_name; instruction->type = ARM_ADD; @@ -1833,7 +1833,7 @@ int evaluate_adjust_stack_thumb(uint16_t opcode, uint32_t address, arm_instruction_t *instruction) { uint32_t imm = opcode & 0x7f; - uint8_t opc = opcode & (1<<7); + uint8_t opc = opcode & (1 << 7); char *mnemonic; @@ -1872,8 +1872,8 @@ int evaluate_load_store_multiple_thumb(uint16_t opcode, uint32_t address, arm_instruction_t *instruction) { uint32_t reg_list = opcode & 0xff; - uint32_t L = opcode & (1<<11); - uint32_t R = opcode & (1<<8); + uint32_t L = opcode & (1 << 11); + uint32_t R = opcode & (1 << 8); uint8_t Rn = (opcode >> 8) & 7; uint8_t addr_mode = 0 /* IA */; char reg_names[40]; @@ -1904,7 +1904,7 @@ instruction->type = ARM_LDM; mnemonic = "POP"; if (R) - reg_list |= (1<<15) /*PC*/; + reg_list |= (1 << 15) /*PC*/; } else { @@ -1912,14 +1912,14 @@ mnemonic = "PUSH"; addr_mode = 3; /*DB*/ if (R) - reg_list |= (1<<14) /*LR*/; + reg_list |= (1 << 14) /*LR*/; } } reg_names_p = reg_names; for (i = 0; i <= 15; i++) { - if (reg_list & (1<<i)) + if (reg_list & (1 << i)) reg_names_p += snprintf(reg_names_p, (reg_names + 40 - reg_names_p), "r%i, ", i); } if (reg_names_p>reg_names) @@ -1959,7 +1959,7 @@ if (offset & 0x00000080) offset = 0xffffff00 | offset; - target_address = address + 4 + (offset<<1); + target_address = address + 4 + (offset << 1); snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%4.4x\tB%s 0x%8.8" PRIx32 , address, opcode, arm_condition_strings[cond], target_address); Modified: trunk/src/target/armv7m.h =================================================================== --- trunk/src/target/armv7m.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/armv7m.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -138,13 +138,13 @@ * Rd: destination register * SYSm: source special register */ -#define ARMV7M_T_MRS(Rd, SYSm) ((0xF3EF) | ((0x8000 | (Rd<<8) | SYSm) << 16)) +#define ARMV7M_T_MRS(Rd, SYSm) ((0xF3EF) | ((0x8000 | (Rd << 8) | SYSm) << 16)) /* Move from Register from Special Register (Thumb mode) 32 bit Thumb2 instruction * Rd: source register * SYSm: destination special register */ -#define ARMV7M_T_MSR(SYSm, Rn) ((0xF380 | ( Rn<<8 )) | ((0x8800 | SYSm) << 16)) +#define ARMV7M_T_MSR(SYSm, Rn) ((0xF380 | ( Rn << 8 )) | ((0x8800 | SYSm) << 16)) /* Change Processor State. The instruction modifies the PRIMASK and FAULTMASK * special-purpose register values (Thumb mode) 16 bit Thumb2 instruction @@ -153,8 +153,8 @@ */ #define I_FLAG 2 #define F_FLAG 1 -#define ARMV7M_T_CPSID(IF) ((0xB660 | (1<<8) | (IF&0x3)) | ((0xB660 | (1<<8) | (IF&0x3)) << 16)) -#define ARMV7M_T_CPSIE(IF) ((0xB660 | (0<<8) | (IF&0x3)) | ((0xB660 | (0<<8) | (IF&0x3)) << 16)) +#define ARMV7M_T_CPSID(IF) ((0xB660 | (1 << 8) | (IF&0x3)) | ((0xB660 | (1 << 8) | (IF&0x3)) << 16)) +#define ARMV7M_T_CPSIE(IF) ((0xB660 | (0 << 8) | (IF&0x3)) | ((0xB660 | (0 << 8) | (IF&0x3)) << 16)) /* Breakpoint (Thumb mode) v5 onwards * Im: immediate value used by debugger Modified: trunk/src/target/cortex_m3.c =================================================================== --- trunk/src/target/cortex_m3.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/cortex_m3.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -641,7 +641,7 @@ /* Make sure we are in Thumb mode */ buf_set_u32(armv7m->core_cache->reg_list[ARMV7M_xPSR].value, 0, 32, - buf_get_u32(armv7m->core_cache->reg_list[ARMV7M_xPSR].value, 0, 32) | (1<<24)); + buf_get_u32(armv7m->core_cache->reg_list[ARMV7M_xPSR].value, 0, 32) | (1 << 24)); armv7m->core_cache->reg_list[ARMV7M_xPSR].dirty = 1; armv7m->core_cache->reg_list[ARMV7M_xPSR].valid = 1; } @@ -1580,7 +1580,7 @@ armv7m->swjdp_info.ap_tar_value = -1; armv7m->swjdp_info.jtag_info = &cortex_m3->jtag_info; armv7m->swjdp_info.memaccess_tck = 8; - armv7m->swjdp_info.tar_autoincr_block = (1<<12); /* Cortex-M3 has 4096 bytes autoincrement range */ + armv7m->swjdp_info.tar_autoincr_block = (1 << 12); /* Cortex-M3 has 4096 bytes autoincrement range */ /* initialize arch-specific breakpoint handling */ Modified: trunk/src/target/cortex_m3.h =================================================================== --- trunk/src/target/cortex_m3.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/cortex_m3.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -44,7 +44,7 @@ #define DCB_DCRDR 0xE000EDF8 #define DCB_DEMCR 0xE000EDFC -#define DCRSR_WnR (1<<16) +#define DCRSR_WnR (1 << 16) #define DWT_CTRL 0xE0001000 #define DWT_COMP0 0xE0001020 @@ -65,23 +65,23 @@ #define DWT_CTRL 0xE0001000 /* DCB_DHCSR bit and field definitions */ -#define DBGKEY (0xA05F<<16) -#define C_DEBUGEN (1<<0) -#define C_HALT (1<<1) -#define C_STEP (1<<2) -#define C_MASKINTS (1<<3) -#define S_REGRDY (1<<16) -#define S_HALT (1<<17) -#define S_SLEEP (1<<18) -#define S_LOCKUP (1<<19) -#define S_RETIRE_ST (1<<24) -#define S_RESET_ST (1<<25) +#define DBGKEY (0xA05F << 16) +#define C_DEBUGEN (1 << 0) +#define C_HALT (1 << 1) +#define C_STEP (1 << 2) +#define C_MASKINTS (1 << 3) +#define S_REGRDY (1 << 16) +#define S_HALT (1 << 17) +#define S_SLEEP (1 << 18) +#define S_LOCKUP (1 << 19) +#define S_RETIRE_ST (1 << 24) +#define S_RESET_ST (1 << 25) /* DCB_DEMCR bit and field definitions */ -#define TRCENA (1<<24) -#define VC_HARDERR (1<<10) -#define VC_BUSERR (1<<8) -#define VC_CORERESET (1<<0) +#define TRCENA (1 << 24) +#define VC_HARDERR (1 << 10) +#define VC_BUSERR (1 << 8) +#define VC_CORERESET (1 << 0) #define NVIC_ICTR 0xE000E004 #define NVIC_ISE0 0xE000E100 @@ -98,12 +98,12 @@ #define NVIC_BFAR 0xE000ED38 /* NVIC_AIRCR bits */ -#define AIRCR_VECTKEY (0x5FA<<16) -#define AIRCR_SYSRESETREQ (1<<2) -#define AIRCR_VECTCLRACTIVE (1<<1) -#define AIRCR_VECTRESET (1<<0) +#define AIRCR_VECTKEY (0x5FA << 16) +#define AIRCR_SYSRESETREQ (1 << 2) +#define AIRCR_VECTCLRACTIVE (1 << 1) +#define AIRCR_VECTRESET (1 << 0) /* NVIC_SHCSR bits */ -#define SHCSR_BUSFAULTENA (1<<17) +#define SHCSR_BUSFAULTENA (1 << 17) /* NVIC_DFSR bits */ #define DFSR_HALTED 1 #define DFSR_BKPT 2 @@ -112,10 +112,10 @@ #define FPCR_CODE 0 #define FPCR_LITERAL 1 -#define FPCR_REPLACE_REMAP (0<<30) -#define FPCR_REPLACE_BKPT_LOW (1<<30) -#define FPCR_REPLACE_BKPT_HIGH (2<<30) -#define FPCR_REPLACE_BKPT_BOTH (3<<30) +#define FPCR_REPLACE_REMAP (0 << 30) +#define FPCR_REPLACE_BKPT_LOW (1 << 30) +#define FPCR_REPLACE_BKPT_HIGH (2 << 30) +#define FPCR_REPLACE_BKPT_BOTH (3 << 30) typedef struct cortex_m3_fp_comparator_s { Modified: trunk/src/target/mips32.c =================================================================== --- trunk/src/target/mips32.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/mips32.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -433,19 +433,19 @@ if (enable) { - if (!(dcr & (1<<4))) + if (!(dcr & (1 << 4))) { /* enable interrupts */ - dcr |= (1<<4); + dcr |= (1 << 4); update = 1; } } else { - if (dcr & (1<<4)) + if (dcr & (1 << 4)) { /* disable interrupts */ - dcr &= ~(1<<4); + dcr &= ~(1 << 4); update = 1; } } Modified: trunk/src/target/mips32.h =================================================================== --- trunk/src/target/mips32.h 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/mips32.h 2009-06-23 22:41:13 UTC (rev 2370) @@ -94,9 +94,9 @@ #define MIPS32_COP0_MF 0x00 #define MIPS32_COP0_MT 0x04 -#define MIPS32_R_INST(opcode, rs, rt, rd, shamt, funct) (((opcode)<<26) |((rs)<<21)|((rt)<<16)|((rd)<<11)| ((shamt)<<6) | (funct)) -#define MIPS32_I_INST(opcode, rs, rt, immd) (((opcode)<<26) |((rs)<<21)|((rt)<<16)|(immd)) -#define MIPS32_J_INST(opcode, addr) (((opcode)<<26) |(addr)) +#define MIPS32_R_INST(opcode, rs, rt, rd, shamt, funct) (((opcode) << 26) |((rs) << 21)|((rt) << 16)|((rd) << 11)| ((shamt) << 6) | (funct)) +#define MIPS32_I_INST(opcode, rs, rt, immd) (((opcode) << 26) |((rs) << 21)|((rt) << 16)|(immd)) +#define MIPS32_J_INST(opcode, addr) (((opcode) << 26) |(addr)) #define MIPS32_NOP 0 #define MIPS32_ADDI(tar, src, val) MIPS32_I_INST(MIPS32_OP_ADDI, src, tar, val) Modified: trunk/src/target/mips_ejtag.c =================================================================== --- trunk/src/target/mips_ejtag.c 2009-06-23 22:40:42 UTC (rev 2369) +++ trunk/src/target/mips_ejtag.c 2009-06-23 22:41:13 UTC (rev 2370) @@ -285,16 +285,16 @@ break; } LOG_DEBUG("EJTAG: features:%s%s%s%s%s%s%s", - ejtag_info->impcode & (1<<28) ? " R3k": " R4k", - ejtag_info->impcode & (1<<24) ? " DINT": "", - ejtag_info->impcode & (1<<22) ? " ASID_8": "", - ejtag_info->impcode & (1<<21) ? " ASID_6": "", - ejtag_info->impcode & (1<<16) ? " MIPS16": "", - ejtag_info->impcode & (1<<14) ? " noDMA": " DMA", - ejtag_info->impcode & (1<<0) ? " MIPS64": " MIPS32" + ejtag_info->impcode & (1 << 28) ? " R3k": " R4k", + ejtag_info->impcode & (1 << 24) ? " DINT": "", + ejtag_info->impcode & (1 << 22) ? " ASID_8": "", + ejtag_info->impcode & (1 << 21) ? " ASID_6": "", + ejtag_info->impcode & (1 << 16) ? " MIPS16": "", + ejtag_info->impcode & (1 << 14) ? " noDMA": " DMA", + ejtag_info->impcode & (1 << 0) ? " MIPS64": " MIPS32" ); - if ((ejtag_info->impcode & (1<<14)) == 0) + if ((ejtag_info->impcode & (1 << 14)) == 0) LOG_DEBUG("EJTAG: DMA Access Mode Support Enabled"); /* set initial state for ejtag control reg */ |
From: <zw...@ma...> - 2009-06-24 00:41:10
|
Author: zwelch Date: 2009-06-24 00:40:42 +0200 (Wed, 24 Jun 2009) New Revision: 2369 Modified: trunk/src/flash/at91sam7.c trunk/src/flash/flash.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/stellaris.c trunk/src/helper/binarybuffer.h trunk/src/helper/jim.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_disassembler.h trunk/src/target/target.c Log: - Fixes '>>' whitespace - Replace ')\(>>\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(>>\)(' with '\1 \2 ('. - Replace '\(\w\)\(>>\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -366,13 +366,13 @@ at91sam7_info = t_bank->driver_priv; at91sam7_info->cidr = cidr; - at91sam7_info->cidr_ext = (cidr>>31)&0x0001; - at91sam7_info->cidr_nvptyp = (cidr>>28)&0x0007; - at91sam7_info->cidr_arch = (cidr>>20)&0x00FF; - at91sam7_info->cidr_sramsiz = (cidr>>16)&0x000F; - at91sam7_info->cidr_nvpsiz2 = (cidr>>12)&0x000F; - at91sam7_info->cidr_nvpsiz = (cidr>>8)&0x000F; - at91sam7_info->cidr_eproc = (cidr>>5)&0x0007; + at91sam7_info->cidr_ext = (cidr >> 31)&0x0001; + at91sam7_info->cidr_nvptyp = (cidr >> 28)&0x0007; + at91sam7_info->cidr_arch = (cidr >> 20)&0x00FF; + at91sam7_info->cidr_sramsiz = (cidr >> 16)&0x000F; + at91sam7_info->cidr_nvpsiz2 = (cidr >> 12)&0x000F; + at91sam7_info->cidr_nvpsiz = (cidr >> 8)&0x000F; + at91sam7_info->cidr_eproc = (cidr >> 5)&0x0007; at91sam7_info->cidr_version = cidr&0x001F; /* calculate master clock frequency */ @@ -391,10 +391,10 @@ return ERROR_OK; } - arch = (cidr>>20)&0x00FF; + arch = (cidr >> 20)&0x00FF; /* check flash size */ - switch ((cidr>>8)&0x000F) + switch ((cidr >> 8)&0x000F) { case FLASH_SIZE_8KB: break; @@ -586,13 +586,13 @@ at91sam7_info = t_bank->driver_priv; at91sam7_info->cidr = cidr; - at91sam7_info->cidr_ext = (cidr>>31)&0x0001; - at91sam7_info->cidr_nvptyp = (cidr>>28)&0x0007; - at91sam7_info->cidr_arch = (cidr>>20)&0x00FF; - at91sam7_info->cidr_sramsiz = (cidr>>16)&0x000F; - at91sam7_info->cidr_nvpsiz2 = (cidr>>12)&0x000F; - at91sam7_info->cidr_nvpsiz = (cidr>>8)&0x000F; - at91sam7_info->cidr_eproc = (cidr>>5)&0x0007; + at91sam7_info->cidr_ext = (cidr >> 31)&0x0001; + at91sam7_info->cidr_nvptyp = (cidr >> 28)&0x0007; + at91sam7_info->cidr_arch = (cidr >> 20)&0x00FF; + at91sam7_info->cidr_sramsiz = (cidr >> 16)&0x000F; + at91sam7_info->cidr_nvpsiz2 = (cidr >> 12)&0x000F; + at91sam7_info->cidr_nvpsiz = (cidr >> 8)&0x000F; + at91sam7_info->cidr_eproc = (cidr >> 5)&0x0007; at91sam7_info->cidr_version = cidr&0x001F; at91sam7_info->target_name = target_name; @@ -702,12 +702,12 @@ } status = at91sam7_get_flash_status(bank->target, bank->bank_number); - at91sam7_info->lockbits = (status>>16); + at91sam7_info->lockbits = (status >> 16); at91sam7_info->num_lockbits_on = 0; for (lock_pos=0; lock_pos<bank->num_sectors; lock_pos++) { - if ( ((status>>(16+lock_pos))&(0x0001)) == 1) + if ( ((status >> (16+lock_pos))&(0x0001)) == 1) { at91sam7_info->num_lockbits_on++; bank->sectors[lock_pos].is_protected = 1; @@ -719,13 +719,13 @@ /* GPNVM and SECURITY bits apply only for MC_FSR of EFC0 */ status = at91sam7_get_flash_status(bank->target, 0); - at91sam7_info->securitybit = (status>>4)&0x01; - at91sam7_info->nvmbits = (status>>8)&0xFF; + at91sam7_info->securitybit = (status >> 4)&0x01; + at91sam7_info->nvmbits = (status >> 8)&0xFF; at91sam7_info->num_nvmbits_on = 0; for (gpnvm_pos=0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++) { - if ( ((status>>(8+gpnvm_pos))&(0x01)) == 1) + if ( ((status >> (8+gpnvm_pos))&(0x01)) == 1) { at91sam7_info->num_nvmbits_on++; } Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/flash/flash.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -374,7 +374,7 @@ j, p->sectors[j].offset, p->sectors[j].size, - p->sectors[j].size>>10, + p->sectors[j].size >> 10, protect_state); } @@ -465,7 +465,7 @@ j, p->sectors[j].offset, p->sectors[j].size, - p->sectors[j].size>>10, + p->sectors[j].size >> 10, erase_state); } } Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -32,7 +32,7 @@ { unsigned int nvpsiz; - nvpsiz=(inr(DBGU_CIDR)>>8)&0xf; + nvpsiz=(inr(DBGU_CIDR) >> 8)&0xf; switch (nvpsiz) { case 3: @@ -129,7 +129,7 @@ int page_num; page_num=0; - lockbits=inr(MC_FSR+efc_ofs)>>16; + lockbits=inr(MC_FSR+efc_ofs) >> 16; while (lockbits) { if (lockbits&1) { Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -605,11 +605,11 @@ device_id = ejtag_info->idcode; LOG_INFO( "device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)", device_id, - (unsigned)((device_id>>1)&0x7ff), - (unsigned)((device_id>>12)&0xff), - (unsigned)((device_id>>20)&0xfff) ); + (unsigned)((device_id >> 1)&0x7ff), + (unsigned)((device_id >> 12)&0xff), + (unsigned)((device_id >> 20)&0xfff) ); - if (((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) { + if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) { LOG_WARNING( "Cannot identify target as a PIC32MX family." ); return ERROR_FLASH_OPERATION_FAILED; } @@ -697,10 +697,10 @@ device_id = ejtag_info->idcode; - if (((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) { + if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) { snprintf(buf, buf_size, "Cannot identify target as a PIC32MX family (manufacturer 0x%03d != 0x%03d)\n", - (unsigned)((device_id>>1)&0x7ff), + (unsigned)((device_id >> 1)&0x7ff), PIC32MX_MANUF_ID); return ERROR_FLASH_OPERATION_FAILED; } @@ -716,7 +716,7 @@ buf += printed; buf_size -= printed; printed = snprintf(buf, buf_size, " Ver: 0x%03x", - (unsigned)((device_id>>20)&0xfff)); + (unsigned)((device_id >> 20)&0xfff)); return ERROR_OK; } Modified: trunk/src/flash/stellaris.c =================================================================== --- trunk/src/flash/stellaris.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/flash/stellaris.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -33,7 +33,7 @@ #include "binarybuffer.h" -#define DID0_VER(did0) ((did0>>28)&0x07) +#define DID0_VER(did0) ((did0 >> 28)&0x07) static int stellaris_register_commands(struct command_context_s *cmd_ctx); static int stellaris_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); static int stellaris_erase(struct flash_bank_s *bank, int first, int last); @@ -286,7 +286,7 @@ if (DID0_VER(stellaris_info->did0) > 0) { - device_class = (stellaris_info->did0>>16) & 0xFF; + device_class = (stellaris_info->did0 >> 16) & 0xFF; } else { @@ -298,7 +298,7 @@ device_class, StellarisClassname[device_class], stellaris_info->target_name, - (int)('A' + ((stellaris_info->did0>>8) & 0xFF)), + (int)('A' + ((stellaris_info->did0 >> 8) & 0xFF)), (int)((stellaris_info->did0) & 0xFF)); buf += printed; buf_size -= printed; @@ -309,7 +309,7 @@ stellaris_info->did1, stellaris_info->did1, "ARMV7M", - (int)((1+((stellaris_info->dc0>>16) & 0xFFFF))/4), + (int)((1+((stellaris_info->dc0 >> 16) & 0xFFFF))/4), (int)((1+(stellaris_info->dc0 & 0xFFFF))*2)); buf += printed; buf_size -= printed; @@ -366,11 +366,11 @@ LOG_DEBUG("Stellaris PLLCFG %" PRIx32 "", pllcfg); stellaris_info->rcc = rcc; - sysdiv = (rcc>>23) & 0xF; - usesysdiv = (rcc>>22) & 0x1; - bypass = (rcc>>11) & 0x1; - oscsrc = (rcc>>4) & 0x3; - /* xtal = (rcc>>6)&0xF; */ + sysdiv = (rcc >> 23) & 0xF; + usesysdiv = (rcc >> 22) & 0x1; + bypass = (rcc >> 11) & 0x1; + oscsrc = (rcc >> 4) & 0x3; + /* xtal = (rcc >> 6)&0xF; */ switch (oscsrc) { case 0: Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:40:42 UTC (rev 2369) @@ -34,10 +34,10 @@ { if ((num==32) && (first==0)) { - buffer[3]=(value>>24)&0xff; - buffer[2]=(value>>16)&0xff; - buffer[1]=(value>>8)&0xff; - buffer[0]=(value>>0)&0xff; + buffer[3]=(value >> 24)&0xff; + buffer[2]=(value >> 16)&0xff; + buffer[1]=(value >> 8)&0xff; + buffer[0]=(value >> 0)&0xff; } else { unsigned int i; Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/helper/jim.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -6958,7 +6958,7 @@ case JIM_EXPROP_LTE: wC = wA <= wB; break; case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_LSHIFT: wC = wA<<wB; break; - case JIM_EXPROP_RSHIFT: wC = wA>>wB; break; + case JIM_EXPROP_RSHIFT: wC = wA >> wB; break; case JIM_EXPROP_NUMEQ: wC = wA==wB; break; case JIM_EXPROP_NUMNE: wC = wA != wB; break; case JIM_EXPROP_BITAND: wC = wA&wB; break; @@ -6996,7 +6996,7 @@ wC = _rotl(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA<<wB)|(uA>>(S-wB))); + wC = (unsigned long)((uA<<wB)|(uA >> (S-wB))); #endif break; } @@ -7006,7 +7006,7 @@ wC = _rotr(uA,(unsigned long)wB); #else const unsigned int S = sizeof(unsigned long) * 8; - wC = (unsigned long)((uA>>wB)|(uA<<(S-wB))); + wC = (unsigned long)((uA >> wB)|(uA<<(S-wB))); #endif break; } Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:40:42 UTC (rev 2369) @@ -106,7 +106,7 @@ } /* shift out value */ waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x28, (((value>>i)&1)<<1)|tms); + ZY1000_POKE(ZY1000_JTAG_BASE+0x28, (((value >> i)&1)<<1)|tms); } waitIdle(); ZY1000_POKE(ZY1000_JTAG_BASE+0x28, 0); @@ -131,11 +131,11 @@ for (i=0; i<repeat-1; i++) { sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value>>i); + ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value >> i); ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<8)|(a<<4)|a); } sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value>>(repeat-1)); + ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value >> (repeat-1)); ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<8)|(a<<4)|b); } else { Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -474,7 +474,7 @@ for (l=0; l<k; l += 8) { - inBuffer[(j+l)/8]=(value>>l)&0xff; + inBuffer[(j+l)/8]=(value >> l)&0xff; } } j += k; Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/target/arm_adi_v5.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -1103,12 +1103,12 @@ mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFF4, &c_cid1); mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFF8, &c_cid2); mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFFC, &c_cid3); - component_start = component_base - 0x1000*(c_pid4>>4); + component_start = component_base - 0x1000*(c_pid4 >> 4); command_print(cmd_ctx, "\t\tComponent base address 0x%" PRIx32 ", pid4 0x%" PRIx32 ", start address 0x%" PRIx32 "",component_base,c_pid4,component_start); - command_print(cmd_ctx, "\t\tComponent cid1 0x%" PRIx32 ", class is %s",c_cid1,class_description[(c_cid1>>4)&0xF]); /* Se ARM DDI 0314 C Table 2.2 */ + command_print(cmd_ctx, "\t\tComponent cid1 0x%" PRIx32 ", class is %s",c_cid1,class_description[(c_cid1 >> 4)&0xF]); /* Se ARM DDI 0314 C Table 2.2 */ command_print(cmd_ctx, "\t\tCID3 0x%" PRIx32 ", CID2 0x%" PRIx32 ", CID1 0x%" PRIx32 ", CID0, 0x%" PRIx32 "",c_cid3,c_cid2,c_cid1,c_cid0); command_print(cmd_ctx, "\t\tPID3 0x%" PRIx32 ", PID2 0x%" PRIx32 ", PID1 0x%" PRIx32 ", PID0, 0x%" PRIx32 "",c_pid3,c_pid2,c_pid1,c_pid0); - /* For CoreSight components, (c_cid1>>4)&0xF==9 , we also read 0xFC8 DevId and 0xFCC DevType */ + /* For CoreSight components, (c_cid1 >> 4)&0xF==9 , we also read 0xFC8 DevId and 0xFCC DevType */ } else { Modified: trunk/src/target/arm_disassembler.h =================================================================== --- trunk/src/target/arm_disassembler.h 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/target/arm_disassembler.h 2009-06-23 22:40:42 UTC (rev 2369) @@ -198,6 +198,6 @@ extern int thumb_evaluate_opcode(uint16_t opcode, uint32_t address, arm_instruction_t *instruction); extern int arm_access_size(arm_instruction_t *instruction); -#define COND(opcode) (arm_condition_strings[(opcode & 0xf0000000)>>28]) +#define COND(opcode) (arm_condition_strings[(opcode & 0xf0000000) >> 28]) #endif /* ARM_DISASSEMBLER_H */ Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:40:33 UTC (rev 2368) +++ trunk/src/target/target.c 2009-06-23 22:40:42 UTC (rev 2369) @@ -2792,7 +2792,7 @@ int i; for (i=0; i<4; i++) { - char c=(l>>(i*8))&0xff; + char c=(l >> (i*8))&0xff; writeData(f, &c, 1); } @@ -2883,7 +2883,7 @@ val=65535; } data[i*2]=val&0xff; - data[i*2+1]=(val>>8)&0xff; + data[i*2+1]=(val >> 8)&0xff; } free(buckets); writeData(f, data, length * 2); |
From: <zw...@ma...> - 2009-06-24 00:40:39
|
Author: zwelch Date: 2009-06-24 00:40:33 +0200 (Wed, 24 Jun 2009) New Revision: 2368 Modified: trunk/src/flash/at91sam7.c trunk/src/helper/jim.c trunk/src/jtag/bitq.c trunk/src/target/arm7_9_common.c Log: - Fixes '<=' whitespace - Replace '\(\w\)\(<=\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:40:10 UTC (rev 2367) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:40:33 UTC (rev 2368) @@ -916,7 +916,7 @@ } /* mark erased sectors */ - for (sec=first; sec<=last; sec++) + for (sec=first; sec <= last; sec++) { bank->sectors[sec].is_erased = 1; } @@ -952,7 +952,7 @@ at91sam7_read_clock_info(bank); at91sam7_set_flash_mode(bank, FMR_TIMING_NVBITS); - for (sector=first; sector<=last; sector++) + for (sector=first; sector <= last; sector++) { if (set) cmd = SLB; Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:40:10 UTC (rev 2367) +++ trunk/src/helper/jim.c 2009-06-23 22:40:33 UTC (rev 2368) @@ -6955,7 +6955,7 @@ case JIM_EXPROP_MUL: wC = wA*wB; break; case JIM_EXPROP_LT: wC = wA<wB; break; case JIM_EXPROP_GT: wC = wA>wB; break; - case JIM_EXPROP_LTE: wC = wA<=wB; break; + case JIM_EXPROP_LTE: wC = wA <= wB; break; case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_LSHIFT: wC = wA<<wB; break; case JIM_EXPROP_RSHIFT: wC = wA>>wB; break; @@ -7060,7 +7060,7 @@ case JIM_EXPROP_MUL: dC = dA*dB; break; case JIM_EXPROP_LT: dC = dA<dB; break; case JIM_EXPROP_GT: dC = dA>dB; break; - case JIM_EXPROP_LTE: dC = dA<=dB; break; + case JIM_EXPROP_LTE: dC = dA <= dB; break; case JIM_EXPROP_GTE: dC = dA >= dB; break; case JIM_EXPROP_NUMEQ: dC = dA==dB; break; case JIM_EXPROP_NUMNE: dC = dA != dB; break; Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2009-06-23 22:40:10 UTC (rev 2367) +++ trunk/src/jtag/bitq.c 2009-06-23 22:40:33 UTC (rev 2368) @@ -175,7 +175,7 @@ { int i; - for (i = 0; i<=cmd->num_states; i++) + for (i = 0; i <= cmd->num_states; i++) { if (tap_state_transition(tap_get_state(), false) == cmd->path[i]) bitq_io(0, 0, 0); Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:40:10 UTC (rev 2367) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:40:33 UTC (rev 2368) @@ -1428,7 +1428,7 @@ if (armv4_5_mode_to_number(armv4_5->core_mode)==-1) return ERROR_FAIL; - for (i=0; i<=15; i++) + for (i=0; i <= 15; i++) { LOG_DEBUG("r%i: 0x%8.8" PRIx32 "", i, context[i]); buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).value, 0, 32, context[i]); @@ -2362,7 +2362,7 @@ if (armv4_5_mode_to_number(armv4_5->core_mode)==-1) return ERROR_FAIL; - for (i=0; i<=last_reg; i++) + for (i=0; i <= last_reg; i++) ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).dirty = ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).valid; arm7_9->read_xpsr(target, &cpsr, 0); @@ -2545,7 +2545,7 @@ if (armv4_5_mode_to_number(armv4_5->core_mode)==-1) return ERROR_FAIL; - for (i=0; i<=last_reg; i++) + for (i=0; i <= last_reg; i++) ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).dirty = ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).valid; arm7_9->read_xpsr(target, &cpsr, 0); |
From: <zw...@ma...> - 2009-06-24 00:40:30
|
Author: zwelch Date: 2009-06-24 00:40:10 +0200 (Wed, 24 Jun 2009) New Revision: 2367 Modified: trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/helper/jim.c trunk/src/jtag/bitq.c trunk/src/jtag/presto.c trunk/src/target/arm720t.c trunk/src/target/arm7_9_common.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/etm.h trunk/src/target/target.c trunk/src/target/xscale.c Log: - Fixes '>=' whitespace - Replace ')\(>=\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(>=\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -82,7 +82,7 @@ uint32 *data_ptr; /* select proper controller */ - if (page_num>=1024) efc_ofs=0x10; + if (page_num >= 1024) efc_ofs=0x10; else efc_ofs=0; /* wait until FLASH is ready, just for sure */ Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/helper/jim.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -6956,7 +6956,7 @@ case JIM_EXPROP_LT: wC = wA<wB; break; case JIM_EXPROP_GT: wC = wA>wB; break; case JIM_EXPROP_LTE: wC = wA<=wB; break; - case JIM_EXPROP_GTE: wC = wA>=wB; break; + case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_LSHIFT: wC = wA<<wB; break; case JIM_EXPROP_RSHIFT: wC = wA>>wB; break; case JIM_EXPROP_NUMEQ: wC = wA==wB; break; @@ -7061,7 +7061,7 @@ case JIM_EXPROP_LT: dC = dA<dB; break; case JIM_EXPROP_GT: dC = dA>dB; break; case JIM_EXPROP_LTE: dC = dA<=dB; break; - case JIM_EXPROP_GTE: dC = dA>=dB; break; + case JIM_EXPROP_GTE: dC = dA >= dB; break; case JIM_EXPROP_NUMEQ: dC = dA==dB; break; case JIM_EXPROP_NUMNE: dC = dA != dB; break; case JIM_EXPROP_LOGICAND_LEFT: Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/jtag/bitq.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -370,7 +370,7 @@ LOG_ERROR("missing data from bitq interface"); return ERROR_JTAG_QUEUE_FAILED; } - if (bitq_interface->in()>=0) + if (bitq_interface->in() >= 0) { LOG_ERROR("extra data from bitq interface"); return ERROR_JTAG_QUEUE_FAILED; Modified: trunk/src/jtag/presto.c =================================================================== --- trunk/src/jtag/presto.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/jtag/presto.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -652,14 +652,14 @@ static int presto_bitq_in_rdy(void) { - if (presto->buff_in_pos>=presto->buff_in_len) + if (presto->buff_in_pos >= presto->buff_in_len) return 0; return presto->buff_in_len-presto->buff_in_pos; } static int presto_bitq_in(void) { - if (presto->buff_in_pos>=presto->buff_in_len) + if (presto->buff_in_pos >= presto->buff_in_len) return -1; if (presto->buff_in[presto->buff_in_pos++]&0x08) return 1; return 0; Modified: trunk/src/target/arm720t.c =================================================================== --- trunk/src/target/arm720t.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/target/arm720t.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -388,7 +388,7 @@ { break; } - if (debug_level>=3) + if (debug_level >= 3) { alive_sleep(100); } else Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -711,7 +711,7 @@ if ((buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1)) && (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_SYSCOMP, 1))) break; - if (debug_level>=3) + if (debug_level >= 3) { alive_sleep(100); } else @@ -1159,7 +1159,7 @@ embeddedice_read_reg(dbg_stat); if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; - if (debug_level>=3) + if (debug_level >= 3) { alive_sleep(100); } else Modified: trunk/src/target/arm920t.c =================================================================== --- trunk/src/target/arm920t.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/target/arm920t.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -587,7 +587,7 @@ { break; } - if (debug_level>=3) + if (debug_level >= 3) { /* do not eat all CPU, time out after 1 se*/ alive_sleep(100); Modified: trunk/src/target/arm926ejs.c =================================================================== --- trunk/src/target/arm926ejs.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/target/arm926ejs.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -587,7 +587,7 @@ { break; } - if (debug_level>=1) + if (debug_level >= 1) { /* do not eat all CPU, time out after 1 se*/ alive_sleep(100); Modified: trunk/src/target/etm.h =================================================================== --- trunk/src/target/etm.h 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/target/etm.h 2009-06-23 22:40:10 UTC (rev 2367) @@ -184,7 +184,7 @@ BR_ENABLE = 0x1, /* Trace has been enabled */ BR_RESTART = 0x2, /* Trace restarted after a FIFO overflow */ BR_NODEBUG = 0x3, /* ARM has exited for debug state */ - BR_PERIOD = 0x4, /* Peridioc synchronization point (ETM>=v1.2)*/ + BR_PERIOD = 0x4, /* Peridioc synchronization point (ETM >= v1.2)*/ BR_RSVD5 = 0x5, /* reserved */ BR_RSVD6 = 0x6, /* reserved */ BR_RSVD7 = 0x7, /* reserved */ Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/target/target.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -2279,7 +2279,7 @@ /* DANGER!!! beware of unsigned comparision here!!! */ - if ((image.sections[i].base_address+buf_cnt>=min_address)&& + if ((image.sections[i].base_address+buf_cnt >= min_address)&& (image.sections[i].base_address<max_address)) { if (image.sections[i].base_address<min_address) @@ -2955,7 +2955,7 @@ } gettimeofday(&now, NULL); - if ((numSamples>=maxSample) || ((now.tv_sec >= timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec))) + if ((numSamples >= maxSample) || ((now.tv_sec >= timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec))) { command_print(cmd_ctx, "Profiling completed. %d samples.", numSamples); if ((retval = target_poll(target)) != ERROR_OK) @@ -4460,7 +4460,7 @@ /* DANGER!!! beware of unsigned comparision here!!! */ - if ((image.sections[i].base_address+buf_cnt>=min_address)&& + if ((image.sections[i].base_address+buf_cnt >= min_address)&& (image.sections[i].base_address<max_address)) { if (image.sections[i].base_address<min_address) Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-23 22:39:47 UTC (rev 2366) +++ trunk/src/target/xscale.c 2009-06-23 22:40:10 UTC (rev 2367) @@ -499,7 +499,7 @@ { goto done; } - if (debug_level>=3) + if (debug_level >= 3) { LOG_DEBUG("waiting 100ms"); alive_sleep(100); /* avoid flooding the logs */ @@ -580,7 +580,7 @@ } if (!(field0_in & 1)) goto done; - if (debug_level>=3) + if (debug_level >= 3) { LOG_DEBUG("waiting 100ms"); alive_sleep(100); /* avoid flooding the logs */ |
From: <zw...@ma...> - 2009-06-24 00:40:07
|
Author: zwelch Date: 2009-06-24 00:39:47 +0200 (Wed, 24 Jun 2009) New Revision: 2366 Modified: trunk/src/flash/at91sam7.c trunk/src/helper/binarybuffer.h trunk/src/helper/ioutil.c trunk/src/jtag/core.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/server/gdb_server.c trunk/src/target/arm7_9_common.c trunk/src/target/arm_adi_v5.c trunk/src/target/image.c trunk/src/target/target.c Log: - Fixes '&&' whitespace - Replace ')\(&&\)(' with ') \1 ('. - Replace '\(\w\)\(&&\)(' with '\1 \2 ('. - Replace '\(\w\)\(&&\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/flash/at91sam7.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -284,7 +284,7 @@ target_write_u32(target, MC_FCR[bank->bank_number], fcr); LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen); - if ((at91sam7_info->cidr_arch == 0x60)&&((cmd==SLB)|(cmd==CLB))) + if ((at91sam7_info->cidr_arch == 0x60) && ((cmd==SLB)|(cmd==CLB))) { /* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */ if (at91sam7_wait_status_busy(bank, MC_FSR_EOL, 10)&0x0C) Modified: trunk/src/helper/binarybuffer.h =================================================================== --- trunk/src/helper/binarybuffer.h 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/helper/binarybuffer.h 2009-06-23 22:39:47 UTC (rev 2366) @@ -32,7 +32,7 @@ /* inlining this will help show what fn that is taking time during profiling. */ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, uint32_t value) { - if ((num==32)&&(first==0)) + if ((num==32) && (first==0)) { buffer[3]=(value>>24)&0xff; buffer[2]=(value>>16)&0xff; @@ -53,7 +53,7 @@ } static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num) { - if ((num==32)&&(first==0)) + if ((num==32) && (first==0)) { return (((uint32_t)buffer[3])<<24)|(((uint32_t)buffer[2])<<16)|(((uint32_t)buffer[1])<<8)|(((uint32_t)buffer[0])<<0); } else Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/helper/ioutil.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -233,7 +233,7 @@ break; } } - if ((i==argc)&&(fwrite("\n", 1, 1, config_file)==1)) + if ((i==argc) && (fwrite("\n", 1, 1, config_file)==1)) { retval=ERROR_OK; } @@ -274,7 +274,7 @@ chunk = maxChunk; } - if ((retval==ERROR_OK)&&(fwrite(((char *)data)+pos, 1, chunk, f) != chunk)) + if ((retval==ERROR_OK) && (fwrite(((char *)data)+pos, 1, chunk, f) != chunk)) retval = ERROR_INVALID_ARGUMENTS; if (retval != ERROR_OK) Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/jtag/core.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -324,7 +324,7 @@ void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state) { - if (jtag_verify&&jtag_verify_capture_ir) + if (jtag_verify && jtag_verify_capture_ir) { /* 8 x 32 bit id's is enough for all invocations */ @@ -579,9 +579,9 @@ ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)) { if (((req_tlr_or_trst&&!jtag_trst)|| - (!req_tlr_or_trst&&jtag_trst))&& + (!req_tlr_or_trst && jtag_trst))&& ((req_srst&&!jtag_srst)|| - (!req_srst&&jtag_srst))) + (!req_srst && jtag_srst))) { /* FIX!!! srst_pulls_trst allows 1,1 => 0,0 transition.... */ //LOG_ERROR("BUG: transition of req_tlr_or_trst and req_srst in the same jtag_add_reset() call is undefined"); Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:39:47 UTC (rev 2366) @@ -92,7 +92,7 @@ ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value); #if 1 #if TEST_MANUAL() - if ((state==TAP_DRSHIFT)&&(endState != TAP_DRSHIFT)) + if ((state==TAP_DRSHIFT) && (endState != TAP_DRSHIFT)) { int i; setCurrentState(state); @@ -100,7 +100,7 @@ { int tms; tms=0; - if ((i==repeat-1)&&(state != endState)) + if ((i==repeat-1) && (state != endState)) { tms=1; } @@ -124,7 +124,7 @@ #endif #else /* maximum debug version */ - if ((repeat>0)&&((state==TAP_DRSHIFT)||(state==TAP_SI))) + if ((repeat>0) && ((state==TAP_DRSHIFT)||(state==TAP_SI))) { int i; /* sample shift register for every bit. */ @@ -188,13 +188,13 @@ { int singletap=(jtag_tap_next_enabled(jtag_tap_next_enabled(NULL))==NULL); - if ((singletap)&&(num_fields==3)) + if ((singletap) && (num_fields==3)) { /* used by embeddedice_write_reg_inner() */ shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[1], value[1]); shiftValueInner(TAP_DRSHIFT, end_state, num_bits[2], value[2]); - } else if ((singletap)&&(num_fields==2)) + } else if ((singletap) && (num_fields==2)) { /* used by arm7 code */ shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -149,7 +149,7 @@ ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000002); } - if (trst||(srst&&(jtag_get_reset_config() & RESET_SRST_PULLS_TRST))) + if (trst||(srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST))) { waitIdle(); /* we're now in the RESET state until trst is deasserted */ Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/server/gdb_server.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -1397,7 +1397,7 @@ else if (type == 4) /* access watchpoint */ wp_type = WPT_ACCESS; - if (gdb_breakpoint_override&&((bp_type==BKPT_SOFT)||(bp_type==BKPT_HARD))) + if (gdb_breakpoint_override && ((bp_type==BKPT_SOFT)||(bp_type==BKPT_HARD))) { bp_type=gdb_breakpoint_override_type; } @@ -1654,7 +1654,7 @@ xml_printf(&retval, &buffer, &pos, &size, "PacketSize=%x;qXfer:memory-map:read%c;qXfer:features:read-;QStartNoAckMode+", - (GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1)&&(flash_get_bank_count()>0)) ? '+' : '-'); + (GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1) && (flash_get_bank_count()>0)) ? '+' : '-'); if (retval != ERROR_OK) { @@ -1667,7 +1667,7 @@ return ERROR_OK; } - else if (strstr(packet, "qXfer:memory-map:read::")&&(flash_get_bank_count()>0)) + else if (strstr(packet, "qXfer:memory-map:read::") && (flash_get_bank_count()>0)) { /* We get away with only specifying flash here. Regions that are not * specified are treated as if we provided no memory map(if not we Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -1022,7 +1022,7 @@ armv4_5_invalidate_core_regs(target); - if ((target->reset_halt)&&((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)) + if ((target->reset_halt) && ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)) { /* debug entry was already prepared in arm7_9_assert_reset() */ target->debug_reason = DBG_REASON_DBGRQ; @@ -1050,7 +1050,7 @@ jtag_add_reset(0, 0); enum reset_types jtag_reset_config = jtag_get_reset_config(); - if (target->reset_halt&&(jtag_reset_config & RESET_SRST_PULLS_TRST) != 0) + if (target->reset_halt && (jtag_reset_config & RESET_SRST_PULLS_TRST) != 0) { LOG_WARNING("srst pulls trst - can not reset into halted mode. Issuing halt after reset."); /* set up embedded ice registers again */ Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/target/arm_adi_v5.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -1027,7 +1027,7 @@ dap_ap_read_reg_u32(swjdp, 0xFC, &apid); swjdp_transaction_endcheck(swjdp); /* Now we read ROM table ID registers, ref. ARM IHI 0029B sec */ - mem_ap = ((apid&0x10000)&&((apid&0x0F) != 0)); + mem_ap = ((apid&0x10000) && ((apid&0x0F) != 0)); command_print(cmd_ctx, "ap identification register 0x%8.8" PRIx32 "", apid); if (apid) { @@ -1053,7 +1053,7 @@ command_print(cmd_ctx, "No AP found at this apsel 0x%x", apsel); } - romtable_present = ((mem_ap)&&(dbgbase != 0xFFFFFFFF)); + romtable_present = ((mem_ap) && (dbgbase != 0xFFFFFFFF)); if (romtable_present) { uint32_t cid0,cid1,cid2,cid3,memtype,romentry; Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/target/image.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -81,7 +81,7 @@ &&(isxdigit(buffer[5])) &&(isxdigit(buffer[6])) &&(buffer[7]=='0') /* record type : 00 -> 05 */ - &&(buffer[8]>='0')&&(buffer[8]<'6')) + &&(buffer[8]>='0') && (buffer[8]<'6')) { LOG_DEBUG("IHEX image detected."); image->type = IMAGE_IHEX; Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:39:34 UTC (rev 2365) +++ trunk/src/target/target.c 2009-06-23 22:39:47 UTC (rev 2366) @@ -1014,7 +1014,7 @@ if (area->free) return ERROR_OK; - if (restore&&target->backup_working_area) + if (restore && target->backup_working_area) { int retval; if ((retval = target_write_memory(target, area->address, 4, area->size / 4, area->backup)) != ERROR_OK) |
From: <zw...@ma...> - 2009-06-24 00:39:45
|
Author: zwelch Date: 2009-06-24 00:39:34 +0200 (Wed, 24 Jun 2009) New Revision: 2365 Modified: trunk/src/flash/cfi.c Log: - Fixes '[*]=' whitespace - Replace '\(\w\)\([*]=\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:39:18 UTC (rev 2364) +++ trunk/src/flash/cfi.c 2009-06-23 22:39:34 UTC (rev 2365) @@ -114,7 +114,7 @@ { cfi_flash_bank_t *cfi_info = bank->driver_priv; - if (cfi_info->x16_as_x8) offset*=2; + if (cfi_info->x16_as_x8) offset *= 2; /* while the sector list isn't built, only accesses to sector 0 work */ if (sector == 0) |
From: <zw...@ma...> - 2009-06-24 00:39:31
|
Author: zwelch Date: 2009-06-24 00:39:18 +0200 (Wed, 24 Jun 2009) New Revision: 2364 Modified: trunk/src/flash/cfi.c trunk/src/flash/ecos.c trunk/src/flash/mflash.c trunk/src/flash/ocl/at91sam7x/main.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/helper/log.c trunk/src/helper/time_support.c trunk/src/jtag/tcl.c trunk/src/jtag/zy1000/zy1000.c trunk/src/server/gdb_server.c trunk/src/target/arm7_9_common.c trunk/src/target/image.c trunk/src/target/mips32_pracc.c trunk/src/target/target.c Log: - Fixes '[+]=' whitespace - Replace '\(\w\)\([+]=\)(' with '\1 \2 ('. - Replace '\(\w\)\([+]=\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/flash/cfi.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -1014,7 +1014,7 @@ for (i=0; i< count; i++) { target_buffer_set_u32(target, dest, *src); - dest+=4; + dest += 4; src++; } } Modified: trunk/src/flash/ecos.c =================================================================== --- trunk/src/flash/ecos.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/flash/ecos.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -319,7 +319,7 @@ uint32_t i; - for (i=0; i<len; i+=chunk) + for (i=0; i<len; i += chunk) { int t=len-i; if (t>chunk) Modified: trunk/src/flash/mflash.c =================================================================== --- trunk/src/flash/mflash.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/flash/mflash.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -278,7 +278,7 @@ duration_stop_measure(&duration, NULL); t=duration.duration.tv_usec/1000; - t+=duration.duration.tv_sec*1000; + t += duration.duration.tv_sec*1000; if (t > time) break; Modified: trunk/src/flash/ocl/at91sam7x/main.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -64,7 +64,7 @@ result=0; pagenum=adr/flash_page_size; - for (bi=0; bi<bi_end; bi+=flash_page_size/4) { + for (bi=0; bi<bi_end; bi += flash_page_size/4) { result=flash_page_program(buffer+bi, pagenum++); if (result) break; } Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -146,7 +146,7 @@ if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; } - if ((page_num+=flash_lock_pages)>flash_page_count) break; + if ((page_num += flash_lock_pages)>flash_page_count) break; lockbits>>=1; } Modified: trunk/src/helper/log.c =================================================================== --- trunk/src/helper/log.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/helper/log.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -429,7 +429,7 @@ { int i; int napTime=10; - for (i=0; i<ms; i+=napTime) + for (i=0; i<ms; i += napTime) { int sleep_a_bit=ms-i; if (sleep_a_bit>napTime) Modified: trunk/src/helper/time_support.c =================================================================== --- trunk/src/helper/time_support.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/helper/time_support.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -100,7 +100,7 @@ { float t; t=duration->duration.tv_sec; - t+=(float)duration->duration.tv_usec/1000000.0; + t += (float)duration->duration.tv_usec/1000000.0; *text = malloc(100); snprintf(*text, 100, "%fs", t); } @@ -114,8 +114,8 @@ long long t=0; gettimeofday(&now, NULL); - t+=now.tv_usec/1000; - t+=now.tv_sec*1000; + t += now.tv_usec/1000; + t += now.tv_sec*1000; return t; } Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/jtag/tcl.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -1274,7 +1274,7 @@ /* validate arguments as numbers */ e = JIM_OK; - for (i = 2; i < argc; i+=2) + for (i = 2; i < argc; i += 2) { long bits; const char *cp; @@ -1333,7 +1333,7 @@ num_fields=(argc-2)/2; fields = malloc(sizeof(scan_field_t) * num_fields); - for (i = 2; i < argc; i+=2) + for (i = 2; i < argc; i += 2) { long bits; int len; @@ -1361,7 +1361,7 @@ field_count=0; Jim_Obj *list = Jim_NewListObj(interp, NULL, 0); - for (i = 2; i < argc; i+=2) + for (i = 2; i < argc; i += 2) { long bits; char *str; Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -455,7 +455,7 @@ value=0; if (fields[i].out_value != NULL) { - for (l=0; l<k; l+=8) + for (l=0; l<k; l += 8) { value|=fields[i].out_value[(j+l)/8]<<l; } @@ -472,12 +472,12 @@ // we're shifting in data to MSB, shift data to be aligned for returning the value value >>= 32-k; - for (l=0; l<k; l+=8) + for (l=0; l<k; l += 8) { inBuffer[(j+l)/8]=(value>>l)&0xff; } } - j+=k; + j += k; } } } @@ -634,7 +634,7 @@ /* execute num_cycles, 32 at the time. */ int i; - for (i=0; i<num_cycles; i+=32) + for (i=0; i<num_cycles; i += 32) { int num; num=32; @@ -742,7 +742,7 @@ { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 1)); shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1<<5)); - buffer+=4; + buffer += 4; } } else { @@ -751,7 +751,7 @@ { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 0)); shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1<<5)); - buffer+=4; + buffer += 4; } } } Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/server/gdb_server.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -923,7 +923,7 @@ } int i; - for (i = 0; i < str_len; i+=2) + for (i = 0; i < str_len; i += 2) { uint8_t t = hextoint(tstr[i])<<4; t |= hextoint(tstr[i+1]); Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -2587,7 +2587,7 @@ /* Handle first & last using standard embeddedice_write_reg and the middle ones w/the * core function repeated. */ embeddedice_write_reg(&arm7_9->eice_cache->reg_list[EICE_COMMS_DATA], fast_target_buffer_get_u32(buffer, little)); - buffer+=4; + buffer += 4; embeddedice_reg_t *ice_reg = arm7_9->eice_cache->reg_list[EICE_COMMS_DATA].arch_info; uint8_t reg_addr = ice_reg->addr & 0x1f; Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/target/image.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -764,7 +764,7 @@ int section; for (section=0; section < image->num_sections; section++) { - image->sections[section].base_address+=image->base_address; + image->sections[section].base_address += image->base_address; } /* we're done relocating. The two statements below are mainly * for documenation purposes: stop anyone from empirically Modified: trunk/src/target/mips32_pracc.c =================================================================== --- trunk/src/target/mips32_pracc.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/target/mips32_pracc.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -314,8 +314,8 @@ MIPS32_SW(8,0,11), /* sw $8,0($11) */ MIPS32_ADDI(10,10,NEG16(1)), /* $10-- */ - MIPS32_ADDI(9,9,4), /* $1+=4 */ - MIPS32_ADDI(11,11,4), /* $11+=4 */ + MIPS32_ADDI(9,9,4), /* $1 += 4 */ + MIPS32_ADDI(11,11,4), /* $11 += 4 */ MIPS32_NOP, MIPS32_B(NEG16(9)), /* b loop */ @@ -422,8 +422,8 @@ MIPS32_SW(8,0,11), /* sw $8,0($11) */ MIPS32_ADDI(10,10,NEG16(1)), /* $10-- */ - MIPS32_ADDI(9,9,2), /* $9+=2 */ - MIPS32_ADDI(11,11,4), /* $11+=4 */ + MIPS32_ADDI(9,9,2), /* $9 += 2 */ + MIPS32_ADDI(11,11,4), /* $11 += 4 */ MIPS32_NOP, MIPS32_B(NEG16(9)), /* b loop */ MIPS32_NOP, @@ -501,8 +501,8 @@ MIPS32_SW(8,0,11), /* sw $8,0($11) */ MIPS32_ADDI(10,10,NEG16(1)), /* $10-- */ - MIPS32_ADDI(9,9,1), /* $9+=1 */ - MIPS32_ADDI(11,11,4), /* $11+=4 */ + MIPS32_ADDI(9,9,1), /* $9 += 1 */ + MIPS32_ADDI(11,11,4), /* $11 += 4 */ MIPS32_NOP, MIPS32_B(NEG16(9)), /* b loop */ MIPS32_NOP, @@ -588,15 +588,15 @@ MIPS32_ADDI(8,15,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN)), //$8= MIPS32_PRACC_PARAM_IN MIPS32_LW(9,0,8), /* Load write addr to $9 */ MIPS32_LW(10,4,8), //last address /* Load write count to $10 */ - MIPS32_ADDI(8,8,8), // $8+=8 beginning of data + MIPS32_ADDI(8,8,8), // $8 += 8 beginning of data //loop: MIPS32_LW(11,0,8), /* lw $11,0($8), Load $11 with the word @mem[$8] */ MIPS32_SW(11,0,9), /* sw $11,0($9) */ - MIPS32_ADDI(9,9,4), /* $9+=4 */ + MIPS32_ADDI(9,9,4), /* $9 += 4 */ MIPS32_BNE(10,9,NEG16(4)), //was 9 BNE $10, 9, loop /* b loop */ - MIPS32_ADDI(8,8,4), //this instruction is part of the loop (one delay slot)! /* $8+=4 */ + MIPS32_ADDI(8,8,4), //this instruction is part of the loop (one delay slot)! /* $8 += 4 */ /* end: */ MIPS32_LW(11,0,15), /* lw $11,($15) */ MIPS32_LW(10,0,15), /* lw $10,($15) */ @@ -669,7 +669,7 @@ MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)), MIPS32_LW(9,0,8), /* Load write addr to $9 */ MIPS32_LW(10,4,8), /* Load write count to $10 */ - MIPS32_ADDI(8,8,8), /* $8+=8 */ + MIPS32_ADDI(8,8,8), /* $8 += 8 */ MIPS32_NOP, /* loop: */ MIPS32_BEQ(0,10,9), /* beq $0, $10, end */ @@ -679,8 +679,8 @@ MIPS32_SH(11,0,9), /* sh $11,0($9) */ MIPS32_ADDI(10,10,NEG16(1)), /* $10-- */ - MIPS32_ADDI(9,9,2), /* $9+=2 */ - MIPS32_ADDI(8,8,4), /* $8+=4 */ + MIPS32_ADDI(9,9,2), /* $9 += 2 */ + MIPS32_ADDI(8,8,4), /* $8 += 4 */ MIPS32_NOP, MIPS32_B(NEG16(9)), /* b loop */ @@ -729,7 +729,7 @@ MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)), MIPS32_LW(9,0,8), /* Load write addr to $9 */ MIPS32_LW(10,4,8), /* Load write count to $10 */ - MIPS32_ADDI(8,8,8), /* $8+=8 */ + MIPS32_ADDI(8,8,8), /* $8 += 8 */ MIPS32_NOP, /* loop: */ MIPS32_BEQ(0,10,9), /* beq $0, $10, end */ @@ -739,8 +739,8 @@ MIPS32_SB(11,0,9), /* sb $11,0($9) */ MIPS32_ADDI(10,10,NEG16(1)), /* $10-- */ - MIPS32_ADDI(9,9,1), /* $9+=1 */ - MIPS32_ADDI(8,8,4), /* $8+=4 */ + MIPS32_ADDI(9,9,1), /* $9 += 1 */ + MIPS32_ADDI(8,8,4), /* $8 += 4 */ MIPS32_NOP, MIPS32_B(NEG16(9)), /* b loop */ Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:38:12 UTC (rev 2363) +++ trunk/src/target/target.c 2009-06-23 22:39:18 UTC (rev 2364) @@ -2285,7 +2285,7 @@ if (image.sections[i].base_address<min_address) { /* clip addresses below */ - offset+=min_address-image.sections[i].base_address; + offset += min_address-image.sections[i].base_address; length -= offset; } @@ -4466,7 +4466,7 @@ if (image.sections[i].base_address<min_address) { /* clip addresses below */ - offset+=min_address-image.sections[i].base_address; + offset += min_address-image.sections[i].base_address; length -= offset; } @@ -4535,7 +4535,7 @@ { retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data); } - size+=fastload[i].length; + size += fastload[i].length; } int after=timeval_ms(); command_print(cmd_ctx, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0)); |
From: <zw...@ma...> - 2009-06-24 00:39:13
|
Author: zwelch Date: 2009-06-24 00:38:12 +0200 (Wed, 24 Jun 2009) New Revision: 2363 Modified: trunk/src/flash/ecos.c trunk/src/flash/flash.c trunk/src/flash/lpc2000.c trunk/src/flash/ocl/at91sam7x/main.c trunk/src/flash/ocl/at91sam7x/samflash.c trunk/src/flash/pic32mx.c trunk/src/flash/stm32x.c trunk/src/flash/str9x.c trunk/src/helper/command.c trunk/src/helper/configuration.c trunk/src/helper/ioutil.c trunk/src/helper/jim.c trunk/src/helper/log.c trunk/src/helper/replacements.c trunk/src/jtag/bitbang.c trunk/src/jtag/bitq.c trunk/src/jtag/core.c trunk/src/jtag/driver.c trunk/src/jtag/ft2232.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.h trunk/src/jtag/presto.c trunk/src/jtag/tcl.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/openocd.c trunk/src/server/gdb_server.c trunk/src/server/httpd.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm9tdmi.c trunk/src/target/arm_adi_v5.c trunk/src/target/arm_disassembler.c trunk/src/target/armv4_5.c trunk/src/target/armv7m.c trunk/src/target/breakpoints.c trunk/src/target/cortex_m3.c trunk/src/target/embeddedice.c trunk/src/target/etm.c trunk/src/target/feroceon.c trunk/src/target/image.c trunk/src/target/mips_m4k.c trunk/src/target/target.c trunk/src/target/xscale.c Log: - Fixes '!=' whitespace - Replace ')\(!=\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(!=\)(' with '\1 \2 ('. - Replace '\(\w\)\(!=\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/flash/ecos.c =================================================================== --- trunk/src/flash/ecos.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/ecos.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -269,7 +269,7 @@ int timeout = (len / 20480 + 1) * 1000; /*asume 20 KB/s*/ retval=loadDriver(info); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; uint32_t flashErr; @@ -282,7 +282,7 @@ &flashErr, timeout ); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; if (flashErr != 0x0) @@ -302,7 +302,7 @@ int timeout = (chunk / 20480 + 1) * 1000; /*asume 20 KB/s + 1 second*/ retval=loadDriver(info); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; uint32_t buffer; @@ -314,7 +314,7 @@ 0, &buffer, 1000); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/flash.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -90,7 +90,7 @@ int retval; retval=bank->driver->write(bank, buffer, offset, count); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", bank->base, offset, retval); @@ -104,7 +104,7 @@ int retval; retval=bank->driver->erase(bank, first, last); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { LOG_ERROR("failed erasing sectors %d to %d (%d)", first, last, retval); } @@ -117,7 +117,7 @@ int retval; retval=bank->driver->protect(bank, set, first, last); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { LOG_ERROR("failed setting protection for areas %d to %d (%d)", first, last, retval); } @@ -801,11 +801,11 @@ return ERROR_FAIL; } err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size); - if (err!=ERROR_OK) + if (err != ERROR_OK) return err; err = target_read_buffer(target, address + wrote, cur_size, readback); - if (err!=ERROR_OK) + if (err != ERROR_OK) return err; unsigned i; Modified: trunk/src/flash/lpc2000.c =================================================================== --- trunk/src/flash/lpc2000.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/lpc2000.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -526,7 +526,7 @@ LOG_DEBUG("checksum: 0x%8.8" PRIx32, checksum); uint32_t original_value=buf_get_u32(buffer + (5 * 4), 0, 32); - if (original_value!=checksum) + if (original_value != checksum) { LOG_WARNING("Verification will fail since checksum in image(0x%8.8" PRIx32 ") written to flash was different from calculated vector checksum(0x%8.8" PRIx32 ").", original_value, checksum); Modified: trunk/src/flash/ocl/at91sam7x/main.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/ocl/at91sam7x/main.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -53,7 +53,7 @@ chksum=OCL_CHKS_INIT; for (bi=0; bi<bi_end; bi++) chksum^=buffer[bi]=dcc_rd(); - if (dcc_rd()!=chksum) { + if (dcc_rd() != chksum) { dcc_wr(OCL_CHKS_FAIL); return; } Modified: trunk/src/flash/ocl/at91sam7x/samflash.c =================================================================== --- trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/ocl/at91sam7x/samflash.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -175,7 +175,7 @@ { int result; - if ((result=flash_erase_plane(0))!=FLASH_STAT_OK) return result; + if ((result=flash_erase_plane(0)) != FLASH_STAT_OK) return result; /* the second flash controller, if any */ if (flash_page_count>1024) result=flash_erase_plane(0x10); Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -388,7 +388,7 @@ return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - if ((retval=target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code))!=ERROR_OK) + if ((retval=target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code)) != ERROR_OK) return retval; #endif @@ -409,7 +409,7 @@ { uint32_t status; - if ((retval = target_write_buffer(target, source->address, buffer_size, buffer))!=ERROR_OK) { + if ((retval = target_write_buffer(target, source->address, buffer_size, buffer)) != ERROR_OK) { LOG_ERROR("Failed to write row buffer (%d words) to RAM", (int)(buffer_size/4)); break; } Modified: trunk/src/flash/stm32x.c =================================================================== --- trunk/src/flash/stm32x.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/stm32x.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -517,7 +517,7 @@ return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - if ((retval=target_write_buffer(target, stm32x_info->write_algorithm->address, sizeof(stm32x_flash_write_code), stm32x_flash_write_code))!=ERROR_OK) + if ((retval=target_write_buffer(target, stm32x_info->write_algorithm->address, sizeof(stm32x_flash_write_code), stm32x_flash_write_code)) != ERROR_OK) return retval; /* memory buffer */ @@ -547,7 +547,7 @@ { uint32_t thisrun_count = (count > (buffer_size / 2)) ? (buffer_size / 2) : count; - if ((retval = target_write_buffer(target, source->address, thisrun_count * 2, buffer))!=ERROR_OK) + if ((retval = target_write_buffer(target, source->address, thisrun_count * 2, buffer)) != ERROR_OK) break; buf_set_u32(reg_params[0].value, 0, 32, source->address); Modified: trunk/src/flash/str9x.c =================================================================== --- trunk/src/flash/str9x.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/flash/str9x.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -198,11 +198,11 @@ if (str9x_info->bank1) { adr = bank1start + 0x18; - if ((retval=target_write_u16(target, adr, 0x90))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK) { return retval; } - if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK) + if ((retval=target_read_u16(target, adr, &hstatus)) != ERROR_OK) { return retval; } @@ -211,11 +211,11 @@ else { adr = bank1start + 0x14; - if ((retval=target_write_u16(target, adr, 0x90))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK) { return retval; } - if ((retval=target_read_u32(target, adr, &status))!=ERROR_OK) + if ((retval=target_read_u32(target, adr, &status)) != ERROR_OK) { return retval; } @@ -224,11 +224,11 @@ else { adr = bank1start + 0x10; - if ((retval=target_write_u16(target, adr, 0x90))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK) { return retval; } - if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK) + if ((retval=target_read_u16(target, adr, &hstatus)) != ERROR_OK) { return retval; } @@ -236,7 +236,7 @@ } /* read array command */ - if ((retval=target_write_u16(target, adr, 0xFF))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0xFF)) != ERROR_OK) { return retval; } @@ -284,24 +284,24 @@ adr = bank->base + bank->sectors[i].offset; /* erase sectors */ - if ((retval=target_write_u16(target, adr, erase_cmd))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, erase_cmd)) != ERROR_OK) { return retval; } - if ((retval=target_write_u16(target, adr, 0xD0))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0xD0)) != ERROR_OK) { return retval; } /* get status */ - if ((retval=target_write_u16(target, adr, 0x70))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0x70)) != ERROR_OK) { return retval; } int timeout; for (timeout=0; timeout<1000; timeout++) { - if ((retval=target_read_u8(target, adr, &status))!=ERROR_OK) + if ((retval=target_read_u8(target, adr, &status)) != ERROR_OK) { return retval; } @@ -316,13 +316,13 @@ } /* clear status, also clear read array */ - if ((retval=target_write_u16(target, adr, 0x50))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0x50)) != ERROR_OK) { return retval; } /* read array command */ - if ((retval=target_write_u16(target, adr, 0xFF))!=ERROR_OK) + if ((retval=target_write_u16(target, adr, 0xFF)) != ERROR_OK) { return retval; } Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/helper/command.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -226,7 +226,7 @@ const char *t2=""; const char *t3=""; /* maximum of two levels :-) */ - if (c->parent!=NULL) + if (c->parent != NULL) { t1=c->parent->name; t2="_"; @@ -250,7 +250,7 @@ Jim_Obj *cmd_list=Jim_NewListObj(interp, NULL, 0); /* maximum of two levels :-) */ - if (c->parent!=NULL) + if (c->parent != NULL) { Jim_ListAppendElement(interp, cmd_list, Jim_NewStringObj(interp, c->parent->name, -1)); } @@ -420,7 +420,7 @@ const char *t2=""; const char *t3=""; /* maximum of two levels :-) */ - if (c->parent!=NULL) + if (c->parent != NULL) { t1=c->parent->name; t2=" "; @@ -473,7 +473,7 @@ Jim_DeleteAssocData(interp, "context"); } if (retcode == JIM_ERR) { - if (retval!=ERROR_COMMAND_CLOSE_CONNECTION) + if (retval != ERROR_COMMAND_CLOSE_CONNECTION) { /* We do not print the connection closed error message */ Jim_PrintErrorMessage(interp); @@ -520,7 +520,7 @@ va_list ap; va_start(ap, format); string = alloc_vprintf(format, ap); - if (string!=NULL) + if (string != NULL) { retval=command_run_line(context, string); } @@ -809,7 +809,7 @@ int handle_fast_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc!=1) + if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; fast_and_dangerous = strcmp("enable", args[0])==0; Modified: trunk/src/helper/configuration.c =================================================================== --- trunk/src/helper/configuration.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/helper/configuration.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -116,7 +116,7 @@ while (*cfg) { retval=command_run_line(cmd_ctx, *cfg); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; cfg++; } Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/helper/ioutil.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -89,7 +89,7 @@ LOG_ERROR("Can't open %s\n", fileName); return ERROR_FAIL; } - if (fseek(pFile, 0, SEEK_END)!=0) + if (fseek(pFile, 0, SEEK_END) != 0) { LOG_ERROR("Can't open %s\n", fileName); fclose(pFile); @@ -104,7 +104,7 @@ } *len = fsize; - if (fseek(pFile, 0, SEEK_SET)!=0) + if (fseek(pFile, 0, SEEK_SET) != 0) { LOG_ERROR("Can't open %s\n", fileName); fclose(pFile); @@ -225,11 +225,11 @@ for (i = 1; i < argc; i++) { - if (fwrite(args[i], 1, strlen(args[i]), config_file)!=strlen(args[i])) + if (fwrite(args[i], 1, strlen(args[i]), config_file) != strlen(args[i])) break; if (i != argc - 1) { - if (fwrite(" ", 1, 1, config_file)!=1) + if (fwrite(" ", 1, 1, config_file) != 1) break; } } @@ -274,7 +274,7 @@ chunk = maxChunk; } - if ((retval==ERROR_OK)&&(fwrite(((char *)data)+pos, 1, chunk, f)!=chunk)) + if ((retval==ERROR_OK)&&(fwrite(((char *)data)+pos, 1, chunk, f) != chunk)) retval = ERROR_INVALID_ARGUMENTS; if (retval != ERROR_OK) @@ -613,7 +613,7 @@ { //if (ifr->ifr_addr.sa_family == AF_INET) { - if (strcmp("eth0", ifr->ifr_name)!=0) + if (strcmp("eth0", ifr->ifr_name) != 0) continue; strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name)); if (ioctl(SockFD, SIOCGIFHWADDR, &ifreq) < 0) Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/helper/jim.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -503,7 +503,7 @@ static jim_wide JimPowWide(jim_wide b, jim_wide e) { jim_wide i, res = 1; - if ((b==0 && e!=0) || (e<0)) return 0; + if ((b==0 && e != 0) || (e<0)) return 0; for (i=0; i<e; i++) {res *= b;} return res; } @@ -6960,7 +6960,7 @@ case JIM_EXPROP_LSHIFT: wC = wA<<wB; break; case JIM_EXPROP_RSHIFT: wC = wA>>wB; break; case JIM_EXPROP_NUMEQ: wC = wA==wB; break; - case JIM_EXPROP_NUMNE: wC = wA!=wB; break; + case JIM_EXPROP_NUMNE: wC = wA != wB; break; case JIM_EXPROP_BITAND: wC = wA&wB; break; case JIM_EXPROP_BITXOR: wC = wA^wB; break; case JIM_EXPROP_BITOR: wC = wA|wB; break; @@ -7063,7 +7063,7 @@ case JIM_EXPROP_LTE: dC = dA<=dB; break; case JIM_EXPROP_GTE: dC = dA>=dB; break; case JIM_EXPROP_NUMEQ: dC = dA==dB; break; - case JIM_EXPROP_NUMNE: dC = dA!=dB; break; + case JIM_EXPROP_NUMNE: dC = dA != dB; break; case JIM_EXPROP_LOGICAND_LEFT: if (dA == 0) { i += (int)dB; Modified: trunk/src/helper/log.c =================================================================== --- trunk/src/helper/log.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/helper/log.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -89,7 +89,7 @@ if (f != NULL) file = f + 1; - if (strchr(string, '\n')!=NULL) + if (strchr(string, '\n') != NULL) { if (debug_level >= LOG_LVL_DEBUG) { Modified: trunk/src/helper/replacements.c =================================================================== --- trunk/src/helper/replacements.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/helper/replacements.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -35,7 +35,7 @@ void *clear_malloc(size_t size) { void *t = malloc(size); - if (t!=NULL) + if (t != NULL) { memset(t, 0x00, size); } @@ -45,7 +45,7 @@ void *fill_malloc(size_t size) { void *t = malloc(size); - if (t!=NULL) + if (t != NULL) { /* We want to initialize memory to some known bad state. */ /* 0 and 0xff yields 0 and -1 as integers, which often */ Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/bitbang.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -204,7 +204,7 @@ bitbang_interface->write(0, tms, tdi); - if (type!=SCAN_OUT) + if (type != SCAN_OUT) val=bitbang_interface->read(); bitbang_interface->write(1, tms, tdi); Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/bitq.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -72,7 +72,7 @@ if (field->num_bits>bitq_in_bufsize * 8) { /* buffer previously allocated? */ - if (bitq_in_buffer!=NULL) + if (bitq_in_buffer != NULL) { /* free it */ free(bitq_in_buffer); @@ -241,7 +241,7 @@ out_ptr = field->out_value; for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--) { - bitq_io(0, ( (*out_ptr) & out_mask )!=0, tdo_req); + bitq_io(0, ( (*out_ptr) & out_mask ) != 0, tdo_req); if (out_mask==0x80) { out_mask = 0x01; @@ -251,7 +251,7 @@ out_mask <<= 1; } - bitq_io(pause, ( (*out_ptr) & out_mask )!=0, tdo_req); + bitq_io(pause, ( (*out_ptr) & out_mask ) != 0, tdo_req); } if (pause) @@ -382,7 +382,7 @@ void bitq_cleanup(void) { - if (bitq_in_buffer!=NULL) + if (bitq_in_buffer != NULL) { free(bitq_in_buffer); bitq_in_buffer = NULL; Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/core.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -302,7 +302,7 @@ { jtag_checks(); - assert(state!=TAP_INVALID); + assert(state != TAP_INVALID); cmd_queue_cur_state = state; } @@ -676,7 +676,7 @@ LOG_ERROR("BUG: TAP_DRSHIFT/IRSHIFT can't be end state. Calling code should use a larger scan field"); } - if (state!=TAP_INVALID) + if (state != TAP_INVALID) cmd_queue_end_state = state; return cmd_queue_end_state; } @@ -1157,7 +1157,7 @@ } jtag_add_tlr(); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; /* examine chain first, as this could discover the real chain layout */ Modified: trunk/src/jtag/driver.c =================================================================== --- trunk/src/jtag/driver.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/driver.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -493,10 +493,10 @@ if (retval == ERROR_OK) { struct jtag_callback_entry *entry; - for (entry=jtag_callback_queue_head; entry!=NULL; entry=entry->next) + for (entry=jtag_callback_queue_head; entry != NULL; entry=entry->next) { retval=entry->callback(entry->data0, entry->data1, entry->data2, entry->data3); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) break; } } Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/ft2232.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -52,7 +52,7 @@ #if (BUILD_FT2232_FTD2XX==1 && BUILD_FT2232_LIBFTDI==1) #error "BUILD_FT2232_FTD2XX && BUILD_FT2232_LIBFTDI are mutually exclusive" -#elif (BUILD_FT2232_FTD2XX!=1 && BUILD_FT2232_LIBFTDI!=1) +#elif (BUILD_FT2232_FTD2XX != 1 && BUILD_FT2232_LIBFTDI != 1) #error "BUILD_FT2232_FTD2XX || BUILD_FT2232_LIBFTDI must be chosen" #endif Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/jlink.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -751,7 +751,7 @@ for (i = 0; i < length; i++) { int tms = (i < (length - 1)) ? 0 : 1; - int tdi = (buffer[i / 8] & (1 << (i % 8)))!=0; + int tdi = (buffer[i / 8] & (1 << (i % 8))) != 0; jlink_tap_append_step(tms, tdi); } pending_scan_results_length++; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/jtag.h 2009-06-23 22:38:12 UTC (rev 2363) @@ -614,7 +614,7 @@ * matter if the operation was executed *before* jtag_execute_queue(), * jtag_execute_queue() will still return an error code. * - * All jtag_add_xxx() calls that have in_handler!=NULL will have been + * All jtag_add_xxx() calls that have in_handler != NULL will have been * executed when this fn returns, but if what has been queued only * clocks data out, without reading anything back, then JTAG could * be running *after* jtag_execute_queue() returns. The API does Modified: trunk/src/jtag/presto.c =================================================================== --- trunk/src/jtag/presto.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/presto.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -279,7 +279,7 @@ if ((presto->status = FT_Read(presto->handle, &presto_data, 1, &ftbytes)) != FT_OK) return ERROR_JTAG_DEVICE_ERROR; - if (ftbytes!=1) + if (ftbytes != 1) { LOG_DEBUG("PRESTO reset"); @@ -313,7 +313,7 @@ if ((presto->status = FT_Read(presto->handle, &presto_data, 1, &ftbytes)) != FT_OK) return ERROR_JTAG_DEVICE_ERROR; - if (ftbytes!=1) + if (ftbytes != 1) { LOG_DEBUG("PRESTO not responding"); return ERROR_JTAG_DEVICE_ERROR; Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/tcl.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -1262,7 +1262,7 @@ * args[N-2] = "-endstate" * args[N-1] = statename */ - if ((argc < 4) || ((argc % 2)!=0)) + if ((argc < 4) || ((argc % 2) != 0)) { Jim_WrongNumArgs(interp, 1, args, "wrong arguments"); return JIM_ERR; Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:38:12 UTC (rev 2363) @@ -79,7 +79,7 @@ } /* - * Enter state and cause repeat transitions *out* of that state. So if the endState!=state, then + * Enter state and cause repeat transitions *out* of that state. So if the endState != state, then * the transition from state to endState counts as a transition out of state. */ static __inline__ void shiftValueInner(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value) @@ -92,7 +92,7 @@ ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value); #if 1 #if TEST_MANUAL() - if ((state==TAP_DRSHIFT)&&(endState!=TAP_DRSHIFT)) + if ((state==TAP_DRSHIFT)&&(endState != TAP_DRSHIFT)) { int i; setCurrentState(state); @@ -100,7 +100,7 @@ { int tms; tms=0; - if ((i==repeat-1)&&(state!=endState)) + if ((i==repeat-1)&&(state != endState)) { tms=1; } Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -133,7 +133,7 @@ } else { - /* Danger!!! if clk!=0 when in + /* Danger!!! if clk != 0 when in * idle in TAP_IDLE, reset halt on str912 will fail. */ ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000001); @@ -309,7 +309,7 @@ cyg_uint32 status; ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, status); - Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80)!=0)); + Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80) != 0)); return JIM_OK; } @@ -363,7 +363,7 @@ /* clear JTAG error register */ ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x400); - if ((empty&0x400)!=0) + if ((empty&0x400) != 0) { LOG_WARNING("RCLK timeout"); /* the error is informative only as we don't want to break the firmware if there @@ -427,7 +427,7 @@ // figure out where to store the input data int num_bits=fields[i].num_bits; - if (fields[i].in_value!=NULL) + if (fields[i].in_value != NULL) { inBuffer=fields[i].in_value; } @@ -453,7 +453,7 @@ // we have (num_bits+7)/8 bytes of bits to toggle out. // bits are pushed out LSB to MSB value=0; - if (fields[i].out_value!=NULL) + if (fields[i].out_value != NULL) { for (l=0; l<k; l+=8) { @@ -465,7 +465,7 @@ shiftValueInner(shiftState, pause_state, k, value); - if (inBuffer!=NULL) + if (inBuffer != NULL) { // data in, LSB to MSB value=getShiftValue(); Modified: trunk/src/openocd.c =================================================================== --- trunk/src/openocd.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/openocd.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -69,7 +69,7 @@ /* Give TELNET a way to find out what version this is */ static int handle_version_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc!=0) + if (argc != 0) return ERROR_COMMAND_SYNTAX_ERROR; command_print(cmd_ctx, OPENOCD_VERSION); @@ -112,7 +112,7 @@ static int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc!=0) + if (argc != 0) return ERROR_COMMAND_SYNTAX_ERROR; int retval; @@ -268,14 +268,14 @@ return EXIT_FAILURE; #if BUILD_HTTPD - if (httpd_start()!=ERROR_OK) + if (httpd_start() != ERROR_OK) return EXIT_FAILURE; #endif if (ret != ERROR_COMMAND_CLOSE_CONNECTION) { command_context_mode(cmd_ctx, COMMAND_EXEC); - if (command_run_line(cmd_ctx, "init")!=ERROR_OK) + if (command_run_line(cmd_ctx, "init") != ERROR_OK) return EXIT_FAILURE; /* handle network connections */ Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/server/gdb_server.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -133,7 +133,7 @@ return ERROR_OK; } } - *got_data=FD_ISSET(connection->fd, &read_fds)!=0; + *got_data=FD_ISSET(connection->fd, &read_fds) != 0; return ERROR_OK; } @@ -313,7 +313,7 @@ int gotdata; for (;;) { - if ((retval=check_pending(connection, 0, &gotdata))!=ERROR_OK) + if ((retval=check_pending(connection, 0, &gotdata)) != ERROR_OK) return retval; if (!gotdata) break; @@ -600,11 +600,11 @@ */ if (gdb_con->noack_mode) { - if ((retval=fetch_packet(connection, &checksum_ok, 1, len, buffer))!=ERROR_OK) + if ((retval=fetch_packet(connection, &checksum_ok, 1, len, buffer)) != ERROR_OK) return retval; } else { - if ((retval=fetch_packet(connection, &checksum_ok, 0, len, buffer))!=ERROR_OK) + if ((retval=fetch_packet(connection, &checksum_ok, 0, len, buffer)) != ERROR_OK) return retval; } @@ -1190,7 +1190,7 @@ retval = target_read_buffer(target, addr, len, buffer); - if ((retval!=ERROR_OK)&&!gdb_report_data_abort) + if ((retval != ERROR_OK)&&!gdb_report_data_abort) { /* TODO : Here we have to lie and send back all zero's lest stack traces won't work. * At some point this might be fixed in GDB, in which case this code can be removed. @@ -1738,7 +1738,7 @@ p->base, p->size, blocksize); ram_start=p->base+p->size; } - if (ram_start!=0) + if (ram_start != 0) { xml_printf(&retval, &xml, &pos, &size, "<memory type=\"ram\" start=\"0x%x\" length=\"0x%x\"/>\n", ram_start, 0-ram_start); @@ -2109,7 +2109,7 @@ log_add_callback(gdb_log_callback, connection); target_call_event_callbacks(target, TARGET_EVENT_GDB_START); int retval=gdb_step_continue_packet(connection, target, packet, packet_size); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { /* we'll never receive a halted condition... issue a false one.. */ gdb_frontend_halted(target, connection); Modified: trunk/src/server/httpd.c =================================================================== --- trunk/src/server/httpd.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/server/httpd.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -142,7 +142,7 @@ int argc, Jim_Obj *const *argv) { - if (argc!=2) + if (argc != 2) { Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?"); return JIM_ERR; @@ -202,7 +202,7 @@ Jim_Obj *dict = Jim_GetVariableStr(interp, "httppostdata", 0); - if (dict!=NULL) + if (dict != NULL) { if (Jim_DictKey(interp, dict, keyObj, &value, 0) != JIM_OK) { Modified: trunk/src/target/arm7_9_common.c =================================================================== --- trunk/src/target/arm7_9_common.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/arm7_9_common.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -263,7 +263,7 @@ } else if (breakpoint->type == BKPT_SOFT) { - if ((retval=arm7_9_set_software_breakpoints(arm7_9))!=ERROR_OK) + if ((retval=arm7_9_set_software_breakpoints(arm7_9)) != ERROR_OK) return retval; /* did we already set this breakpoint? */ @@ -922,7 +922,7 @@ { reg_t *reg = register_get_by_name(target->reg_cache, "pc", 1); uint32_t t=*((uint32_t *)reg->value); - if (t!=0) + if (t != 0) { LOG_ERROR("PC was not 0. Does this target need srst_pulls_trst?"); } @@ -1050,19 +1050,19 @@ jtag_add_reset(0, 0); enum reset_types jtag_reset_config = jtag_get_reset_config(); - if (target->reset_halt&&(jtag_reset_config & RESET_SRST_PULLS_TRST)!=0) + if (target->reset_halt&&(jtag_reset_config & RESET_SRST_PULLS_TRST) != 0) { LOG_WARNING("srst pulls trst - can not reset into halted mode. Issuing halt after reset."); /* set up embedded ice registers again */ if ((retval = target_examine_one(target)) != ERROR_OK) return retval; - if ((retval=target_poll(target))!=ERROR_OK) + if ((retval=target_poll(target)) != ERROR_OK) { return retval; } - if ((retval=target_halt(target))!=ERROR_OK) + if ((retval=target_halt(target)) != ERROR_OK) { return retval; } @@ -1147,7 +1147,7 @@ int i; int retval; - if ((retval=target_halt(target))!=ERROR_OK) + if ((retval=target_halt(target)) != ERROR_OK) return retval; long long then=timeval_ms(); @@ -1157,7 +1157,7 @@ if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) != 0) break; embeddedice_read_reg(dbg_stat); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; if (debug_level>=3) { @@ -2576,7 +2576,7 @@ armv4_5_common_t *armv4_5 = target->arch_info; arm7_9_common_t *arm7_9 = armv4_5->arch_info; - if ((retval=target_wait_state(target, TARGET_DEBUG_RUNNING, 500))!=ERROR_OK) + if ((retval=target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK) return retval; int little=target->endianness==TARGET_LITTLE_ENDIAN; @@ -2677,7 +2677,7 @@ if (retval==ERROR_OK) { uint32_t endaddress=buf_get_u32(reg_params[0].value, 0, 32); - if (endaddress!=(address+count*4)) + if (endaddress != (address+count*4)) { LOG_ERROR("DCC write failed, expected end address 0x%08" PRIx32 " got 0x%0" PRIx32 "", (address+count*4), endaddress); retval=ERROR_FAIL; @@ -2734,7 +2734,7 @@ /* convert flash writing code into a buffer in target endianness */ for (i = 0; i < (sizeof(arm7_9_crc_code)/sizeof(uint32_t)); i++) { - if ((retval=target_write_u32(target, crc_algorithm->address + i*sizeof(uint32_t), arm7_9_crc_code[i]))!=ERROR_OK) + if ((retval=target_write_u32(target, crc_algorithm->address + i*sizeof(uint32_t), arm7_9_crc_code[i])) != ERROR_OK) { return retval; } Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/arm7tdmi.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -739,13 +739,13 @@ } target_set_examined(target); } - if ((retval=embeddedice_setup(target))!=ERROR_OK) + if ((retval=embeddedice_setup(target)) != ERROR_OK) return retval; - if ((retval=arm7_9_setup(target))!=ERROR_OK) + if ((retval=arm7_9_setup(target)) != ERROR_OK) return retval; if (arm7_9->etm_ctx) { - if ((retval=etm_setup(target))!=ERROR_OK) + if ((retval=etm_setup(target)) != ERROR_OK) return retval; } return ERROR_OK; Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/arm9tdmi.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -831,13 +831,13 @@ } target_set_examined(target); } - if ((retval=embeddedice_setup(target))!=ERROR_OK) + if ((retval=embeddedice_setup(target)) != ERROR_OK) return retval; - if ((retval=arm7_9_setup(target))!=ERROR_OK) + if ((retval=arm7_9_setup(target)) != ERROR_OK) return retval; if (arm7_9->etm_ctx) { - if ((retval=etm_setup(target))!=ERROR_OK) + if ((retval=etm_setup(target)) != ERROR_OK) return retval; } return ERROR_OK; Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/arm_adi_v5.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -195,7 +195,7 @@ https://lists.berlios.de/pipermail/openocd-development/2008-September/003107.html */ - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) { LOG_ERROR("BUG: Why does this fail the first time????"); } @@ -203,7 +203,7 @@ #endif scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; swjdp->ack = swjdp->ack & 0x7; @@ -228,7 +228,7 @@ } scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; swjdp->ack = swjdp->ack & 0x7; } @@ -261,19 +261,19 @@ /* Clear Sticky Error Bits */ scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_WRITE, swjdp->dp_ctrl_stat | SSTICKYORUN | SSTICKYERR, NULL); scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; LOG_DEBUG("swjdp: status 0x%" PRIx32 "", ctrlstat); dap_ap_read_reg_u32(swjdp, AP_REG_CSW, &mem_ap_csw); dap_ap_read_reg_u32(swjdp, AP_REG_TAR, &mem_ap_tar); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; LOG_ERROR("Read MEM_AP_CSW 0x%" PRIx32 ", MEM_AP_TAR 0x%" PRIx32 "", mem_ap_csw, mem_ap_tar); } - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; return ERROR_JTAG_DEVICE_ERROR; } @@ -971,7 +971,7 @@ dap_dp_write_reg(swjdp, swjdp->dp_ctrl_stat, DP_CTRL_STAT); dap_dp_read_reg(swjdp, &ctrlstat, DP_CTRL_STAT); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; /* Check that we have debug power domains activated */ @@ -979,7 +979,7 @@ { LOG_DEBUG("swjdp: wait CDBGPWRUPACK"); dap_dp_read_reg(swjdp, &ctrlstat, DP_CTRL_STAT); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; alive_sleep(10); } @@ -988,7 +988,7 @@ { LOG_DEBUG("swjdp: wait CSYSPWRUPACK"); dap_dp_read_reg(swjdp, &ctrlstat, DP_CTRL_STAT); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; alive_sleep(10); } @@ -1027,7 +1027,7 @@ dap_ap_read_reg_u32(swjdp, 0xFC, &apid); swjdp_transaction_endcheck(swjdp); /* Now we read ROM table ID registers, ref. ARM IHI 0029B sec */ - mem_ap = ((apid&0x10000)&&((apid&0x0F)!=0)); + mem_ap = ((apid&0x10000)&&((apid&0x0F) != 0)); command_print(cmd_ctx, "ap identification register 0x%8.8" PRIx32 "", apid); if (apid) { Modified: trunk/src/target/arm_disassembler.c =================================================================== --- trunk/src/target/arm_disassembler.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/arm_disassembler.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -1435,7 +1435,7 @@ break; } - if ((imm==0) && (opc!=0)) + if ((imm==0) && (opc != 0)) imm = 32; instruction->info.data_proc.Rd = Rd; Modified: trunk/src/target/armv4_5.c =================================================================== --- trunk/src/target/armv4_5.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/armv4_5.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -501,9 +501,9 @@ } if (target->state != TARGET_HALTED) { - if ((retval=target_halt(target))!=ERROR_OK) + if ((retval=target_halt(target)) != ERROR_OK) return retval; - if ((retval=target_wait_state(target, TARGET_HALTED, 500))!=ERROR_OK) + if ((retval=target_wait_state(target, TARGET_HALTED, 500)) != ERROR_OK) { return retval; } @@ -618,7 +618,7 @@ breakpoint_remove(target, exit_point); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; for (i = 0; i < num_mem_params; i++) Modified: trunk/src/target/armv7m.c =================================================================== --- trunk/src/target/armv7m.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/armv7m.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -304,9 +304,9 @@ /* If the target fails to halt due to the breakpoint, force a halt */ if (retval != ERROR_OK || target->state != TARGET_HALTED) { - if ((retval=target_halt(target))!=ERROR_OK) + if ((retval=target_halt(target)) != ERROR_OK) return retval; - if ((retval=target_wait_state(target, TARGET_HALTED, 500))!=ERROR_OK) + if ((retval=target_wait_state(target, TARGET_HALTED, 500)) != ERROR_OK) { return retval; } @@ -356,7 +356,7 @@ for (i = 0; i < num_mem_params; i++) { - if ((retval=target_write_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value))!=ERROR_OK) + if ((retval=target_write_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK) return retval; } Modified: trunk/src/target/breakpoints.c =================================================================== --- trunk/src/target/breakpoints.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/breakpoints.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -141,7 +141,7 @@ void breakpoint_clear_target(target_t *target) { breakpoint_t *breakpoint; - while ((breakpoint = target->breakpoints)!=NULL) + while ((breakpoint = target->breakpoints) != NULL) { breakpoint_free(target, breakpoint); } @@ -260,7 +260,7 @@ void watchpoint_clear_target(target_t *target) { watchpoint_t *watchpoint; - while ((watchpoint = target->watchpoints)!=NULL) + while ((watchpoint = target->watchpoints) != NULL) { watchpoint_free(target, watchpoint); } Modified: trunk/src/target/cortex_m3.c =================================================================== --- trunk/src/target/cortex_m3.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/cortex_m3.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -852,7 +852,7 @@ if (target->reset_halt) { int retval; - if ((retval = target_halt(target))!=ERROR_OK) + if ((retval = target_halt(target)) != ERROR_OK) return retval; } Modified: trunk/src/target/embeddedice.c =================================================================== --- trunk/src/target/embeddedice.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/embeddedice.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -125,7 +125,7 @@ /* identify EmbeddedICE version by reading DCC control register */ embeddedice_read_reg(®_list[EICE_COMMS_CTRL]); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) { for (i = 0; i < num_regs; i++) { @@ -204,7 +204,7 @@ reg_t *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL]; embeddedice_read_reg(dbg_ctrl); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; buf_set_u32(dbg_ctrl->value, 4, 1, 0); embeddedice_set_reg_w_exec(dbg_ctrl, dbg_ctrl->value); Modified: trunk/src/target/etm.c =================================================================== --- trunk/src/target/etm.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/etm.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -282,7 +282,7 @@ buf_set_u32(etm_ctrl_reg->value, 0, etm_ctrl_reg->size, etm_ctrl_value); etm_store_reg(etm_ctrl_reg); - if ((retval=jtag_execute_queue())!=ERROR_OK) + if ((retval=jtag_execute_queue()) != ERROR_OK) return retval; if ((retval=etm_ctx->capture_driver->init(etm_ctx)) != ERROR_OK) Modified: trunk/src/target/feroceon.c =================================================================== --- trunk/src/target/feroceon.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/feroceon.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -688,7 +688,7 @@ int retval; retval = arm9tdmi_examine(target); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; armv4_5 = target->arch_info; Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/image.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -64,7 +64,7 @@ } fileio_close(&fileio); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) return retval; /* check header against known signatures */ @@ -362,7 +362,7 @@ return ERROR_FILEIO_OPERATION_FAILED; } - if (strncmp((char*)elf->header->e_ident,ELFMAG,SELFMAG)!=0) + if (strncmp((char*)elf->header->e_ident,ELFMAG,SELFMAG) != 0) { LOG_ERROR("invalid ELF file, bad magic number"); return ERROR_IMAGE_FORMAT_ERROR; @@ -374,8 +374,8 @@ } elf->endianness = elf->header->e_ident[EI_DATA]; - if ((elf->endianness!=ELFDATA2LSB) - &&(elf->endianness!=ELFDATA2MSB)) + if ((elf->endianness != ELFDATA2LSB) + &&(elf->endianness != ELFDATA2MSB)) { LOG_ERROR("invalid ELF file, unknown endianess setting"); return ERROR_IMAGE_FORMAT_ERROR; Modified: trunk/src/target/mips_m4k.c =================================================================== --- trunk/src/target/mips_m4k.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/mips_m4k.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -314,7 +314,7 @@ if (target->reset_halt) { int retval; - if ((retval = target_halt(target))!=ERROR_OK) + if ((retval = target_halt(target)) != ERROR_OK) return retval; } Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/target.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -1088,7 +1088,7 @@ LOG_USER("target state: %s", Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name); - if (target->state!=TARGET_HALTED) + if (target->state != TARGET_HALTED) return ERROR_OK; retval=target->type->arch_state(target); @@ -1584,7 +1584,7 @@ static int prevPowerdropout = 0; int retval; - if ((retval=jtag_power_dropout(&powerDropout))!=ERROR_OK) + if ((retval=jtag_power_dropout(&powerDropout)) != ERROR_OK) return retval; int powerRestored; @@ -1603,7 +1603,7 @@ lastPower = current; } - if ((retval=jtag_srst_asserted(&srstAsserted))!=ERROR_OK) + if ((retval=jtag_srst_asserted(&srstAsserted)) != ERROR_OK) return retval; int srstDeasserted; @@ -1909,7 +1909,7 @@ for (;;) { - if ((retval=target_poll(target))!=ERROR_OK) + if ((retval=target_poll(target)) != ERROR_OK) return retval; if (target->state == state) { @@ -2872,7 +2872,7 @@ /*append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size) */ char *data=malloc(2*length); - if (data!=NULL) + if (data != NULL) { for (i=0; i<length;i++) { @@ -2903,7 +2903,7 @@ struct timeval timeout, now; gettimeofday(&timeout, NULL); - if (argc!=2) + if (argc != 2) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -2949,7 +2949,7 @@ retval=ERROR_OK; break; } - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { break; } @@ -3388,7 +3388,7 @@ e, Jim_Nvp_value2name_simple( nvp_target_event, e )->name, Jim_GetString( teap->body, NULL ) ); - if (Jim_EvalObj( interp, teap->body )!=JIM_OK) + if (Jim_EvalObj( interp, teap->body ) != JIM_OK) { Jim_PrintErrorMessage(interp); } @@ -4386,7 +4386,7 @@ static void free_fastload(void) { - if (fastload!=NULL) + if (fastload != NULL) { int i; for (i=0; i<fastload_num; i++) @@ -4504,7 +4504,7 @@ image_close(&image); - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { free_fastload(); } Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-23 22:37:56 UTC (rev 2362) +++ trunk/src/target/xscale.c 2009-06-23 22:38:12 UTC (rev 2363) @@ -889,7 +889,7 @@ retval=target_read_u32(target, 0xffff0000 + 4*i, &xscale->high_vectors[i]); if (retval == ERROR_TARGET_TIMEOUT) return retval; - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { /* Some of these reads will fail as part of normal execution */ xscale->high_vectors[i] = ARMV4_5_B(0xfffffe, 0); @@ -908,7 +908,7 @@ retval=target_read_u32(target, 0x0 + 4*i, &xscale->low_vectors[i]); if (retval == ERROR_TARGET_TIMEOUT) return retval; - if (retval!=ERROR_OK) + if (retval != ERROR_OK) { /* Some of these reads will fail as part of normal execution */ xscale->low_vectors[i] = ARMV4_5_B(0xfffffe, 0); @@ -1028,11 +1028,11 @@ /* clear external dbg break (will be written on next DCSR read) */ xscale->external_debug_break = 0; - if ((retval=xscale_read_dcsr(target))!=ERROR_OK) + if ((retval=xscale_read_dcsr(target)) != ERROR_OK) return retval; /* get r0, pc, r1 to r7 and cpsr */ - if ((retval=xscale_receive(target, buffer, 10))!=ERROR_OK) + if ((retval=xscale_receive(target, buffer, 10)) != ERROR_OK) return retval; /* move r0 from buffer to register cache */ @@ -1253,7 +1253,7 @@ } } - if ((retval=xscale_set_reg_u32(ibcr0, next_pc | 0x1))!=ERROR_OK) + if ((retval=xscale_set_reg_u32(ibcr0, next_pc | 0x1)) != ERROR_OK) return retval; return ERROR_OK; @@ -1266,7 +1266,7 @@ reg_t *ibcr0 = &xscale->reg_cache->reg_list[XSCALE_IBCR0]; int retval; - if ((retval=xscale_set_reg_u32(ibcr0, 0x0))!=ERROR_OK) + if ((retval=xscale_set_reg_u32(ibcr0, 0x0)) != ERROR_OK) return retval; return ERROR_OK; @@ -1297,7 +1297,7 @@ } /* update vector tables */ - if ((retval=xscale_update_vectors(target))!=ERROR_OK) + if ((retval=xscale_update_vectors(target)) != ERROR_OK) return retval; /* current = 1: continue on current pc, otherwise continue at <address> */ @@ -1451,56 +1451,56 @@ } LOG_DEBUG("enable single-step"); - if ((retval=xscale_enable_single_step(target, next_pc))!=ERROR_OK) + if ((retval=xscale_enable_single_step(target, next_pc)) != ERROR_OK) return retval; /* restore banked registers */ - if ((retval=xscale_restore_context(target))!=ERROR_OK) + if ((retval=xscale_restore_context(target)) != ERROR_OK) return retval; /* send resume request (command 0x30 or 0x31) * clean the trace buffer if it is to be enabled (0x62) */ if (xscale->trace.buffer_enabled) { - if ((retval=xscale_send_u32(target, 0x62))!=ERROR_OK) + if ((retval=xscale_send_u32(target, 0x62)) != ERROR_OK) return retval; - if ((retval=xscale_send_u32(target, 0x31))!=ERROR_OK) + if ((retval=xscale_send_u32(target, 0x31)) != ERROR_OK) return retval; } else - if ((retval=xscale_send_u32(target, 0x30))!=ERROR_OK) + if ((retval=xscale_send_u32(target, 0x30)) != ERROR_OK) return retval; /* send CPSR */ - if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32)))!=ERROR_OK) + if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32))) != ERROR_OK) return retval; LOG_DEBUG("writing cpsr with value 0x%8.8" PRIx32 "", buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32)); for (i = 7; i >= 0; i--) { /* send register */ - if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[i].value, 0, 32)))!=ERROR_OK) + if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[i].value, 0, 32))) != ERROR_OK) return retval; LOG_DEBUG("writing r%i with value 0x%8.8" PRIx32 "", i, buf_get_u32(armv4_5->core_cache->reg_list[i].value, 0, 32)); } /* send PC */ - if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32)))!=ERROR_OK) + if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32))) != ERROR_OK) return retval; LOG_DEBUG("writing PC with value 0x%8.8" PRIx32, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32)); target_call_event_callbacks(target, TARGET_EVENT_RESUMED); /* registers are now invalid */ - if ((retval=armv4_5_invalidate_core_regs(target))!=ERROR_OK) + if ((retval=armv4_5_invalidate_core_regs(target)) != ERROR_OK) return retval; /* wait for and process debug entry */ - if ((retval=xscale_debug_entry(target))!=ERROR_OK) + if ((retval=xscale_debug_entry(target)) != ERROR_OK) return retval; LOG_DEBUG("disable single-step"); - if ((retval=xscale_disable_single_step(target))!=ERROR_OK) + if ((retval=xscale_disable_single_step(target)) != ERROR_OK) return retval; target_call_event_callbacks(target, TARGET_EVENT_HALTED); @@ -1531,7 +1531,7 @@ /* if we're at the reset vector, we have to simulate the step */ if (current_pc == 0x0) { - if ((retval=arm_simulate_step(target, NULL))!=ERROR_OK) + if ((retval=arm_simulate_step(target, NULL)) != ERROR_OK) return retval; current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32); @@ -1545,7 +1545,7 @@ if (handle_breakpoints) if ((breakpoint = breakpoint_find(target, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32)))) { - if ((retval=xscale_unset_breakpoint(target, breakpoint))!=ERROR_OK) + if ((retval=xscale_unset_breakpoint(target, breakpoint)) != ERROR_OK) return retval; } @@ -1597,7 +1597,7 @@ if (target->reset_halt) { int retval; - if ((retval = target_halt(target))!=ERROR_OK) + if ((retval = target_halt(target)) != ERROR_OK) return retval; } @@ -1930,20 +1930,20 @@ return ERROR_TARGET_UNALIGNED_ACCESS; /* send memory read request (command 0x1n, n: access size) */ - if ((retval=xscale_send_u32(target, 0x10 | size))!=ERROR_OK) + if ((retval=xscale_send_u32(target, 0x10 | size)) != ERROR_OK) return retval; /* send base address for read request */ - if ((retval=xscale_send_u32(target, address))!=ERROR_OK) + if ((retval=xscale_send_u32(target, address)) != ERROR_OK) return retval; /* send number of requested data words */ - if ((retval=xscale_send_u32(target, count))!=ERROR_OK) + if ((retval=xscale_send_u32(target, count)) != ERROR_OK) return retval; /* receive data from target (count times 32-bit words in host endianness) */ buf32 = malloc(4 * count); - if ((retval=xscale_receive(target, buf32, count))!=ERROR_OK) + if ((retval=xscale_receive(target, buf32, count)) != ERROR_OK) return retval; /* extract data from host-endian buffer into byte stream */ @@ -1971,12 +1971,12 @@ free(buf32); /* examine DCSR, to see if Sticky Abort (SA) got set */ - if ((retval=xscale_read_dcsr(target))!=ERROR_OK) + if ((retval=xscale_read_dcsr(target)) != ERROR_OK) return retval; if (buf_get_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 5, 1) == 1) { /* clear SA bit */ - if ((retval=xscale_send_u32(target, 0x60))!=ERROR_OK) + if ((retval=xscale_send_u32(target, 0x60)) != ERROR_OK) return retval; return ERROR_TARGET_DATA_ABORT; @@ -2007,15 +2007,15 @@ return ERROR_TARGET_UNALIGNED_ACCESS; /* send memory write request (command 0x2n, n: access size) */ - if ((retval=xscale_send_u32(target, 0x20 | size))!=ERROR_OK) + if ((retval=xscale_send_u32(target, 0x20 | size)) != ERROR_OK) return retval; /* send base address for read request */ - if ((retval=xscale_send_u32(target, address))!=ERROR_OK) + if ((retval=xscale_send_u32(target, address)) != ERROR_OK) return retval; /* send number of requested data words to be written*/ - if ((retval=xscale_send_u32(target, count))!=ERROR_OK) + if ((retval=xscale_send_u32(target, count)) != ERROR_OK) return retval; /* extract data from host-endian buffer into byte stream */ @@ -2045,16 +2045,16 @@ } } #endif - if ((retval=xscale_send(target, buffer, count, size))!=ERROR_OK) + if ((retval=xscale_send(target, buffer, count, size)) != ERROR_OK) return retval; /* examine DCSR, to see if Sticky Abort (SA) got set */ - if ((retval=xscale_read_dcsr(target))!=ERROR_OK) + if ((retval=xscale_read_dcsr(target)) != ERROR_OK) return retval; if (buf_get_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 5, 1) == 1) { /* clear SA bit */ - if ((retval=xscale_send_u32(target, 0x60))!=ERROR_OK) + if ((retval=xscale_send_u32(target, 0x60)) != ERROR_OK) return retval; return ERROR_TARGET_DATA_ABORT; |
From: <zw...@ma...> - 2009-06-24 00:38:09
|
Author: zwelch Date: 2009-06-24 00:37:56 +0200 (Wed, 24 Jun 2009) New Revision: 2362 Modified: trunk/src/server/telnet_server.c trunk/src/target/image.c trunk/src/target/target.c Log: - Fixes '-=' whitespace - Replace '\(\w\)\(-=\)(' with '\1 \2 ('. - Replace '\(\w\)\(-=\)\(\w\)' with '\1 \2 \3'. Modified: trunk/src/server/telnet_server.c =================================================================== --- trunk/src/server/telnet_server.c 2009-06-23 22:37:49 UTC (rev 2361) +++ trunk/src/server/telnet_server.c 2009-06-23 22:37:56 UTC (rev 2362) @@ -120,7 +120,7 @@ /* clear the command line */ telnet_write(connection, "\r", 1); - for (i = strlen(t_con->prompt) + t_con->line_size; i>0; i-=16) + for (i = strlen(t_con->prompt) + t_con->line_size; i>0; i -= 16) telnet_write(connection, " ", i>16 ? 16 : i); telnet_write(connection, "\r", 1); Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-06-23 22:37:49 UTC (rev 2361) +++ trunk/src/target/image.c 2009-06-23 22:37:56 UTC (rev 2362) @@ -1022,7 +1022,7 @@ { run=32768; } - nbytes-=run; + nbytes -= run; while (run--) { /* as per gdb */ Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:37:49 UTC (rev 2361) +++ trunk/src/target/target.c 2009-06-23 22:37:56 UTC (rev 2362) @@ -2286,12 +2286,12 @@ { /* clip addresses below */ offset+=min_address-image.sections[i].base_address; - length-=offset; + length -= offset; } if (image.sections[i].base_address+buf_cnt>max_address) { - length-=(image.sections[i].base_address+buf_cnt)-max_address; + length -= (image.sections[i].base_address+buf_cnt)-max_address; } if ((retval = target_write_buffer(target, image.sections[i].base_address+offset, length, buffer+offset)) != ERROR_OK) @@ -4467,12 +4467,12 @@ { /* clip addresses below */ offset+=min_address-image.sections[i].base_address; - length-=offset; + length -= offset; } if (image.sections[i].base_address+buf_cnt>max_address) { - length-=(image.sections[i].base_address+buf_cnt)-max_address; + length -= (image.sections[i].base_address+buf_cnt)-max_address; } fastload[i].address=image.sections[i].base_address+offset; |
From: <zw...@ma...> - 2009-06-24 00:37:53
|
Author: zwelch Date: 2009-06-24 00:37:49 +0200 (Wed, 24 Jun 2009) New Revision: 2361 Modified: trunk/src/flash/avrf.c trunk/src/flash/lpc288x.c Log: - Replace 'do{' with 'do {'. - Replace '}while' with '} while'. Modified: trunk/src/flash/avrf.c =================================================================== --- trunk/src/flash/avrf.c 2009-06-23 22:37:21 UTC (rev 2360) +++ trunk/src/flash/avrf.c 2009-06-23 22:37:49 UTC (rev 2361) @@ -148,7 +148,7 @@ avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); - do{ + do { poll_value = 0; avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); if (ERROR_OK != mcu_execute_queue()) @@ -156,7 +156,7 @@ return ERROR_FAIL; } LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value); - }while (!(poll_value & 0x0200)); + } while (!(poll_value & 0x0200)); return ERROR_OK; } @@ -195,7 +195,7 @@ avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); - do{ + do { poll_value = 0; avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); if (ERROR_OK != mcu_execute_queue()) @@ -203,7 +203,7 @@ return ERROR_FAIL; } LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value); - }while (!(poll_value & 0x0200)); + } while (!(poll_value & 0x0200)); return ERROR_OK; } Modified: trunk/src/flash/lpc288x.c =================================================================== --- trunk/src/flash/lpc288x.c 2009-06-23 22:37:21 UTC (rev 2360) +++ trunk/src/flash/lpc288x.c 2009-06-23 22:37:49 UTC (rev 2361) @@ -127,7 +127,7 @@ alive_sleep(1); timeout--; target_read_u32(target, F_STAT, &status); - }while (((status & FS_DONE) == 0) && timeout); + } while (((status & FS_DONE) == 0) && timeout); if (timeout == 0) { |
From: <zw...@ma...> - 2009-06-24 00:37:44
|
Author: zwelch Date: 2009-06-24 00:37:21 +0200 (Wed, 24 Jun 2009) New Revision: 2360 Modified: trunk/src/flash/cfi.c trunk/src/flash/flash.c trunk/src/flash/nand_ecc.c trunk/src/flash/pic32mx.c trunk/src/helper/jim.c trunk/src/helper/options.c trunk/src/jtag/core.c trunk/src/jtag/interface.c trunk/src/jtag/rlink/rlink.c trunk/src/jtag/tcl.c trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c trunk/src/server/gdb_server.c trunk/src/target/mips_m4k.c trunk/src/target/target.c trunk/src/target/xscale.c trunk/src/xsvf/xsvf.c trunk/testing/examples/PIC32/BlinkingLeds.c Log: - Replace 'for(' with 'for ('. Modified: trunk/src/flash/cfi.c =================================================================== --- trunk/src/flash/cfi.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/flash/cfi.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -212,7 +212,7 @@ if (cfi_info->x16_as_x8) { uint8_t i; - for(i=0;i<2;i++) + for (i=0;i<2;i++) target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, &data[i*bank->bus_width] ); } @@ -234,7 +234,7 @@ if (cfi_info->x16_as_x8) { uint8_t i; - for(i=0;i<4;i++) + for (i=0;i<4;i++) target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, &data[i*bank->bus_width] ); } Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/flash/flash.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -770,13 +770,13 @@ switch (wordsize) { case 4: - for(i = 0; i < chunk_count; i++) + for (i = 0; i < chunk_count; i++) { target_buffer_set_u32(target, chunk + i * wordsize, pattern); } break; case 2: - for(i = 0; i < chunk_count; i++) + for (i = 0; i < chunk_count; i++) { target_buffer_set_u16(target, chunk + i * wordsize, pattern); } Modified: trunk/src/flash/nand_ecc.c =================================================================== --- trunk/src/flash/nand_ecc.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/flash/nand_ecc.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -77,7 +77,7 @@ reg1 = reg2 = reg3 = 0; /* Build up column parity */ - for(i = 0; i < 256; i++) { + for (i = 0; i < 256; i++) { /* Get CP0 - CP5 from table */ idx = nand_ecc_precalc_table[*dat++]; reg1 ^= (idx & 0x3f); Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/flash/pic32mx.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -620,7 +620,7 @@ num_pages = 12; } else { /* 0xBD000000: Program flash size varies with device */ - for(i=0; pic32mx_devs[i].name != NULL; i++) + for (i=0; pic32mx_devs[i].name != NULL; i++) if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) { num_pages = pic32mx_devs[i].pfm_size; break; @@ -704,7 +704,7 @@ PIC32MX_MANUF_ID); return ERROR_FLASH_OPERATION_FAILED; } - for(i=0; pic32mx_devs[i].name != NULL; i++) + for (i=0; pic32mx_devs[i].name != NULL; i++) if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) { printed = snprintf(buf, buf_size, "PIC32MX%s", pic32mx_devs[i].name); break; Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/helper/jim.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -504,7 +504,7 @@ { jim_wide i, res = 1; if ((b==0 && e!=0) || (e<0)) return 0; - for(i=0; i<e; i++) {res *= b;} + for (i=0; i<e; i++) {res *= b;} return res; } @@ -10425,7 +10425,7 @@ script = caseList[i+1]; } } - for(; i < patCount && Jim_CompareStringImmediate(interp, script, "-"); + for (; i < patCount && Jim_CompareStringImmediate(interp, script, "-"); i += 2) script = caseList[i+1]; if (script && Jim_CompareStringImmediate(interp, script, "-")) { @@ -12599,7 +12599,7 @@ int x; Jim_fprintf( p->interp, p->interp->cookie_stderr, "---args---\n"); - for( x = 0 ; x < p->argc ; x++ ){ + for ( x = 0 ; x < p->argc ; x++ ){ Jim_fprintf( p->interp, p->interp->cookie_stderr, "%2d) %s\n", x, @@ -12823,7 +12823,7 @@ } debug_string_obj = Jim_NewEmptyStringObj( interp ); - for( x = 0 ; x < argc ; x++ ){ + for ( x = 0 ; x < argc ; x++ ){ Jim_AppendStrings( interp, debug_string_obj, Jim_GetString( argv[x], NULL ), Modified: trunk/src/helper/options.c =================================================================== --- trunk/src/helper/options.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/helper/options.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -90,7 +90,7 @@ GetModuleFileName (NULL, strExePath, MAX_PATH); *strrchr(strExePath, '\\')=0; strcat(strExePath, "/../lib/"PACKAGE); - for(p=strExePath; *p; p++) { + for (p=strExePath; *p; p++) { if (*p == '\\') *p = '/'; } Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/jtag/core.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -1024,7 +1024,7 @@ tap = NULL; total_ir_length = 0; - for(;;){ + for (;;){ tap = jtag_tap_next_enabled(tap); if ( tap == NULL ){ break; @@ -1048,7 +1048,7 @@ tap = NULL; chain_pos = 0; int val; - for(;;){ + for (;;){ tap = jtag_tap_next_enabled(tap); if ( tap == NULL ){ break; Modified: trunk/src/jtag/interface.c =================================================================== --- trunk/src/jtag/interface.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/jtag/interface.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -359,7 +359,7 @@ { tap_state_t x; - for( x = 0 ; x < TAP_NUM_STATES ; x++ ){ + for ( x = 0 ; x < TAP_NUM_STATES ; x++ ){ /* be nice to the human */ if ( 0 == strcasecmp( name, tap_state_name(x) ) ){ return x; @@ -403,9 +403,9 @@ DEBUG_JTAG_IO("TAP/SM: TMS bits: %u (bytes: %u)", tap_bits, tap_bytes); tap_out_bits = 0; - for(cur_byte = 0; cur_byte < tap_bytes; cur_byte++) + for (cur_byte = 0; cur_byte < tap_bytes; cur_byte++) { - for(cur_bit = 0; cur_bit < 8; cur_bit++) + for (cur_bit = 0; cur_bit < 8; cur_bit++) { // make sure we do not run off the end of the buffers unsigned tap_bit = cur_byte * 8 + cur_bit; Modified: trunk/src/jtag/rlink/rlink.c =================================================================== --- trunk/src/jtag/rlink/rlink.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/jtag/rlink/rlink.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -518,7 +518,7 @@ /* Wait for DTC to finish running command buffer */ - for(i = 10;;) { + for (i = 10;;) { usb_err = ep1_generic_commandl( pHDev, 4, @@ -711,7 +711,7 @@ /* The rigamarole with the masks and doing it bit-by-bit is due to the fact that the scan buffer is LSb-first and the DTC code is MSb-first for hardware reasons. It was that or craft a function to do the reversal, and that wouldn't work with bit-stuffing (supplying extra bits to use mostly byte operations), or any other scheme which would throw the byte alignment off. */ - for( + for ( rq_p = dtc_queue.rq_head; rq_p != NULL; rq_p = rq_next @@ -726,7 +726,7 @@ dtc_mask = 1 << (8 - 1); - for( + for ( ; bit_cnt; bit_cnt-- @@ -764,7 +764,7 @@ dtc_mask = 1 << (bit_cnt - 1); } - for( + for ( ; bit_cnt; bit_cnt-- @@ -834,7 +834,7 @@ if (!tap_state_queue.length) return(retval); bits = 1; byte = 0; - for(i = tap_state_queue.length; i--;) { + for (i = tap_state_queue.length; i--;) { byte <<= 1; if (tap_state_queue.buffer & 1) { @@ -1140,7 +1140,7 @@ buffer[scan_size / 8] &= ((1 << ((scan_size - 1) % 8) + 1) - 1); printf("before scan:"); - for(i = 0; i < (scan_size + 7) / 8; i++) { + for (i = 0; i < (scan_size + 7) / 8; i++) { printf(" %02x", buffer[i]); } printf("\n"); @@ -1503,7 +1503,7 @@ speed = rlink_speed_table[rlink_speed_table_size - 1].prescaler; } - for(i = rlink_speed_table_size; i--; ) { + for (i = rlink_speed_table_size; i--; ) { if (rlink_speed_table[i].prescaler == speed) { if (dtc_load_from_buffer(pHDev, rlink_speed_table[i].dtc, rlink_speed_table[i].dtc_size) != 0) { LOG_ERROR("An error occurred while trying to load DTC code for speed \"%d\".\n", speed); @@ -1534,7 +1534,7 @@ ) { int i; - for(i = rlink_speed_table_size; i--; ) { + for (i = rlink_speed_table_size; i--; ) { if (rlink_speed_table[i].prescaler == speed) { *khz = rlink_speed_table[i].khz; return(ERROR_OK); @@ -1558,7 +1558,7 @@ return ERROR_FAIL; } - for(i = rlink_speed_table_size; i--; ) { + for (i = rlink_speed_table_size; i--; ) { if (rlink_speed_table[i].khz <= khz) { *speed = rlink_speed_table[i].prescaler; return(ERROR_OK); @@ -1630,11 +1630,11 @@ busses = usb_get_busses(); - for(bus = busses; bus; bus = bus->next) + for (bus = busses; bus; bus = bus->next) { struct usb_device *dev; - for(dev = bus->devices; dev; dev = dev->next) + for (dev = bus->devices; dev; dev = dev->next) { if ( (dev->descriptor.idVendor == USB_IDVENDOR) && (dev->descriptor.idProduct == USB_IDPRODUCT) ) { @@ -1715,7 +1715,7 @@ /* The device starts out in an unknown state on open. As such, result reads time out, and it's not even known whether the command was accepted. So, for this first command, we issue it repeatedly until its response doesn't time out. Also, if sending a command is going to time out, we'll find that out here. */ /* It must be possible to open the device in such a way that this special magic isn't needed, but, so far, it escapes us. */ - for(i = 0; i < 5; i++) { + for (i = 0; i < 5; i++) { j = ep1_generic_commandl( pHDev, 1, EP1_CMD_GET_FWREV Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/jtag/tcl.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -1181,7 +1181,7 @@ const char *cpA; const char *cpS; cpA = args[ argc-1 ]; - for( endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++ ){ + for ( endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++ ){ cpS = tap_state_name( endstate ); if ( 0 == strcmp( cpA, cpS ) ){ break; Modified: trunk/src/jtag/zy1000/jtag_minidriver.h =================================================================== --- trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/jtag/zy1000/jtag_minidriver.h 2009-06-23 22:37:21 UTC (rev 2360) @@ -157,7 +157,7 @@ enum tap_state pause_state = TAP_DRSHIFT; jtag_tap_t *tap, *nextTap; - for(tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) + for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) { nextTap=jtag_tap_next_enabled(tap); if (nextTap==NULL) Modified: trunk/src/jtag/zy1000/zy1000.c =================================================================== --- trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/jtag/zy1000/zy1000.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -494,7 +494,7 @@ int j; int scan_size = 0; jtag_tap_t *tap, *nextTap; - for(tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) + for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) { nextTap=jtag_tap_next_enabled(tap); tap_state_t end_state; @@ -563,7 +563,7 @@ int j; jtag_tap_t *tap, *nextTap; - for(tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) + for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) { nextTap=jtag_tap_next_enabled(tap); int found=0; Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/server/gdb_server.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -2041,7 +2041,7 @@ // binary packets spew junk into the debug log stream char buf[ 50 ]; int x; - for( x = 0 ; (x < 49) && (packet[x] != ':') ; x++ ){ + for ( x = 0 ; (x < 49) && (packet[x] != ':') ; x++ ){ buf[x] = packet[x]; } buf[x] = 0; Modified: trunk/src/target/mips_m4k.c =================================================================== --- trunk/src/target/mips_m4k.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/target/mips_m4k.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -763,7 +763,7 @@ uint32_t i, t32; uint16_t t16; - for(i = 0; i < (count*size); i += size) + for (i = 0; i < (count*size); i += size) { switch (size) { @@ -808,7 +808,7 @@ uint32_t i, t32; uint16_t t16; - for(i = 0; i < (count*size); i += size) + for (i = 0; i < (count*size); i += size) { switch (size) { Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/target/target.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -3829,7 +3829,7 @@ b = 1; break; } - for( x = 0 ; x < c ; x++ ){ + for ( x = 0 ; x < c ; x++ ){ e = target_write_memory( target, a, b, 1, target_buf ); if ( e != ERROR_OK ){ Jim_SetResult_sprintf( interp, "Error writing @ 0x%08x: %d\n", (int)(a), e ); @@ -3895,36 +3895,36 @@ Jim_fprintf( interp, interp->cookie_stdout, "0x%08x ", (int)(a) ); switch ( b ){ case 4: - for( x = 0 ; (x < 16) && (x < y) ; x += 4 ){ + for ( x = 0 ; (x < 16) && (x < y) ; x += 4 ){ z = target_buffer_get_u32( target, &(target_buf[ x * 4 ]) ); Jim_fprintf( interp, interp->cookie_stdout, "%08x ", (int)(z) ); } - for( ; (x < 16) ; x += 4 ){ + for ( ; (x < 16) ; x += 4 ){ Jim_fprintf( interp, interp->cookie_stdout, " " ); } break; case 2: - for( x = 0 ; (x < 16) && (x < y) ; x += 2 ){ + for ( x = 0 ; (x < 16) && (x < y) ; x += 2 ){ z = target_buffer_get_u16( target, &(target_buf[ x * 2 ]) ); Jim_fprintf( interp, interp->cookie_stdout, "%04x ", (int)(z) ); } - for( ; (x < 16) ; x += 2 ){ + for ( ; (x < 16) ; x += 2 ){ Jim_fprintf( interp, interp->cookie_stdout, " " ); } break; case 1: default: - for( x = 0 ; (x < 16) && (x < y) ; x += 1 ){ + for ( x = 0 ; (x < 16) && (x < y) ; x += 1 ){ z = target_buffer_get_u8( target, &(target_buf[ x * 4 ]) ); Jim_fprintf( interp, interp->cookie_stdout, "%02x ", (int)(z) ); } - for( ; (x < 16) ; x += 1 ){ + for ( ; (x < 16) ; x += 1 ){ Jim_fprintf( interp, interp->cookie_stdout, " " ); } break; } /* ascii-ify the bytes */ - for( x = 0 ; x < y ; x++ ){ + for ( x = 0 ; x < y ; x++ ){ if ( (target_buf[x] >= 0x20) && (target_buf[x] <= 0x7e) ){ /* good */ @@ -4132,7 +4132,7 @@ e = Jim_GetOpt_String( goi, &cp2, NULL ); cp = cp2; /* now does target type exist */ - for( x = 0 ; target_types[x] ; x++ ){ + for ( x = 0 ; target_types[x] ; x++ ){ if ( 0 == strcmp( cp, target_types[x]->name ) ){ /* found */ break; @@ -4140,7 +4140,7 @@ } if ( target_types[x] == NULL ){ Jim_SetResult_sprintf( goi->interp, "Unknown target type %s, try one of ", cp ); - for( x = 0 ; target_types[x] ; x++ ){ + for ( x = 0 ; target_types[x] ; x++ ){ if ( target_types[x+1] ){ Jim_AppendStrings( goi->interp, Jim_GetResult(goi->interp), @@ -4313,7 +4313,7 @@ return JIM_ERR; } Jim_SetResult( goi.interp, Jim_NewListObj( goi.interp, NULL, 0 ) ); - for( x = 0 ; target_types[x] ; x++ ){ + for ( x = 0 ; target_types[x] ; x++ ){ Jim_ListAppendElement( goi.interp, Jim_GetResult(goi.interp), Jim_NewStringObj( goi.interp, target_types[x]->name, -1 ) ); Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/target/xscale.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -1783,7 +1783,7 @@ * we can't enter User mode on an XScale (unpredictable), * but User shares registers with SYS */ - for(i = 1; i < 7; i++) + for (i = 1; i < 7; i++) { int valid = 1; @@ -1855,7 +1855,7 @@ * we can't enter User mode on an XScale (unpredictable), * but User shares registers with SYS */ - for(i = 1; i < 7; i++) + for (i = 1; i < 7; i++) { int dirty = 0; Modified: trunk/src/xsvf/xsvf.c =================================================================== --- trunk/src/xsvf/xsvf.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/src/xsvf/xsvf.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -366,7 +366,7 @@ LOG_DEBUG("%s %d", op_name, xsdrsize); - for( attempt=0; attempt<limit; ++attempt ) + for ( attempt=0; attempt<limit; ++attempt ) { scan_field_t field; @@ -836,7 +836,7 @@ if (limit < 1) limit = 1; - for( attempt=0; attempt<limit; ++attempt ) + for ( attempt=0; attempt<limit; ++attempt ) { scan_field_t field; Modified: trunk/testing/examples/PIC32/BlinkingLeds.c =================================================================== --- trunk/testing/examples/PIC32/BlinkingLeds.c 2009-06-23 22:36:56 UTC (rev 2359) +++ trunk/testing/examples/PIC32/BlinkingLeds.c 2009-06-23 22:37:21 UTC (rev 2360) @@ -11,11 +11,11 @@ while (1) { - for(i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) mPORTDToggleBits(BIT_0); - for(i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) mPORTDToggleBits(BIT_1); - for(i = 0; i < 500000; i++) + for (i = 0; i < 500000; i++) mPORTDToggleBits(BIT_2); } |