375
|
1 |
/*
|
|
2 |
This file is part of CanFestival, a library implementing CanOpen Stack.
|
|
3 |
|
|
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN
|
|
5 |
AVR Port: Andreas GLAUSER and Peter CHRISTEN
|
|
6 |
|
|
7 |
See COPYING file for copyrights details.
|
|
8 |
|
|
9 |
This library is free software; you can redistribute it and/or
|
|
10 |
modify it under the terms of the GNU Lesser General Public
|
|
11 |
License as published by the Free Software Foundation; either
|
|
12 |
version 2.1 of the License, or (at your option) any later version.
|
|
13 |
|
|
14 |
This library is distributed in the hope that it will be useful,
|
|
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17 |
Lesser General Public License for more details.
|
|
18 |
|
|
19 |
You should have received a copy of the GNU Lesser General Public
|
|
20 |
License along with this library; if not, write to the Free Software
|
|
21 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef __CAN_AVR__
|
|
25 |
#define __CAN_AVR__
|
|
26 |
|
|
27 |
// AVR implementation of the CANopen driver includes
|
|
28 |
// Hardware related macros and ATMEL lib can_drv
|
|
29 |
#include "config.h"
|
|
30 |
#include "can_drv.h"
|
|
31 |
|
|
32 |
// Canfestivals includes
|
|
33 |
#include "can.h"
|
|
34 |
|
|
35 |
// Number of receive MOb
|
|
36 |
#define NB_RX_MOB 13 // minimal 8
|
|
37 |
// Number of transmit MOb
|
|
38 |
#define NB_TX_MOB (NB_MOB - NB_RX_MOB)
|
|
39 |
|
|
40 |
#if (NB_TX_MOB < 1)
|
|
41 |
#error define less RX Mobs, you must have at least 1 TX MOb!
|
|
42 |
#elif (NB_RX_MOB < 8)
|
|
43 |
#error define at least 8 RX MObs!
|
|
44 |
#endif
|
|
45 |
|
|
46 |
#define START_TX_MOB NB_RX_MOB
|
|
47 |
#define TX_INT_MSK ((0x7F << (7 - NB_TX_MOB)) & 0x7F)
|
|
48 |
|
|
49 |
/************************* To be called by user app ***************************/
|
|
50 |
|
|
51 |
unsigned char canInit(unsigned int bitrate);
|
|
52 |
unsigned char canSend(CAN_PORT notused, Message *m);
|
|
53 |
unsigned char canReceive(Message *m);
|
384
|
54 |
unsigned char canChangeBaudRate_driver( CAN_HANDLE fd, char* baud);
|
375
|
55 |
#endif
|