diff --git a/epicardium/modules/hw-lock.c b/epicardium/modules/hw-lock.c index 1c8e0b5d4188eadfd9beaea3983bf2bcb04c0137..cc9986ec96285c7f2f42e6b06a51364d656f2b0e 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; }