author | edouard |
Fri, 10 Sep 2010 13:44:56 +0200 | |
changeset 627 | 4939452b1bf1 |
parent 561 | f9be4262c68d |
permissions | -rwxr-xr-x |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
1 |
#ifndef UNIX_H_ |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
2 |
#define UNIX_H_ |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
3 |
|
251 | 4 |
#ifdef __cplusplus |
5 |
extern "C" { |
|
6 |
#endif |
|
7 |
||
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
8 |
#include "timerscfg.h" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
9 |
#include "can_driver.h" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
10 |
#include "data.h" |
167 | 11 |
#include "timers_driver.h" |
329 | 12 |
|
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
384
diff
changeset
|
13 |
#ifndef __KERNEL__ |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
14 |
#include <dlfcn.h> |
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
384
diff
changeset
|
15 |
#endif |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
384
diff
changeset
|
16 |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
17 |
typedef void* LIB_HANDLE; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
18 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
19 |
/** @defgroup userapi User API */ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
20 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
21 |
/** @defgroup can CAN management |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
22 |
* @ingroup userapi |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
23 |
*/ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
24 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
25 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
26 |
* @ingroup can |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
27 |
* @brief Unload CAN driver interface |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
28 |
* @param handle The library handle |
561 | 29 |
* @return |
30 |
* - 0 is returned upon success. |
|
31 |
* - -1 is returned if the CAN driver interface can't be unloaded. |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
32 |
*/ |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
33 |
UNS8 UnLoadCanDriver(LIB_HANDLE handle); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
34 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
35 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
36 |
* @ingroup can |
561 | 37 |
* @brief Load CAN driver interface. |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
38 |
* @param *driver_name The location of the library to load |
561 | 39 |
* @return |
40 |
* - handle of the CAN driver interface is returned upon success. |
|
41 |
* - NULL is returned if the CAN driver interface can't be loaded. |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
42 |
*/ |
480 | 43 |
LIB_HANDLE LoadCanDriver(const char* driver_name); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
44 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
45 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
46 |
* @brief Send a CAN message |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
47 |
* @param port CanFestival file descriptor |
561 | 48 |
* @param *m The CAN message to send |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
49 |
* @return 0 if succes |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
50 |
*/ |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
51 |
UNS8 canSend(CAN_PORT port, Message *m); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
52 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
53 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
54 |
* @ingroup can |
561 | 55 |
* @brief Open a CANOpen device |
56 |
* @param *board Pointer to the board structure that contains busname and baudrate |
|
57 |
* @param *d Pointer to the CAN object data structure |
|
58 |
* @return |
|
59 |
* - CanFestival file descriptor is returned upon success. |
|
60 |
* - NULL is returned if the CANOpen board can't be opened. |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
61 |
*/ |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
62 |
CAN_PORT canOpen(s_BOARD *board, CO_Data * d); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
63 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
64 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
65 |
* @ingroup can |
561 | 66 |
* @brief Close a CANOpen device |
67 |
* @param *d Pointer to the CAN object data structure |
|
68 |
* @return |
|
69 |
* - 0 is returned upon success. |
|
70 |
* - errorcode if error. (if implemented) |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
71 |
*/ |
149 | 72 |
int canClose(CO_Data * d); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
73 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
74 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
75 |
* @ingroup can |
561 | 76 |
* @brief Change the CANOpen device baudrate |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
77 |
* @param port CanFestival file descriptor |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
78 |
* @param *baud The new baudrate to assign |
561 | 79 |
* @return |
80 |
* - 0 is returned upon success or if not supported by the CAN driver. |
|
81 |
* - errorcode from the CAN driver is returned if an error occurs. (if implemented in the CAN driver) |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
82 |
*/ |
384 | 83 |
UNS8 canChangeBaudRate(CAN_PORT port, char* baud); |
561 | 84 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
480
diff
changeset
|
85 |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
86 |
|
251 | 87 |
#ifdef __cplusplus |
88 |
}; |
|
89 |
#endif |
|
90 |
||
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff
changeset
|
91 |
#endif /*UNIX_H_*/ |