nico@215: nico@215:
nico@215:00001 /* nico@215: 00002 This file is part of CanFestival, a library implementing CanOpen Stack. nico@215: 00003 nico@215: 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN nico@215: 00005 nico@215: 00006 See COPYING file for copyrights details. nico@215: 00007 nico@215: 00008 This library is free software; you can redistribute it and/or nico@215: 00009 modify it under the terms of the GNU Lesser General Public nico@215: 00010 License as published by the Free Software Foundation; either nico@215: 00011 version 2.1 of the License, or (at your option) any later version. nico@215: 00012 nico@215: 00013 This library is distributed in the hope that it will be useful, nico@215: 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of nico@215: 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU nico@215: 00016 Lesser General Public License for more details. nico@215: 00017 nico@215: 00018 You should have received a copy of the GNU Lesser General Public nico@215: 00019 License along with this library; if not, write to the Free Software nico@215: 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA nico@215: 00021 */ nico@215: 00022 #ifdef USE_XENO nico@215: 00023 //#define eprintf(...) if(0){} nico@215: 00024 #define eprintf(...) nico@215: 00025 #else etisserant@240: 00026 #define eprintf(...) printf (__VA_ARGS__) nico@215: 00027 #endif etisserant@240: 00028 void print_message(Message *m); nico@215: 00029 nico@215: 00030 /*UNS8 canSend(CAN_HANDLE fd0, Message *m);*/ nico@215: 00031 nico@215: 00032 #include "canfestival.h" nico@215: 00033 nico@215: 00034 /* nico@215: 00035 #define CAN_FIFO_LENGTH 100 nico@215: 00036 nico@215: 00037 #define DECLARE_A_CAN_FIFO \ nico@215: 00038 static Message FIFO[CAN_FIFO_LENGTH];\ nico@215: 00039 static int FIFO_First = 0;\ nico@215: 00040 static int FIFO_Last = 0;\ nico@215: 00041 \ nico@215: 00042 static void PutInFIFO(Message *m)\ nico@215: 00043 {\ nico@215: 00044 FIFO[FIFO_Last++] = *m;\ nico@215: 00045 FIFO_Last %= CAN_FIFO_LENGTH;\ nico@215: 00046 }\ nico@215: 00047 \ nico@215: 00048 static void GetFromFIFO(Message *m)\ nico@215: 00049 {\ nico@215: 00050 *m = FIFO[FIFO_First++];\ nico@215: 00051 FIFO_First %= CAN_FIFO_LENGTH;\ nico@215: 00052 }\ nico@215: 00053 \ nico@215: 00054 static void TransmitMessage(CO_Data* d, UNS32 id)\ nico@215: 00055 {\ nico@215: 00056 Message m;\ nico@215: 00057 GetFromFIFO(&m);\ nico@215: 00058 canDispatch(d, &m);\ nico@215: 00059 } nico@215: 00060 */ etisserant@240: