* 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., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
/* Constants for AICE command format length */
static const int32_t AICE_FORMAT_HTDA = 3;
-static const int32_t AICE_FORMAT_HTDB = 6;
static const int32_t AICE_FORMAT_HTDC = 7;
-static const int32_t AICE_FORMAT_HTDD = 10;
static const int32_t AICE_FORMAT_HTDMA = 4;
static const int32_t AICE_FORMAT_HTDMB = 8;
static const int32_t AICE_FORMAT_HTDMC = 8;
/* Constants for AICE command */
static const uint8_t AICE_CMD_SCAN_CHAIN = 0x00;
-static const uint8_t AICE_CMD_SELECT_TARGET = 0x01;
-static const uint8_t AICE_CMD_READ_DIM = 0x02;
-static const uint8_t AICE_CMD_READ_EDMSR = 0x03;
-static const uint8_t AICE_CMD_READ_DTR = 0x04;
-static const uint8_t AICE_CMD_READ_MEM = 0x05;
-static const uint8_t AICE_CMD_READ_MISC = 0x06;
-static const uint8_t AICE_CMD_FASTREAD_MEM = 0x07;
-static const uint8_t AICE_CMD_WRITE_DIM = 0x08;
-static const uint8_t AICE_CMD_WRITE_EDMSR = 0x09;
-static const uint8_t AICE_CMD_WRITE_DTR = 0x0A;
-static const uint8_t AICE_CMD_WRITE_MEM = 0x0B;
-static const uint8_t AICE_CMD_WRITE_MISC = 0x0C;
-static const uint8_t AICE_CMD_FASTWRITE_MEM = 0x0D;
-static const uint8_t AICE_CMD_EXECUTE = 0x0E;
-static const uint8_t AICE_CMD_READ_MEM_B = 0x14;
-static const uint8_t AICE_CMD_READ_MEM_H = 0x15;
static const uint8_t AICE_CMD_T_READ_MISC = 0x20;
static const uint8_t AICE_CMD_T_READ_EDMSR = 0x21;
static const uint8_t AICE_CMD_T_READ_DTR = 0x22;
-static const uint8_t AICE_CMD_T_READ_DIM = 0x23;
static const uint8_t AICE_CMD_T_READ_MEM_B = 0x24;
static const uint8_t AICE_CMD_T_READ_MEM_H = 0x25;
static const uint8_t AICE_CMD_T_READ_MEM = 0x26;
static const uint8_t AICE_CMD_T_WRITE_MEM_H = 0x2D;
static const uint8_t AICE_CMD_T_WRITE_MEM = 0x2E;
static const uint8_t AICE_CMD_T_FASTWRITE_MEM = 0x2F;
-static const uint8_t AICE_CMD_T_GET_TRACE_STATUS = 0x36;
static const uint8_t AICE_CMD_T_EXECUTE = 0x3E;
-static const uint8_t AICE_CMD_AICE_PROGRAM_READ = 0x40;
-static const uint8_t AICE_CMD_AICE_PROGRAM_WRITE = 0x41;
-static const uint8_t AICE_CMD_AICE_PROGRAM_CONTROL = 0x42;
static const uint8_t AICE_CMD_READ_CTRL = 0x50;
static const uint8_t AICE_CMD_WRITE_CTRL = 0x51;
static const uint8_t AICE_CMD_BATCH_BUFFER_READ = 0x60;
if ((i % 30) == 0)
keep_alive();
- long long then = 0;
+ int64_t then = 0;
if (i == aice_count_to_check_dbger)
then = timeval_ms();
if (i >= aice_count_to_check_dbger) {
const uint16_t pids[] = { param->pid, 0 };
struct jtag_libusb_device_handle *devh;
- if (jtag_libusb_open(vids, pids, &devh) != ERROR_OK)
+ if (jtag_libusb_open(vids, pids, NULL, &devh) != ERROR_OK)
return ERROR_FAIL;
/* BE ***VERY CAREFUL*** ABOUT MAKING CHANGES IN THIS
/* reopen jlink after usb_reset
* on win32 this may take a second or two to re-enumerate */
int retval;
- while ((retval = jtag_libusb_open(vids, pids, &devh)) != ERROR_OK) {
+ while ((retval = jtag_libusb_open(vids, pids, NULL, &devh)) != ERROR_OK) {
usleep(1000);
timeout--;
if (!timeout)
#endif
/* usb_set_configuration required under win32 */
- struct jtag_libusb_device *udev = jtag_libusb_get_device(devh);
jtag_libusb_set_configuration(devh, 0);
jtag_libusb_claim_interface(devh, 0);
unsigned int aice_read_ep;
unsigned int aice_write_ep;
- jtag_libusb_get_endpoints(udev, &aice_read_ep, &aice_write_ep);
+
+ jtag_libusb_choose_interface(devh, &aice_read_ep, &aice_write_ep, -1, -1, -1, LIBUSB_TRANSFER_TYPE_BULK);
+ LOG_DEBUG("aice_read_ep=0x%x, aice_write_ep=0x%x", aice_read_ep, aice_write_ep);
aice_handler.usb_read_ep = aice_read_ep;
aice_handler.usb_write_ep = aice_write_ep;
static int aice_usb_set_clock(int set_clock)
{
- if (aice_write_ctrl(AICE_WRITE_CTRL_TCK_CONTROL,
- AICE_TCK_CONTROL_TCK_SCAN) != ERROR_OK)
- return ERROR_FAIL;
+ if (set_clock & AICE_TCK_CONTROL_TCK_SCAN) {
+ if (aice_write_ctrl(AICE_WRITE_CTRL_TCK_CONTROL,
+ AICE_TCK_CONTROL_TCK_SCAN) != ERROR_OK)
+ return ERROR_FAIL;
- /* Read out TCK_SCAN clock value */
- uint32_t scan_clock;
- if (aice_read_ctrl(AICE_READ_CTRL_GET_ICE_STATE, &scan_clock) != ERROR_OK)
- return ERROR_FAIL;
+ /* Read out TCK_SCAN clock value */
+ uint32_t scan_clock;
+ if (aice_read_ctrl(AICE_READ_CTRL_GET_ICE_STATE, &scan_clock) != ERROR_OK)
+ return ERROR_FAIL;
- scan_clock &= 0x0F;
+ scan_clock &= 0x0F;
- uint32_t scan_base_freq;
- if (scan_clock & 0x8)
- scan_base_freq = 48000; /* 48 MHz */
- else
- scan_base_freq = 30000; /* 30 MHz */
+ uint32_t scan_base_freq;
+ if (scan_clock & 0x8)
+ scan_base_freq = 48000; /* 48 MHz */
+ else
+ scan_base_freq = 30000; /* 30 MHz */
- uint32_t set_base_freq;
- if (set_clock & 0x8)
- set_base_freq = 48000;
- else
- set_base_freq = 30000;
+ uint32_t set_base_freq;
+ if (set_clock & 0x8)
+ set_base_freq = 48000;
+ else
+ set_base_freq = 30000;
- uint32_t set_freq;
- uint32_t scan_freq;
- set_freq = set_base_freq >> (set_clock & 0x7);
- scan_freq = scan_base_freq >> (scan_clock & 0x7);
+ uint32_t set_freq;
+ uint32_t scan_freq;
+ set_freq = set_base_freq >> (set_clock & 0x7);
+ scan_freq = scan_base_freq >> (scan_clock & 0x7);
- if (scan_freq < set_freq) {
- LOG_ERROR("User specifies higher jtag clock than TCK_SCAN clock");
- return ERROR_FAIL;
+ if (scan_freq < set_freq) {
+ LOG_ERROR("User specifies higher jtag clock than TCK_SCAN clock");
+ return ERROR_FAIL;
+ }
}
if (aice_write_ctrl(AICE_WRITE_CTRL_TCK_CONTROL, set_clock) != ERROR_OK)
if (AICE_TARGET_HALTED == state)
break;
- long long then = 0;
+ int64_t then = 0;
if (i == 30)
then = timeval_ms();
return ERROR_OK;
}
-static int aice_usb_read_tlb(uint32_t coreid, uint32_t virtual_address,
- uint32_t *physical_address)
+static int aice_usb_read_tlb(uint32_t coreid, target_addr_t virtual_address,
+ target_addr_t *physical_address)
{
- LOG_DEBUG("aice_usb_read_tlb, virtual address: 0x%08" PRIx32, virtual_address);
+ LOG_DEBUG("aice_usb_read_tlb, virtual address: 0x%08" TARGET_PRIxADDR, virtual_address);
uint32_t instructions[4];
uint32_t probe_result;