]> rtime.felk.cvut.cz Git - frescor/fna.git/commitdiff
corrected an error in the sporadic servers... the activation time is the timestamp...
authorsangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Fri, 18 Apr 2008 10:50:20 +0000 (10:50 +0000)
committersangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Fri, 18 Apr 2008 10:50:20 +0000 (10:50 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fna/trunk@1124 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_frescan/frescan.c
src_frescan/frescan_packets.h
src_frescan/frescan_queues.c
src_frescan/frescan_servers_replenishments.c
src_frescan/frescan_servers_replenishments.h

index 4084c8ca93880710b455cdbd71c6024262ee7c52..5ec15fa4f64870a351434c25ee805cc837b660c0 100644 (file)
@@ -532,7 +532,9 @@ static int frescan_hook_frame_sent(const struct can_chip_t *chip)
                 DEBUG(FRESCAN_SENT_HOOK_ENABLE_DEBUG,
                       "calling frame_sent + program repl for id:%u\n", id);
 
-                ret = frescan_replenishment_program(chip->minor, id);
+                ret = frescan_replenishment_program(chip->minor,
+                                                    id,
+                                                    &packet->timestamp);
                 if (ret != 0) {
                         ERROR("could not program replenishment\n");
                         return -1;
index 62e57489a24d65752363fea649de1b4c81a9b213..37e01f3fcb59b0b822df03d0d1a87766ee04e250 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef _MARTE_FRESCAN_PACKETS_H_
 #define _MARTE_FRESCAN_PACKETS_H_
 
+#include <time.h>             // struct timespec
 #include <stdint.h>           // uint8_t ...
 #include "frescan.h"          // frescan_flags_t
 #include <misc/linux_list.h>  // struct list_head
@@ -63,6 +64,7 @@
  * @buffer_head: pointer to first byte of the buffer that is going to be sent
  * @buffer_read_pointer: pointer to the part of the buffer being read
  * @buffer_pending_bytes: bytes waiting to be sent
+ * @timestamp: time when the packet was enqueued (activation time)
  * @pool_pos: position in the packets pool to know how to free it
  *
  * NOTE: the buffers could also be used on the receiving part to support
@@ -78,6 +80,7 @@ typedef struct {
         uint8_t *buffer_head;         // only for sending packets
         uint8_t *buffer_read_pointer; // only for sending packets
         uint32_t buffer_pending_bytes; // only for sending packets
+        struct timespec timestamp;
         int pool_pos;
 } frescan_packet_t;
 
index e00fd833eef0c23b42ae448a7e5b7a735ecfb5eb..681c7161d7ccf7ee40f703fee355e26de66f1aed 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <stdlib.h>
+#include <time.h>
 
 #include "frescan_queues.h"
 #include "frescan_packets.h"
@@ -285,6 +286,8 @@ int frescan_servers_enqueue(frescan_network_t net,
 {
         DEBUG(FRESCAN_SERVERS_ENABLE_DEBUG, "enqueue packet for id:%u\n", id);
 
+        clock_gettime (CLOCK_MONOTONIC, &packet->timestamp);
+
         // add the packet to the server fifo list
         list_add_tail(&packet->fifo_list,
                        &the_servers_pool[net][id].packet_list.fifo_list);
index 58d76a401d75803b2f7af89ae623b775279785e0..d0ea18cf2c641f75d9dd127567ea91cdb33df33a 100644 (file)
@@ -243,7 +243,8 @@ int frescan_replenishments_init(frescan_network_t net)
  */
 
 int frescan_replenishment_program(frescan_network_t net,
-                                  frescan_ss_t ss)
+                                  frescan_ss_t ss,
+                                  const struct timespec *timestamp)
 {
         int ret;
         frescan_repl_op_t *repl;
@@ -264,7 +265,7 @@ int frescan_replenishment_program(frescan_network_t net,
                 return -1;
         }
 
-        clock_gettime (CLOCK_MONOTONIC, &repl->when);
+        repl->when = *timestamp;
         incr_timespec (&repl->when, &server->params.values.period);
         repl->amount = 1;
 
index 0a10d0662639ad8add7c341d93b8faf9df0a3064..3d4e979423a75d85668cf696531b26c77a31e1d4 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef _MARTE_FRESCAN_SERVERS_REPLENISHMENTS_H_
 #define _MARTE_FRESCAN_SERVERS_REPLENISHMENTS_H_
 
+#include <time.h>
 #include "frescan.h" // frescan_network_t
 
 /**
@@ -48,6 +49,7 @@ extern int frescan_replenishments_init(frescan_network_t net);
  */
 
 extern int frescan_replenishment_program(frescan_network_t net,
-                                         frescan_ss_t ss);
+                                         frescan_ss_t ss,
+                                         const struct timespec *timestamp);
 
 #endif // _MARTE_FRESCAN_SERVERS_REPLENISHMENTS_H_