etisserant@375: /* etisserant@375: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@375: etisserant@375: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@375: AVR Port: Andreas GLAUSER and Peter CHRISTEN etisserant@375: etisserant@375: See COPYING file for copyrights details. etisserant@375: etisserant@375: This library is free software; you can redistribute it and/or etisserant@375: modify it under the terms of the GNU Lesser General Public etisserant@375: License as published by the Free Software Foundation; either etisserant@375: version 2.1 of the License, or (at your option) any later version. etisserant@375: etisserant@375: This library is distributed in the hope that it will be useful, etisserant@375: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@375: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@375: Lesser General Public License for more details. etisserant@375: etisserant@375: You should have received a copy of the GNU Lesser General Public etisserant@375: License along with this library; if not, write to the Free Software etisserant@375: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@375: */ etisserant@375: etisserant@375: #ifndef __CAN_AVR__ etisserant@375: #define __CAN_AVR__ etisserant@375: etisserant@375: // AVR implementation of the CANopen driver includes etisserant@375: // Hardware related macros and ATMEL lib can_drv etisserant@375: #include "config.h" etisserant@375: #include "can_drv.h" etisserant@375: etisserant@375: // Canfestivals includes etisserant@375: #include "can.h" etisserant@375: etisserant@375: // Number of receive MOb etisserant@375: #define NB_RX_MOB 13 // minimal 8 etisserant@375: // Number of transmit MOb etisserant@375: #define NB_TX_MOB (NB_MOB - NB_RX_MOB) etisserant@375: etisserant@375: #if (NB_TX_MOB < 1) etisserant@375: #error define less RX Mobs, you must have at least 1 TX MOb! etisserant@375: #elif (NB_RX_MOB < 8) etisserant@375: #error define at least 8 RX MObs! etisserant@375: #endif etisserant@375: etisserant@375: #define START_TX_MOB NB_RX_MOB etisserant@375: #define TX_INT_MSK ((0x7F << (7 - NB_TX_MOB)) & 0x7F) etisserant@375: etisserant@375: /************************* To be called by user app ***************************/ etisserant@375: etisserant@375: unsigned char canInit(unsigned int bitrate); etisserant@375: unsigned char canSend(CAN_PORT notused, Message *m); etisserant@375: unsigned char canReceive(Message *m); groke6@384: unsigned char canChangeBaudRate_driver( CAN_HANDLE fd, char* baud); etisserant@375: #endif