From a5ac02a6954d79ab4b94092b4f882bf60fbdd84c Mon Sep 17 00:00:00 2001
From: swym <0xfd000000@gmail.com>
Date: Sat, 24 Aug 2019 00:32:15 +0200
Subject: [PATCH] hwlock: print task name instead of PC, print PC with
 LOG_DEBUG

---
 epicardium/modules/hw-lock.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/epicardium/modules/hw-lock.c b/epicardium/modules/hw-lock.c
index 1c8e0b5d..cc9986ec 100644
--- a/epicardium/modules/hw-lock.c
+++ b/epicardium/modules/hw-lock.c
@@ -25,18 +25,25 @@ int hwlock_acquire(enum hwlock_periph p, TickType_t wait)
 	if (p >= _HWLOCK_MAX) {
 		return -EINVAL;
 	}
+	TaskHandle_t task = xTaskGetCurrentTaskHandle();
 
 	if (xSemaphoreTake(hwlock_mutex[p], wait) != pdTRUE) {
 		LOG_WARN(
 			"hwlock",
-			"Lock %u is busy. [pc %p]",
+			"Lock %u is busy, held by: %s, attempt to accquire by: %s",
 			p,
+			pcTaskGetName(hwlock_tasks[p]),
+			pcTaskGetName(task)
+		);
+		LOG_DEBUG(
+			"hwlock",
+			"...attempted to lock from pc %p",
 			__builtin_return_address(0)
 		);
 		return -EBUSY;
 	}
 
-	hwlock_tasks[p] = xTaskGetCurrentTaskHandle();
+	hwlock_tasks[p] = task;
 
 	return 0;
 }
-- 
GitLab