544 lines
18 KiB
Plaintext
544 lines
18 KiB
Plaintext
From 4d3142a06baa820186fb26eb441baab091a41715 Mon Sep 17 00:00:00 2001
|
|
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
|
Date: Sun, 12 Aug 2018 15:24:16 +0200
|
|
Subject: Fix python path
|
|
|
|
|
|
diff --git a/src/ec2drv/csv2c.py b/src/ec2drv/csv2c.py
|
|
index 65ca8f6..029a473 100755
|
|
--- a/src/ec2drv/csv2c.py
|
|
+++ b/src/ec2drv/csv2c.py
|
|
@@ -1,4 +1,4 @@
|
|
-#!/usr/bin/python
|
|
+#!python
|
|
# cvs2c
|
|
# csv converter for devices table to c table
|
|
#
|
|
--
|
|
2.16.4
|
|
|
|
|
|
From c84048849d8d96e1523478e8e360ce9922bac966 Mon Sep 17 00:00:00 2001
|
|
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
|
Date: Sun, 12 Aug 2018 15:24:24 +0200
|
|
Subject: Do not use "read_port"
|
|
|
|
It overrides the kernel kit one, making everything crash on startup, of
|
|
course.
|
|
|
|
diff --git a/src/devel-tools/playback-comms.cpp b/src/devel-tools/playback-comms.cpp
|
|
index f9de0a3..2652d0b 100644
|
|
--- a/src/devel-tools/playback-comms.cpp
|
|
+++ b/src/devel-tools/playback-comms.cpp
|
|
@@ -94,7 +94,7 @@ void Ec2Sim::go()
|
|
{
|
|
cout << "waiting for : ";
|
|
print_vec( mSimData[i].tx );
|
|
- while(!read_port( buf,mSimData[i].tx.size()) );
|
|
+ while(!read_ec2_port( buf,mSimData[i].tx.size()) );
|
|
|
|
for(unsigned int j=0; j<mSimData[i].rx.size(); j++)
|
|
buf[j] = mSimData[i].rx[j];
|
|
@@ -103,7 +103,7 @@ void Ec2Sim::go()
|
|
|
|
while(1)
|
|
{
|
|
- while(!read_port( buf,0x0C) );
|
|
+ while(!read_ec2_port( buf,0x0C) );
|
|
}
|
|
}
|
|
|
|
@@ -178,16 +178,16 @@ bool Ec2Sim::write_port( char *buf, int len )
|
|
return true;
|
|
}
|
|
|
|
-int Ec2Sim::read_port_ch()
|
|
+int Ec2Sim::read_ec2_port_ch()
|
|
{
|
|
char ch;
|
|
- if( read_port( &ch, 1 ) )
|
|
+ if( read_ec2_port( &ch, 1 ) )
|
|
return ch;
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
-bool Ec2Sim::read_port( char *buf, int len )
|
|
+bool Ec2Sim::read_ec2_port( char *buf, int len )
|
|
{
|
|
fd_set input;
|
|
struct timeval timeout;
|
|
diff --git a/src/devel-tools/playback-comms.h b/src/devel-tools/playback-comms.h
|
|
index 38aa60e..ff8396a 100644
|
|
--- a/src/devel-tools/playback-comms.h
|
|
+++ b/src/devel-tools/playback-comms.h
|
|
@@ -31,8 +31,8 @@ protected:
|
|
|
|
bool write_port_ch( char ch );
|
|
bool write_port( char *buf, int len );
|
|
- int read_port_ch();
|
|
- bool read_port( char *buf, int len );
|
|
+ int read_ec2_port_ch();
|
|
+ bool read_ec2_port( char *buf, int len );
|
|
void rx_flush();
|
|
void tx_flush();
|
|
void close_port();
|
|
diff --git a/src/ec2drv/boot.c b/src/ec2drv/boot.c
|
|
index e3cac94..c4d1f6d 100644
|
|
--- a/src/ec2drv/boot.c
|
|
+++ b/src/ec2drv/boot.c
|
|
@@ -15,7 +15,7 @@ uint8_t boot_run_app( EC2DRV *obj )
|
|
DUMP_FUNC();
|
|
uint8_t fw_ver;
|
|
write_port(obj,"\x06\x00\x00",3);
|
|
- fw_ver = read_port_ch(obj);
|
|
+ fw_ver = read_ec2_port_ch(obj);
|
|
DUMP_FUNC_END();
|
|
return fw_ver;
|
|
}
|
|
@@ -27,7 +27,7 @@ uint8_t boot_get_version( EC2DRV *obj )
|
|
{
|
|
DUMP_FUNC();
|
|
write_port(obj,"\x00\x00\x00",3);
|
|
- obj->boot_ver = read_port_ch(obj);
|
|
+ obj->boot_ver = read_ec2_port_ch(obj);
|
|
DUMP_FUNC_END();
|
|
return obj->boot_ver;
|
|
}
|
|
@@ -102,7 +102,7 @@ BOOL boot_write_flash_page( EC2DRV *obj, uint8_t *buf, BOOL do_xor )
|
|
{
|
|
write_port(obj,(char*)out_buf,512);
|
|
}
|
|
- read_port_ch(obj); // 0x00
|
|
+ read_ec2_port_ch(obj); // 0x00
|
|
// printf("local_csum = 0x%04x, remote_csum=0x%04x\n",local_csum, boot_calc_page_cksum(obj));
|
|
BOOL r = boot_calc_page_cksum(obj) == local_csum;
|
|
DUMP_FUNC_END();
|
|
@@ -124,7 +124,7 @@ uint8_t boot_read_byte( EC2DRV *obj, uint16_t addr )
|
|
cmd[1] = (addr>>8) & 0xff;
|
|
cmd[2] = addr & 0xff;
|
|
write_port(obj,cmd,3);
|
|
- while(!read_port(obj,(char*)&c,1))
|
|
+ while(!read_ec2_port(obj,(char*)&c,1))
|
|
write_port(obj,cmd,3);
|
|
DUMP_FUNC_END();
|
|
return c;
|
|
@@ -141,7 +141,7 @@ uint16_t boot_calc_page_cksum( EC2DRV *obj )
|
|
char buf[2];
|
|
uint16_t cksum;
|
|
write_port(obj,"\x04\x00\x00",3);
|
|
- read_port(obj,buf,2);
|
|
+ read_ec2_port(obj,buf,2);
|
|
cksum = (buf[0]&0xff)<<8 | (buf[1]&0xff);
|
|
// printf("checksum = 0x%04x\n",cksum);
|
|
DUMP_FUNC();
|
|
diff --git a/src/ec2drv/c2_mode.c b/src/ec2drv/c2_mode.c
|
|
index 3e69e3f..38c1851 100644
|
|
--- a/src/ec2drv/c2_mode.c
|
|
+++ b/src/ec2drv/c2_mode.c
|
|
@@ -15,7 +15,7 @@ uint8_t c2_special_read( EC2DRV *obj, uint8_t sfr)
|
|
cmd[2] = 1;
|
|
|
|
write_port( obj, (char*)cmd, 3 );
|
|
- read_port( obj, (char*)buf, 2 ); // +1 for 0x0d
|
|
+ read_ec2_port( obj, (char*)buf, 2 ); // +1 for 0x0d
|
|
|
|
return buf[0];
|
|
}
|
|
@@ -31,7 +31,7 @@ void c2_special_write( EC2DRV *obj, uint8_t sfr, uint8_t value )
|
|
cmd[2] = 1;
|
|
cmd[3] = value & 0xff;
|
|
write_port( obj, (char*)cmd, 4 );
|
|
- read_port( obj, (char*)buf, 1 ); // +1 for 0x0d
|
|
+ read_ec2_port( obj, (char*)buf, 1 ); // +1 for 0x0d
|
|
}
|
|
|
|
/** Perform opperations necessary before any flash write or erase
|
|
@@ -145,7 +145,7 @@ uint16_t c2_device_id( EC2DRV *obj )
|
|
// this appeared in new versions of IDE but seems to have no effect for F310
|
|
// EC2 chokes on this!!!! trx(obj,"\xfe\x08",2,"\x0d",1);
|
|
write_port( obj,"\x22", 1 ); // request device id (C2 mode)
|
|
- read_port( obj, buf, 3 );
|
|
+ read_ec2_port( obj, buf, 3 );
|
|
return buf[0]<<8 | buf[1];
|
|
}
|
|
|
|
@@ -156,7 +156,7 @@ uint16_t c2_unique_device_id( EC2DRV *obj )
|
|
|
|
// ec2_target_halt(obj); // halt needed otherwise device may return garbage!
|
|
write_port(obj,"\x23",1);
|
|
- read_port(obj,buf,3);
|
|
+ read_ec2_port(obj,buf,3);
|
|
dev_id = buf[1];
|
|
// print_buf( buf,3);
|
|
// ec2_target_halt(obj); // halt needed otherwise device may return garbage!
|
|
@@ -189,7 +189,7 @@ void c2_erase_flash( EC2DRV *obj )
|
|
printf("Start erase3\n");
|
|
write_port( obj, "\x3C",1); // Erase entire device
|
|
printf("Start erase4\n");
|
|
- read_port_ch(obj); // 0x0d
|
|
+ read_ec2_port_ch(obj); // 0x0d
|
|
printf("Start erase5\n");
|
|
flash_write_post(obj);
|
|
printf("Start erase6\n");
|
|
@@ -418,7 +418,7 @@ BOOL c2_read_flash( EC2DRV *obj, uint8_t *buf, uint32_t start_addr, int len, BOO
|
|
cmd[2] = high;
|
|
cmd[3] = l;
|
|
write_port( obj, (char*)cmd, 4 );
|
|
- read_port( obj, (char*)buf+i, cmd[3]+1 ); // +1 for 0x0d
|
|
+ read_ec2_port( obj, (char*)buf+i, cmd[3]+1 ); // +1 for 0x0d
|
|
if (buf[i+cmd[3]] != 0x0d)
|
|
return FALSE;
|
|
i+=l;
|
|
@@ -474,7 +474,7 @@ BOOL c2_read_xdata_emif( EC2DRV *obj, char *buf, int start_addr, int len )
|
|
block_len = (len-cnt)>block_len_max ? block_len_max : len-cnt;
|
|
cmd[3] = block_len;
|
|
write_port( obj, cmd, 4 );
|
|
- read_port( obj, buf+cnt, block_len+1 ); // +1 for 0x0d terminator ///@FIXME do we need to read one extra here for 0x0d?
|
|
+ read_ec2_port( obj, buf+cnt, block_len+1 ); // +1 for 0x0d terminator ///@FIXME do we need to read one extra here for 0x0d?
|
|
addr += block_len;
|
|
cnt += block_len;
|
|
}
|
|
@@ -521,7 +521,7 @@ BOOL c2_read_xdata_F350( EC2DRV *obj, char *buf, int start_addr, int len )
|
|
cmd[2] = 0x00;
|
|
cmd[3] = (len-ofs)>=max_read_len ? max_read_len : (len-ofs);
|
|
write_port( obj, (char*)cmd, 4 );
|
|
- read_port( obj, (char*)buf+ofs, cmd[3]+1 ); // for 0x0d terminator
|
|
+ read_ec2_port( obj, (char*)buf+ofs, cmd[3]+1 ); // for 0x0d terminator
|
|
}
|
|
|
|
// restore SFR page register
|
|
@@ -578,12 +578,12 @@ BOOL c2_write_xdata_emif( EC2DRV *obj, char *buf, int start_addr, int len )
|
|
// split write over 2 USB writes
|
|
write_port( obj, cmd, 0x3f );
|
|
write_port( obj, &cmd[cmd_len+0x3b], 1 );
|
|
- ok |= (read_port_ch( obj)=='\x0d');
|
|
+ ok |= (read_ec2_port_ch( obj)=='\x0d');
|
|
}
|
|
else
|
|
{
|
|
write_port( obj, cmd, block_len + cmd_len );
|
|
- ok |= (read_port_ch( obj)=='\x0d');
|
|
+ ok |= (read_ec2_port_ch( obj)=='\x0d');
|
|
}
|
|
addr += block_len;
|
|
cnt += block_len;
|
|
@@ -605,9 +605,9 @@ void c2_read_ram( EC2DRV *obj, char *buf, int start_addr, int len )
|
|
//T 28 24 02 R 7C 00
|
|
//T 28 26 02 R 00 00
|
|
write_port( obj,"\x28\x24\x02",3 );
|
|
- read_port( obj, &tmp[0], 2);
|
|
+ read_ec2_port( obj, &tmp[0], 2);
|
|
write_port( obj,"\x28\x26\x02",3 );
|
|
- read_port( obj, &tmp[2], 2);
|
|
+ read_ec2_port( obj, &tmp[2], 2);
|
|
if( start_addr<3 )
|
|
{
|
|
memcpy( &buf[0], &tmp[start_addr], 3-start_addr );
|
|
@@ -627,7 +627,7 @@ void c2_read_ram_sfr( EC2DRV *obj, char *buf, int start_addr, int len, BOOL sfr
|
|
cmd[1] = start_addr+i;
|
|
cmd[2] = len-i >= block_len ? block_len : len-i;
|
|
write_port( obj, (char*)cmd, 3 );
|
|
- read_port( obj, buf+i, cmd[2] );
|
|
+ read_ec2_port( obj, buf+i, cmd[2] );
|
|
}
|
|
}
|
|
|
|
@@ -753,12 +753,12 @@ BOOL c2_write_xdata_F35x( EC2DRV *obj, char *buf, int start_addr, int len )
|
|
// split write over 2 USB writes
|
|
write_port( obj, cmd, 0x3f );
|
|
write_port( obj, &cmd[cmd_len+0x3b], 1 );
|
|
- ok |= (read_port_ch( obj)=='\x0d');
|
|
+ ok |= (read_ec2_port_ch( obj)=='\x0d');
|
|
}
|
|
else
|
|
{
|
|
write_port( obj, cmd, block_len + cmd_len );
|
|
- ok |= (read_port_ch( obj)=='\x0d');
|
|
+ ok |= (read_ec2_port_ch( obj)=='\x0d');
|
|
}
|
|
addr += block_len;
|
|
cnt += block_len;
|
|
@@ -937,7 +937,7 @@ BOOL c2_target_halt_poll( EC2DRV *obj )
|
|
char buf[2];
|
|
write_port( obj, "\x27", 1 );
|
|
//write_port( obj, "\x27\x00", 2 );
|
|
- read_port( obj, buf, 2 );
|
|
+ read_ec2_port( obj, buf, 2 );
|
|
return buf[0]==0x01; // 01h = stopped, 00h still running
|
|
}
|
|
|
|
diff --git a/src/ec2drv/ec2drv.c b/src/ec2drv/ec2drv.c
|
|
index adb3ab6..5468e5d 100644
|
|
--- a/src/ec2drv/ec2drv.c
|
|
+++ b/src/ec2drv/ec2drv.c
|
|
@@ -29,6 +29,7 @@
|
|
#include <errno.h> // Error number definitions
|
|
#include <termios.h> // POSIX terminal control definitions
|
|
#include <sys/ioctl.h>
|
|
+#include <sys/select.h>
|
|
#include "ec2drv.h"
|
|
#include "config.h"
|
|
#include "boot.h"
|
|
@@ -1107,7 +1108,7 @@ void read_active_regs( EC2DRV *obj, char *buf )
|
|
|
|
// R0-R1
|
|
write_port( obj, "\x02\x02\x24\x02", 4 );
|
|
- read_port( obj, &buf[0], 2 );
|
|
+ read_ec2_port( obj, &buf[0], 2 );
|
|
}
|
|
|
|
/** Read the targets program counter
|
|
@@ -1122,12 +1123,12 @@ uint16_t ec2_read_pc( EC2DRV *obj )
|
|
if( obj->mode==JTAG )
|
|
{
|
|
write_port( obj, "\x02\x02\x20\x02", 4 );
|
|
- read_port( obj, (char*)buf, 2 );
|
|
+ read_ec2_port( obj, (char*)buf, 2 );
|
|
}
|
|
else if( obj->mode==C2 )
|
|
{
|
|
write_port( obj, "\x28\x20\x02", 3 );
|
|
- read_port( obj, (char*)buf, 2 );
|
|
+ read_ec2_port( obj, (char*)buf, 2 );
|
|
}
|
|
return ((buf[1]<<8) | buf[0]);
|
|
}
|
|
@@ -1182,7 +1183,7 @@ uint16_t ec2_step( EC2DRV *obj )
|
|
trx( obj, "\x13\x00", 2, "\x01", 1 ); // very similar to 1/2 a target_halt command, test to see if stopped...
|
|
|
|
write_port( obj, "\x02\x02\x20\x02", 4 );
|
|
- read_port( obj, buf, 2 );
|
|
+ read_ec2_port( obj, buf, 2 );
|
|
return (uint8_t)buf[0] | ((uint8_t)buf[1]<<8);
|
|
}
|
|
else if( obj->mode==C2 )
|
|
@@ -1654,7 +1655,7 @@ BOOL trx( EC2DRV *obj, char *txbuf, int txlen, char *rxexpect, int rxlen )
|
|
{
|
|
char rxbuf[256];
|
|
write_port( obj, txbuf, txlen );
|
|
- if( read_port( obj, rxbuf, rxlen ) )
|
|
+ if( read_ec2_port( obj, rxbuf, rxlen ) )
|
|
return memcmp( rxbuf, rxexpect, rxlen )==0 ? TRUE : FALSE;
|
|
else
|
|
return FALSE;
|
|
@@ -1781,7 +1782,7 @@ BOOL write_port( EC2DRV *obj, char *buf, int len )
|
|
}
|
|
}
|
|
|
|
-int read_port_ch( EC2DRV *obj )
|
|
+int read_ec2_port_ch( EC2DRV *obj )
|
|
{
|
|
if( obj->dbg_adaptor==EC3 )
|
|
{
|
|
@@ -1790,7 +1791,7 @@ int read_port_ch( EC2DRV *obj )
|
|
else
|
|
{
|
|
char ch;
|
|
- if( read_port( obj, &ch, 1 ) )
|
|
+ if( read_ec2_port( obj, &ch, 1 ) )
|
|
return ch;
|
|
else
|
|
return -1;
|
|
@@ -1803,9 +1804,9 @@ int read_port_ch( EC2DRV *obj )
|
|
\param len Number of bytes to read.
|
|
\returns TRUE on success, FALSE on timeout ro failure.
|
|
*/
|
|
-BOOL read_port( EC2DRV *obj, char *buf, int len )
|
|
+BOOL read_ec2_port( EC2DRV *obj, char *buf, int len )
|
|
{
|
|
- return read_port_tm( obj, buf, len, 100000 );
|
|
+ return read_ec2_port_tm( obj, buf, len, 100000 );
|
|
}
|
|
|
|
|
|
@@ -1816,7 +1817,7 @@ BOOL read_port( EC2DRV *obj, char *buf, int len )
|
|
\param ms Number of milliseconds beefore a timeout will occur.
|
|
\returns TRUE on success, FALSE on timeout ro failure.
|
|
*/
|
|
-BOOL read_port_tm( EC2DRV *obj, char *buf, int len, uint32_t ms )
|
|
+BOOL read_ec2_port_tm( EC2DRV *obj, char *buf, int len, uint32_t ms )
|
|
{
|
|
if( obj->dbg_adaptor==EC3 )
|
|
{
|
|
diff --git a/src/ec2drv/ec2drv.h b/src/ec2drv/ec2drv.h
|
|
index 95cb94e..5975807 100644
|
|
--- a/src/ec2drv/ec2drv.h
|
|
+++ b/src/ec2drv/ec2drv.h
|
|
@@ -131,9 +131,9 @@ BOOL ec2_write_raw_sfr(EC2DRV *obj, uint8_t addr, uint8_t value );
|
|
BOOL trx( EC2DRV *obj, char *txbuf, int txlen, char *rxexpect, int rxlen );
|
|
BOOL write_port_ch( EC2DRV *obj, char ch );
|
|
BOOL write_port( EC2DRV *obj, char *buf, int len );
|
|
-int read_port_ch( EC2DRV *obj );
|
|
-BOOL read_port( EC2DRV *obj, char *buf, int len );
|
|
-BOOL read_port_tm( EC2DRV *obj, char *buf, int len, uint32_t ms );
|
|
+int read_ec2_port_ch( EC2DRV *obj );
|
|
+BOOL read_ec2_port( EC2DRV *obj, char *buf, int len );
|
|
+BOOL read_ec2_port_tm( EC2DRV *obj, char *buf, int len, uint32_t ms );
|
|
|
|
void set_flash_addr_jtag( EC2DRV *obj, uint32_t addr );
|
|
void ec2_core_suspend( EC2DRV *obj );
|
|
diff --git a/src/ec2drv/jtag_mode.c b/src/ec2drv/jtag_mode.c
|
|
index 7004cff..7ccaff7 100644
|
|
--- a/src/ec2drv/jtag_mode.c
|
|
+++ b/src/ec2drv/jtag_mode.c
|
|
@@ -26,7 +26,7 @@ uint16_t jtag_device_id( EC2DRV *obj )
|
|
char buf[6];
|
|
// trx( obj,"\x0A\x00",2,"\x21\x01\x03\x00\x00\x12",6);
|
|
write_port( obj, "\x0A\x00", 2 );
|
|
- read_port( obj, buf, 6 );
|
|
+ read_ec2_port( obj, buf, 6 );
|
|
return buf[2]<<8 | 0; // no rev id known yet
|
|
}
|
|
|
|
@@ -39,7 +39,7 @@ uint16_t jtag_unique_device_id( EC2DRV *obj )
|
|
ec2_target_halt(obj); // halt needed otherwise device may return garbage!
|
|
trx(obj,"\x10\x00",2,"\x07\x0D",2);
|
|
write_port(obj,"\x0C\x02\x80\x12",4);
|
|
- read_port(obj,buf,4);
|
|
+ read_ec2_port(obj,buf,4);
|
|
// print_buf( buf,4);
|
|
return buf[2];
|
|
}
|
|
@@ -220,7 +220,7 @@ BOOL jtag_write_flash_sector( EC2DRV *obj, uint32_t sect_addr, uint8_t *buf,
|
|
memcpy(tbuf,"\x12\x02\x0c\x00",4);
|
|
memcpy(tbuf+4,buf,max_block_len);
|
|
write_port(obj,tbuf,max_block_len+4);
|
|
- result |= read_port_ch(obj)==0x0d;
|
|
+ result |= read_ec2_port_ch(obj)==0x0d;
|
|
addr += max_block_len;
|
|
buf += max_block_len;
|
|
}
|
|
@@ -235,7 +235,7 @@ BOOL jtag_write_flash_sector( EC2DRV *obj, uint32_t sect_addr, uint8_t *buf,
|
|
tbuf[3] = 0x00;
|
|
memcpy(&tbuf[4],buf,len);
|
|
write_port(obj, tbuf,4+len);
|
|
- result &= read_port_ch( obj )==0x0d;
|
|
+ result &= read_ec2_port_ch( obj )==0x0d;
|
|
}
|
|
}
|
|
else
|
|
@@ -257,7 +257,7 @@ BOOL jtag_write_flash_sector( EC2DRV *obj, uint32_t sect_addr, uint8_t *buf,
|
|
: sector_size-offset;
|
|
write_port(obj,(char*)buf+offset,blk);
|
|
}
|
|
- result &= read_port_ch(obj)==0x0d;
|
|
+ result &= read_ec2_port_ch(obj)==0x0d;
|
|
|
|
}
|
|
jtag_flashcon( obj, 0x00 );
|
|
@@ -423,11 +423,11 @@ BOOL jtag_read_flash( EC2DRV *obj, uint8_t *buf,
|
|
cmd[2] = (len-i)>=block_size ? block_size : (len-i);
|
|
cmd[3] = 0x00;
|
|
write_port( obj, (char*)cmd, 4 );
|
|
- read_port( obj, tmp_buf, cmd[2]+1 ); // +1 for 0x0d terminator
|
|
+ read_ec2_port( obj, tmp_buf, cmd[2]+1 ); // +1 for 0x0d terminator
|
|
memcpy(buf+i,tmp_buf,cmd[2]);
|
|
result &= tmp_buf[cmd[2]]==0x0d;
|
|
- //read_port( obj, buf+i, cmd[2]+1 );
|
|
- // result &= read_port_ch( obj )==0x0d; // requires ec2 ver 0x13 or newer
|
|
+ //read_ec2_port( obj, buf+i, cmd[2]+1 );
|
|
+ // result &= read_ec2_port_ch( obj )==0x0d; // requires ec2 ver 0x13 or newer
|
|
}
|
|
|
|
jtag_flashcon( obj, 0x00 ); //trx( obj, "\x0D\x05\x82\x08\x00\x00\x00", 7, "\x0D", 1 );
|
|
@@ -631,7 +631,7 @@ BOOL jtag_erase_flash( EC2DRV *obj )
|
|
write_port(obj,"\x0F\x01\xA5",3);
|
|
BOOL r;
|
|
char c;
|
|
- r = read_port_tm(obj,&c,1,5000);
|
|
+ r = read_ec2_port_tm(obj,&c,1,5000);
|
|
r &= c==0x0d;
|
|
|
|
trx( obj, "\x0b\x02\x02\x00",4,"\x0d",1);
|
|
@@ -827,7 +827,7 @@ uint8_t JTAG_0x14( EC2DRV *obj, uint8_t a, uint8_t b )
|
|
cmd[2] = a;
|
|
cmd[3] = b;
|
|
write_port( obj, cmd, 4 );
|
|
- read_port( obj, cmd, 2 );
|
|
+ read_ec2_port( obj, cmd, 2 );
|
|
return cmd[0];
|
|
}
|
|
|
|
@@ -839,7 +839,7 @@ uint8_t JTAG_unknown_op_0x15( EC2DRV *obj )
|
|
{
|
|
char buf[2];
|
|
write_port( obj, "\x15\x02\x18\x00",4);
|
|
- read_port( obj, buf, 2);
|
|
+ read_ec2_port( obj, buf, 2);
|
|
return buf[0];
|
|
}
|
|
|
|
@@ -852,7 +852,7 @@ uint16_t JTAG_0x16_Len2( EC2DRV *obj, uint8_t a, uint8_t b )
|
|
cmd[2] = a;
|
|
cmd[3] = b;
|
|
write_port( obj, cmd, 4);
|
|
- read_port( obj, cmd, 3);
|
|
+ read_ec2_port( obj, cmd, 3);
|
|
return cmd[0] | (cmd[1]<<8);
|
|
}
|
|
|
|
@@ -865,7 +865,7 @@ uint32_t JTAG_0x16_Len3( EC2DRV *obj, uint8_t a, uint8_t b, uint8_t c )
|
|
cmd[3] = b;
|
|
cmd[4] = c;
|
|
write_port( obj, cmd, 5);
|
|
- read_port( obj, cmd, 4);
|
|
+ read_ec2_port( obj, cmd, 4);
|
|
return cmd[0] | (cmd[1]<<8) | (cmd[1]<<16);
|
|
}
|
|
|
|
@@ -897,7 +897,7 @@ BOOL ec2_connect_jtag( EC2DRV *obj, const char *port )
|
|
return FALSE;
|
|
}
|
|
write_port( obj, "\x06\x00\x00",3);
|
|
- read_port( obj, buf, 1);
|
|
+ read_ec2_port( obj, buf, 1);
|
|
|
|
printf("Debug adaptor ver = 0x%02x\n",buf[0]);
|
|
ec2_target_reset( obj );
|
|
@@ -914,10 +914,10 @@ void jtag_read_ram( EC2DRV *obj, char *buf, int start_addr, int len )
|
|
ec2_read_ram_sfr( obj, buf, start_addr, len, FALSE );
|
|
char tmp[4];
|
|
write_port( obj,"\x02\x02\x24\x02",4 );
|
|
- read_port( obj, &tmp[0], 3); // 3rd byte is 0x0d terminator
|
|
+ read_ec2_port( obj, &tmp[0], 3); // 3rd byte is 0x0d terminator
|
|
usleep(10000);
|
|
write_port( obj,"\x02\x02\x26\x02",4 );
|
|
- read_port( obj, &tmp[2], 3); // 3rd byte is 0x0d terminator
|
|
+ read_ec2_port( obj, &tmp[2], 3); // 3rd byte is 0x0d terminator
|
|
usleep(10000);
|
|
if( start_addr<3 )
|
|
{
|
|
@@ -938,8 +938,8 @@ void jtag_read_ram_sfr( EC2DRV *obj, char *buf, int start_addr, int len, BOOL sf
|
|
cmd[3] = len-i >= 0x0C ? 0x0C : len-i;
|
|
write_port( obj, cmd, 0x04 );
|
|
// usleep(10000); // try to prevent bad reads of RAM by letting the EC2 take a breather
|
|
- //read_port( obj, buf+i, cmd[3] );
|
|
- read_port( obj, rbuf, cmd[3]+1 ); // +1 for terminator 0x0d
|
|
+ //read_ec2_port( obj, buf+i, cmd[3] );
|
|
+ read_ec2_port( obj, rbuf, cmd[3]+1 ); // +1 for terminator 0x0d
|
|
memcpy(buf+i,rbuf,cmd[3]);
|
|
}
|
|
}
|
|
@@ -1236,7 +1236,7 @@ void jtag_read_xdata_page( EC2DRV *obj, char *buf, unsigned char page,
|
|
cmd[2] = (start+i) & 0xFF;
|
|
cmd[3] = (len-i)>=0x3C ? 0x3C : (len-i);
|
|
write_port( obj, (char*)cmd, 4 );
|
|
- read_port( obj, buf, cmd[3]+1 ); // +1 for 0x0d terminator
|
|
+ read_ec2_port( obj, buf, cmd[3]+1 ); // +1 for 0x0d terminator
|
|
buf += cmd[3];
|
|
}
|
|
// close out XDATA read process...bug fix for bug #2024032
|
|
@@ -1313,7 +1313,7 @@ BOOL jtag_target_halt( EC2DRV *obj )
|
|
BOOL jtag_target_halt_poll( EC2DRV *obj )
|
|
{
|
|
write_port( obj, "\x13\x00", 2 );
|
|
- return read_port_ch( obj )==0x01; // 01h = stopped, 00h still running
|
|
+ return read_ec2_port_ch( obj )==0x01; // 01h = stopped, 00h still running
|
|
}
|
|
|
|
|
|
--
|
|
2.16.4
|
|
|