aboutsummaryrefslogtreecommitdiff
path: root/src/lmi.c
diff options
context:
space:
mode:
authorGareth McMullin2012-11-03 23:51:53 +1300
committerGareth McMullin2012-11-03 23:53:25 +1300
commit2637f072a1e973826ea4b374125621ef1a0dc901 (patch)
tree5dc228f1e9256ab4e26ae3e0c2ac15cc4d33098b /src/lmi.c
parente1c1162a1a666387133780efa31935e5b6dcc5c7 (diff)
Probe function return bool, true if device identified.
Correctly identify LM3S3748.
Diffstat (limited to 'src/lmi.c')
-rw-r--r--src/lmi.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/lmi.c b/src/lmi.c
index a4ae1f7..09a9dd5 100644
--- a/src/lmi.c
+++ b/src/lmi.c
@@ -89,15 +89,19 @@ uint16_t lmi_flash_write_stub[] = {
// _data:
// ...
};
-
-int lmi_probe(struct target_s *target)
+
+bool lmi_probe(struct target_s *target)
{
- /* How do we really probe the LMI device??? */
- target->driver = lmi_driver_str;
- target->xml_mem_map = lmi_xml_memory_map;
- target->flash_erase = lmi_flash_erase;
- target->flash_write = lmi_flash_write;
- return 0;
+ uint32_t did1 = adiv5_ap_mem_read(adiv5_target_ap(target), 0x400FE004);
+ switch (did1 >> 16) {
+ case 0x1049: /* LM3S3748 */
+ target->driver = lmi_driver_str;
+ target->xml_mem_map = lmi_xml_memory_map;
+ target->flash_erase = lmi_flash_erase;
+ target->flash_write = lmi_flash_write;
+ return true;
+ }
+ return false;
}
int lmi_flash_erase(struct target_s *target, uint32_t addr, int len)