examples/SillySlave/main.h
author etisserant
Thu, 05 Jun 2008 08:04:30 +0200
changeset 476 08cdcb021beb
parent 400 7d845f5d730c
child 642 f77ad188c2b1
permissions -rw-r--r--
serious typo in dcf.c
400
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     1
/*
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     2
Copyright (C): Giuseppe Massimo BERTANI
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     3
gmbertani@users.sourceforge.net
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     4
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     5
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     7
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    12
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    17
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    21
*/
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    22
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    23
/**
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    24
 * @file main.h
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    25
 * @author GMB
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    26
 * @date 17/1/08
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    27
 *
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    28
 * This file is part of SillySlave demo for CANfestival
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    29
 * open source CANopen stack.
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    30
 */ 
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    31
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    32
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    33
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    34
#ifndef _MAIN_H
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    35
 #define _MAIN_H
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    36
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    37
#if defined(WIN32) && !defined(__CYGWIN__)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    38
#include <windows.h>
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    39
#include "getopt.h"
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    40
void pause(void)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    41
{
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    42
	system("PAUSE");
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    43
}
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    44
#else
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    45
#include <unistd.h>
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    46
#include <stdio.h>
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    47
#include <string.h>
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    48
#include <stdlib.h>
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    49
#include <signal.h>
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    50
#endif
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    51
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    52
#include "canfestival.h"
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    53
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    54
/*
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    55
 * Please tune the following defines to suit your needs:
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    56
 */
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    57
#define NODE_MASTER 0x1        
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    58
#define NODE_SLAVE  0x12        
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    59
#define DRIVER_LIBRARY "libcanfestival_can_kvaser.so"
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    60
#define BAUDRATE 250000
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    61
#define BUS 0
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    62
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    63
#endif /* _MAIN_H */
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    64
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    65