Prefer the dump function in the examples.

This commit is contained in:
Jef Driesen 2009-06-04 08:59:55 +00:00
parent ff26c2db70
commit 23f81c6319
6 changed files with 24 additions and 18 deletions

View File

@ -42,8 +42,9 @@ test_dump_memory (const char* name, const char* filename)
return rc;
}
message ("device_read\n");
rc = device_read (device, 0x00, data, sizeof (data));
message ("device_dump\n");
unsigned int nbytes = 0;
rc = device_dump (device, data, sizeof (data), &nbytes);
if (rc != DEVICE_STATUS_SUCCESS) {
WARNING ("Cannot read memory.");
device_close (device);
@ -53,7 +54,7 @@ test_dump_memory (const char* name, const char* filename)
message ("Dumping data\n");
FILE* fp = fopen (filename, "wb");
if (fp != NULL) {
fwrite (data, sizeof (unsigned char), sizeof (data), fp);
fwrite (data, sizeof (unsigned char), nbytes, fp);
fclose (fp);
}

View File

@ -42,8 +42,9 @@ test_dump_memory (const char* name, const char* filename)
return rc;
}
message ("device_read\n");
rc = device_read (device, 0x00, data, sizeof (data));
message ("device_dump\n");
unsigned int nbytes = 0;
rc = device_dump (device, data, sizeof (data), &nbytes);
if (rc != DEVICE_STATUS_SUCCESS) {
WARNING ("Cannot read memory.");
device_close (device);
@ -53,7 +54,7 @@ test_dump_memory (const char* name, const char* filename)
message ("Dumping data\n");
FILE* fp = fopen (filename, "wb");
if (fp != NULL) {
fwrite (data, sizeof (unsigned char), sizeof (data), fp);
fwrite (data, sizeof (unsigned char), nbytes, fp);
fclose (fp);
}

View File

@ -42,8 +42,9 @@ test_dump_memory (const char* name, const char* filename)
return rc;
}
message ("device_read\n");
rc = device_read (device, 0x00, data, sizeof (data));
message ("device_dump\n");
unsigned int nbytes = 0;
rc = device_dump (device, data, sizeof (data), &nbytes);
if (rc != DEVICE_STATUS_SUCCESS) {
WARNING ("Cannot read memory.");
device_close (device);
@ -53,7 +54,7 @@ test_dump_memory (const char* name, const char* filename)
message ("Dumping data\n");
FILE* fp = fopen (filename, "wb");
if (fp != NULL) {
fwrite (data, sizeof (unsigned char), sizeof (data), fp);
fwrite (data, sizeof (unsigned char), nbytes, fp);
fclose (fp);
}

View File

@ -91,8 +91,9 @@ test_dump_memory (const char* name, const char* filename)
return rc;
}
message ("device_read\n");
rc = device_read (device, 0x00, data, sizeof (data));
message ("device_dump\n");
unsigned int nbytes = 0;
rc = device_dump (device, data, sizeof (data), &nbytes);
if (rc != DEVICE_STATUS_SUCCESS) {
WARNING ("Cannot read memory.");
device_close (device);
@ -102,7 +103,7 @@ test_dump_memory (const char* name, const char* filename)
message ("Dumping data\n");
FILE* fp = fopen (filename, "wb");
if (fp != NULL) {
fwrite (data, sizeof (unsigned char), sizeof (data), fp);
fwrite (data, sizeof (unsigned char), nbytes, fp);
fclose (fp);
}

View File

@ -92,8 +92,9 @@ test_dump_memory (const char* name, const char* filename)
return rc;
}
message ("device_read\n");
rc = device_read (device, 0x00, data, sizeof (data));
message ("device_dump\n");
unsigned int nbytes = 0;
rc = device_dump (device, data, sizeof (data), &nbytes);
if (rc != DEVICE_STATUS_SUCCESS) {
WARNING ("Cannot read memory.");
device_close (device);
@ -103,7 +104,7 @@ test_dump_memory (const char* name, const char* filename)
message ("Dumping data\n");
FILE* fp = fopen (filename, "wb");
if (fp != NULL) {
fwrite (data, sizeof (unsigned char), sizeof (data), fp);
fwrite (data, sizeof (unsigned char), nbytes, fp);
fclose (fp);
}

View File

@ -78,8 +78,9 @@ test_dump_memory (const char* name, unsigned int delay, const char* filename)
suunto_vyper_device_set_delay (device, delay);
message ("device_read\n");
rc = device_read (device, 0x00, data, sizeof (data));
message ("device_dump\n");
unsigned int nbytes = 0;
rc = device_dump (device, data, sizeof (data), &nbytes);
if (rc != DEVICE_STATUS_SUCCESS) {
WARNING ("Cannot read memory.");
device_close (device);
@ -89,7 +90,7 @@ test_dump_memory (const char* name, unsigned int delay, const char* filename)
message ("Dumping data\n");
FILE* fp = fopen (filename, "wb");
if (fp != NULL) {
fwrite (data, sizeof (unsigned char), sizeof (data), fp);
fwrite (data, sizeof (unsigned char), nbytes, fp);
fclose (fp);
}