timer: add debug logging to identify dropped timer requests or events

Bug: 29625330
Change-Id: I403512cc75d107f5f903f06c5ec21d9fda5edb45
diff --git a/firmware/src/timer.c b/firmware/src/timer.c
index 98f5c11..e64c557 100644
--- a/firmware/src/timer.c
+++ b/firmware/src/timer.c
@@ -29,6 +29,12 @@
 
 #define MAX_INTERNAL_EVENTS       32 //also used for external app timer() calls
 
+#define INFO_PRINT(fmt, ...) do { \
+        osLog(LOG_INFO, "%s " fmt, "[timer]", ##__VA_ARGS__); \
+    } while (0);
+
+#define ERROR_PRINT(fmt, ...) INFO_PRINT("%s" fmt, "ERROR: ", ##__VA_ARGS__)
+
 struct Timer {
     uint64_t      expires; /* time of next expiration */
     uint64_t      period;  /* 0 for oneshot */
@@ -46,7 +52,6 @@
 static struct Timer mTimers[MAX_TIMERS];
 static volatile uint32_t mNextTimerId = 0;
 
-
 uint64_t timGetTime(void)
 {
     return platGetTicks();
@@ -81,8 +86,12 @@
         if ((evt = slabAllocatorAlloc(mInternalEvents)) != 0) {
             evt->timerId = tim->id;
             evt->data = tim->callData;
-            if (!osEnqueuePrivateEvt(EVT_APP_TIMER, evt, timerCallFuncFreeF, tim->tid))
+            if (!osEnqueuePrivateEvt(EVT_APP_TIMER, evt, timerCallFuncFreeF, tim->tid)) {
+                ERROR_PRINT("Could not enqueue private timer event\n");
                 slabAllocatorFree(mInternalEvents, evt);
+            }
+        } else {
+            ERROR_PRINT("Could not allocate an internal event\n");
         }
     }
 }
@@ -151,8 +160,10 @@
     struct Timer *t;
     uint16_t timId;
 
-    if (idx < 0) /* no free timers */
+    if (idx < 0) /* no free timers */{
+        ERROR_PRINT("no free timers\n");
         return 0;
+    }
 
     /* generate next timer ID */
     do {