This is an automated email from Gerrit.

Spencer Oliver (s...@spen-soft.co.uk) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/498

-- gerrit

commit c2597a7bd7248b31384adb481e081b709ced0ff6
Author: Szymon Modzelewski <szmodzelew...@gmail.com>
Date:   Tue Feb 21 13:44:00 2012 +0100

    stlink-v1: fix memory writes
    
    implement stlink_usb_send and use it to fix stlink_usb_write_mem
    
    using two calls to stlink_usb_recv is inappropriate since each
    call issues a SG command on stlink-v1, resulting in errors
    
    Change-Id: I24ef9f2dda284e041dc4a532b59968a77eebe702
    Signed-off-by: Szymon Modzelewski <szmodzelew...@gmail.com>

diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index f7ad7c0..e3c005e 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -369,6 +369,13 @@ static int stlink_usb_recv(void *handle, const uint8_t 
*cmd, int cmdsize, uint8_
 }
 
 /** */
+static int stlink_usb_send(void *handle, const uint8_t *cmd, int cmdsize, 
uint8_t *txbuf,
+                   int txsize)
+{
+       return stlink_usb_xfer(handle, cmd, cmdsize, STLINK_TX_EP, txbuf, 
txsize);
+}
+
+/** */
 static void stlink_usb_init_buffer(void *handle)
 {
        struct stlink_usb_handle_s *h;
@@ -971,12 +978,7 @@ static int stlink_usb_write_mem8(void *handle, uint32_t 
addr, uint16_t len,
        h_u32_to_le(h->txbuf + 2, addr);
        h_u16_to_le(h->txbuf + 2 + 4, len);
 
-       res = stlink_usb_recv(handle, h->txbuf, STLINK_CMD_SIZE, 0, 0);
-
-       if (res != ERROR_OK)
-               return res;
-
-       res = stlink_usb_recv(handle, (uint8_t *) buffer, len, 0, 0);
+       res = stlink_usb_send(handle, h->txbuf, STLINK_CMD_SIZE, (uint8_t *) 
buffer, len);
 
        if (res != ERROR_OK)
                return res;
@@ -1034,12 +1036,7 @@ static int stlink_usb_write_mem32(void *handle, uint32_t 
addr, uint16_t len,
        h_u32_to_le(h->txbuf + 2, addr);
        h_u16_to_le(h->txbuf + 2 + 4, len);
 
-       res = stlink_usb_recv(handle, h->txbuf, STLINK_CMD_SIZE, 0, 0);
-
-       if (res != ERROR_OK)
-               return res;
-
-       res = stlink_usb_recv(handle, (uint8_t *) buffer, len, 0, 0);
+       res = stlink_usb_send(handle, h->txbuf, STLINK_CMD_SIZE, (uint8_t *) 
buffer, len);
 
        if (res != ERROR_OK)
                return res;

-- 

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to