Line 1... |
Line 1... |
/* rsp-server.c -- Remote Serial Protocol server for GDB
|
/* rsp-server.c -- Remote Serial Protocol server for GDB
|
|
|
Copyright (C) 2008 Embecosm Limited
|
Copyright (C) 2008 Embecosm Limited
|
|
Copyright (C) 2008-2010 Nathan Yawn <nyawn@opencores.net>
|
|
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
|
|
This file was part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
|
This file was part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
|
Adapted for adv_jtag_bridge by Nathan Yawn <nyawn@opencores.org>
|
Adapted for adv_jtag_bridge by Nathan Yawn
|
|
|
This program is free software; you can redistribute it and/or modify it
|
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
|
under the terms of the GNU General Public License as published by the Free
|
Software Foundation; either version 3 of the License, or (at your option)
|
Software Foundation; either version 3 of the License, or (at your option)
|
any later version.
|
any later version.
|
Line 2850... |
Line 2851... |
}
|
}
|
|
|
local_state = target_handler_state;
|
local_state = target_handler_state;
|
pthread_mutex_unlock(&target_handler_mutex);
|
pthread_mutex_unlock(&target_handler_mutex);
|
|
|
|
|
|
|
if(local_state == 1) // Then start target polling loop, but keep checking for DETACH. State 1 == GO
|
if(local_state == 1) // Then start target polling loop, but keep checking for DETACH. State 1 == GO
|
{
|
{
|
while(1)
|
while(1)
|
{
|
{
|
// non-blocking check for DETACH signal
|
// non-blocking check for DETACH signal
|
Line 2897... |
Line 2900... |
pthread_mutex_unlock(&target_handler_mutex);
|
pthread_mutex_unlock(&target_handler_mutex);
|
|
|
break; // Stop polling, block on the next GO/DETACH
|
break; // Stop polling, block on the next GO/DETACH
|
}
|
}
|
}
|
}
|
usleep(250000); // This thread make rsp handle too slow, so sleep a little bit longer
|
|
|
usleep(250000); // wait 1/4 second before polling again.
|
}
|
}
|
} else {
|
}
|
|
|
|
else
|
|
{
|
fprintf(stderr, "Unknown command 0x%X received by target handler thread\n", local_state);
|
fprintf(stderr, "Unknown command 0x%X received by target handler thread\n", local_state);
|
pthread_mutex_lock(&target_handler_mutex); // Set our own state back to STOP
|
pthread_mutex_lock(&target_handler_mutex); // Set our own state back to STOP
|
target_handler_state = 0;
|
target_handler_state = 0;
|
pthread_mutex_unlock(&target_handler_mutex);
|
pthread_mutex_unlock(&target_handler_mutex);
|
}
|
}
|