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