examples/xenomai/main.c
changeset 2056 a92e8f119723
parent 2055 d246ab6b50d2
child 2589 2b9c78543663
equal deleted inserted replaced
2055:d246ab6b50d2 2056:a92e8f119723
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  *  $Id$
     3  *  $Id$
     4  *
     4  *
     5  *  usermdtest.c	Copyright (C) 2009-2010  Moehwald GmbH B.Benner
     5  *  main.c	        Copyright (C) 2009-2010  Moehwald GmbH B.Benner
     6  *                                2011       IgH Andreas Stewering-Bone
     6  *                                2011       IgH Andreas Stewering-Bone
     7  *
     7  *
     8  *  This file is part of ethercatrtdm interface to IgH EtherCAT master 
     8  *  This file is part of ethercatrtdm interface to IgH EtherCAT master 
     9  *  
     9  *  
    10  *  The Moehwald ethercatrtdm interface is free software; you can
    10  *  The Moehwald ethercatrtdm interface is free software; you can
    57 RT_TASK my_task;
    57 RT_TASK my_task;
    58 
    58 
    59 int rt_fd = -1;
    59 int rt_fd = -1;
    60 int run=0;
    60 int run=0;
    61 
    61 
    62 //struct timeval tv;
       
    63 unsigned int sync_ref_counter = 0;
    62 unsigned int sync_ref_counter = 0;
    64 
    63 
    65 CstructMstrAttach MstrAttach;
    64 CstructMstrAttach MstrAttach;
    66 
    65 
    67 /****************************************************************************/
    66 /****************************************************************************/
    68 
    67 
    69 // Application parameters
    68 
    70 //#define FREQUENCY 1000
       
    71 //#define PRIORITY 1
       
    72 
    69 
    73 // Optional features
    70 // Optional features
    74 #define CONFIGURE_PDOS  1
    71 #define CONFIGURE_PDOS  1
    75 //#define SDO_ACCESS      1
    72 //#define SDO_ACCESS      1
    76 
    73 
   575 
   572 
   576   RTIME periodns;
   573   RTIME periodns;
   577   float period;
   574   float period;
   578 
   575 
   579 
   576 
   580   period=1E-4;
   577   period=1E-3; //1kHz
   581 
   578 
   582   
   579   
   583   periodns=(RTIME)(((double)period * 1E9) + 0.4999999);
   580   periodns=(RTIME)(((double)period * 1E9) + 0.4999999);
   584   rt_task_set_periodic(NULL, TM_NOW, periodns);
   581   rt_task_set_periodic(NULL, TM_NOW, periodns);
   585 
   582