summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <jaylink-dev@marcschink.de>2016-06-25 12:32:39 +0200
committerMarc Schink <jaylink-dev@marcschink.de>2016-06-25 13:12:49 +0200
commit3805635e498f6d916eb15cfbb573036de7a441ab (patch)
tree3d047b6ab13c4c2b896caad748e2548ea4b30cb0
parentbc5373b904a2e396d57aec633f92afe088039b90 (diff)
Update for libjaylink API changes
-rw-r--r--device_info.c23
-rw-r--r--efm32_debug_mode.c15
2 files changed, 28 insertions, 10 deletions
diff --git a/device_info.c b/device_info.c
index e2954a4..d260f3a 100644
--- a/device_info.c
+++ b/device_info.c
@@ -31,8 +31,7 @@ int main(int argc, char **argv)
uint8_t caps[JAYLINK_DEV_EXT_CAPS_SIZE];
struct jaylink_hardware_version hwver;
uint32_t interfaces;
- uint32_t freq;
- uint16_t div;
+ struct jaylink_speed speed;
struct jaylink_swo_speed swo_speed;
uint8_t config[JAYLINK_DEV_CONFIG_SIZE];
bool use_serial_number;
@@ -68,9 +67,18 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- ret = jaylink_get_device_list(ctx, &devs);
+ ret = jaylink_discovery_scan(ctx, 0);
- if (ret < 0) {
+ if (ret != JAYLINK_OK) {
+ printf("jaylink_discovery_scan() failed: %s.\n",
+ jaylink_strerror_name(ret));
+ jaylink_exit(ctx);
+ return EXIT_FAILURE;
+ }
+
+ ret = jaylink_get_devices(ctx, &devs, NULL);
+
+ if (ret != JAYLINK_OK) {
printf("jaylink_get_device_list() failed: %s.\n",
jaylink_strerror_name(ret));
jaylink_exit(ctx);
@@ -104,7 +112,7 @@ int main(int argc, char **argv)
jaylink_strerror_name(ret));
}
- jaylink_free_device_list(devs, true);
+ jaylink_free_devices(devs, true);
if (!device_found) {
printf("No J-Link device found.\n");
@@ -207,7 +215,7 @@ int main(int argc, char **argv)
}
if (jaylink_has_cap(caps, JAYLINK_DEV_CAP_GET_SPEEDS)) {
- ret = jaylink_get_speeds(devh, &freq, &div);
+ ret = jaylink_get_speeds(devh, &speed);
if (ret != JAYLINK_OK) {
printf("jaylink_get_speeds() failed: "
@@ -222,7 +230,8 @@ int main(int argc, char **argv)
if (jaylink_has_cap(caps, JAYLINK_DEV_CAP_ADAPTIVE_CLOCKING))
printf(" - Adaptive clocking\n");
- printf(" - %u MHz / div; div >= %u\n", freq / 1000000, div);
+ printf(" - %u MHz / div; div >= %u\n", speed.freq / 1000000,
+ speed.div);
}
if (jaylink_has_cap(caps, JAYLINK_DEV_CAP_SWO)) {
diff --git a/efm32_debug_mode.c b/efm32_debug_mode.c
index 6f3903a..877cefe 100644
--- a/efm32_debug_mode.c
+++ b/efm32_debug_mode.c
@@ -102,9 +102,18 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- ret = jaylink_get_device_list(ctx, &devs);
+ ret = jaylink_discovery_scan(ctx, 0);
- if (ret < 0) {
+ if (ret != JAYLINK_OK) {
+ printf("jaylink_discovery_scan() failed: %s.\n",
+ jaylink_strerror_name(ret));
+ jaylink_exit(ctx);
+ return EXIT_FAILURE;
+ }
+
+ ret = jaylink_get_devices(ctx, &devs, NULL);
+
+ if (ret != JAYLINK_OK) {
printf("jaylink_get_device_list() failed: %s.\n",
jaylink_strerror_name(ret));
jaylink_exit(ctx);
@@ -138,7 +147,7 @@ int main(int argc, char **argv)
jaylink_strerror_name(ret));
}
- jaylink_free_device_list(devs, true);
+ jaylink_free_devices(devs, true);
if (!device_found) {
printf("No J-Link device found.\n");