peter@521: /* peter@521: This file is part of CanFestival, a library implementing CanOpen Stack. peter@521: peter@521: Copyright (C): Edouard TISSERANT and Francis DUPIN peter@521: AT91 Port: Peter CHRISTEN peter@521: peter@521: See COPYING file for copyrights details. peter@521: peter@521: This library is free software; you can redistribute it and/or peter@521: modify it under the terms of the GNU Lesser General Public peter@521: License as published by the Free Software Foundation; either peter@521: version 2.1 of the License, or (at your option) any later version. peter@521: peter@521: This library is distributed in the hope that it will be useful, peter@521: but WITHOUT ANY WARRANTY; without even the implied warranty of peter@521: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU peter@521: Lesser General Public License for more details. peter@521: peter@521: You should have received a copy of the GNU Lesser General Public peter@521: License along with this library; if not, write to the Free Software peter@521: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA peter@521: */ peter@521: peter@521: #ifndef __CAN_AT91__ peter@521: #define __CAN_AT91__ peter@521: peter@521: #include "config.h" peter@521: peter@521: // Canfestivals includes peter@521: #include "can.h" peter@521: peter@521: // Number of receive MB peter@521: #define NB_MB 8 peter@521: #define NB_RX_MB 4 peter@521: // Number of transmit MB peter@521: #define NB_TX_MB (NB_MB - NB_RX_MB) peter@521: peter@521: #if (NB_TX_MB < 1) peter@521: #error define less RX MBs, you must have at least 1 TX MB! peter@521: #elif (NB_RX_MB < 1) peter@521: #error define at least 1 RX MBs! peter@521: #endif peter@521: peter@521: #define START_TX_MB NB_RX_MB peter@521: #define TX_INT_MSK ((0xFF << (NB_MB - NB_TX_MB)) & 0xFF) peter@521: #define RX_INT_MSK (0xFF >> (NB_MB - NB_RX_MB)) peter@521: peter@521: /************************* To be called by user app ***************************/ peter@521: peter@521: unsigned char canInit(unsigned int bitrate); peter@521: unsigned char canSend(CAN_PORT notused, Message *m); peter@521: unsigned char canReceive(Message *m); peter@521: #endif