]> rtime.felk.cvut.cz Git - arc.git/blobdiff - system/kernel/alarm.c
Updated testsystem. Added test suites. Added Autostart tests. Autotester with T32.
[arc.git] / system / kernel / alarm.c
index 12b62329021f5635a7e79212fff44c7aab90583c..ce53f725b2e04d8e9f983a6ceaa07e4c1bffdc6b 100644 (file)
@@ -147,6 +147,37 @@ StatusType SetRelAlarm(AlarmType AlarmId, TickType Increment, TickType Cycle){
 \r
        OS_STD_END_3(OSServiceId_SetRelAlarm,AlarmId, Increment, Cycle);\r
 }\r
+
+/**
+ * The  system  service  occupies  the  alarm  <AlarmID>  element.
+ * When <start> ticks are reached, the task assigned to the alarm
+ *
+ * If the absolute value <start> is very close to the current counter
+ * value, the alarm may expire, and the task may become ready or
+ * the  alarm-callback  may  be  called  before  the  system  service
+ * returns to the user.
+ * If  the  absolute  value  <start>  already  was  reached  before  the
+ * system call, the alarm shall only expire when the absolute value
+ * <start>  is  reached  again,  i.e.  after  the  next  overrun  of  the
+ * counter.
+ *
+ * If <cycle> is unequal zero, the alarm element is logged on again
+ * immediately after expiry with the relative value <cycle>.
+ *
+ * The alarm <AlarmID> shall not already be in use.
+ * To  change  values  of  alarms  already  in  use  the  alarm  shall  be
+ * cancelled first.
+ *
+ * If  the  alarm  is  already  in  use,  this  call  will  be  ignored  and  the
+ * error E_OS_STATE is returned.
+ *
+ * Allowed on task level and in ISR, but not in hook routines.
+ *
+ * @param AlarmId
+ * @param Start
+ * @param Cycle
+ * @return
+ */
 \r
 StatusType SetAbsAlarm(AlarmType AlarmId, TickType Start, TickType Cycle) {\r
 \r
@@ -176,7 +207,8 @@ StatusType SetAbsAlarm(AlarmType AlarmId, TickType Start, TickType Cycle) {
 \r
        Irq_Save(flags);\r
        if( aPtr->active == 1 ) {\r
-               rv = E_OS_STATE;\r
+               rv = E_OS_STATE;
+               Irq_Restore(flags);\r
                goto err;\r
        }\r
 \r