ft2232: cleanup

Previous patch somehow made GCC lose some of its cookies;
work around, zero-init that struct.

Clean up code from the previous patch.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
David Brownell 2009-11-04 21:41:08 -08:00
parent 2970696e89
commit 2d9863e121
1 changed files with 83 additions and 96 deletions

View File

@ -3256,7 +3256,7 @@ static int signalyzer_h_init(void)
char *end_of_desc; char *end_of_desc;
uint16_t read_buf[12]; uint16_t read_buf[12] = { 0 };
uint8_t buf[3]; uint8_t buf[3];
uint32_t bytes_written; uint32_t bytes_written;
@ -3922,7 +3922,7 @@ static int ktlink_init(void)
buf[2] = low_direction; buf[2] = low_direction;
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{ {
LOG_ERROR("couldn't initialize FT2232 with 'ktlink' layout"); LOG_ERROR("couldn't initialize FT2232 with 'ktlink' layout");
return ERROR_JTAG_INIT_FAILED; return ERROR_JTAG_INIT_FAILED;
@ -3938,24 +3938,18 @@ static int ktlink_init(void)
enum reset_types jtag_reset_config = jtag_get_reset_config(); enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) {
{
high_output |= nTRSTnOE; high_output |= nTRSTnOE;
high_output &= ~nTRST; high_output &= ~nTRST;
} } else {
else
{
high_output &= ~nTRSTnOE; high_output &= ~nTRSTnOE;
high_output |= nTRST; high_output |= nTRST;
} }
if (jtag_reset_config & RESET_SRST_PUSH_PULL) if (jtag_reset_config & RESET_SRST_PUSH_PULL) {
{
high_output &= ~nSRSTnOE; high_output &= ~nSRSTnOE;
high_output |= nSRST; high_output |= nSRST;
} } else {
else
{
high_output |= nSRSTnOE; high_output |= nSRSTnOE;
high_output &= ~nSRST; high_output &= ~nSRST;
} }
@ -3966,7 +3960,7 @@ static int ktlink_init(void)
buf[2] = high_direction; buf[2] = high_direction;
LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
{ {
LOG_ERROR("couldn't initialize FT2232 with 'ktlink' layout"); LOG_ERROR("couldn't initialize FT2232 with 'ktlink' layout");
return ERROR_JTAG_INIT_FAILED; return ERROR_JTAG_INIT_FAILED;
@ -3979,30 +3973,24 @@ static void ktlink_reset(int trst, int srst)
{ {
enum reset_types jtag_reset_config = jtag_get_reset_config(); enum reset_types jtag_reset_config = jtag_get_reset_config();
if (trst == 1) if (trst == 1) {
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
high_output &= ~nTRSTnOE; high_output &= ~nTRSTnOE;
else else
high_output &= ~nTRST; high_output &= ~nTRST;
} } else if (trst == 0) {
else if (trst == 0)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
high_output |= nTRSTnOE; high_output |= nTRSTnOE;
else else
high_output |= nTRST; high_output |= nTRST;
} }
if (srst == 1) if (srst == 1) {
{
if (jtag_reset_config & RESET_SRST_PUSH_PULL) if (jtag_reset_config & RESET_SRST_PUSH_PULL)
high_output &= ~nSRST; high_output &= ~nSRST;
else else
high_output &= ~nSRSTnOE; high_output &= ~nSRSTnOE;
} } else if (srst == 0) {
else if (srst == 0)
{
if (jtag_reset_config & RESET_SRST_PUSH_PULL) if (jtag_reset_config & RESET_SRST_PUSH_PULL)
high_output |= nSRST; high_output |= nSRST;
else else
@ -4017,7 +4005,7 @@ static void ktlink_reset(int trst, int srst)
static void ktlink_blink(void) static void ktlink_blink(void)
{ {
/*LED connected to ACBUS7 */ /* LED connected to ACBUS7 */
if (high_output & 0x80) if (high_output & 0x80)
high_output &= 0x7F; high_output &= 0x7F;
else else
@ -4027,4 +4015,3 @@ static void ktlink_blink(void)
buffer_write(high_output); buffer_write(high_output);
buffer_write(high_direction); buffer_write(high_direction);
} }