Index: embios/trunk/tools/embios.py |
— | — | @@ -360,12 +360,13 @@ |
361 | 361 |
|
362 | 362 | elif argv[1] == "readrawbootflash":
|
363 | 363 | if len(argv) != 5: usage()
|
364 | | - dev.readrawbootflash(int(argv[2]), int(argv[3]), int(argv[4]))
|
| 364 | + dev.readrawbootflash(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16))
|
365 | 365 |
|
366 | 366 | elif argv[1] == "writerawbootflash":
|
367 | 367 | if len(argv) != 5: usage()
|
368 | | - dev.writerawbootflash(int(argv[2]), int(argv[3]), int(argv[4]))
|
369 | | -
|
| 368 | + dev.writerawbootflash(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16))
|
| 369 | +
|
| 370 | +
|
370 | 371 | elif argv[1] == "flushcaches":
|
371 | 372 | if len(argv) != 2: usage()
|
372 | 373 | dev.flushcaches()
|
Index: embios/trunk/tools/libembios.py |
— | — | @@ -258,13 +258,15 @@ |
259 | 259 |
|
260 | 260 | # correct alignment
|
261 | 261 | while (offset & 0xF) != 0:
|
262 | | - blocklen = (0x10 - offset % 0x10)
|
263 | | -
|
| 262 | + blocklen = size
|
| 263 | +
|
264 | 264 | if (blocklen > size):
|
265 | 265 | blocklen = size
|
266 | 266 | if (blocklen > self.cout_maxsize - 0x10):
|
267 | | - blocklen = self.cout_maxsize
|
| 267 | + blocklen = self.cout_maxsize - 0x10
|
268 | 268 |
|
| 269 | + blocklen = (blocklen & 0xFFFFFFF0) + (offset & 0xF)
|
| 270 | +
|
269 | 271 | self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 5, offset, blocklen, 0) + data[boffset:boffset+blocklen])
|
270 | 272 | response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
271 | 273 | self.__checkstatus(response)
|
— | — | @@ -274,11 +276,11 @@ |
275 | 277 | size -= blocklen
|
276 | 278 |
|
277 | 279 | # write data with DMA, if it makes sense (-> much data) and isn't forbidden
|
278 | | - if (usedma):
|
| 280 | + if (usedma) and (size > 2 * (self.cout_maxsize - 16)):
|
279 | 281 | if (freezesched):
|
280 | | - self.freezescheduler(1)
|
| 282 | + self.freezescheduler(1, 0)
|
281 | 283 |
|
282 | | - while (size > 0x1F):
|
| 284 | + while (size > (self.cout_maxsize - 16)):
|
283 | 285 | blocklen = size
|
284 | 286 |
|
285 | 287 | if (blocklen > self.dout_maxsize):
|
— | — | @@ -295,7 +297,7 @@ |
296 | 298 | size -= blocklen
|
297 | 299 |
|
298 | 300 | if (freezesched):
|
299 | | - self.freezescheduler(0)
|
| 301 | + self.freezescheduler(0, 0)
|
300 | 302 |
|
301 | 303 | # write rest of data
|
302 | 304 | while (size > 0):
|
— | — | @@ -302,7 +304,7 @@ |
303 | 305 | blocklen = size
|
304 | 306 |
|
305 | 307 | if (blocklen > self.cout_maxsize - 0x10):
|
306 | | - blocklen = self.cout_maxsize
|
| 308 | + blocklen = self.cout_maxsize - 0x10
|
307 | 309 |
|
308 | 310 | self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 5, offset, blocklen, 0) + data[boffset:boffset+blocklen])
|
309 | 311 | response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
— | — | @@ -321,12 +323,14 @@ |
322 | 324 |
|
323 | 325 | # correct alignment
|
324 | 326 | while (offset & 0xF) != 0:
|
325 | | - blocklen = (0x10 - offset % 0x10)
|
| 327 | + blocklen = size
|
326 | 328 |
|
327 | 329 | if (blocklen > size):
|
328 | 330 | blocklen = size
|
329 | 331 | if (blocklen > self.cin_maxsize - 0x10):
|
330 | | - blocklen = self.cin_maxsize
|
| 332 | + blocklen = self.cin_maxsize - 0x10
|
| 333 | +
|
| 334 | + blocklen = (blocklen & 0xFFFFFFF0) + (offset & 0xF)
|
331 | 335 |
|
332 | 336 | self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 4, offset, blocklen, 0))
|
333 | 337 | response = self.__getbulk(self.handle, self.__cinep, 0x10 + blocklen)
|
— | — | @@ -338,11 +342,11 @@ |
339 | 343 | size -= blocklen
|
340 | 344 |
|
341 | 345 | # read data with DMA, if it makes sense (-> much data) and isn't forbidden
|
342 | | - if (usedma):
|
| 346 | + if (usedma) and (size > 2 * (self.cin_maxsize - 16)):
|
343 | 347 | if (freezesched):
|
344 | | - self.freezescheduler(1)
|
| 348 | + self.freezescheduler(1, 0)
|
345 | 349 |
|
346 | | - while (size > 0x1F):
|
| 350 | + while (size > (self.cin_maxsize - 16)):
|
347 | 351 | blocklen = size
|
348 | 352 |
|
349 | 353 | if (blocklen > self.din_maxsize):
|
— | — | @@ -358,7 +362,7 @@ |
359 | 363 | size -= blocklen
|
360 | 364 |
|
361 | 365 | if (freezesched):
|
362 | | - self.freezescheduler(0)
|
| 366 | + self.freezescheduler(0, 0)
|
363 | 367 |
|
364 | 368 | # read rest of data
|
365 | 369 | while (size > 0):
|
— | — | @@ -365,7 +369,7 @@ |
366 | 370 | blocklen = size
|
367 | 371 |
|
368 | 372 | if (blocklen > self.cin_maxsize - 0x10):
|
369 | | - blocklen = self.cin_maxsize
|
| 373 | + blocklen = self.cin_maxsize - 0x10
|
370 | 374 |
|
371 | 375 | self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 4, offset, blocklen, 0))
|
372 | 376 | response = self.__getbulk(self.handle, self.__cinep, 0x10 + blocklen)
|