etisserant@400: /* etisserant@400: Copyright (C): Giuseppe Massimo BERTANI etisserant@400: gmbertani@users.sourceforge.net etisserant@400: etisserant@400: etisserant@400: See COPYING file for copyrights details. etisserant@400: etisserant@400: This library is free software; you can redistribute it and/or etisserant@400: modify it under the terms of the GNU Lesser General Public etisserant@400: License as published by the Free Software Foundation; either etisserant@400: version 2.1 of the License, or (at your option) any later version. etisserant@400: etisserant@400: This library is distributed in the hope that it will be useful, etisserant@400: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@400: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@400: Lesser General Public License for more details. etisserant@400: etisserant@400: You should have received a copy of the GNU Lesser General Public etisserant@400: License along with this library; if not, write to the Free Software etisserant@400: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@400: */ etisserant@400: etisserant@400: /** etisserant@400: * @file main.c etisserant@400: * @author GMB etisserant@400: * @date 17/1/08 etisserant@400: * etisserant@400: * This file is part of SillySlave demo for CANfestival etisserant@400: * open source CANopen stack. etisserant@400: */ etisserant@400: etisserant@400: etisserant@400: #include "main.h" etisserant@400: #include "slave.h" etisserant@400: etisserant@400: #if !defined(WIN32) || defined(__CYGWIN__) etisserant@400: void catch_signal(int sig) etisserant@400: { etisserant@400: signal(SIGTERM, catch_signal); etisserant@400: signal(SIGINT, catch_signal); etisserant@400: etisserant@400: printf("Got Signal %d\n",sig); etisserant@400: } etisserant@400: #endif etisserant@400: etisserant@400: etisserant@400: /** etisserant@400: * Please edit main.h defines before compiling etisserant@400: */ etisserant@400: int main(int argc,char **argv) etisserant@400: { etisserant@400: char* LibraryPath= DRIVER_LIBRARY; etisserant@400: etisserant@400: #if !defined(WIN32) || defined(__CYGWIN__) etisserant@400: /* install signal handler for manual break */ etisserant@400: signal(SIGTERM, catch_signal); etisserant@400: signal(SIGINT, catch_signal); etisserant@400: #endif etisserant@400: etisserant@400: #ifndef NOT_USE_DYNAMIC_LOADING etisserant@400: LoadCanDriver(LibraryPath); etisserant@400: #endif etisserant@400: etisserant@400: etisserant@400: if(InitCANdevice( BUS, BAUDRATE, NODE_SLAVE ) < 0) etisserant@400: { etisserant@400: printf("\nInitCANdevice() failed, exiting.\n"); etisserant@400: return -1; etisserant@400: } etisserant@400: etisserant@400: return 0; etisserant@400: } etisserant@400: etisserant@400: