Index: embios/trunk/tools/embios.py |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | print " killthread <threadid>"
|
160 | 160 | print " Kills the thread with thread ID <threadid>"
|
161 | 161 | print ""
|
162 | | - print " createthread <namepointer> <entrypoint> <stackpointer> <stacksize>, <type> <priority> <state>"
|
| 162 | + print " createthread <namepointer> <entrypoint> <stackpointer> <stacksize> <type> <priority> <state>"
|
163 | 163 | print " Creates a new thread and returns its thread ID"
|
164 | 164 | print " <namepointer> a pointer to the thread's name"
|
165 | 165 | print " <entrypoint> a pointer to the entrypoint of the thread"
|
— | — | @@ -185,51 +185,51 @@ |
186 | 186 |
|
187 | 187 | elif argv[1] == "reset":
|
188 | 188 | if len(argv) != 3: usage()
|
189 | | - dev.reset(int(argv[2]))
|
| 189 | + dev.reset(int(argv[2]), 16)
|
190 | 190 |
|
191 | 191 | elif argv[1] == "poweroff":
|
192 | 192 | if len(argv) != 3: usage()
|
193 | | - dev.poweroff(int(argv[2]))
|
| 193 | + dev.poweroff(int(argv[2]), 16)
|
194 | 194 |
|
195 | 195 |
|
196 | 196 | elif argv[1] == "uploadfile":
|
197 | 197 | if len(argv) < 4 or len(argv) > 6: usage()
|
198 | 198 | if len(argv) > 4:
|
199 | | - usedma = argv[4]
|
| 199 | + usedma = int(argv[4], 16)
|
200 | 200 | if len(argv) > 5:
|
201 | | - freezesched = argv[5]
|
| 201 | + freezesched = int(argv[5], 16)
|
202 | 202 | else:
|
203 | 203 | freezesched = 0
|
204 | 204 | else:
|
205 | 205 | freezesched = 0
|
206 | 206 | usedma = 1
|
207 | | - dev.uploadfile(int(argv[2]), argv[3], usedma, freezesched)
|
| 207 | + dev.uploadfile(int(argv[2], 16), argv[3], usedma, freezesched)
|
208 | 208 |
|
209 | 209 | elif argv[1] == "downloadfile":
|
210 | 210 | if len(argv) < 5 or len(argv) > 7: usage()
|
211 | 211 | if len(argv) > 5:
|
212 | | - usedma = argv[5]
|
| 212 | + usedma = int(argv[5], 16)
|
213 | 213 | if len(argv) > 6:
|
214 | | - freezesched = argv[6]
|
| 214 | + freezesched = int(argv[6], 16)
|
215 | 215 | else:
|
216 | 216 | freezesched = 0
|
217 | 217 | else:
|
218 | 218 | freezesched = 0
|
219 | 219 | usedma = 1
|
220 | | - dev.downloadfile(int(argv[2]), int(argv[3]), argv[4], usedma, freezesched)
|
| 220 | + dev.downloadfile(int(argv[2], 16), int(argv[3], 16), argv[4], usedma, freezesched)
|
221 | 221 |
|
222 | 222 | elif argv[1] == "uploadint":
|
223 | 223 | if len(argv) != 4: usage()
|
224 | | - dev.uploadint(int(argv[2]), int(argv[3]))
|
| 224 | + dev.uploadint(int(argv[2], 16), int(argv[3], 16))
|
225 | 225 |
|
226 | 226 | elif argv[1] == "downloadint":
|
227 | 227 | if len(argv) != 3: usage()
|
228 | | - dev.downloadint(int(argv[2]))
|
| 228 | + dev.downloadint(int(argv[2], 16))
|
229 | 229 |
|
230 | 230 |
|
231 | 231 | elif argv[1] == "i2cread":
|
232 | 232 | if len(argv) != 6: usage()
|
233 | | - dev.i2crecv(int(argv[2]), int(argv[3]), int(argv[4]), int(argv[5]))
|
| 233 | + dev.i2crecv(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), int(argv[5], 16))
|
234 | 234 |
|
235 | 235 | elif argv[1] == "i2csend":
|
236 | 236 | if len(argv) < 6: usage()
|
— | — | @@ -236,15 +236,15 @@ |
237 | 237 | data = ""
|
238 | 238 | ptr = 5
|
239 | 239 | while ptr < len(argv):
|
240 | | - data += struct.pack("<B", int(argv[ptr]))
|
| 240 | + data += struct.pack("<B", int(argv[ptr], 16))
|
241 | 241 | ptr += 1
|
242 | | - dev.i2csend(int(argv[2]), int(argv[3]), int(argv[4]), data)
|
| 242 | + dev.i2csend(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), data)
|
243 | 243 |
|
244 | 244 |
|
245 | 245 | elif argv[1] == "readusbconsole":
|
246 | 246 | if len(argv) not in [4, 5]: usage()
|
247 | 247 | if len(argv) == 4: argv[4] = ""
|
248 | | - dev.readusbcon(int(argv[2]), argv[3], argv[4])
|
| 248 | + dev.readusbcon(int(argv[2], 16), argv[3], argv[4])
|
249 | 249 |
|
250 | 250 | elif argv[1] == "writeusbconsole":
|
251 | 251 | if len(argv) < 4: usage()
|
— | — | @@ -254,11 +254,11 @@ |
255 | 255 | data = f.read()
|
256 | 256 |
|
257 | 257 | if len(argv) > 4:
|
258 | | - offset = int(argv[4])
|
| 258 | + offset = int(argv[4], 16)
|
259 | 259 | else:
|
260 | 260 | offset = 0
|
261 | 261 | if len(argv) > 5:
|
262 | | - size = int(argv[5])
|
| 262 | + size = int(argv[5], 16)
|
263 | 263 | else:
|
264 | 264 | size = len(data)
|
265 | 265 | if len(argv) > 6: usage()
|
— | — | @@ -269,7 +269,7 @@ |
270 | 270 | data = ""
|
271 | 271 | ptr = 3
|
272 | 272 | while ptr < len(argv):
|
273 | | - data += struct.pack("<I", int(argv[ptr]))
|
| 273 | + data += struct.pack("<I", int(argv[ptr], 16))
|
274 | 274 | ptr += 1
|
275 | 275 | dev.writeusbcon(data)
|
276 | 276 |
|
— | — | @@ -276,7 +276,7 @@ |
277 | 277 | elif argv[1] == "readdevconsole":
|
278 | 278 | if len(argv) not in [5, 6]: usage()
|
279 | 279 | if len(argv) == 5: argv[5] = ""
|
280 | | - dev.readusbcon(int(argv[2]), int(argv[3]), argv[4], argv[5])
|
| 280 | + dev.readusbcon(int(argv[2], 16), int(argv[3], 16), argv[4], argv[5])
|
281 | 281 |
|
282 | 282 | elif argv[1] == "writedevconsole":
|
283 | 283 | if len(argv) < 5: usage()
|
— | — | @@ -286,33 +286,33 @@ |
287 | 287 | data = f.read()
|
288 | 288 |
|
289 | 289 | if len(argv) > 5:
|
290 | | - offset = int(argv[5])
|
| 290 | + offset = int(argv[5], 16)
|
291 | 291 | else:
|
292 | 292 | offset = 0
|
293 | 293 | if len(argv) > 6:
|
294 | | - size = int(argv[6])
|
| 294 | + size = int(argv[6], 16)
|
295 | 295 | else:
|
296 | 296 | size = len(data)
|
297 | 297 | if len(argv) > 7: usage()
|
298 | 298 |
|
299 | | - dev.writeusbcon(int(argv[3]), data, 0, offset, size)
|
| 299 | + dev.writeusbcon(int(argv[3], 16), data, 0, offset, size)
|
300 | 300 |
|
301 | 301 | if argv[2] == "direct":
|
302 | 302 | data = ""
|
303 | 303 | ptr = 4
|
304 | 304 | while ptr < len(argv):
|
305 | | - data += struct.pack("<I", int(argv[ptr]))
|
| 305 | + data += struct.pack("<I", int(argv[ptr], 16))
|
306 | 306 | ptr += 1
|
307 | | - dev.writeusbcon(int(argv[3]), data)
|
| 307 | + dev.writeusbcon(int(argv[3], 16), data)
|
308 | 308 |
|
309 | 309 | elif argv[1] == "flushconsolebuffers":
|
310 | 310 | if len(argv) != 3: usage()
|
311 | | - dev.flushconsolebuffers(int(argv[2]))
|
| 311 | + dev.flushconsolebuffers(int(argv[2], 16))
|
312 | 312 |
|
313 | 313 |
|
314 | 314 | elif argv[1] == "getprocessinformation" or argv[1] == "getprocinfo":
|
315 | 315 | if len(argv) != 4: usage()
|
316 | | - dev.getprocinfo(int(argv[2]), int(argv[3]))
|
| 316 | + dev.getprocinfo(int(argv[2], 16), int(argv[3], 16))
|
317 | 317 |
|
318 | 318 | elif argv[1] == "lockscheduler":
|
319 | 319 | if len(argv) != 2: usage()
|
— | — | @@ -324,19 +324,19 @@ |
325 | 325 |
|
326 | 326 | elif argv[1] == "suspendthread":
|
327 | 327 | if len(argv) != 3: usage()
|
328 | | - dev.suspendthread(1, int(argv[2]))
|
| 328 | + dev.suspendthread(1, int(argv[2], 16))
|
329 | 329 |
|
330 | 330 | elif argv[1] == "resumethread":
|
331 | 331 | if len(argv) != 3: usage()
|
332 | | - dev.suspendthread(0, int(argv[2]))
|
| 332 | + dev.suspendthread(0, int(argv[2], 16))
|
333 | 333 |
|
334 | 334 | elif argv[1] == "killthread":
|
335 | 335 | if len(argv) != 3: usage()
|
336 | | - dev.killthread(int(argv[2]))
|
| 336 | + dev.killthread(int(argv[2], 16))
|
337 | 337 |
|
338 | 338 | elif argv[1] == "createthread":
|
339 | 339 | if len(argv) != 9: usage()
|
340 | | - dev.createthread(int(argv[2]), int(argv[3]), int(argv[4]), int(argv[5]), int(argv[6]), int(argv[7]), int(argv[8]))
|
| 340 | + dev.createthread(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), int(argv[5], 16), int(argv[6], 16), int(argv[7], 16), int(argv[8], 16))
|
341 | 341 |
|
342 | 342 |
|
343 | 343 | elif argv[1] == "flushcaches":
|