summaryrefslogtreecommitdiff
path: root/utils/jz4740_tools
diff options
context:
space:
mode:
Diffstat (limited to 'utils/jz4740_tools')
-rw-r--r--utils/jz4740_tools/jz4740_usbtool.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/utils/jz4740_tools/jz4740_usbtool.c b/utils/jz4740_tools/jz4740_usbtool.c
index 42d3160a5e..e76c038887 100644
--- a/utils/jz4740_tools/jz4740_usbtool.c
+++ b/utils/jz4740_tools/jz4740_usbtool.c
@@ -255,9 +255,9 @@ int read_data(usb_dev_handle* dh, int address, unsigned char *p, int len)
255 255
256unsigned int read_reg(usb_dev_handle* dh, int address, int size) 256unsigned int read_reg(usb_dev_handle* dh, int address, int size)
257{ 257{
258 int err; 258 int err; /* set by SEND_COMMAND macro */
259 unsigned char buf[4]; 259 unsigned char buf[4];
260 260
261 SEND_COMMAND(VR_SET_DATA_ADDRESS, address); 261 SEND_COMMAND(VR_SET_DATA_ADDRESS, address);
262 SEND_COMMAND(VR_SET_DATA_LENGTH, size); 262 SEND_COMMAND(VR_SET_DATA_LENGTH, size);
263 GET_DATA(buf, size); 263 GET_DATA(buf, size);
@@ -274,20 +274,20 @@ unsigned int read_reg(usb_dev_handle* dh, int address, int size)
274 274
275int set_reg(usb_dev_handle* dh, int address, unsigned int val, int size) 275int set_reg(usb_dev_handle* dh, int address, unsigned int val, int size)
276{ 276{
277 int err, i; 277 int err; /* set by SEND_COMMAND macro */
278 unsigned char buf[4]; 278 unsigned char buf[4];
279 279
280 buf[0] = val & 0xff; 280 buf[0] = val & 0xff;
281 if(i > 1) 281 if(size > 1)
282 { 282 {
283 buf[1] = (val >> 8) & 0xff; 283 buf[1] = (val >> 8) & 0xff;
284 if(i > 2) 284 if(size > 2)
285 { 285 {
286 buf[2] = (val >> 16) & 0xff; 286 buf[2] = (val >> 16) & 0xff;
287 buf[3] = (val >> 24) & 0xff; 287 buf[3] = (val >> 24) & 0xff;
288 } 288 }
289 } 289 }
290 290
291 SEND_COMMAND(VR_SET_DATA_ADDRESS, address); 291 SEND_COMMAND(VR_SET_DATA_ADDRESS, address);
292 SEND_DATA(buf, size); 292 SEND_DATA(buf, size);
293 293