include/none/canfestival.h
author gabriele at naustech dot com
Thu, 12 Jun 2014 14:07:16 +0200
changeset 791 7740ac6fdedc
parent 619 96f84395154f
permissions -rw-r--r--
Fix : libcanfestival_unix.a not built if examples are not compiled

Problem: when building Canfestival with unix timers 'libcanfestiva_unix.a'
is built only if you build examples too.

Test case:

$ ./configure --timers=unix --can=socket --target=unix
$ make canfestival

...

no errors but 'libcanfestival_unix.a' is not built:
$ find . -name "*.a"
./src/libcanfestival.a

Changing line 90 of 'drivers/unix/Makefile.in' to:
#driver: $(OBJS)
driver: libcanfestival_$(TARGET).a

solves the problem:

$ ./configure --timers=unix --can=socket --target=unix
$ make canfestival

...

$ find . -name "*.a"
./drivers/unix/libcanfestival_unix.a
./src/libcanfestival.a
#ifndef CANFESTIVAL_H_
#define CANFESTIVAL_H_

#include "timerscfg.h"
#include "can_driver.h"
#include "data.h"
#include "timers_driver.h"

typedef void* LIB_HANDLE;

/** @defgroup userapi User API */

/** @defgroup can CAN management
 *  @ingroup userapi
 */
/**
 * @ingroup can
 * @brief Load CAN driver interface.
 * @param *driver_name The location of the library to load
 * @return
 *       - handle of the CAN driver interface is returned upon success.
 *       - NULL is returned if the CAN driver interface can't be loaded.
 */
#define LoadCanDriver(driver_name) 1

/**
 * @brief Send a CAN message
 * @param port CanFestival file descriptor
 * @param *m The CAN message to send
 * @return 0 if succes
 */
UNS8 canSend(CAN_PORT port, Message *m);

/**
 * @ingroup can
 * @brief Open a CANOpen device
 * @param *board Pointer to the board structure that contains busname and baudrate 
 * @param *d Pointer to the CAN object data structure
 * @return
 *       - CanFestival file descriptor is returned upon success.
 *       - NULL is returned if the CANOpen board can't be opened.
 */
CAN_PORT canOpen(s_BOARD *board, CO_Data * d);

/**
 * @ingroup can
 * @brief Close a CANOpen device
 * @param *d Pointer to the CAN object data structure
 * @return
 *       - 0 is returned upon success.
 *       - errorcode if error. (if implemented)  
 */
int canClose(CO_Data * d);

/**
 * @ingroup can
 * @brief Change the CANOpen device baudrate 
 * @param port CanFestival file descriptor 
 * @param *baud The new baudrate to assign
 * @return
 *       - 0 is returned upon success or if not supported by the CAN driver.
 *       - errorcode from the CAN driver is returned if an error occurs. (if implemented in the CAN driver)
 */
UNS8 canChangeBaudRate(CAN_PORT port, char* baud);

#endif