include/unix/canfestival.h
author etisserant
Tue, 17 Mar 2009 00:03:18 +0100
changeset 539 187058b4a4b8
parent 529 c171e11707c5
child 561 f9be4262c68d
permissions -rw-r--r--
Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
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
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
     4
#ifdef __cplusplus
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
     5
extern "C" {
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
     6
#endif
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
     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
b2f8b91d89b5 Removed compilation warnings with some GCC.
etisserant
parents: 149
diff changeset
    11
#include "timers_driver.h"
329
7717252e3ed9 Changes to compile for win32
greg
parents: 251
diff changeset
    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
 * @{
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    28
 */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    29
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    30
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    31
 * @ingroup can
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    32
 * @brief Unload CAN driver interface
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    33
 * @param handle The library handle
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    34
 * @return 0 if succes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    35
 */
145
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff changeset
    36
UNS8 UnLoadCanDriver(LIB_HANDLE handle);
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    37
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    38
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    39
 * @ingroup can
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    40
 * @brief Load CAN driver interface
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    41
 * @param *driver_name The location of the library to load
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    42
 * @return handle The library handle
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    43
 */
480
d0d76932ad74 Added missing const for dll names strings
etisserant
parents: 391
diff changeset
    44
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
    45
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    46
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    47
 * @brief Send a CAN message
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    48
 * @param port CanFestival file descriptor
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    49
 * @param *m The message to send
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    50
 * @return 0 if succes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    51
 */
145
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff changeset
    52
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
    53
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    54
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    55
 * @ingroup can
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    56
 * @brief Open a CANopen device
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    57
 * @param *board Pointer on the board structure that contains busname and baudrate 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    58
 * @param *d Pointer on the CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    59
 * @return port CanFestival file descriptor
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    60
 */
145
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff changeset
    61
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
    62
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
 * @ingroup can
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
    65
 * @brief Close a CANopen device
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    66
 * @param *d Pointer on the CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    67
 * @return 0 if succes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    68
 */
149
fe50ada8020b Changes in the API:
etisserant
parents: 145
diff changeset
    69
int canClose(CO_Data * d);
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    70
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    71
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    72
 * @ingroup can
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
    73
 * @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
    74
 * @param port CanFestival file descriptor 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    75
 * @param *baud The new baudrate to assign
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    76
 * @return 0 if succes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    77
 */
384
83793fc7ce48 added canChangeBaudRate to the driver interface
groke6
parents: 329
diff changeset
    78
UNS8 canChangeBaudRate(CAN_PORT port, char* baud);
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    79
/** @} */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 480
diff changeset
    80
145
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff changeset
    81
251
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
    82
#ifdef __cplusplus
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
    83
};
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
    84
#endif
cab66ef3e68e Some fixes for C++
etisserant
parents: 167
diff changeset
    85
145
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
diff changeset
    86
#endif /*UNIX_H_*/