author | Christian Taedcke <hacking@taedcke.com> |
Mon, 23 Jan 2012 20:06:45 +0100 | |
changeset 702 | 8be1c1e5fb17 |
parent 619 | 96f84395154f |
permissions | -rw-r--r-- |
618 | 1 |
#ifndef CANFESTIVAL_H_ |
2 |
#define CANFESTIVAL_H_ |
|
3 |
||
4 |
#include "timerscfg.h" |
|
5 |
#include "can_driver.h" |
|
6 |
#include "data.h" |
|
7 |
#include "timers_driver.h" |
|
8 |
||
619
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
9 |
typedef void* LIB_HANDLE; |
618 | 10 |
|
11 |
/** @defgroup userapi User API */ |
|
12 |
||
13 |
/** @defgroup can CAN management |
|
14 |
* @ingroup userapi |
|
15 |
*/ |
|
619
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
16 |
/** |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
17 |
* @ingroup can |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
18 |
* @brief Load CAN driver interface. |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
19 |
* @param *driver_name The location of the library to load |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
20 |
* @return |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
21 |
* - handle of the CAN driver interface is returned upon success. |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
22 |
* - NULL is returned if the CAN driver interface can't be loaded. |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
23 |
*/ |
96f84395154f
Enhancements for 'None' target : produce pre-linked object, remove some windows CRLF problems, fixed pedantic compiler warnings
edouard
parents:
618
diff
changeset
|
24 |
#define LoadCanDriver(driver_name) 1 |
618 | 25 |
|
26 |
/** |
|
27 |
* @brief Send a CAN message |
|
28 |
* @param port CanFestival file descriptor |
|
29 |
* @param *m The CAN message to send |
|
30 |
* @return 0 if succes |
|
31 |
*/ |
|
32 |
UNS8 canSend(CAN_PORT port, Message *m); |
|
33 |
||
34 |
/** |
|
35 |
* @ingroup can |
|
36 |
* @brief Open a CANOpen device |
|
37 |
* @param *board Pointer to the board structure that contains busname and baudrate |
|
38 |
* @param *d Pointer to the CAN object data structure |
|
39 |
* @return |
|
40 |
* - CanFestival file descriptor is returned upon success. |
|
41 |
* - NULL is returned if the CANOpen board can't be opened. |
|
42 |
*/ |
|
43 |
CAN_PORT canOpen(s_BOARD *board, CO_Data * d); |
|
44 |
||
45 |
/** |
|
46 |
* @ingroup can |
|
47 |
* @brief Close a CANOpen device |
|
48 |
* @param *d Pointer to the CAN object data structure |
|
49 |
* @return |
|
50 |
* - 0 is returned upon success. |
|
51 |
* - errorcode if error. (if implemented) |
|
52 |
*/ |
|
53 |
int canClose(CO_Data * d); |
|
54 |
||
55 |
/** |
|
56 |
* @ingroup can |
|
57 |
* @brief Change the CANOpen device baudrate |
|
58 |
* @param port CanFestival file descriptor |
|
59 |
* @param *baud The new baudrate to assign |
|
60 |
* @return |
|
61 |
* - 0 is returned upon success or if not supported by the CAN driver. |
|
62 |
* - errorcode from the CAN driver is returned if an error occurs. (if implemented in the CAN driver) |
|
63 |
*/ |
|
64 |
UNS8 canChangeBaudRate(CAN_PORT port, char* baud); |
|
65 |
||
66 |
#endif |