examples/rtai/rtai_sample.c
changeset 1942 cd6ff5adae84
parent 1935 8ea1033bd4c2
child 2024 96e2ae6cce95
child 2421 bc2d4bf9cbe5
equal deleted inserted replaced
1941:e12266a4f473 1942:cd6ff5adae84
    74 /*****************************************************************************/
    74 /*****************************************************************************/
    75 
    75 
    76 // process data
    76 // process data
    77 static uint8_t *domain1_pd; // process data memory
    77 static uint8_t *domain1_pd; // process data memory
    78 
    78 
    79 #define AnaInSlavePos  0, 1
    79 #define AnaInSlavePos  0, 3
    80 #define DigOutSlavePos 0, 3
    80 #define DigOutSlavePos 0, 2
    81 
    81 
    82 #define Beckhoff_EL2004 0x00000002, 0x07D43052
    82 #define Beckhoff_EL2004 0x00000002, 0x07D43052
    83 #define Beckhoff_EL3162 0x00000002, 0x0C5A3052
    83 #define Beckhoff_EL3162 0x00000002, 0x0C5A3052
    84 
    84 
    85 static unsigned int off_ana_in; // offsets for PDO entries
    85 static unsigned int off_ana_in; // offsets for PDO entries
   284     rt_sem_init(&master_sem, 1);
   284     rt_sem_init(&master_sem, 1);
   285 
   285 
   286     t_critical = cpu_khz * 1000 / FREQUENCY - cpu_khz * INHIBIT_TIME / 1000;
   286     t_critical = cpu_khz * 1000 / FREQUENCY - cpu_khz * INHIBIT_TIME / 1000;
   287 
   287 
   288     master = ecrt_request_master(0);
   288     master = ecrt_request_master(0);
   289     if (IS_ERR(master)) {
   289     if (!master) {
   290         ret = PTR_ERR(master); 
   290         ret = -EBUSY; 
   291         printk(KERN_ERR PFX "Requesting master 0 failed!\n");
   291         printk(KERN_ERR PFX "Requesting master 0 failed!\n");
   292         goto out_return;
   292         goto out_return;
   293     }
   293     }
   294 
   294 
   295     ecrt_master_callbacks(master, send_callback, receive_callback, master);
   295     ecrt_master_callbacks(master, send_callback, receive_callback, master);