--- D:/repos_temp/chibios_cmsis_os_validation/cmsis_os_original/cmsis_os.c	Sat Apr 25 23:54:06 2020
+++ D:/repos_temp/chibios_cmsis_os_validation/cmsis_os_original_Timers/cmsis_os.c	Sat Apr 25 23:57:03 2020
@@ -215,6 +215,9 @@
 osTimerId osTimerCreate(const osTimerDef_t *timer_def,
                         os_timer_type type,
                         void *argument) {
+  if ((timer_def == NULL) || port_is_isr_context()) {
+	  return NULL;
+  }
 
   osTimerId timer = chPoolAlloc(&timpool);
   chVTObjectInit(&timer->vt);
@@ -229,6 +232,14 @@
  */
 osStatus osTimerStart(osTimerId timer_id, uint32_t millisec) {
 
+  if (timer_id == NULL) {
+    return osErrorParameter;
+  }
+
+  if (port_is_isr_context()) {
+    return osErrorISR;
+  }
+
   if ((millisec == 0) || (millisec == osWaitForever))
     return osErrorValue;
 
@@ -243,6 +254,18 @@
  */
 osStatus osTimerStop(osTimerId timer_id) {
 
+  if (timer_id == NULL) {
+    return osErrorParameter;
+  };
+
+  if (port_is_isr_context()) {
+    return osErrorISR;
+  }
+
+  if (chVTIsArmed(&timer_id->vt) == false) {
+	return osErrorResource;
+  };
+
   chVTReset(&timer_id->vt);
 
   return osOK;
@@ -252,6 +275,14 @@
  * @brief   Delete a timer.
  */
 osStatus osTimerDelete(osTimerId timer_id) {
+
+  if (timer_id == NULL) {
+	return osErrorParameter;
+  };
+
+  if (port_is_isr_context()) {
+    return osErrorISR;
+  }
 
   chVTReset(&timer_id->vt);
   chPoolFree(&timpool, (void *)timer_id);
