Add missing *_entry_dump and *_ensure utils
Change-Id: I2e54f66f1dfe9dfacbf57eba6d327377c3abd66d
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/src/transfer_list.c b/src/transfer_list.c
index 20903eb..8b7d0d0 100644
--- a/src/transfer_list.c
+++ b/src/transfer_list.c
@@ -34,12 +34,20 @@
if (!te) {
break;
}
+
printf("Entry %d:\n", i++);
+ transfer_entry_dump(te);
+ }
+}
+
+void transfer_entry_dump(struct transfer_list_entry *te)
+{
+ if (te) {
printf("tag_id 0x%x\n", te->tag_id);
printf("hdr_size 0x%x\n", te->hdr_size);
printf("data_size 0x%x\n", te->data_size);
printf("data_addr 0x%lx\n",
- (unsigned long)transfer_list_entry_data(te));
+ (unsigned long)transfer_list_entry_data(te));
}
}
@@ -484,3 +492,22 @@
}
return (uint8_t *)entry + entry->hdr_size;
}
+
+/*******************************************************************************
+ * Verifies that the transfer list has not already been initialized, then
+ * initializes it at the specified memory location.
+ *
+ * Return pointer to the transfer list or NULL on error
+ * *****************************************************************************/
+struct transfer_list_header *transfer_list_ensure(void *addr, size_t size)
+{
+ struct transfer_list_header *tl = NULL;
+
+ if (transfer_list_check_header(addr) == TL_OPS_ALL) {
+ return (struct transfer_list_header *)addr;
+ }
+
+ tl = transfer_list_init((void *)addr, size);
+
+ return tl;
+}