include/none/canfestival.h
author Christian Taedcke <Christian.Taedcke@ica-traffic.de>
Tue, 23 Feb 2010 08:12:19 +0100
changeset 642 f77ad188c2b1
parent 619 96f84395154f
permissions -rw-r--r--
ADDED: - pause() for win32
* * *
CHANGED: - moved pause implementation to main.cpp
- default driver to ixxat, baudrate to 125K and slaveid to 0x40
* * *
FIXED: - append "K" to baudrate
- added TimerInit()
618
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     1
#ifndef CANFESTIVAL_H_
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     2
#define CANFESTIVAL_H_
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     3
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     4
#include "timerscfg.h"
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     5
#include "can_driver.h"
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     6
#include "data.h"
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     7
#include "timers_driver.h"
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
     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
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    10
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    11
/** @defgroup userapi User API */
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    12
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    13
/** @defgroup can CAN management
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    14
 *  @ingroup userapi
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    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
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    25
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    26
/**
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    27
 * @brief Send a CAN message
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    28
 * @param port CanFestival file descriptor
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    29
 * @param *m The CAN message to send
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    30
 * @return 0 if succes
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    31
 */
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    32
UNS8 canSend(CAN_PORT port, Message *m);
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    33
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    34
/**
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    35
 * @ingroup can
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    36
 * @brief Open a CANOpen device
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    37
 * @param *board Pointer to the board structure that contains busname and baudrate 
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    38
 * @param *d Pointer to the CAN object data structure
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    39
 * @return
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    40
 *       - CanFestival file descriptor is returned upon success.
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    41
 *       - NULL is returned if the CANOpen board can't be opened.
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    42
 */
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    43
CAN_PORT canOpen(s_BOARD *board, CO_Data * d);
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    44
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    45
/**
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    46
 * @ingroup can
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    47
 * @brief Close a CANOpen device
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    48
 * @param *d Pointer to the CAN object data structure
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    49
 * @return
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    50
 *       - 0 is returned upon success.
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    51
 *       - errorcode if error. (if implemented)  
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    52
 */
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    53
int canClose(CO_Data * d);
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    54
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    55
/**
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    56
 * @ingroup can
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    57
 * @brief Change the CANOpen device baudrate 
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    58
 * @param port CanFestival file descriptor 
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    59
 * @param *baud The new baudrate to assign
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    60
 * @return
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    61
 *       - 0 is returned upon success or if not supported by the CAN driver.
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    62
 *       - errorcode from the CAN driver is returned if an error occurs. (if implemented in the CAN driver)
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    63
 */
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    64
UNS8 canChangeBaudRate(CAN_PORT port, char* baud);
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    65
564a4a9862b1 added 'none' taget for building standalone library
edouard
parents:
diff changeset
    66
#endif