]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_hw_buffer.c
makefile changes in rtep and frescan for current marte version (1.9_5nov2008)
[frescor/fna.git] / src_frescan / frescan_hw_buffer.c
index f2996c710bb7e1bf29c9e27f39f9e6fa5cfbb00b..3608cf59e2ef8d5341cb41d8b6de4804d759acd5 100644 (file)
  *
  * @license
  *
- * See MaRTE OS license
+ * -----------------------------------------------------------------------
+ *  Copyright (C) 2006 - 2008 FRESCOR consortium partners:
+ *
+ *    Universidad de Cantabria,              SPAIN
+ *    University of York,                    UK
+ *    Scuola Superiore Sant'Anna,            ITALY
+ *    Kaiserslautern University,             GERMANY
+ *    Univ. Politécnica  Valencia,           SPAIN
+ *    Czech Technical University in Prague,  CZECH REPUBLIC
+ *    ENEA                                   SWEDEN
+ *    Thales Communication S.A.              FRANCE
+ *    Visual Tools S.A.                      SPAIN
+ *    Rapita Systems Ltd                     UK
+ *    Evidence                               ITALY
+ *
+ *    See http://www.frescor.org for a link to partners' websites
+ *
+ *           FRESCOR project (FP6/2005/IST/5-034026) is funded
+ *        in part by the European Union Sixth Framework Programme
+ *        The European Union is not liable of any use that may be
+ *        made of this code.
+ *
+ *  This file is part of FRESCAN
+ *
+ *  FRESCAN is free software; you can  redistribute it and/or  modify
+ *  it under the terms of  the GNU General Public License as published by
+ *  the Free Software Foundation;  either  version 2, or (at  your option)
+ *  any later version.
+ *
+ *  FRESCAN  is distributed  in  the hope  that  it  will  be useful,  but
+ *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
+ *  MERCHANTABILITY  or  FITNESS FOR  A  PARTICULAR PURPOSE. See  the  GNU
+ *  General Public License for more details.
+ *
+ *  You should have  received a  copy of  the  GNU  General Public License
+ *  distributed  with  FRESCAN;  see file COPYING.   If not,  write to the
+ *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
+ *  02111-1307, USA.
+ *
+ * As a special exception, including FRESCAN header files in a file,
+ * instantiating FRESCAN generics or templates, or linking other files
+ * with FRESCAN objects to produce an executable application, does not
+ * by itself cause the resulting executable application to be covered
+ * by the GNU General Public License. This exception does not
+ * however invalidate any other reasons why the executable file might be
+ * covered by the GNU Public License.
+ * -----------------------------------------------------------------------
  *
  */
 
@@ -28,7 +74,7 @@
 #include <string.h> // memcpy
 
 #include "frescan_data.h"    // the_networks
-#include "frescan_debug.h"   // DEBUG, ERROR
+#include "frescan_debug.h"   // DEBUG, FRESCAN_ERROR
 #include "frescan_servers.h" // frescan_servers_get_highest_prio
 #include "frescan_queues.h"  // frescan_pqueue_xxx, frescan_servers_dequeue
 #include "frescan_id.h"      // frescan_id_set_field
  * buffer of the chip. It is useful to prevent priority inversion when there
  * is another packet with highest priority waiting in the frescan queues.
  *
- * TODO: implement it
+ * NOTE: if the frame is already being transmitted it won't abort it. In both
+ * cases a IRQ will be raised and either 'frescan_hook_frame_sent' or
+ * 'frescan_hook_frame_aborted' will be called.
  */
 
 int frescan_hw_buffer_abort(frescan_network_t net)
 {
-//         int ret;
-//
-//         ret = ioctl(the_networks[net].fd,
-//                     CAN_IOCTL_ABORT_FRAME, NULL);
-//         if (ret == -1) {
-//                 ERROR ("could not abort the frame\n");
-//                 return -1;
-//         }
-        ERROR ("NOT IMPLEMENTED\n");
-        return -1;
+        int ret;
+
+        ret = ioctl(the_networks[net].fd, CAN_IOCTL_ABORT_FRAME, NULL);
+        if (ret == -1) {
+                FRESCAN_ERROR ("could not abort the frame\n");
+                return -1;
+        }
+
+        return 0;
 }
 
 /**
@@ -112,7 +159,7 @@ int frescan_hw_buffer_update(frescan_network_t net)
                 DEBUG(FRESCAN_HW_BUFFER_ENABLE_DEBUG,"abort frame\n");
                 ret = frescan_hw_buffer_abort(net);
                 if (ret != 0) {
-                        ERROR ("could not abort frame\n");
+                        FRESCAN_ERROR ("could not abort frame\n");
                         return ret;
                 }
                 return 0;
@@ -162,7 +209,7 @@ int frescan_hw_buffer_update(frescan_network_t net)
                     sizeof(struct can_frame_t));
 
         if (ret != sizeof(struct can_frame_t)) {
-                ERROR ("could not send frame\n");
+                FRESCAN_ERROR ("could not send frame\n");
                 return ret;
         }